/* ============================================================================
   Design system — premium refresh
   ----------------------------------------------------------------------------
   All of the older inline CSS in index.html lives in `@layer legacy`.
   Plain rules in this file therefore win over legacy rules whatever their
   specificity, while still losing to inline style="" attributes (so colours
   that JavaScript sets for profit/loss, heatmaps and progress bars survive).

   Rules inside `@layer ds-force` carry !important. They exist only where the
   legacy CSS itself used !important. They never set display, visibility or
   anything else JavaScript uses to show and hide content.

   Palette: graphite neutrals, one quiet blue accent for selection, focus and
   charts. Green and red only ever mean gain and loss.
   ========================================================================= */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: dark;
  --bg: #0A0C10;
  --surface: #111419;
  --surface2: #171B21;
  --surface3: #1E232B;
  --raise: #262C36;
  --bg-elevated: #1B2028; /* used by alert toasts; was never defined before */
  --border: #21262E;
  --border2: #2E343F;
  --border-neon: rgba(125,163,255,.35);
  --border-accent: rgba(125,163,255,.35);
  --text: #ECEEF1;
  --muted: #A3AAB5;
  --dim: #7C8491;
  --green: #3FCF8E;  --green-bg: rgba(63,207,142,.12);  --green-glow: transparent;
  --red: #F2646F;    --red-bg: rgba(242,100,111,.12);   --red-glow: transparent;
  --amber: #E2AD4B;  --amber-bg: rgba(226,173,75,.13);
  --blue: #7DA3FF;   --blue-bg: rgba(125,163,255,.13);
  --purple: #B79DFF; --purple-bg: rgba(183,157,255,.12);
  --accent: #7DA3FF; --accent-glow: transparent;
  --ink: #ECEEF1;    --ink-fg: #0A0C10;
  --focus-ring: 0 0 0 3px rgba(125,163,255,.28);
  --sans: 'Geist', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  /* Figures use the same face with tabular digits; true monospace is --code. */
  --mono: 'Geist', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --code: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-card: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 32px -22px rgba(0,0,0,.85);
  --shadow-pop: 0 28px 72px -18px rgba(0,0,0,.75);
  --dock-bg: #111419;
  --dock-border: #21262E;
  --dock-glow: transparent;
  --topbar-bg: #0A0C10;
  --glass-specular: transparent;
}
html:not(.light) {
  --dock-bg: #111419;
  --dock-border: #21262E;
  --dock-glow: transparent;
  --topbar-bg: #0A0C10;
  --glass-specular: transparent;
}
html.light {
  color-scheme: light;
  --bg: #F3F4F6;
  --surface: #FFFFFF;
  --surface2: #F5F6F8;
  --surface3: #EAECF0;
  --raise: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --border: #E4E7EC;
  --border2: #D0D5DD;
  --border-neon: rgba(46,91,234,.3);
  --border-accent: rgba(46,91,234,.3);
  --text: #0E1116;
  --muted: #4A5361;
  --dim: #687180;
  --green: #07805A;  --green-bg: rgba(7,128,90,.09);    --green-glow: transparent;
  --red: #C8303C;    --red-bg: rgba(200,48,60,.08);     --red-glow: transparent;
  --amber: #9A6A10;  --amber-bg: rgba(154,106,16,.10);
  --blue: #2E5BEA;   --blue-bg: rgba(46,91,234,.08);
  --purple: #6E4FD0; --purple-bg: rgba(110,79,208,.08);
  --accent: #2E5BEA; --accent-glow: transparent;
  --ink: #0E1116;    --ink-fg: #FFFFFF;
  --focus-ring: 0 0 0 3px rgba(46,91,234,.18);
  --shadow-card: 0 1px 2px rgba(16,24,40,.04);
  --shadow-pop: 0 24px 64px -16px rgba(16,24,40,.25);
  --dock-bg: #FFFFFF;
  --dock-border: #E4E7EC;
  --topbar-bg: #FFFFFF;
}

/* ------------------------------------------------------------------ base */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--blue-bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Icons from the inline sprite (#ds-sprite) */
.ds-i {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: middle;
}
.ds-i.sm { width: 15px; height: 15px; }
.ds-i.xs { width: 13px; height: 13px; }

@layer ds-force {
  /* Decorative glows, gradients and mouse-follow light are retired everywhere. */
  * { text-shadow: none !important; }
  .scard::before, .scard::after,
  .scard-g::after,
  .home-hero-card::before, .pf-insight-card::before,
  .logo::before, .page-header::after,
  .nav-label-premium::before, .nav-label-premium::after,
  .nav-item-premium::before, .nav-item-premium::after,
  .wl-sub-header::after, .wl-nav-item-premium::after { content: none !important; }

  /* No hover "lift" on cards, buttons or nav — state is shown with colour. */
  .scard:hover, .btn:hover, .btn:active, .nav-item-premium:hover,
  .wl-sub-header:hover, .wl-nav-item-premium:hover, .wl-new-btn-premium:hover,
  .filter-btn:hover, .qfilter-btn:hover, .filter-reset-btn:hover,
  .home-hero-card:hover, .pf-insight-card:hover, .broker-card:hover, .bcard:hover,
  .mobile-action-btn:active, .mobile-dock-item:active { transform: none !important; }

  /* Light text on the accent fill reads poorly with the softer dark-mode blue. */
  html:not(.light) [style*="background:var(--accent)"],
  html:not(.light) [style*="background: var(--accent)"] { color: var(--ink-fg) !important; }
}

/* ============================================================== app shell */
@layer ds-force {
  .sidebar {
    background: var(--bg) !important;
    border-right: 1px solid var(--border) !important;
    box-shadow: none !important;
  }
  .logo {
    background: none !important;
    border-bottom: 0 !important;
    padding: 18px 16px 10px !important;
    margin-bottom: 0 !important;
  }
  .logo-title {
    font-size: 14px !important;
    font-weight: 600 !important;
    letter-spacing: -.01em !important;
  }
  .logo-sub { font-size: 11.5px !important; color: var(--dim) !important; margin-top: 1px !important; }
  .wl-nav-item-premium { font-size: 13px !important; letter-spacing: 0 !important; }
}
.logo-top-row { margin-bottom: 14px; }
.logo-live-badge {
  font-size: 11.5px; font-weight: 500; letter-spacing: 0; text-transform: none;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 9px 3px 8px; white-space: nowrap;
}
html.light .logo-live-badge { color: var(--muted); background: var(--surface); border-color: var(--border); }
.logo-live-dot, .live-dot, .logo-mark-dot, .mobile-live-pulse, .live-pulse-dot {
  background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); animation: none;
}
.theme-toggle-pill {
  width: 30px; height: 28px; border-radius: 8px;
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  font-size: 13px;
}
.theme-toggle-pill:hover,
html.light .theme-toggle-pill:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }
html.light .theme-toggle-pill { background: transparent; color: var(--muted); border-color: var(--border); }
.logo-identity { gap: 10px; }
.logo-avatar, .mobile-avatar {
  background: var(--ink); color: var(--ink-fg);
  border-radius: 8px; font-family: var(--sans); font-weight: 700; letter-spacing: -.02em;
  box-shadow: none;
}
.logo-avatar { width: 32px; height: 32px; font-size: 14px; }
.logo-title span, .mobile-title span { color: inherit; }
.logo-glow-line { background: var(--border); margin-top: 16px; opacity: 1; }
html.light .logo-glow-line { background: var(--border); }

.nav-label-premium {
  font-size: 11.5px; font-weight: 500; letter-spacing: 0; text-transform: none;
  color: var(--dim); opacity: 1; padding: 18px 20px 6px;
}
html.light .nav-label-premium { color: var(--dim); opacity: 1; }
.nav-section-wrap { padding: 0 10px; }
.nav-item-premium, .wl-sub-header {
  gap: 10px; min-height: 36px; padding: 0 10px; border-radius: 8px;
  font-size: 13.5px; font-weight: 400; color: var(--muted);
  background: transparent; box-shadow: none;
}
.nav-item-premium:hover, .wl-sub-header:hover,
html.light .nav-item-premium:hover, html.light .wl-sub-header:hover {
  background: var(--surface2); color: var(--text);
}
html.light .nav-item-premium, html.light .wl-sub-header { color: var(--muted); }
.nav-item-premium.active, html.light .nav-item-premium.active {
  background: var(--surface2); color: var(--text); font-weight: 500; box-shadow: none;
}
html:not(.light) .nav-item-premium.active { background: var(--surface3); }
.nav-icon-wrap, .wl-sub-icon,
html.light .nav-icon-wrap, html.light .wl-sub-icon {
  width: 20px; height: 20px; border: 0; border-radius: 0; background: none;
  box-shadow: none; color: inherit; font-size: 15px;
}
.nav-item-premium:hover .nav-icon-wrap, .wl-sub-header:hover .wl-sub-icon,
.nav-item-premium.active .nav-icon-wrap, .wl-sub-header.stk:hover .wl-sub-icon,
html.light .nav-item-premium:hover .nav-icon-wrap, html.light .nav-item-premium.active .nav-icon-wrap,
html.light .wl-sub-header:hover .wl-sub-icon {
  background: none; border: 0; box-shadow: none; transform: none;
}
.nav-item-premium.active .nav-icon-wrap { color: var(--accent); }
.portfolio-wrap .nav-item-premium .nav-icon-wrap,
.explore-wrap .nav-item-premium .nav-icon-wrap { border: 0; }
@layer ds-force { .nav-item-premium .active-dot { display: none !important; } }
@media (max-width: 900px) {
  .nav-item-premium, .wl-sub-header { min-height: 42px; padding: 0 12px; font-size: 14px; }
  .nav-icon-wrap, .wl-sub-icon { width: 20px; height: 20px; font-size: 15px; }
}

.wl-sub-label { font-size: inherit; font-weight: inherit; letter-spacing: 0; }
.wl-sub-count, .wl-nav-count, html.light .wl-sub-count, html.light .wl-nav-count {
  font-family: var(--code); font-size: 11px; font-weight: 500;
  color: var(--dim); background: none; padding: 0; opacity: 1;
}
.wl-sub-chevron, html.light .wl-sub-chevron { color: var(--dim); opacity: 1; font-size: 10px; }
.wl-sub-body, html.light .wl-sub-body { margin-left: 19px; padding: 2px 0 4px 10px; border-left: 1px solid var(--border); }
.wl-nav-item-premium {
  min-height: 32px; padding: 0 10px; border-radius: 8px; margin: 1px 0;
  color: var(--muted); background: transparent; box-shadow: none;
}
.wl-nav-item-premium:hover, html.light .wl-nav-item-premium:hover { background: var(--surface2); color: var(--text); }
html.light .wl-nav-item-premium { color: var(--muted); }
.wl-nav-item-premium.active, .wl-nav-item-premium.stk-active,
html.light .wl-nav-item-premium.active {
  background: var(--surface2); color: var(--text); font-weight: 500; box-shadow: none;
}
.wl-new-btn-premium, html.light .wl-new-btn-premium {
  min-height: 32px; padding: 0 10px; border-radius: 8px;
  color: var(--dim); background: transparent; border: 1px dashed var(--border2);
  font-size: 12.5px; font-weight: 500;
}
.wl-new-btn-premium:hover, html.light .wl-new-btn-premium:hover { color: var(--text); background: var(--surface2); border-color: var(--border2); }
@layer ds-force {
  /* Inline per-list tints on the "+ New list" buttons */
  .wl-new-btn-premium[style] { color: var(--dim) !important; border-color: var(--border2) !important; }
  .wl-new-btn-premium[style]:hover { color: var(--text) !important; }
}
.us-badge {
  font-family: var(--code); font-size: 9.5px; font-weight: 600; letter-spacing: .02em;
  color: var(--muted); background: var(--surface3); border-radius: 4px; padding: 1px 4px;
}

.sidebar-footer, html:not(.light) .sidebar-footer, html.light .sidebar-footer {
  border-top: 1px solid var(--border); background: none; color: var(--dim);
  padding: 14px 16px 0;
}
.auth-badge {
  font-family: var(--sans); font-size: 12px; font-weight: 500;
  border-radius: 999px; padding: 4px 10px;
}

/* ------------------------------------------------------- mobile chrome */
.mobile-top-bar {
  background: var(--topbar-bg); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none;
}
.mobile-avatar { width: 32px; height: 32px; font-size: 14px; }
.mobile-title { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.mobile-subtitle {
  font-family: var(--sans); font-size: 11.5px; letter-spacing: 0; text-transform: none; color: var(--dim);
}
.mobile-action-btn {
  border-radius: 10px; background: transparent; border: 1px solid var(--border); color: var(--muted);
}
.mobile-hamburger span { background: var(--text); }
.mobile-bottom-dock { left: 0; right: 0; bottom: 0; }
.mobile-dock-inner {
  max-width: none; border-radius: 0; border: 0; border-top: 1px solid var(--border);
  background: var(--dock-bg); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
}
.mobile-dock-item { color: var(--dim); min-height: 48px; }
.mobile-dock-item .dock-label { color: var(--dim); font-size: 11px; font-weight: 500; }
.mobile-dock-item.active { color: var(--text); }
.mobile-dock-item.active .dock-icon { transform: none; filter: none; color: var(--accent); }
.mobile-dock-item.active .dock-label { color: var(--text); font-weight: 600; }
.mobile-dock-item .dock-dot { display: none; }
.hamburger { background: var(--surface); border-color: var(--border); }
.sidebar-overlay { background: rgba(5,7,10,.55); }
html.light .sidebar-overlay { background: rgba(15,20,30,.3); }
.view-banner { border-bottom-color: var(--border); }

/* ============================================================ page header */
@layer ds-force {
  .page-header {
    border-bottom: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: 22px !important;
    align-items: flex-end;
  }
  .page-title, h1.page-title, h2.page-title {
    font-size: 24px !important;
    font-weight: 600 !important;
    letter-spacing: -.025em !important;
    line-height: 1.2 !important;
  }
  .page-sub {
    font-size: 13px !important;
    color: var(--muted) !important;
    margin-top: 4px !important;
  }
}
@media (max-width: 768px) {
  @layer ds-force {
    .page-title, h1.page-title, h2.page-title { font-size: 20px !important; }
    .page-header { margin-bottom: 16px !important; align-items: flex-start; }
  }
}

/* ================================================================ buttons */
@layer ds-force {
  .btn {
    font-family: var(--sans) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    letter-spacing: 0 !important;
    border-radius: 8px !important;
    padding: 0 14px !important;
    color: var(--text);
    box-shadow: none !important;
    gap: 7px;
  }
  /* Buttons whose background is set inline (JS on/off states) keep it. */
  .btn:not([style*="background"]) {
    border: 1px solid var(--border2) !important;
    background: var(--surface) !important;
  }
  .btn:not([style*="background"]):hover { background: var(--surface2) !important; border-color: var(--border2) !important; color: var(--text); }
  .btn-sm { font-size: 12px !important; padding: 0 10px !important; }

  /* Create / add actions are the one filled button in a header. */
  .btn-green:not([style*="background"]) { background: var(--ink) !important; color: var(--ink-fg) !important; border-color: transparent !important; }
  .btn-green:not([style*="background"]):hover { background: var(--ink) !important; opacity: .88; }

  /* Refresh, save and similar get the quiet accent treatment. */
  .btn-primary:not([style*="background"]) { background: var(--blue-bg) !important; color: var(--accent) !important; border-color: transparent !important; }
  .btn-primary:not([style*="background"]):hover { background: var(--blue-bg) !important; border-color: var(--border-accent) !important; }

  /* Buttons that JavaScript or markup fill with the accent become the filled primary. */
  .btn[style*="background:var(--accent)"], .btn[style*="background: var(--accent)"] {
    background: var(--ink) !important; color: var(--ink-fg) !important; border-color: transparent !important;
  }
  /* The inline purple tint on Rebalance was decoration. (Amber stays: JS uses it for "privacy on".) */
  #pf-toolbar-rebalance-btn { color: var(--text) !important; background: var(--surface) !important; border: 1px solid var(--border2) !important; }
  #pf-toolbar-rebalance-btn:hover { background: var(--surface2) !important; }

  /* Colour on other variants was decoration; keep them neutral. */
  .btn-purple, .btn-amber, .btn-blue { color: var(--text) !important; }
  .btn-danger { color: var(--red) !important; }
  .btn-danger:not([style*="background"]):hover { background: var(--red-bg) !important; border-color: transparent !important; }
}
.btn { min-height: 36px; }
.btn-sm { min-height: 30px; }
@media (pointer: coarse) { .btn { min-height: 44px; } .btn-sm { min-height: 36px; } }

/* ========================================================= summary cards */
@layer ds-force {
  .scard,
  .scard-g-green, .scard-g-red, .scard-g-blue, .scard-g-purple, .scard-g-amber, .scard-g-muted,
  html.light .scard {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-card) !important;
  }
  html:not(.light) .scard:hover, .scard:hover { border-color: var(--border) !important; box-shadow: var(--shadow-card) !important; }
  .scard-label {
    font-size: 12.5px !important;
    font-weight: 500 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    color: var(--muted);
    margin-bottom: 6px;
  }
  .scard-val {
    font-family: var(--sans) !important;
    font-size: 22px !important;
    font-weight: 500 !important;
    letter-spacing: -.025em !important;
  }
  .scard-sub { font-size: 12px !important; font-weight: 400 !important; color: var(--dim) !important; }
}
.scard-val.blue, .scard-val.purple, .scard-val.amber { color: var(--text); }
@media (max-width: 768px) {
  @layer ds-force { .scard-val { font-size: 19px !important; } }
  /* An odd card out spans the row instead of sitting alone. */
  .summary-grid-5 > .scard:last-child:nth-child(odd),
  .summary-grid > .scard:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 480px) { @layer ds-force { .scard-val { font-size: 17px !important; } } }

/* ============================================================== panels */
/* Every card-like container shares one surface treatment. */
@layer ds-force {
  .pf-insight-card, .pf-chart-card, .pf-benchmark-bar, .wl-mover-card,
  .home-hero-card, .home-mini-card, .home-intraday-card, .home-alloc-card,
  .perf-card, .perf-progress-card, .broker-card, .bcard,
  .mi-runway-card, .tpnl-drag-card, .revision-card, .an-est-card,
  .an-qcard, .an-ind-card, .an-extra-card, .an-ms-box, .screener-panel,
  .tm-segment-block, .fi-wrap {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-card) !important;
  }
}

@layer ds-force {
  :is(.pf-insight-card, .pf-chart-card, .pf-benchmark-bar, .wl-mover-card,
  .home-hero-card, .home-mini-card, .home-intraday-card, .home-alloc-card,
  .perf-card, .perf-progress-card, .broker-card, .bcard,
  .mi-runway-card, .tpnl-drag-card, .revision-card, .an-est-card,
  .an-qcard, .an-ind-card, .an-extra-card, .an-ms-box, .screener-panel,
  .tm-segment-block, .fi-wrap):not([style*="background"]) { background: var(--surface) !important; }
}

/* ================================================================= tables */
@layer ds-force {
  .table-wrap, html.light .table-wrap {
    border-color: var(--border) !important;
    box-shadow: var(--shadow-card) !important;
  }
  thead tr, html.light thead tr { background: var(--surface) !important; }
  th {
    font-family: var(--sans) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    color: var(--dim) !important;
    padding: 10px 14px !important;
    border-bottom: 1px solid var(--border) !important;
  }
  td {
    font-size: 13px !important;
    padding: 11px 14px !important;
    border-bottom-color: var(--border) !important;
  }
  .pf-table.compact th { padding: 8px 10px !important; }
  .pf-table.compact td { padding: 7px 10px !important; }
  .tbl-wrap tbody tr:hover { background: var(--surface2) !important; }
  .table-toolbar { background: var(--surface) !important; padding: 12px 16px !important; }
  .toolbar-title { font-size: 14px !important; font-weight: 600 !important; letter-spacing: -.01em !important; }
  .note-bar {
    font-size: 12px !important;
    padding: 10px 18px !important;
    background: var(--surface) !important;
    color: var(--dim) !important;
  }
}
th:hover { color: var(--text); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface2); }
.sort-icon { color: var(--dim); opacity: .7; }
.pf-table th.sticky-sym, .pf-table td.sticky-sym { background: var(--surface); box-shadow: 1px 0 0 var(--border); }
@media (max-width: 768px) {
  .table-wrap table th:first-child, .table-wrap table td:first-child { background: var(--surface); box-shadow: 1px 0 0 var(--border); }
  .table-wrap table thead tr th:first-child { background: var(--surface); }
}

/* ======================================================= search + inputs */
@layer ds-force {
  .search-box {
    background: var(--surface2) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    min-height: 34px;
  }
  .search-box:focus-within { border-color: var(--accent) !important; box-shadow: var(--focus-ring) !important; }
}
.search-box input { font-size: 13px; }
.search-box input::placeholder { color: var(--dim); }

.pf-input, .screener-field, .notes-textarea, .wl-create-input, .wl-inline-input,
.fi-input-field, .si-num-input, .pg-size-select, .nav-drop {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-family: var(--sans);
}
.pf-input:focus, .screener-field:focus, .notes-textarea:focus, .wl-create-input:focus,
.wl-inline-input:focus, .fi-input-field:focus, .si-num-input:focus, .pg-size-select:focus, .nav-drop:focus {
  border-color: var(--accent); box-shadow: var(--focus-ring); outline: none;
}
.pf-input::placeholder { color: var(--dim); }
.pf-label { font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }

/* ================================================== segmented controls */
.view-switch-grp, .density-btn-grp {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; overflow: visible;
}
.view-switch-btn, .density-btn {
  border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  font-family: var(--sans); font-size: 12.5px; font-weight: 500; padding: 4px 10px;
}
.view-switch-btn:hover, .density-btn:hover { color: var(--text); }
.view-switch-btn.active, .density-btn.active,
html.light .view-switch-btn.active {
  background: var(--raise); color: var(--text); font-weight: 500;
  box-shadow: 0 0 0 1px var(--border2), 0 1px 2px rgba(0,0,0,.12);
}

/* ========================================================== filter pills */
@layer ds-force {
  .filter-btn, .qfilter-btn, .wl-tab-btn, html.light .qfilter-btn {
    font-family: var(--sans) !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
    letter-spacing: 0 !important;
    padding: 5px 12px !important;
    border-radius: 999px !important;
    box-shadow: none !important;
  }
  /* Pills whose state JavaScript paints inline keep that paint. */
  :is(.filter-btn, .qfilter-btn, .wl-tab-btn):not([style*="background"]) {
    border: 1px solid var(--border) !important;
    background: var(--surface) !important;
    color: var(--muted) !important;
  }
  :is(.filter-btn, .qfilter-btn, .wl-tab-btn):not([style*="background"]):hover {
    background: var(--surface2) !important;
    border-color: var(--border2) !important;
    color: var(--text) !important;
  }
  :is(.filter-btn, .qfilter-btn, .wl-tab-btn).active:not([style*="background"]) {
    background: var(--ink) !important;
    color: var(--ink-fg) !important;
    border-color: transparent !important;
  }
  .qfilter-btn.green-active:not([style*="background"]) { background: var(--green-bg) !important; color: var(--green) !important; border-color: transparent !important; }
  .qfilter-btn.red-active:not([style*="background"]) { background: var(--red-bg) !important; color: var(--red) !important; border-color: transparent !important; }
  .qfilter-btn.amber-active:not([style*="background"]) { background: var(--amber-bg) !important; color: var(--amber) !important; border-color: transparent !important; }
  .filter-reset-btn {
    font-size: 12px !important;
    font-weight: 500 !important;
    border-radius: 999px !important;
    padding: 5px 12px !important;
    box-shadow: none !important;
  }
  .filter-reset-btn:hover { box-shadow: none !important; }
}
.pg-btn {
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted);
  font-family: var(--sans);
}
.pg-btn:hover:not(:disabled) { background: var(--surface2); border-color: var(--border2); color: var(--text); }
.pg-btn.active { background: var(--ink); border-color: transparent; color: var(--ink-fg); }
.filter-scroll-wrapper .scroll-btn-left, .filter-scroll-wrapper .scroll-btn-right {
  background: var(--surface); border: 1px solid var(--border); color: var(--muted); border-radius: 8px;
}
.filter-scroll-wrapper .scroll-btn-left:hover, .filter-scroll-wrapper .scroll-btn-right:hover {
  background: var(--surface2); border-color: var(--border2); color: var(--text);
}

/* ======================================================= chips + badges */
@layer ds-force {
  .badge {
    font-family: var(--sans) !important;
    font-size: 11.5px !important;
    font-weight: 500 !important;
    letter-spacing: 0 !important;
    border-radius: 6px !important;
  }
  .badge-red, .badge-green, .badge-purple, .badge-amber, .badge-blue { border-color: transparent !important; }
  .badge-neu { border-color: var(--border) !important; }
  .sym-pill {
    font-family: var(--sans) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    border-radius: 6px !important;
  }
  .status-chip { font-family: var(--sans) !important; font-size: 11.5px !important; font-weight: 500 !important; border-radius: 999px !important; }
}
.sym-pill, .sym-pill-stk { color: var(--text); background: var(--surface2); border-color: var(--border); }
.sector-chip { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); font-family: var(--sans); font-size: 11px; }
.xirr-badge { border-radius: 6px; font-family: var(--sans); }

/* ================================================================ modals */
.modal-overlay { background: rgba(5,7,10,.62); }
html.light .modal-overlay { background: rgba(15,20,30,.32); }
@layer ds-force {
  .modal {
    background: var(--surface) !important;
    border: 1px solid var(--border2) !important;
    border-radius: 16px !important;
    box-shadow: var(--shadow-pop) !important;
  }
  .modal-header { padding: 18px 22px !important; border-bottom-color: var(--border) !important; }
  .modal-title { font-size: 15px !important; font-weight: 600 !important; letter-spacing: -.01em !important; }
}
.modal-subtitle { color: var(--dim); }
.modal-close { color: var(--dim); border-radius: 8px; }
.modal-close:hover { color: var(--text); background: var(--surface2); }
.modal-search-inner { background: var(--surface2); border-color: var(--border); border-radius: 8px; }
.modal-search-inner:focus-within { border-color: var(--accent); box-shadow: var(--focus-ring); }
.modal-section-label {
  font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none;
  color: var(--dim); background: var(--surface);
}
.modal-item:hover { background: var(--surface2); }
.modal-add-btn { font-family: var(--sans); border-radius: 999px; }
.modal-add-btn.add { background: var(--ink); color: var(--ink-fg); border-color: transparent; }
.modal-add-btn.add:hover { opacity: .88; border-color: transparent; }

/* ============================================================ ticker bar */
@layer ds-force {
  .ticker-bar { background: var(--bg) !important; border-bottom: 1px solid var(--border) !important; box-shadow: none !important; }
  .ticker-name { font-size: 11px !important; letter-spacing: .02em !important; font-weight: 500 !important; color: var(--dim); }
  .ticker-price { font-family: var(--sans) !important; font-weight: 500 !important; font-size: 12.5px !important; }
  .ticker-item { font-family: var(--sans) !important; }
}
.ticker-item { border-right-color: var(--border); }

/* ============================================================== skeleton */
.skeleton-box { background: var(--surface2); }

/* ================================================ labels + figures (global) */
/* Tiny upper-case, letter-spaced labels become calm sentence-case labels. */
@layer ds-force {
  .nw-hstat-label, .pf-chart-title, .screener-field label, .pf-bench-label, .pf-insight-title,
  .pf-tax-half-label, .home-hero-label, .si-label, .si-label2, .si-label3, .si-label4, .si-label5,
  .home-stat-label, .wl-mover-title, .filter-sheet-section-title, .alert-grid-price .price-label,
  .alert-grid-dist .dist-label, .an-est-title, .home-intraday-badge, .home-alloc-header,
  .alert-modal-desc, .revision-card-label, .perf-progress-label,
  .perf-breakdown-col .perf-breakdown-stat-label, .perf-card-label, .an-qs-label, .an-qcard-label,
  .an-ind-label, .an-price-chart-title, .an-extra-title, .an-bd-header, .an-ht-label,
  .an-price-ms-lbl, .an-hb-label, .an-fund-label, .an-indavg-title, .an-iavg-head,
  .an-proscons-title, .an-wl-label, .an-fhist-stat-label, .an-ms-box-title, .fi-input-label,
  .fi-progress-label, .fi-summary-slabel, .fi-depr-label {
    font-family: var(--sans) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
  }
  /* Card and section titles read as titles, not labels. */
  .pf-chart-title, .pf-insight-title, .wl-mover-title, .an-price-chart-title, .an-extra-title,
  .an-indavg-title, .an-ms-box-title, .an-proscons-title {
    font-size: 13.5px !important;
    font-weight: 600 !important;
    color: var(--text);
    letter-spacing: -.005em !important;
  }

  /* Figures: one face, tabular digits, medium weight, gently tightened. */
  .pf-bench-val, .pf-alpha-badge, .pf-gl-val, .pf-tax-half-val, .pf-conc-val, .home-hero-val,
  .si-val-red, .si-val-mono, .home-stat-val, .wl-mover-rank, .wl-mover-chg,
  .alert-grid-price .price-value, .tm-pnl-val, .home-intraday-val, .tpnl-cal-pnl,
  .mi-runway-badge, .revision-card-value, .perf-progress-pct, .perf-card-val, .an-stock-price,
  .an-stock-chg, .an-qs-val, .an-qcard-val, .an-ind-val, .an-price-target-val, .an-earnings-val,
  .an-ht-num, .an-ht-chg, .an-ht-val, .an-price-ms-val, .an-price-tt-val, .an-hb-val,
  .an-fhist-stat-val, .an-ms-row-pct, .scr-ticker-item-price, .fi-usd-tgt, .fi-inr-ret, .fi-pct,
  .fi-summary-sval, .nw-hstat-val, .mono {
    font-family: var(--sans) !important;
    font-weight: 600 !important;
    letter-spacing: -.01em !important;
  }
  .home-hero-val, .home-intraday-val, .nw-hstat-val, .perf-card-val, .an-stock-price {
    font-weight: 500 !important;
    letter-spacing: -.025em !important;
  }
}

/* ===================================================================== home */
@layer ds-force {
  .home-hero-card, .home-hero-green, .home-hero-blue, .home-hero-purple,
  html.light .home-hero-card, html:not(.light) .home-hero-card:hover {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-card) !important;
  }
  .home-hero-val { font-size: 30px !important; }
  .home-charts-grid .table-wrap { box-shadow: var(--shadow-card) !important; }
  .home-intraday-card { background: var(--surface) !important; }
}
.home-hero-card::before { content: none; }
.home-hero-label { color: var(--muted); }
.home-hero-val.purple { color: var(--text); }
.home-hero-sub-label { color: var(--dim); font-size: 12px; }
.home-hero-sub-val, .home-hero-sub-pnl { font-family: var(--sans); font-size: 12.5px; }
.home-stat-card { background: var(--surface2); border-color: var(--border); border-radius: 10px; }
.home-stat-label { color: var(--muted); }
.home-stat-val { font-size: 18px; color: var(--text); }
.home-stat-sub { color: var(--dim); font-size: 12px; }
.home-pulse-chip { background: var(--surface); border-color: var(--border); border-radius: 999px; font-family: var(--sans); }
.home-pulse-chip:hover { border-color: var(--border2); transform: none; }
.home-pulse-name { font-weight: 600; font-size: 12px; letter-spacing: 0; }
.home-pulse-chg { font-weight: 600; border-radius: 6px; }
.home-intraday-badge { border-radius: 999px; }
.home-action-pill {
  border-color: var(--border); background: var(--surface); color: var(--muted);
  border-radius: 999px; font-size: 12px; font-weight: 500;
}
.home-action-pill:hover { border-color: var(--border2); color: var(--text); background: var(--surface2); transform: none; }
.home-alloc-header { color: var(--muted); }
.home-alloc-bar { gap: 2px; border-radius: 5px; background: var(--surface3); }
.home-alloc-legend { font-family: var(--sans); font-size: 12px; color: var(--muted); }
.home-mini-trend { font-family: var(--sans); border-radius: 6px; }
.home-mini-lastmo-val { font-family: var(--sans); }
.pf-type-toggle, .perf-type-toggle { border-color: var(--border); border-radius: 9px; background: var(--surface2); padding: 3px; gap: 2px; }
.pf-type-btn, .perf-type-btn { border-radius: 6px; color: var(--muted); font-weight: 500; }
.pf-type-btn.active, .perf-type-btn.active { background: var(--raise); color: var(--text); box-shadow: 0 0 0 1px var(--border2); }
.si-box { background: var(--surface2); border-color: var(--border); }

/* ================================================================ portfolio */
@layer ds-force {
  .pf-insight-card::after, .wl-mover-card::after { content: none !important; }
}
/* Emoji in section titles was decoration; the titles carry the meaning. */
.pf-bench-label-icon, .pf-insight-title-icon, .wl-mover-title-icon { display: none; }
.pf-benchmark-bar { padding: 8px; gap: 0; }
.pf-bench-item, .pf-bench-item-green, .pf-bench-item-blue, .pf-bench-item-purple, .pf-bench-item-amber {
  background: transparent; border-radius: 10px; padding: 10px 14px; gap: 4px;
}
.pf-bench-item:hover, .pf-bench-item-green:hover, .pf-bench-item-blue:hover,
.pf-bench-item-purple:hover, .pf-bench-item-amber:hover { background: var(--surface2); }
.pf-bench-label, html.light .pf-bench-label { color: var(--muted); }
.pf-bench-val, .pf-alpha-badge { font-size: 18px; }
.pf-bench-sub, html.light .pf-bench-sub { font-family: var(--sans); font-size: 11.5px; color: var(--dim); }
.pf-bench-divider { display: none; }
.concentration-bar { height: 6px; background: var(--surface3); gap: 2px; }
.pf-insights-row, .pf-charts-grid, .wl-movers-grid { gap: 16px; }
.pf-insight-title, html.light .pf-insight-title { color: var(--text); margin-bottom: 12px; }
.pf-gl-row, .pf-conc-row { padding: 7px 0; }
.pf-gl-label, .pf-conc-label, .pf-age-label { font-size: 12.5px; color: var(--muted); }
.pf-gl-val { font-size: 13.5px; }
.pf-conc-val { font-size: 12.5px; }
.pf-age-meta, html.light .pf-age-meta { font-family: var(--sans); font-size: 11.5px; color: var(--dim); }
.pf-age-track, .pf-conc-track { height: 6px; background: var(--surface3); }
.pf-tax-half { background: var(--surface2); border-color: var(--border); border-radius: 10px; padding: 10px 12px; }
.pf-tax-half-val { font-size: 16px; }
.pf-tax-half-sub, .pf-tax-note, html.light .pf-tax-half-sub, html.light .pf-tax-note { color: var(--dim); font-size: 11.5px; }
.pf-hhi-band { border-radius: 6px; font-size: 11.5px; font-weight: 500; }
.pf-chart-card { padding: 16px 18px; }

.wl-mover-title, html.light .wl-mover-title { color: var(--text); margin-bottom: 12px; }
.wl-mover-title-badge { font-family: var(--sans); font-size: 11px; font-weight: 600; border-radius: 6px; padding: 2px 7px; }
.wl-mover-row { padding: 8px 0; }
.wl-mover-row:hover { background: var(--surface2); border-radius: 8px; }
.wl-mover-rank { border-radius: 6px; font-size: 11px; font-weight: 600; }
.wl-rank-blue, .wl-rank-purple { background: var(--surface3); color: var(--muted); }
.wl-mover-sym { font-family: var(--sans); font-size: 12.5px; font-weight: 600; }
.wl-mover-sym:hover { color: var(--accent); }
.wl-mover-ltp { font-family: var(--sans); font-size: 12px; color: var(--muted); }
.wl-mover-chg { font-family: var(--sans); font-size: 12.5px; }
.wl-empty { font-style: normal; font-size: 12px; color: var(--dim); }
.wl-mobile-tabs { gap: 6px; }

/* Collapsible section toggles ("Analytics & Insights", "Today's Winners & Losers") */
#pf-analytics-toggle, #wl-movers-toggle {
  background: var(--surface); border-color: var(--border); border-radius: 10px;
  color: var(--muted); font-family: var(--sans); font-size: 13px; font-weight: 500;
}
#pf-analytics-toggle:hover, #wl-movers-toggle:hover { color: var(--text); background: var(--surface2); }

/* ============================================================ trading P&L */
@layer ds-force {
  .perf-card::before, .perf-card::after, .perf-progress-card::after { content: none !important; }
  .perf-row-total td { background: var(--surface2) !important; font-weight: 600 !important; }
  .perf-card:hover { transform: none !important; }
}
.perf-card:hover { border-color: var(--border); box-shadow: var(--shadow-card); }
.perf-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.perf-target-badge { font-family: var(--sans); font-size: 12px; border-radius: 999px; background: var(--surface2); border-color: var(--border); }
.perf-target-badge strong { color: var(--text); }
.perf-type-btn { font-size: 12px; border-radius: 999px; border-color: var(--border); background: var(--surface); }
.perf-type-btn:hover { border-color: var(--border2); }
.perf-type-btn.active { background: var(--ink); color: var(--ink-fg); border-color: transparent; box-shadow: none; }
.perf-progress-card { padding: 20px 22px; }
.perf-progress-pct { font-size: 28px; }
.perf-progress-pct.over-target { color: var(--accent); }
.perf-progress-bar-wrap { background: var(--surface3); box-shadow: none; height: 8px; }
.perf-progress-bar-fill { box-shadow: none; }
.perf-seg + .perf-seg { box-shadow: -2px 0 0 var(--surface); }
.perf-breakdown-dot { box-shadow: none; }
.perf-breakdown-stat-label { font-size: 11.5px; color: var(--dim); }
.perf-breakdown-stat-val { font-family: var(--sans); font-size: 13px; }
.perf-card { padding: 16px 18px; }
.perf-card-label { color: var(--muted); margin-bottom: 8px; }
.perf-card-val { font-size: 22px; }
.perf-card-sub { font-size: 12px; color: var(--dim); }
.perf-pf-override input { font-family: var(--sans); border-radius: 6px; border-color: var(--border); }

/* Daily P&L calendar: same green/red tokens as everywhere else, tinted by size. */
.tpnl-cal-wrap { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-card); }
.tpnl-cal-tile { border-radius: 8px; }
.tpnl-cal-tile:hover { transform: none; box-shadow: 0 0 0 1px var(--border2); }
.tpnl-cal-date { font-family: var(--sans); font-size: 11px; font-weight: 500; }
.tpnl-cal-pnl { font-size: 11.5px; }
.tpnl-cal-tile.profit-high { background: color-mix(in srgb, var(--green) 26%, transparent); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.tpnl-cal-tile.profit-mid  { background: color-mix(in srgb, var(--green) 15%, transparent); border-color: color-mix(in srgb, var(--green) 26%, transparent); }
.tpnl-cal-tile.profit-low  { background: color-mix(in srgb, var(--green) 8%, transparent);  border-color: color-mix(in srgb, var(--green) 16%, transparent); }
.tpnl-cal-tile.loss-high   { background: color-mix(in srgb, var(--red) 26%, transparent);   border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.tpnl-cal-tile.loss-mid    { background: color-mix(in srgb, var(--red) 15%, transparent);   border-color: color-mix(in srgb, var(--red) 26%, transparent); }
.tpnl-cal-tile.loss-low    { background: color-mix(in srgb, var(--red) 8%, transparent);    border-color: color-mix(in srgb, var(--red) 16%, transparent); }
.tpnl-cal-tile.profit-high .tpnl-cal-pnl, .tpnl-cal-tile.profit-mid .tpnl-cal-pnl, .tpnl-cal-tile.profit-low .tpnl-cal-pnl { color: var(--green); }
.tpnl-cal-tile.loss-high .tpnl-cal-pnl, .tpnl-cal-tile.loss-mid .tpnl-cal-pnl, .tpnl-cal-tile.loss-low .tpnl-cal-pnl { color: var(--red); }
.tpnl-cal-day-label { font-size: 11px; font-weight: 500; letter-spacing: 0; }

.broker-card:hover { box-shadow: var(--shadow-card); }
.bcard-val { font-family: var(--sans); }
.revision-card-sub { font-family: var(--sans); }
.revision-dir-icon { border-radius: 6px; }
.mi-runway-badge { border: 0; border-radius: 999px; font-weight: 600; font-family: var(--sans); }
.mi-cards-grid, .mi-analytics-grid { gap: 16px; }

/* ============================================================== net worth */
.nw-hero-stat { border-right-color: var(--border); }
.nw-hstat-label { color: var(--muted); }
.nw-hstat-val { font-size: 20px; }
.nw-hstat-sub, html.light .nw-hstat-sub { color: var(--dim); font-size: 12px; }
#nw-hero-stats .nw-hero-stat:hover { background: var(--surface2); border-radius: 10px; }

/* ============================================================ heatmap view */
.tm-top-bar { border-color: var(--border); }
.tm-legend { font-family: var(--sans); font-size: 12px; }
.tm-segment-header { background: var(--surface2); border-color: var(--border); border-radius: 10px; }
.tm-segment-title { font-weight: 600; }
.tm-segment-icon { display: none; }
.tm-segment-count, .tm-segment-meta { font-family: var(--sans); }
.tm-tile { border-radius: 10px; border-color: transparent; color: var(--text); }
.tm-tile:hover { transform: none; box-shadow: 0 0 0 1px var(--border2); border-color: transparent; }
.tm-sym, .tm-pnl-val { font-family: var(--sans); color: var(--text); }
.tm-weight, .tm-day-pct { font-family: var(--sans); color: var(--muted); opacity: 1; }
.tm-green-high { background: color-mix(in srgb, var(--green) 42%, var(--surface2)); }
.tm-green-mid  { background: color-mix(in srgb, var(--green) 28%, var(--surface2)); }
.tm-green-low  { background: color-mix(in srgb, var(--green) 15%, var(--surface2)); }
.tm-red-low    { background: color-mix(in srgb, var(--red) 15%, var(--surface2)); }
.tm-red-mid    { background: color-mix(in srgb, var(--red) 28%, var(--surface2)); }
.tm-red-high   { background: color-mix(in srgb, var(--red) 42%, var(--surface2)); }
.tm-flat       { background: var(--surface3); }

/* ================================================================= alerts */
.alert-grid-container { gap: 16px; }
.alert-grid-card { background: var(--surface); border-color: var(--border); border-radius: 14px; box-shadow: var(--shadow-card); }
.alert-grid-card:hover { border-color: var(--border2); box-shadow: var(--shadow-card); transform: none; }
.alert-grid-card.hit { background: var(--surface); border-color: color-mix(in srgb, var(--red) 45%, var(--border)); box-shadow: var(--shadow-card); }
.alert-grid-card.watching { border-color: var(--border); }
.alert-grid-header { border-bottom-color: var(--border); }
.alert-grid-sym .sym-pill { font-size: 13.5px; font-weight: 600; letter-spacing: 0; }
.alert-grid-ltp { font-family: var(--sans); font-size: 12px; }
.alert-grid-type .type-icon { border-radius: 6px; font-size: 13px; }
.alert-grid-type .type-label { font-size: 12px; font-weight: 500; letter-spacing: 0; }
.alert-grid-price .price-value { font-size: 16px; }
.alert-grid-dist .dist-value { font-family: var(--sans); }
.alert-grid-status { font-size: 12px; font-weight: 500; letter-spacing: 0; }
.alert-grid-status .tg-badge { font-size: 11px; border-radius: 4px; }
.alert-action-btn {
  border-radius: 999px; font-size: 12px; font-weight: 500; padding: 5px 12px;
  background: var(--surface2); border: 1px solid var(--border); box-shadow: none;
}
.alert-action-btn.rearm { background: var(--surface2); border-color: var(--border); color: var(--green); }
.alert-action-btn.dismiss { background: var(--surface2); border-color: var(--border); color: var(--red); }
.alert-action-btn.rearm:hover { background: var(--green-bg); color: var(--green); transform: none; box-shadow: none; }
.alert-action-btn.dismiss:hover { background: var(--red-bg); color: var(--red); transform: none; box-shadow: none; }
@layer ds-force {
  .alert-edit-btn {
    font-size: 12px !important; border-radius: 8px !important; padding: 0 9px !important;
    background: var(--surface) !important; border: 1px solid var(--border2) !important;
  }
  .alert-edit-btn:hover { background: var(--surface2) !important; border-color: var(--border2) !important; }
}
.alert-modal-card, .alert-modal-card.upper, .alert-modal-card.lower { background: var(--surface); border-radius: 14px; }
.alert-modal-card.upper { border-color: color-mix(in srgb, var(--red) 35%, var(--border)); }
.alert-modal-card.lower { border-color: color-mix(in srgb, var(--green) 35%, var(--border)); }
.alert-modal-card:hover { transform: none; box-shadow: none; }
.alert-modal-icon { border-radius: 8px; }
.alert-modal-label { font-weight: 600; }
.alert-modal-card .pf-input { font-family: var(--sans); }
.alert-modal-status { font-family: var(--sans); }
.alert-modal-info { background: var(--surface2); border-color: var(--border); }
.alert-bell-btn:hover { transform: none; }
.alert-bell-active svg, .alert-bell-triggered svg { filter: none; }

/* ======================================================= screener filters */
.screener-field input, .screener-field select {
  background: var(--surface2); border-color: var(--border); border-radius: 8px; font-family: var(--sans);
}
.screener-field input:focus, .screener-field select:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.screener-count { font-family: var(--sans); }
.exc-toggle { background: var(--surface2); border-color: var(--border); border-radius: 999px; padding: 2px; gap: 2px; }
.exc-opt { border-right: 0; border-radius: 999px; font-size: 12px; font-weight: 500; }
.exc-opt:hover { background: var(--surface3); }
.exc-opt.active { background: var(--ink); color: var(--ink-fg); }
.exc-badge { font-weight: 600; font-size: 10px; }

/* ================================================================== login */
/* Shared by landing.html and the in-app login screen. Same copy and fields, calmer surface. */
.login-screen, html.light .login-screen { background: var(--bg); }
.login-screen-bg { display: none; }
.login-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: var(--shadow-pop);
}
.login-left, html.light .login-left { background: var(--surface2); }
.login-left::before, .login-left::after { content: none; }
.login-logo-icon, .login-mobile-logo-icon {
  background: var(--ink); color: var(--ink-fg); border-radius: 10px; box-shadow: none;
  font-family: var(--sans); font-weight: 700;
}
.login-logo-name, html.light .login-logo-name, .login-mobile-logo-name { color: var(--text); font-weight: 600; letter-spacing: -.01em; }
.login-logo-tag, html.light .login-logo-tag, .login-mobile-logo-tag {
  font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--dim);
}
.login-hero-eyebrow, html.light .login-hero-eyebrow {
  font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
}
.login-hero-eyebrow-dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); animation: none; }
.login-hero-title, html.light .login-hero-title, .login-mobile-title {
  color: var(--text); font-weight: 600; letter-spacing: -.035em; text-wrap: balance;
}
.login-hero-title span, .login-mobile-title span { color: var(--accent); }
.login-hero-sub, html.light .login-hero-sub, .login-mobile-sub { color: var(--muted); font-size: 14px; }
.login-features-list, html.light .login-features-list { border-left: 0; gap: 2px; }
.login-feature-row, html.light .login-feature-row { padding: 10px 0; border-bottom-color: var(--border); }
.login-feature-icon { color: var(--accent); display: inline-flex; }
.login-feature-main, html.light .login-feature-main { color: var(--text); font-size: 13px; font-weight: 500; }
.login-feature-sub, html.light .login-feature-sub { color: var(--dim); font-size: 12px; }
.login-pill, .login-pill-green, .login-pill-blue, .login-pill-purple, .login-pill-amber,
html.light .login-pill-green, html.light .login-pill-blue, html.light .login-pill-purple, html.light .login-pill-amber {
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  font-size: 12px; font-weight: 500; border-radius: 999px;
}
.login-right, html.light .login-right { background: var(--surface); border-left: 1px solid var(--border); }
.login-form-icon, html.light .login-form-icon {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-radius: 12px;
}
.login-form-heading, html.light .login-form-heading { color: var(--text); font-weight: 600; letter-spacing: -.02em; }
.login-form-sub, html.light .login-form-sub { color: var(--muted); font-size: 13px; }
.login-pw-label, html.light .login-pw-label {
  font-size: 12.5px; font-weight: 500; letter-spacing: 0; text-transform: none;
  color: var(--muted); text-align: left; margin-bottom: 6px;
}
.login-input-icon { opacity: 1; color: var(--dim); display: inline-flex; }
.login-input-icon .ds-i { width: 16px; height: 16px; }
.login-input, html.light .login-input {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; color: var(--text);
  font-family: var(--sans);
}
.login-input:focus, html.light .login-input:focus { border-color: var(--accent); background: var(--surface2); box-shadow: var(--focus-ring); }
.login-input::placeholder, html.light .login-input::placeholder { color: var(--dim); }
.login-btn {
  background: var(--ink); color: var(--ink-fg); border-radius: 10px; box-shadow: none;
  font-family: var(--sans); font-weight: 600;
}
.login-btn:hover { opacity: .9; box-shadow: none; transform: none; }
.login-err, html.light .login-err { color: var(--red); }
.login-view-link, html.light .login-view-link { border-top-color: var(--border); color: var(--dim); }
.login-view-link a, html.light .login-view-link a { color: var(--accent); }
/* landing.html sign-in / sign-up tabs */
.login-tabs { border-bottom-color: var(--border); }
.login-tab { color: var(--dim); font-weight: 500; }
.login-tab:hover { color: var(--text); }
.login-tab.active { color: var(--text); border-bottom-color: var(--text); }

/* ======================================================= icons in controls */
.btn .ds-i, .home-action-pill .ds-i, .alert-action-btn .ds-i { width: 16px; height: 16px; }
.btn-sm .ds-i { width: 15px; height: 15px; }
.btn:not(.btn-green):not(.btn-primary):not(.btn-danger):not([style*="background"]) .ds-i { color: var(--muted); }
.view-switch-btn .ds-i, .density-btn .ds-i, .qfilter-btn .ds-i, .filter-btn .ds-i,
.wl-tab-btn .ds-i, .exc-opt .ds-i { width: 14px; height: 14px; }
.search-box .ds-i, .modal-search-inner .ds-i { width: 16px; height: 16px; color: var(--dim); }
.theme-toggle-pill .ds-i, .mobile-action-btn .ds-i { width: 16px; height: 16px; }
.modal-title .ds-i, .toolbar-title .ds-i { width: 16px; height: 16px; color: var(--muted); margin-right: 2px; }
.dock-icon .ds-i { width: 20px; height: 20px; }
.home-action-pill > span { display: inline-flex; }
.alert-bell-active .ds-i, .alert-bell-triggered .ds-i { fill: currentColor; }
.alert-bell-btn .ds-i { width: 17px; height: 17px; }

/* ========================================================= stock analysis */
.an-search-inner { background: var(--surface); border-color: var(--border); border-radius: 10px; }
.an-search-inner:focus-within { border-color: var(--accent); box-shadow: var(--focus-ring); }
.an-results-drop { background: var(--surface); border-color: var(--border2); border-radius: 12px; box-shadow: var(--shadow-pop); }
.an-result-item:hover { background: var(--surface2); transform: none; }
.an-result-sym { font-family: var(--sans); }
.an-stock-hdr { background: var(--surface); border-color: var(--border); border-radius: 14px; }
.an-stock-sym { font-family: var(--sans); letter-spacing: 0; }
.an-qcard:hover, .an-ind-card:hover, .an-extra-card:hover, .an-holding-banner:hover { transform: none; box-shadow: var(--shadow-card); }
.an-qcard-sub { color: var(--dim); }
.an-verdict { font-family: var(--sans); font-weight: 600; border-radius: 999px; }
.an-verdict.BUY, .an-verdict.SELL, .an-verdict.HOLD { border-color: transparent; }
.an-signal { border-color: transparent; font-weight: 500; }
.an-signal:hover { transform: none; }
.an-signal.neutral { border-color: var(--border); }
.an-price-period, .an-sr-period-btn, .an-fhist-period, .an-deals-tab {
  font-family: var(--sans); font-size: 12px; font-weight: 500; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
.an-price-period:hover, .an-sr-period-btn:hover, .an-fhist-period:hover, .an-deals-tab:hover {
  border-color: var(--border2); color: var(--text); background: var(--surface2);
}
.an-price-period.active, .an-sr-period-btn.active, .an-fhist-period.active, .an-deals-tab.active {
  background: var(--ink); color: var(--ink-fg); border-color: transparent;
}
.an-holding-banner, .an-holding-banner.profit, .an-holding-banner.loss { background: var(--surface); border-radius: 14px; }
.an-holding-banner.profit { border-color: color-mix(in srgb, var(--green) 40%, var(--border)); }
.an-holding-banner.loss { border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.an-hb-icon { display: none; }
.an-fund-item { background: var(--surface2); border-color: var(--border); border-radius: 10px; }
.an-fund-item-click:hover { border-color: var(--border2); box-shadow: none; transform: none; }
.an-fund-item-click:hover .an-fund-label { color: var(--text); }
.an-indavg { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-card); }
.an-indavg-legend { background: var(--surface2); }
.an-empty-icon { opacity: .35; }
/* Market dashboard cards and score panels injected by analyse-bundle.js */
.an-md-card { background: var(--surface); border-color: var(--border); border-radius: 14px; box-shadow: var(--shadow-card); }
.an-md-card:hover { border-color: var(--border2); transform: none; box-shadow: var(--shadow-card); }
.an-md-card::before { content: none; }
.an-md-header { font-size: 12.5px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.an-md-val { font-family: var(--sans); font-weight: 600; letter-spacing: -.02em; }
.an-md-chg { font-weight: 600; }
.ss-panel, html.light .ss-panel { background: var(--surface); border-color: var(--border); border-radius: 14px; box-shadow: var(--shadow-card); }
.ss-panel:hover, html.light .ss-panel:hover { border-color: var(--border2); }
.ss-panel-hdr { font-size: 13.5px; font-weight: 600; letter-spacing: -.005em; text-transform: none; color: var(--text); }
@layer ds-force {
  .ss-panel-hdr[style] { color: var(--text) !important; }
  html.light .qfilter-btn.an-active, .qfilter-btn.an-active {
    background: var(--ink) !important; color: var(--ink-fg) !important;
    border: 1px solid transparent !important; box-shadow: none !important; transform: none !important;
  }
}

/* Labels and headline values aren't colour-coded; only gains/losses are. */
.home-hero-val.green { color: var(--text); }
@layer ds-force {
  .scard-label[style*="color"] { color: var(--muted) !important; }
}

/* Section titles that set upper-case inline read as sentence case like everything else. */
@layer ds-force {
  .main [style*="text-transform:uppercase"], .main [style*="text-transform: uppercase"],
  .modal [style*="text-transform:uppercase"], .modal [style*="text-transform: uppercase"] {
    text-transform: none !important;
    letter-spacing: 0 !important;
  }
  .toolbar-title[style*="uppercase"] { font-size: 14px !important; }
}
.auth-badge { text-transform: none; letter-spacing: 0; }

/* ================================================================= toasts */
.toast, .alert-toast {
  background: var(--bg-elevated); color: var(--text);
  border: 1px solid var(--border2); border-radius: 12px;
  box-shadow: var(--shadow-pop); font-family: var(--sans);
}
.toast.error, .toast.success, .toast.info { background: var(--bg-elevated); border-color: var(--border2); }
.toast.error   { color: var(--text); box-shadow: inset 3px 0 0 var(--red), var(--shadow-pop); }
.toast.success { color: var(--text); box-shadow: inset 3px 0 0 var(--green), var(--shadow-pop); }
.toast.info    { color: var(--text); box-shadow: inset 3px 0 0 var(--accent), var(--shadow-pop); }
.alert-toast.toast-up, .alert-toast.toast-lo { background: var(--bg-elevated); border-left: 1px solid var(--border2); }
.alert-toast.toast-up { box-shadow: inset 3px 0 0 var(--red), var(--shadow-pop); }
.alert-toast.toast-lo { box-shadow: inset 3px 0 0 var(--green), var(--shadow-pop); }
.alert-toast-title { font-size: 13px; font-weight: 600; }
.alert-toast-sub { font-size: 12px; color: var(--muted); }

/* Empty decorative "glow circles" placed in card corners (markup and JS templates). */
div[style*="position:absolute"][style*="border-radius:50%"][style*="opacity:"]:empty { display: none; }

/* Remaining tinted surfaces from older page CSS */
.fi-header, html.light .fi-header { background: transparent; }
.scr-ticker-item { background: var(--surface); border-color: var(--border); border-radius: 12px; }
.scr-ticker-item:hover { background: var(--surface2); border-color: var(--border2); transform: none; box-shadow: none; }
.scr-ticker-item-name { font-size: 11.5px; letter-spacing: 0; text-transform: none; }

/* A filled button repeated on every table row is too loud; rows use the quiet style. */
@layer ds-force {
  td .btn-green:not([style*="background"]) {
    background: var(--surface2) !important; color: var(--text) !important; border: 1px solid var(--border2) !important;
  }
  td .btn-green:not([style*="background"]):hover { background: var(--surface3) !important; opacity: 1; }
}
.alert-edit-btn { min-height: 28px; flex-shrink: 0; }
.alert-grid-header { gap: 8px; }
.alert-grid-sym { min-width: 0; flex-wrap: wrap; row-gap: 4px; }

/* ═══ Trading P&L page (tp-*) — layout shell; the JS keeps toggling the ids inside ═══ */
.tp-sources { margin-bottom: 16px; }
.tp-sources-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tp-filter { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 9px 14px; margin-bottom: 14px; box-shadow: var(--shadow-card); }
.tp-filter-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); flex-shrink: 0; }
.tp-filter-opts { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; flex: 1; }
.tp-filter-note { font-size: 11px; font-family: var(--code); color: var(--dim); }
.tp-state { padding: 48px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* hero */
.tp-hero { grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.tp-hero > .scard { min-width: 0; }
.tp-hero-main { padding: 18px 20px !important; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.tp-hero-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tp-hero-period { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--dim); font-family: var(--code); font-size: 11px; }
.tp-hero-net { font-size: 36px !important; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tp-hero-body { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px 28px; flex-wrap: wrap; }
.tp-hero-parts { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; padding-bottom: 6px; }
.tp-part { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tp-part-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); }
.tp-part-v { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.tp-part-v.red { color: var(--red); }
.tp-part-s { font-size: 10.5px; color: var(--dim); }
.tp-part-sep { font-size: 18px; color: var(--dim); line-height: 1.1; }
.tp-hero-main .tp-part-s { margin-top: 2px; }
.tp-tile .scard-val { font-size: 20px; }
.tp-drag { grid-column: 1 / -1; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 16px; }
.tp-drag-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tp-drag-left > .ds-i { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.tp-drag-title { font-size: 12.5px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tp-drag-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.tp-drag-right { display: flex; align-items: center; gap: 12px; min-width: 240px; flex: 1; max-width: 380px; }
.tp-drag-track { flex: 1; height: 8px; background: var(--surface3); border-radius: 4px; overflow: hidden; }
.tp-drag-pct { font-size: 13px; font-weight: 700; color: var(--text); width: 48px; text-align: right; font-variant-numeric: tabular-nums; }

/* NFO / MCX split */
.tp-split { grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.tp-seg { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 16px; display: grid; gap: 6px; min-width: 0; box-shadow: var(--shadow-card); }
.tp-seg-nfo .tp-seg-head { color: var(--blue); }
.tp-seg-mcx .tp-seg-head { color: var(--amber); }
.tp-seg-head { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tp-seg-parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.tp-seg-part.scard { background: var(--surface2) !important; border: 1px solid var(--border) !important; border-radius: var(--radius) !important; padding: 8px 10px !important; box-shadow: none !important; min-width: 0; }
.tp-seg-part .scard-label { font-size: 10.5px; margin-bottom: 2px; }
.tp-seg-part .scard-val { font-size: 15px; white-space: nowrap; }
.tp-seg-part .scard-sub { font-size: 10.5px; white-space: normal; }
.tp-seg-big { font-size: 24px; font-weight: 600; letter-spacing: -.01em; color: var(--text); font-variant-numeric: tabular-nums; }
.tp-seg-sub { font-size: 11px; color: var(--dim); }

/* tabs */
.tp-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tp-tabs::-webkit-scrollbar { display: none; }
.tp-tab { appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 10px 14px; font: 500 13px var(--sans); color: var(--muted); cursor: pointer; white-space: nowrap; }
.tp-tab:hover { color: var(--text); }
.tp-tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tp-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 6px; }
.tp-panel { display: none; }
.tp-panel.active { display: block; }
.tp-stack { display: grid; gap: 14px; margin-bottom: 14px; }

/* cards and boxes */
.tp-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px 16px; box-shadow: var(--shadow-card); min-width: 0; }
.tp-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.tp-card-title { font-size: 13px; font-weight: 600; color: var(--text); display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tp-card-sub { font-size: 11.5px; font-weight: 400; color: var(--dim); }
.tp-card-sub.mono { font-family: var(--code); }
.tp-head-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tp-grid6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.tp-grid5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.tp-grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tp-box { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; min-width: 0; }
.tp-box-lg { padding: 12px 14px; }
.tp-box-purple { background: var(--purple-bg); border-color: transparent; }
.tp-k { font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.tp-k.amber { color: var(--amber); } .tp-k.green { color: var(--green); } .tp-k.purple { color: var(--purple); }
.tp-v { font-size: 18px; font-weight: 600; letter-spacing: -.01em; color: var(--text); font-variant-numeric: tabular-nums; }
.tp-v-lg { font-size: 24px; font-weight: 600; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.tp-v.red, .tp-v-lg.red { color: var(--red); } .tp-v.green, .tp-v-lg.green { color: var(--green); } .tp-v.amber, .tp-v-lg.amber { color: var(--amber); }
.tp-v.blue, .tp-v-lg.blue { color: var(--blue); } .tp-v.purple, .tp-v-lg.purple { color: var(--purple); } .tp-v.muted { color: var(--muted); }
.tp-s { font-size: 11px; color: var(--dim); margin-top: 2px; }
.tp-nm { font-size: 11px; font-family: var(--code); color: var(--muted); margin-top: 3px; }
.tp-hint { font-size: 11px; color: var(--dim); line-height: 1.5; margin-top: 6px; }
.tp-curve { row-gap: 10px; }
.tp-chg-bar { margin-top: 12px; height: 8px; border-radius: 4px; overflow: hidden; display: flex; gap: 1px; }
.tp-chg-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 11px; color: var(--muted); }

/* collapsibles (chart, tax) */
.tp-collapsible { margin-bottom: 14px; }
.tp-collapsible-head { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 11px 16px; cursor: pointer; font-family: var(--sans); text-align: left; color: var(--text); }
.tp-collapsible-head:hover { border-color: var(--border2); }
.tp-collapsible-body { background: var(--surface); border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius-lg) var(--radius-lg); padding: 14px 16px 16px; }
.tp-chev { font-size: 11px; color: var(--muted); transition: transform .2s; display: inline-block; cursor: pointer; }
.tp-chip-row { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }

/* tax controls + ITR steps */
.tp-tax-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tp-field { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--dim); }
.tp-input { font: 12px var(--sans); padding: 5px 9px; border-radius: var(--radius); border: 1px solid var(--border2); background: var(--surface2); color: var(--text); outline: none; }
.tp-input.mono { font-family: var(--code); }
.tp-input:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.tp-itr { margin-top: 16px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; }
.tp-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: step; }
.tp-steps > li { counter-increment: step; display: grid; grid-template-columns: 24px 1fr; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.tp-steps > li::before { content: counter(step); width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border2); color: var(--muted); font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.tp-step-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 12px; }
.tp-step-head .mono { font-family: var(--code); font-weight: 600; font-size: 12.5px; }
.tp-step-head .mono.green { color: var(--green); } .tp-step-head .mono.red { color: var(--red); } .tp-step-head .mono.purple { color: var(--purple); } .tp-step-head .mono.blue { color: var(--blue); }
.tp-step-body { grid-column: 2; font-size: 11.5px; color: var(--muted); line-height: 1.55; }
.tp-step-body strong { color: var(--purple); } .tp-step-body small { color: var(--dim); font-size: 10.5px; }
.tp-step-purple { border-color: var(--purple) !important; } .tp-step-blue { border-color: var(--blue) !important; }
.tp-exp-breakdown { margin: 8px 0; padding: 8px; background: var(--surface2); border: 1px dashed var(--border2); border-radius: 6px; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 11px; color: var(--text); }

@media (max-width: 1100px) { .tp-grid6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .tp-grid5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .tp-hero { grid-template-columns: 1fr 1fr; } .tp-hero-main { grid-column: 1 / -1; } }
@media (max-width: 700px) { .tp-grid6, .tp-grid5, .tp-grid4 { grid-template-columns: 1fr 1fr; } .tp-hero { grid-template-columns: 1fr; } .tp-split { grid-template-columns: 1fr; } .tp-hero-net { font-size: 30px !important; } .tp-filter { position: static; } }

/* The legacy sheet pins #tpnl-cards / #tpnl-cards2 column counts with !important at <=1400px;
   important declarations in an earlier layer win, so the hero grid is fixed here. */
@layer ds-force {
  #tpnl-cards.tp-hero { grid-template-columns: 2fr 1fr 1fr 1fr !important; }
  #tpnl-cards2.tp-split { grid-template-columns: 1fr 1fr 1fr !important; }
  @media (max-width: 1100px) { #tpnl-cards.tp-hero { grid-template-columns: 1fr 1fr 1fr !important; } }
  @media (max-width: 700px) { #tpnl-cards.tp-hero, #tpnl-cards2.tp-split { grid-template-columns: 1fr !important; } }
}

/* broker source cards (rendered by renderSourceRow) */
.tp-bcard.scard { background: var(--surface) !important; border: 1px solid var(--border) !important; border-radius: var(--radius-lg) !important; padding: 14px 16px !important; display: grid; gap: 10px; box-shadow: var(--shadow-card) !important; min-width: 0; }
.tp-bcard.active { border-color: var(--accent) !important; }
.tp-bcard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.tp-bcard-id { display: flex; align-items: center; gap: 9px; min-width: 0; }
.tp-bcard-txt { min-width: 0; }
.tp-bcard-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bc, var(--accent)); flex-shrink: 0; }
.tp-bcard-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-bcard-status { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.tp-bcard-acts { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.tp-bcard-ico { appearance: none; border: 0; background: none; color: var(--dim); width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.tp-bcard-ico:hover { background: var(--surface2); color: var(--text); }
.tp-bcard-ico .ds-i { width: 14px; height: 14px; }
.tp-bcard-filter { font: 500 11px var(--sans); padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border2); background: var(--surface2); color: var(--muted); cursor: pointer; white-space: nowrap; }
.tp-bcard-filter:hover { color: var(--text); border-color: var(--border2); }
.tp-bcard-filter.active { background: var(--blue-bg); color: var(--accent); border-color: transparent; font-weight: 600; }
.tp-bcard-net { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tp-bcard-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); }
.tp-bcard-netv { font-size: 22px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.tp-bcard-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; border-top: 1px solid var(--border); padding-top: 8px; }
.tp-bcard-row > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; align-items: flex-start; text-align: left; }
.tp-bcard-row > div:last-child { align-items: flex-end; text-align: right; }
.tp-bcard-row .bcard-val { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: inherit !important; width: auto !important; }
.tp-bcard-netv { text-align: right !important; }
.tp-bcard-row .bcard-val.red { color: var(--red); }
@layer ds-force {
  .tp-bcard-row > div:first-child .bcard-val { text-align: left !important; }
  .tp-bcard-row > div:last-child .bcard-val, .tp-bcard-netv { text-align: right !important; }
  .tp-bcard-row .bcard-val { font-size: 13px !important; }
}

/* Trading P&L chart panes */
.tp-chart-stack { display: grid; gap: 14px; width: 100%; }
.tp-chart-pane { display: grid; gap: 4px; min-width: 0; }
.tp-chart-pane-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; padding: 0 2px; }
.tp-chart-pane-title { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tp-chart-legend { display: inline-flex; gap: 12px; font-size: 11px; color: var(--muted); }
.tp-chart-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.tp-chart-readout { margin-left: auto; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tp-chart-readout b { color: var(--text); font-weight: 600; }
.tp-chart-canvas { position: relative; width: 100%; }

/* people: account holders and the per-person tax switch */
.tp-person-switch { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tp-person-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.tp-person-btn { appearance: none; display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 12px; border-radius: var(--radius); border: 1px solid var(--border2); background: var(--surface); color: var(--text); font: 500 12.5px var(--sans); cursor: pointer; }
.tp-person-btn small { font-size: 10.5px; color: var(--dim); font-weight: 400; }
.tp-person-btn.active { border-color: var(--accent); background: var(--blue-bg); color: var(--accent); }
.tp-person-btn.active small { color: var(--accent); opacity: .8; }
.tp-bcard-person { display: inline-block; font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--purple-bg); color: var(--purple); margin-left: 6px; vertical-align: middle; }
.bmgr-person { flex-shrink: 0; }

/* ── Income page: who received an entry, person filter ───────────────────────────── */
.mi-inc-person{margin-left:4px;padding-left:5px;border-left:1px solid rgba(31,204,138,.35);color:var(--muted);font-weight:600}
#mi-person-filter{margin-bottom:14px}
#income-person-sel{width:100%}

/* ═══ Income & Expenses page (mi-*) — hero + tabs shell; the ids inside are driven by the JS ═══ */
.mi-hero { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.mi-hero > .scard { min-width: 0; }
.mi-hero-main .tp-hero-net { font-size: 34px !important; }
.mi-this-month { font-family: var(--code); }
.mi-hero-side { display: flex; flex-direction: column; justify-content: center; align-items: stretch; padding: 14px 16px !important; margin: 0 !important; text-align: left; border-color: var(--border); }
.mi-hero-side > * + * { margin-top: 6px; }
.mi-hero-side .tp-v-lg { font-size: 22px; }
.mi-hero-side .tp-k { margin-bottom: 0; }
.mi-hero-btn { font: inherit; color: inherit; cursor: pointer; width: 100%; }
.mi-hero-btn:hover, .mi-box-btn:hover { border-color: var(--border2); }
.mi-hero-btn:focus-visible, .mi-box-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.mi-k-hint { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--dim); margin-left: 4px; }
.mi-side-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.mi-side-val { font-size: 12px; font-weight: 600; }
.mi-hero-side .mi-runway-badge { align-self: flex-start; font-size: 10.5px; padding: 3px 9px; }
.mi-meter { position: relative; height: 8px; border-radius: 4px; background: var(--surface3); overflow: hidden; }
.mi-meter-mark { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--accent); z-index: 2; }
.mi-meter-fill { height: 100%; width: 0; background: var(--green); border-radius: 4px; transition: width .4s, background-color .4s; }
.mi-tiles { margin-bottom: 14px; }
.mi-box-btn { cursor: pointer; }
.mi-chart-card { margin-bottom: 14px; }
.mi-chart-canvas { height: 280px; position: relative; }
.mi-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.mi-bars { display: flex; flex-direction: column; gap: 6px; }
.mi-bars-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 18px; }
.mi-table-card { padding: 0 !important; overflow: hidden; }
.mi-table-card > .tp-card-head { padding: 14px 16px 10px; margin: 0; border-bottom: 1px solid var(--border); }
.mi-table-scroll { overflow-x: auto; }
.mi-table { width: 100%; border-collapse: collapse; }
.mi-table th { font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 9px 12px; background: var(--surface2); white-space: nowrap; }
.mi-table td { padding: 9px 12px; border-top: 1px solid var(--border); font-size: 12.5px; vertical-align: middle; }
.mi-table tbody tr:hover td { background: var(--surface2); }
#mi-panel-insights .ins-section, #mi-slot-insights > div { margin-top: 0; }
@media (max-width: 1100px) { .mi-hero { grid-template-columns: 1fr 1fr 1fr; } .mi-hero-main { grid-column: 1 / -1; } .mi-bars-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .mi-hero { grid-template-columns: 1fr; } .mi-two { grid-template-columns: 1fr; } .mi-bars-grid { grid-template-columns: 1fr 1fr; } .mi-chart-canvas { height: 220px; } .mi-hero-main .tp-hero-net { font-size: 30px !important; } .mi-hero-side .tp-v-lg { font-size: 20px; } }

/* ═══ Net Worth page (nw-*) — hero + tabs shell; reuses the hero, meter and table components above ═══ */
.tp-part-v.blue { color: var(--blue); } .tp-part-v.green { color: var(--green); } .tp-part-v.purple { color: var(--purple); } .tp-part-v.amber { color: var(--amber); }
.nw-hero .tp-hero-parts { gap: 12px; }
.nw-liab-fill { background: var(--red); }
.mi-side-val.red { color: var(--red); }
.nw-tiles { margin-bottom: 14px; }
.nw-two { display: grid; grid-template-columns: 320px 1fr; gap: 14px; margin-bottom: 14px; align-items: start; }
.nw-donut-wrap { position: relative; width: 200px; margin: 4px auto 14px; }
.nw-donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; gap: 2px; }
.nw-donut-center .mono { font-size: 15px; font-weight: 700; color: var(--text); }
.nw-legend { display: flex; flex-direction: column; gap: 6px; }
.nw-manual { margin-bottom: 14px; }
.nw-manual-debt { border-color: rgba(240, 82, 74, .25); }
.nw-edit-table td { padding: 6px 10px; }
.nw-edit-table .pf-input { min-width: 0; }
.nw-fi-cur { display: inline-flex; border: 1px solid var(--border2); border-radius: 20px; overflow: hidden; background: var(--surface2); }
.nw-fi-cur .fi-cur-btn { padding: 4px 12px; font: 600 11.5px var(--code); cursor: pointer; background: none; border: 0; color: var(--muted); }
.nw-fi-cur .fi-cur-btn.active { background: var(--purple-bg); color: var(--purple); }
.nw-fi-controls { margin-bottom: 8px; }
.nw-fi-refresh { background: none; border: 0; cursor: pointer; color: var(--dim); padding: 0 2px; line-height: 1; display: inline-flex; }
.nw-fi-refresh .ds-i { width: 12px; height: 12px; }
.nw-fi-hint { margin: 0 0 12px; }
.nw-fi-stats { margin-bottom: 14px; }
.nw-fi-progress { display: grid; gap: 8px; }
.nw-fi-track { height: 10px; }
#nw-panel-insights .ins-section, #nw-slot-insights > div { margin-top: 0; }
@media (max-width: 1100px) { .nw-two { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .nw-hero .tp-hero-parts { gap: 10px; } .nw-hero .tp-part-sep { display: none; } }

/* ═══ Stock Analysis (ana-*) — landing strip, lists, screener; stock page hero, technicals, financials ═══ */
#page-analyse .an-search-inner { border-radius: var(--radius-lg); padding: 10px 14px; background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-card); }
#page-analyse .an-search-inner input { font-size: 14px; }
#page-analyse .an-results-drop { border-radius: var(--radius-lg); border-color: var(--border); overflow: hidden; }
#page-analyse .an-result-item { padding: 11px 16px; }
#page-analyse .an-result-item:hover { transform: none; }
#page-analyse .an-home-btn { border-radius: var(--radius); padding: 7px 10px; display: inline-flex; align-items: center; }
.ana-chg { display: inline-block; font: 600 11px var(--code); padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.ana-chg.up { color: var(--green); background: var(--green-bg); } .ana-chg.dn { color: var(--red); background: var(--red-bg); }
.ana-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ana-idx { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px 12px; display: grid; gap: 4px; min-width: 0; box-shadow: var(--shadow-card); }
.ana-idx-name { font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ana-idx-val { font-size: 17px; font-weight: 600; color: var(--text); letter-spacing: -.01em; }
.ana-idx .ana-chg { justify-self: start; }
.ana-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin-bottom: 14px; }
.ana-list .tp-card-head { margin-bottom: 4px; }
.tp-card-title.up { color: var(--green); } .tp-card-title.dn { color: var(--red); }
.ana-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 8px 2px; background: none; border: 0; border-bottom: 1px solid var(--border); font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.ana-row:last-child { border-bottom: 0; } .ana-row:hover { background: var(--surface2); } .ana-row.static { cursor: default; } .ana-row.static:hover { background: none; }
.ana-row-sym { font-weight: 600; font-size: 12.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ana-row-sym small { display: block; font-size: 10.5px; font-weight: 400; color: var(--dim); }
.ana-row-right { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.ana-news-card { margin-bottom: 14px; } .ana-news-list { display: grid; gap: 2px; }
.ana-news { display: grid; gap: 3px; padding: 9px 2px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.ana-news:last-child { border-bottom: 0; } .ana-news:hover .ana-news-title { color: var(--accent); }
.ana-news-title { font-size: 13px; font-weight: 500; line-height: 1.4; color: var(--text); } .ana-news-meta { font-size: 11px; color: var(--dim); }
.ana-screener .tp-card-head { padding: 14px 16px 10px; }
.ana-scr-tools { gap: 8px; } .ana-presets { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 12px; border-bottom: 1px solid var(--border); }
.ana-seg { display: inline-flex; border: 1px solid var(--border2); border-radius: 20px; overflow: hidden; background: var(--surface2); }
.ana-seg button { padding: 5px 12px; font: 600 11.5px var(--sans); color: var(--muted); background: none; border: 0; cursor: pointer; }
.ana-seg button.active { background: var(--ink); color: var(--ink-fg); }
.ana-scr-table th { user-select: none; } .ana-scr-table td { font-size: 12px; }
.ana-scr-table tbody tr[onclick] { cursor: pointer; }
.ana-updated { font-size: 11px; color: var(--dim); text-align: center; padding: 10px 0 4px; }

/* stock page */
.ana-pos { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--green); border-radius: var(--radius-lg); padding: 12px 16px; margin-bottom: 12px; }
.ana-pos.dn { border-left-color: var(--red); } .ana-pos-main { font-size: 15px; font-weight: 600; color: var(--text); }
.ana-pos-pnl { font-size: 20px; font-weight: 600; color: var(--green); display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; } .ana-pos.dn .ana-pos-pnl { color: var(--red); } .ana-pos-pnl small { font-size: 11.5px; font-weight: 500; }
.ana-hero { margin-bottom: 12px; padding: 16px 18px 14px; }
.ana-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ana-hero-sym { font: 600 13px var(--code); color: var(--accent); letter-spacing: .06em; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ana-tag { font: 600 10px var(--sans); letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; background: var(--blue-bg); color: var(--accent); }
.ana-tag.muted { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.ana-hero-name { font-size: 20px; font-weight: 600; letter-spacing: -.02em; color: var(--text); margin-top: 2px; }
.ana-hero-id a { color: var(--accent); text-decoration: none; }
.ana-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } .ana-wl { width: auto; }
.ana-hero-body { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.ana-price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; } .ana-price-val { font-size: 34px; font-weight: 600; letter-spacing: -.02em; color: var(--text); line-height: 1; }
.ana-verdict { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius); background: var(--surface2); border: 1px solid var(--border); }
.ana-verdict-tag { font: 700 12px var(--code); letter-spacing: .08em; padding: 3px 9px; border-radius: 6px; background: var(--surface3); color: var(--text); }
.ana-verdict.BUY .ana-verdict-tag { background: var(--green-bg); color: var(--green); } .ana-verdict.SELL .ana-verdict-tag { background: var(--red-bg); color: var(--red); } .ana-verdict.HOLD .ana-verdict-tag { background: var(--amber-bg); color: var(--amber); }
.ana-verdict-sub { font-size: 11.5px; color: var(--muted); }
.ana-hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.ana-hs { display: grid; gap: 3px; min-width: 0; } .ana-hs .mono { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .ana-hs .tp-k { margin: 0; }
.ana-range { position: relative; display: block; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--red), var(--amber), var(--green)); opacity: .9; margin-top: 2px; }
.ana-range i { position: absolute; top: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--text); border: 2px solid var(--surface); transform: translateX(-50%); }
.ana-signals { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.ana-sig { font: 600 11px var(--sans); padding: 4px 10px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface2); color: var(--muted); }
.ana-sig.bullish { color: var(--green); background: var(--green-bg); border-color: transparent; } .ana-sig.bearish { color: var(--red); background: var(--red-bg); border-color: transparent; } .ana-sig.neutral { color: var(--amber); background: var(--amber-bg); border-color: transparent; }
.ana-stats { margin-bottom: 12px; } .ana-stats .tp-v { font-size: 16px; }
.ana-chart-card { margin-bottom: 12px; } .ana-chart-card .tp-card-head { margin-bottom: 6px; }
.ana-periods { display: inline-flex; gap: 2px; background: var(--surface2); border: 1px solid var(--border); border-radius: 20px; padding: 2px; }
.ana-periods .an-price-period { background: none; border: 0; color: var(--muted); padding: 4px 10px; border-radius: 16px; font: 600 10.5px var(--sans); cursor: pointer; }
.ana-periods .an-price-period:hover { color: var(--text); } .ana-periods .an-price-period.active { background: var(--ink); color: var(--ink-fg); }
.ana-canvas { position: relative; height: 280px; } .ana-canvas.short { height: 220px; }
.ana-slider { display: flex; align-items: center; gap: 8px; margin-top: 8px; } .ana-slider input[type=range] { flex: 1; accent-color: var(--accent); }
.ana-tech { margin-bottom: 12px; }
.ana-tech-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 18px; }
.ana-kv > span:first-child { white-space: nowrap; }
.ana-kv { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.ana-kv:last-child { border-bottom: 0; } .ana-kv .mono { color: var(--text); font-weight: 600; white-space: nowrap; }
.ana-kv .mono.up, .ana-kv em.up { color: var(--green); } .ana-kv .mono.dn, .ana-kv em.dn { color: var(--red); } .ana-kv em { font-style: normal; font: 600 10px var(--sans); text-transform: uppercase; letter-spacing: .05em; margin-left: 4px; }
button.ana-kv.clickable { cursor: pointer; font: inherit; } button.ana-kv.clickable:hover { color: var(--text); } .ana-kv .ds-i { width: 11px; height: 11px; color: var(--dim); vertical-align: -1px; margin-left: 2px; }
.ana-gauge { position: relative; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--green) 0 30%, var(--surface3) 30% 70%, var(--red) 70% 100%); margin: 6px 0 4px; }
.ana-gauge b { position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--border2); } .ana-gauge i { position: absolute; top: -3px; width: 12px; height: 12px; border-radius: 50%; background: var(--text); border: 2px solid var(--surface); transform: translateX(-50%); }
.ana-sr-btns { display: inline-flex; gap: 2px; margin-left: 6px; } .ana-sr-btns .an-sr-period-btn { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 6px; padding: 1px 6px; font: 600 10px var(--sans); cursor: pointer; text-transform: none; letter-spacing: 0; }
.ana-sr-btns .an-sr-period-btn.active { background: var(--ink); color: var(--ink-fg); border-color: transparent; }
.ana-three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.ana-three .an-extra-card { margin: 0; }
.ana-fin { margin-bottom: 12px; } .ana-fin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 22px; }
.ana-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.ana-pc ul { margin: 6px 0 0; padding-left: 16px; display: grid; gap: 5px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.ana-pc.pros .tp-k { color: var(--green); } .ana-pc.cons .tp-k { color: var(--amber); } .ana-pc.pros li::marker { color: var(--green); } .ana-pc.cons li::marker { color: var(--amber); }
.ana-block { margin-bottom: 12px; } .ana-block .an-indavg { margin-bottom: 0; }
#an-stock-content .an-est-section { margin-bottom: 12px; }
.ana-about p { font-size: 12.5px; line-height: 1.65; color: var(--muted); margin: 0; }
.ana-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 2px 20px; } .ana-foot a { font-size: 12px; color: var(--accent); text-decoration: none; font-weight: 500; }
@media (max-width: 1100px) { .ana-fin-grid { grid-template-columns: 1fr 1fr; } .ana-three { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .ana-lists, .ana-three, .ana-fin-grid, .ana-two, .ana-tech-grid { grid-template-columns: 1fr; } .ana-hero-stats { grid-template-columns: 1fr 1fr; } .ana-price-val { font-size: 28px; } .ana-canvas { height: 220px; } .ana-strip { grid-template-columns: 1fr 1fr; } .ana-scr-tools { width: 100%; } .ana-scr-tools .tp-input:first-child { flex: 1; } }

/* monthly breakdown: realised part of the portfolio P&L */
.perf-realised { display: block; font-size: 10px; font-weight: 500; color: var(--dim); margin-top: 1px; }

/* ═══ Recurring income & expenses ═══ */
.mi-rec-check { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text); cursor: pointer; padding: 8px 10px; border: 1px dashed var(--border2); border-radius: var(--radius); }
.mi-rec-check input { accent-color: var(--accent); }
.mi-rec-check span { font-size: 11px; color: var(--dim); }
.mi-rec-mark { margin-left: 3px; color: var(--accent); font-weight: 700; }
.mi-rec-list { display: grid; gap: 6px; max-height: 46vh; overflow-y: auto; }
.mi-rec-row { display: grid; grid-template-columns: auto 1fr auto auto auto; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface2); }
.mi-rec-row.paused { opacity: .6; }
.mi-rec-kind { font: 600 10px var(--sans); letter-spacing: .05em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; }
.mi-rec-kind.income { background: var(--green-bg); color: var(--green); } .mi-rec-kind.expense { background: var(--red-bg); color: var(--red); }
.mi-rec-main { display: grid; gap: 2px; min-width: 0; } .mi-rec-main b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .mi-rec-main small { font-size: 11px; color: var(--dim); }
.mi-rec-amt { font-size: 13px; font-weight: 600; white-space: nowrap; } .mi-rec-amt.income { color: var(--green); } .mi-rec-amt.expense { color: var(--red); } .mi-rec-amt small { font-size: 10px; color: var(--dim); font-weight: 400; }
.mi-rec-add { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.mi-rec-grid { display: grid; grid-template-columns: 110px 1fr 1fr 120px; gap: 8px; margin-top: 6px; }
.mi-rec-grid > * { min-width: 0; } .mi-rec-grid #mi-rec-person-wrap select { width: 100%; }
@media (max-width: 700px) { .mi-rec-row { grid-template-columns: auto 1fr; } .mi-rec-row .btn, .mi-rec-amt { grid-column: span 1; } .mi-rec-grid { grid-template-columns: 1fr 1fr; } }

/* ═══ Net worth: owner column + by-person card ═══ */
#page-networth .nw-person-col { display: none; }
#page-networth.nw-multi .nw-person-col { display: table-cell; }
.nw-owner { font-size: 12px !important; padding: 5px 8px !important; width: auto; max-width: 140px; }
#nw-by-person { margin-bottom: 14px; }

/* ═══ Portfolio page (pf-*) — hero, benchmark strip, tabs; the inner blocks keep their own classes ═══ */
.pf-hero .pf-hero-main { padding: 18px 20px; display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 0; }
.pf-hero .mi-hero-side { padding: 14px 16px; }
.pf-hero-val { font-size: 34px; font-weight: 600; letter-spacing: -.02em; line-height: 1.05; color: var(--text); font-variant-numeric: tabular-nums; }
#page-portfolio #pf-pnl { font-size: 16px; font-weight: 600; margin: 0; }
#page-portfolio #pf-day-chg { font-size: 22px; font-weight: 600; margin: 0; }
#page-portfolio #pf-pnl.green, #page-portfolio #pf-day-chg.green { color: var(--green); }
#page-portfolio #pf-pnl.red, #page-portfolio #pf-day-chg.red { color: var(--red); }
#page-portfolio .pf-benchmark-bar { flex-wrap: wrap; gap: 10px; padding: 0; background: none; border: 0; box-shadow: none; margin-bottom: 14px; }
#page-portfolio .pf-bench-divider { display: none; }
#page-portfolio .pf-bench-item { flex: 1 1 150px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px 12px; box-shadow: var(--shadow-card); min-width: 0; }
#page-portfolio .pf-bench-label-icon { display: none; }
#page-portfolio .pf-bench-label { font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
#page-portfolio .pf-bench-val { font-size: 17px; font-weight: 600; }
/* collapsibles live inside tabs now: no toggle, always open */
#page-portfolio #pf-analytics-toggle, #page-portfolio #wl-movers-toggle { display: none !important; }
#page-portfolio #pf-analytics-body, #page-portfolio #wl-movers-body { max-height: none !important; opacity: 1 !important; overflow: visible !important; }
#page-portfolio .pf-toolbar-card { border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-bottom: none; margin-bottom: 0; }
#pf-panel-insights .ins-section, #pf-slot-insights > div { margin-top: 0; }
@media (max-width: 700px) { .pf-hero-val { font-size: 28px; } #page-portfolio .pf-bench-item { flex-basis: 140px; } }

/* ═══ Lending & Borrowing (ln-*) ═══ */
.ln-hero { grid-template-columns: 2fr 1fr 1fr 1fr; }
.ln-hero .ln-hero-main { padding: 18px 20px; display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 0; }
.ln-hero .mi-hero-side { padding: 14px 16px; }
.ln-hero-val { font-size: 32px; font-weight: 600; letter-spacing: -.02em; line-height: 1.05; color: var(--text); }
.tp-v-lg.red { color: var(--red); }
.ln-list { margin-bottom: 14px; }
.ln-row { cursor: pointer; } .ln-row.closed { opacity: .6; }
.ln-chip { display: inline-block; font: 600 10px var(--sans); letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; background: var(--surface2); color: var(--muted); border: 1px solid var(--border); text-transform: uppercase; }
.ln-chip.amber { background: var(--amber-bg); color: var(--amber); border-color: transparent; } .ln-chip.blue { background: var(--blue-bg); color: var(--accent); border-color: transparent; } .ln-chip.red { background: var(--red-bg); color: var(--red); border-color: transparent; }
.ln-due { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ln-acts { white-space: nowrap; text-align: right; } .ln-acts .btn { padding: 3px 7px; min-height: 0; }
.ln-del { color: var(--red); }
.ln-paid { background: var(--green-bg); color: var(--green); border-color: transparent; font-weight: 600; }
.ln-empty { padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }
.ln-back-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ln-settings { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; padding: 12px 16px; }
.ln-radio { display: inline-flex; align-items: center; gap: 5px; color: var(--text); cursor: pointer; font-size: 12px; } .ln-radio input { accent-color: var(--accent); }
.ln-type { font: 500 10.5px var(--sans); padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.ln-date { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ln-notes { font-size: 11.5px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-table tr.ln-pending td { background: color-mix(in srgb, var(--amber-bg) 60%, transparent); }
@media (max-width: 1100px) { .ln-hero { grid-template-columns: 1fr 1fr 1fr; } .ln-hero .ln-hero-main { grid-column: 1 / -1; } }
@media (max-width: 700px) { .ln-hero { grid-template-columns: 1fr; } .ln-hero-val { font-size: 28px; } }

/* ═══ Watchlists, explorers, SGB, alerts, settings — same card language as the redesigned pages ═══ */
:is(#page-tracker,#page-stockwl,#page-uswl,#page-sgbpage) .summary-grid { gap: 10px; margin-bottom: 14px; }
:is(#page-tracker,#page-stockwl,#page-uswl,#page-sgbpage) .summary-grid .scard-label { font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
:is(#page-tracker,#page-stockwl,#page-uswl,#page-sgbpage) .summary-grid .scard-val { font-size: 22px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.15; }
:is(#page-tracker,#page-stockwl,#page-uswl,#page-sgbpage) .summary-grid .scard-sub { font-size: 11px; color: var(--dim); margin-top: 2px; }
:is(#page-tracker,#page-stockwl,#page-uswl,#page-sgbpage,#page-stockpage,#page-navpage,#page-alerts,#page-settings) .table-wrap { border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-card); overflow: hidden; }
:is(#page-tracker,#page-stockwl,#page-uswl,#page-sgbpage,#page-stockpage,#page-navpage,#page-alerts,#page-settings) .table-toolbar { padding: 12px 16px; border-bottom: 1px solid var(--border); }
:is(#page-tracker,#page-stockwl,#page-uswl,#page-sgbpage,#page-stockpage,#page-navpage,#page-alerts,#page-settings) .toolbar-title { font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text); }
:is(#page-tracker,#page-stockwl,#page-uswl,#page-sgbpage,#page-stockpage,#page-navpage,#page-alerts,#page-settings) .table-wrap table th { font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: var(--surface2); white-space: nowrap; }
:is(#page-tracker,#page-stockwl,#page-uswl,#page-sgbpage,#page-stockpage,#page-navpage,#page-alerts,#page-settings) .table-wrap table tbody tr:hover td { background: var(--surface2); }
:is(#page-tracker,#page-stockwl,#page-uswl,#page-sgbpage,#page-stockpage,#page-navpage,#page-alerts,#page-settings) .note-bar { font-size: 11px; color: var(--dim); background: transparent; border-top: 1px solid var(--border); }
:is(#page-tracker,#page-stockwl,#page-uswl,#page-sgbpage,#page-stockpage,#page-navpage,#page-alerts,#page-settings) .qfilter-btn, :is(#page-tracker,#page-stockwl,#page-uswl,#page-sgbpage,#page-stockpage,#page-navpage,#page-alerts,#page-settings) .filter-btn { border-radius: 20px; font-size: 11.5px; }
.al-tiles { margin-bottom: 10px; }
#page-alerts .alert-grid-container { gap: 12px; }
@layer ds-force {
  :is(#page-tracker,#page-stockwl,#page-uswl,#page-sgbpage) .summary-grid .scard { padding: 12px 14px !important; background: var(--surface) !important; border: 1px solid var(--border) !important; border-radius: var(--radius-lg) !important; box-shadow: var(--shadow-card) !important; }
  :is(#page-tracker,#page-stockwl,#page-uswl,#page-sgbpage) .summary-grid .scard::before, :is(#page-tracker,#page-stockwl,#page-uswl,#page-sgbpage) .summary-grid .scard::after { display: none !important; }
}
@media (max-width: 1100px) { .al-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .al-tiles { grid-template-columns: 1fr 1fr; } }

/* ═══ Tax page (tx-*) — the estimator is always open here; the Tax picture and ITR steps are cards ═══ */
#page-tax .tp-person-switch { margin-bottom: 14px; }
#page-tax #tpnl-tax-wrap { margin-bottom: 14px; }
#page-tax #tpnl-tax-wrap .tp-collapsible-head { pointer-events: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
#page-tax #tpnl-tax-wrap #tpnl-tax-arrow { display: none; }
#page-tax #tpnl-tax-body { max-height: none !important; opacity: 1 !important; overflow: visible !important; }
#page-tax #tp-slot-taxcenter { margin-bottom: 14px; }
#page-tax #tp-slot-taxcenter .ins-section { margin-top: 0; }
#page-tax .tx-itr-card .tp-itr { margin-top: 0; background: var(--surface); box-shadow: var(--shadow-card); }
.tx-loading { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; margin-bottom: 14px; padding: 14px 16px; }

/* ═══ Tax page: smart suggestions ═══ */
.tx-smart { margin-bottom: 14px; }
.tx-smart .tp-card-head { margin-bottom: 8px; }
.tx-smart-total { font-size: 12.5px; color: var(--muted); } .tx-smart-total b { color: var(--green); font-size: 15px; font-family: var(--code); }
.tx-sg { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: start; padding: 12px 2px; border-top: 1px solid var(--border); }
.tx-sg:first-child { border-top: 0; }
.tx-sg-ico { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--surface2); color: var(--muted); }
.tx-sg-ico .ds-i { width: 15px; height: 15px; }
.tx-sg.save .tx-sg-ico { background: var(--green-bg); color: var(--green); }
.tx-sg.warn .tx-sg-ico { background: var(--amber-bg); color: var(--amber); }
.tx-sg.info .tx-sg-ico { background: var(--blue-bg); color: var(--accent); }
.tx-sg-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.35; }
.tx-sg-detail { font-size: 12px; color: var(--muted); line-height: 1.55; margin-top: 3px; }
.tx-sg-detail b { color: var(--text); font-weight: 600; }
.tx-sg-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 110px; }
.tx-sg-save { font-size: 15px; font-weight: 600; color: var(--green); white-space: nowrap; }
.tx-sg-k { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.tx-sg-side .btn { white-space: nowrap; }
@media (max-width: 700px) { .tx-sg { grid-template-columns: 28px 1fr; } .tx-sg-side { grid-column: 2; align-items: flex-start; flex-direction: row; flex-wrap: wrap; gap: 8px; min-width: 0; } }
/* Portfolio "Needs a decision" and Home "Top decisions": rows reuse the Tax page's .tx-sg */
.pf-dec-card { margin: 0 0 14px; }
.tx-sg.loss .tx-sg-ico { background: var(--red-bg); color: var(--red); }
.pf-dec .tx-sg-title .ln-chip { margin-left: 6px; vertical-align: 1px; }
.pf-dec-more { margin-top: 8px; }
.pf-dec-home .tx-sg { padding: 10px 0; }
.pf-dec-home .tx-sg-detail { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Home → Yearly Performance: "what it takes" tiles, month-by-month chart, slimmer monthly table */
.tp-k.red { color: var(--red); }
.perf-need { margin-bottom: 18px; }
.perf-need .tp-v { font-size: 16px; }
.perf-need .tp-s { line-height: 1.45; }
.perf-chart-card { margin-bottom: 18px; }
.perf-chart-card .tp-card-head { align-items: center; margin-bottom: 8px; }
.perf-chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 8px; font-size: 11.5px; color: var(--muted); }
.perf-lg { display: inline-flex; align-items: center; gap: 6px; }
.perf-lg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.perf-lg i.dash { width: 16px; height: 0; border-radius: 0; border-top: 2px dashed; }
.perf-chart-box { position: relative; height: 230px; }
.perf-pct { color: var(--dim); font-size: 11px; }
.perf-hit { color: var(--green); font-weight: 700; margin-right: 6px; }
.perf-month-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.perf-month-btn:hover { color: var(--accent); }
.perf-month-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 4px; }
.perf-caret { font-size: 9px; color: var(--dim); transition: transform .15s; display: inline-block; }
.perf-month-btn[aria-expanded="true"] .perf-caret { transform: rotate(90deg); }
.perf-detail-row:not(.open) { display: none; }
.perf-detail-row td { background: var(--surface2); padding-top: 8px !important; padding-bottom: 10px !important; }
.perf-detail { display: grid; gap: 4px; font-size: 12px; color: var(--muted); line-height: 1.5; white-space: normal; }
.perf-detail-k { display: inline-block; min-width: 74px; font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--dim); }
@media (max-width: 700px) { .perf-need { grid-template-columns: repeat(2, minmax(0, 1fr)); } .perf-chart-box { height: 200px; } }
/* Income and net worth targets (Income & Expenses, Net Worth, Home): the Yearly Performance card, reused */
.goal-target { margin-bottom: 18px; }
.goal-target .perf-header { margin-bottom: 10px; }
.goal-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.goal-pair.goal-n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.goal-pair .perf-progress-card { margin-bottom: 0; min-width: 0; }
.goal-card-head { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin-bottom: 14px; }
.goal-card-title { font-size: 13px; font-weight: 600; color: var(--text); display: flex; flex-direction: column; gap: 2px; }
.goal-card-range { font-size: 11.5px; font-weight: 400; color: var(--dim); }
.goal-card-ctl { margin-left: auto; flex-wrap: wrap; }
.goal-need { margin: 14px 0 0; }
.goal-pair.goal-n2 .goal-need { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.goal-empty-btns { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 1000px) { .goal-pair.goal-n2 { grid-template-columns: minmax(0, 1fr); } .goal-pair.goal-n2 .goal-need { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 700px) { .goal-pair.goal-n2 .goal-need { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.goal-of { margin-left: 8px; font: 500 12px var(--sans); letter-spacing: 0; color: var(--dim); text-shadow: none; white-space: nowrap; }
.goal-pace-mark { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); opacity: .55; border-radius: 1px; pointer-events: none; }
.goal-note { margin-top: 12px; font-size: 11.5px; color: var(--dim); line-height: 1.5; }
.goal-empty { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 18px; }
.goal-empty-msg { flex: 1 1 240px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.goal-empty-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.goal-home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.goal-mini { margin-bottom: 0; padding: 16px 18px; min-width: 0; }
.goal-mini.goal-empty { display: block; }
.goal-mini-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.goal-mini-head .btn { margin-left: auto; }
.goal-mini-title { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; font: 600 13px var(--sans); color: var(--text); cursor: pointer; }
.goal-mini-title span { color: var(--dim); }
.goal-mini-title:hover { color: var(--accent); }
.goal-mini-title:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 4px; }
.goal-mini .perf-progress-top { margin-bottom: 10px; }
.goal-mini .perf-progress-pct { font-size: 22px; }
.goal-mini .perf-pace { margin-top: 10px; padding-top: 10px; }
.goal-target-hint { margin-top: 6px; }
.goal-target-err { color: var(--red); }
.goal-target-err:empty { display: none; }
.goal-target-remove { align-self: center; color: var(--red); background: none; border-color: transparent; }
@media (max-width: 800px) { .goal-home-grid { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .goal-mini { padding: 14px 16px; } .goal-mini .perf-progress-pct { font-size: 20px; } }
/* Income & Expenses: monthly averages, and your own categories */
.mi-avg-card { margin-top: 14px; }
.mi-avg-table th small, .mi-avg-table td small { display: block; font-size: 10.5px; font-weight: 400; color: var(--dim); text-transform: none; letter-spacing: 0; margin-top: 2px; white-space: nowrap; }
.mi-avg-table thead th:not(:first-child), .mi-avg-table td { text-align: right; }
.mi-avg-table tbody th { text-align: left; font-size: 12.5px; text-transform: none; letter-spacing: 0; color: var(--text); background: none; border-top: 1px solid var(--border); border-bottom: 0; }
.mi-avg-table td b { font-weight: 700; }
.mi-avg-pm { font-size: 10.5px; font-weight: 500; color: var(--dim); margin-left: 2px; }
.mi-avg-table .mi-avg-net th, .mi-avg-table .mi-avg-net td { border-top: 1px solid var(--border2); background: var(--surface2); }
.mi-cat-label { display: flex; align-items: center; justify-content: space-between; }
.mi-cat-manage { background: none; border: 0; padding: 0; font: inherit; font-size: 11.5px; color: var(--accent); cursor: pointer; }
.mi-cat-manage:hover { text-decoration: underline; }
.mi-cat-save { margin-top: 6px; }
.mi-cat-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.mi-cat-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mi-cat-list { display: grid; gap: 4px; margin-top: 6px; max-height: 260px; overflow-y: auto; }
.mi-cat-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); }
.mi-cat-ico { width: 20px; text-align: center; }
.mi-cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--text); }
.mi-cat-add { display: flex; gap: 6px; margin-top: 10px; }
.mi-cat-add .pf-input { min-width: 0; }
.mi-cat-add .btn { white-space: nowrap; flex: none; }
.mi-cat-icon-in { width: 52px; flex: none; text-align: center; }
.mi-cat-chip { cursor: pointer; text-transform: none; letter-spacing: 0; margin: 4px 2px 0 0; }
@media (max-width: 640px) { .mi-cat-cols { grid-template-columns: 1fr; } }
/* Income & Expenses → From email: spends read from bank alert emails, waiting for review */
.mi-mail-count { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 6px; border-radius: 9px; background: var(--accent); color: var(--bg); font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; }
.mi-mail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.mi-mail-head .tp-s { max-width: 720px; line-height: 1.5; }
.mi-mail-srcs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.mi-mail-src { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface2); color: var(--muted); }
.mi-mail-src.on { color: var(--green); border-color: color-mix(in srgb, var(--green) 35%, transparent); }
.mi-mail-src.bad { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.mi-mail-src.run { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.mi-mail-src.run i { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; vertical-align: 1px; animation: cc-pulse 1.2s ease-in-out infinite; }
@keyframes cc-pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .mi-mail-src.run i { animation: none; } }
.mi-mail-src a { color: var(--accent); }
.mi-mail-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--border); }
.mi-mail-allbox { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-right: 6px; cursor: pointer; }
.mi-mail-row { display: grid; grid-template-columns: 20px 52px minmax(0, 1fr) auto 180px auto; grid-template-areas: "pick date main amt cat acts"; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.mi-mail-row.hold { opacity: .72; }
.mi-mail-pick { grid-area: pick; accent-color: var(--accent); }
.mi-mail-date { grid-area: date; font-size: 12px; color: var(--muted); white-space: nowrap; }
.mi-mail-main { grid-area: main; min-width: 0; }
.mi-mail-main b { display: block; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-mail-main small { display: block; font-size: 11px; color: var(--dim); }
.mi-mail-learned { color: var(--accent); }
.mi-mail-note { font-size: 11px; color: var(--amber); margin-top: 2px; }
.mi-mail-amt { grid-area: amt; font-size: 13px; font-weight: 600; color: var(--red); white-space: nowrap; text-align: right; }
.mi-mail-cat { grid-area: cat; font-size: 12px; padding: 5px 8px; min-width: 0; }
.mi-mail-acts { grid-area: acts; display: flex; gap: 6px; }
.mi-mail-empty { padding: 14px 0 4px; }
.mi-mail-unread { margin-top: 12px; font-size: 12px; color: var(--muted); }
.mi-mail-hist { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border2); }
.mi-mail-hist-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.mi-mail-hrow { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto 200px auto; grid-template-areas: "date main amt state acts"; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); }
.mi-mail-hrow.skipped .mi-mail-main b, .mi-mail-hrow.skipped .mi-mail-amt { color: var(--muted); }
.mi-mail-state { grid-area: state; text-align: right; min-width: 0; }
.mi-mail-state .ln-chip { text-transform: none; letter-spacing: 0; font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.ln-chip.green { background: var(--green-bg); color: var(--green); border-color: transparent; }
.mi-mail-more { margin-top: 8px; }
@media (max-width: 760px) { .mi-mail-hrow { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main amt" "date date" "state acts"; row-gap: 4px; } .mi-mail-state { text-align: left; } }
.mi-mail-unread summary { cursor: pointer; color: var(--amber); }
@media (max-width: 760px) {
  .mi-mail-row { grid-template-columns: 20px minmax(0, 1fr) auto; grid-template-areas: "pick main amt" ". date date" ". cat acts"; row-gap: 6px; }
}
/* Settings → Outlook */
.set-ol-steps summary { cursor: pointer; font-size: 12.5px; color: var(--accent); }
.set-ol-steps ol { margin: 8px 0 0 18px; padding: 0; display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.set-ol-steps code { font-family: var(--code, monospace); font-size: 11.5px; padding: 1px 5px; border-radius: 4px; background: var(--surface2); color: var(--text); word-break: break-all; }
@media (max-width: 640px) { #set-outlook-card > div[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; } }

/* ═══ Decision support: data health, guardrails, rebalance, review, journal, cash & goals ═══ */
.tp-k.blue { color: var(--blue); }
.hh-card { margin-bottom: 14px; }
.hh-card .tp-card-head { margin-bottom: 4px; }
.hh-card.hh-bad { border-color: rgba(245,166,35,.45); }
.hh-card.hh-bad #home-health-sub { color: var(--amber); }
.hh-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-top: 1px solid var(--border); }
.hh-row:first-child { border-top: 0; }
.hh-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--dim); }
.hh-row.ok .hh-dot { background: var(--green); } .hh-row.stale .hh-dot { background: var(--amber); }
.hh-row.old .hh-dot, .hh-row.missing .hh-dot { background: var(--red); } .hh-row.info .hh-dot { background: var(--blue); }
.hh-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hh-main b { font-size: 12.5px; font-weight: 600; color: var(--text); }
.hh-main small { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.hh-status { font-size: 11px; color: var(--dim); white-space: nowrap; }
.hh-row.stale .hh-status { color: var(--amber); } .hh-row.old .hh-status, .hh-row.missing .hh-status { color: var(--red); }
.hh-row .btn { white-space: nowrap; }
.gr-card { margin-bottom: 14px; }
.gr-tiles { margin-bottom: 12px; }
.gr-patterns { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.gr-patterns ul { margin: 6px 0 0; padding-left: 18px; }
.gr-patterns li { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.rb-table tfoot td { font-weight: 600; border-top: 1px solid var(--border2); padding: 9px 12px; font-size: 12.5px; }
.rb-controls { margin-top: 12px; }
.rb-plan { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.rb-plan > .tp-k { margin-bottom: 8px; }
.rb-buys { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-top: 10px; }
.jr-form { margin-bottom: 12px; }
.jr-reason-in { flex: 1 1 260px; min-width: 200px; }
.jr-summary { margin-bottom: 12px; }
.jr-reason { font-size: 12px; color: var(--muted); max-width: 320px; white-space: normal; }
.jr-v { font-size: 11px; color: var(--dim); white-space: nowrap; }
.jr-v.ok { color: var(--green); } .jr-v.no { color: var(--red); }
.nw-cash-card { margin-bottom: 14px; }
.nw-cash-tiles { margin-bottom: 4px; }
.nw-cash-notes { margin: 10px 0 0; padding-left: 18px; }
.nw-cash-notes li { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.nw-cash-notes b { color: var(--text); font-weight: 600; }
.nw-cash-goals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
@media (max-width: 700px) { .hh-row { flex-wrap: wrap; } .hh-row .btn { margin-left: 18px; } .jr-reason { max-width: 200px; } }

/* Credit Cards page */
.cc-srcs { margin: -4px 0 16px; align-items: center; }
.cc-hbtns .btn { display: inline-flex; align-items: center; }

/* summary */
.cc-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.cc-stat { display: flex; align-items: flex-start; gap: 12px; min-width: 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.cc-stat-t { min-width: 0; }
.cc-stat .tp-k { color: var(--muted); margin-bottom: 3px; }
.cc-stat-v { font-size: 22px; font-weight: 650; line-height: 1.2; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.cc-stat.owed .cc-stat-v { color: var(--red); }
.cc-stat .tp-s { line-height: 1.45; margin-top: 3px; }
.cc-stat-ic { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--muted); background: var(--surface3); }
.cc-stat-ic .ds-i { width: 17px; height: 17px; }
.cc-stat-ic.red { color: var(--red); background: var(--red-bg); }
.cc-stat-ic.amber { color: var(--amber); background: var(--amber-bg); }
.cc-stat-ic.green { color: var(--green); background: var(--green-bg); }
.cc-stat-ic.purple { color: var(--purple); background: var(--purple-bg); }
.cc-stat-ic.blue { color: var(--blue); background: var(--blue-bg); }
.cc-empty { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }

/* cards seen in emails but not set up */
.cc-detected { margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cc-chip { cursor: pointer; text-transform: none; letter-spacing: 0; display: inline-flex; align-items: center; gap: 6px; }
.cc-chip .cc-mark { width: 16px; height: 16px; border-radius: 4px; }
.cc-chip .cc-mark svg { width: 12px; height: 12px; }

/* bank marks: the bank's sign on a small white tile */
.cc-mark { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.28); }
.cc-mark svg { display: block; width: 18px; height: 18px; }
.cc-mark-amex svg, .cc-mark-idfc svg, .cc-mark-slice svg, .cc-mark-custom svg { width: 22px; height: 22px; }
/* Banks dialog: banks you added, colour swatches */
.cc-bank-list { display: grid; gap: 6px; }
.cc-bank-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--border); }
.cc-bank-t { flex: 1; min-width: 0; }
.cc-bank-t b { display: block; font-size: 13px; color: var(--text); }
.cc-bank-t small { display: block; font-size: 11px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.cc-sw { width: 28px; height: 28px; padding: 0; border-radius: 8px; border: 2px solid transparent; background: var(--sw); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.cc-sw.on { border-color: var(--text); }
.cc-sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
html.light .cc-mark { box-shadow: 0 0 0 1px var(--border), 0 1px 2px rgba(16,24,40,.06); }

/* the cards */
.cc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)); gap: 16px; margin-bottom: 18px; }
/* phones only: a card's one-line summary (tap to open its details), a bank's amount in its ₹10 lakh row */
.cc-mob-sum, .cc-mob { display: none; }
.cc-card { display: flex; flex-direction: column; min-width: 0; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-card); }
.cc-body { display: grid; gap: 10px; align-content: start; padding: 12px 6px 4px; }

/* the card face, drawn like the plastic in the bank's colours */
.cc-face {
  --f1: #454D5B; --f2: #15181E;
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-rows: auto 1fr auto auto; gap: 6px;
  aspect-ratio: 1.8; min-height: 156px; padding: 14px 16px 12px; border-radius: 13px; color: #fff;
  background: radial-gradient(120% 95% at 100% 0%, rgba(255,255,255,.20), transparent 55%), linear-gradient(140deg, var(--f1) 0%, var(--f2) 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.10), 0 14px 26px -18px rgba(0,0,0,.9);
}
.cc-face::before { content: ""; position: absolute; inset: 0; z-index: -1; background: repeating-linear-gradient(118deg, rgba(255,255,255,.028) 0 2px, transparent 2px 10px); }
.cc-face::after { content: ""; position: absolute; z-index: -1; width: 78%; aspect-ratio: 1; right: -30%; bottom: -62%; border-radius: 50%; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 0 0 28px rgba(255,255,255,.035), 0 0 0 56px rgba(255,255,255,.02); }
.cc-f-hdfc  { --f1: #1F56A8; --f2: #071B40; }
.cc-f-icici { --f1: #B23A1C; --f2: #3D0C08; }
.cc-f-sbi   { --f1: #3157BE; --f2: #0E1A4B; }
.cc-f-axis  { --f1: #AA1D5C; --f2: #36061E; }
.cc-f-kotak { --f1: #D3262F; --f2: #1A2A58; }
.cc-f-amex  { --f1: #4A93D3; --f2: #0D3B69; }
.cc-f-idfc  { --f1: #A52230; --f2: #3A0910; }
.cc-f-slice { --f1: #7A3DE6; --f2: #24104F; }
.cc-f-other { --f1: #4A5261; --f2: #14171C; }
/* a debit card: its bank's colour too, in a lighter shade from the other corner, with a fine dot texture */
.cc-card.debit .cc-face {
  background: radial-gradient(110% 90% at 0% 100%, rgba(255,255,255,.16), transparent 55%),
    linear-gradient(320deg, color-mix(in srgb, var(--f1) 72%, #fff) 0%, var(--f1) 48%, color-mix(in srgb, var(--f1) 55%, var(--f2)) 100%);
}
.cc-card.debit .cc-face::before { background: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1.4px) 0 0 / 9px 9px; }
.cc-face-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.cc-bank { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; }
.cc-bank > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-face-type { flex: none; font-size: 9.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.16); color: rgba(255,255,255,.92); }
.cc-face-mid { display: flex; align-items: center; gap: 10px; }
.cc-emv { position: relative; width: 34px; height: 25px; border-radius: 6px; background: linear-gradient(135deg, #F4E2AC 0%, #C9A04E 52%, #EBD08C 100%); box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
.cc-emv::before { content: ""; position: absolute; inset: 7px 0; border-top: 1px solid rgba(80,55,10,.35); border-bottom: 1px solid rgba(80,55,10,.35); }
.cc-emv::after { content: ""; position: absolute; inset: 0 11px; border-left: 1px solid rgba(80,55,10,.35); border-right: 1px solid rgba(80,55,10,.35); }
.cc-nfc { width: 20px; height: 20px; fill: none; stroke: rgba(255,255,255,.7); stroke-width: 1.8; stroke-linecap: round; }
.cc-face-num { font-family: var(--code); font-size: 14.5px; letter-spacing: .12em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: rgba(255,255,255,.78); }
.cc-face-num b { font-weight: 600; color: #fff; }
.cc-face-num small { margin-left: 8px; font-size: 11px; letter-spacing: .04em; color: rgba(255,255,255,.7); }
.cc-face-bot { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; min-width: 0; }
.cc-face-name { min-width: 0; }
.cc-face .cc-name { font-size: 14px; font-weight: 650; letter-spacing: .01em; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-face-hint { font-size: 10.5px; color: rgba(255,255,255,.66); margin-top: 1px; }
.cc-face-holder { font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.72); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-edit { flex: none; display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: 11.5px; font-weight: 600; color: #fff; padding: 5px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.12); cursor: pointer; }
.cc-edit .ds-i { width: 13px; height: 13px; }
.cc-edit:hover { background: rgba(255,255,255,.22); }
.cc-edit:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* under the card: due, spent, milestone */
.cc-ask { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; background: var(--amber-bg); font-size: 12px; color: var(--amber); }
.cc-ask > span { margin-right: auto; font-weight: 600; }
.cc-due { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "top top" "amt acts" "sub acts"; gap: 2px 10px; align-items: end; padding: 11px 12px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--border); }
.cc-due-top { grid-area: top; display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 2px; }
.cc-due-top .tp-k { margin: 0; }
.cc-amt { grid-area: amt; font-size: 22px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; color: var(--text); }
.cc-due > .tp-s { grid-area: sub; margin: 0; line-height: 1.45; }
.cc-due.due .cc-amt, .cc-due.overdue .cc-amt { color: var(--red); }
.cc-due.paid .cc-amt { color: var(--muted); }
.cc-due.overdue { border-color: color-mix(in srgb, var(--red) 45%, transparent); background: var(--red-bg); }
.cc-due-acts { grid-area: acts; display: flex; flex-direction: column; gap: 6px; }
.cc-due-acts .btn { justify-content: center; }
.cc-due.none { display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 12px; background: transparent; border-style: dashed; border-color: var(--border2); }
.cc-due.none > .ds-i { color: var(--dim); }
.cc-due.none > .tp-s { flex: 1; margin: 0; }
.cc-pill { flex: none; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--surface3); color: var(--muted); }
.cc-pill.red { background: var(--red-bg); color: var(--red); }
.cc-pill.amber { background: var(--amber-bg); color: var(--amber); }
.cc-pill.green { background: var(--green-bg); color: var(--green); }
.cc-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 0 2px; }
.cc-row b { font-size: 14px; font-weight: 650; color: var(--text); }
.cc-ms { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--border); }
.cc-ms-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cc-ms-top .tp-k { margin: 0; }
.cc-ms-pct { font-size: 12px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.cc-ms-pct.done { color: var(--green); } .cc-ms-pct.behind { color: var(--amber); }
.cc-bar { height: 7px; border-radius: 999px; background: var(--surface3); overflow: hidden; }
.cc-bar > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 55%, transparent), var(--accent)); }
.cc-bar > div.done { background: var(--green); }
.cc-bar > div.behind { background: linear-gradient(90deg, color-mix(in srgb, var(--amber) 55%, transparent), var(--amber)); }
.cc-ms-nums { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.cc-ms-nums b { color: var(--text); font-size: 14px; }
.cc-ms-nums .tp-s { margin: 0; }
.cc-ms > .tp-s { line-height: 1.5; margin: 0; }
.cc-ms-add { display: flex; align-items: center; gap: 8px; width: 100%; font: inherit; font-size: 12px; text-align: left; color: var(--muted); padding: 9px 12px; border-radius: 10px; border: 1px dashed var(--border2); background: transparent; cursor: pointer; }
.cc-ms-add > span { flex: 1; }
.cc-ms-add:hover { color: var(--accent); border-color: var(--border-accent); background: var(--blue-bg); }

/* section headers (₹10 lakh, Cards): tap to fold a section to one summary line */
.cc-sec-head { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; padding: 2px 0; margin: 0 0 10px; font: inherit; font-size: 14px; color: var(--text); text-align: left; background: none; border: 0; cursor: pointer; }
.cc-sec-head > .ds-i:first-child { flex: none; width: 16px; height: 16px; color: var(--accent); }
.cc-sec-head b { font-weight: 650; white-space: nowrap; }
.cc-sec-head:hover b { color: var(--accent); }
.cc-sec-head .cc-count { flex: none; }
.cc-sec-sum { flex: 1; min-width: 0; font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-sec-sum i { font-style: normal; color: var(--muted); }
.cc-sec-sum i.over { color: var(--red); } .cc-sec-sum i.near { color: var(--amber); }
.cc-sec-head > .ds-i:last-child { flex: none; width: 16px; height: 16px; color: var(--dim); transition: transform .15s; }
.cc-sec-head.open > .ds-i:last-child { transform: rotate(180deg); }
.cc-sec-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.cc-lim-top .cc-sec-head { width: auto; flex: 0 1 auto; margin: 0; }
/* a folded section: one line in a box */
.cc-sec.closed, .cc-limits.closed { padding: 10px 14px; margin-bottom: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); }
.cc-sec.closed .cc-sec-head, .cc-limits.closed .cc-sec-head { margin: 0; width: 100%; }
.cc-limits.closed .cc-lim-top { margin: 0; }

/* ₹10 lakh a year per bank, per person — a compact strip above the cards */
.cc-limits { margin-bottom: 18px; }
.cc-lim-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.cc-lim-title { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.cc-lim-title b { font-weight: 650; }
.cc-lim-title .ds-i { width: 16px; height: 16px; color: var(--accent); }
.cc-lim-note { font-size: 11.5px; color: var(--dim); }
.cc-lim-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 12px; }
.cc-lim { --c: var(--accent); display: grid; gap: 9px; align-content: start; padding: 13px 14px 11px; border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow-card);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 7%, var(--surface)) 0%, var(--surface) 70%); }
.cc-lim.near { --c: var(--amber); border-color: color-mix(in srgb, var(--amber) 35%, var(--border)); }
.cc-lim.over { --c: var(--red); border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.cc-lim-head { display: flex; align-items: center; gap: 10px; min-width: 0; width: 100%; padding: 0; font: inherit; color: inherit; text-align: left; background: none; border: 0; cursor: default; }
.cc-lim-head > .ds-i { display: none; }
.cc-lim-head .cc-mark { width: 24px; height: 24px; border-radius: 7px; }
.cc-lim-head .cc-mark svg { width: 16px; height: 16px; }
.cc-lim-t { flex: 1; min-width: 0; }
.cc-lim-t b { display: block; font-size: 13px; font-weight: 650; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-lim-t small { display: block; font-size: 11px; color: var(--dim); }
.cc-lim-pct { font-size: 20px; font-weight: 700; letter-spacing: -.02em; color: var(--c); line-height: 1; }
.cc-lim-pct i { font-style: normal; font-size: 12px; font-weight: 600; margin-left: 1px; opacity: .8; }
.cc-lim-amt { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.cc-lim-amt > b { font-size: 18px; font-weight: 650; letter-spacing: -.01em; color: var(--text); }
.cc-lim-amt > span { font-size: 12px; color: var(--dim); }
.cc-lim-st { margin-left: auto; font-style: normal; font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; color: var(--green); background: var(--green-bg); }
.cc-lim.near .cc-lim-st { color: var(--amber); background: var(--amber-bg); }
.cc-lim.over .cc-lim-st { color: var(--red); background: var(--red-bg); }
.cc-lim-bar { position: relative; display: flex; gap: 2px; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface3); }
.cc-lim-bar > span { flex: none; height: 100%; background: var(--c); border-radius: 2px; }
.cc-lim-bar > span:first-child { border-radius: 999px 2px 2px 999px; }
.cc-lim-cards { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.cc-lim-card { display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: 11px; color: var(--muted); padding: 1px 0; border: 0; background: none; cursor: pointer; white-space: nowrap; }
.cc-lim-card i { width: 7px; height: 7px; border-radius: 2px; background: var(--c); }
.cc-lim-card b { font-weight: 600; color: var(--text); }
.cc-lim-card:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.cc-lim-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--dim); }
.cc-lim-foot .red { color: var(--red); font-weight: 600; }
.cc-lim-go { flex: none; display: inline-flex; align-items: center; gap: 2px; font: inherit; font-size: 11.5px; font-weight: 600; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; }
.cc-lim-go .ds-i { width: 13px; height: 13px; }
.cc-lim-go:hover { text-decoration: underline; text-underline-offset: 3px; }
.cc-sum { font-size: 13px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.cc-check { display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px; margin-bottom: 8px; border-radius: 10px; background: var(--blue-bg); font-size: 12.5px; color: var(--text); line-height: 1.5; }
.cc-check .ds-i { flex: none; width: 15px; height: 15px; margin-top: 2px; color: var(--accent); }
@media (max-width: 640px) {
  /* a folded section: its summary on its own line under the title */
  .cc-sec-head { flex-wrap: wrap; row-gap: 4px; }
  .cc-sec-head > .ds-i:last-child { order: 5; margin-left: auto; }
  .cc-sec-sum { order: 10; flex-basis: 100%; padding-left: 24px; }
  .cc-sec-head.open .cc-sec-sum { display: none; }
  /* a list of banks: each row shows the bar; tap it for the amount, its cards and See spends */
  .cc-lim-note { display: none; }
  .cc-lim-list { grid-template-columns: 1fr; gap: 8px; }
  .cc-lim { padding: 10px 12px; gap: 8px; }
  .cc-lim-head { cursor: pointer; }
  .cc-lim-head > .ds-i { display: block; flex: none; width: 16px; height: 16px; color: var(--dim); transition: transform .15s; }
  .cc-lim.open .cc-lim-head > .ds-i { transform: rotate(180deg); }
  .cc-lim .cc-mob { display: inline; }
  .cc-lim-pct { font-size: 17px; }
  .cc-lim:not(.open) .cc-lim-amt, .cc-lim:not(.open) .cc-lim-cards, .cc-lim:not(.open) .cc-lim-foot { display: none; }
}

/* card spends */
.cc-spends { margin-bottom: 14px; padding: 16px 18px 12px; }
.cc-sp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cc-sp-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 650; color: var(--text); }
.cc-count { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--surface3); color: var(--muted); font-variant-numeric: tabular-nums; }
.cc-sp-hint { font-size: 11.5px; color: var(--dim); margin-top: 3px; }
.cc-sp-hint b { color: var(--muted); font-weight: 600; }
.cc-sp-ctrl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cc-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--border); }
.cc-seg button { font: inherit; font-size: 12px; padding: 5px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap; }
.cc-seg button:hover { color: var(--text); }
.cc-seg button i { font-style: normal; font-size: 11px; color: var(--dim); margin-left: 2px; font-variant-numeric: tabular-nums; }
.cc-seg button.warn i { color: var(--amber); font-weight: 700; }
.cc-seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--border2), 0 1px 2px rgba(0,0,0,.25); }
.cc-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cc-filter { font-size: 12px; padding: 6px 8px; width: auto; max-width: 200px; }
.cc-filter.cc-period { max-width: 260px; }
.cc-bulk { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 9px 12px; margin-bottom: 8px; border-radius: 10px; background: var(--amber-bg); }
.cc-bulk .tp-s { color: var(--amber); margin: 0; }
.cc-thead, .cc-tx { display: grid; grid-template-columns: 46px minmax(170px, 1fr) minmax(150px, 270px) 118px 372px 58px; grid-template-areas: "date main card amt for del"; gap: 14px; align-items: center; }
.cc-thead { padding: 0 10px 8px; border-bottom: 1px solid var(--border); font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.cc-thead .r { text-align: right; }
.cc-tx { padding: 9px 10px; border-bottom: 1px solid var(--border); }
.cc-tx:last-child { border-bottom: 0; }
.cc-tx:hover { background: color-mix(in srgb, var(--surface2) 70%, transparent); }
.cc-date { grid-area: date; width: 42px; padding: 4px 0; text-align: center; line-height: 1.1; border-radius: 9px; background: var(--surface2); border: 1px solid var(--border); }
.cc-date b { display: block; font-size: 15px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.cc-date span { display: block; font-size: 9.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
.cc-tx-main { grid-area: main; display: flex; align-items: center; gap: 10px; min-width: 0; }
.cc-tx-main > div { min-width: 0; }
.cc-tx-main b { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-tx-main small { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; margin-top: 2px; font-size: 11px; color: var(--dim); }
.cc-av { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font-size: 14px; font-weight: 700; background: hsl(var(--h) 34% 19%); color: hsl(var(--h) 72% 76%); }
html.light .cc-av { background: hsl(var(--h) 70% 93%); color: hsl(var(--h) 55% 33%); }
.cc-tag { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; white-space: nowrap; background: var(--surface3); color: var(--muted); }
.cc-tag.green { background: var(--green-bg); color: var(--green); }
.cc-tag.amber { background: var(--amber-bg); color: var(--amber); }
.cc-tx-card { grid-area: card; display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; color: var(--muted); }
.cc-tx-card .cc-mark { width: 22px; height: 22px; border-radius: 6px; }
.cc-tx-card .cc-mark svg { width: 15px; height: 15px; }
.cc-tx-card .cc-mark-amex svg, .cc-tx-card .cc-mark-idfc svg, .cc-tx-card .cc-mark-slice svg, .cc-tx-card .cc-mark-custom svg { width: 19px; height: 19px; }
.cc-cardlink { font: inherit; font-size: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-cardlink:hover, .cc-cardlink.set { color: var(--accent); }
.cc-tx-amt { grid-area: amt; font-size: 14px; font-weight: 650; color: var(--text); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cc-tx.refund .cc-tx-amt { color: var(--green); }
.cc-fx { display: block; font-size: 10.5px; font-weight: 500; color: var(--dim); margin-top: 1px; }
.cc-tx-for { grid-area: for; display: flex; align-items: center; gap: 8px; min-width: 0; }
.cc-tx-for > .tp-s { margin: 0; }
.cc-tx-del { grid-area: del; display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.cc-x { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--dim); cursor: pointer; }
.cc-x .ds-i { width: 15px; height: 15px; }
.cc-x:hover { color: var(--text); background: var(--surface2); border-color: var(--border); }
.cc-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cc-tx.excluded .cc-tx-main b, .cc-tx.excluded .cc-tx-amt { color: var(--dim); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--dim) 60%, transparent); }
.cc-tx.excluded .cc-av, .cc-tx.excluded .cc-tx-card { opacity: .55; }
.cc-sp-hint .ds-i { width: 12px; height: 12px; vertical-align: -2px; }
.cc-group { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; font-size: 14px; color: var(--text); }
.cc-group .cc-av { width: 28px; height: 28px; border-radius: 8px; font-size: 12px; }
.cc-group b { font-weight: 650; }
.cc-owner { display: grid; gap: 8px; }
.cc-person { font-size: 12px; padding: 5px 9px; min-width: 0; flex: 1; }
.cc-comm { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.cc-comm b { font-size: 12px; color: var(--green); }
.cc-comm input { font-size: 12px; padding: 5px 9px; width: 104px; }
.cc-who { display: inline-flex; flex: none; gap: 2px; padding: 2px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--border); }
.cc-who-b { font: inherit; font-size: 12px; padding: 4px 12px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.cc-who-b:hover { color: var(--text); }
.cc-who-b.on { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); font-weight: 600; }
.cc-who-b:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cc-more { margin-top: 10px; }
.cc-form2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 1280px) {
  .cc-thead, .cc-tx { grid-template-columns: 46px minmax(150px, 1fr) minmax(130px, 220px) 108px 330px 58px; gap: 12px; }
  .cc-comm input { width: 86px; }
}
@media (max-width: 1080px) {
  .cc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cc-thead { display: none; }
  .cc-tx { grid-template-columns: 46px minmax(0, 1fr) auto auto; grid-template-areas: "date main amt del" ". card card card" ". for for for"; row-gap: 6px; }
  .cc-tx-card { padding-left: 44px; }
  .cc-tx-for { padding-left: 44px; flex-wrap: wrap; row-gap: 6px; }
}
@media (max-width: 760px) {
  .cc-form2 { grid-template-columns: 1fr; }
  .cc-spends { padding: 14px 12px 8px; }
  .cc-sp-ctrl { width: 100%; }
  .cc-seg { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .cc-seg button { flex: 1 0 auto; padding: 6px 8px; }
  .cc-filter { max-width: none; width: 100%; }
  .cc-tx { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "main amt del" "card date date" "for for for"; padding: 11px 4px; gap: 6px 10px; }
  .cc-date { width: auto; padding: 0; display: flex; justify-content: flex-end; gap: 4px; background: none; border: 0; font-size: 11.5px; color: var(--dim); }
  .cc-date b, .cc-date span { display: inline; font-size: 11.5px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--dim); }
  .cc-person { min-width: 110px; } .cc-comm input { width: 120px; }
}
@media (max-width: 640px) {
  .cc-stats { gap: 8px; }
  .cc-stat { padding: 12px; gap: 10px; flex-direction: column; }
  .cc-stat-ic { width: 30px; height: 30px; border-radius: 9px; }
  .cc-stat-v { font-size: 19px; }
  /* a list of slim cards: bank, digits, name, and one line of what it owes; tap the line for the details */
  .cc-grid { grid-template-columns: 1fr; gap: 10px; margin-bottom: 16px; }
  .cc-card { padding: 6px; border-radius: 16px; }
  .cc-face { aspect-ratio: auto; min-height: 0; padding: 12px 14px 10px; gap: 6px; grid-template-rows: auto auto auto; border-radius: 11px; }
  .cc-face-mid { display: none; }
  .cc-face-num { font-size: 13px; }
  .cc-face-num > span { display: none; }
  .cc-face-num b::before { content: "•••• "; font-weight: 400; opacity: .7; }
  .cc-mob-sum { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 8px 6px; font: inherit; font-size: 13px; font-weight: 600; text-align: left; color: var(--text); background: none; border: 0; cursor: pointer; }
  .cc-mob-sum > span { flex: 1; min-width: 0; }
  .cc-mob-sum.green > span { color: var(--green); }
  .cc-mob-sum.red > span { color: var(--red); }
  .cc-mob-sum.amber > span { color: var(--amber); }
  .cc-mob-sum .ds-i { flex: none; width: 16px; height: 16px; color: var(--dim); transition: transform .15s; }
  .cc-card.open .cc-mob-sum .ds-i { transform: rotate(180deg); }
  .cc-card:not(.open) .cc-body { display: none; }
  .cc-card.open .cc-body { padding-top: 4px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Phone layer: fast, one-handed, quiet
   ───────────────────────────────────────────────────────────────────────────
   • Touch: no grey tap flash, no double-tap-zoom wait, a pressed state you can
     feel, and sideways swipes inside tables don't trigger the browser's Back.
   • Labels read in sentence case everywhere (no tracked-out capitals).
   • Page header on a phone: title, one line of context, then the page's
     actions as one row of pills you can swipe. Every action stays.
   • Figures: two-up tiles instead of one card per line; amounts never break.
   • Hero figure: the first amount on a page is the one big, light number.
   • Dock: the tab you're on sits on a soft pill.
   Desktop layout is unchanged apart from the label case.
   ═════════════════════════════════════════════════════════════════════════ */

/* ---------------------------------------------------------------- touch */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, .btn, a, select, summary, label, [onclick] { touch-action: manipulation; }
.table-wrap, .tbl-wrap, .tp-tabs, .cc-seg { overscroll-behavior-x: contain; }
@media (pointer: coarse) {
  html { -webkit-tap-highlight-color: transparent; }
  @layer ds-force {
    .btn:not([style*="background"]):not([disabled]):active { background: var(--surface3) !important; }
    .btn-green:not([style*="background"]):not([disabled]):active,
    .btn-primary:not([style*="background"]):not([disabled]):active { opacity: .78; }
  }
  .nav-item-premium:active, .wl-nav-item-premium:active, .wl-sub-header:active { background: var(--surface3); }
  .mobile-action-btn:active { background: var(--surface2); }
}

/* --------------------------------------------- labels in sentence case */
@layer ds-force {
  .tp-k, .tp-part-k, .tp-seg-head, .tp-bcard-k, .tp-filter-label, .tp-person-label,
  .tx-sg-k, .tp-chart-pane-title, .tp-hero-label, .cc-thead, .ln-chip {
    text-transform: none !important;
    letter-spacing: 0 !important;
  }
}
.tp-k, .tp-part-k, .tp-bcard-k, .tp-filter-label, .tp-person-label, .tx-sg-k, .tp-hero-label {
  font-size: 12px; font-weight: 500;
}
.tp-seg-head, .tp-chart-pane-title { font-size: 12.5px; font-weight: 600; }
.cc-thead { font-size: 11.5px; font-weight: 500; }

/* ------------------------------------------------------------ the dock */
.mobile-dock-item { gap: 3px; }
.mobile-dock-item .dock-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 54px; height: 28px; border-radius: 999px;
  transition: background-color .18s ease, color .18s ease;
}
.mobile-dock-item.active .dock-icon { background: var(--blue-bg); }
.mobile-dock-item:active .dock-icon { background: var(--surface3); }

/* ============================================================ ≤ 640px */
@media (max-width: 640px) {
  /* Page header: title, context, then one swipeable row of actions */
  @layer ds-force {
    .page-header { margin-bottom: 14px !important; gap: 12px !important; }
    .page-title, h1.page-title, h2.page-title { font-size: 22px !important; letter-spacing: -.03em !important; }
    .page-sub { font-size: 12.5px !important; line-height: 1.45 !important; margin-top: 3px !important; }
    .page-header > div:last-child:not(:first-child) > .btn {
      min-height: 38px !important; padding: 0 14px !important;
      border-radius: 999px !important; font-size: 12.5px !important;
    }
  }
  .page-header > div:last-child:not(:first-child) {
    display: flex; flex-wrap: nowrap; align-items: center; gap: 8px;
    width: calc(100% + 24px); max-width: none; margin: 0 -12px; padding: 1px 12px 3px;
    overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 28px), transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 28px), transparent 100%);
  }
  .page-header > div:last-child:not(:first-child)::-webkit-scrollbar { display: none; }
  .page-header > div:last-child:not(:first-child) > * { flex: none; white-space: nowrap; }

  /* Figures: two-up tiles */
  @layer ds-force {
    #pf-summary-cards { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
    .home-mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
    .scard { padding: 13px 14px !important; }
    .scard-label { font-size: 12px !important; margin-bottom: 4px !important; }
    .scard-val { font-size: 18px !important; white-space: nowrap; }
    .scard-sub { font-size: 11.5px !important; }
  }
  #pf-summary-cards > .scard:last-child:nth-child(odd),
  .home-mini-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  @layer ds-force {
    .tp-hero, .page #tpnl-cards.tp-hero, .mi-hero { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  }
  .tp-hero > .tp-hero-main, .tp-hero > .tp-drag, .mi-hero > :first-child { grid-column: 1 / -1; }
  .tp-hero > :last-child:nth-child(even), .mi-hero > :last-child:nth-child(even),
  .tp-hero > .tp-tile:nth-last-child(2):nth-child(even) { grid-column: 1 / -1; }
  .tp-grid6, .tp-grid5, .tp-grid4 { gap: 8px; }
  .tp-grid5 > :last-child:nth-child(odd), .tp-grid4 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .ln-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ln-hero > :last-child:nth-child(even) { grid-column: 1 / -1; }

  /* Amounts never break across lines */
  .home-hero-val, .home-stat-val, .tp-v, .tp-v-lg, .tp-hero-net, .pf-hero-val, .ln-hero-val,
  .perf-card-val, .scard-val, .cc-stat-v { white-space: nowrap; }
  .home-stat-card { padding: 10px 11px; min-width: 0; }
  .home-stat-card .home-stat-label { font-size: 11.5px; }
  .home-stat-val { font-size: clamp(15px, 4.6vw, 19px); letter-spacing: -.02em; }
  .home-stat-val .home-hero-usd-sm { display: block; margin: 1px 0 0; font-size: 11px; font-weight: 500; letter-spacing: 0; }

  /* The hero figure: one big, light number per page */
  @layer ds-force {
    .home-hero-val, .pf-hero-val, .tp-hero-net, .mi-hero-main .tp-hero-net, .ln-hero-val, #tpnl-net {
      font-size: clamp(30px, 9.4vw, 36px) !important;
      font-weight: 400 !important;
      letter-spacing: -.035em !important;
      line-height: 1.05 !important;
    }
  }
  .home-hero-card { padding: 16px; }

  /* Bottom sheets rise from the dock edge */
  .modal-overlay.open > .modal {
    width: 100%; max-width: 100%; max-height: 90vh; max-height: 90dvh;
    border-radius: 18px 18px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    animation: ds-sheet-up .22s cubic-bezier(.2, .8, .2, 1);
  }
  .modal-overlay.open { animation: ds-fade-in .18s ease; }
}
@keyframes ds-sheet-up { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes ds-fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .modal-overlay.open, .modal-overlay.open > .modal, .page.active { animation: none !important; }
  .mobile-dock-item .dock-icon { transition: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Layout refresh (Nov 2026): your own colours and Geist, less clutter
   ───────────────────────────────────────────────────────────────────────────
   • Figures that belong together share one panel, split by hairlines, instead of
     floating as separate boxes.
   • Home opens with its headline figures, then the month, then Today's brief.
   • Today's brief is a list, not a stack of boxes.
   Colours and fonts are the ones defined at the top of this file.
   ═════════════════════════════════════════════════════════════════════════ */
:root, html:not(.light), html.light { --accent-bg: var(--blue-bg); }

/* Headline amounts: a touch larger than before, same weight and colour */
@layer ds-force {
  .home-hero-val { font-size: 34px !important; }
  .pf-hero-val, #tpnl-net, .tp-hero-net, .ln-hero-val { font-size: 32px !important; }
  .home-hero-val, .pf-hero-val, #tpnl-net, .tp-hero-net, .mi-hero-main .tp-hero-net, .ln-hero-val {
    font-weight: 500 !important; letter-spacing: -.025em !important; line-height: 1.1 !important;
  }
}
@media (max-width: 640px) {
  @layer ds-force {
    .home-hero-val, .pf-hero-val, #tpnl-net, .tp-hero-net, .mi-hero-main .tp-hero-net, .ln-hero-val { font-size: clamp(26px, 8vw, 30px) !important; }
  }
}
.home-hero-card { padding: 20px 22px; }
.nav-item-premium, .wl-sub-header, .wl-nav-item-premium { transition: background-color .12s ease, color .12s ease; }

/* Ledger panels: related figures in one panel, split by hairlines */
@layer ds-force {
  #home-hero-grid, #home-mini-grid, #pf-summary-cards, #perf-cards, .tax-cards-grid, .cc-stats,
  .mi-hero, .page #tpnl-cards.tp-hero, #pf-benchmark-bar, .summary-grid, .summary-grid-5 {
    gap: 0 !important;
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    overflow: hidden;
    box-shadow: var(--shadow-card) !important;
  }
  :is(#home-hero-grid, #home-mini-grid, #pf-summary-cards, #perf-cards, .tax-cards-grid, .cc-stats,
      .mi-hero, #tpnl-cards, #pf-benchmark-bar, .summary-grid, .summary-grid-5) > * {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: 1px 0 0 var(--border), 0 1px 0 var(--border) !important;
    margin: 0 !important;
  }
}

/* Portfolio's top panel has three figures; no empty fourth column */
@media (min-width: 641px) { .mi-hero.pf-hero:not(:has(> :nth-child(4))) { grid-template-columns: 2fr 1fr 1fr; } }

/* Small figure tiles (.tp-box) across pages: the same ledger treatment */
@layer ds-force {
  :is(.tp-grid4, .tp-grid5, .tp-grid6):has(> .tp-box) {
    gap: 0 !important; background: var(--surface) !important; border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important; overflow: hidden;
  }
  :is(.tp-grid4, .tp-grid5, .tp-grid6) > .tp-box {
    background: transparent !important; border: 0 !important; border-radius: 0 !important; margin: 0 !important;
    box-shadow: 1px 0 0 var(--border), 0 1px 0 var(--border) !important;
  }
}
/* Today's brief: a list split by hairlines, not a stack of boxes */
.ins-body .ins-brief { gap: 0; }
.ins-body .ins-brief .line { background: transparent; border: 0; border-radius: 0; border-top: 1px solid var(--border); padding: 11px 4px; }
.ins-body .ins-brief .line:first-child { border-top: 0; padding-top: 4px; }
.ins-body .ins-brief .line:hover { background: var(--surface2); }

/* The small gain tiles under Home's charts: one ledger strip */
@layer ds-force {
  div:has(> .home-stat-card) { gap: 0 !important; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
  div:has(> .home-stat-card) > .home-stat-card {
    background: transparent !important; border: 0 !important; border-radius: 0 !important;
    box-shadow: 1px 0 0 var(--border) !important;
  }
}

/* ----------------------------------------------------- Home: figures first */
#page-home.active { display: flex; flex-direction: column; gap: 16px; }
@layer ds-force { #page-home.active > * { margin-top: 0 !important; margin-bottom: 0 !important; } }
#page-home.active > .page-header { order: -10; }
#page-home.active > #home-hero-grid { order: -9; }
#page-home.active > #home-mini-grid { order: -8; }

/* ---------------------------------------------------------------- phone */
@media (max-width: 640px) {
  #page-home.active { gap: 12px; }
  .home-hero-card { padding: 16px 16px 14px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Phone rows (≤ 640px): wide tables become lists, no sideways scrolling
   ───────────────────────────────────────────────────────────────────────────
   The script "Phone rows" at the end of index.html marks a table wider than the
   screen as table.ph[data-ph="list" | "card"] and tags its cells:
     .ph-t name · .ph-s second line (name/sector) · .ph-a / .ph-b key figures
     .ph-x shown when the row is tapped open · .ph-f always-shown field (card)
     .ph-act cell holding the row's buttons · tr.ph-g a group heading row
   `display` rules stay unlayered and not !important, so rows or cells hidden
   with an inline style stay hidden. Spacing, borders and positions go in
   ds-force because the legacy table rules use !important.
   ═════════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  /* ---- layout (display) */
  table.ph, table.ph > tbody, table.ph > tfoot { display: block; }
  table.ph > thead { display: none; }
  table.ph.ph-sortable > thead { display: block; }
  table.ph.ph-sortable > thead > tr { display: flex; }
  table.ph.ph-sortable > thead th { display: none; }
  table.ph.ph-sortable > thead th.ph-sort { display: inline-flex; }
  table.ph tr.ph-r { display: grid; }
  table.ph tr.ph-g > td { display: block; }
  table.ph tr.ph-r > td.ph-t, table.ph tr.ph-r > td.ph-s,
  table.ph tr.ph-r > td.ph-a, table.ph tr.ph-r > td.ph-b { display: block; }
  table.ph[data-ph="list"] tr.ph-r > td.ph-x { display: none; }
  table.ph[data-ph="list"] tr.ph-open > td.ph-x, table.ph[data-ph="card"] tr.ph-r > td.ph-f { display: block; }
  table.ph tr.ph-r > td.ph-act { display: none; }
  table.ph[data-ph="list"] tr.ph-open > td.ph-act, table.ph[data-ph="card"] tr.ph-r > td.ph-act { display: flex; }
  .table-wrap:has(> table.ph), .mi-table-scroll:has(> table.ph), .ins-table-wrap:has(> table.ph) { overflow-x: visible; }

  @layer ds-force {
    /* ---- the table itself */
    table.ph { min-width: 0 !important; width: 100% !important; table-layout: auto !important; }
    table.ph th, table.ph td { left: auto !important; box-shadow: none !important; }
    table.ph tr.ph-r { background: transparent !important; }
    table.ph tr.ph-r > td {
      position: static !important; padding: 0 !important; border: 0 !important; background: transparent !important;
      white-space: normal !important; max-width: none !important; width: auto !important; min-width: 0 !important; height: auto !important;
      transition: none !important;
    }
    table.ph tr.ph-g > td { position: static !important; padding: 12px 12px 6px !important; border: 0 !important; background: transparent !important; }

    /* ---- sorting stays: the sortable headers become a row of chips */
    table.ph.ph-sortable > thead { border-bottom: 1px solid var(--border) !important; }
    table.ph.ph-sortable > thead > tr {
      align-items: center !important; gap: 6px !important; overflow-x: auto !important; scrollbar-width: none;
      padding: 10px 12px !important; overscroll-behavior-x: contain; background: transparent !important;
    }
    table.ph.ph-sortable > thead th.ph-sort {
      position: static !important; align-items: center; gap: 4px; flex: none !important;
      width: auto !important; min-width: 0 !important; max-width: none !important;
      padding: 0 11px !important; height: 32px !important; border: 1px solid var(--border2) !important; border-radius: 999px !important;
      background: var(--surface) !important; font-size: 12px !important; white-space: nowrap !important; cursor: pointer;
    }

    /* ---- a row: name (and second line) left, the two key figures right */
    table.ph tr.ph-r {
      grid-template-columns: minmax(0, 1fr) auto !important; column-gap: 14px; row-gap: 3px;
      align-items: baseline; padding: 12px !important; border-bottom: 1px solid var(--border) !important; position: relative !important;
    }
    table.ph tr.ph-r > td.ph-t { grid-column: 1; grid-row: 1; min-width: 0 !important; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
    table.ph tr.ph-r > td.ph-s { grid-column: 1; grid-row: 2; min-width: 0 !important; font-size: 12px !important; color: var(--dim) !important; opacity: 1 !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap !important; }
    table.ph tr.ph-r > td.ph-a { grid-column: 2; grid-row: 1; text-align: right !important; font-weight: 600; white-space: nowrap !important; }
    table.ph tr.ph-r > td.ph-b { grid-column: 2; grid-row: 2; text-align: right !important; font-size: 12px !important; white-space: nowrap !important; }

    /* ---- list tables: the other columns open under the row */
    table.ph[data-ph="list"] tr.ph-r { padding-right: 38px !important; cursor: pointer; }
    table.ph[data-ph="list"] tr.ph-open { background: var(--surface2) !important; }
    table.ph[data-ph="list"] tr.ph-open > td.ph-x, table.ph[data-ph="card"] tr.ph-r > td.ph-f {
      grid-column: 1 / -1; position: relative !important; text-align: right !important;
      padding: 8px 0 8px 46% !important; border-top: 1px solid var(--border) !important; min-height: 34px;
    }
    table.ph[data-ph="card"] tr.ph-r > td.ph-t { grid-column: 1 / -1; padding-bottom: 4px !important; }
    table.ph[data-ph="card"] tr.ph-r { row-gap: 0; }

    /* ---- the row's buttons: one plain row, no label */
    /* (these cells often carry an inline display, so showing and hiding them needs !important here) */
    table.ph[data-ph="list"] tr.ph-r > td.ph-act { display: none !important; }
    table.ph[data-ph="list"] tr.ph-open > td.ph-act, table.ph[data-ph="card"] tr.ph-r > td.ph-act { display: flex !important; }
    table.ph[data-ph] tr.ph-r > td.ph-act {
      grid-column: 1 / -1; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-start;
      text-align: left !important; padding: 10px 0 2px !important; border-top: 0 !important; min-height: 0;
    }
  }
  /* labels (pseudo-elements: no legacy rules reach them) */
  table.ph tr.ph-r > td.ph-x::before, table.ph tr.ph-r > td.ph-f::before {
    content: attr(data-label); position: absolute; left: 0; top: 8px; max-width: 44%;
    text-align: left; font-size: 12px; font-weight: 500; color: var(--dim); white-space: normal; line-height: 1.35;
  }
  table.ph tr.ph-r > td.ph-act::before, table.ph tr.ph-r > td.ph-a::before, table.ph tr.ph-r > td.ph-b::before { content: none; }
  table.ph.ph-sortable > thead > tr::-webkit-scrollbar { display: none; }
  table.ph.ph-sortable > thead > tr::before { content: "Sort"; flex: none; font-size: 12px; color: var(--dim); margin-right: 2px; }
  table.ph[data-ph="list"] tr.ph-r::after {
    content: ""; position: absolute; right: 16px; top: 19px; width: 7px; height: 7px;
    border-right: 1.5px solid var(--dim); border-bottom: 1.5px solid var(--dim); transform: rotate(45deg); transition: transform .15s;
  }
  table.ph[data-ph="list"] tr.ph-open::after { transform: rotate(-135deg); top: 22px; }
  /* which two figures each row shows */
  table.ph[data-ph="list"][data-ph-keys]::before {
    content: attr(data-ph-keys); display: block; text-align: right; font-size: 11.5px; color: var(--dim); padding: 8px 38px 2px 12px;
  }
}

/* ═══ Investing extras (app-invest.js): results & filings, what you really own, where the gain came from,
       P/E and promoter holding, mutual funds, watchlist buy-below. Existing tokens and card language only. ═══ */
.inv-card { margin-bottom: 14px; }
.inv-two { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.inv-two > div > .tp-k { margin: 2px 0 6px; }
.inv-tiles { margin-bottom: 14px; }
.inv-table td { vertical-align: top; }
.inv-table .tp-s { margin-top: 1px; }
.inv-purpose { color: var(--muted); font-size: 12px; }
.inv-seg { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.inv-seg button { padding: 4px 13px; font: 600 11px var(--sans); border-radius: 20px; border: 1px solid var(--border2); background: var(--surface2); color: var(--muted); cursor: pointer; min-height: 30px; }
.inv-seg button.on { border-color: var(--accent); background: var(--blue-bg); color: var(--accent); }
.inv-thesis { padding: 10px 0; border-top: 1px solid var(--border); }
.inv-thesis:first-child { border-top: none; padding-top: 0; }
.inv-thesis-head { margin-bottom: 4px; }
.inv-thesis-text { font-size: 12.5px; color: var(--text); line-height: 1.5; white-space: pre-wrap; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; margin: 4px 0 8px; }
.inv-thesis-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.inv-filings { display: flex; flex-direction: column; }
.inv-filing { padding: 9px 0; border-top: 1px solid var(--border); }
.inv-filing:first-child { border-top: none; padding-top: 0; }
.inv-filing-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; }
.inv-filing-text { font-size: 12px; color: var(--muted); line-height: 1.5; }
.inv-filing-text a { color: var(--accent); white-space: nowrap; }
.inv-buy { display: inline-block; text-align: right; }
.inv-buy-set { padding: 2px 9px; min-height: 0; font-size: 11px; }
.inv-lots td { padding-top: 0 !important; border-top: none !important; }
.inv-lot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding: 3px 0; }
.inv-lot .btn { padding: 2px 6px; min-height: 0; }
.inv-mf-form { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.inv-mf-form .tp-k { margin-bottom: 8px; }
#inv-mf-results { display: flex; flex-direction: column; gap: 4px; margin: -4px 0 10px; max-height: 260px; overflow-y: auto; }
.inv-mf-hit { text-align: left; font: 12.5px var(--sans); color: var(--text); background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; cursor: pointer; }
.inv-mf-hit:hover { border-color: var(--border2); }
.inv-nw { align-items: flex-start; margin-top: 6px; line-height: 1.45; }
.inv-nw input { margin-top: 2px; }
@media (min-width: 1440px) { .inv-two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.inv-pfb-status { font-size: 12px; color: var(--muted); background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 12px; line-height: 1.5; }
.inv-pfb-status.stale { border-color: rgba(226,173,75,.45); color: var(--amber); }
.inv-table tr.inv-top td:first-child b { color: var(--accent); }
.inv-run { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.inv-run-text { font-size: 12.5px; color: var(--muted); line-height: 1.55; flex: 1; min-width: 220px; }
.inv-run-text b { color: var(--text); }
.inv-run-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inv-run-acts a.btn { text-decoration: none; }
.inv-run.is-running .inv-run-text b, .inv-run.is-pending .inv-run-text b { color: var(--accent); }
.inv-run.is-failed .inv-run-text b { color: var(--red); }
.inv-runlog { margin-top: 6px; }
.inv-runlog pre { font: 11px/1.45 var(--code); color: var(--muted); background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; margin: 6px 0 0; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; }
.inv-newkey { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--blue-bg); }
.inv-key-row { display: flex; gap: 8px; align-items: center; margin: 6px 0 8px; flex-wrap: wrap; }
.inv-key-row code { font: 12px var(--code); color: var(--text); background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 5px 8px; word-break: break-all; flex: 1; min-width: 0; }
.inv-steps { margin: 0; padding-left: 18px; font-size: 12px; color: var(--muted); line-height: 1.6; }
/* Strategies: New / Edit strategy form and the "waiting for Portfolio Builder" list (app-invest.js) */
.inv-pfb-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.inv-ed { display: flex; flex-direction: column; }
.inv-ed-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.inv-ed-row:first-child { border-top: 0; padding-top: 2px; }
.inv-ed-k { font-size: 12px; font-weight: 600; color: var(--text); padding-top: 6px; }
.inv-ed-v { min-width: 0; }
.inv-ed-v > .inv-seg { margin-bottom: 6px; }
.inv-ed-v > .tp-s { margin-top: 2px; }
.inv-ed-v > select.tp-input, .inv-ed-v > input.tp-input { max-width: 100%; }
.inv-ed-v > input[type="text"].tp-input { width: min(100%, 360px); }
.inv-ed-v .inv-seg + select.tp-input { margin-top: 2px; }
.inv-ed-idx button { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.25; padding: 5px 12px; border-radius: var(--radius); }
.inv-ed-idx button small { font-weight: 500; font-size: 10px; color: var(--dim); }
.inv-ed-idx button.on small { color: var(--accent); opacity: .8; }
.inv-ed-nums { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.inv-ed-nums .tp-input, .inv-ed-weights .tp-input { width: 96px; }
.inv-ed-weights { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; }
.inv-ed-err { margin: 10px 0 0; padding: 8px 10px; border: 1px solid rgba(242,100,111,.4); background: var(--red-bg); border-radius: var(--radius); color: var(--red); font-size: 12px; line-height: 1.5; }
.inv-ed-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.inv-edits { display: flex; flex-direction: column; }
.inv-edit { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 12.5px; }
.inv-edit:first-child { border-top: 0; padding-top: 0; }
.inv-edit.bad .inv-edit-note { color: var(--red); }
.inv-edit-acts { display: flex; gap: 6px; flex-shrink: 0; }
/* Strategies: weekly-rules strategies (strength phases, exit points, rule rows, strength map) */
.inv-ph { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 20px; font: 600 10.5px var(--sans); line-height: 1.6; white-space: nowrap; border: 1px solid var(--border2); background: var(--surface2); color: var(--muted); vertical-align: middle; }
button.inv-ph { cursor: pointer; min-height: 26px; padding: 2px 10px; margin: 0 4px 0 0; }
.inv-ph.on.inv-ph-lead { background: var(--green-bg); color: var(--green); border-color: transparent; }
.inv-ph.on.inv-ph-imp { background: var(--blue-bg); color: var(--accent); border-color: transparent; }
.inv-ph.on.inv-ph-weak { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
.inv-ph.on.inv-ph-lag { background: var(--red-bg); color: var(--red); border-color: transparent; }
.inv-wrules { display: flex; flex-direction: column; gap: 6px; }
.inv-wrule { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface2); }
.inv-wrule.off { opacity: .55; }
.inv-wrule > input[type="checkbox"] { flex-shrink: 0; }
.inv-wrule > .tp-field { flex-shrink: 0; margin: 0; }
.inv-wbody { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.inv-wbody select.tp-input { max-width: 190px; }
.inv-wrule .inv-ed-p { width: 64px; }
.inv-xbar { display: inline-block; width: 56px; height: 5px; border-radius: 3px; background: var(--surface2); border: 1px solid var(--border); vertical-align: middle; margin-left: 6px; overflow: hidden; }
.inv-xbar > i { display: block; height: 100%; background: var(--amber); }
.inv-xbar.hot > i { background: var(--red); }
.inv-why { font-size: 11px; color: var(--dim); line-height: 1.45; margin-top: 2px; max-width: 440px; }
.inv-smap { width: 100%; max-width: 560px; height: auto; display: block; margin: 4px 0 2px; }
.inv-smap text { font: 10px var(--sans); fill: var(--dim); }
.inv-smap .lbl { font-weight: 600; fill: var(--text); }
.inv-pick-area { width: min(100%, 520px); min-height: 64px; font: 12px var(--code); }
/* Strategies: "Set up another PC" guide */
.inv-guide > summary, .inv-guide-sub > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--accent); padding: 2px 0; }
.inv-guide-sub { margin-top: 12px; }
.inv-guide-sub ul { margin: 8px 0 0; }
.inv-gneed { margin: 10px 0 4px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface2); font-size: 12px; color: var(--muted); line-height: 1.55; }
.inv-gneed b { color: var(--text); }
.inv-guide-steps { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.inv-gstep { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.inv-gstep:first-child { border-top: 0; }
.inv-gnum { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 600 12px var(--sans); color: var(--accent); background: var(--blue-bg); border: 1px solid rgba(125,163,255,.35); }
.inv-gtitle { font-size: 13px; font-weight: 600; color: var(--text); margin: 2px 0 6px; }
.inv-gbody, .inv-guide .inv-gopt { font-size: 12px; color: var(--muted); line-height: 1.6; min-width: 0; }
.inv-gbody b, .inv-gopt b { color: var(--text); }
.inv-gbody > .tp-s { font-size: 12px; line-height: 1.6; margin: 2px 0; }
.inv-gbody a, .inv-gopt a { color: var(--accent); }
.inv-gbody ul, .inv-gbody ol, .inv-gopt ul, .inv-gopt ol, .inv-guide-sub ul { margin: 4px 0 6px; padding-left: 18px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.inv-gbody li, .inv-gopt li, .inv-guide-sub li { margin: 2px 0; }
.inv-gopt { margin: 6px 0 8px; }
.inv-guide > .inv-gopt { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.inv-gzip { margin: 2px 0 8px; padding: 7px 10px; border: 1px solid rgba(226,173,75,.4); border-radius: var(--radius); background: var(--amber-bg); font-size: 12px; color: var(--muted); line-height: 1.55; }
.inv-gzip.ok { border-color: rgba(125,163,255,.35); background: var(--blue-bg); }
.inv-gzip b { color: var(--text); }
.inv-cmd { margin: 6px 0 8px; }
.inv-cmd code { font-size: 11.5px; }
/* Strategies: the amount the model's quantities and orders are shown for */
.inv-amt { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; margin: 0 0 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface2); }
.inv-amt .tp-field { margin: 0; }
.inv-amt .tp-input { width: 130px; }
.inv-amt .tp-s { margin: 0; flex: 1; min-width: 220px; }
/* Strategies: follow with my money (amount box) and Portfolio → Running strategies */
.inv-run-acts2 { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; flex-basis: 100%; }
.inv-run-have { flex: 1; min-width: 220px; margin: 0; }
.inv-run-form { flex-basis: 100%; display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px dashed var(--border2); }
.inv-run-form .inv-ed-acts { margin-top: 2px; }
.inv-run-form select.tp-input { min-width: 160px; }
.inv-rs { padding: 12px 0 14px; border-top: 1px solid var(--border); }
.inv-rs:first-child { border-top: 0; padding-top: 0; }
.inv-rs-head { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; font-size: 13.5px; }
.inv-rs-head .tp-s { margin: 0 0 0 auto; }
.inv-rs-nums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.inv-rs-nums > div { border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 10px; background: var(--surface2); min-width: 0; }
.inv-rs-nums span { display: block; font-size: 11px; color: var(--dim); }
.inv-rs-nums b { font-size: 14px; font-weight: 600; }
.inv-rs-nums small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.inv-rs-todo { border: 1px solid var(--border-accent); background: var(--blue-bg); border-radius: var(--radius); padding: 10px 12px; margin: 6px 0 10px; }
.inv-rs-todo-h { display: flex; gap: 4px 12px; flex-wrap: wrap; align-items: baseline; margin-bottom: 6px; }
.inv-rs-todo-h .tp-s { margin: 0; }
.inv-rs-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.inv-rs-list { margin: 4px 0 8px; max-width: 640px; }
.inv-rs-li { display: grid; grid-template-columns: minmax(0, 1fr) auto 96px; gap: 10px; align-items: baseline; padding: 5px 0; border-top: 1px solid var(--border); font-size: 12.5px; }
.inv-rs-list.four .inv-rs-li { grid-template-columns: minmax(0, 1fr) 64px 64px 80px; }
.inv-rs-li > span:not(:first-child) { text-align: right; }
.inv-rs-li.hd { border-top: 0; font-size: 11px; color: var(--dim); padding-top: 0; }
@media (max-width: 640px) { .inv-rs-nums { grid-template-columns: 1fr 1fr; } .inv-rs-head .tp-s { margin-left: 0; flex-basis: 100%; } }
/* Strategies: settings history */
.inv-hist-list { margin: 2px 0 8px; }
.inv-hist { border-top: 1px solid var(--border); padding: 8px 0; }
.inv-hist:first-child { border-top: 0; padding-top: 2px; }
.inv-hist-h { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; font-size: 13px; }
.inv-hist-h > div { flex: 1 1 260px; min-width: 0; }
.inv-hist-res { font-size: 12px; color: var(--muted); }
.inv-hist.cur .inv-hist-h b { color: var(--text); }
.inv-hist-ch { margin: 4px 0 2px; padding-left: 18px; font-size: 12.5px; }
.inv-hist-ch li { margin: 1px 0; }
.inv-hist-all { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); gap: 2px 12px; font-size: 12px; margin: 4px 0; }
.inv-hist-all > div { display: contents; }
.inv-hist-all span:first-child { color: var(--dim); }
.inv-hist-all span:last-child { overflow-wrap: anywhere; }
.inv-hist-gone { margin-top: 6px; }
@media (max-width: 640px) { .inv-hist-all { grid-template-columns: 1fr; } .inv-hist-all span:last-child { margin-bottom: 4px; } }
/* Running strategies: order lists you record fills on, the trade list */
.inv-rs-vs { margin: -2px 0 8px; }
.inv-rs-cash { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; margin: 4px 0 10px; }
.inv-fl { margin-top: 4px; }
.inv-fl-top { display: flex; gap: 6px 14px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.inv-fl-top .tp-s { margin: 0; flex: 1 1 280px; }
.inv-fl-date .tp-input { width: 150px; }
.inv-fl-row { display: grid; grid-template-columns: minmax(0, 1fr) 76px 96px 76px 38px; gap: 6px 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--border); font-size: 12.5px; max-width: 760px; }
.inv-fl-row.hd { border-top: 0; padding: 0 0 2px; font-size: 11px; color: var(--dim); }
.inv-fl-row.hd > span:not(:first-child) { text-align: right; padding-right: 2px; }
.inv-fl-row > .tp-input { width: 100%; min-width: 0; text-align: right; }
.inv-fl-row > .btn { width: 38px; padding-left: 0; padding-right: 0; justify-content: center; }
.inv-fl-what { min-width: 0; display: flex; gap: 2px 6px; align-items: baseline; flex-wrap: wrap; }
.inv-fl-what small { flex-basis: 100%; margin: 0; }
.inv-fl .inv-ed-acts { margin-top: 8px; }
.inv-tr-list { margin: 2px 0 8px; max-width: 760px; }
.inv-tr { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; padding: 5px 0; border-top: 1px solid var(--border); font-size: 12.5px; }
.inv-tr:first-child { border-top: 0; }
.inv-tr .tp-s { margin: 0; }
.inv-tr-acts { margin-left: auto; display: flex; gap: 6px; }
.inv-tr.ed .tp-field .tp-input { width: 96px; }
.inv-tr.ed .tp-field input[type="date"] { width: 140px; }
.inv-tr-add { border-top: 1px dashed var(--border2); padding-top: 8px; margin-top: 6px; }
.inv-tr-add .inv-ed-nums { margin: 6px 0 2px; }
.inv-tr-add .inv-ed-nums input[type="date"].tp-input { width: 140px; }
@media (max-width: 640px) {
  .inv-fl-row { grid-template-columns: 1fr 1fr 1fr 40px; }
  .inv-fl-row > .inv-fl-what { grid-column: 1 / -1; }
  .inv-fl-row.hd > span:first-child { display: none; }
  .inv-fl-row.hd > span:not(:first-child) { text-align: left; }
  .inv-fl-row > .tp-input { text-align: left; }
}
/* Strategies: "How to use this page" (the tutorial, folded by section) */
/* phones: the guide's stacked table cells drop the legacy table padding (an !important rule in @layer legacy) */
@layer ds-force { @media (max-width: 640px) { .inv-hbody .inv-htable td { border: 0 !important; padding: 1px 0 !important; } } }
.inv-hsec { border-top: 1px solid var(--border); padding: 9px 0; }
.inv-guide > .inv-hsec:first-of-type { margin-top: 10px; }
.inv-hsec > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text); list-style: none; display: flex; align-items: center; gap: 8px; }
.inv-hsec > summary::-webkit-details-marker { display: none; }
.inv-hsec > summary::before { content: '›'; color: var(--dim); width: 10px; display: inline-block; transition: transform .15s; font-size: 15px; line-height: 1; }
.inv-hsec[open] > summary::before { transform: rotate(90deg); }
.inv-hbody { padding: 8px 0 2px 18px; font-size: 12.5px; color: var(--muted); line-height: 1.6; max-width: 900px; }
.inv-hbody p { margin: 0 0 8px; }
.inv-hbody b { color: var(--text); }
.inv-hbody ol, .inv-hbody ul { margin: 2px 0 10px; padding-left: 18px; }
.inv-hbody li { margin: 3px 0; }
.inv-hbody code { font: 11.5px var(--code); color: var(--text); background: var(--surface2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
.inv-hbody .mi-table-scroll { margin: 4px 0 10px; }
.inv-htable th, .inv-htable td { white-space: normal; vertical-align: top; font-size: 12px; line-height: 1.5; }
.inv-htable td:first-child { color: var(--text); min-width: 110px; }
.inv-fit { display: flex; flex-direction: column; margin: 6px 0 10px; max-width: 760px; }
.inv-fit-tier { border: 1px solid var(--border2); border-radius: 12px; padding: 10px 12px 12px; }
.inv-fit-tier.pc { border-color: var(--border-accent); background: var(--blue-bg); }
.inv-fit-name { font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.inv-fit-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inv-fit-box { border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; background: var(--surface); }
.inv-fit-box b { display: block; font-size: 12.5px; }
.inv-fit-box span { font-size: 11.5px; color: var(--muted); }
.inv-fit-link { display: flex; justify-content: space-around; gap: 12px; font-size: 11.5px; color: var(--dim); padding: 7px 0; text-align: center; }
.inv-phase-axis { font-size: 11px; color: var(--dim); margin: 4px 0; }
.inv-phases { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; max-width: 540px; position: relative; }
.inv-phase { border-radius: 8px; padding: 10px 12px; font-size: 11.5px; color: var(--muted); line-height: 1.5; min-height: 78px; }
.inv-phase b { display: block; font-size: 12.5px; margin-bottom: 2px; }
.inv-phase.lead { background: var(--green-bg); } .inv-phase.lead b { color: var(--green); }
.inv-phase.imp { background: var(--blue-bg); } .inv-phase.imp b { color: var(--accent); }
.inv-phase.weak { background: var(--amber-bg); } .inv-phase.weak b { color: var(--amber); }
.inv-phase.lag { background: var(--red-bg); } .inv-phase.lag b { color: var(--red); }
.inv-phase-turn { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 36px; height: 36px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border2); display: grid; place-items: center; font-size: 18px; color: var(--muted); }
@media (max-width: 640px) {
  .inv-hbody { padding-left: 4px; }
  .inv-fit-boxes { grid-template-columns: 1fr; }
  .inv-phase { padding: 8px; min-height: 92px; }
  /* tables stack: one block per row, each value after its column's name */
  .inv-htable thead { display: none; }
  .inv-htable, .inv-htable tbody, .inv-htable tr, .inv-htable td { display: block; width: auto; min-width: 0; }
  .inv-hbody .inv-htable tr { border-top: 1px solid var(--border); padding: 8px 0; }
  .inv-htable td:first-child { font-weight: 600; }
  .inv-htable td:not(:first-child)[data-h]:not([data-h=""])::before { content: attr(data-h) ": "; color: var(--dim); }
}
.inv-ic { font: 11px var(--code); color: var(--text); background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1px 5px; }
@media (max-width: 640px) {
  .inv-ed-row { grid-template-columns: 1fr; gap: 6px; }
  .inv-ed-k { padding-top: 0; }
  .inv-wrule { align-items: flex-start; flex-wrap: wrap; }
  .inv-wbody { flex: 1 1 calc(100% - 30px); }
  .inv-wrule > .tp-field { margin-left: 22px; }
  .inv-wrule > .ln-del { margin-left: auto; }
  .inv-wbody select.tp-input { max-width: 100%; }
  .inv-edit { flex-direction: column; gap: 6px; }
}
