/* ============================================================================
   Design system — "calm command"
   Premium, precise, spacious, trustworthy. Light base, blue/teal, monitoring-grade
   status vocabulary. ALL colour/scale lives in tokens so a brand kit (or per-tenant
   theme, Phase 3) drops in by overriding :root / [data-theme] — no re-skin.
   Placeholder brand only; final name is config/tenant-driven, never hardcoded.
   ============================================================================ */

:root {
    /* Surfaces & ink — deeper page bg so cards pop; NEAR-BLACK ink for a sharp, premium read. */
    --bg: #ebebe4;
    --surface: #ffffff;
    --surface-2: #f7f7f3;
    --surface-inset: #eeeee8;
    --border: #e2e2db;
    --border-strong: #cfcfc6;
    --ink: #0a0e14;        /* near-black — the single biggest "snap into focus" lever */
    --ink-2: #384250;
    --muted: #667085;
    --faint: #98a2b3;

    /* Brand — Stanchion teal, RESERVED for brand moments only (logo, CTAs, active nav, main chart). */
    --brand: #00897b;
    --brand-strong: #00796b;
    --brand-tint: #e0f2ef;
    --accent: #4db6ac;
    --accent-tint: #e0f2ef;

    /* Semantic palette — colour carries MEANING (separate from brand teal, which fixes the flatness).
       green=positive · red=negative · amber=warning · slate=neutral. Red reserved for real alerts. */
    --st-healthy: #12b76a;
    --st-healthy-bg: #e3f7ec;
    --st-warn: #d18e0b;
    --st-warn-bg: #fbf0da;
    --st-alert: #e5484d;
    --st-alert-bg: #fdeaea;
    --st-neutral: #64748b;
    --st-neutral-bg: #eef1f6;

    /* Data viz — positive is a confident GREEN (distinct from brand teal), negative an assured RED. */
    --pos: #12b76a;
    --neg: #e5484d;

    /* Scale */
    --r-sm: 7px;
    --r: 11px;
    --r-lg: 16px;
    --sp: 8px;
    --shadow-sm: 0 1px 2px rgba(16, 33, 56, .06), 0 1px 3px rgba(16, 33, 56, .04);
    --shadow: 0 2px 8px rgba(16, 33, 56, .06), 0 8px 24px rgba(16, 33, 56, .05);
    --shadow-lg: 0 12px 40px rgba(16, 33, 56, .12);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;   /* Stanchion display headings */
    --nums: 'Inter', ui-monospace, 'SF Mono', 'Cascadia Mono', monospace;
}

/* Dark theme — the premium option (serious algo traders live in dark terminals: MT5, TradingView,
   Bloomberg). Pure token swap. Scoped html[data-theme] so it beats the inline per-tenant brand tint
   in <head>; --brand itself is NOT overridden, so white-label brands (Door B, #12) still apply. */
html[data-theme="dark"] {
    --bg: #0a0e14;
    --surface: #141b26;
    --surface-2: #10161f;
    --surface-inset: #1b2431;
    --border: #242f3e;
    --border-strong: #33415a;
    --ink: #eef2f7;
    --ink-2: #c7d0dc;
    --muted: #8b97a8;
    --faint: #5c6879;
    --brand-tint: #0e2b28;
    --accent-tint: #0e2b28;
    --st-healthy: #2ce592;
    --st-healthy-bg: #0e2a1e;
    --st-warn: #f0b429;
    --st-warn-bg: #2a2210;
    --st-alert: #ff6b6b;
    --st-alert-bg: #2c1618;
    --st-neutral: #7a8ba3;
    --st-neutral-bg: #1b2431;
    --pos: #2ce592;
    --neg: #ff6b6b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 2px 10px rgba(0, 0, 0, .45);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
}
html[data-theme="dark"] body { background: var(--bg); }

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--brand-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

.tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }

/* ---- App shell ---------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }
.side {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    display: flex; flex-direction: column; gap: 4px;
    position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 20px; }
.brand-mark {
    width: 30px; height: 30px; border-radius: 8px; flex: none;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
    display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-mark svg { width: 19px; height: 19px; display: block; }
.brand-name { font-family: var(--serif); font-weight: 700; letter-spacing: -.01em; font-size: 18px; color: var(--ink); }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); padding: 16px 10px 6px; font-weight: 600; }
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 11px; border-radius: var(--r-sm);
    color: var(--ink-2); font-weight: 500; font-size: 14px;
}
.nav-item:hover { background: var(--surface-inset); text-decoration: none; color: var(--ink); }
.nav-item.active { background: var(--brand-tint); color: var(--brand-strong); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex: none; stroke-width: 1.8; }
.side-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 18px 32px; border-bottom: 1px solid var(--border); background: var(--surface);
    position: sticky; top: 0; z-index: 5;
}
.topbar > :first-child { min-width: 0; }        /* title may truncate … */
.topbar > :last-child { flex: none; }           /* … but toolbar actions never clip */
.page-title { font-family: var(--serif); font-size: 23px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.content { padding: 20px 28px; max-width: 1400px; width: 100%; min-width: 0; }
/* Wide tables scroll inside their own box instead of widening the page (which was
   pushing the right-aligned toolbar button off-screen on narrow viewports). */
.table-wrap { width: 100%; overflow-x: auto; }

/* ---- User chip ---------------------------------------------------------- */
.userchip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm); }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; flex: none;
    background: var(--accent-tint); color: var(--accent);
    display: grid; place-items: center; font-weight: 650; font-size: 13px;
}
.userchip .nm { font-size: 13px; font-weight: 600; line-height: 1.2; }
.userchip .em { font-size: 11.5px; color: var(--muted); }

/* ---- Cards & metrics ---------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 13.5px; font-weight: 650; letter-spacing: -.005em; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 15px; box-shadow: var(--shadow-sm); }
.metric .k { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.metric .v { font-size: 22px; font-weight: 680; letter-spacing: -.02em; margin-top: 2px; line-height: 1.1; }
.metric .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.row-chev { float: right; color: var(--faint); font-size: 18px; line-height: 1; font-weight: 400; }
tr.row-open .row-chev { color: var(--brand); }

/* Account detail — CENTRE modal (dashboard directive: centre of screen, not a right slide-over) */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 20, .5); z-index: 60;
    display: flex; align-items: center; justify-content: center; padding: 24px; animation: soFade .16s ease; }
.modal { width: 940px; max-width: 100%; max-height: 88vh; background: var(--bg); border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
    animation: modalIn .2s cubic-bezier(.22, .61, .36, 1); }
.modal-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
.modal-body { overflow-y: auto; flex: 1; overscroll-behavior: contain; }
@keyframes soFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: scale(.97) translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 720px) { .modal-backdrop { padding: 0; } .modal { max-height: 100vh; height: 100vh; border-radius: 0; } .modal .cols-detail { grid-template-columns: 1fr; } .modal .stat-grid-3 { grid-template-columns: 1fr 1fr; } }

/* Daily P&L calendar heatmap (drill-down). Columns stretch to fill the card width (no dead
   right-hand whitespace); cells stay square via aspect-ratio, capped so a sparse history
   doesn't blow them up. The bare .hm-cell rule styles the small legend swatches below. */
.heatmap { display: flex; justify-content: space-between; gap: 4px; align-items: flex-start; }
.heatmap .hm-col { flex: 1 1 0; max-width: 30px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.heatmap .hm-cell { width: 100%; height: auto; aspect-ratio: 1 / 1; }
.hm-cell { width: 13px; height: 13px; border-radius: 3px; display: inline-block; flex: none; }

/* Detailed drill-down chart — gridlines + y-axis value labels (TradingView-ish, our data) */
.ch-wrap { position: relative; height: 200px; }
.ch-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ch-grid { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border); pointer-events: none; }
.ch-lbl { position: absolute; left: 0; top: -7px; font-size: 10px; color: var(--faint); background: var(--surface); padding: 0 5px 0 0; }

/* Money grouped by currency (Decision #10) — never blind-summed across currencies. */
.money-row { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.money-row .ccy { font-size: 12px; color: var(--faint); font-weight: 600; margin-left: 2px; }

/* ---- Status vocabulary -------------------------------------------------- */
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 9px 3px 8px; border-radius: 999px;
    font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.s-healthy { color: var(--st-healthy); background: var(--st-healthy-bg); }
.s-healthy .dot { background: var(--st-healthy); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-healthy) 18%, transparent); }
.s-warn { color: var(--st-warn); background: var(--st-warn-bg); }
.s-warn .dot { background: var(--st-warn); }
.s-alert { color: var(--st-alert); background: var(--st-alert-bg); }
.s-alert .dot { background: var(--st-alert); }
.s-neutral { color: var(--st-neutral); background: var(--st-neutral-bg); }
.s-neutral .dot { background: var(--st-neutral); }

.tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--r-sm); font-size: 11.5px; font-weight: 600; background: var(--surface-inset); color: var(--ink-2); }
.tag.live { background: var(--st-healthy-bg); color: var(--st-healthy); }
.tag.demo { background: var(--accent-tint); color: var(--accent); }

/* ---- List-first account table ------------------------------------------- */
.acct-group { margin-bottom: 22px; }
.acct-group-h { display: flex; align-items: center; gap: 10px; margin: 4px 2px 10px; }
.acct-group-h .lbl { font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.acct-group-h .ct { font-size: 12px; color: var(--faint); }
.acct-group-h .line { flex: 1; height: 1px; background: var(--border); }

table.acct { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-sm); }
table.acct th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
table.acct th.r, table.acct td.r { text-align: right; }
table.acct td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
table.acct tr:last-child td { border-bottom: none; }
table.acct tbody tr:hover { background: var(--surface-2); }
.acct-name { font-weight: 600; color: var(--ink); }
.acct-meta { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* mini uptime bars */
.bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 18px; }
.bars i { width: 4px; height: 100%; border-radius: 1.5px; background: var(--st-neutral-bg); display: inline-block; }
.bars i.up { background: var(--st-healthy); }
.bars i.warn { background: var(--st-warn); }
.bars i.down { background: var(--st-alert); }
.bars i.none { background: var(--surface-inset); }

/* Dense multi-account table + compact uptime + chart-stats (built for many accounts at a glance) */
table.acct.dense th { padding: 8px 10px; }
table.acct.dense td { padding: 8px 10px; font-size: 12.5px; }
.acct.dense .acct-name { font-size: 12.5px; }
.acct.dense .acct-meta { font-size: 10.5px; }
.acct.dense .pill { padding: 2px 7px; font-size: 10.5px; }
.warn-tag { background: var(--st-warn-bg); color: var(--st-warn); }
.up-pct { font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 5px; }
.up-pct.ok { background: var(--st-healthy-bg); color: var(--st-healthy); }
.up-pct.warn { background: var(--st-warn-bg); color: var(--st-warn); }
.up-pct.bad { background: var(--st-alert-bg); color: var(--st-alert); }
.chart-stats { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.chart-stats > div { display: flex; flex-direction: column; }
.cs-k { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.cs-v { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 1px; }

/* Drill-down hero strip — headline figures a trader checks first, before chart + depth. */
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-bottom: 18px;
    background: var(--border); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.hero-stats > div { display: flex; flex-direction: column; gap: 3px; padding: 11px 14px; background: var(--surface); }
.hs-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.hs-v { font-size: 18px; font-weight: 680; letter-spacing: -.01em; line-height: 1; }
@media (max-width: 720px) { .hero-stats { grid-template-columns: repeat(2, 1fr); } .hs-v { font-size: 16px; } }

/* Instant-feedback veil while the drill-down detail renders server-side (kills the dead pause). */
.load-veil { display: none; position: fixed; inset: 0; z-index: 120; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(1px); }
.load-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border);
    border-top-color: var(--brand); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .load-spinner { animation-duration: 1.6s; } }

/* Combined-balance hero chart (Chart.js) — toolbar, segmented tabs, overlay toggle, canvas box. */
.chart-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding: 16px 18px 2px; }
.chart-toolbar h3 { font-size: 15px; font-weight: 650; }
.chart-ctrls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg-tabs { display: inline-flex; gap: 3px; background: var(--surface-inset); padding: 3px; border-radius: 9px; }
.ctab, .rtab { padding: 5px 11px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; user-select: none; white-space: nowrap; transition: background .14s, color .14s; }
.ctab:hover, .rtab:hover { color: var(--ink); }
.ctab.active, .rtab.active { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.ov-toggle { padding: 6px 11px; border: 1px dashed var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; transition: .14s; }
.ov-toggle:hover { color: var(--ink); border-color: var(--faint); }
.ov-toggle.is-on { border-style: solid; border-color: var(--neg); color: var(--neg); background: var(--st-alert-bg); }
.chart-wrap { position: relative; width: 100%; height: 320px; }
@media (max-width: 900px) { .chart-wrap { height: 260px; } .chart-toolbar { padding: 14px 14px 2px; } }

/* ---- Buttons & forms ---------------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--r-sm); font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: background .12s, border-color .12s; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 11px; font-size: 13px; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input, input[type=text], input[type=email], input[type=password] {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
    font-size: 14.5px; font-family: inherit; color: var(--ink); background: var(--surface);
}
.input:focus, input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.select { padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); font-size: 13.5px; font-family: inherit; color: var(--ink); background: var(--surface); cursor: pointer; }
.select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }

/* Drill-down chart tabs (Balance / Gain / Drawdown) */
.chart-tabs { display: inline-flex; gap: 2px; background: var(--surface-inset); border-radius: var(--r-sm); padding: 2px; }
.chart-tab { border: none; background: none; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600;
    color: var(--muted); padding: 4px 11px; border-radius: 5px; transition: background .12s, color .12s; }
.chart-tab:hover { color: var(--ink); }
.chart-tab.is-on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }

/* Responsive content grids (classes so media queries can override — inline styles can't be) */
.cols-hero { display: grid; grid-template-columns: 1.9fr 1fr; gap: 14px; }
.cols-detail { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; }
.cols-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat-grid-2 { display: grid; grid-template-columns: 1fr 1fr; }
.stat-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); }
.err { color: var(--st-alert); font-size: 12.5px; margin-top: 5px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 5px; }

code, .mono { font-family: var(--nums); font-size: 12.5px; background: var(--surface-inset); padding: 2px 6px; border-radius: 5px; color: var(--ink-2); }

/* ---- Auth pages --------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
    radial-gradient(1200px 500px at 50% -10%, var(--brand-tint) 0%, transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 32px; }
.auth-brand { display: flex; align-items: center; gap: 11px; justify-content: center; margin-bottom: 22px; }
.auth-card h1 { font-family: var(--serif); font-size: 25px; font-weight: 700; letter-spacing: -.01em; text-align: center; margin-bottom: 4px; }
.auth-card .lede { text-align: center; color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }
.auth-alt { text-align: center; font-size: 13.5px; color: var(--muted); margin-top: 20px; }

/* ---- Print (monthly report → PDF) --------------------------------------- */
@media print {
    .side, .no-print { display: none !important; }
    .shell { display: block !important; }
    .main { display: block !important; }
    .content { padding: 0 !important; max-width: none !important; }
    body { background: #fff !important; }
    .print-head { display: flex !important; justify-content: space-between; align-items: center;
        margin-bottom: 18px; padding-bottom: 12px; border-bottom: 2px solid var(--brand); }
    .card, .metric, table.acct { box-shadow: none !important; }
    .metrics { grid-template-columns: repeat(7, 1fr) !important; }
    tr { break-inside: avoid; }
}

.notice { padding: 11px 14px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 16px; }
.notice.ok { background: var(--st-healthy-bg); color: var(--st-healthy); }
.notice.bad { background: var(--st-alert-bg); color: var(--st-alert); }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; stroke-width: 1.5; color: var(--faint); margin-bottom: 12px; }
.empty h3 { color: var(--ink); font-size: 16px; margin-bottom: 6px; }

/* Tablet + mobile: sidebar becomes a horizontal top bar, multi-column grids stack. */
@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
        gap: 4px; border-right: none; border-bottom: 1px solid var(--border); padding: 12px 16px; }
    .side .brand { width: 100%; margin-bottom: 8px; }
    .side-foot { margin: 0; border: none; padding: 0; }
    .side-foot .userchip { display: none; }   /* who-am-I is implicit on mobile; keep sign-out */
    .nav-label { display: none; }
    .nav-item { padding: 8px 12px; }
    .content, .topbar { padding-left: 18px; padding-right: 18px; }
    .cols-hero, .cols-detail, .cols-split { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .metrics { grid-template-columns: 1fr 1fr; }
    .stat-grid-3 { grid-template-columns: 1fr 1fr; }
    .topbar { flex-wrap: wrap; gap: 10px; }
    .content { padding: 20px 14px; }
    /* Compact account list: keep Status + Strategy + Balance + Total + Uptime/tap; rest one tap away.
       (13-col: 1 Status 2 Strategy 3 Type 4 Balance 5 Floating 6 Today 7 Month 8 Total 9 Trades 10 PF 11 DD 12 Algo 13 Uptime) */
    table.acct th:nth-child(3), table.acct td:nth-child(3),
    table.acct th:nth-child(5), table.acct td:nth-child(5),
    table.acct th:nth-child(6), table.acct td:nth-child(6),
    table.acct th:nth-child(7), table.acct td:nth-child(7),
    table.acct th:nth-child(9), table.acct td:nth-child(9),
    table.acct th:nth-child(10), table.acct td:nth-child(10),
    table.acct th:nth-child(11), table.acct td:nth-child(11),
    table.acct th:nth-child(12), table.acct td:nth-child(12) { display: none; }
    table.acct th, table.acct td { padding: 9px 8px; }
}

/* ---- Motion — INTERACTION FEEDBACK ONLY (dashboard directive P5) ----------
   Removed the decorative load-time animations (count-ups, cards fading in, chart-draw-on-load,
   donut pop) — traders read those as toy-like. The real liveness layer (value-change flash on
   actual ticks, a "live" pulse when data is genuinely flowing, breathing uptime edge, status
   transitions) is added when real accounts post — never faked on seed data. What stays here is
   only feedback to the user's own actions. */
.row-open td { background: var(--brand-tint); }
.metric { transition: transform .16s ease, box-shadow .16s ease; }
.metric:hover { transform: translateY(-2px); box-shadow: var(--shadow-md, 0 8px 24px rgba(20, 30, 50, .08)); }
.card { transition: box-shadow .16s ease; }
tr[wire\:click] { transition: background .12s ease; }
.tnum, .count-up { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
