:root {
  --bg: #0f1420;
  --panel: #182031;
  --panel-2: #1e2740;
  --head: #1b2437;
  --line: #2a3450;
  --text: #e6ebf5;
  --muted: #8a95ad;
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, 0.14);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.14);
  --accent: #6c8cff;
  --accent-2: #4d6bd8;
  --warn: #facc15;
  --hover: #263255;
}

/* Light theme — applied when <html> has class "light" (set from localStorage). */
:root.light {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #eef2f9;
  --head: #eef2f9;
  --line: #dde3ee;
  --text: #1b2333;
  --muted: #5c6884;
  --green: #059669;
  --green-bg: rgba(5, 150, 105, 0.12);
  --red: #dc2626;
  --red-bg: rgba(220, 38, 38, 0.10);
  --accent: #4f6ef0;
  --accent-2: #3f5bc4;
  --warn: #b45309;
  --hover: #e3e8f2;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* Authenticated trade-image gallery and canvas viewer */
.media-heading,.viewer-bar,.media-actions,.annotation-tools { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.trade-process-actions { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.trade-images-panel { display:grid; gap:8px; }
.trade-images-panel .muted,.trade-save-status { margin:0; }
.media-heading { justify-content:space-between; }
.media-gallery-box { overflow-x:hidden; }
.media-section { border-top:1px solid var(--line); padding-top:14px; margin-top:14px; }
.media-section h4 { margin:0 0 10px; font-size:14px; }
.media-upload { display:grid; grid-template-columns:2fr 2fr auto; gap:12px; align-items:end; }
.media-gallery { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:14px; max-height:58vh; overflow:auto; }
.media-card { background:var(--panel-2); border:1px solid var(--line); border-radius:10px; padding:10px; min-width:0; }
.media-preview { width:100%; height:150px; border:0; border-radius:7px; overflow:hidden; padding:0; background:#07090e; cursor:zoom-in; }
.media-preview img { width:100%; height:100%; object-fit:contain; }
.media-card p { margin:8px 0 3px; overflow-wrap:anywhere; }
.media-card small { display:block; color:var(--muted); margin-bottom:8px; }
.media-primary-actions { margin-bottom:8px; }
.media-secondary-actions { padding-top:8px; border-top:1px solid var(--line); }
.media-actions .btn { white-space:normal; }
.media-footer { position:sticky; bottom:-22px; margin:16px -22px -22px; padding:14px 22px; background:var(--panel); border-top:1px solid var(--line); }
.media-footer .btn { min-width:96px; min-height:42px; }
.media-viewer { z-index:100; padding:0; }
.viewer-shell { width:100vw; height:100dvh; display:flex; flex-direction:column; background:rgba(5,7,12,.97); color:#fff; }
.viewer-bar { justify-content:center; padding:10px; background:#111827; }
.viewer-stage { flex:1; min-height:0; overflow:hidden; display:flex; align-items:center; justify-content:center; touch-action:none; cursor:grab; }
.viewer-transform { position:relative; transform-origin:center; max-width:94vw; max-height:78vh; }
.viewer-transform img { display:block; max-width:94vw; max-height:78vh; object-fit:contain; user-select:none; }
.viewer-transform canvas { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.viewer-transform canvas.editing { pointer-events:auto; cursor:crosshair; }
.viewer-caption { margin:0; padding:10px 18px; text-align:center; overflow-wrap:anywhere; }
.annotation-tools { justify-content:center; background:#111827; padding:8px; }
.annotation-tools .active { outline:2px solid var(--accent); }
@media (max-width:700px) {
  .media-upload { grid-template-columns:1fr; }
  .media-gallery { grid-template-columns:1fr; }
  .media-gallery-box { width:96vw; max-height:94vh; }
  .media-actions .btn { flex:1 1 auto; }
  .media-footer .btn { width:100%; }
  .viewer-bar { gap:5px; }
  .viewer-bar .btn { padding:6px 8px; }
}
@media (prefers-reduced-motion:reduce) { .viewer-transform { transition:none !important; } }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: var(--head);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { color: var(--accent); font-size: 20px; display: inline-flex; align-items: center; }
.brand h1 { font-size: 18px; margin: 0; letter-spacing: .5px; }
.licensed-to { font-size: 11px; color: var(--muted); margin-left: 4px; }
.trader-name {
  background: rgba(108,140,255,.12); color: var(--accent);
  border: 1px solid transparent; border-radius: 8px;
  padding: 5px 12px; font-size: 14px; font-weight: 700; cursor: pointer;
  letter-spacing: .3px;
}
.trader-name:hover { border-color: var(--accent); }
.trader-name.has-name::before { content: "👤 "; font-weight: 400; }
/* prominent help link — new users must be able to find the import guide */
.howto-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(250, 204, 21, .14); color: var(--warn);
  border: 1px solid rgba(250, 204, 21, .45); border-radius: 8px;
  padding: 5px 12px; font-size: 13px; font-weight: 700;
  text-decoration: none; letter-spacing: .2px; white-space: nowrap;
}
.howto-btn:hover { background: rgba(250, 204, 21, .24); border-color: var(--warn); }
.portfolio { display: flex; gap: 26px; }
.pf-item { display: flex; flex-direction: column; align-items: flex-end; }
.pf-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.pf-value { font-size: 18px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 22px; }

/* Settings pill + popover (top bar) */
.settings-wrap { position: relative; display: inline-block; }
#btnSettings { position: relative; }
.settings-dot { position: absolute; top: -3px; right: -3px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--warn, #facc15); border: 1.5px solid var(--head); }
.settings-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  min-width: 280px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px; box-shadow: 0 12px 34px rgba(0,0,0,.35); }
.settings-head { font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); padding: 6px 10px 4px; }
.settings-panel .account-link { width: 100%; text-align: left; }
.settings-sub { color: var(--muted); font-size: 11px; padding: 0 10px 8px; line-height: 1.4; }
.settings-div { border-top: 1px solid var(--line); margin: 6px 8px; }
.set-flds { display: flex; gap: 8px; padding: 2px 10px 4px; }
.set-fld { flex: 1; display: flex; flex-direction: column; gap: 3px; font-size: 10.5px;
  color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.set-fld input, .set-fld select { padding: 6px 7px; font-size: 13px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--bg); color: var(--text); width: 100%; }
.guest-badge { background: rgba(240,180,60,.14); color: var(--warn, #eab308);
  border: 1px solid rgba(240,180,60,.4); border-radius: 999px; padding: 6px 13px;
  font-size: 12px; font-weight: 600; white-space: nowrap; }
#publicDemoUrl a { color: var(--accent); word-break: break-all; }
.guest-mode #btnLogTrade, .guest-mode #btnSkip, .guest-mode #btnPause,
.guest-mode #btnAddAccount, .guest-mode #importPanel, .guest-mode .row-actions,
.guest-mode #onbClear, .guest-mode #emailNudge { display: none !important; }

/* Account menu (top-right dropdown) */
.account-menu { position: relative; }
.account-btn {
  display: flex; align-items: center; gap: 8px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 12px;
  color: var(--text); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.account-btn:hover { background: var(--hover); }
.account-avatar {
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent-2);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.account-btn .caret { color: var(--muted); font-size: 11px; }
.account-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); width: 220px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px;
  padding: 6px; z-index: 60; box-shadow: 0 12px 30px rgba(0,0,0,.45);
}
.account-dropdown[hidden] { display: none; }
.account-info { padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.account-name { font-weight: 700; font-size: 14px; }
.account-email { color: var(--muted); font-size: 12px; margin-top: 2px; word-break: break-all; }
.account-link {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--text); font-size: 13.5px; padding: 9px 10px; border-radius: 7px;
  cursor: pointer; text-decoration: none;
}
.account-link[hidden] { display: none; }
.account-link:hover { background: var(--panel-2); }
.account-link.danger { color: var(--red); }

/* Footer */
.site-footer {
  text-align: center; color: var(--muted); font-size: 12px;
  padding: 22px; border-top: 1px solid var(--line); margin-top: 10px;
}

/* Rotation card */
.rotation-card {
  display: flex; align-items: center; gap: 24px;
  margin: 18px 22px; padding: 18px 22px;
  background: linear-gradient(135deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 14px;
}
.rot-now { flex: 1; }
.rot-tag {
  font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--accent); background: rgba(108, 140, 255, .12);
  padding: 3px 9px; border-radius: 6px;
}
.rot-tag.muted { color: var(--muted); background: rgba(138,149,173,.12); }
.rot-account { font-size: 24px; font-weight: 700; margin-top: 8px; }
.rot-account-sm { font-size: 15px; font-weight: 600; margin-top: 6px; color: var(--text); }
.rot-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.rot-actions { display: flex; gap: 10px; }
.rot-next { text-align: right; min-width: 130px; }
.rot-cushion { font-size: 12px; color: var(--muted); margin-top: 4px; }
.rot-stats { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 12px; }
.rot-stat { display: flex; flex-direction: column; line-height: 1.2; }
.rot-stat-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.rot-stat-val { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rot-stat-val.accent { color: var(--accent); }
.rot-stat-val.warn { color: var(--warn); }
.rot-mode { text-align: right; min-width: 150px; }
.mode-toggle {
  display: inline-flex; margin-top: 8px; border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden;
}
.mode-btn {
  background: var(--panel); color: var(--muted); border: none;
  padding: 7px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.mode-btn:hover { background: var(--panel-2); color: var(--text); }
.mode-btn.active { background: var(--accent-2); color: #fff; }

/* Buttons */
.btn {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--accent-2); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* Grid */
.grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; padding: 0 22px 30px;
}
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden;
}
.panel.wide { grid-column: 1 / -1; }
.right-col { display: flex; flex-direction: column; gap: 16px; }
/* split the weekday row into two side-by-side boxes */
.wd-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1150px) { .wd-split { grid-template-columns: 1fr; } }
/* tabbed insight box next to PnL by Weekday */
.insight-head { padding: 0 !important; }
.insight-tabs { display: flex; width: 100%; }
.itab { flex: 1; background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); font-size: 12px; font-weight: 600; padding: 13px 4px; cursor: pointer; }
.itab:hover { color: var(--text); }
.itab.active { color: var(--accent); border-bottom-color: var(--accent); }
.insight-body { padding: 4px 16px 12px; }
.ins-row { display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.ins-row:last-child { border-bottom: none; }
.ins-lbl { color: var(--muted); min-width: 0; }
.ins-val { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ins-empty { color: var(--muted); padding: 20px; text-align: center; font-size: 13px; }

/* weekday PnL bars */
.weekday-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; }
.wd-row { display: flex; align-items: center; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid var(--line); }
.wd-row:last-child { border-bottom: none; }
.wd-day { width: 96px; font-size: 13px; color: var(--muted); font-weight: 600; }
.wd-val { margin-left: auto; width: 110px; text-align: right; font-size: 15px;
  font-variant-numeric: tabular-nums; font-weight: 700; }
.wd-stat { width: 78px; text-align: right; font-size: 12px;
  font-variant-numeric: tabular-nums; color: var(--muted); }
.wd-stat.pos { color: var(--green); }
.wd-stat.neg { color: var(--red); }
/* column-header row + timeframe label */
.wd-head { padding-top: 0; padding-bottom: 9px; }
.wd-head .wd-day, .wd-head .wd-val, .wd-head .wd-stat {
  color: var(--muted); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px; }
.panel-sub { color: var(--muted); font-size: 11px; font-weight: 500;
  text-transform: none; letter-spacing: 0; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 14px; margin: 0; font-weight: 600; }
.badge {
  font-size: 10px; font-weight: 700; color: var(--muted);
  border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px;
  vertical-align: middle;
}

/* Info icon + hover/tap tooltip */
.info { display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--muted);
  color: var(--muted); font-size: 10px; font-weight: 700; font-style: normal;
  line-height: 1; cursor: help; margin-left: 5px; vertical-align: middle;
  user-select: none; flex: none; }
.info:hover { color: var(--text); border-color: var(--text); }
#infoTip { position: absolute; z-index: 2000; max-width: 300px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px; font-size: 12px; line-height: 1.5; color: var(--text);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .45); pointer-events: none; }
#infoTip b { color: var(--accent); }

/* Tables */
.table-scroll { overflow: auto; }
/* Recent Trades flows to its content (no inner scroll box); the panel sizes to
   its trades rather than stretching to fill the grid row */
.table-scroll.tall { max-height: none; }
.trades-panel { align-self: start; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 9px; text-align: left; white-space: nowrap; }
thead th {
  background: var(--head); color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .5px; font-weight: 600;
  position: sticky; top: 0; border-bottom: 1px solid var(--line);
}
tbody tr { border-bottom: 1px solid rgba(42,52,80,.5); }
tbody tr:hover { background: rgba(108,140,255,.05); }
tbody tr.current-row { background: rgba(108,140,255,.10); }
.num { text-align: right; }
td.num { font-variant-numeric: tabular-nums; }
tfoot td { border-top: 2px solid var(--line); font-weight: 700; background: var(--head); }

.pos { color: var(--green); }
.neg { color: var(--red); }
/* colored text only — no background fills (user preference 2026-07-02) */
.cell-pos { color: var(--green); font-weight: 600; }
.cell-neg { color: var(--red); font-weight: 600; }
.cell-warn { color: var(--warn); font-weight: 600; }

.tag-eligible {
  font-size: 9.5px; font-weight: 700; letter-spacing: .5px;
  background: var(--green-bg); color: var(--green);
  padding: 1px 5px; border-radius: 4px; vertical-align: middle;
}
.tag-phase {
  font-size: 9.5px; font-weight: 700; letter-spacing: .5px;
  background: rgba(108,140,255,.15); color: var(--accent);
  padding: 1px 5px; border-radius: 4px; vertical-align: middle;
}
.tag-breached {
  font-size: 9.5px; font-weight: 700; letter-spacing: .5px;
  background: rgba(231,76,60,.18); color: var(--red);
  padding: 1px 5px; border-radius: 4px; vertical-align: middle;
}
/* revealed breached accounts read as dimmed/dead */
tbody tr.breached-row { opacity: .5; }
tbody tr.breached-row td:nth-child(2) { text-decoration: line-through; text-decoration-color: rgba(255,255,255,.25); }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-actions { white-space: nowrap; }

/* ---- First-run onboarding ---- */
.onboard {
  background: linear-gradient(135deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 16px;
  padding: 26px 28px; margin: 0 22px 16px;
}
.onboard-head h2 { font-size: 22px; margin: 0 0 6px; }
.onboard-head p { color: var(--muted); font-size: 14px; max-width: 640px; line-height: 1.5; margin: 0; }
.onboard-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 20px 0; }
.ob-step { display: flex; gap: 11px; align-items: flex-start;
  background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 13px 14px; }
.ob-step b { font-size: 13px; }
.ob-step span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.ob-num { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-2); color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; }
.onboard-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.onboard-note { color: var(--muted); font-size: 12px; }
.sample-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; background: rgba(250,204,21,.08); border: 1px solid rgba(250,204,21,.3);
  border-radius: 11px; padding: 10px 14px; margin: 0 22px 14px; font-size: 13px;
}
/* the display:flex above would otherwise override the [hidden] attribute */
.sample-banner[hidden] { display: none; }
@media (max-width: 700px) { .onboard-steps { grid-template-columns: 1fr; } }

/* ---- UP NOW suggested risk line ---- */
.rot-risk { font-size: 12px; margin-top: 5px; }
.rot-risk-lbl { font-size: 9.5px; font-weight: 700; letter-spacing: .5px; color: var(--accent);
  background: rgba(108,140,255,.12); padding: 1px 6px; border-radius: 5px; margin-right: 5px; }
.rot-risk-sub { color: var(--muted); }
.rot-contracts { color: var(--accent); font-weight: 700; }

/* ---- Pass-Rate Lab ---- */
.pl-note { color: var(--muted); font-size: 11px; font-weight: 400; }
.pl-details { margin: 4px 0 2px; }
.pl-details summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--accent); padding: 6px 0; user-select: none; }
.pl-details[open] summary { margin-bottom: 8px; }
.pl-controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 6px 0 12px; }
.pl-controls label { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.pl-controls select { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; color: var(--text); font-size: 13px; }
.pl-controls label.check { color: var(--text); }
.pl-you { margin-bottom: 12px; }
.pl-you-box { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.pl-you-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.pl-rec { margin-top: 5px; color: var(--accent); font-weight: 600; }
.pl-verdict { display: flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 700; }
.pl-verdict.pl-good { color: var(--pos, #22c55e); }
.pl-verdict.pl-warn { color: var(--warn, #eab308); }
.pl-verdict.pl-bad { color: var(--neg, #f87171); }
.pl-edge { font-size: 13px; color: var(--text); }
.pl-edge-note { color: var(--muted); font-size: 11.5px; }
.pl-legend { font-size: 12px; color: var(--muted); line-height: 1.55; margin-bottom: 10px;
  background: var(--panel-2); border-radius: 8px; padding: 9px 12px; }
.pl-you-load, .pl-loading { padding: 22px; text-align: center; color: var(--muted); font-size: 13px; }
.pl-matrix-wrap { overflow-x: auto; }
.pl-matrix { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.pl-matrix th, .pl-matrix td { padding: 5px 5px; text-align: center; font-size: 11.5px; border: 1px solid var(--line); }
.pl-matrix thead th { background: var(--head); color: var(--muted); font-weight: 700; }
.pl-matrix th.pl-risk { background: var(--head); white-space: nowrap; }
.pl-matrix td { font-weight: 700; }
.pl-wr { font-size: 10px; font-weight: 400; color: var(--muted); }
.pl-legend { font-size: 11.5px; color: var(--muted); margin: 10px 0 2px; line-height: 1.5; }

/* ---- Daily Game Plan modal ---- */
.plan-body { max-height: 62vh; overflow-y: auto; margin: 6px 0 8px; }
.plan-sec { margin-bottom: 15px; }
.plan-sec:last-child { margin-bottom: 4px; }
.plan-h { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 5px; }
.plan-line { font-size: 13.5px; line-height: 1.55; padding: 6px 0; border-bottom: 1px solid var(--line); }
.plan-line:last-child { border-bottom: none; }
.plan-loading { padding: 26px; text-align: center; color: var(--muted); }
.plan-foot { font-size: 11px; color: var(--muted); margin: 8px 0 2px; font-style: italic; }

/* ---- Economic calendar (Today's News) ---- */
.news-src { font-size: 11px; color: var(--muted); }
.plan-sub-tag { font-size: 12px; color: var(--muted); font-weight: 400; }
/* auto-fit stacks to ONE column whenever the panel is narrower than ~2x260px —
   responds to the panel's real width, so it's reliable on phones regardless of
   the reported viewport (media queries were unreliable on some mobile browsers) */
.news-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 2px 20px; }
.news-col { min-width: 0; }
.news-col-h {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); padding: 10px 14px 2px;
}

/* Between the phone card layout and a very wide monitor the accounts table
   still overflowed, which is the band most laptops sit in. Drop the three
   least-load-bearing columns there — Last trade, Total P&L % (derivable from
   Total P&L) and Week (which has its own panel on Today). All of them come
   back on a wide screen, and the card layout below shows every field anyway. */
@media (min-width: 701px) and (max-width: 1500px) {
  #accountsTable th:nth-child(4), #accountsTable td:nth-child(4),
  #accountsTable th:nth-child(5), #accountsTable td:nth-child(5),
  #accountsTable th:nth-child(7), #accountsTable td:nth-child(7) { display: none; }
}

/* ---- Wide tables -> cards on phones (no sideways scroll) ---- */
@media (max-width: 700px) {
  #accountsTable thead, #accountsTable tfoot,
  #moneyTable thead, #moneyTable tfoot { display: none; }
  #accountsTable, #accountsTable tbody,
  #moneyTable, #moneyTable tbody { display: block; }
  .table-scroll { overflow-x: visible; }
  #accountsTable tr, #moneyTable tr {
    display: block; border: 1px solid var(--line); border-radius: 11px;
    padding: 8px 12px; margin-bottom: 10px; background: var(--panel);
  }
  #accountsTable td, #moneyTable td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 5px 0; border: none; text-align: right; white-space: normal;
  }
  #accountsTable td::before, #moneyTable td::before {
    content: attr(data-label); color: var(--muted); font-weight: 600;
    font-size: 12px; text-align: left; flex: 0 0 auto;
  }
  /* firm = the card title: full width, no label, bigger */
  #accountsTable td.acct-name-cell, #moneyTable td.acct-name-cell {
    justify-content: flex-start; text-align: left; font-size: 15px; font-weight: 700;
    padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
  }
  #accountsTable td.acct-name-cell::before, #moneyTable td.acct-name-cell::before { display: none; }
  #accountsTable td.row-actions, #moneyTable td.row-actions { justify-content: flex-end; padding-top: 8px; }
  #accountsTable td.row-actions::before, #moneyTable td.row-actions::before { content: ""; }
}
.news-body { padding: 4px 14px 12px; max-height: 280px; overflow-y: auto; }
.news-row {
  display: flex; align-items: flex-start; gap: 9px; padding: 8px 2px;
  border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.news-row:last-child { border-bottom: none; }
.news-past { opacity: .42; }
.news-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; margin-top: 4px; }
.news-dot.high { background: var(--red); }
.news-dot.med { background: var(--warn); }
.news-main { flex: 1; min-width: 0; }
.news-meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.news-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.news-ccy { font-weight: 700; }
.news-fc { color: var(--muted); font-size: 11px; margin-left: auto; }
.news-title { line-height: 1.35; margin-top: 1px; }   /* full headline on its own line — wraps, never clipped */
.news-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }
/* tappable news panel + "full week" popup */
#newsPanel { cursor: pointer; }
#newsPanel:hover { border-color: var(--accent); }
.news-expand { font-size: 12px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.newsm-body { max-height: 66vh; overflow-y: auto; margin: 4px 0 8px; }
.newsm-group { margin-bottom: 14px; }
.newsm-daylabel {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); padding: 6px 0 4px; border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.newsm-row {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px;
  padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.newsm-row:last-child { border-bottom: none; }
.newsm-row .news-dot { align-self: center; }
.newsm-time { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 62px; }
.newsm-ccy { font-weight: 700; min-width: 34px; }
.newsm-title { flex: 1; min-width: 120px; }   /* full headline, wraps naturally */
.newsm-row .news-fc { color: var(--muted); font-size: 12px; }

/* ---- Alerts bar: what needs attention right now ---- */
.alerts-bar {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin: 0 22px 14px;   /* 22px sides = align with rotation card + panels */
}
.al-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.al-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.al-chip { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px; letter-spacing: .3px; }
.al-chip.sev-danger { background: rgba(231,76,60,.18); color: var(--red); }
.al-chip.sev-good { background: var(--green-bg); color: var(--green); }
.al-row {
  display: flex; align-items: flex-start; gap: 9px; padding: 7px 10px;
  border-radius: 9px; font-size: 13px; line-height: 1.4;
  border-left: 3px solid transparent;
}
.al-row + .al-row { margin-top: 5px; }
.al-row .al-ico { flex: 0 0 auto; font-size: 14px; line-height: 1.3; }
.al-row .al-txt { flex: 1 1 auto; min-width: 0; }
.al-row .al-id { color: var(--muted); font-weight: 400; }
.al-row.sev-danger { background: rgba(231,76,60,.09); border-left-color: var(--red); }
.al-row.sev-warn { background: rgba(250,204,21,.08); border-left-color: var(--warn); }
.al-row.sev-good { background: rgba(46,204,113,.08); border-left-color: var(--green); }
.al-row.sev-info { background: rgba(108,140,255,.08); border-left-color: var(--accent); }
.row-actions .icon-btn { margin: 0 2px; }
.row-actions .icon-btn:hover { color: var(--accent); }

.pill { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.pill.active { background: var(--green-bg); color: var(--green); }
.pill.paused { background: rgba(250,204,21,.15); color: var(--warn); }
.pill.blown  { background: var(--red-bg); color: var(--red); }
.now-dot { color: var(--accent); margin-right: 5px; }

.icon-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.icon-btn:hover { color: var(--red); }

/* Import panel */
.tax-section { padding: 14px 16px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 12px; }
.tax-title { font-weight: 600; font-size: 14px; }
.tax-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 10px; }
.tax-card { background: var(--panel-2, rgba(127,127,127,.06)); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; }
.tc-lbl { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.tc-val { font-size: 19px; font-weight: 700; }
.tc-val.warn { color: var(--warn); }
.tax-card input { width: 40px; padding: 1px 3px; font-size: 11px; margin: 0 1px;
  border: 1px solid var(--border); border-radius: 4px; background: transparent; color: var(--text); }
.tax-disclaimer { font-size: 11.5px; line-height: 1.5; color: var(--muted);
  background: rgba(127,127,127,.06); border-radius: 8px; padding: 9px 11px; }
.import-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.import-hint { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.import-steps { display: flex; flex-direction: column; gap: 10px; }
.import-step { display: flex; align-items: flex-start; gap: 10px; }
.step-badge { flex: 0 0 auto; background: var(--accent); color: #fff;
  font-weight: 800; font-size: 12.5px; padding: 4px 11px; border-radius: 999px;
  white-space: nowrap; margin-top: 1px; letter-spacing: .3px; }
.step-txt { font-size: 12.5px; line-height: 1.5; color: var(--text); }
.imp-label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.imp-label select {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 10px; color: var(--text); font-size: 14px;
}
.imp-drop {
  display: flex; align-items: center; justify-content: center;
  padding: 22px; border: 1.5px dashed var(--line); border-radius: 10px;
  color: var(--muted); cursor: pointer; text-align: center; font-size: 13px;
  transition: border-color .15s, background .15s;
}
.imp-drop:hover, .imp-drop.drag { border-color: var(--accent); background: rgba(108,140,255,.06); color: var(--text); }
.import-body .check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text); }
.imp-note { color: var(--muted); font-size: 11.5px; }
#btnImport { align-self: flex-start; }
.import-result { font-size: 13px; color: var(--muted); min-height: 18px; }
.import-result.ok { color: var(--green); }
.import-result.err { color: var(--red); }

/* View switch */
.view-switch { display: flex; gap: 8px; padding: 14px 22px 12px;
  position: sticky; top: var(--topbar-h, 60px); z-index: 19;
  background: var(--head); border-bottom: 1px solid var(--line); }
.view-btn {
  background: var(--panel); color: var(--muted); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 16px; font-size: 13.5px; font-weight: 600;
  cursor: pointer;
}
.view-btn:hover { background: var(--panel-2); color: var(--text); }
.view-btn.active { background: var(--accent-2); color: #fff; border-color: var(--accent); }

/* Calendar */
.cal-panel { margin: 16px 22px 30px; }
.cal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; gap: 10px;
}
.cal-nav { display: flex; align-items: center; gap: 10px; }
.cal-month { font-size: 17px; font-weight: 700; min-width: 150px; text-align: center; }
.cal-monthstats { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-stat {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 4px 12px; border-left: 1px solid var(--line);
}
.cal-stat:first-child { border-left: none; }
.cal-stat-label { font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .5px; }
.cal-stat-val { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-layout { display: flex; gap: 14px; padding: 16px 18px; }
.cal-main { flex: 1; }
.cal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
  margin-bottom: 6px;
}
.cal-weekdays span {
  text-align: center; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; font-weight: 600;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  min-height: 84px; border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 8px; display: flex; flex-direction: column; background: var(--panel-2);
}
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-cell.cal-pos { background: rgba(52,211,153,.13); border-color: rgba(52,211,153,.30); }
.cal-cell.cal-neg { background: rgba(248,113,113,.13); border-color: rgba(248,113,113,.30); }
.cal-daynum { font-size: 12px; color: var(--muted); font-weight: 600; }
.cal-pnl { margin-top: auto; font-size: 15px; font-weight: 700; }
.cal-meta { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.cal-weeks { display: flex; flex-direction: column; gap: 6px; width: 130px; }
.cal-week {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  min-height: 84px; display: flex; flex-direction: column; justify-content: center;
  background: var(--panel-2);
}
.cal-week-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.cal-week-pnl { font-size: 15px; font-weight: 700; margin-top: 4px; }
.cal-week-days { font-size: 11px; color: var(--muted); margin-top: 2px; }

@media (max-width: 900px) {
  .cal-layout { flex-direction: column; }
  .cal-weeks { flex-direction: row; width: auto; flex-wrap: wrap; }
  .cal-week { flex: 1; min-width: 110px; }
}

/* Compliance view */
.cmp-body {
  padding: 16px; display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
/* Money — year-at-a-glance grid */
.money-year { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; }
.my-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.my-head b { font-size: 15px; min-width: 52px; text-align: center; }
.my-sub { margin-left: auto; color: var(--muted); font-size: 13px; }
.my-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.my-cell { background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 8px; display: flex; flex-direction: column;
  align-items: center; gap: 3px; min-height: 66px; justify-content: center; }
.my-cell.empty { opacity: .45; }
.my-cell.pos { border-color: rgba(46,204,113,.4); background: var(--green-bg); }
.my-cell.neg { border-color: rgba(231,76,60,.35); background: rgba(231,76,60,.08); }
.my-mon { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.my-net { font-size: 15px; font-weight: 800; }
.my-detail { font-size: 10px; color: var(--muted); }
.my-foot { margin-top: 10px; font-size: 11px; color: var(--muted); }
@media (max-width: 640px) { .my-grid { grid-template-columns: repeat(3, 1fr); } }

.cmp-card { background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; }
.cmp-head { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px; }
.cmp-head b { font-size: 15px; }
.cmp-head { align-items: flex-start; }
.cmp-topass { text-align: right; line-height: 1.05; white-space: nowrap; }
.cmp-topass-val { display: block; font-size: 20px; font-weight: 800; color: var(--accent); }
.cmp-topass-lbl { display: block; font-size: 10px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); margin-top: 2px; }
.cmp-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; }
.cmp-ready { font-size: 11px; font-weight: 700; letter-spacing: .5px;
  background: var(--green-bg); color: var(--green); padding: 3px 9px; border-radius: 6px; }
.cmp-pending { font-size: 11px; font-weight: 700; letter-spacing: .5px;
  background: rgba(250,204,21,.15); color: var(--warn); padding: 3px 9px; border-radius: 6px; }
/* payout-readiness checklist */
.pay-section { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.pay-section.pay-dim { opacity: .72; }
.pay-head { display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); margin-bottom: 8px; }
.pay-preview { font-size: 11px; color: var(--muted); font-style: italic; margin-bottom: 6px; }
.pay-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; }
.pay-mark { width: 15px; text-align: center; color: var(--muted); font-weight: 700; }
.pay-mark.ok { color: var(--green); }
.pay-lbl { flex: 1; min-width: 0; }
.pay-det { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay-manual-head { font-size: 11px; color: var(--muted); margin: 8px 0 4px; }
.pay-manual { display: flex; align-items: flex-start; gap: 7px; font-size: 12.5px;
  padding: 3px 0; cursor: pointer; }
.pay-manual input { margin-top: 2px; flex: none; accent-color: var(--accent); }

.cmp-metric { margin: 10px 0; }
.cmp-row { display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; margin: 8px 0 4px; gap: 10px; }
.cmp-row span:first-child { color: var(--muted); }
.cmp-bar { height: 7px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.cmp-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.cmp-fill.pos { background: var(--green); }
.cmp-note { font-size: 12px; color: var(--warn); margin: 2px 0 8px;
  background: rgba(250,204,21,.08); padding: 6px 10px; border-radius: 6px; }

/* Money view */
.money-summary { display: flex; gap: 14px; padding: 16px 18px; flex-wrap: wrap; }
.ms-card { background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 20px; flex: 1; min-width: 150px; }
.ms-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.ms-val { font-size: 22px; font-weight: 700; display: block; margin-top: 4px; }
.payout-add { padding: 16px 18px; border-top: 1px solid var(--line); margin-top: 4px; }
.payout-form { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.payout-form select, .payout-form input {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; color: var(--text); font-size: 13.5px; }
.payout-form input[type=number] { width: 120px; }
.payout-list { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.po-row { display: flex; align-items: center; gap: 12px; font-size: 13px;
  padding: 6px 0; border-bottom: 1px solid rgba(42,52,80,.5); }

/* Stats view */
.stats-cards { display: grid; gap: 12px; padding: 16px 18px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.stat-card { background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-val { font-size: 20px; font-weight: 700; display: block; margin-top: 4px; }
.equity-wrap { padding: 8px 18px 20px; }
.equity-title { font-size: 12px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 8px; }

/* Modals */
.modal {
  position: fixed; inset: 0; background: rgba(6,9,16,.66);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal[hidden] { display: none; }   /* override .modal's display:flex when hidden */
.modal-box {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 22px; width: 420px; max-width: 92vw;
  max-height: 92vh; overflow-y: auto;   /* tall modals scroll instead of clipping off-screen */
}
.modal-box h3 { margin: 0 0 16px; font-size: 16px; }
.modal-box form { display: flex; flex-direction: column; gap: 12px; }
.modal-box label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.modal-box .row { display: flex; gap: 12px; }
/* min-width:0 lets each column shrink to fit — without it, selects overflow
   the modal because their intrinsic option-text width blocks shrinking */
.modal-box .row label { flex: 1 1 0; min-width: 0; }
.modal-box input, .modal-box select {
  width: 100%; box-sizing: border-box;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 10px; color: var(--text); font-size: 14px;
}
.modal-box label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.fld-hint { color: var(--muted); font-size: 10.5px; font-weight: 400; font-style: italic; }
.email-nudge { display: flex; align-items: center; gap: 12px; margin: 0 0 14px;
  padding: 12px 16px; border-radius: 12px; background: rgba(108,140,255,.10);
  border: 1px solid var(--accent); }
.email-nudge[hidden] { display: none; }
.email-nudge .en-icon { font-size: 20px; }
.email-nudge .en-txt { flex: 1; font-size: 13px; line-height: 1.5; color: var(--text); }
.email-nudge .en-close { background: none; border: none; color: var(--muted);
  font-size: 15px; cursor: pointer; padding: 4px 6px; }
.email-nudge .en-close:hover { color: var(--text); }
.fld-warn { font-size: 11.5px; line-height: 1.45; color: var(--warn);
  background: rgba(240,180,60,.10); border: 1px solid rgba(240,180,60,.35);
  border-radius: 8px; padding: 8px 10px; margin: 2px 0 4px; }
.pass-sub { font-size: 10.5px; color: var(--muted); font-weight: 400; margin-top: 2px;
  line-height: 1.25; cursor: help; white-space: nowrap; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.wide-modal { width: 480px; }
.modal-box select {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 10px; color: var(--text); font-size: 14px;
}
.rules-head {
  margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 12px; font-weight: 600; color: var(--text);
}

/* Let grid/flex children shrink so wide tables scroll INSIDE their panel
   instead of stretching the whole page (min-width:auto is the default trap). */
.grid > *, .right-col { min-width: 0; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .portfolio { gap: 14px; }
  .rotation-card { flex-wrap: wrap; }
}

/* Phones */
@media (max-width: 600px) {
  .grid { padding: 0 12px 24px; gap: 12px; }
  .rotation-card { margin: 12px; padding: 14px 16px; }
  .cal-panel { margin: 12px; }

  /* topbar stacks: brand row, then stats + account */
  .topbar { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; }
  .brand { flex-wrap: wrap; gap: 8px; }
  .brand h1 { font-size: 16px; }
  .topbar-right { flex-direction: column; align-items: stretch; gap: 12px; }
  .portfolio { justify-content: space-between; gap: 8px; }
  .pf-item { align-items: flex-start; }
  .pf-value { font-size: 15px; }
  .account-menu { align-self: stretch; }
  .account-btn { width: 100%; justify-content: center; }
  .account-dropdown { left: 0; right: 0; width: auto; }

  /* rotation card: stack each block full width */
  .rotation-card { flex-direction: column; align-items: stretch; gap: 14px; }
  .rot-account { font-size: 20px; }
  .rot-actions { flex-wrap: wrap; }
  .rot-actions .btn { flex: 1 1 auto; }
  .rot-next, .rot-mode { text-align: left; min-width: 0; }

  .view-switch { padding: 12px 12px 0; }
  .panel-head { flex-wrap: wrap; gap: 8px; }
  .head-actions { flex-wrap: wrap; }
}

/* Recent Trades — each day is its own boxed card with a colored left stripe */
#tradesTable .day-group td {
  background: var(--head);
  border-top: 12px solid var(--bg);   /* the visible gap between day boxes */
  padding-top: 10px; padding-bottom: 10px;
}
#tradesTable .day-group:first-child td { border-top: 2px solid var(--line); }
.day-group-date { font-weight: 700; color: var(--text); }
.day-group-count { font-weight: 400; color: var(--muted); font-size: 12px; }
.day-group-total { font-weight: 700; }
.day-group-total-label { color: var(--muted); font-weight: 400; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; margin-right: 4px; }
/* trades sit inside the day box, inset under the header */
#tradesTable .day-row td { border-top: none; background: var(--panel); }
#tradesTable .day-row td:nth-child(2) { padding-left: 18px; }
/* full colored box around each day (green profit / red loss), drawn with inset
   shadows: top edge on the header, sides on outer cells, bottom on the last trade */
#tradesTable .day-pos { --daycol: var(--green); }
#tradesTable .day-neg { --daycol: var(--red); }
#tradesTable .day-group td { box-shadow: inset 0 2px 0 var(--daycol); }              /* top edge */
#tradesTable .day-row td:first-child { box-shadow: inset 2px 0 0 var(--daycol); }    /* left edge */
#tradesTable .day-row td:last-child { box-shadow: inset -2px 0 0 var(--daycol); }    /* right edge */
#tradesTable .day-group td:first-child { box-shadow: inset 2px 0 0 var(--daycol), inset 0 2px 0 var(--daycol); }
#tradesTable .day-group td:last-child { box-shadow: inset -2px 0 0 var(--daycol), inset 0 2px 0 var(--daycol); }
#tradesTable .day-row.last-in-day td { box-shadow: inset 0 -2px 0 var(--daycol); }   /* bottom edge */
#tradesTable .day-row.last-in-day td:first-child { box-shadow: inset 2px 0 0 var(--daycol), inset 0 -2px 0 var(--daycol); }
#tradesTable .day-row.last-in-day td:last-child { box-shadow: inset -2px 0 0 var(--daycol), inset 0 -2px 0 var(--daycol); }

/* =========================================================================
   PHASE 1 - mission-control shell (sidebar + Today page)
   ========================================================================= */
.app-shell { display: flex; align-items: flex-start; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: 232px; flex: 0 0 232px; align-self: stretch;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--head); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; z-index: 60;
}
.side-brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 14px; }
.side-brand .logo { display: inline-flex; }
.side-brand h1 { font-size: 17px; margin: 0; letter-spacing: .3px; font-weight: 800; }
.side-brand .brand-k { color: var(--accent); }
.side-close { display: none; margin-left: auto; background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 9px 11px; border-radius: 9px; font-size: 14px; font-weight: 600;
  font-family: inherit; transition: background .12s, color .12s;
  /* One nav item is an <a> to a standalone page. Buttons get line-height
     normal from the UA sheet but an anchor inherits the body's, which made it
     ~2px taller than its neighbours; pin both so the row heights agree. */
  text-decoration: none; line-height: normal;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; }
.ni-ico { font-size: 15px; width: 20px; text-align: center; flex: 0 0 20px; }
.ni-lbl { flex: 1; }
.ni-soon { font-size: 9px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  background: var(--panel-2); color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.side-quick { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.side-quick-h { font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); padding: 2px 11px 6px; }
.qa {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 8px 11px; border-radius: 8px; font-size: 13.5px; font-weight: 600; font-family: inherit;
}
.qa:hover { background: var(--hover); color: var(--text); }
.qa-ico { color: var(--accent); font-weight: 800; width: 16px; text-align: center; }
.side-foot { margin-top: auto; padding-top: 14px; }
.side-alert { width: 100%; text-align: left; cursor: pointer; display: block;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-family: inherit; color: var(--text); }
.side-alert:hover { border-color: var(--accent); }
.sa-top { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.sa-top b { font-weight: 700; }
.sa-state { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--muted);
  background: var(--panel); border-radius: 999px; padding: 2px 9px; }
.sa-state.on { color: var(--green); background: var(--green-bg); }
.sa-sub { font-size: 11.5px; color: var(--muted); margin: 6px 0; line-height: 1.4; }
.sa-link { font-size: 12px; font-weight: 700; color: var(--accent); }

/* ---- App main + new topbar ---- */
.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { padding: 14px 26px; gap: 16px; }
.hamb { display: none; background: none; border: none; color: var(--text); font-size: 22px; cursor: pointer; padding: 0 4px 0 0; }
.tb-greet { flex: 1; min-width: 0; }
.tb-greet h2 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: .2px; }
.tb-greet p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.tb-date { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--panel);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 13px; white-space: nowrap; }
.tb-icon { background: var(--panel); border: 1px solid var(--line); color: var(--text);
  width: 38px; height: 38px; border-radius: 9px; cursor: pointer; font-size: 15px; position: relative;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.tb-icon:hover { border-color: var(--accent); }

/* ---- Today page scaffold ---- */
#todayView { padding: 22px 26px 46px; }
.today-wrap { display: flex; flex-direction: column; gap: 18px; }
.today-empty { text-align: center; padding: 70px 20px; }
.today-empty h2 { font-size: 22px; margin: 0 0 6px; }
.today-empty p { color: var(--muted); margin: 0 0 20px; }
.today-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.today-2col.wide-left { grid-template-columns: 1.7fr 1fr; }
.tcard { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.tcard-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.tcard-head h3 { margin: 0; font-size: 15px; font-weight: 800; }
.link-btn { background: none; border: none; color: var(--accent); font-weight: 700; font-size: 13px; cursor: pointer; font-family: inherit; }
.link-btn:hover { text-decoration: underline; }

/* ---- KPI cards ---- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-lbl { font-size: 10.5px; font-weight: 800; letter-spacing: .8px; color: var(--muted); }
.kpi-ico { font-size: 15px; opacity: .8; }
.kpi-val { font-size: 26px; font-weight: 800; margin: 8px 0 3px; letter-spacing: -.5px; }
.kpi-sub { font-size: 12px; color: var(--muted); }

/* ---- Action Center ---- */
.ac-chips { display: flex; gap: 6px; }
.ac-chip { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.ac-chip.urgent { color: var(--red); background: var(--red-bg); }
.ac-chip.opp { color: var(--green); background: var(--green-bg); }
.ac-list { display: flex; flex-direction: column; gap: 9px; }
.ac-empty { color: var(--muted); font-size: 13px; padding: 14px 4px; }
.ac-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line); border-left-width: 4px; }
.ac-item.sev-danger { border-left-color: var(--red); }
.ac-item.sev-warn { border-left-color: var(--warn); }
.ac-item.sev-good { border-left-color: var(--green); }
.ac-item.sev-info { border-left-color: var(--accent); }
.ac-ico { font-size: 17px; width: 26px; text-align: center; }
.ac-txt { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ac-txt b { font-size: 14px; font-weight: 700; }
.ac-txt span { font-size: 12px; color: var(--muted); }
.ac-arrow { color: var(--muted); font-size: 18px; }

/* ---- Today's Account to Trade ---- */
.best-badge { font-size: 11px; font-weight: 700; color: var(--green); background: var(--green-bg); padding: 4px 10px; border-radius: 999px; }
.tn-body { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
.tn-empty { color: var(--muted); font-size: 13px; }
.tn-main { display: flex; flex-direction: column; gap: 14px; }
.tn-id { display: flex; align-items: center; gap: 11px; }
.acct-logo { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px; background: var(--accent);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; }
.acct-logo.sm { width: 32px; height: 32px; flex-basis: 32px; font-size: 13px; border-radius: 9px; }
.tn-firm { font-size: 17px; font-weight: 800; }
.tn-acctid { font-size: 12px; color: var(--muted); }
.tn-lbl { font-size: 10px; font-weight: 800; letter-spacing: .7px; color: var(--muted); display: block; margin-bottom: 2px; }
.tn-cush { font-size: 22px; font-weight: 800; }
.tn-pct { font-size: 13px; color: var(--muted); margin-left: 7px; font-weight: 600; }
.tn-status { font-size: 15px; font-weight: 700; }
.tn-side { display: flex; flex-direction: column; gap: 14px; border-left: 1px solid var(--line); padding-left: 18px; }
.tn-goal-val { font-size: 21px; font-weight: 800; }
.tn-risk-val { font-size: 21px; font-weight: 800; color: var(--accent); display: block; }
.tn-sub { font-size: 11.5px; color: var(--muted); }
.tn-actions { margin-top: auto; display: flex; gap: 8px; }
.tn-actions .btn { flex: 1; }

/* ---- Accounts Overview ---- */
.acct-ov { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.ov-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 13px; padding: 13px; }
.ov-top { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; }
.ov-id { min-width: 0; }
.ov-firm { font-size: 13.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-acctid { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-cush-lbl { font-size: 9.5px; font-weight: 800; letter-spacing: .6px; color: var(--muted); }
.ov-cush { font-size: 16px; font-weight: 800; margin: 2px 0 9px; }
.ov-cush .ov-pct { font-size: 11px; color: var(--muted); font-weight: 600; }
.ov-bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-bottom: 11px; }
.ov-fill { height: 100%; border-radius: 999px; }
.ov-fill.bar-ok { background: var(--accent); }
.ov-fill.bar-ready { background: var(--green); }
.ov-fill.bar-risk { background: var(--warn); }
.ov-fill.bar-breach { background: var(--red); width: 100% !important; }
.ov-pill { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .5px; padding: 4px 10px; border-radius: 999px; }
.pill-ready { color: var(--green); background: var(--green-bg); }
.pill-active { color: var(--accent); background: rgba(108,140,255,.14); }
.pill-risk { color: var(--warn); background: rgba(250,204,21,.14); }
.pill-breach { color: var(--red); background: var(--red-bg); }
.pill-muted { color: var(--muted); background: var(--panel); }

/* ---- Quick Stats ---- */
.qs-period { font-size: 12px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 11px; }
.qstats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; }
.qs { display: flex; flex-direction: column; gap: 3px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.qs-lbl { font-size: 11px; color: var(--muted); font-weight: 600; }
.qs-val { font-size: 18px; font-weight: 800; }

/* ---- AI Game Plan strip ---- */
.gameplan-strip { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.gp-left { display: flex; align-items: center; gap: 13px; }
.gp-ico { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px; background: rgba(108,140,255,.14);
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.gp-left b { font-size: 14px; }
.gp-sum { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---- toast ---- */
#toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 18px; font-size: 13px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.3);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .acct-ov { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  body.nav-open .sidebar { transform: translateX(0); }
  .side-close { display: block; }
  .hamb { display: inline-block; }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 55; }
  body.nav-open .scrim { display: block; }
  .today-2col, .today-2col.wide-left { grid-template-columns: 1fr; }
  .tb-greet h2 { font-size: 18px; }
  .tb-greet p { display: none; }
}
@media (max-width: 620px) {
  .kpi-row { grid-template-columns: 1fr; }
  .acct-ov { grid-template-columns: 1fr; }
  .tn-body { grid-template-columns: 1fr; }
  .tn-side { border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: 14px; }
  .qstats { grid-template-columns: 1fr; }
  #todayView { padding: 16px 14px 40px; }
  .tb-date { display: none; }
}

.tb-icon.on { border-color: var(--accent); background: rgba(108,140,255,.16); }
.portfolio[hidden] { display: none !important; }

/* ---- Mobile topbar cleanup ---- */
@media (max-width: 900px) {
  .topbar { flex-direction: row; flex-wrap: wrap; row-gap: 10px; padding: 12px 16px; align-items: center; justify-content: flex-start; }
  .hamb { order: 1; margin-right: auto; }
  .topbar-right { order: 2; flex-direction: row; align-items: center; flex-wrap: nowrap; justify-content: flex-end; gap: 6px; }
  .tb-greet { order: 3; flex-basis: 100%; }
  .topbar-right a.tb-icon, #btnPrivacy { display: none; }
  #accountLabel { display: none; }
  .account-btn { padding: 6px 8px; }
}

/* ---- Today's Account: flip-through deck ---- */
.trade-now { position: relative; z-index: 0; }
.trade-now.stacked::before, .trade-now.stacked::after {
  content: ""; position: absolute; inset: 0; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line); z-index: -1;
}
.trade-now.stacked::before { transform: translate(6px, 9px) scale(0.985); opacity: .55; }
.trade-now.stacked::after { transform: translate(12px, 18px) scale(0.97); opacity: .3; }
.tn-nav { display: flex; align-items: center; gap: 10px; }
.tn-pos { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--panel-2);
  border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; }
.tn-arrows { display: flex; align-items: center; gap: 4px; }
.tn-arrow { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font-size: 16px; line-height: 1; cursor: pointer; }
.tn-arrow:hover { border-color: var(--accent); color: var(--accent); }
.tn-count { font-size: 11px; font-weight: 700; color: var(--muted); min-width: 30px; text-align: center; }
.tn-pager { display: flex; justify-content: center; gap: 7px; margin-top: 14px; }
.tn-dot { width: 8px; height: 8px; border-radius: 999px; border: none; padding: 0; cursor: pointer;
  background: var(--line); transition: background .12s, transform .12s; }
.tn-dot:hover { transform: scale(1.25); }
.tn-dot.on { background: var(--accent); }
.tn-dot.up { box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--green); }

/* ---- Today: Action Center + News + Account all side by side, same height ---- */
/* Action + News each half-width; the Account card = the two combined (2fr). */
.today-trio { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 18px; align-items: stretch; }
.today-trio > .tcard { min-width: 0; }
.today-trio .action-center, .today-trio .news-card { display: flex; flex-direction: column; }
.today-trio .ac-list, .today-trio .today-news { overflow-y: auto; }
@media (max-width: 1000px) {
  .today-trio { grid-template-columns: 1fr 1fr; }
  .today-trio .trade-now { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .today-trio { grid-template-columns: 1fr; }
  .today-trio .trade-now { grid-column: auto; }
}
.news-card .news-src { font-size: 11px; font-weight: 600; color: var(--muted); }
.today-news { display: flex; flex-direction: column; gap: 4px; }
.today-news .news-row { display: flex; align-items: flex-start; gap: 9px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.today-news .news-row:last-child { border-bottom: none; }
.today-news .news-dot { width: 8px; height: 8px; border-radius: 999px; margin-top: 5px; flex: 0 0 8px; }
.today-news .news-dot.high { background: var(--red); }
.today-news .news-main { min-width: 0; }
.today-news .news-meta { display: flex; align-items: center; gap: 8px; }
.today-news .news-time { font-size: 12px; font-weight: 700; }
.today-news .news-ccy { font-size: 10px; font-weight: 700; letter-spacing: .5px; color: var(--muted);
  background: var(--panel-2); border-radius: 5px; padding: 1px 6px; }
.today-news .news-title { font-size: 12.5px; color: var(--text); margin-top: 1px; }
.today-news .news-row.news-past { opacity: .45; }
.today-news .news-empty { color: var(--muted); font-size: 12.5px; padding: 10px 4px; }
.news-daynote { font-size: 11px; color: var(--muted); font-style: italic; padding: 2px 4px 6px; }


/* ---- Today's Account: bottom stat strip + cushion warning ---- */
.tn-stats { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 22px;
  margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.tn-stat { display: flex; flex-direction: column; gap: 2px; }
.tn-stat-lbl { font-size: 9.5px; font-weight: 800; letter-spacing: .6px; color: var(--muted); text-transform: uppercase; }
.tn-stat-val { font-size: 15px; font-weight: 800; }
.tn-stat-val.accent { color: var(--accent); }
.tn-stat-val.warn { color: var(--warn); }
.tn-warn { display: block; font-size: 11.5px; font-weight: 600; color: var(--warn); margin-top: 3px; }

/* ---- Today's Account: plan narrative line (replaces status) ---- */
.tn-plan { font-size: 13px; font-weight: 600; line-height: 1.45; display: block; }
.tn-plan.pos { color: var(--green); }
.tn-plan.warn { color: var(--warn); }

/* ---- Today: this-week P&L strip ---- */
.wk-nav { display: flex; align-items: center; gap: 10px; }
.wk-range { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.wk-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.wk-cell { border: 1px solid var(--line); border-radius: 12px; padding: 12px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 5px; background: var(--panel-2); min-width: 0; }
.wk-cell.wk-pos { background: var(--green-bg); border-color: rgba(52,211,153,.35); }
.wk-cell.wk-neg { background: var(--red-bg); border-color: rgba(248,113,113,.35); }
.wk-cell.wk-today { outline: 2px solid var(--accent); outline-offset: -1px; }
.wk-dow { font-size: 10px; font-weight: 800; letter-spacing: .6px; color: var(--muted); }
.wk-date { font-size: 15px; font-weight: 800; }
.wk-pnl { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.wk-pnl:not(.pos):not(.neg) { color: var(--muted); }
@media (max-width: 620px) {
  .wk-strip { grid-template-columns: repeat(4, 1fr); }
  .wk-pnl { font-size: 11px; }
}

/* ---- Today top row: 2 KPI cards + This Week's P&L (2fr) ---- */
.today-top { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 16px; align-items: stretch; }
.today-top .kpi-row { display: contents; }
.today-top .kpi { height: 100%; display: flex; flex-direction: column; justify-content: center; }
.today-top .weekpnl-card { display: flex; flex-direction: column; }
.today-top .weekpnl-card .wk-strip { flex: 1; align-content: center; }
.today-top .wk-strip { gap: 8px; }
.today-top .wk-cell { padding: 10px 4px; }
.today-top .wk-pnl { font-size: 11.5px; }
@media (max-width: 1000px) {
  .today-top { grid-template-columns: 1fr 1fr; }
  .today-top .weekpnl-card { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .today-top { grid-template-columns: 1fr; }
}

/* ---- KPI polish: return badge + accounts breakdown ---- */
.kpi { transition: border-color .15s ease, box-shadow .15s ease; }
.kpi:hover { border-color: rgba(108,140,255,.5); box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.kpi-foot { display: flex; align-items: center; gap: 11px; margin-top: 11px; flex-wrap: wrap; }
.kpi-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800;
  padding: 3px 10px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.kpi-badge.pos { color: var(--green); background: var(--green-bg); }
.kpi-badge.neg { color: var(--red); background: var(--red-bg); }
.kpi-mini { font-size: 12.5px; color: var(--muted); }
.kpi-mini b { font-weight: 800; }
.kpi-3 { display: flex; align-items: center; margin-top: 12px; }
.c-item { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.c-sep { width: 1px; align-self: stretch; background: var(--line); margin: 3px 4px; }
.c-num { font-size: 27px; font-weight: 800; line-height: 1; letter-spacing: -.5px; }
.c-num.accent { color: var(--accent); }
.c-num.pos { color: var(--green); }
.c-lbl { font-size: 11px; color: var(--muted); font-weight: 600; }

/* ---- Topbar icons: caption under each glyph ---- */
.tb-icon { flex-direction: column; width: auto; min-width: 50px; height: auto; padding: 6px 8px 5px; gap: 2px; line-height: 1; }
.tb-glyph { font-size: 15px; line-height: 1; }
.tb-cap { font-size: 9px; font-weight: 700; letter-spacing: .3px; color: var(--muted); }
.tb-icon:hover .tb-cap { color: var(--text); }
.tb-icon .settings-dot { top: 5px; right: 7px; }

/* ---- Accounts Overview: P&L + Cushion two-stat row ---- */
.ov-stats { display: flex; gap: 14px; margin: 2px 0 9px; }
.ov-stat { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ov-pnl { font-size: 16px; font-weight: 800; }

/* ---- Today's Account: equity sparkline ---- */
.tn-spark { grid-column: 1 / -1; margin-top: 6px; }
.tn-spark-chart { height: 46px; margin-top: 4px; }
.spark-svg { width: 100%; height: 100%; display: block; }

/* ---- News card: scope toggle + day/date headers ---- */
.news-head-actions { display: flex; align-items: center; gap: 10px; }
.news-toggle { background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; cursor: pointer; font-family: inherit; white-space: nowrap; }
.news-toggle:hover { border-color: var(--accent); }
.news-day + .news-day { margin-top: 10px; }
.news-day-h { font-size: 10.5px; font-weight: 800; letter-spacing: .4px; color: var(--accent);
  text-transform: uppercase; padding: 4px 2px 5px; border-bottom: 1px solid var(--line); margin-bottom: 3px; }
.news-hint { color: var(--muted); font-style: italic; }

/* ===================== AI Game Plan page ===================== */
.gp-page { padding: 22px 26px 46px; max-width: 1100px; }
.gp-page-head h2 { margin: 0; font-size: 22px; font-weight: 800; }
.gp-page-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.gp-empty { color: var(--muted); padding: 40px 4px; font-size: 14px; }
#gameplanBody { margin-top: 18px; }
.gp-hero { border: 1px solid var(--line); border-left-width: 5px; border-radius: 16px;
  background: var(--panel); padding: 18px 20px; margin-bottom: 18px; }
.gp-hero-good { border-left-color: var(--green); }
.gp-hero-warn { border-left-color: var(--warn); }
.gp-hero-ok { border-left-color: var(--accent); }
.gp-hero-read { font-size: 13px; color: var(--muted); }
.gp-hero-stance { font-size: 17px; font-weight: 700; margin-top: 6px; line-height: 1.45; }
.gp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.gp-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; border-top-width: 3px; }
.gp-card.gp-accent { border-top-color: var(--accent); }
.gp-card.gp-good { border-top-color: var(--green); }
.gp-card.gp-info { border-top-color: var(--accent); }
.gp-card.gp-warn { border-top-color: var(--warn); }
.gp-card.gp-bad { border-top-color: var(--red); }
.gp-card.gp-plain { border-top-color: var(--line); }
.gp-card-h { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 800; margin-bottom: 11px; }
.gp-card-ico { font-size: 17px; }
.gp-card-lines { display: flex; flex-direction: column; gap: 9px; }
.gp-line { font-size: 13.5px; line-height: 1.5; color: var(--text); }
.gp-card.gp-accent .gp-line:first-child { font-weight: 600; }
.gp-foot { margin-top: 18px; font-size: 12px; color: var(--muted); font-style: italic; }
@media (max-width: 820px) { .gp-grid { grid-template-columns: 1fr; } .gp-page { padding: 16px 14px 40px; } }

/* ===================== Trading Journal page ===================== */
.jr-page { padding: 22px 26px 46px; }
.jr-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.jr-head h2 { margin: 0; font-size: 22px; font-weight: 800; }
.jr-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; max-width: 640px; }
.jr-stats { display: flex; gap: 20px; }
.jr-stat { display: flex; flex-direction: column; align-items: flex-end; }
.jr-stat-num { font-size: 22px; font-weight: 800; }
.jr-stat-lbl { font-size: 10.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.jr-layout { display: grid; grid-template-columns: 1fr 1.35fr; gap: 18px; align-items: start; }
.jr-muted { color: var(--muted); }
.jr-form-card form { display: flex; flex-direction: column; gap: 13px; }
.jr-form-card label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; }
.jr-form-card input, .jr-form-card select, .jr-form-card textarea {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; color: var(--text);
  padding: 9px 11px; font-size: 14px; font-family: inherit; width: 100%; }
.jr-form-card textarea { resize: vertical; }
.jr-pnl-preview { font-size: 13px; color: var(--muted); }
.jr-form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.jr-count { font-size: 12px; color: var(--muted); }
.jr-nudge { background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px; margin-bottom: 13px; font-size: 12.5px; }
.jr-nudge-h { color: var(--muted); font-weight: 700; margin-right: 6px; }
.jr-chip { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 999px;
  padding: 4px 10px; font-size: 12px; font-weight: 700; cursor: pointer; margin: 3px 4px 3px 0; font-family: inherit; }
.jr-chip:hover { border-color: var(--accent); }
.jr-chip.pos { color: var(--green); } .jr-chip.neg { color: var(--red); }
.jr-empty { color: var(--muted); font-size: 13px; padding: 24px 4px; }
.jr-entry { border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; margin-bottom: 11px; background: var(--panel-2); }
.strategy-panel { border: 1px solid var(--line); border-radius: 10px; margin: 12px 0; padding: 10px 12px; }
.strategy-panel legend { font-weight: 700; padding: 0 5px; }
.strategy-panel .muted { color: var(--muted); font-size: 12px; margin: 0 0 8px; }
.strategy-group { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0; }
.strategy-group > b { flex-basis: 100%; font-size: 12px; }
.strategy-stats { border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; margin-top: 9px; padding-top: 9px; }
.strategy-page { padding: 22px 26px 46px; }
.strategy-page-head { margin-bottom: 14px; }
.strategy-page-head h2 { margin: 0; font-size: 22px; font-weight: 800; }
.strategy-page-head p, .strategy-help { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.strategy-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .85fr); gap: 18px; align-items: start; }
.strategy-notice { min-height: 22px; margin-bottom: 5px; font-size: 13px; }
.strategy-notice.success { color: var(--green); } .strategy-notice.error { color: var(--red); }
.strategy-state, .strategy-empty { color: var(--muted); font-size: 12px; margin: 10px 0; }
.strategy-create-form, .strategy-category-form, .strategy-value-form, .strategy-value-create {
  display: grid; grid-template-columns: minmax(130px, .8fr) minmax(160px, 1.2fr) auto auto; gap: 8px; align-items: center; }
.strategy-create-form { grid-template-columns: minmax(130px, .8fr) minmax(160px, 1.2fr) auto; margin-bottom: 14px; }
.strategy-category { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 12px; background: var(--panel-2); }
.strategy-category-form { padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.strategy-value-form { grid-template-columns: minmax(110px, .7fr) minmax(130px, 1fr) minmax(110px, .7fr) auto auto; margin-top: 8px; }
.strategy-value-create { grid-template-columns: minmax(110px, .7fr) minmax(130px, 1fr) auto; margin-top: 12px; }
.strategy-manager input, .strategy-manager select { width: 100%; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 8px 9px; font: inherit; }
.btn.danger, .icon-btn.danger { color: var(--red); }
.strategy-filter-group { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.strategy-filter-group legend { font-size: 12px; font-weight: 800; padding: 0 5px; }
.strategy-selected { color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; margin: 12px 0; }
.strategy-selected span { color: var(--accent); background: rgba(108,140,255,.12); padding: 3px 8px; border-radius: 999px; }
.strategy-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 12px; }
.strategy-kpis div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px; display: flex; flex-direction: column; }
.strategy-kpis span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.strategy-kpis b { font-size: 18px; margin-top: 2px; }
.grading-manager { margin-top: 18px; }
.grading-create { grid-template-columns: minmax(120px,.7fr) minmax(150px,1fr) 110px auto; }
.grading-profile-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.grading-profile-form > input { flex: 1 1 160px; }
.grading-profile-form label { color: var(--muted); font-size: 11px; }
.grading-profile-form label input { display: block; width: 76px; margin-top: 3px; }
.grade-default, .grade-badge { color: var(--accent); background: rgba(108,140,255,.14); border: 1px solid rgba(108,140,255,.35); border-radius: 999px; padding: 5px 9px; }
.grade-badge { cursor: pointer; font: inherit; font-weight: 800; white-space: nowrap; }
.grading-preview { color: var(--muted); font-size: 12px; margin: 10px 0; padding: 9px; border-left: 3px solid var(--accent); }
.grading-rules > div, .grading-add { display: grid; grid-template-columns: minmax(160px,1fr) 120px 90px auto; gap: 8px; align-items: center; margin-top: 7px; }
.grading-rules input, .grading-rules select, .grading-add input, .grading-add select { min-width: 0; width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 7px; }
.grading-add { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; grid-template-columns: minmax(160px,1fr) 110px 80px auto auto; }
@media (max-width: 950px) { .strategy-layout { grid-template-columns: 1fr; } }
@media (max-width: 650px) {
  .strategy-page { padding: 16px 14px 40px; }
  .strategy-create-form, .strategy-category-form, .strategy-value-form, .strategy-value-create { grid-template-columns: 1fr; }
  .strategy-category-form .btn, .strategy-value-form .btn, .strategy-value-create .btn, .strategy-create-form .btn { width: 100%; }
  .grading-create, .grading-rules > div, .grading-add { grid-template-columns: 1fr; }
  .strategy-value-form .icon-btn { width: 100%; }
}
.jr-entry-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.jr-entry-date { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.jr-entry-pnl { font-size: 16px; font-weight: 800; }
.jr-grade { font-size: 11px; font-weight: 800; width: 20px; height: 20px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }
.jr-grade-A, .jr-grade-B { color: var(--green); background: var(--green-bg); }
.jr-grade-C { color: var(--warn); background: rgba(250,204,21,.14); }
.jr-grade-D, .jr-grade-F { color: var(--red); background: var(--red-bg); }
.jr-entry-notes { font-size: 13px; color: var(--text); margin-top: 9px; line-height: 1.5; }
.jr-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.jr-tag { font-size: 11px; font-weight: 600; color: var(--accent); background: rgba(108,140,255,.12); border-radius: 6px; padding: 2px 8px; }
.jr-entry-actions { display: flex; gap: 14px; margin-top: 10px; }
.jr-link { background: none; border: none; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; padding: 0; font-family: inherit; }
.jr-link:hover { color: var(--accent); }
.jr-link.danger:hover { color: var(--red); }
@media (max-width: 860px) { .jr-layout { grid-template-columns: 1fr; } .jr-page { padding: 16px 14px 40px; } }

/* ===================== Reports page ===================== */
.rp-page { padding: 22px 26px 46px; }
.rp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.rp-head h2 { margin: 0; font-size: 22px; font-weight: 800; }
.rp-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; max-width: 620px; }
.rp-head-actions { display: flex; align-items: center; gap: 12px; }
.rp-year { display: flex; align-items: center; gap: 10px; }
.rp-year b { font-size: 15px; min-width: 44px; text-align: center; }
.rp-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.rp-kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; display: flex; flex-direction: column; gap: 3px; }
.rp-kpi-lbl { font-size: 10.5px; font-weight: 800; letter-spacing: .5px; color: var(--muted); text-transform: uppercase; }
.rp-kpi-val { font-size: 20px; font-weight: 800; }
.rp-2col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-bottom: 18px; align-items: stretch; }
.rp-sub { font-size: 12px; color: var(--muted); }
.rp-months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 190px; }
.rp-mo { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.rp-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.rp-bar { width: 62%; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--line); }
.rp-bar.pos { background: var(--green); } .rp-bar.neg { background: var(--red); }
.rp-mo-lbl { font-size: 10px; color: var(--muted); font-weight: 700; }
.rp-mo-val { font-size: 8.5px; font-weight: 700; white-space: nowrap; }
.rp-mo-val.pos { color: var(--green); } .rp-mo-val.neg { color: var(--red); }
.rp-mo-val:not(.pos):not(.neg) { color: var(--muted); }
.rp-equity { height: 190px; }
.rp-eq-svg { width: 100%; height: 100%; display: block; }
.rp-empty { color: var(--muted); font-size: 13px; padding: 30px 4px; text-align: center; }
#rpAcctTable { width: 100%; border-collapse: collapse; }
#rpAcctTable th, #rpAcctTable td { padding: 9px 12px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--line); }
#rpAcctTable th { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
#rpAcctTable td.num, #rpAcctTable th.num { text-align: right; font-variant-numeric: tabular-nums; }
.rp-foot { margin-top: 16px; font-size: 12.5px; color: var(--muted); }
@media (max-width: 900px) { .rp-2col { grid-template-columns: 1fr; } .rp-kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .rp-page { padding: 16px 14px 40px; } .rp-months { gap: 3px; } .rp-mo-val { display: none; } }

/* ===================== Reskinned Calendar / Compliance / Money ===================== */
.page-view { padding: 22px 26px 46px; }
.page-head { margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 22px; font-weight: 800; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; max-width: 660px; }
.cal-panel { margin: 0; border-radius: 16px; }
@media (max-width: 620px) { .page-view { padding: 16px 14px 40px; } }

/* ===================== Compliance rings + Portfolio Health ===================== */
.ph-hero { display: flex; align-items: center; gap: 22px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px 22px; margin: 0 0 8px; }
.ph-hero .cring { width: 92px; }
.ph-hero .cring-graphic { width: 92px; height: 92px; }
.ph-hero .cring-center { font-size: 24px; font-weight: 800; }
.ph-title { font-size: 12px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.ph-score-line { display: flex; align-items: baseline; gap: 6px; margin: 2px 0 4px; }
.ph-score { font-size: 34px; font-weight: 800; letter-spacing: -1px; }
.ph-outof { font-size: 15px; color: var(--muted); font-weight: 700; }
.ph-desc { font-size: 14px; margin-bottom: 8px; }
.ph-detail { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 0 0 18px; }
.ph-formula { font-size: 12.5px; color: var(--muted); line-height: 1.55; margin-bottom: 11px; }
.ph-part { display: flex; align-items: center; justify-content: space-between; font-size: 13px; padding: 6px 0; border-top: 1px solid var(--line); }
.ph-part-sz { color: var(--muted); font-weight: 600; }
.ph-part-score { font-weight: 800; font-variant-numeric: tabular-nums; }

.cmp-rings { display: flex; flex-wrap: wrap; gap: 18px; padding: 6px 2px 4px; }
.cring { display: flex; flex-direction: column; align-items: center; gap: 7px; width: 84px; }
.cring-graphic { position: relative; width: 72px; height: 72px; }
.cring-svg { width: 100%; height: 100%; display: block; }
.cring-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; }
.cring-lbl { font-size: 10.5px; color: var(--muted); font-weight: 600; text-align: center; line-height: 1.25; }
.cmp-note-warn { color: var(--warn); }
.cmp-note-bad { color: var(--red); }
@media (max-width: 620px) { .ph-hero { flex-direction: column; text-align: center; align-items: center; } .cmp-rings { justify-content: center; } }

/* ===================== Your Edge breakdown ===================== */
.edge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.edge-empty { color: var(--muted); font-size: 13px; padding: 20px 4px; }
.edge-dim-h { font-size: 13px; font-weight: 800; margin-bottom: 10px; }
.edge-dim-sub { font-size: 11px; font-weight: 600; color: var(--muted); }
.edge-row { display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 10px; padding: 5px 0; }
.edge-key { font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.edge-track { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.edge-bar { height: 100%; border-radius: 999px; background: var(--muted); }
.edge-bar.pos { background: var(--green); } .edge-bar.neg { background: var(--red); }
.edge-nums { text-align: right; min-width: 96px; }
.edge-pnl { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.edge-meta { display: block; font-size: 10.5px; color: var(--muted); font-weight: 600; }
.edge-tag { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; padding: 1px 6px; border-radius: 5px; }
.edge-tag.best { color: var(--green); background: var(--green-bg); }
.edge-tag.worst { color: var(--red); background: var(--red-bg); }
.edge-soon .edge-note { font-size: 12px; color: var(--muted); line-height: 1.5; }
@media (max-width: 820px) { .edge-grid { grid-template-columns: 1fr; } }

/* ===================== Tax planner (set-aside split + quarterly) ===================== */
.tax-setaside { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-top: 14px; }
.tsa-head { font-size: 13px; font-weight: 800; margin-bottom: 10px; }
.tsa-rows { display: flex; flex-direction: column; }
.tsa-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.tsa-row:last-child { border-bottom: none; }
.tsa-lbl { color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tsa-val { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tsa-total { margin-top: 4px; padding-top: 11px; border-top: 2px solid var(--line); }
.tsa-total .tsa-lbl { color: var(--text); font-weight: 700; }
.tsa-total .tsa-val { font-size: 18px; color: var(--warn); }
.tsa-rate { font-size: 11px; color: var(--muted); font-weight: 600; }
.tax-setaside input, .tax-quarters input { width: 46px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 7px; color: var(--text); padding: 4px 6px; font-size: 13px; text-align: center; }

.tax-quarters { margin-top: 14px; }
.tq-head { font-size: 13px; font-weight: 800; margin-bottom: 10px; }
.tq-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tq-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; }
.tq-card.tq-past { opacity: .6; }
.tq-name { font-size: 13px; font-weight: 800; }
.tq-due { display: block; font-size: 10.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.tq-pay { font-size: 19px; font-weight: 800; margin: 8px 0 2px; }
.tq-pay.warn { color: var(--warn); }
.tq-net { font-size: 11px; color: var(--muted); }
.tq-empty { color: var(--muted); font-size: 13px; }
.tax-deduct-tip { font-size: 12px; color: var(--muted); line-height: 1.55; background: rgba(108,140,255,.08);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px; margin: 10px 0; }
@media (max-width: 700px) { .tq-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---- Accounts (dashboard) view header ---- */
.dash-head { padding: 22px 22px 2px; }
.dash-head h2 { margin: 0; font-size: 22px; font-weight: 800; }
.dash-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* ---- Subtle page transition ---- */
.view-in { animation: viewIn .2s ease; }

/* ===================== Coaching Insights ===================== */
.coaching-page { padding: 22px; max-width: 1500px; margin: 0 auto; }
.coaching-filters { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 10px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.coaching-filters label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.coaching-filters input, .coaching-filters select { min-width: 0; padding: 8px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; }
.coaching-filters select[multiple] { min-height: 64px; }
.coaching-filter-actions { display: flex; flex-direction: column; justify-content: end; gap: 6px; }
.coaching-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin: 14px 0; }
.coaching-kpi { padding: 13px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; }
.coaching-kpi span, .coaching-row small { display: block; color: var(--muted); font-size: 11px; }
.coaching-kpi b { display: block; margin-top: 4px; font-size: 20px; }
.coaching-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.coaching-wide { grid-column: 1 / -1; }
.coaching-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.coaching-row:last-child { border-bottom: 0; }
.sample-note { color: var(--green); font-size: 11px; text-align: right; }
.sample-note.insufficient { color: var(--warn); }
#coachingTrend p, #coachingQuality p, #coachingQuality li { font-size: 13px; line-height: 1.5; }
#coachingTrend small { color: var(--muted); }
@media (max-width: 1000px) { .coaching-filters { grid-template-columns: repeat(3, 1fr); } .coaching-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 650px) { .coaching-page { padding: 14px; } .coaching-filters, .coaching-kpis, .coaching-grid { grid-template-columns: 1fr; } .coaching-wide { grid-column: auto; } .coaching-filter-actions { flex-direction: row; } }
@keyframes viewIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view-in { animation: none; } }

/* ---- Reports empty state (fresh signup) ---- */
.rp-empty-state { text-align: center; padding: 60px 20px; max-width: 520px; margin: 24px auto; }
.rp-empty-ico { font-size: 38px; margin-bottom: 10px; }
.rp-empty-state h3 { margin: 0 0 8px; font-size: 19px; font-weight: 800; }
.rp-empty-state p { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0 0 20px; }
.rp-empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ===================== Market Bias ===================== */
.market-bias-page { padding: 22px; max-width: 1500px; margin: 0 auto; }
.mb-head,.mb-actions { display:flex; align-items:center; gap:12px; }
.mb-head { justify-content:space-between; margin-bottom:16px; }.mb-head h2{margin:0}.mb-head p{color:var(--muted);margin:4px 0}
.mb-actions select { padding:9px; border:1px solid var(--line); border-radius:7px; color:var(--text); background:var(--panel); }
.mb-widget-card { padding: 10px; min-height: 490px; overflow: hidden; }
.tradingview-widget-container { height: 450px; width: 100%; }
.tradingview-widget-container__widget { height: 100%; width: 100%; }
.tradingview-widget-copyright { padding: 6px 4px 0; font-size: 12px; text-align: center; }
.tradingview-widget-copyright a { color: #2962ff; text-decoration: none; }
.mb-confirmation { display:grid; grid-template-columns:minmax(180px,1fr) auto auto; align-items:center; gap:18px; padding:18px; margin-top:14px; }
.mb-confirmation h3,.mb-confirmation p { margin:0 0 5px; }.mb-confirmation p,.mb-save-state,#mbMorning{color:var(--muted);font-size:13px}
.mb-bias-options { display:flex; gap:8px; flex-wrap:wrap; }.mb-bias-options label{border:1px solid var(--line);border-radius:8px;padding:9px 12px;cursor:pointer}
.mb-save-state { grid-column:1/-1; min-height:18px; }.mb-confirmation>div:last-child{grid-column:1/-1}
.mb-disclaimer{text-align:center;color:var(--muted);font-size:12px;line-height:1.5;margin:18px}
@media(max-width:650px){.market-bias-page{padding:14px}.mb-head{align-items:stretch;flex-direction:column}.mb-actions{flex-wrap:wrap}.mb-confirmation{grid-template-columns:1fr;align-items:stretch}.mb-save-state,.mb-confirmation>div:last-child{grid-column:auto}}

/* Today's saved Morning Bias — a small chip beside the greeting rather than a
   full-width strip, which was a whole row to show two words. Only today's call
   is ever shown; the endpoint will not fall back to an older day. */
.tb-greet-line { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.bias-chip { display:inline-flex; align-items:center; gap:8px; padding:2px 9px;
  border:1px solid var(--line); border-radius:20px; background:transparent;
  font-size:11.5px; font-weight:600; line-height:1.7; color:var(--muted);
  cursor:pointer; white-space:nowrap; }
.bias-chip:hover { border-color:var(--accent); color:var(--text); }
.bias-pill { display:inline-flex; align-items:center; gap:4px; }
.bias-pill .bias-instr { color:var(--muted); font-weight:700; }
.bias-pill.bull { color:var(--green); }
.bias-pill.bear { color:var(--red); }
.bias-pill.neutral { color:var(--muted); }
.bias-chip-empty { font-weight:500; }

/* A long account identifier in Firm / Product was forcing the whole accounts
   table into a horizontal scrollbar. Cap it and ellipsis; the full value stays
   in the cell's title and in the Acct ID column. */
.acct-prod { display:inline-block; max-width:150px; overflow:hidden;
  text-overflow:ellipsis; vertical-align:bottom; }
@media (max-width:900px) { .acct-prod { max-width:90px; } }

/* ---- Payout Planner ---- */
    .pp-page { max-width: 1080px; margin: 26px auto; padding: 0 20px; }
    .pp-head { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; margin-bottom:20px; flex-wrap:wrap; }
    .pp-head h2 { font-size:22px; margin:0 0 4px; }
    .pp-head p { color:var(--muted); font-size:13.5px; margin:0; }
    .pp-hero { display:grid; grid-template-columns:repeat(auto-fit,minmax(215px,1fr)); gap:14px; margin-bottom:22px; }
    .pp-stat { background:var(--panel); border:1px solid var(--line); border-radius:13px; padding:16px 18px; }
    .pp-stat .k { color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.06em; font-weight:600; }
    .pp-stat .v { font-size:25px; font-weight:700; margin-top:6px; }
    .pp-stat .s { color:var(--muted); font-size:12.5px; margin-top:3px; }
    .pp-stat.good { border-color:var(--green); }
    .pp-stat.good .v { color:var(--green); }

    .pp-today { background:var(--panel); border:1px solid var(--accent); border-left-width:3px;
      border-radius:13px; padding:16px 18px; margin-bottom:22px; }
    .pp-today h2 { font-size:14px; margin:0 0 10px; }
    .pp-today ul { margin:0; padding-left:19px; color:var(--text); font-size:14px; line-height:1.9; }
    .pp-today li b { color:var(--accent); }

    .pp-row { background:var(--panel); border:1px solid var(--line); border-radius:13px;
      padding:15px 18px; margin-bottom:11px; display:grid;
      grid-template-columns: 1.35fr 1.5fr auto; gap:18px; align-items:center; }
    .pp-row.ready { border-color:var(--green); }
    .pp-name { font-weight:700; font-size:15px; }
    .pp-sub { color:var(--muted); font-size:12px; margin-top:3px; }
    .pp-headline { font-size:14.5px; font-weight:600; }
    .pp-headline.ready { color:var(--green); }
    .pp-blockers { color:var(--muted); font-size:12.5px; margin-top:4px; line-height:1.65; }
    .pp-when { text-align:right; white-space:nowrap; }
    .pp-when .d { font-size:13px; font-weight:700; }
    .pp-when .l { color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.05em; }
    .pp-pill { display:inline-block; font-size:10.5px; font-weight:700; padding:2px 8px; border-radius:20px;
      letter-spacing:.04em; }
    .pp-pill.ready { background:var(--green-bg); color:var(--green); }
    .pp-pill.soon { background:rgba(108,140,255,.14); color:var(--accent); }
    .pp-pill.hold { background:rgba(250,204,21,.12); color:#facc15; }
    .pp-note { color:var(--muted); font-size:12.5px; margin-top:18px; line-height:1.6; }
    @media (max-width:760px) { .pp-row { grid-template-columns:1fr; gap:9px; } .pp-when { text-align:left; } }
  

/* A rejected account save used to close the modal silently. Now it says why. */
.acct-form-error { color: var(--red); background: var(--red-bg); border: 1px solid var(--red);
  border-radius: 8px; padding: 9px 12px; font-size: 13px; margin: 10px 0 0; }

/* The phase filter persists across sessions; when it is hiding accounts, say so
   rather than letting a newly added one look like it failed to save. */
.phase-filter-note { color: var(--muted); font-size: 12.5px; margin: 0 0 8px;
  padding: 7px 11px; background: rgba(108,140,255,.08);
  border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; }
.phase-filter-note b { color: var(--text); }

/* Paste route for the TopstepX import. It exists because neither the site owner
   nor a file he was sent could locate that export — so it is a first-class
   input, not a curiosity tucked away. */
.imp-paste { margin: 10px 0 0; }
.imp-paste > summary { cursor: pointer; color: var(--accent); font-size: 13px;
  font-weight: 600; padding: 4px 0; }
.imp-paste textarea { width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  font: 12.5px/1.5 Consolas, ui-monospace, monospace; resize: vertical; }
.imp-preview { margin: 10px 0 0; padding: 10px 12px; border-radius: 0 8px 8px 0;
  background: rgba(108,140,255,.08); border-left: 3px solid var(--accent);
  font-size: 13px; line-height: 1.6; }
.imp-preview b { color: var(--text); }
.imp-preview .imp-warn { color: var(--red); }
.imp-preview table { width: 100%; margin-top: 7px; border-collapse: collapse; }
.imp-preview td { padding: 2px 8px 2px 0; font-size: 12.5px; color: var(--muted); }
.imp-preview td:last-child { text-align: right; }
