:root {
  --ink: #14213d;
  --muted: #5c6b7a;
  --line: #d7dee8;
  --bg: #f3f6f9;
  --card: #ffffff;
  --accent: #0b6e4f;
  --accent-2: #1b4965;
  --warn: #9a3412;
  --up: #047857;
  --down: #b91c1c;
  --shadow: 0 10px 30px rgba(20, 33, 61, 0.06);
  --font: "Segoe UI", "IBM Plex Sans", system-ui, sans-serif;
  --mono: "Cascadia Code", "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d9ebe3 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #dce7f5 0%, transparent 50%),
    var(--bg);
  line-height: 1.5;
  padding: 28px 20px 64px;
  max-width: 1080px;
  margin-inline: auto;
}

a { color: var(--accent); font-weight: 600; text-decoration: none; }
a:hover { text-decoration: underline; }
.back { display: inline-block; margin-bottom: 1.25rem; }

.hero {
  background: linear-gradient(135deg, #0f766e 0%, #1d4e89 55%, #14213d 100%);
  color: #f8fafc;
  border-radius: 18px;
  padding: 1.6rem 1.7rem 1.8rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  opacity: 0.8;
  margin: 0 0 0.4rem;
}
.hero h1 { margin: 0 0 0.45rem; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.hero .sub { margin: 0; max-width: 46rem; opacity: 0.92; }

.grid.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.grid.stats article,
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.grid.stats h2 {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}
.big { font-size: 1.55rem; font-weight: 750; margin: 0.35rem 0 0.2rem; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); font-size: 0.92rem; }
.warn { color: var(--warn); font-size: 0.95rem; }

.panel { margin-bottom: 1rem; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.panel-head h2 { margin: 0; font-size: 1.1rem; }

.row {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 1fr auto;
  gap: 0.75rem;
  align-items: end;
}
label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--muted);
}
input, select, button, textarea {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0.65rem 0.75rem;
  background: #fff;
  color: var(--ink);
}
button {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 700;
  cursor: pointer;
  padding-inline: 1.1rem;
}
button:hover { filter: brightness(1.05); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.kb { list-style: none; padding: 0; margin: 0; }
.kb li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.15rem;
}
.kb li:last-child { border-bottom: none; }
.steps { padding-left: 1.2rem; }
.steps li { margin-bottom: 0.45rem; }
code, .log, .mono {
  font-family: var(--mono);
  font-size: 0.86em;
}
.log {
  margin-top: 0.9rem;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  white-space: pre-wrap;
}
.foot { margin-top: 1.5rem; color: var(--muted); font-size: 0.9rem; }

.pill {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.pill-on { background: #d1fae5; color: #065f46; }
.pill-off { background: #fee2e2; color: #991b1b; }
.btn-auto { background: #b45309 !important; }

.tabs {
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.35rem;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.tab {
  flex: 1;
  text-align: center;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 750;
  text-decoration: none;
}
.tab:hover { background: #e8eef5; text-decoration: none; }
.tab.active {
  background: linear-gradient(135deg, #0f766e, #1d4e89);
  color: #fff;
}
.pill-soon { background: #ffedd5; color: #9a3412; }
.auto-status {
  margin: 0.75rem 0 1rem;
  padding: 0.95rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.auto-status-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.auto-status-body {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.45;
}
.auto-status-on {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border-color: #6ee7b7;
  color: #065f46;
}
.auto-status-hunt {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-color: #93c5fd;
  color: #1e3a8a;
  animation: auto-hunt-pulse 2.4s ease-in-out infinite;
}
.auto-status-wait {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border-color: #fdba74;
  color: #9a3412;
}
.auto-status-off {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}
.auto-status-agent {
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  border-color: #c4b5fd;
  color: #5b21b6;
}
@keyframes auto-hunt-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.25); }
  50% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
}
.autotrader-panel .panel-head h2 { font-size: 1.25rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 0.75rem; }
.btn-cta {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  padding: 0.75rem 1.15rem;
  border-radius: 10px;
  font-weight: 750;
  text-decoration: none !important;
}
.btn-cta-secondary { background: var(--accent-2); }
button.btn-cta {
  border: 0;
  cursor: pointer;
  font: inherit;
}
.btn-sell {
  background: #b91c1c !important;
  color: #fff !important;
}
button.btn-sell {
  border: 0;
  cursor: pointer;
  font: inherit;
  background: #b91c1c;
  color: #fff;
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
  font-weight: 750;
}
.btn-clear-bans {
  background: #475569 !important;
  color: #fff !important;
}
button.btn-clear-bans {
  border: 0;
  cursor: pointer;
  font: inherit;
  background: #475569;
  color: #fff;
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
  font-weight: 750;
}
.btn-clear-bans.is-banned,
button.btn-clear-bans.is-banned {
  background: #c2410c !important;
  box-shadow: 0 0 0 2px rgba(194, 65, 12, 0.35);
  animation: ban-pulse 1.6s ease-in-out infinite;
}
@keyframes ban-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}
.ban-status {
  margin: 0.35rem 0 0.75rem;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  font-size: 0.9rem;
}
.ban-status-label { color: #9a3412; }
.v2-check { display: grid; gap: 0.55rem; }
.v2-check label {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  font-weight: 600;
  color: var(--ink);
  font-size: 0.95rem;
}
.v2-check input { margin-top: 0.2rem; }

.settings-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}
.settings-form .span-2 { grid-column: 1 / -1; }
.settings-form textarea,
.settings-form input[type="text"],
.settings-form input[type="password"],
.settings-form input[type="number"],
.settings-form select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.login-wrap {
  min-height: 70vh;
  display: grid;
  place-items: center;
}
.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.4rem;
  box-shadow: var(--shadow);
}
.login-card h1 { margin-top: 0; }
.login-card form { display: grid; gap: 0.75rem; }
.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}

.doc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}
.doc h1 { margin-top: 0; }
.doc pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.9rem;
  border-radius: 10px;
  overflow-x: auto;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.15rem;
  padding-bottom: 0.15rem;
}
.table-wrap table { min-width: 520px; }
.bridge-fix-panel.is-bad {
  border-color: #fdba74;
  background: linear-gradient(160deg, #fff7ed 0%, #ffffff 55%);
}
.bridge-fix-panel.is-ok {
  border-color: #6ee7b7;
  background: linear-gradient(160deg, #ecfdf5 0%, #ffffff 55%);
}
.bridge-fix-title {
  margin: 0 0 0.55rem;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
}
.bridge-fix-steps {
  margin: 0.55rem 0 0.85rem;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.35rem;
}
.bridge-fix-steps li {
  font-size: 0.95rem;
  line-height: 1.4;
}
.bridge-fix-panel.is-ok .bridge-fix-steps { display: none; }
.ledger-action { white-space: nowrap; text-align: right; }
.ledger-action .btn-ledger-hold,
.ledger-action .btn-ledger-sell { margin-left: 0.25rem; }
.ledger-action .btn-ledger-hold:first-child,
.ledger-action .btn-ledger-sell:first-child { margin-left: 0; }
.btn-ledger-sell,
.btn-ledger-hold {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  padding: 0.28rem 0.65rem;
  border-radius: 8px;
  color: #fff;
}
.btn-ledger-sell {
  background: #b91c1c;
}
.btn-ledger-hold {
  background: #0f766e;
}
.btn-ledger-hold.is-holding {
  background: #b45309;
}
.btn-ledger-sell:disabled,
.btn-ledger-hold:disabled {
  opacity: 0.55;
  cursor: wait;
}
.btn-ledger-sell:hover:not(:disabled) {
  background: #991b1b;
}
.btn-ledger-hold:hover:not(:disabled) {
  filter: brightness(0.92);
}

.mode-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin: 0.85rem 0 0.35rem;
}
.mode-bar-label {
  font-weight: 700;
  font-size: 0.9rem;
}
.mode-select {
  font: inherit;
  min-width: 14rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line, #d8dde6);
  border-radius: 8px;
  background: #fff;
}
#v2-mode-desc {
  margin-bottom: 0.35rem;
}

.suggest-mode-bar {
  border: 1px solid var(--line, #d8dde6);
  border-radius: 12px;
  background: linear-gradient(165deg, #f0f7ff 0%, #ffffff 55%);
  padding: 0.75rem 0.9rem;
  margin: 0 0 0.85rem;
}
.suggest-mode-bar.is-expert-off {
  border-color: #f97316;
  background: linear-gradient(165deg, #fff7ed 0%, #ffffff 60%);
}
.openai-toggle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.7rem;
  margin: 0 0 0.7rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid transparent;
}
.openai-toggle-row.is-off {
  background: #ffedd5;
  border-color: #fb923c;
  color: #9a3412;
}
.openai-toggle-row.is-on {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}
.openai-toggle-row strong {
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
#v2-openai-note {
  flex: 1 1 12rem;
  font-size: 0.92rem;
}
.suggest-mode-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
}
.suggest-mode-label {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--muted, #5c6b7a);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.suggest-mode-reason {
  margin: 0.45rem 0 0.55rem;
  line-height: 1.4;
}
.suggest-mode-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.ledger-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0.15rem 0 0.45rem;
}
.ledger-tab {
  appearance: none;
  border: 1px solid var(--line, #d8dde6);
  background: #fff;
  color: var(--ink, #14213d);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.28rem 0.8rem;
  cursor: pointer;
}
.ledger-tab.is-active {
  background: #0b6e4f;
  border-color: #0b6e4f;
  color: #fff;
}

.ledger-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
}
.ledger-page-btn {
  appearance: none;
  border: 1px solid var(--line, #d8dde6);
  background: #fff;
  color: var(--ink, #0f172a);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 2rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  cursor: pointer;
}
.ledger-page-btn.is-active {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}
.ledger-page-btn:hover:not(.is-active) {
  border-color: #0f766e;
  color: #0f766e;
}
.ledger-pager-meta {
  margin-left: 0.35rem;
  font-size: 0.85rem;
}
.events-table { min-width: 0 !important; }
.events-table td {
  word-break: break-word;
  font-size: 0.86rem;
  line-height: 1.4;
}
.tab-short { display: none; }
.pill-totals {
  white-space: normal;
  line-height: 1.35;
  max-width: 100%;
  text-align: right;
}
.panel-head-stack {
  flex-wrap: wrap;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .live-actions { grid-template-columns: 1fr 1fr; }
  .grid.stats, .split, .row, .settings-form { grid-template-columns: 1fr 1fr; }
  .grid.stats article:first-child { grid-column: 1 / -1; }
  .grid.stats .big {
    font-size: 1.15rem;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 640px) {
  body {
    padding: 14px 12px 48px;
  }
  .hero {
    padding: 1.1rem 1.15rem 1.2rem;
    border-radius: 14px;
    margin-bottom: 0.85rem;
  }
  .hero h1 { font-size: 1.45rem; }
  .hero .sub { font-size: 0.92rem; }
  .eyebrow { font-size: 0.68rem; }
  .tabs {
    gap: 0.3rem;
    padding: 0.28rem;
    margin-bottom: 0.75rem;
  }
  .tab {
    padding: 0.7rem 0.35rem;
    font-size: 0.82rem;
    min-height: 44px;
    display: grid;
    place-items: center;
  }
  .tab-full { display: none; }
  .tab-short { display: inline; }
  .grid.stats {
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }
  .grid.stats article,
  .panel {
    padding: 0.85rem 0.9rem;
    border-radius: 12px;
  }
  .grid.stats article:first-child { grid-column: 1 / -1; }
  .big { font-size: 1.25rem; }
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
  }
  .panel-head h2 { font-size: 1.05rem; }
  .pill-totals {
    text-align: left;
    padding: 0.45rem 0.65rem;
    background: #f1f5f9;
    color: var(--ink);
  }
  .auto-status {
    padding: 0.8rem 0.9rem;
  }
  .auto-status-title { font-size: 1.02rem; }
  .auto-status-body { font-size: 0.92rem; }
  .cta-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }
  .cta-row .btn-cta,
  .cta-row button.btn-cta,
  .cta-row button.btn-sell,
  .cta-row button.btn-clear-bans,
  button.btn-cta,
  button.btn-sell,
  button.btn-clear-bans {
    width: 100%;
    min-height: 46px;
    text-align: center;
    justify-content: center;
  }
  .table-wrap {
    margin: 0 -0.9rem;
    padding: 0 0.9rem 0.25rem;
  }
  .table-wrap::after {
    content: "Swipe for more →";
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    margin-top: 0.35rem;
  }
  .table-wrap:has(.events-table)::after { display: none; }
  .data-table {
    font-size: 0.8rem;
    min-width: 560px;
  }
  .data-table th,
  .data-table td {
    padding: 0.45rem 0.35rem;
    white-space: nowrap;
  }
  .events-table td { white-space: normal; }
  .settings-form { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
  code { word-break: break-all; }
  #v2-out, .log { font-size: 0.78rem; }
  .v2-hero-panel p { font-size: 0.92rem; }
}

@media (max-width: 380px) {
  .grid.stats { grid-template-columns: 1fr; }
  .grid.stats article:first-child { grid-column: auto; }
}

.manual-desk { margin: 0 0 1rem; }
.manual-desk h3 { margin: 0; font-size: 1rem; }
.desk-order {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin: 0.6rem 0 0.2rem;
}
.desk-order select { min-width: 11rem; }
.desk-actions { margin-top: 0; }
.desk-result {
  margin: 0.55rem 0 0.8rem;
  font-weight: 650;
}
.desk-recs-head { margin-top: 0.4rem; }
.desk-table { width: 100%; border-collapse: collapse; }
.desk-table th,
.desk-table td {
  text-align: left;
  padding: 0.45rem 0.4rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  vertical-align: top;
}
.desk-table th { font-size: 0.78rem; color: var(--muted); }
.desk-why { white-space: normal; max-width: 36rem; }
.desk-side-long { color: #047857; font-weight: 750; }
.desk-side-short { color: #b91c1c; font-weight: 750; }
.desk-table tr { cursor: pointer; }
.desk-table button { cursor: pointer; }

.us500-chart { margin: 0 0 1rem; }
.us500-price { margin: 0.15rem 0 0.4rem; font-weight: 700; font-size: 1.15rem; }
.us500-canvas {
  width: 100%;
  height: 260px;
  background: #0f172a;
  border-radius: 8px;
  display: block;
}

.reminders { margin: 0 0 1rem; }
.reminders-add {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin: 0.2rem 0 0.7rem;
}
.reminders-add input[type="text"] { flex: 1 1 16rem; }
.reminders-list { list-style: none; margin: 0; padding: 0; }
.reminders-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: start;
  padding: 0.45rem 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.reminders-list .due { font-size: 0.78rem; font-weight: 700; min-width: 6.2rem; }
.reminders-list .due.is-over { color: #b91c1c; }
.reminders-list .due.is-soon { color: #b45309; }
.reminders-list .done { text-decoration: line-through; color: #64748b; }
.reminders-acts { display: flex; gap: 0.35rem; }
.reminders-acts button { font-size: 0.78rem; }

.cash-next { margin: 0.15rem 0 0.7rem; font-weight: 700; }
.cash-foot { margin: 0.55rem 0 0; }
.cash-table td.now-open { color: #0f766e; font-weight: 700; }
.cash-table td.now-lunch { color: #b45309; font-weight: 700; }
.cash-table tr.is-now { background: rgba(15, 118, 110, 0.08); }

/* ——— Market hours (site panel style) ——— */
.mkts-clock {
  position: sticky;
  top: 12px;
  z-index: 40;
  overflow: hidden;
}
.mkts-head {
  align-items: center;
  margin-bottom: 0.65rem;
}
.mkts-now {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  text-align: right;
}
.mkts-now-utc {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.mkts-now-local {
  font-size: 0.82rem;
  color: var(--muted);
}
.mkts-scroller {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding: 0.15rem 0.1rem 0.35rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #c5d4df transparent;
}
.mkts-card {
  flex: 0 0 auto;
  width: 158px;
  scroll-snap-align: start;
  border-radius: 12px;
  padding: 0.65rem 0.7rem 0.7rem;
  background: linear-gradient(160deg, #f7fbf9 0%, #ffffff 55%);
  border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(20, 33, 61, 0.04);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.mkts-card::after {
  content: ";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: #d7dee8;
  transform-origin: left center;
  transform: scaleX(var(--mkts-progress, 0));
  transition: transform 1s linear;
}
.mkts-card.is-open {
  border-color: #6ee7b7;
  background: linear-gradient(160deg, #ecfdf5 0%, #ffffff 60%);
  box-shadow: 0 6px 18px rgba(15, 118, 110, 0.08);
}
.mkts-card.is-open::after {
  background: linear-gradient(90deg, #0f766e, #1d4e89);
}
.mkts-card.is-soon {
  border-color: #fdba74;
  background: linear-gradient(160deg, #fff7ed 0%, #ffffff 60%);
}
.mkts-card.is-soon::after { background: #f59e0b; }
.mkts-card.is-bot {
  border-style: dashed;
  border-color: #93c5fd;
}
.mkts-card.is-crypto.is-open {
  border-color: #a5b4fc;
  background: linear-gradient(160deg, #eef2ff 0%, #ffffff 60%);
}
.mkts-card.is-crypto.is-open::after {
  background: linear-gradient(90deg, #6366f1, #0f766e);
}
.mkts-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
}
.mkts-name {
  font-size: 0.88rem;
  font-weight: 750;
  color: var(--ink);
}
.mkts-badge {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: #e8eef5;
  color: var(--muted);
}
.mkts-card.is-open .mkts-badge {
  background: #d1fae5;
  color: #065f46;
}
.mkts-card.is-soon .mkts-badge {
  background: #ffedd5;
  color: #9a3412;
}
.mkts-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mkts-timer {
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.mkts-card.is-open .mkts-timer { color: var(--accent); }
.mkts-card.is-soon .mkts-timer { color: var(--warn); }
.mkts-sub {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.18rem;
  line-height: 1.3;
}

/* ——— AI credits (site panel / stats style) ——— */
.ai-credits .ai-credits-grid {
  margin-bottom: 0.35rem;
}
.ai-credits-refresh {
  padding: 0.45rem 0.85rem;
  min-height: auto;
  font-size: 0.85rem;
}
.ai-credits-note {
  margin: 0.35rem 0 0;
  font-size: 0.86rem;
}
.ai-credits.is-low #ai-cred-balance { color: var(--warn); }
.ai-credits.is-empty #ai-cred-balance { color: var(--down); }
.ai-usage-panel .ai-usage-grid { margin-bottom: 0.75rem; }

/* ——— P&L vs AI cost ——— */
.pnl-ai-panel {
  background:
    linear-gradient(160deg, rgba(15, 23, 42, 0.04), transparent 45%),
    var(--card);
}
.pnl-ai-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 0.65rem;
}
.pnl-ai-card {
  border: 1px solid var(--line, #d8dde6);
  border-radius: 10px;
  padding: 0.85rem 0.9rem;
  background: rgba(255, 255, 255, 0.55);
}
.pnl-ai-card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
}
.pnl-ai-net {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.pnl-ai-net-label {
  margin: 0.15rem 0 0.55rem;
  font-size: 0.78rem;
}
.pnl-ai-dl {
  margin: 0;
  display: grid;
  gap: 0.28rem;
}
.pnl-ai-dl > div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.86rem;
}
.pnl-ai-dl dt {
  margin: 0;
  color: var(--muted, #64748b);
}
.pnl-ai-dl dd {
  margin: 0;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

@media (max-width: 900px) {
  .pnl-ai-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .pnl-ai-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .mkts-clock { top: 8px; }
  .mkts-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .mkts-now { text-align: left; }
  .mkts-now-utc { font-size: 1.05rem; }
  .mkts-card { width: 148px; }
}

/* ——— AI thinking panel ——— */
.think-panel {
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.06), transparent 40%),
    var(--card);
  border-color: #b6d4ce;
}

/* ——— Raw signal chart (above portfolio) ——— */
.signal-board-panel {
  margin-bottom: 0.85rem;
}
.signal-board-note {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}
.signal-advice {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}
.signal-advice-ts {
  font-size: 0.82rem;
  color: var(--muted, #667);
}
.signal-reason-ts {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.signal-log-wrap {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.signal-log-wrap h3 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}
.signal-log-note {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
}
.signal-log {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.4rem;
  max-height: 180px;
  overflow: auto;
}
.signal-log li {
  font-size: 0.84rem;
  line-height: 1.35;
}
.signal-log li.is-change {
  font-weight: 600;
}
.signal-log time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  margin-right: 0.35rem;
}
.signal-log-flip {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #92400e;
  background: color-mix(in srgb, #f59e0b 18%, transparent);
}
.signal-log-action {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 800;
}
.signal-log-action.is-hold {
  color: #1a7f4b;
  background: color-mix(in srgb, #1a7f4b 12%, transparent);
}
.signal-log-action.is-sell {
  color: #b42318;
  background: color-mix(in srgb, #b42318 12%, transparent);
}
.signal-advice-why {
  margin-top: 0.15rem;
  line-height: 1.35;
}
.signal-reason-banner {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 88%, var(--panel));
}
.signal-reason-banner.is-hold {
  border-color: color-mix(in srgb, #1a7f4b 40%, var(--line));
  background: color-mix(in srgb, #1a7f4b 8%, var(--panel));
}
.signal-reason-banner.is-sell {
  border-color: color-mix(in srgb, #b42318 45%, var(--line));
  background: color-mix(in srgb, #b42318 8%, var(--panel));
}
.signal-reason-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: start;
  font-size: 0.92rem;
  line-height: 1.4;
}
.signal-reason-tag {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--line);
}
.signal-reason-banner.is-hold .signal-reason-tag {
  color: #1a7f4b;
  background: color-mix(in srgb, #1a7f4b 12%, transparent);
}
.signal-reason-banner.is-sell .signal-reason-tag {
  color: #b42318;
  background: color-mix(in srgb, #b42318 12%, transparent);
}
.signal-chart {
  display: grid;
  gap: 0.55rem;
}
.signal-bar-row {
  display: grid;
  grid-template-columns: minmax(8.5rem, 11rem) 1fr 2.6rem;
  gap: 0.35rem 0.55rem;
  align-items: center;
}
.signal-bar-row.is-open-symbol {
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 92%, var(--panel));
}
.signal-bar-row.is-hold {
  border-color: color-mix(in srgb, #1a7f4b 35%, var(--line));
}
.signal-bar-row.is-sell {
  border-color: color-mix(in srgb, #b42318 40%, var(--line));
}
.signal-bar-advice {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
.signal-bar-advice.is-hold {
  color: #1a7f4b;
  background: color-mix(in srgb, #1a7f4b 12%, transparent);
}
.signal-bar-advice.is-sell {
  color: #b42318;
  background: color-mix(in srgb, #b42318 12%, transparent);
}
.signal-bar-reason {
  grid-column: 1 / -1;
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--ink);
}
.signal-advice-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 88%, var(--panel));
}
.signal-advice-card.is-sell {
  border-color: color-mix(in srgb, #b42318 45%, var(--line));
  background: color-mix(in srgb, #b42318 8%, var(--panel));
}
.signal-advice-card.is-hold {
  border-color: color-mix(in srgb, #1a7f4b 40%, var(--line));
  background: color-mix(in srgb, #1a7f4b 8%, var(--panel));
}
.signal-advice-action {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  min-width: 4.2rem;
  text-align: center;
}
.signal-advice-card.is-sell .signal-advice-action { color: #b42318; }
.signal-advice-card.is-hold .signal-advice-action { color: #1a7f4b; }
.signal-advice-body {
  display: grid;
  gap: 0.2rem;
  font-size: 0.92rem;
}
.signal-bar-label {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.45rem;
  align-items: baseline;
  font-size: 0.86rem;
}
.signal-bar-side {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--line);
}
.signal-bar-side.is-buy {
  color: #1a7f4b;
  background: color-mix(in srgb, #1a7f4b 12%, transparent);
}
.signal-bar-side.is-sell {
  color: #b42318;
  background: color-mix(in srgb, #b42318 12%, transparent);
}
.signal-bar-track {
  height: 0.7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 70%, transparent);
  overflow: hidden;
}
.signal-bar-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 0.4rem;
}
.signal-bar-fill.is-buy { background: #1a7f4b; }
.signal-bar-fill.is-sell { background: #b42318; }
.signal-bar-score {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
  font-weight: 600;
}
.signal-asof {
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
}
.signal-chart-empty { padding: 0.5rem 0; }

@media (max-width: 640px) {
  .signal-bar-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "label score"
      "track track"
      "reason reason";
  }
  .signal-bar-label { grid-area: label; }
  .signal-bar-score { grid-area: score; }
  .signal-bar-track { grid-area: track; }
  .signal-bar-reason { grid-area: reason; }
}

.think-headline {
  margin: 0 0 0.65rem;
  font-size: 1.08rem;
  font-weight: 750;
  line-height: 1.35;
  color: var(--ink);
}
.think-bullets {
  margin: 0 0 0.75rem;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.35rem;
}
.think-bullets li {
  font-size: 0.95rem;
  line-height: 1.4;
}
.think-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}
.think-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.55rem;
  border-radius: 8px;
  background: #eef4f8;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted);
}
.think-chip strong { color: var(--ink); font-weight: 750; }
.think-setups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}
.think-setup {
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
  font-size: 0.8rem;
  font-family: var(--mono);
}
.think-setup.is-aligned {
  border-color: #6ee7b7;
  background: #ecfdf5;
}
.think-ai {
  margin: 0 0 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.92rem;
  line-height: 1.45;
  min-height: 1.2em;
}
.think-ai:empty { display: none; }
.think-log-wrap h3 {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.think-log {
  margin: 0;
  padding-left: 1.2rem;
  max-height: 160px;
  overflow-y: auto;
  font-size: 0.82rem;
  color: var(--muted);
}
.think-log li { margin-bottom: 0.3rem; }
.think-pill.think-hold { background: #dbeafe; color: #1e3a8a; }
.think-pill.think-sell { background: #fee2e2; color: #991b1b; }
.think-pill.think-chase { background: #ffedd5; color: #9a3412; }
.think-pill.think-buy { background: #d1fae5; color: #065f46; }
.think-pill.think-wait { background: #f1f5f9; color: #475569; }

/* ——— Activity / learning log ——— */
.activity-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 0.65rem;
  align-items: end;
  margin-bottom: 0.75rem;
}
.activity-filters label {
  margin: 0;
}
.activity-search { grid-column: span 1; }
.activity-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}
.activity-stat-chip {
  display: inline-flex;
  padding: 0.28rem 0.55rem;
  border-radius: 8px;
  background: #eef4f8;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.activity-stat-chip:hover { background: #e2e8f0; color: var(--ink); }
.activity-note-row {
  align-items: center;
}
.activity-note-row input[type="text"] {
  flex: 1;
  min-width: 0;
}
.activity-table td { vertical-align: top; }
.activity-table .mono,
.mono {
  font-family: var(--mono);
  font-size: 0.82rem;
}
.activity-cat {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: #f1f5f9;
  font-size: 0.75rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.activity-row.cat-ai .activity-cat { background: #ede9fe; color: #5b21b6; }
.activity-row.cat-trade .activity-cat { background: #d1fae5; color: #065f46; }
.activity-row.cat-user .activity-cat { background: #dbeafe; color: #1e3a8a; }
.activity-row.cat-bridge .activity-cat { background: #ffedd5; color: #9a3412; }
.activity-row.cat-settings .activity-cat,
.activity-row.cat-mode .activity-cat { background: #fce7f3; color: #9d174d; }
.activity-row.cat-auto .activity-cat { background: #e0f2fe; color: #075985; }
.activity-details {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.activity-details pre {
  margin: 0.35rem 0 0;
  padding: 0.5rem 0.6rem;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  overflow: auto;
  max-height: 180px;
  font-size: 0.75rem;
}

@media (max-width: 900px) {
  .activity-filters {
    grid-template-columns: 1fr 1fr;
  }
  .activity-filters .btn-cta {
    grid-column: 1 / -1;
  }
}

/* ——— Desktop density: less scroll, phone stays stacked ——— */
.desk-top-row { display: block; }
.v2-ops-grid { display: block; }
.v2-foot-grid { display: block; }

@media (min-width: 1100px) {
  body {
    max-width: 1360px;
    padding: 18px 22px 48px;
  }

  .hero {
    padding: 1rem 1.25rem 1.1rem;
    margin-bottom: 0.75rem;
    border-radius: 14px;
  }
  .hero h1 {
    font-size: 1.65rem;
    margin-bottom: 0.25rem;
  }
  .hero .sub {
    font-size: 0.9rem;
    max-width: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .eyebrow { margin-bottom: 0.2rem; }

  .desk-top-row {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: stretch;
  }
  .desk-top-row > .panel {
    margin-bottom: 0;
    height: 100%;
  }
  .desk-top-row .ai-credits-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.55rem;
  }
  .desk-top-row .ai-credits .big { font-size: 1.2rem; }
  .desk-top-row .ai-credits-note { margin-bottom: 0; }

  .tabs {
    position: sticky;
    top: 8px;
    z-index: 40;
    margin-bottom: 0.75rem;
  }

  /* Market hours sits in the top row — no need to stick over content */
  .desk-top-row .mkts-clock {
    position: static;
    top: auto;
    z-index: auto;
  }

  .panel {
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.75rem;
  }
  .panel-head { margin-bottom: 0.5rem; }
  .panel-head h2 { font-size: 1.02rem; }
  .grid.stats {
    gap: 0.55rem;
    margin-bottom: 0.75rem;
  }
  .grid.stats article { padding: 0.65rem 0.75rem; }
  .grid.stats .big { font-size: 1.25rem; margin: 0.2rem 0 0.1rem; }

  /* V2: hide marketing hero; compact bridge when online */
  .v2-hero-panel { display: none; }
  .bridge-fix-panel.is-ok {
    padding: 0.55rem 0.85rem;
  }
  .bridge-fix-panel.is-ok .bridge-fix-title {
    font-size: 0.95rem;
    margin: 0 0 0.2rem;
  }
  .bridge-fix-panel.is-ok .cta-row {
    margin-top: 0.35rem;
  }
  .bridge-fix-panel.is-ok #v2-bridge-fix-hint { display: none; }

  .pnl-ai-panel { margin-bottom: 0.75rem; }
  .pnl-ai-grid { gap: 0.5rem; }
  .pnl-ai-card { padding: 0.55rem 0.65rem; }

  .v2-ops-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr);
    gap: 0.75rem;
    align-items: start;
    margin-bottom: 0.75rem;
  }
  .v2-ops-grid > .panel { margin-bottom: 0; }
  #v2-autotrader-panel {
    grid-column: 1;
    grid-row: 1 / span 2;
  }
  #v2-think-panel {
    grid-column: 2;
    grid-row: 1;
  }
  #v2-perf-panel {
    grid-column: 2;
    grid-row: 2;
  }
  .autotrader-panel .panel-head h2 { font-size: 1.1rem; }
  .think-headline { font-size: 1rem; margin-bottom: 0.45rem; }
  .think-log { max-height: 120px; }
  .think-bullets { gap: 0.25rem; margin-bottom: 0.5rem; }
  .think-bullets li { font-size: 0.88rem; }

  .monitor-panel .muted:first-of-type {
    display: none;
  }
  .data-table th,
  .data-table td {
    padding: 0.4rem 0.45rem;
    font-size: 0.84rem;
  }

  .v2-foot-grid {
    display: grid;
    grid-template-columns: 1fr 1.15fr 0.95fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: start;
  }
  .v2-foot-grid > .panel { margin-bottom: 0; }

  .split {
    gap: 0.75rem;
    margin-bottom: 0;
  }
  .split > .panel { margin-bottom: 0; }
}

@media (min-width: 1280px) {
  body { max-width: 1440px; }
  .v2-ops-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  }
}

/* Wiki / docs */
.wiki-hero { margin-bottom: 0.75rem; }
.wiki-tabs { margin-bottom: 1rem; }
.wiki-doc-list {
  margin: 0.5rem 0 0;
  padding-left: 1.15rem;
  line-height: 1.55;
}
.wiki-doc-list li { margin-bottom: 0.45rem; }
.wiki-mode-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .wiki-mode-grid { grid-template-columns: 1fr 1fr; }
}
.wiki-mode-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: #fff;
}
.wiki-mode-card.is-active {
  border-color: #6ee7b7;
  background: linear-gradient(160deg, #ecfdf5 0%, #ffffff 55%);
}
.wiki-mode-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}
.wiki-mode-head h3 {
  margin: 0;
  font-size: 1.05rem;
}
.wiki-mode-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.wiki-tips {
  margin: 0.45rem 0 0.65rem;
  padding-left: 1.1rem;
  font-size: 0.92rem;
  color: var(--muted);
}
.wiki-tips strong { color: var(--ink); }
.wiki-kv {
  display: grid;
  gap: 0.35rem 0.75rem;
  margin: 0;
  font-size: 0.9rem;
}
.wiki-kv > div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.35rem;
}
.wiki-kv dt {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}
.wiki-kv dd { margin: 0; }
.wiki-extra {
  margin: 0.65rem 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
}
a.btn-cta {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

