/* Token defaults — theme.css (dark/light) overrides these after load. */
:root {
  --bg-deep: #0b0d10;
  --bg-panel: #171a21;
  --bg-card: #1c2028;
  --bg-sidebar: #0f1115;
  --text-primary: #f3f4f6;
  --text-muted: #9aa0ab;
  --text-secondary: #c5c7ce;
  --accent-cyan: #60cdff;
  --accent-green: #6ccb5f;
  --accent-purple: #3aa0ff;
  --accent-purple-bright: #60cdff;
  --accent-orange: #f7a300;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --glow-cyan: 0 0 0 1px rgba(96, 205, 255, 0.35);
  --glow-purple: 0 0 0 1px rgba(96, 205, 255, 0.28);
  --radius: 10px;
  --sidebar-width: 232px;
  --header-height: 44px;
  --brand-rail-height: 108px;
  --font-ui: "Segoe UI Variable", "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

body.broker-portal {
  margin: 0;
  font-family: var(--font-ui, "Segoe UI Variable", "Segoe UI", "Helvetica Neue", sans-serif);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
}

/* ── Geometric background ── */
.bg-geometry {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 55% 45%, rgba(0, 229, 255, 0.07) 0%, transparent 70%),
    var(--bg-deep);
}

.bg-geometry-svg {
  position: absolute;
  top: 50%;
  left: 55%;
  width: min(900px, 90vw);
  height: auto;
  transform: translate(-50%, -50%);
  opacity: 0.55;
  filter: drop-shadow(0 0 40px rgba(0, 229, 255, 0.15));
}

/* ── Sidebar brand (logo at top of sidebar column) ── */
.sidebar-brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--brand-rail-height);
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
}

.brand-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex-shrink: 0;
  text-decoration: none;
  line-height: 0;
  background: transparent;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(var(--brand-rail-height) - 0.65rem);
  object-fit: contain;
  object-position: center;
  background: transparent;
  filter: none;
}

/* ── Git branch switcher (top bar) ── */
.git-branch-bar {
  position: relative;
  z-index: 9;
  flex-shrink: 0;
  padding: 0.45rem 1rem 0.55rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(10, 16, 24, 0.92);
}

.git-branch-bar-simple {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.git-branch-hint {
  font-size: 0.72rem;
  color: var(--text-muted, #9aa4b2);
  font-weight: 500;
}

.git-branch-diag {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--text-muted, #9aa3b2);
  letter-spacing: 0.02em;
}

.git-branch-current {
  font-size: 0.78rem;
  font-weight: 700;
  color: #7ee7ff;
  margin-right: 0.35rem;
}

.git-branch-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #9aa4b2);
}

.git-branch-select {
  min-width: 16rem;
  max-width: 28rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(0, 229, 255, 0.25);
  background: #0b1220;
  color: #e8eef7;
  font-size: 0.8rem;
}

.git-branch-dirty {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: #ffcc80;
}

.git-branch-flash {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #b6f5d4;
}

.git-branch-busy {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #ffe7a8;
}

.git-branch-bar.is-busy .git-branch-select,
.git-branch-bar.is-busy .btn {
  opacity: 0.7;
}

@media (max-width: 900px) {
  .git-branch-select {
    min-width: 100%;
    max-width: 100%;
  }
}

/* ── Logout goodbye (close tab; do not return to login) ── */
.logout-goodbye {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(96, 205, 255, 0.12), transparent 45%),
    radial-gradient(ellipse at 70% 80%, rgba(20, 92, 66, 0.28), transparent 50%),
    var(--bg-app, #0f1419);
  color: var(--text-primary, #e8eef7);
}

.logout-goodbye-card {
  text-align: center;
  max-width: 28rem;
}

.logout-goodbye-card h1 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  font-weight: 750;
  letter-spacing: 0.01em;
}

.logout-goodbye-hint {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted, #9aa7b8);
}

.logout-goodbye-actions {
  margin-top: 1.1rem;
}

.logout-goodbye-actions .btn {
  min-width: 9rem;
}

.logout-goodbye-hint strong {
  color: var(--text-primary, #e8eef7);
}

.logout-goodbye-shortcut {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  color: var(--text-muted, #9aa7b8);
}

.logout-goodbye-shortcut kbd,
.logout-goodbye-hint kbd {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.65);
  font: 0.9em ui-monospace, Consolas, monospace;
  color: var(--text-primary, #e8eef7);
}

body.is-logged-out {
  overflow: hidden;
}

body.is-logged-out .layout,
body.is-logged-out .bg-geometry,
body.is-logged-out .git-sync-banner,
body.is-logged-out .active-work-rail {
  visibility: hidden;
  pointer-events: none;
}

/* ── Git sync status banner (launcher auto-pull) ── */
.git-sync-banner {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.git-sync-banner.is-hidden {
  display: none;
}

.git-sync-banner.is-updated {
  background: linear-gradient(90deg, #5c3b00, #8a5a00);
  color: #ffe7a8;
}

.git-sync-banner.is-up-to-date {
  background: linear-gradient(90deg, #0d3d2e, #145c42);
  color: #b6f5d4;
}

.git-sync-banner.is-skipped,
.git-sync-banner.is-error {
  background: linear-gradient(90deg, #3a2430, #5a3040);
  color: #ffd0dc;
}

.git-sync-banner-text {
  flex: 1 1 auto;
}

.git-sync-banner-dismiss {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  border-radius: 4px;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.git-sync-banner-dismiss:hover {
  background: rgba(0, 0, 0, 0.35);
}

/* ── Main column top chrome (wallet ticker + session row) ── */
.main-top-chrome {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: rgba(6, 8, 12, 0.98);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(10px);
}

.chrome-session-row {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-width: 0;
  padding: 0.2rem 0.5rem 0.25rem 0;
}

/* ── Global header (main column only — logo lives in sidebar) ── */
.global-header {
  position: relative;
  z-index: 10;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: var(--control-gap, 0.75rem);
  height: var(--header-height);
  min-height: var(--header-height);
  padding: 0 0.65rem;
  margin: 0;
  border-bottom: none;
  background: transparent;
  min-width: 0;
}

.brand-shield {
  width: 36px;
  height: 40px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text-primary);
}

.brand-sub {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--text-muted);
}

.header-spacer {
  flex: 1;
}

.header-icons {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2, 0.5rem);
}

.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 1.1rem;
  transition: color 0.15s, background 0.15s;
}

.header-icon-btn:hover {
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.08);
}

.wallet-pill {
  display: none;
}

/* ── Wallet balance ticker (top strip of main header) ── */
.wallet-ticker-bar {
  position: relative;
  z-index: 11;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 1.5rem;
  margin: 0;
  padding: 0 1rem;
  border-top: none;
  border-bottom: 1px solid rgba(0, 229, 255, 0.14);
  background: transparent;
  overflow: hidden;
}

.wallet-ticker-label {
  flex: 0 0 auto;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.wallet-ticker-viewport {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  mask-image: linear-gradient(
    90deg,
    transparent 0%,
    #000 4%,
    #000 96%,
    transparent 100%
  );
}

.wallet-ticker-track {
  display: flex;
  width: max-content;
  will-change: transform;
}

.wallet-ticker-track.is-animating {
  animation: wallet-ticker-scroll-ltr var(--wallet-ticker-duration, 36s) linear infinite;
}

.wallet-ticker-track.is-paused {
  animation-play-state: paused;
}

.wallet-ticker-segment {
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  white-space: nowrap;
}

@keyframes wallet-ticker-scroll-ltr {
  from {
    transform: translateX(-50%);
  }
  to {
    transform: translateX(0);
  }
}

.wallet-balances {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  max-width: 100%;
}

.wallet-balance-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0 1.1rem;
  border-right: 1px solid rgba(0, 229, 255, 0.16);
  white-space: nowrap;
}

.wallet-balance-chip:last-child {
  border-right: none;
}

.wallet-balance-chip.is-selected .wallet-balance-account {
  color: var(--accent-cyan);
}

.wallet-balance-chip.is-selected .wallet-balance-amount {
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.45);
}

.wallet-balance-account {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.wallet-balance-amount {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.wallet-balance-meta {
  display: none;
}

.wallet-amount-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0 0.5rem;
}

.user-profile {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3, 0.75rem);
  padding: 0.35rem 0.55rem 0.35rem 0.4rem;
  border-radius: 10px;
  cursor: default;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #00ff88 0%, #00ff88 40%, #7c3aed 40%, #7c3aed 100%);
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
}

.user-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.verified-badge {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #000;
  background: var(--accent-green);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.user-chevron {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ── Layout ── */
.layout {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  padding: 0 0 2rem;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-3, 0.75rem);
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: var(--space-2, 0.5rem);
}

.nav-section-title {
  padding: 0.55rem 1.1rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1.15rem;
  margin: 0.1rem 0.35rem 0.1rem 0;
  border-radius: 0 var(--radius-sm, 6px) var(--radius-sm, 6px) 0;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(0, 229, 255, 0.04);
}

.nav-link.active {
  color: var(--accent-cyan);
  border-left-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.08);
}

.nav-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--text-muted);
  font-size: 0.65rem;
  font-style: italic;
  font-weight: 700;
}

.nav-section-tools {
  margin-top: 1.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar-actions-bar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  flex: 1 1 auto;
  gap: var(--control-gap, 0.75rem) var(--space-4, 1rem);
  min-width: 0;
  width: 100%;
  padding: 0.35rem 1.15rem 0.35rem 1rem;
  border-bottom: none;
  background: transparent;
}

.account-switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  margin-right: 0.5rem;
}

.account-switcher-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.account-switcher-hidden {
  display: none;
}

.env-toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-subtle);
}

.env-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.env-tab:hover {
  color: var(--text-primary);
}

.env-tab.active {
  color: #000;
  background: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
}

.account-select {
  min-width: 180px;
  max-width: 240px;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 229, 255, 0.35);
  background: rgba(0, 0, 0, 0.5);
  color: var(--text-primary);
  font-size: 0.82rem;
}

.account-select:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.2);
}

.topbar-account {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: right;
  max-width: min(42vw, 28rem);
  min-width: 0;
}

.topbar-account strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.topbar-account #accountLabel {
  color: #e2e8f0;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.topbar-actions,
.topbar-actions-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 0 0 auto;
}

.topbar-auth-cluster {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-4, 1rem);
  margin-left: auto;
  flex: 0 0 auto;
  padding-right: 0.45rem;
}

.topbar-auth-buttons {
  display: flex;
  align-items: center;
  gap: var(--control-gap, 0.75rem);
  flex: 0 0 auto;
  /* Buffer between account ID and Login/Logout on the far right */
  margin-left: 0.55rem;
  padding-left: 1rem;
  border-left: 1px solid rgba(148, 163, 184, 0.22);
}

.session-pill {
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.25);
  color: var(--accent-cyan);
}

.content {
  padding: 1.25rem 1.5rem 2rem;
  width: 100%;
}

/* ── Page header ── */
.page-header-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.page-title {
  font-size: 1.65rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.icon-refresh {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(0, 229, 255, 0.4);
  background: rgba(0, 229, 255, 0.08);
  color: var(--accent-cyan);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, box-shadow 0.15s;
}

.icon-refresh:hover {
  background: rgba(0, 229, 255, 0.18);
  box-shadow: var(--glow-cyan);
}

/* ── Info banner ── */
.info-banner {
  position: relative;
  padding: 0.85rem 2.5rem 0.85rem 1.1rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  background: rgba(124, 58, 237, 0.18);
  border: 1px solid rgba(124, 58, 237, 0.35);
  font-size: 0.88rem;
  line-height: 1.5;
  color: rgba(240, 244, 248, 0.9);
}

.info-banner.is-dismissed {
  display: none;
}

.info-banner-text {
  margin: 0;
}

.info-banner-dismiss {
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: rgba(240, 244, 248, 0.65);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.info-banner-dismiss:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.info-banner-dismiss:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

.info-banner strong {
  color: var(--accent-cyan);
}

/* ── Summary stats ── */
.summary-stats-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-bottom: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.summary-stat {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.25rem 1.5rem;
  border-right: 1px solid var(--border-subtle);
}

.summary-stat:last-child {
  border-right: none;
}

.summary-stat-icon {
  font-size: 1.4rem;
  opacity: 0.85;
}

.summary-stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.summary-stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ── Account select ── */
.account-select-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.account-select-row label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.account-select-row select {
  min-width: 280px;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(22, 28, 40, 0.9);
  color: var(--text-primary);
  font-size: 0.9rem;
}

/* ── Account panels ── */
.accounts-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.accounts-env-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem 1rem;
  backdrop-filter: blur(8px);
  order: 2;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.accounts-env-panel-demo {
  order: 1;
  border-left: 3px solid rgba(96, 165, 250, 0.65);
}

.accounts-env-panel-live {
  order: 2;
  border-left: 3px solid rgba(168, 85, 247, 0.75);
}

.accounts-env-panel-demo .accounts-env-heading::before {
  content: "Demo · ";
  color: rgba(96, 165, 250, 0.9);
}

.accounts-env-panel-live .accounts-env-heading::before {
  content: "Live · ";
  color: rgba(168, 85, 247, 0.95);
}

.accounts-stack.accounts-stack--live-first .accounts-env-panel-demo {
  order: 2;
}

.accounts-stack.accounts-stack--live-first .accounts-env-panel-live {
  order: 1;
}

.accounts-env-panel.is-env-active {
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.12);
}

.accounts-env-panel-header {
  margin-bottom: 0.85rem;
}

.accounts-env-panel-header .accounts-env-heading {
  margin: 0;
}

.accounts-env-active-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #22d3ee;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.08);
}

.accounts-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem 0.5rem;
  margin-bottom: 1.25rem;
  backdrop-filter: blur(8px);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.accounts-env-group {
  margin-bottom: 1.25rem;
}

.accounts-env-heading {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.accounts-env-panel-header .accounts-env-heading {
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.account-engine-status {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.account-engine-status.is-active {
  color: #22d3ee;
}

.account-engine-status.is-done {
  color: #3b82f6;
}

.account-engine-status.is-error {
  color: #fb923c;
}

.accounts-table-wrap {
  overflow-x: auto;
}

.accounts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.accounts-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.accounts-table td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.accounts-table tr:last-child td {
  border-bottom: none;
}

.account-login-cell {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.account-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  flex-shrink: 0;
}

.account-id {
  font-weight: 700;
  font-size: 0.95rem;
}

.account-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.col-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  white-space: nowrap;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  border-color: rgba(0, 229, 255, 0.35);
  color: var(--accent-cyan);
}

.btn-trade {
  padding: 0.45rem 1.25rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: box-shadow 0.15s, transform 0.1s;
}

.btn-trade-solid {
  background: linear-gradient(135deg, var(--accent-purple-bright), var(--accent-purple));
  color: #fff;
  box-shadow: var(--glow-purple);
}

.btn-trade-solid:hover {
  box-shadow: 0 0 28px rgba(124, 58, 237, 0.6);
}

.btn-trade-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.btn-trade-outline:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.account-row-selected {
  background: rgba(0, 255, 200, 0.07);
  box-shadow: inset 4px 0 0 rgba(0, 255, 200, 0.85), 0 0 18px rgba(0, 255, 200, 0.12);
}

.account-trading-chosen-badge {
  display: inline-block;
  margin-top: 0.3rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0ff;
  background: rgba(0, 255, 200, 0.1);
  border: 1px solid rgba(0, 255, 200, 0.75);
  box-shadow:
    0 0 10px rgba(0, 255, 200, 0.55),
    0 0 22px rgba(0, 255, 200, 0.25),
    inset 0 0 12px rgba(0, 255, 200, 0.08);
  text-shadow:
    0 0 6px rgba(0, 255, 200, 0.95),
    0 0 14px rgba(0, 255, 200, 0.55);
  animation: trading-acc-chosen-pulse 2.4s ease-in-out infinite;
}

@keyframes trading-acc-chosen-pulse {
  0%,
  100% {
    box-shadow:
      0 0 10px rgba(0, 255, 200, 0.55),
      0 0 22px rgba(0, 255, 200, 0.25),
      inset 0 0 12px rgba(0, 255, 200, 0.08);
  }
  50% {
    box-shadow:
      0 0 14px rgba(0, 255, 200, 0.75),
      0 0 28px rgba(0, 255, 200, 0.4),
      inset 0 0 16px rgba(0, 255, 200, 0.12);
  }
}

.pair-selection-account-hint.is-trading-acc-chosen {
  color: #0ff;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow:
    0 0 8px rgba(0, 255, 200, 0.85),
    0 0 16px rgba(0, 255, 200, 0.45);
}

.empty-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 1.25rem !important;
}

/* ── Buttons ── */
.btn {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-primary);
  text-decoration: none;
  display: inline-block;
}

.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--accent-cyan);
  border-color: transparent;
  color: #041018;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-outline {
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--text-primary);
}

.btn-outline:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-pill {
  border-radius: 999px;
}

/* ── Metrics ── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1rem 0.85rem;
  text-align: center;
  backdrop-filter: blur(6px);
}

.metric-card .label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.metric-card .value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.metric-card .value.muted {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
}

/* ── Status panel ── */
.status-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(6px);
}

.status-panel h3 {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.86rem;
}

.status-row:last-child {
  border-bottom: none;
}

.status-reason {
  color: var(--text-muted);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.badge-disabled {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.badge-view-only {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-orange);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-active {
  background: rgba(0, 255, 136, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(0, 255, 136, 0.35);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-orange);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

/* ── Trade sections ── */
.section {
  margin-bottom: 1.5rem;
}

.section h2 {
  font-size: 1.05rem;
  margin: 0 0 0.85rem;
  font-weight: 700;
}

.trade-cards {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.trade-card-polished {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  backdrop-filter: blur(6px);
}

.trade-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.trade-card-head h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--accent-cyan);
}

.position-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(0, 229, 255, 0.12);
  color: var(--accent-cyan);
  letter-spacing: 0.04em;
}

.trade-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem 1rem;
}

.trade-card-grid label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.1rem;
}

.trade-card-grid span {
  font-size: 0.9rem;
  font-weight: 600;
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 1.25rem;
  text-align: center;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius);
  grid-column: 1 / -1;
}

/* History wraps use the same TradeLocker grid chrome */
.history-table-wrap {
  width: 100%;
  overflow-x: auto;
  background: var(--dtp-tl-grid-bg, #000);
  border: 1px solid var(--dtp-tl-border, rgba(148, 163, 184, 0.18));
}

.pnl-positive {
  color: var(--dtp-tl-pnl-pos, #4ade80);
  font-weight: 600;
}

.pnl-negative {
  color: var(--dtp-tl-pnl-neg, #f87171);
  font-weight: 600;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .summary-stats-card {
    grid-template-columns: 1fr;
  }

  .summary-stat {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .summary-stat:last-child {
    border-bottom: none;
  }
}

@media (max-width: 768px) {
  :root {
    --brand-rail-height: 96px;
  }

  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: 0;
  }

  .sidebar-brand {
    min-height: auto;
    padding: 0.65rem 1rem;
  }

  .brand-logo {
    width: 100%;
    max-height: 64px;
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.5rem;
    overflow: visible;
  }

  .main-top-chrome {
    min-height: 0;
  }

  .chrome-session-row {
    flex-wrap: wrap;
    padding: 0.15rem 0.25rem 0.2rem 0;
  }

  .topbar-actions-bar {
    padding: 0.1rem 0.5rem 0.1rem 0.75rem;
  }

  .global-header {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--header-height);
    padding: 0.25rem 0.75rem 0.25rem 0.35rem;
    gap: 0.65rem;
    margin-top: 0;
  }

  .wallet-ticker-bar {
    padding: 0 0.75rem;
    gap: 0.5rem;
  }

  .wallet-ticker-label {
    font-size: 0.58rem;
  }

  .user-profile {
    order: 4;
  }

  .nav-section {
    margin-bottom: 0;
  }

  .nav-section-title {
    display: none;
  }

  .nav-link {
    border-left: none;
    border-radius: 6px;
    padding: 0.45rem 0.75rem;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Login portal (modern — matches dashboard dark theme) ── */
body.login-portal {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #030508;
  color: var(--text-primary);
}

.login-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 55% at 50% 42%, rgba(0, 229, 255, 0.09) 0%, transparent 65%), #030508;
}

.login-backdrop-glow {
  position: absolute;
  top: 38%;
  left: 50%;
  width: min(520px, 90vw);
  height: min(520px, 90vw);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.12) 0%, transparent 68%);
  filter: blur(8px);
}

.login-backdrop-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.45;
}

.login-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-theme-dock {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 20;
}

.login-card-modern {
  position: relative;
  width: min(400px, 100%);
  padding: 0 1.75rem 1.65rem;
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(12, 16, 24, 0.98) 0%, rgba(6, 9, 14, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow:
    0 0 0 1px rgba(0, 229, 255, 0.06),
    0 28px 64px rgba(0, 0, 0, 0.55),
    0 0 48px rgba(0, 229, 255, 0.08);
  overflow: hidden;
}

.login-card-accent {
  height: 4px;
  margin: 0 -1.75rem 1.35rem;
  background: linear-gradient(90deg, #00c4e0 0%, #00e5ff 45%, #00ff88 100%);
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.45);
}

.login-card-brand {
  text-align: center;
  margin-bottom: 1.35rem;
}

.login-brand-logo {
  display: block;
  width: 100%;
  height: auto;
  max-height: 112px;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(0, 229, 255, 0.28));
}

.login-eyebrow {
  margin: 0.85rem 0 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.login-session-status {
  margin-bottom: 0.85rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.35;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.login-session-status.login-session-ok {
  color: var(--accent-green);
  border-color: rgba(0, 255, 136, 0.35);
}

.login-session-status.login-session-error {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
}

.login-form-modern {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.login-field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(139, 155, 180, 0.95);
}

.login-field input {
  width: 100%;
  padding: 0.72rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.96);
  color: #0f1419;
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-field input::placeholder {
  color: #8b95a5;
}

.login-field input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.22);
}

.login-stay-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.15rem 0 0.35rem;
  cursor: pointer;
  user-select: none;
}

.login-stay-row input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.login-stay-box {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid rgba(0, 255, 136, 0.55);
  background: transparent;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}

.login-stay-row input:checked + .login-stay-box {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

.login-stay-row input:checked + .login-stay-box::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #031208;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.login-stay-text {
  font-size: 0.82rem;
  color: rgba(240, 244, 248, 0.88);
}

.login-access-btn {
  width: 100%;
  margin-top: 0.85rem;
  padding: 0.82rem 1rem;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #031018;
  cursor: pointer;
  background: linear-gradient(180deg, #00e5ff 0%, #00b8d9 48%, #0097b8 100%);
  box-shadow:
    0 0 0 1px rgba(0, 229, 255, 0.35),
    0 8px 24px rgba(0, 229, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.login-access-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(0, 229, 255, 0.5),
    0 12px 28px rgba(0, 229, 255, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.login-access-btn:active:not(:disabled) {
  transform: translateY(0);
}

.login-access-btn:disabled {
  opacity: 0.72;
  cursor: wait;
}

.login-trust-line {
  margin: 1.1rem 0 0;
  text-align: center;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.login-build-line {
  margin: 0.45rem 0 0;
  text-align: center;
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

@media (max-width: 480px) {
  .login-card-modern {
    padding: 0 1.25rem 1.35rem;
  }

  .login-card-accent {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
  }
}

/* Trade Guardian page — uses settings-section spacing tokens */
.tg-page {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap, 1.5rem);
}

.tg-page .tg-block {
  margin: 0;
  padding: var(--card-padding, 1rem) var(--space-5, 1.25rem) var(--space-5, 1.25rem);
}

.tg-page .settings-section-head {
  margin-bottom: var(--stack-gap, 1rem);
}

.tg-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--control-gap, 0.75rem) var(--space-4, 1rem);
}

.tg-status-line {
  flex: 1 1 18rem;
  min-width: 0;
  margin: 0;
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-elevated, rgba(15, 23, 42, 0.35));
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: normal;
}

.tg-live-cash-degraded-banner {
  margin: var(--space-3, 0.75rem) 0 0;
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  border: 1px solid #c53030;
  border-radius: var(--radius);
  background: rgba(197, 48, 48, 0.15);
  color: #feb2b2;
  font-weight: 600;
  line-height: 1.45;
}

.tg-status-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--control-gap, 0.75rem);
  flex: 0 1 auto;
}

.watchdog-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2, 0.5rem);
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
  padding: var(--space-2, 0.5rem) var(--space-3, 0.75rem);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-elevated, transparent);
  color: var(--text-primary);
}

.watchdog-toggle input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent-green, #4ade80);
  flex-shrink: 0;
}

.oco-form-grid {
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap, 1rem);
}

.oco-form-top {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--control-gap, 0.75rem) var(--space-4, 1rem);
}

.oco-legs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--stack-gap, 1rem);
}

.oco-leg {
  margin: 0;
  min-width: 0;
  padding: var(--space-4, 1rem);
  padding-top: var(--space-3, 0.75rem);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-elevated, rgba(15, 23, 42, 0.25));
}

.oco-leg legend {
  padding: 0 var(--space-2, 0.5rem);
  margin-left: var(--space-1, 0.25rem);
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 600;
}

.oco-leg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: var(--control-gap, 0.75rem) var(--space-4, 1rem);
  margin-top: var(--space-2, 0.5rem);
}

.tg-page .oco-form-grid .settings-field {
  min-width: 0;
}

.tg-page .oco-form-grid .settings-field input {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
}

/* ==========================================================================
   Canonical TradeLocker-style data grid (ONE template for the whole app)
   Use: wrap `.tl-grid-wrap.dtp-tl-grid-wrap` + table `.dtp-tl-grid`
   Aliases kept: .tl-positions-grid .tg-tl-grid .history-table
   ========================================================================== */
:root {
  --dtp-tl-buy: #22c55e;
  --dtp-tl-sell: #f97316; /* orange — easy scan vs green buys */
  --dtp-tl-pnl-pos: #4ade80;
  --dtp-tl-pnl-neg: #f87171;
  --dtp-tl-grid-bg: #000;
  --dtp-tl-head-bg: #0a0b0d;
  --dtp-tl-text: #e8eef7;
  --dtp-tl-muted: #9aa0ab;
  --dtp-tl-border: rgba(148, 163, 184, 0.18);
  --dtp-tl-row-border: rgba(55, 65, 81, 0.65);
}

/* Trade Guardian section chrome (toolbar around the shared grid) */
.tg-grid-section {
  margin: 0;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: #000;
  overflow: hidden;
}

.tg-grid-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--control-gap, 0.75rem) var(--space-4, 1rem);
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  background: #0a0b0d;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.tg-grid-toolbar h2 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  font-weight: 700;
  color: #f3f4f6;
}

.tg-grid-sub {
  margin: 0;
  font-size: 0.8rem;
  color: #9aa0ab;
  max-width: 40rem;
  line-height: 1.4;
}

.tg-grid-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3, 0.75rem);
  font-size: 0.78rem;
  color: #9aa0ab;
  font-variant-numeric: tabular-nums;
}

.tg-grid-count {
  color: #e8eef7;
  font-weight: 600;
}

.tg-tl-wrap {
  margin: 0;
  border: none;
  border-radius: 0;
  background: var(--dtp-tl-grid-bg, #000);
}

.tl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0 auto;
  max-width: 28rem;
  text-align: center;
}

.tl-empty strong {
  display: block;
  font-size: 0.98rem;
  font-weight: 650;
  color: #e8eef7;
  letter-spacing: 0.01em;
}

.tl-empty span {
  display: block;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--dtp-tl-muted, #9aa0ab);
}

.dtp-tl-grid .badge,
.tl-positions-grid .badge,
.tg-tl-grid .badge {
  display: inline-block;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.oco-warning {
  margin-top: 0.25rem;
  font-size: 0.7rem;
  color: #fbbf24;
  white-space: normal;
}

/* Legacy OCO head helpers (account section embeds same body) */
.oco-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--stack-gap, 1rem);
}

.oco-panel-actions {
  display: flex;
  align-items: center;
  gap: var(--control-gap, 0.75rem);
  flex-shrink: 0;
}

.form-hint-success {
  color: #4ade80;
}

.form-hint-error {
  color: #f87171;
}

.coming-soon-panel {
  margin-top: 1rem;
  padding: 2rem 1.5rem;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.45);
  text-align: center;
}

.coming-soon-badge {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(251, 146, 60, 0.15);
  color: #fb923c;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.coming-soon-lead {
  margin: 0 0 0.75rem;
  color: var(--text-primary);
  font-size: 1rem;
}

.coming-soon-note {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Trade Cockpit chooser + env pages ── */
.page-lead {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 52rem;
}

.cockpit-chooser-header,
.cockpit-env-page-header {
  align-items: flex-start;
}

.cockpit-env-title-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cockpit-back-link {
  display: inline-block;
  margin-bottom: 0.15rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-decoration: none;
}

.cockpit-back-link:hover {
  color: var(--accent-cyan);
}

.cockpit-env-chooser {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}

.cockpit-env-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 100%;
  padding: 1.15rem 1.2rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.92), rgba(15, 23, 42, 0.55));
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.cockpit-env-card:hover {
  border-color: rgba(34, 211, 238, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.cockpit-env-card.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.cockpit-env-card-demo {
  border-top: 3px solid rgba(34, 211, 238, 0.65);
}

.cockpit-env-card-live {
  border-top: 3px solid rgba(251, 146, 60, 0.75);
}

.cockpit-env-card-icon {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1rem;
  background: rgba(34, 211, 238, 0.12);
  color: #22d3ee;
}

.cockpit-env-card-live .cockpit-env-card-icon {
  background: rgba(251, 146, 60, 0.12);
  color: #fb923c;
}

.cockpit-env-card-title {
  margin: 0;
  font-size: 1.25rem;
}

.cockpit-env-card-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.cockpit-env-card-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0;
}

.cockpit-env-card-stats div {
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border-subtle);
}

.cockpit-env-card-stats dt {
  margin: 0;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.cockpit-env-card-stats dd {
  margin: 0.2rem 0 0;
  font-size: 1rem;
  font-weight: 600;
}

.cockpit-env-card-cta {
  margin-top: auto;
  font-size: 0.88rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.cockpit-accounts-flat-panel {
  margin-top: var(--section-gap, 1.5rem);
  margin-bottom: var(--section-gap, 1.5rem);
}

.cockpit-accounts-flat-header {
  margin-bottom: var(--stack-gap, 1rem);
}

/*
 * Trade Cockpit home spacing.
 * Page blocks live under <main class="content"> — NOT .main > * (chrome/git bar).
 * Flex gap avoids margin-collapse so error banners never sit flush on Live Cash rows.
 */
.content:has(#cockpitAccountsFlatPanel) {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap, 1.5rem);
}

.content:has(#cockpitAccountsFlatPanel) > .page-header-row,
.content:has(#cockpitAccountsFlatPanel) > .cockpit-live-sessions,
.content:has(#cockpitAccountsFlatPanel) > .info-banner,
.content:has(#cockpitAccountsFlatPanel) > .cockpit-accounts-flat-panel,
.content:has(#cockpitAccountsFlatPanel) > .cockpit-accounts-status-stack,
.content:has(#cockpitAccountsFlatPanel) > .active-work-rail-host,
.content:has(#cockpitAccountsFlatPanel) > .page-data-loading-banner {
  margin-top: 0;
  margin-bottom: 0;
}

.cockpit-accounts-status-stack {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap, 1.5rem);
  width: 100%;
}

.cockpit-accounts-status-stack > .trade-engine-feedback,
.cockpit-accounts-status-stack > .chart-failure-action-banner {
  margin-top: 0;
  margin-bottom: 0;
}

/* Global section rhythm — keep content blocks from colliding */
.page-header-row,
.tool-page-desc,
.settings-section,
.workspace-block,
.nm-panel,
.sch-panel,
.sch-form-panel,
.launch-log-panel,
.pj-toolbar,
.trade-engine-pipeline,
.setups-discovered-hero,
.engine-activity-log,
.cockpit-accounts-flat-panel,
.cockpit-live-sessions,
.info-banner,
.chart-failure-action-banner,
.trade-engine-feedback,
.trade-engine-scan-diagnostics-wrap {
  scroll-margin-top: var(--space-4, 1rem);
}

.main-content > .page-header-row + *,
.main > .page-header-row + * {
  margin-top: var(--space-2, 0.5rem);
}

.cockpit-accounts-flat-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.cockpit-accounts-flat-lead {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.cockpit-accounts-flat-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.cockpit-account-flat-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto auto auto auto;
  align-items: center;
  gap: 0.75rem 1rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.45);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.cockpit-account-flat-row:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(15, 23, 42, 0.65);
}

.cockpit-account-flat-row.is-navigating {
  opacity: 0.75;
  cursor: wait;
  pointer-events: none;
}

.cockpit-account-flat-row.is-navigating .cockpit-account-flat-open::after {
  content: " Opening…";
  font-weight: 600;
}

.cockpit-account-env-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.cockpit-account-env-badge-demo {
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
}

.cockpit-account-env-badge-live {
  background: rgba(251, 191, 36, 0.15);
  color: #fcd34d;
}

.cockpit-account-flat-id {
  font-weight: 700;
  min-width: 5.5rem;
}

.cockpit-account-flat-name {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cockpit-account-flat-balance {
  min-width: 7rem;
  text-align: right;
}

.cockpit-account-balance-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}

.cockpit-account-balance-amount {
  font-weight: 600;
}

.cockpit-account-balance-meta,
.wallet-balance-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.cockpit-account-balance-is-cached .cockpit-account-balance-amount,
.wallet-balance-chip.is-cached-balance .wallet-balance-amount {
  color: #fbbf24;
}

.cockpit-account-flat-open {
  color: var(--accent-cyan);
  font-size: 0.88rem;
  font-weight: 600;
}

.cockpit-account-flat-actions .btn-trade {
  pointer-events: auto;
}

.cockpit-account-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.5);
}

.cockpit-account-context-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.cockpit-account-context-label {
  font-weight: 700;
}

.cockpit-account-context-balance {
  font-weight: 600;
}

.cockpit-account-context-change {
  font-size: 0.88rem;
  color: var(--accent-cyan);
  text-decoration: none;
}

.cockpit-account-context-change:hover {
  text-decoration: underline;
}

.cockpit-account-context-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: min(100%, 22rem);
}

.cockpit-account-context-switch-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.cockpit-account-select {
  flex: 1 1 auto;
  min-width: 14rem;
  max-width: 28rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #0a0b0d;
  color: #e8eef7;
  font-size: 0.84rem;
  font-weight: 600;
}

.cockpit-account-select:disabled {
  opacity: 0.65;
  cursor: wait;
}

.cockpit-account-context-status {
  font-size: 0.82rem;
  color: var(--accent-cyan);
  white-space: nowrap;
}

.cockpit-account-context-status.is-loading {
  color: #67e8f9;
}

.cockpit-account-context-status.is-error {
  color: #f87171;
}

@media (max-width: 720px) {
  .cockpit-account-context {
    flex-direction: column;
    align-items: stretch;
  }

  .cockpit-account-context-switch,
  .cockpit-account-select {
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 900px) {
  .cockpit-account-flat-row {
    grid-template-columns: 1fr 1fr;
  }

  .cockpit-account-flat-open {
    display: none;
  }
}

.accounts-stack-single {
  display: block;
}

.accounts-stack-single .accounts-env-panel {
  margin-bottom: 1rem;
}

.trade-engine-account-panel {
  margin-top: 0.5rem;
}

/* Host wrappers are layout-only — cards live on each .workspace-block */
.workspace-stack-host,
.trade-engine-account-panel.workspace-stack-host,
.pair-selection-panel.workspace-stack-host {
  margin: 0;
  padding: 0;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0;
}

.cockpit-workspace-panels {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

/* Isolated Account Workspace content cards */
.workspace-stack,
.workspace-stack-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.workspace-panel-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.15rem 0.1rem;
  flex-wrap: wrap;
}

.workspace-panel-chrome-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.workspace-panel-chrome-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.workspace-block {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius, 10px);
  background: var(--bg-panel, rgba(22, 28, 40, 0.75));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.workspace-block.is-hidden {
  display: none !important;
}

.workspace-block-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: nowrap;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--bg-elevated, #242933) 88%, transparent);
}

.workspace-block.is-collapsed .workspace-block-head {
  border-bottom: none;
}

.workspace-block-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.workspace-block-subtitle,
.workspace-block-head-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  flex: 0 1 auto;
  min-width: 0;
}

.workspace-block-head-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  margin-right: 0.15rem;
}

.workspace-block-head .pair-selection-account-hint,
.workspace-block-head .favorites-count-badge {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 0.78rem;
}

.workspace-block-collapse {
  order: 99;
  margin-left: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input, rgba(0, 0, 0, 0.2));
  color: var(--text-secondary, var(--text-muted));
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}

.workspace-block-collapse:hover {
  border-color: var(--accent-cyan, #60cdff);
  color: var(--accent-cyan, #60cdff);
}

.workspace-block-body {
  padding: 0.85rem 1rem 1rem;
}

.workspace-block.is-collapsed .workspace-block-body {
  display: none;
}

.workspace-block .panel-drawer {
  margin: 0;
  border: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--bg-elevated, #242933) 55%, transparent);
  box-shadow: none;
}

.workspace-block[data-workspace-block="pair-favorites"] .panel-drawer {
  border: none;
  background: transparent;
}

.workspace-block .panel-drawer + .pair-trade-action-bar,
.workspace-block .panel-drawer + .pair-selection-feedback {
  margin-top: 0.85rem;
}

.cockpit-workspace-panels.workspace-engine-priority #trade-engine-account-panel {
  order: -1;
  margin-top: 0;
}

.cockpit-workspace-panels.workspace-engine-priority #pairSelectionPanel {
  order: 1;
  opacity: 0.88;
}

.cockpit-workspace-panels.workspace-engine-priority #trade-engine-account-panel .workspace-block {
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.08);
}

.cockpit-workspace-panels.workspace-engine-priority #tradeEngineRunIdBar {
  border-color: rgba(56, 189, 248, 0.35);
}

.pair-trade-action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm, 6px);
  background: var(--bg-elevated, rgba(255, 255, 255, 0.03));
}

/* Primary Scan Universe strip — always visible on Account Workspace */
.pair-trade-action-bar-primary {
  margin: 0;
  padding: 1rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--accent-cyan, #60cdff) 45%, var(--border-subtle));
  border-radius: var(--radius, 10px);
  background: color-mix(in srgb, var(--bg-panel, #161c28) 88%, rgba(96, 205, 255, 0.12));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  align-items: flex-start;
}

.pair-trade-action-copy {
  flex: 1 1 16rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pair-trade-action-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--text-primary);
}

.pair-trade-action-bar-primary .pair-trade-action-hint {
  margin: 0;
}

.pair-trade-action-bar-primary .pair-selection-account-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pair-trade-action-bar-primary .pair-trade-action-buttons {
  flex: 0 0 auto;
  align-self: center;
}

.pair-selection-panel > .workspace-stack > .pair-selection-feedback {
  margin: 0.15rem 0 0;
}

.pair-trade-action-hint {
  margin: 0;
  flex: 1 1 16rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.pair-trade-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.trade-engine-interrupt-dialog .trade-engine-interrupt-run-ref {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 0.85rem;
}

.trade-engine-interrupt-dialog .trade-engine-interrupt-run-ref.is-hidden {
  display: none;
}

.trade-engine-account-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.trade-engine-account-panel-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.trade-engine-account-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
  margin: 0 0 0.75rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.35);
  font-size: 0.88rem;
}

.trade-engine-account-stats .label {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.trade-engine-account-stats #tradeEngineSetupsFound,
.trade-engine-account-stats #tradeEngineProgress {
  font-weight: 700;
  color: var(--accent-cyan);
}

/* ── Pair selection + Favorites ── */
.pair-selection-panel:not(.workspace-stack-host) {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.pair-selection-panel.workspace-stack-host {
  margin-bottom: 0;
}

.hidden-pairs-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.hidden-pairs-page {
  padding: 1.1rem 1.2rem 1.35rem;
}

.hidden-pairs-page .pair-selection-lead {
  margin-top: 0;
}

.hidden-pairs-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem 0.75rem;
  margin: 0 0 0.75rem;
}

.hidden-pairs-add-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.hidden-pairs-add-input {
  min-width: 10rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-card, rgba(0, 0, 0, 0.2));
  color: var(--text-primary);
  font-size: 0.88rem;
}

.hidden-pairs-feedback {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  color: var(--text-secondary, var(--text-muted));
}

.hidden-pairs-feedback.is-error {
  color: #f85149;
}

.hidden-pairs-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.85rem 1rem;
}

.hidden-pairs-subtitle {
  margin: 0 0 0.45rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.hidden-pairs-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 18rem;
  overflow: auto;
  padding-right: 0.15rem;
}

.hidden-pairs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-elevated, #242933) 70%, transparent);
}

.hidden-pairs-row-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.hidden-pairs-desc,
.hidden-pairs-source {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden-pairs-source {
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
}

.pair-selection-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.pair-selection-head h2 {
  margin: 0 0 0.25rem;
}

.pair-selection-lead {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.pair-selection-account-hint {
  font-size: 0.85rem;
  color: var(--accent-cyan);
  white-space: nowrap;
}

.pair-selection-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.pair-search-input {
  flex: 1 1 220px;
  min-width: 180px;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input, var(--bg-card));
  color: var(--text-primary);
}

.pair-selection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.pair-selection-feedback {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

.pair-selection-feedback.is-error {
  color: var(--danger, #e35);
}

.pair-selection-count {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pair-checkbox-grid-wrap {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  margin-bottom: 0;
  background: rgba(0, 0, 0, 0.12);
}

.pair-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.35rem 0.75rem;
}

.pair-checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.pair-checkbox-symbol {
  font-weight: 600;
}

.pair-checkbox-unavailable {
  opacity: 0.55;
}

.pair-unavailable-badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--warning, #c90);
}

.favorites-section {
  padding-top: 0.35rem;
}

.favorites-drawer,
.panel-drawer {
  margin-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.65rem;
}

.favorites-drawer-toggle,
.panel-drawer-toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.panel-drawer-toggle-inline {
  border: none;
  background: transparent;
  padding: 0;
  width: auto;
  flex: 1 1 auto;
}

.panel-drawer-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.panel-drawer-header-row .panel-drawer-toggle-inline {
  min-width: 0;
}

.panel-drawer-header-row .accounts-env-heading {
  margin: 0;
}

.favorites-drawer-toggle:hover,
.panel-drawer-toggle:hover {
  border-color: rgba(0, 200, 255, 0.35);
  background: rgba(0, 0, 0, 0.28);
}

.panel-drawer-toggle-inline:hover {
  background: transparent;
  border-color: transparent;
}

.favorites-drawer-toggle-label,
.panel-drawer-toggle-label {
  flex: 1 1 auto;
}

.panel-drawer-summary {
  flex: 0 1 auto;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: right;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorites-drawer-chevron,
.panel-drawer-chevron {
  flex-shrink: 0;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  margin-right: 0.15rem;
}

.favorites-drawer:not(.is-collapsed) .favorites-drawer-chevron,
.panel-drawer:not(.is-collapsed) .panel-drawer-chevron {
  transform: rotate(-135deg);
  margin-top: 0.2rem;
}

.favorites-drawer-body,
.panel-drawer-body {
  padding: 0.75rem 0 0;
}

.favorites-drawer-body.is-collapsed,
.panel-drawer-body.is-collapsed {
  display: none;
}

.last-run-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(0, 255, 200, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(0, 255, 200, 0.06);
}

.last-run-bar.is-hidden {
  display: none;
}

.last-run-bar-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.last-run-bar-kicker {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.last-run-bar-summary {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.last-run-bar-summary.is-error {
  color: #ff8a80;
}

.last-run-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.rerun-confirm-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(124, 58, 237, 0.45);
  border-radius: var(--radius-sm);
  background: rgba(124, 58, 237, 0.1);
}

.rerun-confirm-bar.is-hidden {
  display: none;
}

.rerun-confirm-copy {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  flex: 1;
}

.rerun-confirm-summary {
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--text-primary);
}

.rerun-confirm-help {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.rerun-historical-block {
  margin-top: 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rerun-historical-block.is-hidden {
  display: none;
}

.rerun-historical-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.rerun-historical-select {
  max-width: 18rem;
  padding: 0.4rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text-primary);
}

.favorites-workflow {
  margin-bottom: 0;
}

.favorites-workflow-prominent {
  padding: 1.2rem 1.35rem 1.1rem;
  border: 2px solid rgba(0, 255, 200, 0.42);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(0, 255, 200, 0.1) 0%, rgba(0, 0, 0, 0.22) 48%, rgba(124, 58, 237, 0.08) 100%);
  box-shadow:
    0 0 28px rgba(0, 255, 200, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.favorites-workflow-title {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
}

.favorites-workflow-lead {
  max-width: 52rem;
}

.favorites-count-badge {
  flex-shrink: 0;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 255, 200, 0.45);
  background: rgba(0, 255, 200, 0.1);
  color: #0ff;
  font-weight: 700;
  font-size: 0.82rem;
  text-shadow: 0 0 8px rgba(0, 255, 200, 0.45);
}

.favorites-workflow-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.favorites-workflow-head h2 {
  margin: 0 0 0.25rem;
}

.favorites-workflow-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
}

.workflow-step {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.12);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.workflow-step.is-active {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
  box-shadow: 0 0 0 1px rgba(0, 200, 255, 0.15);
}

.workflow-step.is-complete {
  border-color: rgba(0, 200, 120, 0.45);
  color: var(--text-primary);
}

.workflow-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
  font-size: 0.72rem;
}

.favorite-trade-confirm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 200, 255, 0.35);
  background: rgba(0, 200, 255, 0.08);
}

.favorite-trade-confirm.is-hidden {
  display: none;
}

.favorite-trade-confirm-title {
  margin: 0 0 0.2rem;
  font-weight: 700;
}

.favorite-trade-confirm-detail {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.pair-picker-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.85rem;
}

.pair-picker-section h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.favorites-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.favorites-section-head h3 {
  margin: 0;
  font-size: 1rem;
}

.favorites-count {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.favorites-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

@media (max-width: 900px) {
  .favorite-card-head {
    grid-template-columns: 1fr;
  }

  .favorite-card-center {
    justify-content: stretch;
  }

  .favorite-session-account {
    max-width: none;
  }

  .favorite-card-actions {
    justify-content: flex-start;
  }
}

.favorite-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
}

.favorite-card.is-selected {
  border-color: rgba(0, 255, 200, 0.65);
  box-shadow:
    0 0 0 1px rgba(0, 255, 200, 0.22),
    0 0 24px rgba(0, 255, 200, 0.14);
  background: rgba(0, 255, 200, 0.06);
}

.favorite-card-head {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 1.4fr) auto;
  align-items: center;
  gap: 0.85rem 1rem;
  padding: 0.7rem 0.85rem;
}

.favorite-card-left {
  min-width: 0;
}

.favorite-card-center {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.favorite-session-account {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.12rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.18);
  width: 100%;
  max-width: 320px;
}

.favorite-session-account.is-ready {
  border-style: solid;
  border-color: rgba(0, 255, 200, 0.35);
}

.favorite-session-account.is-highlight.is-ready {
  border-color: rgba(0, 255, 200, 0.75);
  background: rgba(0, 255, 200, 0.08);
  box-shadow: 0 0 16px rgba(0, 255, 200, 0.18);
}

.favorite-session-account-kicker {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.favorite-session-account.is-ready .favorite-session-account-kicker {
  color: rgba(0, 255, 200, 0.85);
}

.favorite-session-account-name {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
  word-break: break-word;
}

.favorite-session-account-id {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0ff;
  text-shadow: 0 0 8px rgba(0, 255, 200, 0.55);
}

.favorite-session-account-pending {
  font-size: 0.82rem;
  color: var(--warning, #c90);
  font-weight: 600;
}

.favorite-select,
.favorite-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  text-align: left;
  padding: 0;
}

.favorite-select-indicator {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  flex-shrink: 0;
}

.favorite-card.is-selected .favorite-select-indicator {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.favorite-name {
  font-weight: 700;
}

.favorite-pair-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.favorite-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.favorite-card-body {
  padding: 0 0.65rem 0.65rem;
}

.favorite-card-body.is-collapsed {
  display: none;
}

.favorite-symbols {
  margin: 0 0 0.35rem;
  font-size: 0.86rem;
  word-break: break-word;
}

.favorite-unavailable,
.favorite-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-danger-outline {
  border-color: var(--danger, #e35);
  color: var(--danger, #e35);
}

.trade-engine-live-override-dialog .trade-engine-mode-lead {
  max-width: 36rem;
  line-height: 1.45;
}

.trade-engine-live-override-detail {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted, #9aa3b2);
}

.trade-engine-live-override-detail.is-hidden {
  display: none;
}

.trade-engine-scan-diagnostics-wrap:not(.workspace-block) {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
}

.trade-engine-scan-diagnostics-wrap.is-hidden,
#tradeEngineScanDiagnosticsWrap.is-hidden {
  display: none !important;
}

.trade-engine-scan-diagnostics-title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  color: var(--accent-cyan);
}

.scan-diag-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem 0.75rem;
  margin: 0 0 0.65rem;
}

.scan-diag-search-label,
.scan-diag-select-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.scan-diag-label-text {
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 600;
}

.scan-diag-search {
  min-width: 12rem;
  width: min(18rem, 100%);
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-card, rgba(0, 0, 0, 0.2));
  color: var(--text-primary);
  font-size: 0.88rem;
}

.scan-diag-select {
  min-width: 8.5rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-card, rgba(0, 0, 0, 0.2));
  color: var(--text-primary);
  font-size: 0.85rem;
}

.scan-diag-meta {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  align-self: center;
}

.scan-diag-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin-top: 0.65rem;
}

.scan-diag-pager.is-hidden,
.scan-diag-pager:empty {
  display: none;
}

.scan-diag-page-status {
  font-size: 0.8rem;
  color: var(--text-muted);
}

@media (max-width: 700px) {
  .scan-diag-meta {
    margin-left: 0;
    width: 100%;
  }

  .scan-diag-search {
    width: 100%;
    min-width: 0;
  }
}

.scan-diagnostic-brief {
  font-weight: 600;
  color: var(--text-muted, #9aa3b2);
}

.scan-summary-headline {
  margin: 0;
}

.scan-summary-headline.is-no-trade strong {
  color: #c9a227;
}

.scan-summary-headline.is-a-found strong {
  color: #3fb950;
}

.scan-summary-stats {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted, #9aa3b2);
}

.scan-summary-no-trade-banner {
  margin: 0.5rem 0 0;
  font-weight: 600;
  color: #c9a227;
}

.scan-summary-timing {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted, #9aa3b2);
  font-family: var(--font-mono, ui-monospace, monospace);
}

.trade-engine-a-grade-title {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.trade-engine-b-grade-section:not(.workspace-block) {
  margin-top: 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px dashed rgba(201, 162, 39, 0.35);
  background: rgba(201, 162, 39, 0.05);
}

.workspace-block[data-workspace-block="te-b-grade"] {
  border-color: rgba(201, 162, 39, 0.35);
  background: color-mix(in srgb, rgba(201, 162, 39, 0.08) 70%, var(--bg-panel, transparent));
}

.workspace-block[data-workspace-block="te-b-grade"] .workspace-block-subtitle {
  color: #c9a227;
}

.trade-engine-b-grade-section.is-hidden,
#tradeEngineBGradeSection.is-hidden {
  display: none !important;
}

.trade-engine-b-grade-summary {
  cursor: pointer;
  font-weight: 600;
  color: #c9a227;
}

.trade-engine-scan-summary-wrap {
  margin: 0.75rem 0;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.trade-engine-scan-summary-wrap.is-hidden {
  display: none;
}

.scan-summary-b-grade-note {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: #c9a227;
}

.setup-grade-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.setup-grade-a {
  background: rgba(46, 160, 67, 0.2);
  color: #3fb950;
}

.setup-grade-b {
  background: rgba(201, 162, 39, 0.15);
  color: #c9a227;
}

.setup-grade-wrap.is-b-grade {
  opacity: 0.92;
  border-left: 3px solid #c9a227;
  padding-left: 0.5rem;
}

.setup-batch-b-grade-note {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: #c9a227;
}

.engine-gpt-review {
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  background: rgba(88, 166, 255, 0.08);
  border: 1px solid rgba(88, 166, 255, 0.2);
  font-size: 0.9rem;
}

.engine-gpt-review.is-disagreement {
  border-color: rgba(248, 81, 73, 0.35);
  background: rgba(248, 81, 73, 0.08);
}

.engine-gpt-review.is-concur {
  border-color: rgba(63, 185, 80, 0.35);
  background: rgba(63, 185, 80, 0.08);
}

.engine-gpt-concerns {
  margin: 0.35rem 0 0 1rem;
  padding: 0;
}

.scan-diagnostic-card {
  border: 1px solid rgba(255, 180, 0, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(255, 180, 0, 0.06);
  padding: 0 0.85rem;
  margin-bottom: 0.4rem;
}

/* Collapsed rows are the default: a universe scan lists 150+ of these, and the
   headline is what the operator scans down the list for. */
.scan-diagnostic-card[open] {
  padding-bottom: 0.75rem;
}

.scan-diagnostic-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  cursor: pointer;
  list-style: none;
}

.scan-diagnostic-head::-webkit-details-marker {
  display: none;
}

.scan-diagnostic-title {
  font-size: 0.92rem;
  font-weight: 600;
}

.scan-diagnostic-head h4 {
  margin: 0;
  font-size: 0.92rem;
}

/* Push the confidence chip and chevron to the right of the summary row. */
.scan-diagnostic-head .scan-diagnostic-confidence {
  margin-left: auto;
}

.scan-diagnostic-chevron::after {
  content: "▾";
  display: inline-block;
  font-size: 0.8rem;
  color: var(--text-muted, #9aa3b2);
  transition: transform 0.15s ease;
}

.scan-diagnostic-card[open] .scan-diagnostic-chevron::after {
  transform: rotate(180deg);
}

.scan-diagnostic-confidence {
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffb347;
}

.scan-diagnostic-best {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.scan-diagnostic-reasons {
  margin: 0 0 0.55rem;
  padding-left: 1.1rem;
  font-size: 0.84rem;
}

.scan-diagnostic-chart-failures {
  margin: 0 0 0.55rem;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.scan-diagnostic-chart-failure {
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  background: rgba(255, 92, 92, 0.08);
  border: 1px solid rgba(255, 92, 92, 0.22);
  font-size: 0.84rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.scan-diagnostic-chart-headline {
  margin: 0 0 0.45rem;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.scan-diagnostic-card.is-chart-failure .scan-diagnostic-confidence {
  color: #ffb4b4;
}

.scan-diagnostic-error-code {
  align-self: flex-start;
  font-size: 0.75rem;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  color: #ffb4b4;
}

.scan-diagnostic-strategies {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.scan-diagnostic-strategy {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.45rem;
  font-size: 0.8rem;
}

.scan-diagnostic-strategy-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.scan-diagnostic-chapters {
  margin: 0.35rem 0 0;
  padding-left: 1rem;
  color: var(--text-muted);
}

.setup-confidence-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(0, 255, 200, 0.12);
  border: 1px solid rgba(0, 255, 200, 0.35);
  color: #0ff;
}

/* ── Trade Engine activity ── */
.trade-engine-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.trade-engine-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
  flex-wrap: nowrap;
}

.trade-engine-head h2 {
  margin: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}

.trade-engine-head-progress {
  flex: 1 1 auto;
  min-width: 0;
  display: none;
  align-items: center;
  margin-right: 0.35rem; /* small gap before Copy log */
}

.trade-engine-head-progress.has-rail {
  display: flex;
}

.trade-engine-head-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 0 0 auto;
  margin-left: auto;
}

.trade-engine-head-actions .btn {
  white-space: nowrap;
}

.engine-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
}

.engine-badge-idle { background: rgba(148, 163, 184, 0.2); color: #94a3b8; }
.engine-badge-scanning { background: rgba(34, 211, 238, 0.15); color: #22d3ee; }
.engine-badge-setup { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.engine-badge-executing { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.engine-badge-blocked { background: rgba(251, 146, 60, 0.15); color: #fb923c; }
.engine-badge-failed { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.engine-badge-completed { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }

.trade-engine-feedback {
  margin: var(--section-gap, 1.5rem) 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(34, 211, 238, 0.08);
  color: var(--text-primary);
  font-size: 0.88rem;
}

.trade-engine-feedback.is-error {
  background: rgba(251, 146, 60, 0.12);
  color: #fb923c;
}

.trade-engine-feedback.is-hidden {
  display: none;
}

.trade-engine-run-id-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm, 6px);
  background: var(--bg-elevated, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
}

.trade-engine-run-id-bar.is-hidden {
  display: none;
}

.trade-engine-run-id-bar .label {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.trade-engine-run-id-bar strong {
  font-variant-numeric: tabular-nums;
}

.trade-engine-run-uuid {
  font-size: 0.72rem;
  opacity: 0.85;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-engine-live-status {
  margin: 0 0 0.65rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.45);
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.45;
}

.trade-engine-live-status.is-active {
  border-color: rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.06);
}

.trade-engine-live-status.is-active::before {
  content: "● ";
  color: #22d3ee;
  animation: trade-engine-pulse 1.4s ease-in-out infinite;
}

.trade-engine-live-status.is-complete {
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.08);
}

.trade-engine-live-status.is-error {
  border-color: rgba(251, 146, 60, 0.35);
  background: rgba(251, 146, 60, 0.1);
  color: #fb923c;
}

.trade-engine-symbol-trail-wrap {
  margin: 0;
}

.trade-engine-symbol-trail-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.trade-engine-symbol-trail {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.35);
  min-height: 2.5rem;
}

.trade-engine-symbol-current {
  font-size: 0.88rem;
  color: var(--text-primary);
}

.trade-engine-symbol-current strong {
  color: #22d3ee;
  font-weight: 700;
}

.trade-engine-symbol-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.trade-engine-symbol-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.55);
}

.trade-engine-symbol-chip.is-active {
  border-color: rgba(34, 211, 238, 0.55);
  color: #22d3ee;
  background: rgba(34, 211, 238, 0.12);
}

.trade-engine-symbol-chip.is-setup {
  border-color: rgba(59, 130, 246, 0.45);
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.12);
}

.trade-engine-symbol-chip.is-failed {
  border-color: rgba(251, 146, 60, 0.45);
  color: #fdba74;
}

.trade-engine-symbol-trail-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}

@keyframes trade-engine-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.trade-engine-stats-help {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.trade-engine-session-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.35);
}

.trade-engine-session-context {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 160px;
}

.trade-engine-session-context .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.trade-engine-mode-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(4px);
}

.trade-engine-mode-modal.is-hidden {
  display: none;
}

.trade-engine-mode-dialog {
  width: min(100%, 460px);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.trade-engine-mode-dialog h3 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}

.trade-engine-mode-lead {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.trade-engine-mode-scope {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.9rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.trade-engine-mode-scope.is-hidden {
  display: none;
}

.trade-engine-mode-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}

.trade-engine-mode-hint {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.trade-engine-mode-cancel {
  width: 100%;
}

#tradeEngineSessionLabel {
  font-weight: 600;
  font-size: 0.92rem;
}

.trade-engine-session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.trade-engine-saved-logs {
  margin-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.65rem;
}

.trade-engine-saved-logs summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.55rem;
}

.trade-engine-saved-logs-help {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.45;
}

.trade-engine-saved-logs-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.trade-engine-saved-log-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.25);
}

.trade-engine-saved-log-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 180px;
}

.trade-engine-saved-log-title {
  font-weight: 600;
  font-size: 0.88rem;
}

.trade-engine-saved-log-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.trade-engine-saved-log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.setup-batch-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.setup-batch-sort-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.setup-batch-sort-text {
  white-space: nowrap;
}

.setup-batch-sort {
  min-width: 11.5rem;
  max-width: 16rem;
  padding: 0.28rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  background: var(--surface-2, rgba(0, 0, 0, 0.2));
  color: var(--text-primary);
  font-size: 0.78rem;
}

.setup-batch-more {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--control-gap, 0.75rem);
  margin-top: var(--space-4, 1rem);
  padding: var(--space-3, 0.75rem) 0.35rem 0.15rem;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.setup-batch-more-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--control-gap, 0.75rem);
}

.setup-batch-page-meta {
  margin: 0;
  width: 100%;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.setup-batch-more .setup-batch-page-meta {
  width: auto;
}

.trade-engine-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.trade-engine-controls {
  margin-bottom: 0.75rem;
}

.trade-engine-auto-exec {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  color: var(--text-primary);
  cursor: pointer;
}

.trade-engine-setups-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.trade-engine-setups-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
}

.trade-engine-setups-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.setups-discovered-jump {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent-cyan, #60cdff) 55%, var(--border-subtle));
  background: color-mix(in srgb, var(--accent-cyan, #60cdff) 16%, transparent);
  color: var(--accent-cyan, #60cdff);
  font-size: 0.78rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.setups-discovered-jump:hover {
  background: color-mix(in srgb, var(--accent-cyan, #60cdff) 28%, transparent);
  text-decoration: none;
}

.setups-discovered-jump.is-hidden {
  display: none !important;
}

.setups-discovered-hero {
  margin: 1.1rem 0 1.35rem;
  padding: 1.05rem 1.15rem 1.2rem;
  border: 1px solid color-mix(in srgb, var(--accent-cyan, #60cdff) 35%, var(--border-subtle));
  border-radius: calc(var(--radius, 10px) + 2px);
  background:
    radial-gradient(ellipse at 12% 0%, rgba(96, 205, 255, 0.14), transparent 48%),
    radial-gradient(ellipse at 88% 100%, rgba(61, 214, 140, 0.1), transparent 42%),
    var(--bg-panel, rgba(22, 28, 40, 0.82));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  scroll-margin-top: 5.5rem;
}

.setups-discovered-hero.has-setups {
  border-color: color-mix(in srgb, var(--accent-cyan, #60cdff) 55%, var(--border-subtle));
}

.setups-discovered-hero.is-spotlight {
  animation: setups-spotlight 1.5s ease;
}

@keyframes setups-spotlight {
  0% {
    box-shadow: 0 0 0 0 rgba(96, 205, 255, 0.55);
  }
  40% {
    box-shadow: 0 0 0 10px rgba(96, 205, 255, 0.12);
  }
  100% {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  }
}

.setups-discovered-hero-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
}

.setups-discovered-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-cyan, #60cdff);
}

.setups-discovered-title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

.setups-discovered-lead {
  margin: 0;
  max-width: 40rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.setups-discovered-panel {
  margin-top: 0.85rem;
}

.setups-discovered-a .trade-cards,
.setups-discovered-b .trade-cards {
  gap: 1rem;
}

.setups-discovered-hero-workspace {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem;
}

.setups-discovered-hero-workspace .workspace-block {
  margin: 0;
}

.engine-setup-meta {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.setup-batch-group {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.setup-batch-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.setup-batch-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.setup-batch-head h4 {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

/* Batch groups stack vertically; cards inside each batch fill the row (3–4 wide). */
.setup-batch-cards {
  display: grid;
  gap: var(--control-gap, 0.75rem);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

#tradeEngineSetups.trade-cards,
#tradeEngineBGradeSetups.trade-cards {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  grid-template-columns: unset;
}

.setup-grade-wrap {
  min-width: 0;
  height: 100%;
}

.setup-grade-wrap > .trade-engine-setup-card {
  height: 100%;
}

.trade-engine-setup-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: var(--card-padding, 1rem);
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap, 1rem);
}

@media (max-width: 1100px) {
  .setup-batch-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .setup-batch-cards {
    grid-template-columns: 1fr;
  }
}

.trade-engine-setup-card .trade-card-head {
  margin-bottom: 0.55rem;
}

.engine-setup-compact-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.engine-setup-levels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.35rem 1rem;
  margin: 0 0 0.65rem;
  padding: 0;
}

.engine-setup-levels div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.engine-setup-levels dt {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.engine-setup-levels dd {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.engine-setup-read {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.65rem;
  border-left: 3px solid rgba(96, 165, 250, 0.45);
  background: rgba(15, 23, 42, 0.35);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.engine-setup-read h4 {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
}

.engine-setup-read p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.engine-setup-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--control-gap, 0.75rem) var(--space-3, 0.75rem);
  margin-top: var(--space-4, 1rem);
  margin-bottom: 0;
  padding-top: var(--space-3, 0.75rem);
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.engine-setup-actions .btn,
.engine-setup-actions .open-setup-project-btn,
.engine-setup-actions .execute-setup-btn,
.engine-setup-actions .gpt-review-btn {
  margin: 0;
  flex: 0 0 auto;
}

.engine-setup-primary-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--control-gap, 0.75rem);
  margin-left: auto;
}

.engine-gpt-model {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-1, 0.25rem);
  margin: 0;
  min-width: min(11rem, 100%);
  flex: 1 1 10rem;
  max-width: 16rem;
}

.engine-gpt-model span,
.engine-gpt-model .engine-gpt-model-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.2;
  margin: 0;
}

.engine-gpt-model select,
.engine-gpt-model .gpt-model-select {
  min-width: 0;
  width: 100%;
  margin: 0;
}

.trade-engine-setup-card .engine-setup-actions {
  margin-top: auto;
}

.page-data-loading-banner {
  display: none;
  align-items: center;
  gap: var(--control-gap, 0.75rem);
  margin: 0 0 var(--section-gap, 1.5rem);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md, 10px);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border-subtle));
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-panel));
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
}

.page-data-loading-banner.is-visible {
  display: flex;
}

.page-data-loading-banner .spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: page-data-spin 0.7s linear infinite;
  flex: 0 0 auto;
}

@keyframes page-data-spin {
  to {
    transform: rotate(360deg);
  }
}

.trade-engine-new-session-bar {
  display: none;
  align-items: center;
  justify-content: flex-start;
  gap: var(--control-gap, 0.75rem);
  margin: 0 0 var(--section-gap, 1.5rem);
}

.trade-engine-new-session-bar.is-visible {
  display: flex;
}

.pj-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--control-gap, 0.75rem) var(--space-3, 0.75rem);
  margin-bottom: var(--section-gap, 1.5rem);
}

.pj-view-toggle {
  display: inline-flex;
  gap: var(--space-2, 0.5rem);
  margin-left: auto;
  padding-left: var(--space-3, 0.75rem);
}

.pj-view-toggle .btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

.pj-folder-grid {
  gap: var(--control-gap, 0.75rem);
}

.pj-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2, 0.5rem);
}

.pj-list-row {
  display: grid;
  grid-template-columns:
    minmax(5.5rem, 0.8fr)
    minmax(4rem, 0.55fr)
    minmax(4.5rem, 0.6fr)
    minmax(4.5rem, 0.55fr)
    minmax(5.5rem, 0.75fr)
    minmax(7rem, 1.1fr);
  gap: var(--control-gap, 0.75rem);
  align-items: center;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 10px);
  background: var(--bg-panel);
  text-align: left;
  color: inherit;
  cursor: pointer;
  width: 100%;
}

.pj-list-row:hover {
  background: var(--bg-hover);
}

.pj-list-row .pj-list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.pj-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

@media (max-width: 960px) {
  .pj-list-row {
    grid-template-columns: 1fr 1fr;
  }
  .pj-list-row .pj-list-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

.setup-executed-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: #22c55e;
  text-transform: uppercase;
}

.trade-engine-setup-card.is-executed {
  opacity: 0.82;
}

.setup-card-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.setup-lifecycle-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
}

.setup-lifecycle-tradeable {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.12);
}

.setup-lifecycle-armed {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
}

.setup-lifecycle-watch {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(96, 165, 250, 0.12);
}

.setup-lifecycle-canceled {
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.1);
}

.trade-engine-setup-card.is-tradeable {
  border-color: rgba(34, 197, 94, 0.35);
}

.trade-engine-stats .label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.engine-activity-log {
  margin: 0 0 1rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius, 10px);
  background: color-mix(in srgb, var(--bg-panel, rgba(22, 28, 40, 0.75)) 92%, transparent);
}

.engine-activity-log-head {
  margin-bottom: 0.55rem;
}

.engine-activity-log-head h3 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 750;
}

.engine-activity-log-help {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.engine-activity-feed {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.15);
  margin-bottom: 0;
}

.engine-activity-row {
  display: grid;
  grid-template-columns: 5.5rem 7rem 1fr;
  gap: 0.5rem;
  align-items: center;
  padding: 0.35rem 0.25rem;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border-subtle);
}

.engine-activity-row.is-clickable {
  cursor: pointer;
  border-radius: 6px;
}

.engine-activity-row.is-clickable:hover,
.engine-activity-row.is-clickable:focus-visible {
  background: color-mix(in srgb, var(--accent-cyan, #60cdff) 12%, transparent);
  outline: none;
}

.engine-activity-row.is-setup-found .engine-activity-message {
  font-weight: 650;
}

.engine-activity-open-hint {
  display: inline-block;
  margin-left: 0.45rem;
  color: var(--accent-cyan, #60cdff);
  font-weight: 750;
  white-space: nowrap;
}

.engine-activity-row:last-child {
  border-bottom: none;
}

.trade-engine-setup-card.is-spotlight {
  animation: setups-spotlight 1.5s ease;
}

.engine-activity-time {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.engine-activity-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.engine-activity-message {
  color: var(--text-primary);
}

.learning-summary-panel .learning-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.learning-summary-panel .learning-grid div {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

.learning-summary-panel strong {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.learning-notes {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.engine-setup-reject {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: #fb923c;
}

.bible-chapter-checklist {
  margin-top: 0.45rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.12);
  font-size: 0.78rem;
}

.bible-chapter-checklist summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0;
  list-style: none;
}

.bible-chapter-checklist summary::-webkit-details-marker {
  display: none;
}

.bible-chapter-checklist[open] summary {
  margin-bottom: 0.35rem;
}

.bible-chapter-list {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
}

.bible-beginner-list {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  columns: 1;
}

.bible-ch-row {
  display: grid;
  grid-template-columns: 1.1rem minmax(8rem, 1.4fr) minmax(0, 1fr);
  gap: 0.35rem;
  align-items: baseline;
  padding: 0.12rem 0;
  color: var(--text-muted);
}

.bible-beginner-row {
  display: flex;
  gap: 0.4rem;
  align-items: baseline;
  padding: 0.1rem 0;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.bible-ch-pass,
.bible-beginner-yes {
  color: #4ade80;
}

.bible-ch-watch {
  color: #fbbf24;
}

.bible-ch-blocked {
  color: #f87171;
}

.bible-ch-detail {
  font-size: 0.75rem;
  opacity: 0.85;
}

.bible-beginner-title {
  margin: 0.55rem 0 0.15rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bible-primary-blocker {
  margin: 0.25rem 0 0.35rem;
  font-size: 0.78rem;
  color: #fb923c;
}

/* ── Tool pages (journal, scanner, signals, etc.) ── */

.section[id] {
  scroll-margin-top: 1.25rem;
}

.tool-page-desc {
  margin: 0 0 1.25rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
  max-width: 52rem;
}

.tool-page-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.tool-page-content h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.tool-page-content h3:first-child {
  margin-top: 0;
}

.tool-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tool-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 1.25rem;
  font-size: 0.85rem;
}

.tool-table th,
.tool-table td {
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.45rem 0.55rem;
  text-align: left;
  vertical-align: top;
}

.tool-table th {
  color: var(--text-muted);
  font-weight: 600;
}

.hint-list {
  margin: 0.5rem 0 1rem;
  padding-left: 1.2rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.tool-form {
  display: grid;
  gap: 0.85rem;
  max-width: 28rem;
  margin-bottom: 1.25rem;
}

.tool-form-wide {
  max-width: 52rem;
}

.bt-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 0.35rem;
}

.bt-result-header h3 {
  margin: 0;
}

#btCopyResultsBtn.is-copied {
  border-color: var(--accent-green, #39ff14);
  color: var(--accent-green, #39ff14);
}

.bt-saved-panel {
  margin: 0 0 1.5rem;
  padding: 1rem 1.1rem 1.15rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 12px);
  background: var(--surface-elevated, rgba(15, 23, 42, 0.55));
}

.bt-saved-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.bt-saved-panel-head h3 {
  margin: 0;
}

.bt-saved-table-wrap {
  overflow-x: auto;
  margin-top: 0.65rem;
}

.bt-saved-table td {
  vertical-align: top;
}

.bt-saved-banner {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.75rem;
  border-left: 3px solid var(--accent-cyan, #00f0ff);
  background: rgba(0, 240, 255, 0.06);
}

.bt-suggest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.bt-suggest-panel {
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 12px);
  background: rgba(15, 23, 42, 0.65);
}

.bt-suggest-disclaimer {
  padding: 0.55rem 0.75rem;
  border-left: 3px solid #fbbf24;
  background: rgba(251, 191, 36, 0.08);
  color: var(--text-primary);
  font-weight: 600;
}

.bt-sug-card {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm, 8px);
}

.bt-sug-card h5 {
  margin: 0 0 0.35rem;
}

.bt-sug-prio {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.bt-sug-prio-high {
  color: #ff4d6d;
}

.bt-sug-prio-medium {
  color: #fbbf24;
}

.bt-sug-prio-low {
  color: #39ff14;
}

.tool-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.tool-fieldset {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem 1rem;
  display: grid;
  gap: 0.65rem;
}

.tool-fieldset legend {
  padding: 0 0.35rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.tool-inline {
  display: inline-flex !important;
  align-items: center;
  gap: 0.4rem;
  grid-template-columns: none !important;
}

.tool-table-wrap {
  overflow-x: auto;
  margin-bottom: 1rem;
}

.tool-why {
  max-width: 16rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.outcome-pill {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.outcome-win { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.outcome-loss { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.outcome-timeout { background: rgba(234, 179, 8, 0.15); color: #fbbf24; }
.outcome-skipped { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }

.tool-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.tool-form input {
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.tool-form .hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Signals tool — NAS100-style playbook cards */
.signal-playbook-summary {
  margin: 0 0 1rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.signal-playbook-heading {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.05rem;
}

.signal-playbook-list {
  display: grid;
  gap: 1rem;
  margin: 0.75rem 0 1.25rem;
}

.signal-playbook-card {
  padding: 1rem 1.15rem 1.15rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(165deg, #0a0b0d 0%, #000 70%);
  color: #e8eef7;
}

.signal-playbook-card.is-explain {
  opacity: 0.92;
  border-style: dashed;
}

.signal-playbook-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.signal-playbook-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #f8fafc;
}

.signal-playbook-source {
  font-size: 0.75rem;
  color: #9aa0ab;
  letter-spacing: 0.02em;
}

.signal-playbook-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.55rem 1rem;
  margin: 0 0 0.85rem;
}

.signal-playbook-fields > div {
  display: grid;
  gap: 0.15rem;
}

.signal-playbook-fields dt {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9aa0ab;
}

.signal-playbook-fields dd {
  margin: 0;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.signal-playbook-result {
  grid-column: 1 / -1;
}

.signal-playbook-section {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(55, 65, 81, 0.65);
}

.signal-playbook-section h4 {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  color: #f3f4f6;
}

.signal-repeat-lead {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
  color: #9aa0ab;
}

.signal-playbook-section ul {
  margin: 0;
  padding-left: 1.15rem;
  color: #c5c7ce;
  font-size: 0.86rem;
  line-height: 1.45;
}

.signal-playbook-diagnostics {
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

/* B-grade discoveries — reuse Signals playbook cards */
.bg-panel {
  margin-top: 0.5rem;
}
.bg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.bg-card-list {
  margin-top: 0.5rem;
}
.bg-discovery-card.is-would-win {
  border-color: rgba(57, 255, 20, 0.45);
  box-shadow: 0 0 0 1px rgba(57, 255, 20, 0.12);
}
.bg-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 0.75rem;
}
.bg-win-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(57, 255, 20, 0.15);
  color: #39ff14;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.bg-bt-outcome {
  font-size: 0.75rem;
  color: #94a3b8;
}
.bg-notes-intro {
  margin: 0 0 0.45rem;
  color: #cbd5e1;
  font-size: 0.88rem;
}
.bg-req-list {
  margin: 0;
  padding-left: 1.1rem;
  color: #e2e8f0;
}
.bg-req-list li {
  margin: 0.35rem 0;
}
.bg-req-label {
  color: #67e8f9;
  font-weight: 700;
  margin-right: 0.25rem;
}
.bg-final-fields {
  display: grid;
  gap: 0.45rem 1rem;
  margin: 0;
}
.bg-final-fields > div {
  display: grid;
  grid-template-columns: 10.5rem 1fr;
  gap: 0.5rem;
}
.bg-final-fields dt {
  margin: 0;
  color: #94a3b8;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bg-final-fields dd {
  margin: 0;
  color: #e2e8f0;
}
.bg-final-reason {
  grid-column: 1 / -1;
}
.bg-final-reason dd {
  line-height: 1.45;
}
.bg-card-actions {
  margin-top: 0.85rem;
  display: flex;
  gap: 0.5rem;
}
.bg-feedback.is-error {
  color: #ff4d6d;
}
.lu-live-banner {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 77, 109, 0.65);
  background: rgba(255, 77, 109, 0.14);
  color: #ff4d6d;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: center;
}
.lu-live-auto-warn {
  margin: 0.65rem 0;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 77, 109, 0.55);
  background: rgba(255, 77, 109, 0.1);
  color: #fecdd3;
  font-size: 0.85rem;
  line-height: 1.45;
}
.lu-mandatory-a-exec {
  margin: 0 0 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.08);
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.45;
}
.lu-live-auto-confirm {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin-top: 0.65rem;
  color: #fff;
  font-weight: 650;
}
.lu-email-status {
  font-size: 0.78rem;
  white-space: nowrap;
}

.signal-playbook-diagnostics summary {
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.tool-json {
  margin: 0;
  padding: 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  line-height: 1.45;
  overflow-x: auto;
  color: var(--text-secondary);
}

.tool-error {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 0.88rem;
}

.tool-running {
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* Trade engine setup execution status */
.engine-exec-status {
  margin: 0.65rem 0 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
}

.engine-exec-status.is-preview {
  border-color: rgba(34, 211, 238, 0.25);
  background: rgba(34, 211, 238, 0.06);
}

.engine-exec-status.is-success {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
}

.engine-exec-status.is-failed {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

.engine-exec-head {
  margin-bottom: 0.45rem;
  font-size: 0.82rem;
}

.engine-exec-grid {
  margin-top: 0.25rem;
}

.engine-exec-distance,
.engine-exec-message {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.trade-engine-setup-card.is-exec-failed {
  border-color: rgba(239, 68, 68, 0.35);
}

.setup-executed-tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: #22c55e;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.engine-setup-actions .btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

/* Repeatable Setup Scanner (standalone) */
.rss-panel { display: flex; flex-direction: column; gap: 0.85rem; }
.rss-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; align-items: center; }
.rss-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.rss-status { font-size: 0.9rem; color: var(--text-secondary); }
.rss-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.rss-filter-label {
  font-size: 0.78rem;
  color: var(--text-secondary, #94a3b8);
  margin-right: 0.15rem;
}
.rss-filter {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: transparent;
  color: inherit;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.82rem;
  cursor: pointer;
}
.rss-filter.is-active {
  background: rgba(34, 197, 94, 0.18);
  border-color: #22c55e;
}
.rss-filter[data-filter="all"].is-active {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
}
.rss-section { display: grid; gap: 0.55rem; margin-bottom: 1rem; }
.rss-section-title {
  margin: 0;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.rss-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary, #94a3b8);
}
.rss-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.rss-tab {
  border: 1px solid var(--border-color, #334155);
  background: transparent;
  color: var(--text-primary, #e2e8f0);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
}
.rss-tab.active { background: rgba(59, 130, 246, 0.2); border-color: #3b82f6; }
.rss-feedback { padding: 0.65rem 0.8rem; border-radius: 0.5rem; background: rgba(59, 130, 246, 0.12); }
.rss-feedback.error { background: rgba(239, 68, 68, 0.15); color: #fecaca; }
.rss-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0.75rem; }
.rss-card { border: 1px solid var(--border-color, #334155); border-radius: 0.75rem; padding: 0.85rem; background: rgba(15, 23, 42, 0.45); }
.rss-card-head { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.35rem; }
.rss-grade { font-weight: 700; font-size: 0.78rem; padding: 0.1rem 0.45rem; border-radius: 999px; }
.rss-grade.grade-A { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.rss-grade.grade-B { background: rgba(234, 179, 8, 0.2); color: #facc15; }
.rss-score { margin-left: auto; font-variant-numeric: tabular-nums; }
.rss-card-meta, .rss-card-levels { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 0.35rem; }
.rss-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.rss-table th, .rss-table td { border-bottom: 1px solid rgba(148, 163, 184, 0.2); padding: 0.45rem 0.35rem; text-align: left; vertical-align: top; }
.btn-small { font-size: 0.78rem; padding: 0.25rem 0.55rem; }

/* Live scan pipeline visibility (ticket PART A §A1).
   On Account Workspace this is a .workspace-block card; keep legacy padding
   only when it is not already a workspace card. */
.trade-engine-pipeline:not(.workspace-block) {
  margin: 0.75rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 8px;
  background: rgba(88, 166, 255, 0.06);
}

.trade-engine-pipeline.is-hidden {
  display: none !important;
}

.pipeline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.pipeline-head h4 {
  margin: 0;
  font-size: 0.95rem;
}

.pipeline-elapsed {
  font-size: 0.82rem;
  color: var(--text-secondary, #9aa4b2);
  font-variant-numeric: tabular-nums;
}

.platform-summary {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.06);
}

.platform-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 0.75rem;
  font-size: 0.84rem;
}

.platform-label {
  color: var(--text-secondary, #9aa4b2);
}

.platform-value {
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.platform-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.1rem;
  font-size: 0.84rem;
}

.platform-actions input[type="number"] {
  width: 4.5rem;
  margin: 0 0.35rem;
}

.gpt-reviewer-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(125, 211, 252, 0.45);
  border-radius: 8px;
  background: rgba(125, 211, 252, 0.1);
}

.gpt-reviewer-banner.is-hidden,
.gpt-reviewer-banner .is-hidden {
  display: none;
}

.gpt-reviewer-banner-text {
  font-size: 0.82rem;
  color: #7dd3fc;
}

.section-hint {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  color: var(--text-secondary, #9aa4b2);
}

.login-2fa-lead {
  margin: 0 0 0.85rem;
  font-size: 0.92rem;
  color: var(--text-secondary, #9aa4b2);
  line-height: 1.45;
}

.login-2fa-setup {
  margin: 0 0 1rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.35);
  font-size: 0.82rem;
  color: var(--text-secondary, #9aa4b2);
}

.login-2fa-setup-title,
.login-2fa-step2 {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary, #e8eef7);
}

.login-2fa-setup-hint {
  margin: 0.55rem 0 0.35rem;
  line-height: 1.4;
}

.login-2fa-manual-label {
  margin: 0.55rem 0 0.25rem;
  font-size: 0.8rem;
}

.login-2fa-link-wrap {
  margin: 0.55rem 0 0;
}

.login-2fa-qr {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0.35rem auto 0.25rem;
  padding: 0.65rem;
  width: fit-content;
  max-width: 100%;
  border-radius: 8px;
  background: #fff;
}

.login-2fa-qr img,
.login-2fa-qr canvas {
  display: block;
}

.login-2fa-key {
  display: block;
  margin-top: 0.25rem;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.55);
  word-break: break-all;
  font-size: 0.78rem;
  color: var(--text-primary, #e8eef7);
  user-select: all;
}

.login-2fa-back {
  width: 100%;
  margin-top: 0.55rem;
}

.login-form-modern.is-hidden,
.login-form-modern[hidden] {
  display: none !important;
}

.section-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.55rem;
}

.section-header-row h2 {
  margin-bottom: 0.35rem;
}

.section-header-row .section-hint {
  margin-bottom: 0;
  max-width: 46rem;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.trade-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.trade-card-id {
  font-size: 0.72rem;
  color: var(--text-secondary, #9aa4b2);
  overflow-wrap: anywhere;
}

.broker-orders-feedback,
.broker-positions-feedback {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  color: #7dd3fc;
}

.broker-orders-feedback.is-error,
.broker-positions-feedback.is-error {
  color: #f87171;
}

.broker-orders-feedback.is-hidden,
.broker-positions-feedback.is-hidden {
  display: none;
}

.position-badge.is-profit {
  color: #4ade80;
}

.position-badge.is-loss {
  color: #f87171;
}

.scan-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.pipeline-eta {
  margin-left: auto;
  font-size: 0.82rem;
  font-weight: 600;
  color: #7dd3fc;
  font-variant-numeric: tabular-nums;
}

.pipeline-throttle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(251, 191, 36, 0.5);
  border-radius: 8px;
  background: rgba(251, 191, 36, 0.12);
}

.pipeline-throttle.is-hidden {
  display: none;
}

.pipeline-throttle-text {
  font-size: 0.82rem;
  color: #fbbf24;
}

.pipeline-stuck {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  margin-bottom: 0.7rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(201, 162, 39, 0.5);
  border-radius: 8px;
  background: rgba(201, 162, 39, 0.12);
}

.pipeline-stuck.is-hidden {
  display: none;
}

.pipeline-stuck-text {
  flex: 1 1 14rem;
  font-size: 0.82rem;
  color: #e6c35c;
}

.pipeline-progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
  margin-bottom: 0.7rem;
}

.pipeline-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6, #22c55e);
  transition: width 0.35s ease;
}

.pipeline-counters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.5rem 0.85rem;
  margin-bottom: 0.7rem;
}

.pipeline-counters > div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.pipeline-counters .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary, #9aa4b2);
}

.pipeline-counters > div > span:last-child {
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pipeline-active-wrap {
  margin-bottom: 0.7rem;
}

.pipeline-active-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary, #9aa4b2);
  margin-bottom: 0.3rem;
}

.pipeline-active-symbols {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pipeline-chip {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.pipeline-chip.is-active {
  animation: pipeline-pulse 1.6s ease-in-out infinite;
}

@keyframes pipeline-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.pipeline-empty {
  font-size: 0.82rem;
  color: var(--text-secondary, #9aa4b2);
}

.pipeline-symbol-table-wrap {
  max-height: 260px;
  overflow-y: auto;
  border-radius: 6px;
}

.pipeline-symbol-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.pipeline-symbol-table th {
  position: sticky;
  top: 0;
  text-align: left;
  padding: 0.3rem 0.45rem;
  background: rgba(15, 23, 42, 0.92);
  color: var(--text-secondary, #9aa4b2);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pipeline-symbol-table td {
  padding: 0.32rem 0.45rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  vertical-align: middle;
}

.pipeline-symbol {
  font-weight: 600;
}

.pipeline-stage-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.2);
}

.pipeline-stage-badge.stage-fetching { background: rgba(59, 130, 246, 0.22); color: #93c5fd; }
.pipeline-stage-badge.stage-validating { background: rgba(234, 179, 8, 0.2); color: #facc15; }
.pipeline-stage-badge.stage-analyzing { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }
.pipeline-stage-badge.stage-completed { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.pipeline-stage-badge.stage-failed { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

.pipeline-fail { color: #fca5a5; }

.pipeline-empty-row td {
  color: var(--text-secondary, #9aa4b2);
  font-style: italic;
}

/* Chart viewer — inspect the charts behind a scan verdict */
.chart-viewer-meta {
  margin-bottom: 0.9rem;
  font-size: 0.88rem;
  color: var(--text-secondary, #9aa4b2);
}
.chart-viewer-path code,
.chart-card-file code {
  font-size: 0.76rem;
  color: #93c5fd;
  word-break: break-all;
}
.chart-viewer-empty { color: #facc15; }
.chart-viewer-error { color: #fca5a5; }

/* Decision logic panel — why the engine reached this verdict */
.chart-reasoning {
  margin: 0 0 1rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.06);
}

.chart-reasoning-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent-cyan, #7dd3fc);
  list-style: none;
}

.chart-reasoning-summary::-webkit-details-marker {
  display: none;
}

.chart-reasoning-chevron::after {
  content: "▾";
  display: inline-block;
  transition: transform 0.15s ease;
}

.chart-reasoning[open] .chart-reasoning-chevron::after {
  transform: rotate(180deg);
}

.chart-reasoning-body {
  padding: 0 0.9rem 0.9rem;
  font-size: 0.85rem;
}

.chart-reasoning-body h3 {
  margin: 0.9rem 0 0.35rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary, #9aa4b2);
}

.chart-reasoning-verdict {
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  background: rgba(125, 211, 252, 0.1);
}

.chart-reasoning-source {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.76rem;
  color: var(--text-secondary, #9aa4b2);
}

.chart-reasoning-list {
  margin: 0.25rem 0 0;
  padding-left: 1.15rem;
}

.chart-reasoning-list li {
  margin-bottom: 0.22rem;
  overflow-wrap: anywhere;
}

.chart-reasoning-list.is-blockers li {
  color: #fca5a5;
}

.chart-reasoning-empty {
  margin: 0;
  color: var(--text-secondary, #9aa4b2);
}

.chart-card-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.chart-viewer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 1500px) {
  .chart-viewer-grid { grid-template-columns: 1fr 1fr; }
}
.chart-card {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.5);
  padding: 0.7rem 0.85rem;
}
.chart-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.chart-card-tf { display: block; font-size: 0.95rem; }
.chart-card-sub {
  display: block;
  font-size: 0.76rem;
  color: var(--text-secondary, #9aa4b2);
}
.chart-canvas {
  width: 100%;
  height: auto;
  background: rgba(2, 6, 23, 0.55);
  border-radius: 6px;
}
.chart-card-file { margin: 0.45rem 0 0; }

/* "View charts" links inside scan review / setup cards */
.engine-chart-link {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.78rem;
  color: #93c5fd;
  text-decoration: underline;
}
.engine-chart-link:hover { color: #bfdbfe; }

/* GPT model picker inline with review buttons */
.engine-gpt-model {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-secondary, #9aa4b2);
  margin-right: 0.4rem;
}
.engine-gpt-model select {
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-primary, #e2e8f0);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 5px;
  padding: 0.15rem 0.3rem;
  font-size: 0.75rem;
}

/* GPT Review History page */
.gr-panel {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.45);
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}
.gr-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--control-gap, 0.75rem) var(--space-4, 1rem);
  align-items: flex-end;
}
.gr-field { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.78rem; color: var(--text-secondary, #9aa4b2); }
.gr-field-grow { flex: 1 1 320px; }
.gr-field select {
  background: rgba(2, 6, 23, 0.7);
  color: var(--text-primary, #e2e8f0);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 6px;
  padding: 0.35rem 0.45rem;
  min-width: 150px;
}
.gr-root { margin: 0.7rem 0 0; font-size: 0.78rem; color: var(--text-secondary, #9aa4b2); }
.gr-root code { color: #93c5fd; word-break: break-all; }
.gr-feedback { margin: 0.6rem 0 0; padding: 0.5rem 0.7rem; border-radius: 6px; background: rgba(59,130,246,0.12); font-size: 0.85rem; }
.gr-feedback.is-error { background: rgba(239,68,68,0.15); color: #fecaca; }
.gr-detail {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.45);
  padding: 0.9rem 1rem;
}
.gr-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.6rem; }
.gr-detail-head h3 { margin: 0; font-size: 1rem; }
.gr-badge { display: inline-block; padding: 0.12rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: rgba(148,163,184,0.2); }
.gr-badge.gr-agree { background: rgba(34,197,94,0.2); color: #4ade80; }
.gr-badge.gr-disagree { background: rgba(239,68,68,0.2); color: #fca5a5; }
.gr-review-latest { border: 1px solid rgba(88,166,255,0.25); background: rgba(88,166,255,0.07); border-radius: 6px; padding: 0.6rem 0.75rem; margin-bottom: 0.7rem; }
.gr-review-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.gr-review-meta { font-size: 0.78rem; color: var(--text-secondary, #9aa4b2); }
.gr-review-bullets { margin: 0.45rem 0 0 1.1rem; font-size: 0.85rem; }
.gr-diff { margin: 0.5rem 0 0; font-size: 0.85rem; color: #fde68a; }
.gr-analysis summary, .gr-files summary { cursor: pointer; font-size: 0.85rem; color: #93c5fd; }
.gr-analysis-text {
  max-height: 430px; overflow: auto; background: rgba(2,6,23,0.65);
  border-radius: 6px; padding: 0.7rem; font-size: 0.74rem; line-height: 1.45; white-space: pre-wrap;
}
.gr-folder code { color: #93c5fd; word-break: break-all; }

/* Outcome logging + learned evidence */
.gr-section-title { margin: 0 0 0.35rem; font-size: 1rem; }
.gr-help { font-size: 0.8rem; color: var(--text-secondary, #9aa4b2); margin: 0.3rem 0; }
.gr-field input[type="text"], .gr-field input[type="number"] {
  background: rgba(2, 6, 23, 0.7);
  color: var(--text-primary, #e2e8f0);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 6px; padding: 0.35rem 0.45rem; min-width: 120px;
}
.gr-headline { font-size: 0.95rem; margin: 0.2rem 0 0.6rem; }
.gr-props { list-style: none; padding: 0; margin: 0 0 0.9rem; display: grid; gap: 0.4rem; }
.gr-prop { padding: 0.45rem 0.6rem; border-radius: 6px; font-size: 0.84rem;
  background: rgba(148,163,184,0.12); border-left: 3px solid rgba(148,163,184,0.5); }
.gr-prop-high { background: rgba(239,68,68,0.12); border-left-color: #ef4444; }
.gr-prop-info { background: rgba(34,197,94,0.10); border-left-color: #22c55e; }
.gr-evidence { display: block; font-size: 0.76rem; color: var(--text-secondary, #9aa4b2); margin-top: 0.15rem; }
.gr-bucket-title { margin: 0.7rem 0 0.3rem; font-size: 0.85rem; color: var(--text-secondary, #9aa4b2); }
.gr-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; margin-bottom: 0.5rem; }
.gr-table th, .gr-table td { text-align: left; padding: 0.28rem 0.4rem; border-bottom: 1px solid rgba(148,163,184,0.15); }
.gr-table th { color: var(--text-secondary, #9aa4b2); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.gr-row-thin { opacity: 0.55; }

/* Scan History */
.sh-panel,
.pj-panel {
  margin-top: 0.85rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-card);
}

.sh-toolbar,
.pj-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--control-gap, 0.75rem) var(--space-4, 1rem);
  align-items: flex-end;
  margin-bottom: var(--space-5, 1.25rem);
}

.sh-field,
.pj-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pj-field-grow { flex: 1 1 16rem; }

.sh-field select,
.pj-field select,
.pj-field input[type="search"] {
  min-width: 10rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: #000000;
  color: #ffffff;
}

.sh-field select option,
.pj-field select option,
.sh-field select optgroup,
.pj-field select optgroup {
  background-color: #000000;
  color: #ffffff;
}

.sh-field-outcome select {
  min-width: 16rem;
  max-width: 22rem;
}

.sh-outcome-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}

.sh-outcome-chips.is-hidden {
  display: none;
}

.sh-outcome-chip {
  border: 1px solid var(--border-subtle);
  background: rgba(2, 6, 23, 0.45);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  cursor: pointer;
  line-height: 1.35;
}

.sh-outcome-chip:hover {
  color: var(--text-primary);
  border-color: rgba(148, 163, 184, 0.55);
}

.sh-outcome-chip.is-active {
  color: var(--text-primary);
  border-color: rgba(96, 165, 250, 0.65);
  background: rgba(59, 130, 246, 0.16);
}

.sh-outcome-chip .sh-chip-count {
  opacity: 0.75;
  margin-left: 0.25rem;
}

.sh-meta,
.pj-meta {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  align-self: center;
}

.pj-cleanup-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(122, 248, 255, 0.22);
  border-radius: 8px;
  background: rgba(0, 240, 255, 0.05);
}
.pj-cleanup-banner.is-hidden {
  display: none;
}
.pj-cleanup-banner.is-done {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
}
.pj-cleanup-banner.is-error {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.08);
}
.pj-cleanup-text {
  margin: 0;
  flex: 1 1 18rem;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--text-muted, #9aa7b8);
}

.sh-feedback,
.pj-feedback {
  margin: 0 0 0.65rem;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.12);
  font-size: 0.85rem;
}

.sh-feedback.is-error,
.pj-feedback.is-error {
  background: rgba(239, 68, 68, 0.15);
  color: #fecaca;
}

.sh-date-list { display: grid; gap: 0.85rem; }

.sh-date-card {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  background: rgba(2, 6, 23, 0.25);
}

.sh-date-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.55rem;
}

.sh-date-head h3 { margin: 0; font-size: 1rem; }

.sh-date-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.sh-stat.is-a { color: #3fb950; }
.sh-stat.is-b { color: #c9a227; }

.sh-archive-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.55rem 0.85rem;
  padding: 0.55rem 0;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.sh-archive-meta,
.sh-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0.2rem 0 0.45rem;
}

.sh-archive-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.sh-pair-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.sh-pair-chip {
  display: inline-block;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--accent-cyan);
  text-decoration: none;
}

.sh-field-grow { flex: 1 1 12rem; }

.sh-field input[type="search"] {
  min-width: 10rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.55);
  color: var(--text-primary);
}

.sh-table-wrap {
  overflow-x: auto;
  margin-top: 0.45rem;
}

.sh-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.sh-table th,
.sh-table td {
  text-align: left;
  padding: 0.4rem 0.45rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  vertical-align: top;
}

.sh-table th {
  color: var(--text-secondary, #9aa4b2);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sh-why-cell {
  max-width: 28rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.sh-pkg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  white-space: nowrap;
}

.sh-grade-pill {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  font-size: 0.72rem;
}

.sh-grade-pill.is-a { color: #3fb950; border-color: rgba(63, 185, 80, 0.45); }
.sh-grade-pill.is-b { color: #c9a227; border-color: rgba(201, 162, 39, 0.45); }
.sh-grade-pill.is-no { color: var(--text-muted); }

.sh-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin-top: 0.55rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Projects */
.pj-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.pj-folder-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.35);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.pj-folder-card:hover {
  border-color: rgba(0, 229, 255, 0.35);
}

.pj-folder-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pj-folder-meta,
.pj-folder-grades {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pj-detail-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.pj-detail-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.pj-attempt-list {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.pj-attempt-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--control-gap, 0.75rem) var(--space-4, 1rem);
  margin: 0 0 var(--stack-gap, 1rem);
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 10px);
  background: var(--bg-elevated);
}

.pj-attempt-identity-symbol {
  font-size: 1.05rem;
  min-width: 5rem;
}

.pj-attempt-row.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-panel));
}

.pj-attempt-row.is-loading {
  opacity: 0.85;
  cursor: wait;
}

.pj-attempt-load-status {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  min-height: 1em;
}

.pj-brief.is-loading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 1.1rem 1.2rem;
}

.pj-brief.is-error {
  border-color: color-mix(in srgb, var(--accent-danger) 45%, var(--border-subtle));
}

.pj-brief-blocked {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-danger) 12%, transparent);
  color: var(--text-primary);
  font-weight: 600;
}

.pj-chart-status {
  margin: 1rem 0;
}

.pj-chart-status h4 {
  margin: 0 0 0.5rem;
}

.pj-chart-status-banner {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.86rem;
}

.pj-chart-status-banner.is-ok {
  background: var(--success-bg, rgba(108, 203, 95, 0.14));
}

.pj-chart-status-banner.is-warn {
  background: var(--warning-bg, rgba(247, 163, 0, 0.14));
}

.pj-chart-status-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
}

.pj-chart-status-table th,
.pj-chart-status-table td {
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: top;
}

.pj-chart-status-table tr.is-ok td {
  color: var(--accent-green, #6ccb5f);
}

.pj-chart-status-table tr.is-bad td {
  color: var(--accent-danger, #f1707a);
}

.pj-attempt-exclude {
  display: flex;
  flex-wrap: wrap;
  gap: var(--control-gap, 0.75rem);
  margin-top: 0.85rem;
}

.chart-failure-action-banner {
  display: block;
  margin: var(--section-gap, 1.5rem) 0;
  padding: var(--card-padding, 1rem);
  border: 1px solid color-mix(in srgb, var(--accent-danger) 40%, var(--border-subtle));
  border-radius: var(--radius-md, 10px);
  background: color-mix(in srgb, var(--accent-danger) 10%, var(--bg-panel));
}

.chart-failure-action-banner p {
  margin: 0.35rem 0 0.65rem;
}

.chart-failure-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--control-gap, 0.75rem);
}

.pj-attempt-row {
  display: grid;
  grid-template-columns: 7rem 1fr auto auto;
  gap: 0.55rem 0.85rem;
  align-items: center;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.3);
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-size: 0.85rem;
}

.pj-attempt-row:hover {
  border-color: rgba(0, 229, 255, 0.3);
}

.pj-attempt-run {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pj-package-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.pj-demo-exec-note {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: #fde68a;
  line-height: 1.4;
}

.pj-live-cash-note {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: #fda4af;
  line-height: 1.4;
}

.pj-live-cash-panel {
  margin: 0 0 1rem;
  padding: 0.85rem 0.95rem;
  border-radius: 10px;
  border: 1px solid rgba(251, 113, 133, 0.35);
  background: rgba(127, 29, 29, 0.18);
}

.pj-live-cash-panel h3 {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
}

.pj-live-cash-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.45rem 0.85rem;
  margin: 0.65rem 0 0.85rem;
}

.pj-live-cash-facts > div,
.pj-live-cash-approval-dl > div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.55rem;
}

.pj-live-cash-facts dt,
.pj-live-cash-approval-dl dt {
  margin: 0;
  color: var(--text-muted, #94a3b8);
  font-size: 0.72rem;
}

.pj-live-cash-facts dd,
.pj-live-cash-approval-dl dd {
  margin: 0;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.pj-live-cash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.pj-live-cash-error {
  color: #fecaca;
}

.pj-live-cash-verified {
  border: 1px solid rgba(74, 222, 128, 0.45);
  border-radius: 0.55rem;
  padding: 0.85rem 1rem;
  background: rgba(22, 101, 52, 0.22);
}

.pj-live-cash-verified h3 {
  margin: 0 0 0.35rem;
  color: #bbf7d0;
}

.pj-live-cash-unverified {
  border: 1px solid rgba(250, 204, 21, 0.45);
  border-radius: 0.55rem;
  padding: 0.85rem 1rem;
  background: rgba(113, 63, 18, 0.28);
}

.pj-live-cash-unverified h3 {
  margin: 0 0 0.35rem;
  color: #fde68a;
}

.pj-live-cash-panel .pj-live-cash-error {
  border: 1px solid rgba(248, 113, 113, 0.45);
  border-radius: 0.55rem;
  padding: 0.85rem 1rem;
  background: rgba(127, 29, 29, 0.28);
}

.pj-live-cash-approval {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.72);
}

.pj-live-cash-approval.is-hidden {
  display: none !important;
}

.pj-live-cash-approval-card {
  width: min(34rem, 100%);
  padding: 1.1rem 1.2rem 1.2rem;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: #1f2937;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.pj-live-cash-approval-card h3 {
  margin: 0 0 0.45rem;
  color: #fde68a;
}

.pj-live-cash-approval-card p {
  margin: 0 0 0.75rem;
  line-height: 1.45;
}

.pj-live-cash-approval-dl {
  display: grid;
  gap: 0.35rem;
  margin: 0 0 0.95rem;
}

.pj-live-cash-approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.pj-submit-preview,
.gr-submit-preview {
  margin: 0.55rem 0 0.75rem;
}

.pj-preview-card,
.gr-preview-card {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  background: rgba(15, 23, 42, 0.55);
}

.pj-preview-card.is-warn,
.gr-preview-card.is-warn {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.08);
}

.pj-preview-card > header,
.gr-preview-card > header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.45rem;
}

.pj-preview-card > header span,
.gr-preview-card > header span {
  font-size: 0.8rem;
  color: var(--text-muted, #94a3b8);
}

.pj-preview-list,
.gr-preview-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.28rem;
}

.pj-preview-list li,
.gr-preview-list li {
  display: grid;
  grid-template-columns: minmax(9rem, 40%) 1fr;
  gap: 0.5rem;
  font-size: 0.8rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.pj-preview-list li span,
.gr-preview-list li span {
  color: var(--text-muted, #94a3b8);
}

.pj-preview-list li strong,
.gr-preview-list li strong {
  font-weight: 600;
  word-break: break-word;
}

.pj-preview-note,
.pj-preview-blockers,
.gr-preview-note,
.gr-preview-blockers {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  color: var(--text-secondary, #9aa4b2);
  line-height: 1.4;
}

.pj-submit-progress,
.gr-submit-progress {
  margin: 0.55rem 0 0.75rem;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  background: rgba(14, 165, 233, 0.06);
}

.pj-progress-head,
.gr-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.pj-progress-head span,
.gr-progress-head span {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: #7dd3fc;
}

.pj-progress-steps,
.gr-progress-steps {
  margin: 0 0 0.65rem;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.28rem;
  font-size: 0.8rem;
}

.pj-progress-steps li,
.gr-progress-steps li {
  color: var(--text-muted, #94a3b8);
}

.pj-progress-steps li.is-active,
.gr-progress-steps li.is-active {
  color: #e2e8f0;
  font-weight: 600;
}

.pj-progress-steps li.is-done,
.gr-progress-steps li.is-done {
  color: #86efac;
}

.pj-progress-steps li.is-failed,
.gr-progress-steps li.is-failed {
  color: #fca5a5;
  font-weight: 600;
}

.pj-progress-bar,
.gr-progress-bar {
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.pj-progress-bar-fill,
.gr-progress-bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #0ea5e9, #22d3ee);
  transition: width 0.25s ease;
}

.pj-progress-eta,
.gr-progress-eta {
  margin: 0.45rem 0 0;
  font-size: 0.76rem;
  color: var(--text-secondary, #9aa4b2);
}

.pj-submit-result,
.gr-submit-result {
  margin: 0.55rem 0 0.75rem;
}

.pj-result-card,
.gr-result-card {
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.55);
}

.pj-result-card.is-ok,
.gr-result-card.is-ok {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.07);
}

.pj-result-card.is-error,
.gr-result-card.is-error {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.08);
}

.pj-result-card > header,
.gr-result-card > header {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.45rem;
}

.pj-result-card > header span,
.gr-result-card > header span {
  font-size: 0.8rem;
  color: var(--text-secondary, #9aa4b2);
}

.pj-result-bullets,
.gr-result-bullets {
  margin: 0.55rem 0 0 1.1rem;
  font-size: 0.82rem;
}

.pj-result-error,
.gr-result-error {
  margin: 0.55rem 0 0;
  font-size: 0.82rem;
  color: #fecaca;
}

.pj-latest-review {
  margin-bottom: 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  background: rgba(88, 166, 255, 0.08);
  font-size: 0.85rem;
}

.pj-analysis-card {
  margin: 0.75rem 0;
}

.pj-brief {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(2, 6, 23, 0.88));
}

.pj-brief.is-notrade { border-color: rgba(248, 113, 113, 0.4); }
.pj-brief.is-watch { border-color: rgba(251, 191, 36, 0.45); }
.pj-brief.is-trade { border-color: rgba(74, 222, 128, 0.45); }
.pj-brief.is-empty {
  color: var(--text-muted, #94a3b8);
  font-size: 0.85rem;
}

.pj-brief-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.55rem;
}

.pj-brief-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted, #94a3b8);
}

.pj-brief-head h3 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
}

.pj-brief-grade {
  font-size: 0.82rem;
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.16);
  white-space: nowrap;
}

.pj-brief-bias {
  margin: 0 0 0.7rem;
  font-size: 0.92rem;
}

.pj-brief-block h4,
.pj-brief-thumbs h4 {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  color: #cbd5e1;
}

.pj-brief-block ul {
  margin: 0 0 0.7rem;
  padding-left: 1.15rem;
  font-size: 0.86rem;
  line-height: 1.45;
}

.pj-brief-levels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.pj-brief-levels > div {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  background: rgba(30, 41, 59, 0.55);
}

.pj-brief-levels span {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 0.15rem;
}

.pj-brief-levels strong {
  font-size: 0.95rem;
}

.pj-brief-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.pj-watched-section,
.pj-rejection-section {
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}
.pj-watched-section h4,
.pj-rejection-section h4 {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
}
.pj-watched-headline {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  color: var(--text-muted, #94a3b8);
}
.pj-watched-setup + .pj-watched-setup {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.25);
}
.pj-watched-levels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem 0.85rem;
  margin: 0;
}
.pj-watched-levels > div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.55rem;
  align-items: baseline;
}
.pj-watched-levels dt {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted, #94a3b8);
}
.pj-watched-levels dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pj-watched-confidence {
  grid-column: 1 / -1;
}
.pj-watched-meta {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
}
.pj-next-check-countdown {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.85rem;
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(14, 165, 233, 0.1);
}
.pj-next-check-countdown.is-soon {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(245, 158, 11, 0.12);
}
.pj-next-check-countdown.is-due {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(16, 185, 129, 0.12);
}
.pj-next-check-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.65rem;
}
.pj-next-check-label {
  color: #7dd3fc;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pj-next-check-countdown.is-soon .pj-next-check-label {
  color: #fde68a;
}
.pj-next-check-countdown.is-due .pj-next-check-label {
  color: #6ee7b7;
}
.pj-next-check-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #e0f2fe;
  line-height: 1;
}
.pj-next-check-countdown.is-soon .pj-next-check-value {
  color: #fef3c7;
}
.pj-next-check-countdown.is-due .pj-next-check-value {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: #a7f3d0;
}
.pj-next-check-meta {
  flex: 1 1 12rem;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
}
.pj-rejection-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.pj-rejection-table th,
.pj-rejection-table td {
  padding: 0.4rem 0.45rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  text-align: left;
  vertical-align: top;
}
.pj-rejection-table th {
  color: var(--text-muted, #94a3b8);
  font-weight: 600;
}
.pj-rejection-table td:first-child {
  white-space: nowrap;
  width: 4.5rem;
}

.pj-brief-actions {
  margin-top: 0.35rem;
  font-size: 0.86rem;
  display: grid;
  gap: 0.2rem;
}

.pj-brief-actions p { margin: 0; }

.pj-brief-final {
  margin-top: 0.25rem !important;
  font-weight: 700;
  color: #fde68a;
}

.pj-brief-thumbs { margin-top: 0.85rem; }

.pj-thumb-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.55rem;
}

.pj-thumb {
  margin: 0;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(2, 6, 23, 0.7);
}

.pj-thumb img {
  display: block;
  width: 100%;
  height: auto;
  background: #0b1220;
}

.pj-thumb figcaption {
  padding: 0.28rem 0.4rem;
  font-size: 0.7rem;
  color: var(--text-muted, #94a3b8);
}

.pj-brief-gpt-note {
  margin: 0.8rem 0 0;
  font-size: 0.78rem;
  color: #86efac;
}

.pj-analysis-trail {
  margin: 0.55rem 0 0.9rem;
}

.pj-analysis-trail summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: #93c5fd;
}

.pj-gpt-checklist {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.25rem 0.6rem;
  font-size: 0.78rem;
}

.pj-gpt-checklist li.is-yes { color: #86efac; }
.pj-gpt-checklist li.is-no { color: #fca5a5; }
.pj-gpt-checklist code {
  color: #cbd5e1;
  font-size: 0.74rem;
}

.pj-preview-checklist {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.pj-brief-preview-details {
  margin-top: 0.55rem;
  font-size: 0.8rem;
}

.pj-brief-preview-details summary {
  cursor: pointer;
  color: #93c5fd;
}

.pj-brief-preview-text {
  margin: 0.4rem 0 0;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.76rem;
  line-height: 1.4;
  background: rgba(2, 6, 23, 0.65);
  border-radius: 6px;
  padding: 0.55rem 0.65rem;
}

.pj-analysis-text {
  max-height: 380px;
  overflow: auto;
  background: rgba(2, 6, 23, 0.65);
  border-radius: 6px;
  padding: 0.7rem;
  font-size: 0.74rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

@media (max-width: 800px) {
  .pj-brief-levels,
  .pj-brief-grid,
  .pj-watched-levels {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  .pj-attempt-row {
    grid-template-columns: 1fr;
  }

  .pj-preview-list li,
  .gr-preview-list li {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
}

/* Near-Miss Monitor (autonomous recheck + learning) */
.nm-panel {
  display: grid;
  gap: 1.1rem;
}
.nm-status-row {
  font-size: 0.85rem;
  color: var(--text-muted, #94a3b8);
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.35);
}
.nm-feedback {
  margin: 0;
  font-size: 0.85rem;
  color: #86efac;
}
.nm-feedback.is-error {
  color: #fca5a5;
}
.nm-settings {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  padding: 0.6rem 0.85rem 0.9rem;
}
.nm-settings summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.6rem;
}
.nm-prefs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4, 1rem) var(--space-5, 1.25rem);
  align-items: end;
}
.nm-prefs-grid label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.8rem;
}
.nm-prefs-grid input[type="number"],
.nm-prefs-grid select {
  width: 100%;
}
.nm-check {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  grid-template-columns: none !important;
}
.nm-prefs-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--control-gap, 0.75rem);
  margin-top: var(--space-3, 0.75rem);
}
.nm-section-title {
  margin: 0.4rem 0 0;
  font-size: 1.05rem;
}
.nm-table-wrap {
  overflow-x: auto;
}
.nm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.nm-table th,
.nm-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  text-align: left;
  vertical-align: top;
}
.nm-archive-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: 0.55rem 0 0.25rem;
}
.nm-archive-meta {
  font-size: 0.8rem;
}
.nm-archived-wrap {
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.28);
}
.nm-archived-wrap.is-hidden,
.nm-archive-meta.is-hidden {
  display: none;
}
.nm-archived-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
}
.nm-archived-hint {
  margin: 0.25rem 0 0.55rem;
  font-size: 0.8rem;
}
.nm-archived-row td {
  color: var(--text-muted, #94a3b8);
}
.nm-status-pill {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}
.nm-why {
  max-width: 280px;
  white-space: normal;
}
.nm-learning-list {
  display: grid;
  gap: 0.75rem;
}
.nm-learning-card {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  background: rgba(15, 23, 42, 0.28);
}
.nm-learning-card p {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
}

/* Shared operator progress (op_progress.js) — muted panel like GPT submit progress */
.op-progress {
  margin: 0.55rem 0 0.75rem;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  background: rgba(14, 165, 233, 0.06);
}

.op-progress.is-hidden {
  display: none;
}

.op-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.op-progress-head .op-progress-timer,
.op-progress-timer {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: #7dd3fc;
}

.op-progress-title {
  font-size: 0.9rem;
}

.op-progress-snippet {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  color: var(--text-secondary, #9aa4b2);
  min-height: 1.1em;
}

.op-progress-steps {
  margin: 0 0 0.65rem;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.28rem;
  font-size: 0.8rem;
}

.op-progress-steps li {
  color: var(--text-muted, #94a3b8);
}

.op-progress-steps li.is-active {
  color: #e2e8f0;
  font-weight: 600;
}

.op-progress-steps li.is-done {
  color: #86efac;
}

.op-progress-steps li.is-failed {
  color: #fca5a5;
  font-weight: 600;
}

.op-progress-track {
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.op-progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #0ea5e9, #22d3ee);
  transition: width 0.25s ease;
}

.op-progress-eta {
  margin: 0.45rem 0 0;
  font-size: 0.76rem;
  color: var(--text-secondary, #9aa4b2);
}

/* Pipeline rows used by live scan panel (cockpit) */
.pipeline-pct-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: -0.25rem 0 0.7rem;
  font-size: 0.82rem;
}

.pipeline-pct {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #7dd3fc;
}

.pipeline-now {
  color: var(--text-secondary, #9aa4b2);
  text-align: right;
  overflow-wrap: anywhere;
}

.pipeline-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.35rem 0 0.45rem;
  font-size: 0.78rem;
  color: var(--text-secondary, #9aa4b2);
}

.pipeline-table-hint {
  overflow-wrap: anywhere;
}

/* Repeatable Setup Scanner live progress */
.rss-progress {
  margin: 0;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  background: rgba(14, 165, 233, 0.06);
}

.rss-progress.is-hidden {
  display: none;
}

.rss-progress-track {
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.rss-progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #0ea5e9, #22d3ee);
  transition: width 0.25s ease;
}

.rss-progress-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.45rem;
  font-size: 0.8rem;
}

.rss-progress-pct {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #7dd3fc;
}

.rss-progress-snippet {
  color: var(--text-secondary, #9aa4b2);
  text-align: right;
  overflow-wrap: anywhere;
}

/* Chart viewer per-card loading */
.chart-canvas-wrap {
  position: relative;
}

.chart-card.is-loading {
  opacity: 0.72;
}

.chart-card.is-loading .chart-canvas {
  filter: saturate(0.7);
}

.chart-card-loading {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #94a3b8;
  pointer-events: none;
  background: rgba(2, 6, 23, 0.35);
  border-radius: 6px;
}

.chart-card.is-loading .chart-card-loading {
  display: flex;
}

.settings-feedback.is-hidden {
  display: none !important;
}
.dtp-config-toast {
  position: fixed;
  bottom: 1.35rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12000;
  padding: 0.72rem 1.35rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  max-width: min(92vw, 520px);
  text-align: center;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.dtp-config-toast.is-ok {
  background: rgba(46, 160, 67, 0.95);
  border: 1px solid rgba(63, 185, 80, 0.9);
  color: #fff;
}
.dtp-config-toast.is-error {
  background: rgba(218, 54, 51, 0.95);
  border: 1px solid rgba(248, 81, 73, 0.9);
  color: #fff;
}
.dtp-config-toast.is-hidden {
  display: none !important;
}
.btn.is-saving {
  opacity: 0.72;
  pointer-events: none;
}

/* —— Settings hub —— */
.settings-feedback {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.88rem;
}
.settings-feedback.is-ok {
  background: rgba(63, 185, 80, 0.12);
  border: 1px solid rgba(63, 185, 80, 0.35);
  color: var(--text-primary);
}
.settings-feedback.is-error {
  background: rgba(248, 81, 73, 0.12);
  border: 1px solid rgba(248, 81, 73, 0.35);
  color: var(--text-primary);
}
.settings-section {
  margin: 0 0 1.35rem;
  padding: 1rem 1.1rem 1.15rem;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
  border-radius: 12px;
  background: var(--surface-1, rgba(255, 255, 255, 0.02));
}
.settings-section-head {
  margin-bottom: 0.85rem;
}
.settings-section-head h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}
.settings-section-head p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
  max-width: 48rem;
}
.settings-form {
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap, 1rem);
}
.settings-prefs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4, 1rem) var(--space-5, 1.25rem);
}
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.84rem;
  color: var(--text-primary);
}
.settings-label {
  font-weight: 600;
}
.settings-field input,
.settings-field select,
.settings-form select {
  max-width: 16rem;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.14));
  background: var(--surface-2, rgba(0, 0, 0, 0.2));
  color: var(--text-primary);
}
.settings-input-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.settings-suffix {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.settings-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.settings-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
}
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--control-gap, 0.75rem);
  align-items: center;
  grid-column: 1 / -1;
  margin-top: var(--space-2, 0.5rem);
}
.settings-readout {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin: 0.85rem 0 0;
  padding: 0;
}
.settings-readout div {
  margin: 0;
}
.settings-readout dt {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.settings-readout dd {
  margin: 0.15rem 0 0;
  font-size: 0.92rem;
  font-weight: 600;
}
.settings-link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}
.settings-link-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.85rem 0.95rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
  text-decoration: none;
  color: inherit;
  background: var(--surface-2, rgba(0, 0, 0, 0.15));
}
.settings-link-card:hover {
  border-color: var(--accent-cyan, #60cdff);
}
.settings-link-card strong {
  font-size: 0.92rem;
}
.settings-link-card span {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.nm-settings-relocated {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
  background: var(--surface-1, rgba(255, 255, 255, 0.02));
}
.nm-settings-relocated p {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* CCFX-ALL Continuous Scan (legacy: Ongoing Live Universe) */
.lu-panel {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem 1.15rem;
  border-radius: 12px;
  border: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.22));
  background: var(--surface-1, rgba(255, 255, 255, 0.02));
}
.lu-status-row {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted, #94a3b8);
}
.lu-status-row.is-active {
  color: #39ff14;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.45), 0 0 18px rgba(57, 255, 20, 0.2);
}
.lu-feedback {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.12);
  color: #e0f2fe;
  font-size: 0.88rem;
}
.lu-feedback.is-error {
  background: rgba(248, 113, 113, 0.14);
  color: #fecaca;
}
.lu-feedback.is-hidden,
.lu-live-grid.is-hidden,
.lu-active-actions.is-hidden,
.lu-two-col.is-hidden,
.lu-live-detail.is-hidden,
.lu-field.is-hidden,
.lu-post-abort.is-hidden,
#luSetupPanel.is-hidden {
  display: none !important;
}
.lu-post-abort {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(30, 20, 28, 0.55);
}
.lu-post-abort-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.85rem;
}
.lu-live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem 0.85rem;
  margin: 0 0 1rem;
}
.lu-metric-session {
  grid-column: 1 / -1;
  min-width: 0;
}
.lu-metric-pair strong {
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: #7af8ff;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.28);
}
.lu-live-activity {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 240, 255, 0.28);
  background: linear-gradient(
    135deg,
    rgba(0, 40, 56, 0.55),
    rgba(15, 23, 42, 0.72)
  );
  min-height: 7.5rem;
}
.lu-live-activity.is-hidden {
  display: none !important;
}
.lu-live-activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.lu-live-activity-pulse {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #39ff14;
  box-shadow: 0 0 8px rgba(57, 255, 20, 0.7);
  animation: lu-pulse 1.4s ease-in-out infinite;
}
@keyframes lu-pulse {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}
.lu-live-activity-headline {
  display: block;
  font-size: 1rem;
  color: #7af8ff;
  margin-bottom: 0.25rem;
}
.lu-live-activity-algorithm,
.lu-live-activity-detail,
.lu-live-activity-progress {
  margin: 0.15rem 0;
  font-size: 0.84rem;
  color: var(--text-muted, #9aa7b8);
  line-height: 1.35;
}
.lu-live-activity-algorithm {
  color: #d7e6f5;
}
.lu-live-activity-feed {
  list-style: none;
  margin: 0.45rem 0 0;
  padding: 0;
  max-height: 5.5rem;
  overflow: hidden;
}
.lu-live-activity-feed li {
  font-size: 0.78rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.12rem 0;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  animation: lu-feed-in 0.35s ease;
}
@keyframes lu-feed-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.lu-universe-count {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
  margin: 0.35rem 0 0.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(122, 248, 255, 0.22);
  border-radius: 6px;
  background: rgba(0, 240, 255, 0.04);
}
.lu-universe-count.is-hidden {
  display: none;
}
.lu-universe-count-text {
  margin: 0;
  flex: 1 1 16rem;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--text-muted, #9aa7b8);
}
.lu-universe-count-text strong {
  color: #7af8ff;
  font-weight: 650;
}
.lu-universe-count.is-error .lu-universe-count-text {
  color: #fbbf24;
}
.lu-universe-refresh-btn {
  flex: 0 0 auto;
  font-size: 0.8rem;
  padding: 0.28rem 0.7rem;
}
.lu-interval-estimate {
  margin: -0.15rem 0 0.65rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-muted, #9aa7b8);
}
.lu-interval-estimate.is-warn {
  color: #fbbf24;
}
.lu-interval-estimate.is-continuous {
  color: #7af8ff;
}
.lu-session-id-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.1rem;
}
.lu-session-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  word-break: break-all;
  color: #00f0ff;
  text-shadow: 0 0 6px rgba(0, 240, 255, 0.35);
}
.lu-handoff-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0.35rem 0 0.85rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 240, 255, 0.28);
  background: rgba(0, 240, 255, 0.06);
}
.lu-copy-handoff-btn {
  appearance: none;
  border: 1px solid rgba(57, 255, 20, 0.55);
  background: rgba(57, 255, 20, 0.12);
  color: #39ff14;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
}
.lu-copy-handoff-btn:hover:not(:disabled) {
  background: rgba(57, 255, 20, 0.22);
}
.lu-copy-handoff-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.lu-copy-handoff-btn.is-copied {
  border-color: rgba(0, 240, 255, 0.65);
  color: #67e8f9;
}
.lu-handoff-hint {
  font-size: 0.78rem;
  flex: 1 1 220px;
}
.lu-handoff-picker {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(3px);
}
.lu-handoff-picker.is-hidden {
  display: none !important;
}
.lu-handoff-picker-card {
  width: min(560px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(0, 240, 255, 0.35);
  background: linear-gradient(180deg, #0f172a 0%, #0b1220 100%);
  padding: 1.1rem 1.15rem 1rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.lu-handoff-picker-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: #f8fafc;
}
.lu-handoff-picker-sub {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
}
.lu-handoff-picker-choices {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.lu-handoff-choice {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.55);
  cursor: pointer;
}
.lu-handoff-choice:has(input:checked) {
  border-color: rgba(57, 255, 20, 0.55);
  background: rgba(57, 255, 20, 0.08);
}
.lu-handoff-choice:has(input:disabled) {
  opacity: 0.45;
  cursor: not-allowed;
}
.lu-handoff-choice strong {
  display: block;
  color: #e2e8f0;
  font-size: 0.9rem;
}
.lu-handoff-choice small {
  display: block;
  margin-top: 0.15rem;
  color: #94a3b8;
  font-size: 0.75rem;
  word-break: break-all;
}
.lu-handoff-date-fields {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.lu-handoff-date-fields.is-hidden {
  display: none !important;
}
.lu-handoff-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}
.lu-abort-close-card {
  width: min(640px, 100%);
}
.lu-abort-close-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.85rem;
  margin: 0 0 0.55rem;
}
.lu-abort-close-all {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #e2e8f0;
  cursor: pointer;
}
.lu-abort-close-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: min(45vh, 360px);
  overflow: auto;
  margin-bottom: 0.65rem;
}
.lu-abort-close-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.55);
}
.lu-abort-close-row strong {
  display: block;
  color: #e2e8f0;
  font-size: 0.9rem;
}
.lu-abort-close-row small {
  display: block;
  margin-top: 0.12rem;
  color: #94a3b8;
  font-size: 0.75rem;
}
.lu-abort-close-note {
  margin: 0;
  font-size: 0.78rem;
}
.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}
.luh-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.luh-meta {
  color: var(--text-muted, #94a3b8);
  font-size: 0.85rem;
}
.luh-table-wrap {
  margin-top: 0.25rem;
}
.luh-id-btn {
  appearance: none;
  background: transparent;
  border: none;
  color: #67e8f9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  cursor: pointer;
  text-align: left;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.luh-id-btn:hover {
  color: #39ff14;
}
.luh-stop {
  max-width: 12rem;
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
}
.luh-row-copy {
  font-size: 0.75rem !important;
  padding: 0.3rem 0.55rem !important;
  white-space: nowrap;
}
.luh-detail-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #67e8f9;
  font-size: 0.85rem;
  margin-left: 0.35rem;
}
.luh-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0.5rem 0 0.85rem;
}
.luh-detail-pre {
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(2, 6, 23, 0.65);
  color: #e2e8f0;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 28rem;
  overflow: auto;
}
.lu-copy-session-btn {
  background: #000000 !important;
  background-color: #000000 !important;
  color: #00f0ff !important;
  border: 1px solid #00f0ff !important;
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  font-weight: 650;
  font-size: 0.78rem;
  cursor: pointer;
  text-shadow: 0 0 6px rgba(0, 240, 255, 0.4);
  box-shadow: none;
  white-space: nowrap;
}
.lu-copy-session-btn:hover:not(:disabled) {
  background: #0a0a0a !important;
  color: #7af8ff !important;
  border-color: #7af8ff !important;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.28);
}
.lu-copy-session-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.lu-copy-session-btn.is-copied {
  color: #39ff14 !important;
  border-color: #39ff14 !important;
  text-shadow: 0 0 6px rgba(57, 255, 20, 0.45);
}
.lu-metric {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.25);
}
.lu-metric-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #94a3b8);
}
.lu-metric strong {
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.lu-metric-sub {
  font-size: 0.68rem;
  color: var(--text-muted, #94a3b8);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  min-height: 0.85rem;
}
.lu-active-actions,
.lu-start-actions,
.lu-notify-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--control-gap, 0.75rem);
  margin: 0 0 1.15rem;
}

/* Notification test/enable buttons: browser-default gray is unreadable on dark.
   Force black surfaces + neon labels for contrast. */
.lu-notify-actions button,
.lu-notify-actions .btn-secondary {
  background: #000000 !important;
  background-color: #000000 !important;
  color: #39ff14 !important;
  border: 1px solid #39ff14 !important;
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-weight: 650;
  font-size: 0.82rem;
  cursor: pointer;
  text-shadow: 0 0 6px rgba(57, 255, 20, 0.45);
  box-shadow: none;
}

.lu-notify-actions button:hover:not(:disabled),
.lu-notify-actions .btn-secondary:hover:not(:disabled) {
  background: #0a0a0a !important;
  color: #7dff5a !important;
  border-color: #7dff5a !important;
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.28);
}

.lu-notify-actions button:focus-visible,
.lu-notify-actions .btn-secondary:focus-visible {
  outline: 2px solid #00f0ff;
  outline-offset: 2px;
}

.lu-notify-actions button:nth-child(1) {
  color: #00f0ff !important;
  border-color: #00f0ff !important;
  text-shadow: 0 0 6px rgba(0, 240, 255, 0.45);
}
.lu-notify-actions button:nth-child(2) {
  color: #39ff14 !important;
  border-color: #39ff14 !important;
  text-shadow: 0 0 6px rgba(57, 255, 20, 0.45);
}
.lu-notify-actions button:nth-child(3) {
  color: #1ea7ff !important;
  border-color: #1ea7ff !important;
  text-shadow: 0 0 6px rgba(30, 167, 255, 0.45);
}
.lu-notify-actions button:nth-child(4) {
  color: #25ff88 !important;
  border-color: #25ff88 !important;
  text-shadow: 0 0 6px rgba(37, 255, 136, 0.45);
}
.lu-notify-actions button:nth-child(5) {
  color: #ffe600 !important;
  border-color: #ffe600 !important;
  text-shadow: 0 0 6px rgba(255, 230, 0, 0.4);
}
.lu-notify-actions button:nth-child(6) {
  color: #ff4fd8 !important;
  border-color: #ff4fd8 !important;
  text-shadow: 0 0 6px rgba(255, 79, 216, 0.45);
}

.lu-notify-actions button:nth-child(1):hover:not(:disabled) {
  color: #7af8ff !important;
  border-color: #7af8ff !important;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.28);
}
.lu-notify-actions button:nth-child(2):hover:not(:disabled) {
  color: #7dff5a !important;
  border-color: #7dff5a !important;
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.28);
}
.lu-notify-actions button:nth-child(3):hover:not(:disabled) {
  color: #6ec8ff !important;
  border-color: #6ec8ff !important;
  box-shadow: 0 0 10px rgba(30, 167, 255, 0.28);
}
.lu-notify-actions button:nth-child(4):hover:not(:disabled) {
  color: #7dffb3 !important;
  border-color: #7dffb3 !important;
  box-shadow: 0 0 10px rgba(37, 255, 136, 0.28);
}
.lu-notify-actions button:nth-child(5):hover:not(:disabled) {
  color: #fff36b !important;
  border-color: #fff36b !important;
  box-shadow: 0 0 10px rgba(255, 230, 0, 0.28);
}
.lu-notify-actions button:nth-child(6):hover:not(:disabled) {
  color: #ff8ae8 !important;
  border-color: #ff8ae8 !important;
  box-shadow: 0 0 10px rgba(255, 79, 216, 0.28);
}
.lu-abort-btn {
  font-weight: 700;
}
/* Stack activity above setups full-width so the 11-col hits table is not
   squeezed into a ~58% side column (which clipped When + Live cash). */
.lu-two-col,
.lu-live-detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.lu-two-col > section,
.lu-live-detail > section {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.lu-section-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  flex: 0 0 auto;
}
.lu-section-hint {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  line-height: 1.35;
}
.lu-activity {
  margin: 0;
  padding-left: 1.1rem;
  flex: 0 1 auto;
  min-height: 8rem;
  max-height: 16rem;
  overflow: auto;
  font-size: 0.84rem;
  line-height: 1.45;
}
.lu-hits-section {
  width: 100%;
  min-width: 0;
}
.lu-table-wrap,
#luHitsTableWrap {
  overflow-x: auto;
  overflow-y: visible;
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.lu-table,
#luHitsTable {
  width: max-content;
  min-width: 72rem;
  max-width: none;
  border-collapse: collapse;
  font-size: 0.8rem;
  table-layout: auto;
}
.lu-table th,
.lu-table td {
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  text-align: left;
  white-space: nowrap;
}
.lu-table .tl-col-time,
.lu-table .tl-col-actions {
  color: var(--dtp-tl-muted, #9aa0ab);
  font-size: 0.72rem;
}
.lu-table .tl-col-actions,
#luHitsTable th.tl-col-actions,
#luHitsTable td.tl-col-actions {
  position: sticky;
  right: 0;
  z-index: 2;
  text-align: right;
  background: var(--dtp-tl-grid-bg, #000);
  box-shadow: -8px 0 12px rgba(0, 0, 0, 0.35);
}
#luHitsTable thead th.tl-col-actions {
  background: var(--dtp-tl-head-bg, #0a0b0d);
  z-index: 3;
}
.lu-table .execute-live-cash-btn {
  white-space: nowrap;
  display: inline-block;
}
.lu-form {
  display: grid;
  gap: 1rem;
}
.lu-fieldset {
  margin: 0;
  padding: 0.85rem 0.95rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.lu-fieldset legend {
  padding: 0 0.35rem;
  font-weight: 650;
}
.lu-choice-row,
.lu-check-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3, 0.75rem) var(--space-5, 1.25rem);
  margin: 0.45rem 0 0.9rem;
}
.lu-choice-row label,
.lu-check-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.1rem;
  line-height: 1.35;
}
.lu-field {
  display: grid;
  gap: 0.35rem;
  margin: 0 0 0.8rem;
  font-size: 0.86rem;
}
.lu-field input,
.lu-field select,
.lu-notify-config input {
  width: 100%;
  max-width: 36rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #000000;
  color: #ffffff;
}

.lu-field select option,
.lu-field select optgroup {
  background-color: #000000;
  color: #ffffff;
}
.lu-notify-config {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.55rem 0.85rem;
  margin: 0.35rem 0 0.75rem;
}
.lu-summary {
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px dashed rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.2);
}
.lu-summary h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}
.lu-summary pre {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.82rem;
  line-height: 1.45;
}
.lu-readiness {
  margin: 0.35rem 0;
  font-size: 0.82rem;
  line-height: 1.4;
}
.lu-ready-row {
  margin: 0 0 0.45rem;
}
.lu-ready-badge {
  font-weight: 700;
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
}
.lu-ready-ok {
  color: #4ade80;
}
.lu-ready-warn {
  color: #fde68a;
}
.lu-ready-ok .lu-ready-badge {
  background: rgba(74, 222, 128, 0.12);
}
.lu-ready-warn .lu-ready-badge {
  background: rgba(253, 230, 138, 0.12);
}
.lu-probe {
  color: #9ca3af;
  font-size: 0.75rem;
}
.lu-needs {
  margin-top: 0.15rem;
  color: #fde68a;
  font-size: 0.78rem;
}
.lu-setup-hint {
  margin: 0 0 0.85rem;
}

/* B-Grade Discoveries */
.bg-panel {
  margin: 0 0 1.25rem;
  padding: 0.85rem 0.95rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.bg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.bg-feedback.is-hidden { display: none; }
.bg-feedback.is-error { color: #fca5a5; }
.bg-would-win {
  background: rgba(34, 197, 94, 0.12);
}
.bg-win-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #bbf7d0;
  background: rgba(22, 163, 74, 0.35);
}

/* TradeLocker-style Live Open Activity grid */
.tl-live-section {
  margin-bottom: 1rem;
}

.tl-live-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.65rem;
}

.tl-live-header h2 {
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
}

.tl-live-toolbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.tl-live-updated {
  font-size: 0.78rem;
  color: var(--text-muted, #9aa0ab);
  font-variant-numeric: tabular-nums;
}

.tl-live-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.35rem;
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.75rem;
  background: #050607;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.tl-stat {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 4.5rem;
}

.tl-stat label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #9aa0ab);
}

.tl-stat span {
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary, #f3f4f6);
}

/* Shared grid wrap + table — every data grid in the app should use these */
.tl-grid-wrap,
.dtp-tl-grid-wrap,
.history-table-wrap,
.lu-table-wrap,
.nm-table-wrap,
.accounts-table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  background: var(--dtp-tl-grid-bg, #000);
  border: 1px solid var(--dtp-tl-border, rgba(148, 163, 184, 0.18));
}

.tl-secondary-block .tl-grid-wrap,
.tl-secondary-block .dtp-tl-grid-wrap {
  width: 100%;
  margin-top: 0.35rem;
}

.dtp-tl-grid,
.tl-positions-grid,
.tg-tl-grid,
.history-table,
.lu-table,
.nm-table,
.accounts-table,
.pipeline-symbol-table,
table.data-table.dtp-tl-grid {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--dtp-tl-text, #e8eef7);
  background: var(--dtp-tl-grid-bg, #000);
}

/* CCFX-ALL setups table: force horizontal scroll instead of clipping after When. */
#luHitsTable.lu-table,
#luHitsTable.dtp-tl-grid {
  width: max-content;
  min-width: 72rem;
  max-width: none;
}

.dtp-tl-grid thead th,
.tl-positions-grid thead th,
.tg-tl-grid thead th,
.history-table thead th,
.lu-table thead th,
.nm-table thead th,
.accounts-table thead th,
.pipeline-symbol-table thead th,
table.data-table.dtp-tl-grid thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.55rem 0.9rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dtp-tl-muted, #9aa0ab);
  background: var(--dtp-tl-head-bg, #0a0b0d);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  white-space: nowrap;
}

.dtp-tl-grid tbody td,
.tl-positions-grid tbody td,
.tg-tl-grid tbody td,
.history-table tbody td,
.lu-table tbody td,
.nm-table tbody td,
.accounts-table tbody td,
.pipeline-symbol-table tbody td,
table.data-table.dtp-tl-grid tbody td {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--dtp-tl-row-border, rgba(55, 65, 81, 0.65));
  vertical-align: middle;
  white-space: nowrap;
}

.dtp-tl-grid tbody tr:last-child td,
.tl-positions-grid tbody tr:last-child td,
.tg-tl-grid tbody tr:last-child td,
.history-table tbody tr:last-child td,
.lu-table tbody tr:last-child td,
.nm-table tbody tr:last-child td,
.accounts-table tbody tr:last-child td,
.pipeline-symbol-table tbody tr:last-child td {
  border-bottom: none;
}

.dtp-tl-grid tbody tr:hover td,
.tl-positions-grid tbody tr:hover td,
.tg-tl-grid tbody tr:hover td,
.history-table tbody tr:hover td,
.lu-table tbody tr:hover td,
.nm-table tbody tr:hover td,
.accounts-table tbody tr:hover td,
.pipeline-symbol-table tbody tr:hover td,
table.data-table.dtp-tl-grid tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.dtp-tl-grid .empty-cell,
.tl-positions-grid .empty-cell,
.tg-tl-grid .empty-cell,
.history-table .empty-cell,
.lu-table .empty-cell,
.nm-table .empty-cell,
.accounts-table .empty-cell,
.pipeline-symbol-table .empty-cell,
table.data-table.dtp-tl-grid .empty-cell {
  padding: 2.25rem 1.25rem;
  text-align: center;
  color: var(--dtp-tl-muted, #9aa0ab);
  white-space: normal;
  border-bottom: none;
}

.dtp-tl-grid .tl-num,
.tl-positions-grid .tl-num,
.tg-tl-grid .tl-num,
.history-table .tl-num,
.lu-table .tl-num,
.nm-table .tl-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dtp-tl-grid .tl-col-instrument,
.tl-positions-grid .tl-col-instrument,
.tg-tl-grid .tl-col-instrument,
.lu-table .tl-col-instrument,
.nm-table .tl-col-instrument {
  font-weight: 600;
  color: #f8fafc;
}

.dtp-tl-grid .tl-col-time,
.dtp-tl-grid .tl-col-id,
.tl-positions-grid .tl-col-time,
.tl-positions-grid .tl-col-id,
.tg-tl-grid .tl-col-time,
.tg-tl-grid .tl-col-id,
.lu-table .tl-col-time,
.lu-table .tl-col-id {
  color: var(--dtp-tl-muted, #9aa0ab);
  font-size: 0.72rem;
}

.dtp-tl-grid .tl-col-id code,
.tl-positions-grid .tl-col-id code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.7rem;
  color: #94a3b8;
}

.dtp-tl-grid .tl-col-actions,
.tl-positions-grid .tl-col-actions,
.tg-tl-grid .tl-col-actions,
.lu-table .tl-col-actions {
  text-align: right;
}

.dtp-tl-grid .tl-muted,
.tl-positions-grid .tl-muted,
.tg-tl-grid .tl-muted {
  color: var(--dtp-tl-muted, #9aa0ab);
}

.dtp-tl-grid .tl-wrap,
.tl-positions-grid .tl-wrap,
.tg-tl-grid .tl-wrap,
.nm-table .tl-wrap {
  white-space: normal;
  max-width: 18rem;
  line-height: 1.35;
}

/* Spread short row-sets (e.g. Recent closed) across the full panel width */
#recentClosedTable {
  table-layout: fixed;
  width: 100%;
}

.tl-side-buy {
  color: var(--dtp-tl-buy, #22c55e);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.tl-side-sell {
  color: var(--dtp-tl-sell, #f97316);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.tl-pnl-pos,
.dtp-tl-grid .pnl-positive,
.tl-positions-grid .pnl-positive,
.history-table .pnl-positive,
.lu-table .pnl-positive,
.nm-table .pnl-positive,
#tlStatPnl.tl-pnl-pos {
  color: var(--dtp-tl-pnl-pos, #4ade80);
  font-weight: 700;
  text-shadow: 0 0 12px rgba(74, 222, 128, 0.28);
}

.tl-pnl-neg,
.dtp-tl-grid .pnl-negative,
.tl-positions-grid .pnl-negative,
.history-table .pnl-negative,
.lu-table .pnl-negative,
.nm-table .pnl-negative,
#tlStatPnl.tl-pnl-neg {
  color: var(--dtp-tl-pnl-neg, #f87171);
  font-weight: 700;
  text-shadow: 0 0 12px rgba(248, 113, 113, 0.28);
}

.tl-secondary-block {
  margin-top: 0.85rem;
  padding: 0.55rem 0.75rem 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 17, 21, 0.65);
}

.tl-secondary-block > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-secondary, #c5c7ce);
  margin-bottom: 0.45rem;
}

@media (max-width: 900px) {
  .tl-live-summary {
    gap: 0.45rem 0.9rem;
  }

  .dtp-tl-grid,
  .tl-positions-grid,
  .tg-tl-grid,
  .history-table,
  .lu-table,
  .nm-table,
  .accounts-table,
  .pipeline-symbol-table {
    font-size: 0.72rem;
  }

  .dtp-tl-grid thead th,
  .dtp-tl-grid tbody td,
  .tl-positions-grid thead th,
  .tl-positions-grid tbody td,
  .history-table thead th,
  .history-table tbody td,
  .lu-table thead th,
  .lu-table tbody td,
  .nm-table thead th,
  .nm-table tbody td,
  .accounts-table thead th,
  .accounts-table tbody td {
    padding: 0.45rem 0.65rem;
  }
}

/* Launch Log (permanent launcher journal UI) */
.launch-log-panel {
  margin-top: 1rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border-subtle, #334155);
  border-radius: 8px;
  background: var(--surface-elevated, rgba(15, 23, 42, 0.6));
}

.launch-log-status {
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
}

.launch-log-status-ok {
  color: var(--success, #4ade80);
}

.launch-log-status-fail {
  color: var(--danger, #f87171);
}

.launch-log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.launch-log-feedback {
  margin: 0.5rem 0;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}

.launch-log-feedback.is-ok {
  background: rgba(74, 222, 128, 0.12);
  color: var(--success, #4ade80);
}

.launch-log-feedback.is-error {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger, #f87171);
}

.launch-log-details {
  margin-bottom: 1rem;
}

.launch-log-pre {
  max-height: 28rem;
  overflow: auto;
  padding: 0.75rem;
  font-size: 0.82rem;
  line-height: 1.4;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  white-space: pre-wrap;
  word-break: break-word;
}

.launch-log-subtitle {
  margin: 0.5rem 0 0.75rem;
  font-size: 1rem;
}

.launch-log-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.launch-log-badge-ok {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

.launch-log-badge-fail {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

.launch-log-paths {
  margin-top: 1rem;
  font-size: 0.82rem;
}

.launch-fail-banner {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.1);
  color: var(--text, #e8eef8);
}

.launch-fail-banner.is-hidden {
  display: none;
}

.launch-fail-banner-hint {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted, #94a3b8);
}

/* Scheduled Sessions — generous section gaps */
.sch-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.sch-status-block {
  padding: 1rem 1.15rem;
  border: 1px solid var(--border-subtle, #334155);
  border-radius: 8px;
  background: var(--surface-elevated, rgba(15, 23, 42, 0.55));
}

.sch-status-row {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  line-height: 1.45;
}

.sch-status-line {
  margin: 0;
}

.sch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0;
  padding-top: 0.15rem;
}

.sch-feedback {
  margin: 0;
}

.sch-table-wrap {
  margin-top: 0.25rem;
}

.sch-form-panel {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle, #334155);
}

.sch-fieldset {
  margin: 1.25rem 0;
  padding: 1rem 1.1rem 1.15rem;
  border: 1px solid var(--border-subtle, #334155);
  border-radius: 8px;
}

.sch-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.sch-warn {
  color: var(--danger, #f87171);
}

/* Shared CCFX live progress (Scheduled Sessions + Continuous Scan + Cockpit) */
.cockpit-live-sessions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.cockpit-live-sessions.is-hidden,
.cockpit-live-sessions[hidden] {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  min-height: 0 !important;
  border: 0 !important;
}

.ccfx-prog-panel {
  margin: 0.25rem 0 0.5rem;
  padding: 1.1rem 1.2rem 1.25rem;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(14, 116, 144, 0.16), rgba(15, 23, 42, 0.55));
}

.cockpit-live-sessions .ccfx-prog-panel {
  margin: 0;
}

.ccfx-prog-panel-manual {
  border-color: rgba(52, 211, 153, 0.4);
  background: linear-gradient(180deg, rgba(6, 95, 70, 0.2), rgba(15, 23, 42, 0.55));
}

.ccfx-prog-panel-manual .ccfx-prog-badge {
  background: rgba(52, 211, 153, 0.18);
  color: #6ee7b7;
}

.ccfx-prog-panel-manual .ccfx-prog-bar {
  background: linear-gradient(90deg, #059669, #34d399);
}

.ccfx-prog-panel.is-hidden {
  display: none;
}

.ccfx-prog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.ccfx-prog-kicker {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 0.2rem;
}

.ccfx-prog-id {
  font-size: 0.95rem;
  word-break: break-all;
}

.ccfx-prog-badge {
  display: inline-block;
  margin-bottom: 0.55rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
}

.ccfx-prog-headline {
  display: block;
  font-size: 1.15rem;
  margin: 0 0 0.4rem;
}

.ccfx-prog-algorithm,
.ccfx-prog-detail,
.ccfx-prog-line {
  margin: 0 0 0.45rem;
  color: var(--text-muted, #94a3b8);
  font-size: 0.92rem;
  line-height: 1.45;
}

.ccfx-prog-line {
  color: var(--text, #e8eef8);
  font-weight: 550;
}

.ccfx-prog-bar-wrap {
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
  margin: 0.65rem 0 0.55rem;
}

.ccfx-prog-bar {
  height: 100%;
  background: linear-gradient(90deg, #0ea5e9, #22d3ee);
  border-radius: inherit;
  transition: width 0.35s ease;
}

.ccfx-prog-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem 1rem;
  margin: 0.85rem 0 0.75rem;
}

.ccfx-prog-metrics div {
  margin: 0;
}

.ccfx-prog-metrics dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted, #94a3b8);
  margin: 0 0 0.15rem;
}

.ccfx-prog-metrics dd {
  margin: 0;
  font-weight: 600;
}

.ccfx-prog-feed-wrap {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.ccfx-prog-feed {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  color: var(--text-muted, #94a3b8);
  font-size: 0.86rem;
}

.ccfx-prog-feed li {
  margin: 0.2rem 0;
}
