/* Soft Layered design system — full token + component set
   Scoped under `.sx` so old style.css keeps working on un-migrated screens.
   When a screen is migrated, its container gets `class="sx"` and inherits
   the entire token + component set below. */

:root {
    --sx-bg-from: #f5f1ea;
    --sx-bg-to:   #ebe6dc;
    --sx-surface: #fdfbf6;
    --sx-text:    #2a2825;
    --sx-muted:   #6a6760;
    --sx-muted-2: #8a8780;
    --sx-faint:   #c9c5bb;
    --sx-soft-1:  rgba(0,0,0,0.02);
    --sx-soft-2:  rgba(0,0,0,0.03);
    --sx-soft-3:  rgba(0,0,0,0.04);
    --sx-soft-4:  rgba(0,0,0,0.05);
    --sx-soft-6:  rgba(0,0,0,0.06);
    --sx-row-hover: #f5f1ea;
    --sx-accent:  #b85c2a;
    --sx-pos:     #3a7a4a;
    --sx-neg:     #b54a3e;
    --sx-card-radius: 14px;
    --sx-card-shadow: 0 1px 0 rgba(0,0,0,0.02), 0 6px 18px -8px rgba(80,70,50,0.12);
    --sx-card-border: 1px solid rgba(0,0,0,0.04);
    --sx-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
    --sx-mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, monospace;
}

/* Container — the entry point. Apply to the wrapper of any migrated screen. */
.sx {
    font-family: var(--sx-sans);
    color: var(--sx-text);
    background: linear-gradient(180deg, var(--sx-bg-from) 0%, var(--sx-bg-to) 100%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.sx *, .sx *::before, .sx *::after { box-sizing: border-box; }
.sx h1, .sx h2, .sx h3 { margin: 0; font-weight: 500; letter-spacing: -0.02em; }

/* Type utilities */
.sx .num     { font-variant-numeric: tabular-nums; }
.sx .mono    { font-family: var(--sx-mono); font-variant-numeric: tabular-nums; }
.sx .pos     { color: var(--sx-pos); }
.sx .neg     { color: var(--sx-neg); }
.sx .acc     { color: var(--sx-accent); }
.sx .muted   { color: var(--sx-muted); }
.sx .muted-2 { color: var(--sx-muted-2); }
.sx .micro {
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sx-muted-2);
    font-weight: 500;
}

/* Card surface — the only "container" affordance. Hierarchy comes from layering, not borders. */
.sx .card {
    background: var(--sx-surface);
    border-radius: var(--sx-card-radius);
    box-shadow: var(--sx-card-shadow);
    border: var(--sx-card-border);
}

/* Row hover — used in any list/table */
.sx .row {
    transition: background 140ms;
    cursor: pointer;
}
.sx .row:hover { background: var(--sx-row-hover); }

/* Pills (tag-style) */
.sx .pill {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 11.5px;
    background: var(--sx-soft-3);
    color: #5a5750;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.sx .pill.on { background: var(--sx-text); color: var(--sx-surface); }

/* Buttons */
.sx .btn-prim {
    background: var(--sx-accent);
    color: var(--sx-surface);
    height: 36px;
    padding: 0 16px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 6px -2px rgba(184,92,42,0.5);
    font-family: inherit;
    transition: filter 120ms;
}
.sx .btn-prim:hover { filter: brightness(0.95); }
.sx .btn-ghost {
    background: var(--sx-soft-2);
    color: var(--sx-text);
    height: 36px;
    padding: 0 14px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: background 120ms;
}
.sx .btn-ghost:hover { background: rgba(0,0,0,0.07); }
.sx .btn-dark {
    background: var(--sx-text);
    color: var(--sx-surface);
    height: 36px;
    padding: 0 16px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}
/* btn-sm is also used by legacy .btn buttons elsewhere (where it means "small chip"),
   so scope this size override only to soft-system buttons. */
.sx .btn-prim.btn-sm,
.sx .btn-ghost.btn-sm,
.sx .btn-dark.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }

/* Top nav links */
.sx .nav {
    font-size: 13px;
    color: var(--sx-muted);
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 8px;
    background: none;
    border: none;
    font-family: inherit;
    text-decoration: none;
}
.sx .nav.on { background: var(--sx-soft-4); color: var(--sx-text); font-weight: 500; }
.sx .nav .nav-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 16px;
    padding: 0 5px;
    margin-left: 6px;
    background: var(--sx-accent);
    color: var(--sx-surface);
    font-family: var(--sx-mono);
    font-variant-numeric: tabular-nums;
    font-size: 9.5px;
    font-weight: 600;
    border-radius: 999px;
    vertical-align: middle;
}

/* Sub-tabs (within a card) */
.sx .tab {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--sx-muted);
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
}
.sx .tab.on, .sx .tab.active { background: var(--sx-text); color: var(--sx-surface); }

/* Inputs */
.sx .input {
    background: var(--sx-soft-2);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    color: var(--sx-text);
}
.sx .input:focus {
    background: var(--sx-surface);
    border-color: rgba(0,0,0,0.08);
}
.sx .input::placeholder { color: var(--sx-muted-2); }

/* Ticker chip — dark mono badge */
.sx .chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 28px;
    padding: 0 10px;
    background: var(--sx-text);
    color: var(--sx-surface);
    border-radius: 8px;
    font-family: var(--sx-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* TP-style mini-badge (subtle, in flex row with name) */
.sx .tp-badge {
    font-size: 9px;
    padding: 1px 5px;
    background: var(--sx-soft-6);
    border-radius: 4px;
    color: var(--sx-muted);
    letter-spacing: 0.05em;
    font-weight: 500;
}
.sx .tp-badge.on { background: rgba(184,92,42,0.18); color: var(--sx-accent); }

/* Avatar circle (top-right) */
.sx .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sx-accent);
    color: var(--sx-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 13px;
}

/* Section header (inside cards) — kicker + title pattern */
.sx .section-header {
    margin-bottom: 18px;
}
.sx .section-header .kicker {
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sx-accent);
    font-weight: 500;
    margin-bottom: 6px;
}
.sx .section-header .title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}
.sx .section-header h2 {
    font-size: 20px;
    font-weight: 500;
    letter-spacing: -0.015em;
    margin: 0;
}
.sx .section-header .hint {
    font-size: 12px;
    color: var(--sx-muted-2);
}

/* StatRow (label · value with optional sub) */
.sx .stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px solid var(--sx-soft-3);
}
.sx .stat-row:last-child { border-bottom: none; }
.sx .stat-row .label { font-size: 13px; color: #5a5750; }
.sx .stat-row .value { font-weight: 600; font-size: 14px; }
.sx .stat-row .sub { font-family: var(--sx-mono); font-size: 11px; color: var(--sx-muted-2); }

/* TopBar layout */
.sx .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid var(--sx-soft-4);
    gap: 24px;
}
.sx .topbar-left  { display: flex; align-items: center; gap: 8px; }
.sx .topbar-right { display: flex; align-items: center; gap: 10px; }
.sx .brand {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-right: 24px;
    text-decoration: none;
    color: var(--sx-text);
}

/* Table (CSS-grid based, not <table>) — standard 16px column gap */
.sx .grid-table { display: flex; flex-direction: column; }
.sx .grid-row {
    display: grid;
    column-gap: 16px;
    align-items: center;
    padding: 14px 20px;
}
.sx .grid-row.head {
    background: var(--sx-soft-1);
    border-bottom: 1px solid var(--sx-soft-4);
}
.sx .grid-row.body {
    border-bottom: 1px solid var(--sx-soft-3);
}
.sx .grid-row.body:last-child { border-bottom: none; }
.sx .grid-row .right { text-align: right; }
.sx .grid-row .center { text-align: center; }
.sx .grid-row .name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right: 16px;
    min-width: 0;
}
.sx .grid-row .name-cell .name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hero KPI strip */
.sx .kpi-strip {
    display: grid;
    column-gap: 28px;
    padding-top: 28px;
    border-top: 1px solid var(--sx-soft-6);
}
.sx .kpi-label { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sx-muted-2); font-weight: 500; margin-bottom: 10px; }
.sx .kpi-value-lg { font-size: 44px; font-weight: 500; letter-spacing: -0.025em; line-height: 1; font-variant-numeric: tabular-nums; }
.sx .kpi-value-lg .cents { color: #a8a59a; font-size: 28px; }
.sx .kpi-value    { font-size: 22px; font-weight: 500; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.sx .kpi-sub      { font-size: 12px; color: var(--sx-muted-2); margin-top: 6px; font-variant-numeric: tabular-nums; }
.sx .kpi-pill-pos {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    padding: 3px 8px;
    background: rgba(58,122,74,0.10);
    color: var(--sx-pos);
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
}
.sx .kpi-pill-neg {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    padding: 3px 8px;
    background: rgba(181,74,62,0.10);
    color: var(--sx-neg);
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
}

/* Breadcrumb pattern (e.g. "← Portfolios · EUR · Brokerage") */
.sx .crumbs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.sx .crumbs .sep { color: var(--sx-faint); }

/* Focus states (accessibility) */
.sx button:focus-visible,
.sx a:focus-visible,
.sx .input:focus-visible,
.sx .nav:focus-visible,
.sx .tab:focus-visible,
.sx .pill:focus-visible {
    outline: 2px solid var(--sx-accent);
    outline-offset: 2px;
}

/* Portfolios list page */
.sx .portfolio-list-page {
    padding: 32px;
    max-width: 1100px;
    margin: 0 auto;
}
.sx .portfolio-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.sx .portfolio-list-header h1 {
    font-size: 30px;
    font-weight: 500;
    letter-spacing: -0.02em;
    margin: 0;
}
.sx .pcards-section { margin-bottom: 32px; }
.sx .pcards-section:last-child { margin-bottom: 0; }
.sx .pcards-section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--sx-soft-4);
}
.sx .pcards-section-head .micro { font-size: 11px; }
.sx .pcards-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 18px;
    padding: 0 7px;
    background: var(--sx-soft-3);
    color: var(--sx-muted);
    font-size: 10.5px;
    font-weight: 600;
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}
.sx .portfolio-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
@media (max-width: 960px) { .sx .portfolio-cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .sx .portfolio-cards-grid { grid-template-columns: 1fr; } }

.sx .pcard {
    background: var(--sx-surface);
    border-radius: var(--sx-card-radius);
    box-shadow: var(--sx-card-shadow);
    border: var(--sx-card-border);
    padding: 22px;
    cursor: pointer;
    transition: background 140ms, transform 140ms;
}
.sx .pcard:hover { background: var(--sx-row-hover); transform: translateY(-1px); }
.sx .pcard-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
    gap: 8px;
}
.sx .pcard-name {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sx .pcard-ccy {
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--sx-soft-3);
    color: var(--sx-muted);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.sx .pcard-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 12px;
}
.sx .pcard-stat .pcard-label { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sx-muted-2); font-weight: 500; }
.sx .pcard-stat .pcard-value {
    font-size: 15px;
    font-weight: 500;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
    color: var(--sx-text);
}
.sx .pcard-stat .pcard-value.muted { color: var(--sx-muted); font-size: 14px; }
.sx .pcard-stat .pcard-value.ret-pos { color: var(--sx-pos); font-weight: 600; font-size: 14px; }
.sx .pcard-stat .pcard-value.ret-neg { color: var(--sx-neg); font-weight: 600; font-size: 14px; }
.sx .pcard-stat .pcard-value.ret-na  { color: var(--sx-muted-2); font-weight: 600; font-size: 14px; }

.sx .portfolio-empty {
    grid-column: 1 / -1;
    padding: 48px 24px;
    text-align: center;
    color: var(--sx-muted-2);
    background: var(--sx-surface);
    border-radius: var(--sx-card-radius);
    box-shadow: var(--sx-card-shadow);
    border: var(--sx-card-border);
}

/* Watchlists sub-tab strip (sits between TopBar and a watchlist content card) */
.sx .wl-subtabs {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 32px 4px;
    flex-wrap: wrap;
}
.sx .wl-subtabs .tab.add {
    color: var(--sx-accent);
    font-size: 18px;
    font-weight: 500;
    padding: 6px 12px;
}

/* Watchlist filter card (search + add ticker + filter pills) */
.sx .wl-page { padding: 8px 0; }
.sx .wl-filter-card {
    background: var(--sx-surface);
    border-radius: var(--sx-card-radius);
    box-shadow: var(--sx-card-shadow);
    border: var(--sx-card-border);
    padding: 20px;
    margin-bottom: 16px;
}
.sx .wl-filter-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: center;
    flex-wrap: wrap;
}
.sx .wl-filter-row .input { font-size: 13px; }
.sx .wl-filter-row .input.search { flex: 1; min-width: 180px; max-width: 320px; }
.sx .wl-filter-row .input.add { width: 220px; min-width: 160px; }
.sx .wl-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.sx .wl-pill-divider {
    width: 1px;
    height: 20px;
    background: rgba(0,0,0,0.08);
    margin: 0 4px;
}
/* Region pill colors (mockup palette) */
.sx .pill.region-us     { background: rgba(58,74,138,0.12);  color: #3a4a8a; border: 1px solid rgba(58,74,138,0.28); }
.sx .pill.region-eu     { background: rgba(122,58,170,0.12); color: #7a3aaa; border: 1px solid rgba(122,58,170,0.28); }
.sx .pill.region-jp     { background: rgba(170,58,138,0.12); color: #aa3a8a; border: 1px solid rgba(170,58,138,0.28); }
.sx .pill.flag-mag7     { background: rgba(201,122,26,0.12); color: #c97a1a; border: 1px solid rgba(201,122,26,0.28); }
.sx .pill.flag-risk     { background: rgba(181,74,62,0.12);  color: var(--sx-neg); border: 1px solid rgba(181,74,62,0.28); }
.sx .pill.flag-value    { background: rgba(58,122,74,0.12);  color: var(--sx-pos); border: 1px solid rgba(58,122,74,0.28); }
.sx .pill.flag-drop     { background: rgba(181,74,62,0.12);  color: var(--sx-neg); border: 1px solid rgba(181,74,62,0.28); }

/* Watchlist data card (grid table) — horizontally scrollable when columns
   exceed container width; columns are user-resizable via drag handles. */
.sx .wl-card {
    overflow-x: auto;
    overflow-y: hidden;
}
.sx .wl-grid {
    display: grid;
    column-gap: 16px;
    align-items: center;
    padding: 14px 20px;
    /* min-width: max-content keeps the grid from collapsing and forces
       horizontal scroll when card width < total grid width */
    min-width: max-content;
}
.sx .wl-grid.head {
    background: var(--sx-soft-1);
    border-bottom: 1px solid var(--sx-soft-4);
    position: sticky;
    top: 0;
    z-index: 1;
}
.sx .wl-grid.row {
    border-bottom: 1px solid var(--sx-soft-3);
    transition: background 140ms;
    cursor: pointer;
}
.sx .wl-grid.row:last-child { border-bottom: none; }
.sx .wl-grid.row:hover { background: var(--sx-row-hover); }
.sx .wl-grid.row.target-hit { background: rgba(255,228,160,0.18); }
.sx .wl-grid.row.target-hit:hover { background: rgba(255,228,160,0.30); }
.sx .wl-grid.row.alert { background: rgba(255,228,160,0.18); }

/* Stocks grid: Company · Ticker · Mkt Cap · Exchange · Price · Daily · P/E · DivY · 52W · Weekly · Monthly · From 52W · Actions
   First column is fixed-px (220px default) so it doesn't collapse, and so
   resize handles work uniformly. */
.sx .wl-grid.stocks {
    grid-template-columns: 220px 80px 90px 80px 100px 90px 70px 90px 90px 90px 90px 100px 100px;
}
/* SX5E grid: Company · Ticker · Mkt Cap · Price · Daily · P/E · DivY · 52W · Weekly · Monthly · From 52W · Add */
.sx .wl-grid.sx5e {
    grid-template-columns: 220px 80px 90px 100px 90px 70px 90px 90px 90px 90px 100px 70px;
}
/* ETFs grid: Name · Ticker · Exchange · Price · 52W · Weekly · Monthly · From 52W · Daily · Actions */
.sx .wl-grid.etfs {
    grid-template-columns: 220px 80px 80px 100px 90px 90px 90px 100px 90px 100px;
}

.sx .wl-grid .name {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right: 16px;
    min-width: 0;
    overflow: hidden;
}
.sx .wl-grid .name-text {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--sx-text);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    flex: 1 1 auto;
    min-width: 0;
}
.sx .wl-grid .name-text:hover { color: var(--sx-accent); }
.sx .wl-grid .right { text-align: right; }

/* Numeric / mono cells — single size for consistency */
.sx .wl-grid .col-ticker { font-family: var(--sx-mono); font-weight: 600; font-size: 13px; }
.sx .wl-grid .col-exch   { font-family: var(--sx-mono); color: var(--sx-muted-2); font-size: 12px; }
.sx .wl-grid .col-mid {
    font-family: var(--sx-mono); font-variant-numeric: tabular-nums;
    color: var(--sx-muted); font-size: 13px;
}
.sx .wl-grid .col-price {
    font-family: var(--sx-mono); font-variant-numeric: tabular-nums;
    font-weight: 500; font-size: 13px;
}
.sx .wl-grid .mono.num   { font-size: 13px; }   /* unify percent cells, etc. */
.sx .wl-grid .right .mono.num { font-size: 13px; }

/* Header text — uppercase 10.5px label */
.sx .wl-grid.head .micro { font-size: 10.5px; }
.sx .wl-grid.head .hdr   { cursor: pointer; user-select: none; position: relative; }
.sx .wl-grid.head .hdr:hover { color: var(--sx-text); }

/* Column resize handle — always shows a faint divider so users can see
   where to grab; turns clay on hover and during drag. */
.sx .wl-grid.head .hdr .col-resize {
    position: absolute;
    top: -14px;
    right: -12px;
    bottom: -14px;
    width: 14px;
    cursor: col-resize;
    z-index: 2;
    /* Always-visible faint divider line in the middle of the hit area */
    background: linear-gradient(
        to right,
        transparent 0,
        transparent 6px,
        rgba(0,0,0,0.10) 6px,
        rgba(0,0,0,0.10) 7px,
        transparent 7px,
        transparent 14px
    );
    transition: background 120ms;
}
.sx .wl-grid.head .hdr .col-resize:hover,
.sx .wl-grid.head .hdr .col-resize.active {
    background: linear-gradient(
        to right,
        transparent 0,
        transparent 5px,
        var(--sx-accent) 5px,
        var(--sx-accent) 8px,
        transparent 8px,
        transparent 14px
    );
}
.sx .wl-card.resizing { cursor: col-resize; user-select: none; }
.sx .wl-card.resizing .wl-grid.head .hdr .col-resize { background: linear-gradient(
    to right,
    transparent 0,
    transparent 5px,
    rgba(184,92,42,0.4) 5px,
    rgba(184,92,42,0.4) 8px,
    transparent 8px,
    transparent 14px
); }
.sx .wl-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    align-items: center;
}
.sx .wl-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: var(--sx-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: background 120ms, color 120ms;
}
.sx .wl-icon-btn:hover { background: var(--sx-soft-3); color: var(--sx-text); }
.sx .wl-icon-btn.danger:hover { background: rgba(181,74,62,0.10); color: var(--sx-neg); }
.sx .wl-loading {
    padding: 40px 24px;
    text-align: center;
    color: var(--sx-muted-2);
    font-size: 13px;
}

/* Allocation card head with view toggle */
.sx .alloc-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 8px;
}
.sx .alloc-toggle {
    display: inline-flex;
    background: var(--sx-soft-3);
    border-radius: 8px;
    padding: 2px;
    gap: 0;
}
.sx .alloc-toggle-btn {
    background: transparent;
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    color: var(--sx-muted);
    cursor: pointer;
    font-family: inherit;
    transition: background 120ms, color 120ms;
}
.sx .alloc-toggle-btn:hover { color: var(--sx-text); }
.sx .alloc-toggle-btn.on {
    background: var(--sx-surface);
    color: var(--sx-text);
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    font-weight: 500;
}

/* ---------------- Portfolio detail shell ---------------- */
/* Hero card (breadcrumb + title + actions + KPI strip) */
.sx .pf-hero { padding: 26px 28px 24px; }
.sx .pf-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}
.sx .pf-hero .crumbs { margin-bottom: 12px; }
.sx .pf-back {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--sx-muted-2);
    padding: 0;
    font-family: inherit;
}
.sx .pf-back:hover { color: var(--sx-text); }
.sx .pf-title {
    font-size: 32px;
    font-weight: 500;
    letter-spacing: -0.025em;
    line-height: 1.05;
    color: var(--sx-text);
    margin: 0;
    cursor: pointer;
}
.sx .pf-title:hover { color: var(--sx-accent); }
.sx .pf-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.sx .pf-actions .btn-ghost,
.sx .pf-actions .btn-prim { white-space: nowrap; }
.sx .btn-danger-ghost { color: var(--sx-neg); }
.sx .btn-danger-ghost:hover { background: rgba(181,74,62,0.10); color: var(--sx-neg); }

/* KPI strip — 4-up grid below the title */
.sx .pf-kpi-strip {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    column-gap: 28px;
    padding-top: 24px;
    margin-top: 24px;
    border-top: 1px solid var(--sx-soft-6);
}
.sx .kpi-cell { min-width: 0; padding-right: 18px; border-right: 1px solid var(--sx-soft-6); }
.sx .kpi-cell:last-child { border-right: none; padding-right: 0; }
.sx .kpi-cell .kpi-label {
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sx-muted-2);
    font-weight: 500;
    margin-bottom: 10px;
    position: relative;
}
.sx .kpi-cell .kpi-value-lg {
    font-size: 38px;
    font-weight: 500;
    letter-spacing: -0.025em;
    line-height: 1;
    color: var(--sx-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.sx .kpi-cell .kpi-value {
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--sx-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.sx .kpi-cell .kpi-value.positive { color: var(--sx-pos); }
.sx .kpi-cell .kpi-value.negative { color: var(--sx-neg); }
.sx .kpi-cell .kpi-sub {
    font-size: 12px;
    color: var(--sx-muted-2);
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
}
.sx .kpi-cell .kpi-return-pill {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 6px;
    margin-top: 10px;
    background: var(--sx-soft-3);
    color: var(--sx-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.sx .kpi-cell .kpi-return-pill.positive { background: rgba(58,122,74,0.10); color: var(--sx-pos); }
.sx .kpi-cell .kpi-return-pill.negative { background: rgba(181,74,62,0.10); color: var(--sx-neg); }

/* Tab strip inside the content card */
.sx .pf-content-card { overflow: hidden; }
.sx .pf-tab-strip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--sx-soft-4);
    flex-wrap: wrap;
}

/* Dividends tab — reference table pattern reused by Transactions / Closed */
.sx .dividends-page { padding: 16px 20px 20px; }
.sx .dividends-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.sx .div-grid {
    display: grid;
    grid-template-columns: 120px 100px 1fr 140px 60px;
    column-gap: 18px;
    align-items: center;
    padding: 10px 16px;
}
.sx .div-grid.head {
    background: var(--sx-soft-1);
    border-radius: 8px;
    margin-bottom: 4px;
}
.sx .div-grid.row {
    padding: 12px 16px;
    border-bottom: 1px solid var(--sx-soft-3);
    border-radius: 8px;
    transition: background 140ms;
}
.sx .div-grid.row:last-child { border-bottom: none; }
.sx .div-grid.row:hover { background: var(--sx-row-hover); }
.sx .div-grid .right { text-align: right; }
.sx .div-grid .div-date {
    font-family: var(--sx-mono);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    color: var(--sx-muted);
}
.sx .div-grid .div-name {
    font-size: 13px;
    color: var(--sx-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sx .div-grid .div-amount {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    font-size: 14px;
    color: var(--sx-text);
}
.sx .div-grid .div-del {
    background: none;
    border: none;
    color: var(--sx-neg);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 120ms;
}
.sx .div-grid .div-del:hover { background: rgba(181,74,62,0.10); }
.sx .div-empty {
    padding: 40px 24px;
    text-align: center;
    color: var(--sx-muted-2);
    font-size: 13px;
}

/* Transactions tab */
.sx .tx-page { padding: 16px 20px 20px; overflow-x: auto; }
.sx .tx-actions { margin-bottom: 12px; }
.sx .tx-grid {
    display: grid;
    grid-template-columns: 110px 70px 100px minmax(180px, 1fr) 60px 90px 90px 70px 110px 90px;
    column-gap: 16px;
    align-items: center;
    padding: 10px 16px;
    min-width: max-content;
}
.sx .tx-grid.head {
    background: var(--sx-soft-1);
    border-radius: 8px;
    margin-bottom: 4px;
}
.sx .tx-grid.row {
    padding: 12px 16px;
    border-bottom: 1px solid var(--sx-soft-3);
    border-radius: 8px;
    transition: background 140ms;
}
.sx .tx-grid.row:last-child { border-bottom: none; }
.sx .tx-grid.row:hover { background: var(--sx-row-hover); }
.sx .tx-grid .right { text-align: right; }
.sx .tx-grid .tx-date {
    font-family: var(--sx-mono);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    color: var(--sx-muted);
}
.sx .tx-grid .tx-name {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sx .tx-grid .tx-ccy { font-family: var(--sx-mono); font-size: 11px; color: var(--sx-muted-2); }
.sx .tx-grid .tx-num {
    font-family: var(--sx-mono);
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    color: var(--sx-text);
}
.sx .tx-grid .tx-num.muted { color: var(--sx-muted); }
.sx .tx-type-pill {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 10px;
    border-radius: 999px;
    font-family: var(--sx-mono);
    font-size: 10px;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.sx .tx-type-pill.buy  { background: rgba(58,122,74,0.12);  color: var(--sx-pos); }
.sx .tx-type-pill.sell { background: rgba(181,74,62,0.12);  color: var(--sx-neg); }
.sx .tx-actions-cell { display: flex; gap: 4px; justify-content: flex-end; }
.sx .tx-icon-btn {
    background: transparent;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    color: var(--sx-muted);
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    transition: background 120ms, color 120ms;
}
.sx .tx-icon-btn:hover { background: var(--sx-soft-3); color: var(--sx-text); }
.sx .tx-icon-btn.danger:hover { background: rgba(181,74,62,0.10); color: var(--sx-neg); }
.sx .tx-empty {
    padding: 40px 24px;
    text-align: center;
    color: var(--sx-muted-2);
    font-size: 13px;
}

/* Closed Positions tab — variable columns via inline grid-template-columns */
.sx .closed-page { padding: 16px 20px 20px; overflow-x: auto; }
.sx .closed-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.sx .closed-grid {
    display: grid;
    column-gap: 16px;
    align-items: center;
    padding: 10px 16px;
    min-width: max-content;
}
.sx .closed-grid.head {
    background: var(--sx-soft-1);
    border-radius: 8px;
    margin-bottom: 4px;
}
.sx .closed-grid.row {
    padding: 12px 16px;
    border-bottom: 1px solid var(--sx-soft-3);
    border-radius: 8px;
    transition: background 140ms;
}
.sx .closed-grid.row:last-child { border-bottom: none; }
.sx .closed-grid.row:hover { background: var(--sx-row-hover); }
.sx .closed-grid .right { text-align: right; }
.sx .closed-grid .col-num {
    font-family: var(--sx-mono);
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    color: var(--sx-text);
}
.sx .closed-grid .col-num.muted { color: var(--sx-muted); }
.sx .closed-grid .col-name {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    min-width: 0;
}
.sx .closed-grid .col-name .name-text {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--sx-text);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}
.sx .closed-grid .col-name .name-text:hover { color: var(--sx-accent); }
.sx .closed-grid .col-date {
    font-family: var(--sx-mono);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    color: var(--sx-muted);
}
.sx .closed-grid .head-cell { cursor: pointer; user-select: none; }
.sx .closed-grid .head-cell:hover { color: var(--sx-text); }

/* Targets tab */
.sx .targets-page { padding: 16px 20px 20px; overflow-x: auto; }
.sx .targets-actions { margin-bottom: 12px; }
.sx .tg-grid {
    display: grid;
    grid-template-columns: 90px minmax(180px, 1fr) 60px 90px 80px 100px 100px 100px 110px 100px 80px 110px 160px;
    column-gap: 16px;
    align-items: center;
    padding: 10px 16px;
    min-width: max-content;
}
.sx .tg-grid.head {
    background: var(--sx-soft-1);
    border-radius: 8px;
    margin-bottom: 4px;
}
.sx .tg-grid.row {
    padding: 12px 16px;
    border-bottom: 1px solid var(--sx-soft-3);
    border-radius: 8px;
    transition: background 140ms;
}
.sx .tg-grid.row:last-child { border-bottom: none; }
.sx .tg-grid.row:hover { background: var(--sx-row-hover); }
.sx .tg-grid.row.total {
    background: var(--sx-soft-1);
    font-weight: 600;
    border-top: 2px solid var(--sx-soft-4);
    margin-top: 4px;
}
.sx .tg-grid .right { text-align: right; }
.sx .tg-grid .tg-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx .tg-grid .tg-num { font-family: var(--sx-mono); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--sx-text); }
.sx .tg-grid .tg-num.muted { color: var(--sx-muted); }
.sx .tg-progress {
    position: relative;
    height: 18px;
    background: var(--sx-soft-3);
    border-radius: 4px;
    overflow: hidden;
}
.sx .tg-progress .tg-progress-fill {
    height: 100%;
    background: var(--sx-accent);
    opacity: 0.7;
}
.sx .tg-progress .tg-progress-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--sx-mono);
    font-variant-numeric: tabular-nums;
    font-size: 10.5px;
    color: var(--sx-text);
    font-weight: 500;
}

/* Options tab */
.sx .options-page { padding: 16px 20px 20px; overflow-x: auto; }
.sx .options-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.sx .options-summary {
    font-size: 13px;
    color: var(--sx-muted);
    font-variant-numeric: tabular-nums;
}
.sx .options-summary strong { color: var(--sx-text); font-weight: 600; }
.sx .opt-grid {
    display: grid;
    grid-template-columns: 70px 50px 90px minmax(140px, 1fr) 80px 80px 100px 60px 80px 60px 100px 100px 100px 50px 130px;
    column-gap: 14px;
    align-items: center;
    padding: 10px 14px;
    min-width: max-content;
}
.sx .opt-grid.head {
    background: var(--sx-soft-1);
    border-radius: 8px;
    margin-bottom: 4px;
}
.sx .opt-grid.row {
    padding: 12px 14px;
    border-bottom: 1px solid var(--sx-soft-3);
    border-radius: 8px;
    transition: background 140ms;
}
.sx .opt-grid.row:last-child { border-bottom: none; }
.sx .opt-grid.row:hover { background: var(--sx-row-hover); }
.sx .opt-grid .right { text-align: right; }
.sx .opt-grid .opt-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx .opt-grid .opt-num { font-family: var(--sx-mono); font-variant-numeric: tabular-nums; font-size: 13px; }
.sx .opt-grid .opt-ccy { font-family: var(--sx-mono); font-size: 11px; color: var(--sx-muted-2); }
.sx .opt-status,
.sx .opt-type {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    font-family: var(--sx-mono);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
}
.sx .opt-status.open     { background: rgba(33,150,243,0.12);  color: #2196f3; }
.sx .opt-status.expired  { background: rgba(58,122,74,0.12);   color: var(--sx-pos); }
.sx .opt-status.closed   { background: rgba(255,152,0,0.12);   color: #d77a00; }
.sx .opt-status.assigned { background: rgba(229,57,53,0.12);   color: var(--sx-neg); }
.sx .opt-type.sell_put,
.sx .opt-type.sell_call  { background: rgba(229,57,53,0.12);   color: var(--sx-neg); }
.sx .opt-type.buy_put,
.sx .opt-type.buy_call   { background: rgba(58,122,74,0.12);   color: var(--sx-pos); }
.sx .opt-itm { font-size: 9px; color: var(--sx-neg); margin-left: 4px; font-weight: 600; }
.sx .opt-otm { font-size: 9px; color: var(--sx-pos); margin-left: 4px; font-weight: 600; }
.sx .opt-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.sx .opt-actions .opt-btn {
    background: var(--sx-soft-2);
    border: none;
    color: var(--sx-text);
    font-size: 10px;
    padding: 4px 7px;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    transition: background 120ms;
}
.sx .opt-actions .opt-btn:hover { background: var(--sx-soft-3); }
.sx .opt-actions .opt-btn.danger { color: var(--sx-neg); }
.sx .opt-actions .opt-btn.danger:hover { background: rgba(181,74,62,0.10); }
.sx .opt-empty {
    padding: 40px 24px;
    text-align: center;
    color: var(--sx-muted-2);
    font-size: 13px;
}

/* Report tab — wrapper padding only; inner table keeps existing markup for now */
.sx .report-page { padding: 16px 20px 20px; }
.sx .report-page .controls {
    background: var(--sx-soft-1);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

/* ============== Home / front page ============== */
/* Scoped under .home-page so it can't leak. Soft Layered tokens, real data. */
.sx .home-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 32px 80px;
    font-family: var(--sx-sans);
    background: #faf8f3;
}
.sx .home-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 36px;
    gap: 20px;
    flex-wrap: wrap;
}
.sx .home-kicker {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sx-muted-2);
    margin-bottom: 6px;
}
.sx .home-title {
    font-family: "IBM Plex Serif", Georgia, serif;
    font-size: 36px;
    font-weight: 400;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--sx-text);
}
.sx .home-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--sx-mono);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    color: var(--sx-muted);
}
.sx .home-meta .market-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sx-pos);
}
.sx .home-meta.closed .market-dot { background: var(--sx-muted-2); }

.sx .home-section { margin-bottom: 32px; }
.sx .home-section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 14px;
    padding: 0 4px;
}
.sx .home-section-label {
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sx-muted-2);
    font-weight: 500;
}
.sx .home-section-action {
    font-size: 12px;
    color: var(--sx-text);
    background: rgba(0,0,0,0.04);
    border: none;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 999px;
    font-family: inherit;
    transition: background 0.15s;
}
.sx .home-section-action:hover { background: rgba(0,0,0,0.07); }

.sx .home-card {
    background: #fefdf9;
    border-radius: 14px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.02), 0 6px 18px -8px rgba(80,70,50,0.08);
    border: 1px solid var(--sx-soft-3);
}

/* Movers — paired side-by-side cards */
.sx .movers-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}
.sx .movers-pair .home-section { margin-bottom: 0; }
@media (max-width: 900px) {
    .sx .movers-pair { grid-template-columns: 1fr; gap: 16px; }
}
.sx .movers-card { padding: 8px 28px; }

.sx .mover-row {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) 78px 84px;
    column-gap: 14px;
    align-items: baseline;
    padding: 14px 0;
    border-bottom: 1px solid var(--sx-soft-3);
    cursor: pointer;
}
.sx .mover-row:last-child { border-bottom: none; }
.sx .mover-row:hover { background: rgba(0,0,0,0.015); }
.sx .mover-ticker {
    font-family: var(--sx-mono);
    font-weight: 700;
    font-size: 13px;
    color: var(--sx-text);
    letter-spacing: 0.02em;
}
.sx .mover-name {
    font-size: 13px;
    color: var(--sx-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sx .mover-price {
    font-family: var(--sx-mono);
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    color: var(--sx-muted);
    text-align: right;
}
.sx .mover-pct {
    font-family: var(--sx-mono);
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    font-weight: 700;
    text-align: right;
}
.sx .mover-pct.pos { color: var(--sx-pos); }
.sx .mover-pct.neg { color: var(--sx-neg); }

/* News */
.sx .home-news-list { padding: 4px 26px; }
.sx .home-news-row {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) 80px;
    gap: 18px;
    padding: 18px 0;
    align-items: center;
    border-bottom: 1px solid var(--sx-soft-3);
    text-decoration: none;
    color: inherit;
}
.sx .home-news-row:last-child { border-bottom: none; }
.sx .home-news-row:hover { background: rgba(0,0,0,0.015); }
.sx .home-news-badge {
    font-family: var(--sx-mono);
    font-weight: 700;
    font-size: 13px;
    color: var(--sx-accent);
    letter-spacing: 0.02em;
}
.sx .home-news-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
}
.sx .home-news-headline {
    font-size: 14px;
    color: var(--sx-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sx .home-news-source {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sx-muted-2);
}
.sx .home-news-time {
    font-family: var(--sx-mono);
    font-size: 12px;
    color: var(--sx-muted-2);
    text-align: right;
}

/* Indices — 6-col strip */
.sx .home-indices {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
}
.sx .home-index-cell {
    padding: 22px 16px;
    border-right: 1px solid var(--sx-soft-3);
}
.sx .home-index-cell:last-child { border-right: none; }
.sx .home-index-name {
    font-size: 11px;
    color: var(--sx-muted);
    margin-bottom: 12px;
    font-weight: 500;
}
.sx .home-index-pct {
    font-family: var(--sx-mono);
    font-variant-numeric: tabular-nums;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 10px;
}
.sx .home-index-pct.pos { color: var(--sx-pos); }
.sx .home-index-pct.neg { color: var(--sx-neg); }
.sx .home-index-sub {
    font-family: var(--sx-mono);
    font-variant-numeric: tabular-nums;
    font-size: 11px;
    color: var(--sx-muted-2);
}
@media (max-width: 900px) {
    .sx .home-indices { grid-template-columns: repeat(3, 1fr); }
    .sx .home-index-cell:nth-child(3n) { border-right: none; }
    .sx .home-index-cell:nth-child(n+4) { border-top: 1px solid var(--sx-soft-3); }
}

/* Earnings — grouped by day */
.sx .home-earnings { padding: 4px 26px 12px; }
.sx .earnings-day {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 18px 0 10px;
    border-bottom: 1px solid var(--sx-soft-3);
}
.sx .earnings-day-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--sx-text);
}
.sx .earnings-day-label.today { color: var(--sx-accent); }
.sx .earnings-day-count {
    font-size: 10.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sx-muted-2);
    font-weight: 500;
}
.sx .earnings-row {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) 110px 150px;
    gap: 16px;
    padding: 14px 0;
    align-items: baseline;
    border-bottom: 1px solid var(--sx-soft-3);
    cursor: pointer;
}
.sx .earnings-row:last-child { border-bottom: none; }
.sx .earnings-row:hover { background: rgba(0,0,0,0.015); }
.sx .earnings-ticker {
    font-family: var(--sx-mono);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.02em;
}
.sx .earnings-name {
    font-size: 13px;
    color: var(--sx-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sx .earnings-call {
    font-size: 10.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sx-muted-2);
    font-weight: 500;
    text-align: right;
}
.sx .earnings-eps {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 8px;
    font-family: var(--sx-mono);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    text-align: right;
}
.sx .earnings-est { color: var(--sx-muted-2); }
.sx .earnings-yoy {
    font-weight: 600;
    font-size: 11.5px;
}
.sx .earnings-yoy.pos { color: var(--sx-pos); }
.sx .earnings-yoy.neg { color: var(--sx-neg); }
.sx .home-empty {
    padding: 28px 28px;
    color: var(--sx-muted-2);
    font-size: 13px;
    text-align: center;
}

/* ---------------- Alerts page (legacy — currently unused; reachable if reintroduced) ---------------- */
/* All alerts styling is scoped under .alerts-page so it can't leak into other tabs. */
.sx .alerts-page { padding: 24px 32px; max-width: 1380px; margin: 0 auto; }

.sx .alerts-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}
.sx .alerts-page-header h1 {
    font-size: 28px;
    font-weight: 500;
    letter-spacing: -0.02em;
    margin: 0;
}
.sx .alerts-sub {
    font-size: 13px;
    color: var(--sx-muted);
    margin-top: 6px;
}
.sx .alerts-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.sx .alerts-pills {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.sx .alerts-pills .pill {
    background: none;
    border: 1px solid transparent;
}
.sx .alerts-pills .pill:not(.on):hover { background: var(--sx-soft-3); }
.sx .alerts-pills .pill .count {
    margin-left: 6px;
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
}
.sx .alerts-pills .pill.drops {
    background: rgba(181,74,62,0.10);
    color: var(--sx-neg);
}
.sx .alerts-pills .pill.drops.on {
    background: var(--sx-neg);
    color: var(--sx-surface);
}

/* Alert card — severity-tinted background + dot */
.sx .alert-card {
    padding: 0;
    overflow: hidden;
    background: var(--sx-surface);
    border-radius: var(--sx-card-radius);
    box-shadow: var(--sx-card-shadow);
    border: var(--sx-card-border);
    margin-bottom: 10px;
}
.sx .alert-card.high { background: rgba(181,74,62,0.06); }
.sx .alert-card.med  { background: rgba(201,122,26,0.05); }
.sx .alert-card-grid {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 18px;
    padding: 18px 22px;
    align-items: flex-start;
}
.sx .alert-sev-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
}
.sx .alert-card.high .alert-sev-dot { background: var(--sx-neg); }
.sx .alert-card.med  .alert-sev-dot { background: #c97a1a; }
.sx .alert-card.info .alert-sev-dot { background: #5a5750; }

.sx .alert-body { min-width: 0; }
.sx .alert-title-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.sx .alert-title { font-size: 14px; font-weight: 600; color: var(--sx-text); }
.sx .alert-card.high .alert-title { color: var(--sx-neg); }
.sx .alert-card.med  .alert-title { color: #c97a1a; }
.sx .alert-meta { font-size: 12px; color: var(--sx-muted-2); }

/* drop / etf cards — auto-fill grid of ticker rows */
.sx .alert-drop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}
.sx .alert-drop-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.03);
    border-radius: 8px;
}
.sx .alert-drop-row .name {
    font-size: 13px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Movers cards — two-column gainers/losers with proportional bars */
.sx .alert-movers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
@media (max-width: 720px) { .sx .alert-movers { grid-template-columns: 1fr; } }
.sx .alert-movers .mover-list { display: flex; flex-direction: column; gap: 4px; }
.sx .alert-movers .mover-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
}
.sx .alert-movers .mover-row .chip { min-width: 60px; }
.sx .alert-movers .mover-row .chip.pos { background: var(--sx-pos); }
.sx .alert-movers .mover-row .chip.neg { background: var(--sx-neg); }
.sx .alert-movers .mover-bar {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
}
.sx .alert-movers .mover-bar.pos { background: rgba(58,122,74,0.12); }
.sx .alert-movers .mover-bar.neg { background: rgba(181,74,62,0.12); }
.sx .alert-movers .mover-bar-fill { height: 100%; }
.sx .alert-movers .mover-bar.pos .mover-bar-fill { background: var(--sx-pos); }
.sx .alert-movers .mover-bar.neg .mover-bar-fill { background: var(--sx-neg); }
.sx .alert-movers .mover-pct {
    font-family: var(--sx-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 13px;
    min-width: 60px;
    text-align: right;
}

/* News card — headline rows */
.sx .alert-news-list { display: flex; flex-direction: column; gap: 6px; }
.sx .news-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 140ms;
}
.sx .news-row:hover { background: var(--sx-row-hover); }
.sx .news-row .headline {
    font-size: 13px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sx .news-row .arrow { font-size: 11px; color: var(--sx-muted-2); }
.sx .news-more {
    align-self: flex-start;
    margin-top: 4px;
    height: 28px;
    font-size: 12px;
}

/* Right rail — time + dismiss */
.sx .alert-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}
.sx .alert-time { font-size: 11px; color: var(--sx-muted-2); }
.sx .alert-dismiss { height: 28px; font-size: 12px; padding: 0 10px; }

.sx .alerts-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--sx-muted-2);
    font-size: 14px;
    background: var(--sx-surface);
    border-radius: var(--sx-card-radius);
    box-shadow: var(--sx-card-shadow);
    border: var(--sx-card-border);
}
.sx .alerts-footer-hint {
    margin-top: 20px;
    padding: 14px 18px;
    font-size: 12px;
    color: var(--sx-muted);
    text-align: center;
}
.sx .link-acc {
    background: none;
    border: none;
    color: var(--sx-accent);
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
    text-decoration: none;
}
.sx .link-acc:hover { text-decoration: underline; }

/* ---- Configure drawer (right slide-in) ---- */
.sx .drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.30);
    z-index: 998;
    animation: drawerOverlayIn 200ms ease;
}
@keyframes drawerOverlayIn { from { opacity: 0; } to { opacity: 1; } }
.sx .drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    max-width: 100vw;
    background: var(--sx-surface);
    box-shadow: -8px 0 24px -8px rgba(0,0,0,0.18);
    z-index: 999;
    display: flex;
    flex-direction: column;
    animation: drawerSlideIn 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes drawerSlideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.sx .drawer-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 22px 24px 16px;
    border-bottom: 1px solid var(--sx-soft-4);
    gap: 12px;
}
.sx .drawer-head h2 {
    font-size: 20px;
    font-weight: 500;
    letter-spacing: -0.015em;
    margin: 4px 0 0;
}
.sx .drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}
.sx .drawer-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 24px;
    border-top: 1px solid var(--sx-soft-4);
    background: var(--sx-surface);
}
.sx .drawer-section { margin-bottom: 22px; }
.sx .drawer-section .section-title {
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sx-muted-2);
    font-weight: 500;
    margin-bottom: 12px;
}
.sx .drawer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    gap: 12px;
}
.sx .drawer-row .label {
    font-size: 13px;
    color: var(--sx-text);
    flex: 1;
}
.sx .drawer-row .label .hint {
    display: block;
    font-size: 11.5px;
    color: var(--sx-muted-2);
    margin-top: 2px;
}
.sx .drawer-row input[type="number"],
.sx .drawer-row select,
.sx .drawer-row input[type="time"] {
    font-family: inherit;
    background: var(--sx-soft-2);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 12.5px;
    color: var(--sx-text);
    min-width: 100px;
}
.sx .drawer-row input[type="number"]:focus,
.sx .drawer-row select:focus,
.sx .drawer-row input[type="time"]:focus {
    background: var(--sx-surface);
    border-color: rgba(0,0,0,0.10);
    outline: none;
}
.sx .drawer-row input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.sx .drawer-pills { display: flex; gap: 6px; flex-wrap: wrap; }

/* Statistics tab — 4-section story */
.sx .stats-page { padding: 24px; }
.sx .stats-page section { margin-bottom: 36px; }
.sx .stats-page section:last-child { margin-bottom: 0; }

/* Inline help dot — instant CSS tooltip via data-tip attribute */
.sx .help-dot {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--sx-soft-3);
    color: var(--sx-muted);
    font-size: 9px;
    font-weight: 600;
    cursor: help;
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;
}
.sx .help-dot:hover { background: var(--sx-accent); color: var(--sx-surface); }
.sx .help-dot[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translate(-50%, 8px);
    background: var(--sx-text);
    color: var(--sx-surface);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 11.5px;
    font-weight: 400;
    line-height: 1.45;
    letter-spacing: 0.01em;
    text-transform: none;
    white-space: normal;
    width: max-content;
    max-width: 260px;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms;
    box-shadow: 0 6px 18px -8px rgba(0,0,0,0.4);
}
.sx .help-dot[data-tip]::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translate(-50%, 2px) rotate(45deg);
    width: 8px;
    height: 8px;
    background: var(--sx-text);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms;
}
.sx .help-dot[data-tip]:hover::after,
.sx .help-dot[data-tip]:hover::before { opacity: 1; }

/* Index Returns page — `.tab-content` wrapper already supplies 20×32 padding */
.sx .indices-page { }
.sx .indices-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.sx .indices-header h1 {
    font-size: 26px;
    font-weight: 500;
    letter-spacing: -0.02em;
    margin: 0;
}
.sx .indices-card { overflow: hidden; }
.sx .indices-grid {
    display: grid;
    grid-template-columns: 1.6fr 110px 120px 90px 90px 90px 90px 100px 40px;
    column-gap: 16px;
    align-items: center;
    padding: 14px 24px;
}
.sx .indices-grid.head {
    background: var(--sx-soft-1);
    border-bottom: 1px solid var(--sx-soft-4);
}
.sx .indices-grid.row {
    border-bottom: 1px solid var(--sx-soft-3);
    transition: background 140ms;
    cursor: default;
}
.sx .indices-grid.row:last-child { border-bottom: none; }
.sx .indices-grid.row:hover { background: var(--sx-row-hover); }
.sx .indices-grid .right { text-align: right; }
.sx .indices-grid .name {
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sx .indices-grid .symbol {
    font-family: var(--sx-mono);
    color: var(--sx-muted-2);
    font-size: 11px;
    font-weight: 400;
    margin-left: 4px;
}
.sx .indices-grid .region {
    font-size: 12px;
    color: var(--sx-muted);
}
.sx .indices-loading {
    padding: 40px 24px;
    text-align: center;
    color: var(--sx-muted-2);
    font-size: 13px;
}
.sx .ix-del {
    background: none;
    border: none;
    color: var(--sx-neg);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 120ms;
}
.sx .ix-del:hover { background: rgba(181,74,62,0.08); }

/* Scrollbar (subtle, matches surface) */
.sx ::-webkit-scrollbar { width: 10px; height: 10px; }
.sx ::-webkit-scrollbar-track { background: transparent; }
.sx ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 5px; }
.sx ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.16); }
