/* Fonts are loaded via <link rel="stylesheet"> in base.html so the browser's
   preload scanner discovers them before this file finishes parsing. */

/* ── Font-swap CLS fix ────────────────────────────────────────────────────
   display=swap (base.html) paints text in a system fallback immediately,
   then swaps to the real webfont once it downloads — good for LCP, but the
   fallback's metrics don't match the webfont's, so the swap reflows text
   (visible as a jump, or a scroll-anchoring nudge if the reader is already
   scrolled past the affected element).

   Each block below is a same-named "Fallback" face bound to a local system
   font, with size-adjust/ascent-override/descent-override/line-gap-override
   tuned so it occupies the exact same line-box as the real webfont. Values
   computed from the actual webfont + system-font metrics (fontTools OS/2
   table: xAvgCharWidth for size-adjust, sTypoAscender/Descender/LineGap for
   the rest) — not eyeballed. Re-run that computation if any of the three
   families changes.

   local('Times New Roman'/'Arial'/'Courier New') targets the browser's
   actual `serif`/`sans-serif`/`monospace` default on Windows (the majority
   platform here); a machine without them falls through to the plain generic
   keyword still last in each stack, same as before this fix existed. */
@font-face {
    font-family: 'Fraunces Fallback';
    src: local('Times New Roman');
    size-adjust: 151.04%;
    ascent-override: 64.75%;
    descent-override: 16.88%;
    line-gap-override: 0%;
}
@font-face {
    font-family: 'Instrument Sans Fallback';
    src: local('Arial');
    size-adjust: 127.77%;
    ascent-override: 75.92%;
    descent-override: 19.57%;
    line-gap-override: 0%;
}
@font-face {
    font-family: 'JetBrains Mono Fallback';
    src: local('Courier New');
    size-adjust: 99.98%;
    ascent-override: 102.02%;
    descent-override: 30%;
    line-gap-override: 0%;
}

/* Public pages float a fixed-position nav bar over the content. Without this,
   any #anchor jump (nav "Analyze a wallet" button, footer #features/#how/#faq
   links) lands its target right underneath the nav instead of below it.
   Derived from the nav's own dimensions so the two can never drift; the
   ≤768px block re-declares --lyx-nav-h and this recalculates for free. */
html { scroll-padding-top: calc(var(--lyx-nav-h) + var(--lyx-nav-top) + 24px); }

:root {
    color-scheme: dark;  /* native controls (selects, scrollbars) use dark OS theme */

    /* Color Palette */
    --bg-app: #0a0a0a;
    --bg-sidebar: #051515;
    --bg-card: rgba(10, 25, 25, 0.85);
    --bg-card-hover: rgba(15, 35, 35, 0.95);

    --border-subtle: rgba(80, 210, 193, 0.12);
    --border-focus: rgba(80, 210, 193, 0.5);

    --primary: #50d2c1;
    --primary-text: var(--primary);
    /* Text-on-surface variants of the state colours. Same as the fills in dark
       mode; darker in light mode, where #10b981/#f43f5e on white fail 4.5:1. */
    --success-text: var(--success);
    --danger-text: var(--danger);
    --primary-glow: rgba(80, 210, 193, 0.3);
    /* Ink for text/icons sitting ON a --primary or --gradient-brand fill.
       Same value in both themes because the fill itself does not change.
       ~9:1 on #50d2c1, where the older #fff-on-teal pattern manages ~2:1. */
    --primary-ink: #04211e;
    /* Subordinate copy on that same fill: ~5.5:1, still comfortably readable. */
    --primary-ink-soft: rgba(4, 33, 30, 0.78);
    --accent: #FFB454;
    /* Amber that is legible as TEXT or as a control outline. On dark surfaces
       that is --accent itself (~10:1); on the light theme --accent measures
       1.76:1 on white, below even the 3:1 floor for UI components, so it needs
       a darker companion. Use --accent for fills/glows, --accent-ink for
       anything a user has to read. */
    --accent-ink: var(--accent);
    /* Amber tint for surfaces that carry a draft-group state (the sidebar's
       member count and its disclosure hover). The --success-bg/--danger-bg
       companion for --accent, which the tray and count were inlining. */
    --accent-soft: rgba(255, 180, 84, 0.16);

    /* ── Categorical chart series ──────────────────────────────────────────
       Seven slots, assigned in fixed order and never cycled — a chart with an
       8th category folds the tail into "Other" rather than inventing a hue.

       These are NOT --primary/--accent. Those two are UI accents tuned to sit
       on a dark surface at L≈0.79; chart fills need L 0.48–0.67 or adjacent
       slices stop separating. Slots 1 and 2 keep the brand's teal and amber
       *hues*, stepped into the band, so the charts still read as ours.

       Validated (lightness band, chroma floor, CVD ΔE, normal-vision ΔE,
       contrast) against both surfaces — re-run the check before editing:
       dataviz/scripts/validate_palette.js "<hexes>" --mode dark --surface #0a1616 */
    --cat-1: #009e95;   /* teal — brand hue */
    --cat-2: #b77610;   /* amber — brand accent hue */
    --cat-3: #4c88d3;   /* blue */
    --cat-4: #bf6291;   /* rose */
    --cat-5: #68963d;   /* green */
    --cat-6: #9372c8;   /* violet */
    --cat-7: #c8635d;   /* clay — also the "Other" bucket */

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --danger: #f43f5e;
    --danger-bg: rgba(244, 63, 94, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --purple: #a78bfa;
    --purple-bg: rgba(167, 139, 250, 0.1);

    --text-primary: #f7f6f3;
    --text-secondary: #b8c4c3;
    --text-tertiary: #7a9190;

    /* Gradients */
    --gradient-brand: linear-gradient(135deg, #50d2c1 0%, #2dd4bf 100%);
    --gradient-surface: linear-gradient(180deg, rgba(10, 25, 25, 0.7) 0%, rgba(5, 21, 21, 0.7) 100%);

    /* Public/landing-page surfaces (see DESIGN.md "Landing Surface" / "Landing
       Hairline" / "Abyss Teal") — channel values only, so each usage keeps its
       own contextual opacity via rgba(var(--landing-surface-rgb), X). */
    --landing-surface-rgb: 30, 41, 59;
    --abyss-teal-rgb: 5, 21, 21;
    --landing-hairline: rgba(255, 255, 255, 0.06);

    /* Landing-page ambient/hover shadows — deeper and more dramatic than the
       dashboard's --shadow-hover, so named separately rather than forced into
       an ill-fitting shared token. */
    --landing-shadow-hero-panel: 0 24px 48px rgba(0, 0, 0, 0.6);
    --landing-shadow-tab-wrap: 0 24px 48px rgba(0, 0, 0, 0.5);
    --landing-shadow-pub-card-hover: 0 12px 28px rgba(0, 0, 0, 0.5);
    --landing-shadow-card-hover: 0 10px 24px rgba(0, 0, 0, 0.5);

    /* Dimensions */
    --sidebar-width: 260px;
    --header-height: 70px;

    /* Public floating nav — single source of truth for its height and float
       offset. html{scroll-padding-top}, the mobile menu's top padding and the
       nav shell itself all derive from these. */
    --lyx-nav-h: 68px;
    /* Yodoya promo strip (see .ydy-promo): it sits in the normal flow, so
       page content already starts below it. -vis is the part still on screen
       as it scrolls away; fixed and sticky things (the nav and everything
       keyed off --lyx-nav-top) offset by it. -h is its full height. */
    --ydy-promo-h: 0px;
    --ydy-promo-vis: 0px;
    --lyx-nav-top: calc(14px + var(--ydy-promo-vis));
    /* Clearance from the top of the viewport to the first line of page content
       on any public page. The nav floats, so content has to clear its height
       AND its float offset before the 2.5rem of actual breathing room begins.
       Derived, never hand-set: .lyx-guide used to carry a flat 5.5rem that put
       a breadcrumb 6px under the nav on desktop and flush against it on mobile,
       where --lyx-nav-h drops to 58px. Recalculates for free at that
       breakpoint. */
    --lyx-nav-clear: calc(var(--lyx-nav-h) + 14px + 2.5rem);

    /* Effects */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 28px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --glass: blur(8px);

    /* Motion — state-only (hover, focus, flash-on-change, skeleton, tab
       switches), never decorative. See prefers-reduced-motion kill-switch
       below, which every animation/transition must respect. */
    --dur-fast: 150ms;
    --dur-base: 200ms;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

    /* Fonts */
    --font-heading: 'Fraunces', 'Fraunces Fallback', serif;
    --font-body: 'Instrument Sans', 'Instrument Sans Fallback', sans-serif;

    /* Muted text fallback (used in var(--text-muted, …) patterns) */
    --text-muted: #94a3b8;

    /* Subtle neutral surfaces (referenced by portfolio/compound) */
    --bg-secondary: rgba(255, 255, 255, 0.03);
    --bg-tertiary: rgba(255, 255, 255, 0.06);
}

/* ══════════════════════════════════════════════════════════════════════════
   LIGHT MODE  —  activated via <html data-theme="light">
   ══════════════════════════════════════════════════════════════════════════ */
[data-theme="light"] {
    color-scheme: light;

    --bg-app:          #f1f5f9;
    --bg-sidebar:      #ffffff;
    --bg-card:         rgba(255, 255, 255, 0.97);
    --bg-card-hover:   rgba(255, 255, 255, 1);
    --border-subtle:   rgba(80, 210, 193, 0.22);
    --border-focus:    rgba(80, 210, 193, 0.65);
    --primary-glow:    rgba(80, 210, 193, 0.18);

    --accent-ink:      #92400e;   /* 6.5:1 on the white sidebar; --accent is 1.76:1 */
    --accent-soft:     rgba(255, 180, 84, 0.28);   /* denser, to register on white */

    /* Same seven hues, re-stepped for a white surface rather than flipped —
       the dark steps lose contrast on white. Validated against #ffffff. */
    --cat-1: #008b82;
    --cat-2: #a75d00;
    --cat-3: #2971c6;
    --cat-4: #af467e;
    --cat-5: #4f8207;
    --cat-6: #8059bb;
    --cat-7: #b94642;

    --text-primary:    #0f172a;
    --text-secondary:  #334155;
    --text-tertiary:   #64748b;
    --text-muted:      #64748b;
    --primary-text:    #0f7d70;
    --success-text:    #047857;   /* 5.5:1 on white */
    --danger-text:     #be123c;   /* 6.1:1 on white */
    --bg-secondary:    rgba(0, 0, 0, 0.03);
    --bg-tertiary:     rgba(0, 0, 0, 0.06);

    --success-bg:      rgba(16, 185, 129, 0.12);
    --danger-bg:       rgba(244, 63, 94, 0.12);

    --gradient-surface: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(241,245,249,0.95) 100%);

    --shadow-sm:    0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md:    0 4px 12px rgba(0, 0, 0, 0.10);
    --shadow-hover: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* ── Light mode: component-level overrides for contrast and hardcoded values ─────── */
[data-theme="light"] a.link-inline,
[data-theme="light"] .link-inline,
[data-theme="light"] .nav-item.active,
[data-theme="light"] .nav-item:hover,
[data-theme="light"] .sb-ref strong,
[data-theme="light"] .lyx-mobile-link.nav-active {
    color: var(--primary-text);
}
[data-theme="light"] .data-table th {
    background: #f8fafc;
    border-bottom: 2px solid rgba(80, 210, 193, 0.2);
}
[data-theme="light"] .data-table td {
    border-bottom-color: rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .data-table tbody tr:hover td {
    background: rgba(80, 210, 193, 0.05);
}
[data-theme="light"] .table-container {
    background: #ffffff;
}
[data-theme="light"] .modal-overlay {
    background: rgba(15, 23, 42, 0.5);
}
[data-theme="light"] .modal-box {
    background: #ffffff;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
}
[data-theme="light"] .form-input,
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="search"],
[data-theme="light"] input[type="date"],
[data-theme="light"] select,
[data-theme="light"] textarea {
    background: #ffffff;
    border-color: rgba(80, 210, 193, 0.35);
    color: var(--text-primary);
}
[data-theme="light"] select option {
    background: #ffffff;
    color: #0f172a;
}
[data-theme="light"] .nav-item:hover {
    background: rgba(80, 210, 193, 0.1);
    border-color: rgba(80, 210, 193, 0.35);
    color: var(--text-primary);
}
[data-theme="light"] .sidebar {
    box-shadow: 1px 0 0 rgba(0, 0, 0, 0.06), 4px 0 16px rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .seg {
    background: rgba(241, 245, 249, 0.95);
}
[data-theme="light"] .seg-item.active {
    color: #0f172a;
}
[data-theme="light"] .progress-track {
    background: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .badge-soft {
    background: rgba(80, 210, 193, 0.1);
    border-color: rgba(80, 210, 193, 0.25);
}
[data-theme="light"] .dcard,
[data-theme="light"] .compact-trade-card {
    background: #f8fafc;
}
[data-theme="light"] .btn-sidebar {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(80, 210, 193, 0.2);
    color: var(--text-secondary);
}
[data-theme="light"] .btn-sidebar:hover {
    background: rgba(80, 210, 193, 0.08);
    color: var(--text-primary);
    border-color: rgba(80, 210, 193, 0.4);
}
[data-theme="light"] #mobile-toggle {
    background: #ffffff;
    border-bottom-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .sidebar-overlay {
    background: rgba(15, 23, 42, 0.35);
}
[data-theme="light"] .heatmap-neutral {
    background: rgba(100, 116, 139, 0.15);
}
[data-theme="light"] .heatmap-positive {
    background: rgba(16, 185, 129, 0.45);
}
[data-theme="light"] .heatmap-negative {
    background: rgba(244, 63, 94, 0.45);
}
/* Modal pref rows */
[data-theme="light"] .notif-toggle-slider {
    background: rgba(0, 0, 0, 0.12);
}

/* ── Theme-switch smooth transitions ─────────────────────────────────────── */
body,
.sidebar,
.main-content,
#mobile-toggle,
.panel,
.kpi-card,
.table-container,
.modal-box,
.dcard,
.compact-trade-card,
.badge,
.seg,
.form-input,
select,
input {
    transition: background-color 0.22s ease, color 0.22s ease, border-color 0.22s ease;
}
/* Data table cells already have bg-color transition; header needs it too */
.data-table th {
    transition: background-color 0.22s ease, border-color 0.22s ease;
}

/* ── Theme toggle button ─────────────────────────────────────────────────── */
.btn-theme-toggle {
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 0.4rem 0.55rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    min-height: 36px;
    flex-shrink: 0;
}
.btn-theme-toggle:hover {
    color: var(--primary-text);
    border-color: var(--primary);
    background: var(--primary-glow);
}
/* Fixed theme toggle for public pages */
.theme-toggle-fixed {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 9998;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 0.55rem 0.7rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
}
.theme-toggle-fixed:hover {
    color: var(--primary-text);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Theme icon visibility — CSS-driven so icons match theme before JS fires */
.th-sun { display: none; }
[data-theme="light"] .th-sun  { display: inline-block; }
[data-theme="light"] .th-moon { display: none; }

/* ── Chart canvas skeleton loader ────────────────────────────────────────── */
.chart-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        var(--bg-card) 0%,
        rgba(80, 210, 193, 0.05) 50%,
        var(--bg-card) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.6s ease-in-out infinite;
    border-radius: var(--radius-md);
    z-index: 1;
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Generic Skeleton Loaders ───────────────────────────────────────────── */
.skel-shimmer {
    background: linear-gradient(
        90deg,
        var(--bg-card) 0%,
        rgba(80, 210, 193, 0.08) 50%,
        var(--bg-card) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.6s ease-in-out infinite;
    border-radius: var(--radius-sm);
    display: block;
}
[data-theme="light"] .skel-shimmer {
    background: linear-gradient(
        90deg,
        #f1f5f9 0%,
        rgba(80, 210, 193, 0.16) 50%,
        #f1f5f9 100%
    );
    background-size: 200% 100%;
}
.skel-title {
    height: 2rem;
    width: 60%;
    max-width: 220px;
    border-radius: var(--radius-md);
    margin: 0.25rem 0 0.5rem 0;
}
.skel-sub {
    height: 0.85rem;
    width: 80%;
    max-width: 260px;
    border-radius: var(--radius-sm);
    margin-top: 0.25rem;
}
.skel-kpi-val {
    height: 1.6rem;
    width: 50%;
    max-width: 120px;
    border-radius: var(--radius-sm);
    margin-bottom: 0.35rem;
}
.skel-card {
    padding: 0.9rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    margin-bottom: 0.6rem;
}
.skel-row {
    height: 2.2rem;
    margin: 0.4rem 0;
    border-radius: var(--radius-sm);
}
.skel-bar {
    height: 0.5rem;
    border-radius: var(--radius-sm);
    margin: 0.5rem 0;
}

/* ── Flash-on-change: one vocabulary for "this live value just updated",
   used by dashboard KPIs, positions rows, and watchlist prices via
   LYX.flash(el, dir). Wrap the changing value/cell in .flash-target so the
   tint always has something to sit on top of. ─────────────────────────── */
.flash-target { border-radius: 4px; }
@keyframes lyxFlashUp   { 0% { background-color: var(--success-bg); } 100% { background-color: transparent; } }
@keyframes lyxFlashDown { 0% { background-color: var(--danger-bg); } 100% { background-color: transparent; } }
.flash-up   { animation: lyxFlashUp 900ms var(--ease-out); }
.flash-down { animation: lyxFlashDown 900ms var(--ease-out); }

/* ── Toast: LYX.toast(msg, opts) ───────────────────────────────────────────
   The companion to .flash-*. Flash says "this number on screen changed";
   a toast says "the thing you asked for happened" — including when the result
   arrives after a navigation and there is nothing left on screen to flash.

   z-index 1100 places it above the page and the sticky section nav but below
   .sc-modal, so a share dialog is never covered by its own toast. */
.lyx-toasts {
    position: fixed;
    /* Bottom-CENTRE, not the usual corner. Both corners are already taken by
       third-party floating widgets — Ko-fi bottom-left, the consent button
       bottom-right, the latter at z-index 99999999 — so a corner toast landed
       underneath one of them and went unread. */
    left: 50%;
    transform: translateX(-50%);
    bottom: 1.25rem;
    z-index: 1100;
    display: flex;
    flex-direction: column-reverse;   /* newest closest to the edge */
    align-items: center;
    gap: 0.5rem;
    width: max-content;
    max-width: min(30rem, calc(100vw - 2rem));
    pointer-events: none;             /* the page stays clickable around it */
}
.lyx-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.75rem 0.75rem 1rem;
    /* Brighter than a panel: this is a message that must be noticed within a
       few seconds and then goes away, not a surface to live on. */
    border: 1px solid var(--border-focus);
    border-radius: var(--radius-pill);
    background: var(--bg-sidebar);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.25);
    color: var(--text-primary);
    font-size: 0.86rem;
    font-weight: 500;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(0.75rem);
    transition: opacity var(--dur-base) var(--ease-out),
                transform var(--dur-base) var(--ease-out);
}
.lyx-toast.is-in { opacity: 1; transform: none; }
.lyx-toast.is-out { opacity: 0; transform: translateY(0.35rem); }
.lyx-toast-msg { flex: 1; min-width: 0; line-height: 1.35; }
.lyx-toast-up { border-color: rgba(16, 185, 129, 0.55); }
.lyx-toast-down { border-color: rgba(244, 63, 94, 0.55); }

/* The undo affordance. Teal and underlined because it is the one thing in the
   toast worth clicking, and a toast that vanishes must not hide it. */
.lyx-toast-action {
    flex-shrink: 0;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-focus);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--primary-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.lyx-toast-action:hover { background: var(--primary-glow); }
.lyx-toast-action:focus-visible,
.lyx-toast-close:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.lyx-toast-close {
    flex-shrink: 0;
    width: 1.4rem; height: 1.4rem;
    display: grid; place-items: center;
    padding: 0; border: 0; border-radius: var(--radius-sm);
    background: none; color: var(--text-tertiary);
    font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.lyx-toast-close:hover { color: var(--text-primary); }

@media (max-width: 520px) {
    /* Full width, and lifted clear of the floating widgets that sit on the
       bottom edge of a phone screen. */
    .lyx-toasts {
        left: 0.75rem; right: 0.75rem;
        transform: none; width: auto; max-width: none;
        bottom: 4.5rem;
    }
    .lyx-toast { border-radius: var(--radius-md); }
}

/* The global reduced-motion block below zeroes the transition duration, which
   leaves .lyx-toast stuck at opacity 0 — the entry class never gets to move
   it. Start visible instead, so the toast appears and disappears instantly. */
@media (prefers-reduced-motion: reduce) {
    .lyx-toast { opacity: 1; transform: none; }
    .lyx-toast.is-out { opacity: 0; }
}

/* Reserve the scrollbar track at all times. Editing a group changes the page
   height, so the scrollbar could appear on one render and vanish on the next —
   and because the nav and content are centred, everything jumped sideways by
   the scrollbar's width until the next reload. */
html { scrollbar-gutter: stable; }

/* ── Reduced motion: state-conveying transitions collapse to instant,
   decorative/looping animations stop outright. Every animation added to
   this file must be covered here. ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   PAGE — Dashboard
   ══════════════════════════════════════════════════════════════════════════ */
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.dash-col  { display: flex; flex-direction: column; gap: 1.5rem; }
.dash-col > .panel { margin-bottom: 0; }
@media (max-width: 1099px) {
    .dash-col { display: contents; }
    /* Order is scoped per .dash-grid instance — chart/positions share one
       grid, history/analysis share a second, later one. */
    .dash-sec-chart     { order: 1; }
    .dash-sec-positions { order: 2; }
    .dash-sec-history   { order: 1; }
    .dash-sec-analysis  { order: 2; }

    /* No JS height-match below the grid breakpoint (columns stack) — cap
       Active Positions itself so a long position list scrolls in place
       instead of pushing the rest of the page down. */
    .dash-grid-hero .dash-sec-positions .panel-body > .flex-column { max-height: 420px; overflow-y: auto; }
}
@media (min-width: 1100px) {
    .dash-grid { grid-template-columns: 1.55fr 1fr; align-items: start; }
    /* The chart column is a deterministic height driver (.chart-wrap is a fixed
       320px), so stretching the row and taking the positions column out of the
       row-height calculation (height:0) makes 100% here mean "the chart's
       height" — with no JS. Replaces a ResizeObserver in dashboard.html. */
    .dash-grid-hero { align-items: stretch; }
    .dash-grid-hero .dash-col-right { height: 0; min-height: 100%; }
    /* Fill it, always — a short position list must not shrink the tile out of
       alignment with the chart beside it. The leftover room is absorbed by the
       .panel-footer totals pinned to the bottom edge, so a one-position wallet
       reads as a deliberately airy card rather than a half-empty one. */
    .dash-grid-hero .dash-sec-positions { flex: 1; }
}
.dash-grid-hero .dash-sec-positions { display: flex; flex-direction: column; min-height: 0; }
.dash-grid-hero .dash-sec-positions .panel-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* Breathing room for the scrollbar so it never sits on the card borders. */
.dash-grid-hero .dash-sec-positions .panel-body > .flex-column { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; }
.dash-grid-hero .dash-sec-positions .panel-body > .empty-state { flex: 1; }

/* ── Overview: Recent History scrolls inside the height Trade Analysis sets ──
   Same move as the hero row above: the history column is taken out of the
   row-height calculation, so Trade Analysis alone decides how tall the row is
   and history scrolls within it. The analysis panel's floor keeps at least
   five history rows visible when a short range leaves it nearly empty. */
.dash-sec-history { display: flex; flex-direction: column; min-height: 0; }
.dash-sec-history .panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.dash-sec-history thead th {
    position: sticky; top: 0; z-index: 1;
    /* Opaque: rows scroll underneath. The card tint layered over the page
       colour reproduces the panel's own background exactly. */
    background: linear-gradient(var(--bg-card), var(--bg-card)), var(--bg-app);
}
.dash-sec-history .dcards { padding: 1rem; }
@media (min-width: 1100px) {
    .dash-grid-activity { align-items: stretch; }
    .dash-grid-activity .dash-col-history { height: 0; min-height: 100%; }
    .dash-grid-activity .dash-sec-history { flex: 1; }
    .dash-grid-activity .dash-sec-analysis { min-height: 390px; }
}
@media (max-width: 1099px) {
    /* Stacked: cap at roughly five days, scroll for the rest. */
    .dash-sec-history .panel-body { max-height: 340px; }
    .dash-sec-history .dcards { max-height: none; }
}
@media (max-width: 819px) {
    .dash-sec-history .panel-body { max-height: 470px; }
}

/* Nothing open: the chart takes the whole row. */
@media (min-width: 1100px) {
    .dash-grid-hero.no-positions { grid-template-columns: 1fr; }
}
.dash-grid-hero.no-positions .dash-col-right { display: none; }
.dash-nopos {
    display: inline-block; margin-top: .2rem; font-size: .75rem; color: var(--text-tertiary);
}
.dash-nopos[hidden] { display: none; }

/* Period PnL vs the window before it */
.kpi-cmp { font-size: .8rem; color: var(--text-secondary); margin-top: .1rem; font-variant-numeric: tabular-nums; }
.kpi-cmp[hidden] { display: none; }
.kpi-cmp-diff { font-size: .74rem; font-weight: 600; margin-left: .25rem; }

/* Recent History header: last-30-days strip beside the calendar link */
.hist-head-right { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.hist-strip {
    display: grid; grid-template-columns: repeat(30, 7px); gap: 2px; padding: 4px;
    border-radius: var(--radius-sm); text-decoration: none;
    transition: background var(--dur-fast) var(--ease-out);
}
.hist-strip:hover { background: var(--bg-card-hover); }
.hist-strip:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.hist-strip[hidden] { display: none; }
/* Border colour comes from .heat-pos/.heat-neg where set; shorthand avoided so
   it can't win the cascade tie (see the calendar note in DESIGN.md). */
.hs-cell { width: 7px; height: 16px; border-radius: 2px; border-width: 1px; border-style: solid; border-color: transparent; background: rgba(148,163,184,.1); }
/* Open-position badges ("SHORT 30x CROSS") stay on one line; the head wraps instead. */
.pos-card .badge { white-space: nowrap; }
.pos-card-head > .flex-row { flex-wrap: wrap; row-gap: .3rem; }
.hs-cell.hs-flat { background: rgba(148,163,184,.25); }
@media (max-width: 640px) {
    .hist-strip { grid-template-columns: repeat(30, 5px); }
    .hs-cell { width: 5px; height: 14px; }
    .dash-sec-history .panel-header { flex-wrap: wrap; gap: .5rem; }
}

/* Markets panel: best and worst three */
.dash-markets { margin-bottom: 1.5rem; }
.dash-markets[hidden] { display: none; }
.dash-markets-body { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem 2.5rem; }
.dash-mkt-head { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 .5rem; }
.dash-mkt-list { list-style: none; margin: 0; padding: 0; }
.dash-mkt-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "coin pnl" "meta meta" "bar bar";
    column-gap: 1rem; padding: .65rem 0; border-top: 1px solid var(--border-subtle);
}
.dash-mkt-row:first-child { border-top: 0; padding-top: .25rem; }
.dash-mkt-coin { grid-area: coin; font-weight: 700; color: var(--text-primary); text-decoration: none; }
.dash-mkt-coin:hover { color: var(--primary-text); text-decoration: underline; }
.dash-mkt-pnl { grid-area: pnl; font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: .88rem; text-align: right; }
.dash-mkt-meta { grid-area: meta; font-size: .74rem; color: var(--text-tertiary); margin-top: .1rem; }
.dash-mkt-bar { grid-area: bar; height: 4px; width: var(--w); min-width: 3px; border-radius: 2px; margin-top: .45rem; opacity: .75; }
.dash-mkt-bar.is-up { background: var(--success); }
.dash-mkt-bar.is-down { background: var(--danger); }
.dash-mkt-empty { font-size: .82rem; color: var(--text-tertiary); padding: .25rem 0; }
@media (max-width: 700px) { .dash-markets-body { grid-template-columns: 1fr; } }

/* News on your positions */
.dash-news { margin-bottom: 1.5rem; }
.dash-news[hidden] { display: none; }
/* Two classes: a site-wide panel-header rule outranks one, doubling the padding
   around the toggle (which carries its own, so the whole row is clickable). */
.dash-news .dash-news-head { padding: 0; }
.dash-news.is-collapsed .dash-news-head { border-bottom-color: transparent; }
.dash-news-head .panel-title { flex: 1; min-width: 0; }
.dash-news-toggle {
    width: 100%; min-height: 52px; display: flex; align-items: center; flex-wrap: wrap; gap: .35rem .6rem;
    padding: .85rem 1.35rem; background: none; border: 0; border-radius: inherit; cursor: pointer;
    font: inherit; color: inherit; text-align: left;
}
.dash-news-toggle:hover .dash-news-chev { color: var(--text-primary); }
.dash-news-toggle:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
.dash-news-chev { flex-shrink: 0; color: var(--text-tertiary); transition: transform var(--dur-base) var(--ease-out), color var(--dur-fast); }
.dash-news.is-collapsed .dash-news-chev { transform: rotate(-90deg); }
.dash-news-count {
    margin-left: auto; font-family: var(--font-body); font-size: .78rem; font-weight: 500;
    color: var(--text-secondary); white-space: nowrap;
}
.dash-news-body[hidden] { display: none; }
.dash-news-sub { margin: 0 0 .6rem; font-size: .78rem; color: var(--text-tertiary); }
.dash-news-list { list-style: none; margin: 0; padding: 0; }
.dash-news-list:not(.is-all) > .dash-news-row:nth-child(n+5) { display: none; }
.dash-news-foot {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    margin-top: .35rem; padding-top: .75rem; border-top: 1px solid var(--border-subtle);
}
.dash-news-foot a { margin-left: auto; }
.dash-news-more { background: none; border: 0; padding: .35rem 0; font: inherit; cursor: pointer; min-height: 36px; }
.dash-news-more[hidden] { display: none; }
.dash-news-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title moves" "meta moves";
    column-gap: 1.5rem; row-gap: .25rem; align-items: center;
    padding: .75rem 0; border-top: 1px solid var(--border-subtle);
}
.dash-news-row:first-child { border-top: 0; padding-top: .25rem; }
.dash-news-title {
    grid-area: title; color: var(--text-primary); font-weight: 600; font-size: .92rem; line-height: 1.4;
    text-decoration: none; overflow-wrap: anywhere; text-wrap: pretty;
}
.dash-news-title:hover { color: var(--primary-text); text-decoration: underline; text-underline-offset: 3px; }
.dash-news-title:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; border-radius: 2px; }
.dash-news-meta { grid-area: meta; font-size: .76rem; color: var(--text-tertiary); }
.dash-news-lean.is-bullish { color: var(--success-text); }
.dash-news-lean.is-bearish { color: var(--danger-text); }
.dash-news-moves { grid-area: moves; display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; }
.dash-news-move {
    display: inline-flex; flex-direction: column; align-items: flex-end; gap: .05rem;
    padding: .3rem .6rem; border-radius: var(--radius-sm); line-height: 1.2; white-space: nowrap;
}
.dash-news-move b { font-family: 'JetBrains Mono', monospace; font-size: .84rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-news-move em { font-style: normal; font-size: .68rem; opacity: .85; }
.dash-news-move.is-good { color: var(--success-text); background: var(--success-bg); }
.dash-news-move.is-bad { color: var(--danger-text); background: var(--danger-bg); }
.dash-news-move.is-flat { color: var(--text-tertiary); background: transparent; padding-right: 0; }
.dash-news-empty { font-size: .84rem; color: var(--text-tertiary); padding: .25rem 0; }
@media (max-width: 640px) {
    .dash-news-toggle { padding: .8rem 1rem; }
    /* Count drops under the title rather than squeezing it. */
    .dash-news-count { flex-basis: 100%; margin-left: calc(16px + .6rem); white-space: normal; }
    .dash-news-row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "meta" "moves"; }
    .dash-news-moves { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
    .dash-news-move { align-items: flex-start; }
    .dash-news-move.is-flat { padding-left: 0; }
}

/* Header actions (was inline styles with hardcoded greens) */
.dash-wallet { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.dash-updated { display: inline-flex; align-items: center; gap: .35rem; color: var(--text-tertiary); font-size: .85rem; }
.dash-explorer { font-size: .85rem; }
.dash-icon-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0;
    border: 1px solid transparent; border-radius: var(--radius-sm, 6px); background: none;
    color: var(--text-tertiary); cursor: pointer;
    transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.dash-icon-btn:hover { color: var(--text-primary); border-color: var(--border-subtle); }
.dash-icon-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.dash-icon-btn.is-done { color: var(--success-text); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.dash-head-actions { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.dash-head-actions .seg { flex: 0 0 auto; width: auto; }
/* Phones: range, share and alerts on one row; the two buttons go icon-only (aria-label/title keep their names). */
@media (max-width: 520px) {
    .dash-head-actions { flex-wrap: nowrap; gap: 0.5rem; width: 100%; }
    .dash-head-actions .seg { flex: 1 1 auto; width: 100%; min-width: 0; flex-wrap: nowrap; }
    .dash-head-actions .seg-item { flex: 1 1 0; min-width: 0; padding-left: 0.25rem; padding-right: 0.25rem; text-align: center; }
    .dash-head-lbl { display: none; }
    .dash-head-actions .dash-head-btn { flex: 0 0 44px; width: 44px; padding: 0; justify-content: center; }
}
.dash-head-btn, .sc-trigger.dash-head-btn {
    height: 44px; display: inline-flex; align-items: center; gap: .45rem; padding: 0 1rem;
    font: inherit; font-size: .84rem; font-weight: 600; border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle); background: var(--bg-card); color: var(--text-primary);
    cursor: pointer; flex-shrink: 0;
    transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.dash-head-btn:hover, .sc-trigger.dash-head-btn:hover { border-color: var(--border-focus); background: var(--bg-card-hover); }
.dash-head-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.dash-head-btn.is-alert { text-decoration: none; color: var(--success-text); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.dash-head-btn.is-ai { color: var(--primary-text); border-color: color-mix(in srgb, var(--primary) 40%, transparent); background: color-mix(in srgb, var(--primary) 8%, var(--bg-card)); }

/* Daily digest signup, below the analysis row */
.dash-digest {
    display: grid; grid-template-columns: auto 1fr minmax(300px, 460px); align-items: center; gap: 1rem 1.25rem;
    padding: 1.1rem 1.25rem; margin-bottom: 1.5rem;
    background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
    transition: box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.dash-digest.is-flash { border-color: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent); }
.dash-digest-ico {
    width: 40px; height: 40px; border-radius: var(--radius-md); display: grid; place-items: center;
    color: var(--success-text); background: color-mix(in srgb, var(--success) 12%, transparent);
}
.dash-digest-title { font-family: var(--font-heading); font-size: 1rem; font-weight: 700; margin: 0 0 .15rem; color: var(--text-primary); }
.dash-digest-sub { margin: 0; font-size: .82rem; color: var(--text-secondary); line-height: 1.45; }
.dash-digest-sub code { color: var(--primary-text); font-size: .78rem; }
.dash-digest-form { display: flex; gap: .5rem; }
.dash-digest-form .form-input { height: 40px; min-height: 40px; margin: 0; flex: 1 1 auto; min-width: 0; }
.dash-digest-form .dash-digest-freq { flex: 0 0 104px; padding-top: 0; padding-bottom: 0; line-height: 38px; }
.dash-digest-form .btn { height: 40px; flex: 0 0 auto; white-space: nowrap; }
.dash-digest-feedback { font-size: .8rem; margin-top: .4rem; }
@media (max-width: 900px) {
    .dash-digest { grid-template-columns: auto 1fr; }
    .dash-digest-form-wrap { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
    .dash-digest-form { flex-wrap: wrap; }
    .dash-digest-form .form-input { flex-basis: 100%; }
    .dash-digest-form .dash-digest-freq { flex: 1 1 auto; }
}
.empty-state .empty-ico { opacity: .5; }
.pos-card {
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
}
[data-theme="light"] .pos-card { background: rgba(241, 245, 249, 0.6); }
/* The whole card links to that coin's market page. Same hover vocabulary as
   .kpi-card and the market cards this replaced: border warms, card lifts 1px. */
a.pos-card {
    display: block;
    color: inherit;
    text-decoration: none;
    transition: border-color var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
a.pos-card:hover { border-color: var(--border-focus); transform: translateY(-1px); }
a.pos-card:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
/* The affordance: the asset name reads as the link target on hover. */
a.pos-card:hover .pos-coin { color: var(--primary-text); }
.pos-coin {
    font-weight: 700;
    font-size: 1.05rem;
    transition: color var(--dur-fast) var(--ease-out);
}
.pos-open {
    opacity: 0;
    flex-shrink: 0;
    color: var(--primary-text);
    font-size: 0.8rem;
    transition: opacity var(--dur-fast) var(--ease-out);
}
a.pos-card:hover .pos-open,
a.pos-card:focus-visible .pos-open { opacity: 1; }
.pos-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: transparent;
}
.pos-card:has(.badge-success)::after { background: rgba(16, 185, 129, 0.55); }
.pos-card:has(.badge-danger)::after  { background: rgba(244, 63, 94, 0.45); }
.pos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 0.6rem;
    margin-top: 0.8rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 8px;
    padding: 0.7rem 0.8rem;
}
[data-theme="light"] .pos-grid { background: rgba(0, 0, 0, 0.04); }
.pos-grid .k {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
}
/* Grid items default to min-width:auto, so a cell refuses to shrink below its
   own content and simply overruns the one beside it. A nine-figure liquidation
   price was printing straight through the Margin column. min-width:0 lets the
   track hold, and the ellipsis is the visible signal that a value was too wide
   rather than a number silently sitting on top of another one. */
.pos-grid > div { min-width: 0; }
/* Liquidation price coloured by runway, same bands as the positions page. */
.pos-grid .liq-danger { color: var(--danger-text); }
.pos-grid .liq-warn { color: var(--warning); }
.pos-grid .liq-safe { color: var(--text-secondary); }
.pos-liq-dist { font-size: 0.68rem; margin-top: 1px; white-space: nowrap; opacity: 0.85; }
.dcard.is-idle { opacity: 0.55; }
.pos-grid .v {
    font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace;
    font-size: 0.85rem;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pnl-row {
    background: rgba(255, 255, 255, 0.015);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}
[data-theme="light"] .pnl-row { background: rgba(0, 0, 0, 0.02); }

/* 48h price context, drawn per open position by LYX.sparkline. Replaces the
   standalone full-width "Market Context" strip — price context now sits on the
   position it actually affects instead of in its own band. */
.pos-spark { width: 100%; height: 28px; display: block; margin: 0.75rem 0 0; }

/* ── Headline band: the two stats a glance is actually asking for ─────── */
.dash-headline {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1px;
    background: var(--border-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1rem;
}
@media (min-width: 768px) {
    .dash-headline { grid-template-columns: 1fr 1fr; }
}
.dash-hero {
    background: var(--bg-card);
    padding: 1.35rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}
.dash-hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    /* Fits the tallest right-hand control (Share button / badge), so the value
       starts at the same height in both cards, and doesn't jump when the Share
       button appears after load. */
    min-height: 1.6rem;
}
/* The sparkline makes one card taller than its neighbour. Pin each card's last
   line to the bottom so the footers line up across the row. */
.dash-hero > :last-child { margin-top: auto; }
.dash-hero-value {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.75rem, 4vw, 2.4rem);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.025em;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.dash-hero-row { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; min-width: 0; }
.dash-hero .kpi-spark { height: 34px; margin-top: 0.1rem; }

/* ── Trade Analysis total (was a five-property inline style) ──────────── */
.trade-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.6rem 1rem;
}

/* ── Small shared utilities retiring recurring inline styles ──────────── */
.link-inline { color: var(--primary-text); }
.link-inline:hover { text-decoration: underline; }
/* A link that reads as the text it sits in until you point at it: table dates. */
.link-quiet { color: inherit; text-decoration: none; }
.link-quiet:hover, .link-quiet:focus-visible { color: var(--primary-text); text-decoration: underline; }
/* A day with fees or opens but no closed trade: present, but not a result. */
.data-table tr.row-idle td { opacity: 0.55; }
.btn-ghost-sm { border: 1px solid var(--border-subtle); }

/* ══════════════════════════════════════════════════════════════════════════
   PAGE — Journal
   ══════════════════════════════════════════════════════════════════════════ */
.entry-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: background 0.2s, border-color 0.2s;
}
.entry-card:hover {
    border-color: rgba(80, 210, 193, 0.3);
    background: rgba(30, 41, 59, 0.7);
}
[data-theme="light"] .entry-card { background: rgba(241, 245, 249, 0.8); }
[data-theme="light"] .entry-card:hover { background: rgba(226, 232, 240, 0.9); border-color: rgba(80, 210, 193, 0.35); }
/* Win/loss scanability: left-edge accent by entry category */
.entry-card.entry-cat-win  { box-shadow: inset 3px 0 0 var(--success); }
.entry-card.entry-cat-loss { box-shadow: inset 3px 0 0 var(--danger); }
.entry-header { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 0.75rem; }
@media (min-width: 768px) { .entry-header { flex-direction: row; justify-content: space-between; align-items: flex-start; } }
.entry-title { font-weight: 600; font-size: 1rem; margin-bottom: 0.25rem; }
.entry-meta { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--text-secondary); }
.entry-badge { display: inline-block; padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 500; }
.badge-win  { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.25); }
.badge-loss { background: rgba(244, 63, 94, 0.15); color: #f43f5e; border: 1px solid rgba(244, 63, 94, 0.22); }
.badge-lesson, .badge-strategy { background: rgba(80, 210, 193, 0.15); color: #2dd4bf; border: 1px solid rgba(80, 210, 193, 0.22); }
.badge-analysis { background: rgba(59, 130, 246, 0.15); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.22); }
.entry-content { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; white-space: pre-wrap; }
.entry-actions { display: flex; gap: 0.5rem; }
.entry-actions button { background: none; color: var(--text-tertiary); padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.entry-actions button:hover { color: var(--text-primary); }

/* ══════════════════════════════════════════════════════════════════════════
   Custom Scrollbar
   ══════════════════════════════════════════════════════════════════════════ */
/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.4);
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background: var(--bg-app);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img, svg, video, canvas {
    max-width: 100%;
}

pre {
    max-width: 100%;
    overflow-x: auto;
}

/* Typography */
h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

h1 {
    font-size: 2rem;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.5rem;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.125rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-muted {
    color: var(--text-secondary);
}

.text-primary {
    color: var(--text-primary);
}

.text-mono {
    font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace;
}

/* Interactive */
a {
    color: inherit;
    text-decoration: none;
    transition: 0.2s;
}

button {
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: 0.2s;
}

/* ── Global focus-visible treatment (keyboard navigation) ─────────────────
   One consistent teal glow for every focusable element, replacing the
   browser's default outline. box-shadow follows each element's own
   border-radius automatically, so this needs no per-shape overrides. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Layout: Sidebar & Main */
.app-wrapper {
    display: flex;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    z-index: 50;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
    transition: transform 0.3s ease;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 2rem;
    /* Clamp to viewport so nothing bleeds off-screen */
    max-width: calc(100vw - var(--sidebar-width));
    overflow-x: hidden;
}

#mobile-toggle {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    background: var(--bg-app);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
}

/* Components: Sidebar */
.brand {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
}

.brand svg {
    color: var(--primary-text);
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    background: transparent;
    /* Transparent border reserves the same 1px box a bordered hover state
       needs, so the button doesn't grow/shift the moment the border appears. */
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    transition: background var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out),
                color var(--dur-fast) var(--ease-out),
                box-shadow var(--dur-fast) var(--ease-out),
                transform var(--dur-fast) var(--ease-out);
}

.nav-item svg {
    transition: transform var(--dur-fast) var(--ease-out);
}

.nav-item:hover {
    background: rgba(80, 210, 193, 0.1);
    border-color: rgba(80, 210, 193, 0.35);
    color: var(--text-primary);
    transform: translateX(2px);
}

.nav-item:hover svg {
    transform: scale(1.08);
}

.nav-item:active {
    transform: translateX(2px) scale(0.98);
}

.nav-item:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

.nav-item.active {
    background: var(--gradient-brand);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.nav-item.active:hover {
    transform: none;
}

/* Draft-group member count, pinned to the end of its nav item. */
.nav-count {
    margin-left: auto;
    min-width: 1.25rem;
    padding: 0 0.35rem;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent-ink);
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.35rem;
}
.nav-item.active .nav-count { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* A nav entry that carries a trailing control. The row is the unit: the link
   navigates, the button acts on the current wallet. Keeping them on one line is
   what makes the relationship legible — stacked, the button read as a second
   nav entry and was the only thing in the sidebar breaking the one-row rhythm. */
.nav-row {
    display: flex;
    align-items: stretch;
    gap: 0.25rem;
}
.nav-row .nav-item {
    flex: 1;
    min-width: 0;
    padding-right: 0.6rem;
}

.nav-row-action {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    /* Square: the row stretches it to .nav-item's min-height, so the width
       tracks that. 44px here is also the touch floor, so no hit-area padding. */
    width: 44px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out),
                background var(--dur-fast) var(--ease-out);
}
.nav-row-action:hover {
    background: rgba(80, 210, 193, 0.08);
    border-color: rgba(80, 210, 193, 0.5);
    color: var(--text-primary);
}
.nav-row-action:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}
.nav-row-action:active { transform: translateY(1px); }

/* Member state. Hiding the plus sign's vertical stroke turns it into a minus,
   so the control morphs in place instead of swapping glyphs — the amber matches
   .nav-count, tying "this wallet is in" to "the group holds N". */
.nav-row-action.is-on {
    border-color: rgba(255, 180, 84, 0.55);
    color: var(--accent-ink);
}
.nav-row-action.is-on .nav-row-action-stem { display: none; }

.nav-subhint {
    padding: 0.15rem 1rem 0.4rem 2.75rem;   /* indented to the nav item's text column */
    color: var(--accent-ink);
    line-height: 1.4;
}

/* The count is also the disclosure for the draft panel below. It sits inside
   the nav link, so it needs its own affordance and focus ring. */
.nav-count-toggle { cursor: pointer; }
.nav-count-toggle:hover { background: var(--accent-soft); }
.nav-count-toggle:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

/* The whole draft, without leaving this wallet. Indented under its nav row and
   set on the darker surface so it reads as belonging to that row rather than
   as a new section of the sidebar. */
.nav-subpanel {
    margin: 0.35rem 0.6rem 0.5rem;
    padding: 0.65rem 0.7rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-app);
}
.nav-subpanel-open { display: block; margin-top: 0.6rem; text-align: center; }
.nav-subpanel-open.is-disabled { opacity: 0.45; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
    .nav-row-action { transition: none; }
    .nav-row-action:active { transform: none; }
}

.btn-xs {
    padding: 0.3rem 0.55rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

/* Components: Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    backdrop-filter: var(--glass);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.card:hover {
    border-color: rgba(80, 210, 193, 0.35);
    transform: translateY(-2px);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-hover);
}

/* Components: Stats Grid */
.stat-card {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.stat-trend {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Components: Heatmap */
.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
}

.heatmap-cell {
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: default;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.heatmap-cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* Components: Tables */
/* Set by LYX.watchTableScroll while columns are hidden past the right edge.
   Fades to 25%, not 0, so the cut-off column still reads as content. */
.table-container.has-more-right {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 64px), rgba(0, 0, 0, 0.25));
            mask-image: linear-gradient(to right, #000 calc(100% - 64px), rgba(0, 0, 0, 0.25));
}
.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    min-width: 600px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

/* Short, few-column tables (e.g. Directional PnL) don't need the wide
   min-width — it just forces a needless horizontal scrollbar when the
   panel is narrower than 600px. */
.data-table-fit {
    min-width: 0;
}

.data-table th {
    text-align: left;
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(5, 21, 21, 0.97);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(8px);
}

.data-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.05);
    color: var(--text-primary);
    transition: background-color 0.15s ease;
}

.data-table td.text-muted {
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover td {
    background: rgba(80, 210, 193, 0.04);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Utilities */
.text-left {
    text-align: left !important;
}

.text-center {
    text-align: center !important;
}

.text-right {
    text-align: right !important;
}

.text-success {
    color: var(--success-text);
}

.text-danger {
    color: var(--danger-text);
}

.bg-success {
    background: var(--success-bg);
    color: var(--success-text);
    padding: 2px 8px;
    border-radius: 4px;
}

.bg-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    padding: 2px 8px;
    border-radius: 4px;
}

.mb-8 {
    margin-bottom: 2rem;
}

/* Flex & Grid Utilities */
.flex-column {
    display: flex;
    flex-direction: column;
}

.flex-row {
    display: flex;
    flex-direction: row;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
}

.gap-8 {
    gap: 2rem;
}

/* Margin Utilities */
.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 0.75rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.mt-8 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

@media (min-width: 1280px) {
    .xl\:mt-0 {
        margin-top: 0 !important;
    }
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.p-3 {
    padding: 0.75rem;
}

/* Updated Responsive Grids */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-2,
.grid-3,
.grid-4,
.grid-5 {
    grid-template-columns: 1fr;
}

/* 2 cols at 480px for small phones */
@media (min-width: 480px) {
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-4,
    .grid-5 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 640px) {
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid {
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    .grid-5 {
        grid-template-columns: repeat(5, 1fr);
    }

    .grid {
        gap: 2rem;
    }
}

.hidden-mobile {
    display: none !important;
}

@media (min-width: 768px) {
    .hidden-mobile {
        display: block !important;
    }

    th.hidden-mobile,
    td.hidden-mobile {
        display: table-cell !important;
    }
}

.stack-mobile {
    flex-direction: column !important;
    gap: 0.75rem;
    align-items: flex-start !important;
}

@media (min-width: 768px) {
    .stack-mobile {
        flex-direction: row !important;
        align-items: center !important;
        gap: 0;
    }
}

/* Buttons & Forms */
.btn {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover {
    background: rgba(80, 210, 193, 0.06);
    border-color: rgba(80, 210, 193, 0.35);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--gradient-brand);
    color: #0a0a0a;
    border: none;
    box-shadow: 0 2px 10px rgba(80, 210, 193, 0.25);
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-sidebar {
    width: 100%;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-sidebar:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: rgba(80, 210, 193, 0.5);
}

.form-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-subtle);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    transition: 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ── Select elements: dark theme fallback ──────────────────────────────── */
/* color-scheme: dark on :root handles most browsers; these rules add
   explicit fallback colors for option items rendered in Chrome/Edge. */
select {
    background-color: var(--bg-card);
    color: var(--text-primary);
}
select option {
    background: #051515;
    color: var(--text-primary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050; /* above the partner strip (101), so modal titles are never covered */
}

.modal-box {
    background: #0a1a1a;
    border: 1px solid var(--border-subtle);
    padding: 2rem;
    border-radius: var(--radius-lg);
    width: 92%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

/* Mobile Responsive Refined */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
    }

    .main-content {
        margin-left: 0;
        padding: 4.5rem 1rem 1.5rem 1rem;
        /* top padding accounts for fixed mobile header */
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    .sidebar.open {
        transform: translateX(0);
        opacity: 1;
    }

    #mobile-toggle {
        display: flex;
        align-items: center;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 4.5rem 0.75rem 1.5rem 0.75rem;
    }

    .modal-box {
        padding: 1.25rem;
        width: 96%;
        border-radius: var(--radius-md);
    }

    .stat-value {
        font-size: 1.25rem !important;
    }

    h1 {
        font-size: 1.4rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    h3 {
        font-size: 1rem;
    }

    .card {
        padding: 1rem;
    }
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 45;
    display: none;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* Overlay is shown via JS class toggle on the overlay element itself */
.sidebar-overlay.active {
    display: block;
}

/* Layout: Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(12, 1fr);
    }

    .card-calculator {
        grid-column: span 4;
    }

    .card-heatmap {
        grid-column: span 8;
    }
}

/* UI/UX Enhancements */
.icon-box {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 1.25rem;
    transition: 0.2s;
}

.card:hover .icon-box {
    background: var(--primary-glow);
    color: white;
    border-color: var(--primary);
}

/* Animations */
/* Slide only, no fade: content at opacity 0 is not a Largest Contentful Paint
   candidate, and every page body uses this, so a fade delayed LCP sitewide. */
@keyframes fadeIn {
    from { transform: translateY(10px); }
    to { transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes pulse-soft {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse-soft 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Compact Trade Card (Sidebar Style) */
.compact-trade-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px;
    transition: 0.2s;
    margin-bottom: 0.75rem;
}

.compact-trade-card:hover {
    background: rgba(80, 210, 193, 0.04);
    transform: translateX(2px);
    border-color: rgba(80, 210, 193, 0.25);
}

.compact-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.compact-row:last-child {
    margin-bottom: 0;
}

.compact-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.compact-value {
    font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace;
    font-size: 0.85rem;
}

/* Utility: Hidden */
.hidden {
    display: none !important;
}

/* Utility: Font weight */
.font-bold {
    font-weight: 700;
}

.font-mono {
    font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace;
}

/* Utility: bg-danger-soft for error boxes */
.bg-danger-soft {
    background: rgba(244, 63, 94, 0.08);
}

.border-danger-subtle {
    border-color: rgba(244, 63, 94, 0.25);
}

.rounded {
    border-radius: var(--radius-sm);
}

/* ── Progress bar ───────────────────────────────────── */
.progress-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
}

.bg-success {
    background: var(--success);
}

.bg-danger {
    background: var(--danger);
}

/* ── Badge variants ─────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid rgba(244, 63, 94, 0.25);
}

.badge-soft {
    background: rgba(80, 210, 193, 0.1);
    color: var(--primary-text);
    border: 1px solid rgba(80, 210, 193, 0.2);
}

/* Venue chip for builder-deployed (HIP-3) markets, rendered next to the asset
   name by venue_asset() / LYX.venueAsset(). Sits inside bold mono table cells,
   so it resets weight and font to stay a label rather than data. */
.venue-badge {
    margin-left: 0.35rem;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.62rem;
    vertical-align: middle;
    text-transform: none;
    letter-spacing: 0.02em;
}

.badge-neutral {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

/* ── Heatmap ────────────────────────────────────────── */
.session-cell {
    width: 38px;
    min-width: 38px;
    height: 32px;
    border-radius: 4px;
    text-align: center;
    vertical-align: middle;
    transition: opacity 0.2s;
    padding: 0;
}

.session-cell:hover {
    opacity: 0.75;
}

.heatmap-positive {
    background: rgba(16, 185, 129, 0.55);
}

.heatmap-negative {
    background: rgba(244, 63, 94, 0.55);
}

.heatmap-neutral {
    background: rgba(148, 163, 184, 0.08);
}

/* ── Time-range tab active state ────────────────────── */
.btn-primary {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
}

/* ── Utility sizes ──────────────────────────────────── */
.text-xl {
    font-size: 1.5rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-8 {
    margin-top: 2rem;
}

/* ── Loading spinner ─────────────────────────────────── */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border, rgba(255,255,255,0.15));
    border-top-color: var(--primary, #50d2c1);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem;
}

/* ── Skeleton loaders ─────────────────────────────────── *
   Shimmer placeholders shaped like the content they precede, so JS-rendered
   pages (positions, watchlist, trades insights) show layout immediately
   instead of a spinner floating in empty space. Reuses @keyframes shimmer
   (defined above, next to .chart-skeleton). Render markup, don't fetch. */
.skel-bar {
    height: 0.85em;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--bg-tertiary) 0%, rgba(80, 210, 193, 0.08) 50%, var(--bg-tertiary) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.6s ease-in-out infinite;
}
.skel-kpi {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.skel-kpi .skel-bar:first-child { width: 55%; height: 0.7em; }
.skel-kpi .skel-bar:last-child { width: 75%; height: 1.3em; }
.skel-row td { padding: 0.85rem 1rem; }
.skel-row .skel-bar { width: 100%; max-width: 120px; }
.skel-row .skel-bar.wide { max-width: 220px; }

/* ── Empty state ─────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-muted, #94a3b8);
    gap: 0.75rem;
}

.empty-state svg {
    opacity: 0.35;
}

/* ── Notice banner: dismissible info/warning strip used above page content
   (journal storage disclaimer, dashboard degraded/rekt banners, etc). One
   vocabulary instead of a one-off inline-styled block per page. ────────── */
.notice {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    border-radius: var(--radius-md);
    padding: 0.65rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.notice strong { color: var(--text-primary); }
.notice-body { flex: 1; }
.notice-info { background: var(--primary-glow); border: 1px solid var(--border-focus); }
.notice-warning { background: var(--warning-bg); border: 1px solid rgba(245, 158, 11, 0.4); }
.notice-danger { background: var(--danger-bg); border: 1px solid rgba(244, 63, 94, 0.3); }
.notice-dismiss {
    flex-shrink: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.notice-dismiss:hover { color: var(--text-primary); border-color: var(--border-focus); }

/* ── Liquidation distance legend ─────────────────────── */
.liq-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    margin-bottom: 0.5rem;
}
.liq-legend.inline { margin: 0; }
/* Colour swatch so the legend isn't carried by a coloured bullet glyph alone
   (fails for colour-blind readers — PRODUCT.md pairs colour with shape/text). */
.liq-legend .swatch {
    display: inline-block;
    width: 10px;
    height: 3px;
    border-radius: 2px;
    margin-right: 0.35rem;
    vertical-align: middle;
}

/* ── Expandable position rows (positions page) ────────────────────────── */
.pos-expand {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0;
    width: 22px;
    height: 22px;
    line-height: 1;
    flex-shrink: 0;
    transition: transform var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.pos-expand:hover { color: var(--primary-text); }
.pos-expand:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.pos-expand[aria-expanded="true"] { transform: rotate(90deg); color: var(--primary-text); }
.pos-asset { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
/* Asset name links through to that coin's market page — same affordance as the
   position cards on the wallet overview, so the gesture carries across surfaces. */
.pos-coin-link {
    color: inherit;
    text-decoration: none;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    transition: color var(--dur-fast) var(--ease-out);
}
.pos-coin-link:hover { color: var(--primary-text); }
.pos-coin-link:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
/* Shown at rest, not only on hover: on a table of 123 rows the arrow is the
   only cue that the asset name goes anywhere, and a hover-only affordance is
   invisible until you happen to pass over it. Quiet enough at 0.4 not to
   compete with the numbers. */
.pos-coin-link .pos-open {
    opacity: 0.4;
    margin-left: 0.25rem;
    font-size: 0.75rem;
    color: var(--primary-text);
    transition: opacity var(--dur-fast) var(--ease-out);
}
.pos-coin-link:hover .pos-open,
.pos-coin-link:focus-visible .pos-open { opacity: 1; }

/* Actions. nowrap on the desktop table so a second control can never stack and
   double the row height; the mobile card splits its two buttons evenly. */
.pos-actions { display: flex; gap: 0.4rem; justify-content: flex-end; flex-wrap: nowrap; }
.pos-act { min-height: 32px; padding: 0.3rem 0.7rem; white-space: nowrap; }
.dcard .pos-actions .pos-act { flex: 1; text-align: center; }

.pos-detail > td { padding: 0 !important; background: rgba(0, 0, 0, 0.16); }
[data-theme="light"] .pos-detail > td { background: rgba(15, 23, 42, 0.035); }
.pos-detail-inner { padding: 1rem 1.35rem 1.25rem; }
.pos-detail-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
/* Marker legend for the entry / liq / mark lines drawn over the price chart. */
.pos-levels { display: flex; flex-wrap: wrap; gap: 0.9rem; font-size: 0.72rem; color: var(--text-tertiary); }
.pos-levels .lvl { display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap; }
.pos-levels .dash {
    width: 14px;
    height: 0;
    border-top: 2px dashed currentColor;
    display: inline-block;
}
.pos-levels .lvl-entry { color: var(--accent); }
.pos-levels .lvl-liq   { color: var(--danger-text); }
.pos-levels .lvl-mark  { color: var(--primary-text); }
.pos-levels .off       { opacity: 0.55; font-style: italic; }
.pos-chart-wrap { position: relative; width: 100%; height: 220px; }
@media (max-width: 640px) { .pos-chart-wrap { height: 180px; } }

/* ── Inline badge for ws-status ─────────────────────── */
.badge-danger {
    background: rgba(244, 63, 94, 0.15) !important;
    color: #f43f5e !important;
    border: 1px solid rgba(244, 63, 94, 0.3) !important;
}

/* ── Mobile: touch targets ───────────────────────────── */
.btn {
    min-height: 44px;
}
.nav-item {
    min-height: 44px;
}

/* ── Mobile: stat-value scaling for tablets ──────────── */
@media (max-width: 768px) {
    .stat-value {
        font-size: 1.35rem;
    }
}

/* ── text-3xl utility — responsive ──────────────────── */
.text-3xl {
    font-size: 3rem;
}
@media (max-width: 640px) {
    .text-3xl {
        font-size: 1.75rem !important;
    }
}

/* ── Filter bar: wraps cleanly on any screen width ───── */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.filter-bar-lg {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.25rem;
}
.filter-bar select,
.filter-bar input[type="number"] {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
}
@media (max-width: 640px) {
    .filter-bar select,
    .filter-bar input[type="number"] {
        flex: 1 1 calc(50% - 0.25rem);
    }
}

/* ════════════════════════════════════════════════════════════════════════
   DASHBOARD REDESIGN COMPONENTS  (shared by every page — reuses :root tokens)
   ════════════════════════════════════════════════════════════════════════ */

/* ── Safe-area / notch support for installed PWA ──────────────────────── */
.sidebar {
    padding-top: calc(1.5rem + env(safe-area-inset-top, 0px));
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
}

/* ── Sidebar nav groups ──────────────────────────────────────────────── */
.nav-group {
    margin-top: 1.25rem;
}
.nav-group:first-of-type {
    margin-top: 0;
}
.nav-group-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-tertiary);
    padding: 0 1rem;
    margin-bottom: 0.4rem;
}
/* <details><summary> replaces a plain label on every group with more than
   one item (Trading included) — Community/Overview keep the plain caption
   since they hold a single link and have nothing to disclose. Built as a
   real row (icon + title + chevron) rather than a thin caption: a bare
   uppercase label read as a caption, not a control, and gave no sense of
   which section you were looking at once collapsed. */
summary.nav-group-label {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    /* Same 1rem horizontal inset as .nav-group-label/.nav-item, at every
       breakpoint, so the header text stays aligned with the links under it.
       margin-bottom is already set by the shared .nav-group-label rule above. */
    padding: 0.55rem 1rem;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: background var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out),
                color var(--dur-fast) var(--ease-out);
}
.nav-group-icon {
    flex-shrink: 0;
    opacity: 0.8;
}
.nav-group-title {
    flex: 1;
    min-width: 0;
}
summary.nav-group-label::-webkit-details-marker {
    display: none;
}
summary.nav-group-label::after {
    content: '';
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    margin-right: 2px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    opacity: 0.55;
    transform: rotate(45deg);
    transition: transform var(--dur-fast) var(--ease-out);
}
details[open] > summary.nav-group-label::after {
    transform: rotate(-135deg);
    margin-right: -1px;
    margin-top: 3px;
}
/* Open groups keep a faint permanent tint so you can tell what's expanded
   at a glance, without hovering — hover on top of that reads as the
   stronger, third tier. */
details[open] > summary.nav-group-label {
    background: rgba(80, 210, 193, 0.05);
    border-color: rgba(80, 210, 193, 0.22);
    color: var(--text-primary);
}
summary.nav-group-label:hover {
    background: rgba(80, 210, 193, 0.1);
    border-color: rgba(80, 210, 193, 0.35);
    color: var(--text-primary);
}
summary.nav-group-label:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}
/* Animation hook: nav-groups.js sets an explicit pixel height on this wrapper
   and toggles between 0 and the measured content height on toggle, instead
   of letting <details> snap the whole sidebar open/closed in one frame. The
   UA stylesheet still hides it outright (display: none) whenever `open` is
   absent and JS hasn't run, so there is no no-JS regression. */
.nav-group-items {
    overflow: hidden;
    transition: height var(--dur-base) var(--ease-out);
    /* Items sit flush against this box with zero clearance, so .nav-item's
       hover translateX(2px) pushed their right border straight past the
       overflow: hidden edge and clipped it off. The negative margin/padding
       pair below widens the actual clip boundary by 4px on the right while
       the padding pulls the content back in, so items render at exactly the
       same x-position at rest — only the hover shift now has room to move. */
    margin-right: -4px;
    padding-right: 4px;
}
.nav-item svg {
    flex-shrink: 0;
}
.nav-item.active svg {
    color: #fff;
}

/* ── Hyperliquid referral CTA (base.html) ─────────────────────────────────
   Two placements, one offer: .sb-ref pins to the top of the dashboard sidebar
   (desktop), .mt-ref rides the fixed #mobile-toggle bar (≤1024px, where the
   sidebar is a closed drawer). Both must stay reachable on every page, so
   .sb-ref is sticky rather than merely first in the scroll flow. */
.sb-ref {
    /* Sticky shell, not the button itself: it carries the opaque --bg-sidebar
       backdrop so nav items cannot show through the pinned CTA. top:0 pins to
       the sidebar's scrollport edge (above its 1.5rem padding), so the negative
       margins + matching padding restore that inset and let it full-bleed. */
    position: sticky;
    top: 0;
    z-index: 5;
    display: block;
    margin: -0.5rem -1.5rem 1rem;
    padding: 0.75rem 1.25rem 0.9rem;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-subtle);
    text-decoration: none;
}
.sb-ref-card {
    /* Filled, not tinted: this is the one element in the sidebar chrome that
       has to win attention. Icon gets its own grid column so the title and the
       sub-line share a single left edge. */
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 0.6rem;
    row-gap: 0.15rem;
    padding: 0.7rem 0.85rem 0.75rem;
    border-radius: var(--radius-md);
    background: var(--gradient-brand);
    color: var(--primary-ink);
    box-shadow: 0 4px 14px var(--primary-glow);
    transition: transform var(--dur-base) var(--ease-out),
                box-shadow var(--dur-base) var(--ease-out),
                filter var(--dur-base) var(--ease-out);
}
.sb-ref:hover .sb-ref-card {
    transform: translateY(-1px);
    box-shadow: 0 7px 20px var(--primary-glow);
    filter: brightness(1.06);
}
.sb-ref:active .sb-ref-card {
    transform: translateY(0);
    box-shadow: 0 3px 10px var(--primary-glow);
}
.sb-ref:focus-visible {
    outline: none;
}
.sb-ref:focus-visible .sb-ref-card {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.sb-ref-mark {
    grid-row: 1 / span 2;
    flex-shrink: 0;
}
.sb-ref-title {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: -0.012em;
    white-space: nowrap;
}
.sb-ref-arrow {
    flex-shrink: 0;
    opacity: 0.65;
    transition: transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.sb-ref:hover .sb-ref-arrow {
    opacity: 1;
    transform: translate(1.5px, -1.5px);
}
.sb-ref-sub {
    min-width: 0;
    font-size: 0.7rem;
    line-height: 1.3;
    /* Ink at reduced alpha rather than a lighter hue: keeps the sub-line
       subordinate without dropping below ~5:1 on the teal fill. */
    color: var(--primary-ink-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sb-ref-sub strong {
    font-weight: 700;
    color: var(--primary-ink);
}
.sb-ref-dot {
    /* Margins rather than source whitespace, which HTML collapses against the
       adjacent <strong> and leaves the dot crowding "fees". */
    margin: 0 0.3rem;
    opacity: 0.55;
}

/* Mobile top-bar pill. Sits between the logo and the theme toggle; the word
   label drops on narrow phones so the discount badge always survives. */
.mt-ref {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.34rem 0.5rem;
    border-radius: var(--radius-pill);
    background: var(--gradient-brand);
    color: var(--primary-ink);
    box-shadow: 0 2px 10px var(--primary-glow);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    transition: box-shadow var(--dur-base) var(--ease-out), filter var(--dur-base) var(--ease-out);
}
.mt-ref:hover,
.mt-ref:active {
    box-shadow: 0 4px 14px var(--primary-glow);
    filter: brightness(1.06);
}
.mt-ref:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.mt-ref svg {
    flex-shrink: 0;
    opacity: 0.8;
}
.mt-ref-badge {
    /* Knocked-out chip: on a filled pill the discount needs to invert to stay
       the loudest thing in the bar. */
    padding: 0.16rem 0.36rem;
    border-radius: var(--radius-sm);
    background: var(--primary-ink);
    color: var(--primary-text);
    font-size: 0.7rem;
    font-weight: 700;
}
/* Tap areas in the phone top bar reach 40px without changing how they look. */
.mt-ref { position: relative; }
.mt-ref::after { content: ''; position: absolute; inset: -7px -2px; }
#mobile-toggle > a[href="/"] { min-width: 40px; min-height: 40px; }
#mobile-toggle button { min-width: 40px; min-height: 40px; }
/* 340px, not 400px: at 390px (the common iPhone width) the bar still has
   ~90px of slack, and dropping the verb leaves a passive-looking badge. */
@media (max-width: 340px) {
    .mt-ref-label {
        display: none;
    }
}

/* ── Page header (title + subtitle + actions) ────────────────────────── */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
}
.page-heading {
    min-width: 0;
}
.page-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin-top: 0.35rem;
}
.page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

/* ── KPI grid (intrinsically responsive — no breakpoints needed) ─────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}
/* Calendar page: 7 KPI cards, forced onto one row on wide screens */
@media (min-width: 1100px) {
    .kpi-grid-7 { grid-template-columns: repeat(7, 1fr); }
}
/* Fixed-column variant for grids with exactly 4 cards. auto-fit would orphan
   them 3+1 at some widths; this keeps 4-up then 2×2 with no ragged row. */
.kpi-grid.kpi-tight { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) {
    .kpi-grid.kpi-tight { grid-template-columns: repeat(4, 1fr); }
}
/* .kpi-top reserves two label lines so values line up across a row. Opt out
   where every label is provably one line — otherwise it's just dead air
   between the label and its value. Scoped, never global: pages with labels
   like "Total Open Interest" still need the reserved second line. */
.kpi-tight .kpi-top { min-height: 0; }
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s, transform 0.2s;
}
.kpi-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: transparent;
    transition: background 0.2s;
}
/* Scoped to .kpi-value deliberately. A bare :has(.tone-down) also matched tone
   spans inside .kpi-sub (e.g. the "▼ worst" figure on Avg Daily PnL), and since
   that rule is the later of the two, such cards drew a red strip even when the
   headline value was positive. Every page puts the tone class on .kpi-value. */
.kpi-card:has(.kpi-value.tone-up)::after,
.kpi-card:has(.badge-success)::after      { background: rgba(16, 185, 129, 0.55); }
.kpi-card:has(.kpi-value.tone-down)::after { background: rgba(244, 63, 94, 0.45); }
.kpi-card:hover {
    border-color: rgba(80, 210, 193, 0.35);
    transform: translateY(-2px);
}
.kpi-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 2.4rem;
}
.kpi-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    font-weight: 600;
}
.kpi-badge-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-tertiary);
    border: 1px solid var(--border-subtle);
    cursor: help;
    flex-shrink: 0;
    margin-top: 1px;
}
.kpi-ico {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(80, 210, 193, 0.1);
    color: var(--primary-text);
    flex-shrink: 0;
}
.kpi-value {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.1rem, 2.2vw, 1.45rem);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.kpi-sub {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}
.tone-up { color: var(--success-text); }
.tone-down { color: var(--danger-text); }
.tone-muted { color: var(--text-tertiary); }

/* ── KPI delta chip + sparkline (optional kpi() macro slots) ─────────── */
.kpi-value-row { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; min-width: 0; }
.kpi-delta {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
}
.kpi-delta.tone-up { color: var(--success-text); background: var(--success-bg); }
.kpi-delta.tone-down { color: var(--danger-text); background: var(--danger-bg); }
.kpi-delta.tone-muted { color: var(--text-tertiary); background: var(--bg-tertiary); }
.kpi-spark { width: 100%; height: 28px; margin-top: 0.4rem; display: block; }

/* ── Panel (the standard section container) ──────────────────────────── */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.panel-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.1rem 1.35rem;
    border-bottom: 1px solid var(--border-subtle);
}
.panel-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.02rem;
    margin: 0;
}
.panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.panel-body {
    padding: 1.35rem;
}
.panel-body.flush { padding: 0; }
/* Counterpart to .panel-header. Sits below .panel-body and never shrinks, so
   in a height-matched panel it stays pinned to the bottom edge. */
.panel-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-shrink: 0;
    padding: 0.85rem 1.35rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* A plain content grid for arranging panels side by side */
.panel-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
@media (min-width: 1024px) {
    .panel-grid.cols-2 { grid-template-columns: 1fr 1fr; }
    .panel-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
    .panel-grid.sidebar-left { grid-template-columns: 380px 1fr; }
    .panel-grid.sidebar-right { grid-template-columns: 1fr 380px; }
    .panel-grid > .panel { margin-bottom: 0; }
}

/* ── Segmented control (time-range tabs, view toggles) ───────────────── */
.seg {
    display: inline-flex;
    background: rgba(5, 21, 21, 0.6);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
    flex-wrap: wrap;
}
.seg-item {
    appearance: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.45rem 0.85rem;
    border-radius: 7px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    transition: 0.15s;
}
.seg-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}
.seg-item.active {
    background: var(--gradient-brand);
    color: #0a0a0a;
    box-shadow: 0 2px 8px rgba(80, 210, 193, 0.3);
}

/* ── Chart wrapper (keeps charts inside their box on every screen) ───── */
.chart-wrap {
    position: relative;
    width: 100%;
    height: 320px;
}
.chart-wrap.sm { height: 240px; }
.chart-wrap.lg { height: 380px; }
.chart-wrap canvas {
    max-width: 100% !important;
}
@media (max-width: 640px) {
    .chart-wrap { height: 260px; }
    .chart-wrap.lg { height: 300px; }
}

/* ── Responsive table → cards helpers ────────────────────────────────── */
/* !important so these win over component display rules like .dcards{display:flex}
   regardless of source order. */
.show-desktop { display: none !important; }
.show-mobile { display: block; }
@media (min-width: 820px) {
    .show-desktop { display: block !important; }
    .show-mobile { display: none !important; }
}

/* Stacked data cards used as the mobile fallback for any table */
.dcards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.dcard {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    transition: border-color 0.2s;
}
.dcard:hover {
    border-color: rgba(80, 210, 193, 0.3);
}
.dcard-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border-subtle);
}
.dcard-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.2rem 0;
    font-size: 0.85rem;
}
.dcard-row .k {
    color: var(--text-tertiary);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.dcard-row .v {
    font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace;
    text-align: right;
}

/* ── Mobile card transform for tables without a separate dcard layout ─── */
@media (max-width: 819px) {
    .table-container:has(> .mobile-cards) {
        overflow-x: visible !important;
        border: none;
        background: transparent;
    }
    .mobile-cards thead { display: none; }
    .mobile-cards,
    .mobile-cards tbody { display: block; width: 100%; min-width: 0; }
    .mobile-cards tbody tr {
        display: block;
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-md);
        padding: 0.9rem 1rem;
        margin-bottom: 0.75rem;
        transition: border-color 0.2s;
    }
    .mobile-cards tbody tr:hover { border-color: rgba(80, 210, 193, 0.3); }
    .mobile-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.3rem 0;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
        text-align: left;
    }
    .mobile-cards tbody td:last-child { border-bottom: none; }
    .mobile-cards tbody td::before {
        content: attr(data-label);
        font-size: 0.72rem;
        color: var(--text-muted);
        font-weight: 500;
        flex-shrink: 0;
        margin-right: 1rem;
        text-align: left;
    }
}

/* ── Body scroll-lock when the mobile drawer is open ─────────────────── */
body.nav-open {
    overflow: hidden;
}

/* ── Mobile refinements (≤640px) ─────────────────────────────────────── */
@media (max-width: 640px) {
    /* Stop iOS auto-zoom on focus by keeping inputs ≥16px */
    .form-input,
    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px;
    }
    .page-header {
        align-items: flex-start;
    }
    .page-actions {
        width: 100%;
    }
    .panel-body {
        padding: 1rem;
    }
    .seg {
        width: 100%;
        justify-content: stretch;
    }
    .seg-item {
        flex: 1 1 auto;
    }
}

/* Account for notch on the fixed mobile top bar + drawer */
@media (max-width: 1024px) {
    #mobile-toggle {
        padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
    }
    .main-content {
        padding-top: calc(4.5rem + env(safe-area-inset-top, 0px));
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   LIGHT MODE — per-page component overrides
   ══════════════════════════════════════════════════════════════════════════ */

/* ── calculator.html / public_calculator.html ─────────────────────────── */
[data-theme="light"] .calc-card {
    background: #ffffff;
}
[data-theme="light"] .input-icon-wrapper,
[data-theme="light"] .select-wrapper {
    background: #f8fafc;
    border-color: rgba(80, 210, 193, 0.3);
}
[data-theme="light"] .input-panel {
    border-top-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .info-box {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(80, 210, 193, 0.15);
}
[data-theme="light"] .huge-input-wrapper {
    background: #f8fafc;
}
[data-theme="light"] .result-card {
    background: #f8fafc;
}
[data-theme="light"] .gradient-glow {
    background: radial-gradient(circle at center, rgba(80, 210, 193, 0.1) 0%, #f1f5f9 100%) !important;
}
[data-theme="light"] .avg-result-box {
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
}
[data-theme="light"] .move-badge {
    background: rgba(0, 0, 0, 0.06);
}

/* ── risk.html ───────────────────────────────────────────────────────── */
[data-theme="light"] .risk-card {
    background: #ffffff;
    border-color: rgba(80, 210, 193, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .card-header {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .input-icon-wrapper input {
    color: var(--text-primary);
}
[data-theme="light"] .risk-btn {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
}
[data-theme="light"] .risk-btn:hover {
    background: rgba(0, 0, 0, 0.07);
    color: var(--text-primary);
}
[data-theme="light"] .risk-btn.active {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    color: #059669;
}
[data-theme="light"] .custom-risk {
    background: #f8fafc;
    border-color: rgba(80, 210, 193, 0.3);
}
[data-theme="light"] .custom-risk input {
    color: var(--text-primary);
}
[data-theme="light"] .results-section {
    background: linear-gradient(180deg, rgba(241, 245, 249, 0.9) 0%, rgba(248, 250, 252, 1) 100%);
    border-color: rgba(80, 210, 193, 0.15);
}
[data-theme="light"] .result-box {
    background: radial-gradient(120% 120% at 50% 0%, rgba(16, 185, 129, 0.08) 0%, transparent 60%),
        #f8fafc;
    border-color: rgba(16, 185, 129, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .giga-value {
    color: var(--text-primary);
    text-shadow: none;
}
[data-theme="light"] .progress-bar {
    background: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .metric-row {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .stat-box {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
}

/* ── compound.html ───────────────────────────────────────────────────── */
[data-theme="light"] .fc-input-wrap,
[data-theme="light"] .fc-select-wrap {
    background: #f8fafc;
}
[data-theme="light"] .fc-select-wrap select {
    background: #f8fafc;
}
[data-theme="light"] .fc-sim-badge {
    background: rgba(0, 0, 0, 0.04);
}

/* ── watchlist.html ──────────────────────────────────────────────────── */
[data-theme="light"] .watchlist-item {
    background: #f8fafc;
}
[data-theme="light"] .watchlist-item:hover {
    background: #f1f5f9;
    border-color: rgba(80, 210, 193, 0.35);
}

/* ── base.html: shared modals ────────────────────────────────────────── */
[data-theme="light"] #filterModal .btn:not(.btn-primary) {
    background: rgba(0, 0, 0, 0.04) !important;
    border: 1px solid rgba(80, 210, 193, 0.2);
}
[data-theme="light"] #notifPrefModal .flex-column > div {
    background: rgba(0, 0, 0, 0.03) !important;
}
/* ── icon-box (shared component) ─────────────────────────────────────── */
[data-theme="light"] .icon-box {
    background: rgba(80, 210, 193, 0.08);
}

/* ── loading spinner track ───────────────────────────────────────────── */
[data-theme="light"] .spinner {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary);
}

/* ── Desktop sidebar: was squeezed tight enough to fit all 23 links flat.
   Analysis/Tools/Explore now collapse via <details> (see nav-group-label
   above), so a typical view renders under half those rows and there is
   room again for a properly sized, friendlier touch/click target. ── */
@media (min-width: 1025px) {
    .sidebar {
        padding-top: 1rem;
        padding-bottom: 1rem;
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
    .brand {
        margin-bottom: 0.6rem;
    }
    .nav-group {
        margin-top: 0.65rem;
    }
    .nav-group-label {
        margin-bottom: 0.3rem;
    }
    .nav-menu {
        gap: 0.3rem;
    }
    .nav-item {
        min-height: 40px;
        padding: 0.55rem 0.85rem;
        font-size: 0.92rem;
    }
    .sidebar .btn-sidebar {
        min-height: 40px;
        padding: 0.55rem 0.85rem;
        font-size: 0.92rem;
    }
    /* Stays square against the denser .nav-item above. Below the 44px touch
       floor is fine here — this breakpoint is desktop, i.e. a pointer. */
    .nav-row-action {
        width: 34px;
    }
    /* .sb-ref's negative margin full-bleeds against the sidebar's own
       padding (see its rule below) — it was hardcoded to the base 1.5rem
       padding above and never adjusted for this breakpoint's 1.25rem, so it
       overshot the sidebar's real edge by 0.25rem (4px) and made the whole
       sidebar horizontally scrollable. Matched to -1.25rem here, with the
       padding trimmed by the same 0.25rem so the card keeps its original
       (slightly wider than a nav-item) inset instead of losing it. */
    .sb-ref {
        margin: -0.5rem -1.25rem 1rem;
        padding: 0.75rem 1rem 0.9rem;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   Shared public landing chrome (nav / hamburger / footer)
   Used by _public_nav.html + _public_footer.html and every public
   landing-style page (form, leaderboard, whales, markets, market_coin,
   vaults, public_calculator, public_funding, guides/*). Consolidated here
   from per-template <style> blocks to kill drift between pages.
   ══════════════════════════════════════════════════════════════════════ */
.lyx-landing {
    width: 100%;
    max-width: none;
    background:
        radial-gradient(1200px 600px at 50% -10%, rgba(80, 210, 193, 0.1), transparent 60%),
        linear-gradient(180deg, #0a0a0a 0%, #051515 100%);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
}
/* ── Nav: brand ───────────────────────────────────────────────────────── */
/* Shared with _public_footer.html, so the base rule stays layout-neutral and
   everything positional is scoped to .lyx-nav below. */
.lyx-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 0 0 auto;
    text-decoration: none;
}
.lyx-logo img { display: block; }
/* Negative margin cancels the padding so the mark stays optically flush with
   the nav's left inset while the focus ring still gets room to breathe. */
.lyx-nav .lyx-logo { padding: 0.3rem; margin: 0 2rem 0 -0.3rem; border-radius: 10px; }
/* A wordmark is a brand mark, which is where DESIGN.md's Serif-for-Structure
   rule allows Fraunces outside h1–h4. It also gives the taller bar something
   to balance against the actions cluster on the right. */
.lyx-logo-word {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    white-space: nowrap;
}
/* The mark renders 30px tall, short of a comfortable tap target. Grow the hit
   box on touch only; the nav is 58px there so nothing moves visually. */
@media (pointer: coarse) {
    .lyx-logo { min-height: 44px; }
}

/* ── Nav: shell ───────────────────────────────────────────────────────── */
.lyx-nav-wrapper { position: fixed; top: var(--lyx-nav-top); left: 0; right: 0; z-index: 100; padding: 0 16px; pointer-events: none; }
.lyx-nav {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 0.75rem 0 1.1rem;
    height: var(--lyx-nav-h);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(80, 210, 193, 0.14);
    background: rgba(5, 21, 21, 0.62);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    box-shadow: 0 4px 24px rgba(0,0,0,0.45), 0 1px 0 rgba(80,210,193,0.06) inset;
    transition: background-color var(--dur-base) var(--ease-out),
                border-color var(--dur-base) var(--ease-out),
                box-shadow var(--dur-base) var(--ease-out);
}
/* Scroll state conveys "there is content behind me now" — the one thing the
   bar can honestly report. Deliberately glass-only (opacity/border/shadow):
   condensing the height would animate layout on every scroll frame for a
   purely decorative payoff, which the brand's "calm, restrained" personality
   doesn't buy. Toggled by the observer in _public_nav.html. */
.lyx-nav--scrolled {
    background: rgba(5, 21, 21, 0.88);
    border-color: rgba(80, 210, 193, 0.22);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 1px 0 rgba(80,210,193,0.08) inset;
}

.lyx-nav a:focus-visible,
.lyx-nav button:focus-visible,
.lyx-nav-more-panel a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* 44x44 hit area via padding + centring, not size: the three 22px bars stay
   exactly as drawn, the tappable box grows around them. Only ever rendered
   below 768px (see the mobile-menu breakpoint), so no pointer layout shifts. */
.lyx-hamburger { display: none; flex-direction: column; justify-content: center; align-items: center; gap: 5px; background: none; border: none; cursor: pointer; padding: 0.4rem; margin: -0.4rem; min-width: 44px; min-height: 44px; pointer-events: auto; }
.lyx-hamburger span { display: block; width: 22px; height: 2px; background: var(--text-secondary); border-radius: 2px; transition: transform 0.3s ease, opacity 0.3s ease; }
.lyx-hamburger--open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.lyx-hamburger--open span:nth-child(2) { opacity: 0; }
.lyx-hamburger--open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Nav: primary links ───────────────────────────────────────────────── */
/* margin-right:auto is what pushes .lyx-nav-actions to the far edge, so the
   destinations read as one group anchored to the brand rather than five items
   floating in the middle of a wide bar. */
.lyx-nav-links {
    display: flex;
    align-self: stretch;
    align-items: center;
    gap: 0.15rem;
    margin-right: auto;
}
.lyx-nav-link {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    height: 36px;
    padding: 0 0.7rem;
    border-radius: 10px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease-out),
                background-color var(--dur-fast) var(--ease-out);
}
.lyx-nav-link:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.055); }
/* Teal is DESIGN.md's "this is active/primary" signal, so the current page
   gets a tinted pill rather than the old bold-white treatment, which was
   almost indistinguishable from a hovered link. */
.lyx-nav-link.nav-active {
    color: var(--primary-text);
    font-weight: 600;
    background: rgba(80, 210, 193, 0.10);
}
.lyx-nav-link.nav-active:hover { background: rgba(80, 210, 193, 0.16); }

/* ── Nav: More dropdown ───────────────────────────────────────────────── */
/* align-self:stretch makes this wrapper exactly as tall as the bar's content
   box, so the panel can anchor to `top: 100%` in pure CSS and land below the
   whole bar. That replaces the old JS getBoundingClientRect() positioning,
   which existed only to work around .lyx-nav's backdrop-filter capturing
   position:fixed descendants — absolute positioning has no such problem. */
.lyx-nav-more { position: relative; align-self: stretch; display: flex; align-items: center; }
.lyx-nav-more-btn[aria-expanded="true"] { color: var(--text-primary); background: rgba(255, 255, 255, 0.055); }
.lyx-nav-more-btn.nav-active[aria-expanded="true"] { background: rgba(80, 210, 193, 0.16); }
.lyx-nav-more-caret { transition: transform var(--dur-fast) var(--ease-out); }
.lyx-nav-more-btn[aria-expanded="true"] .lyx-nav-more-caret { transform: rotate(180deg); }

.lyx-nav-more-panel {
    position: absolute;
    top: calc(100% + 11px);
    left: 50%;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.4rem;
    min-width: 190px;
    padding: 0.4rem;
    /* Fully opaque, and no backdrop-filter of its own. A backdrop-filter
       nested inside .lyx-nav's own backdrop-filter doesn't get the page as its
       backdrop, so the panel's leftover transparency let headings and KPI
       numbers read straight through the menu. Glass is right for the floating
       bar, which has to stay legible over scrolling content; a menu is a solid
       surface and only has to be readable. */
    background: #071a1a;
    border: 1px solid rgba(80, 210, 193, 0.16);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
    z-index: 101;
    /* visibility (not display) so the panel can transition, and so focus can't
       land on a hidden item mid-fade. */
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-6px);
    transition: opacity var(--dur-fast) var(--ease-out),
                transform var(--dur-fast) var(--ease-out),
                visibility 0s linear var(--dur-fast);
}
.lyx-nav-more-panel.lyx-nav-more-open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    transition: opacity var(--dur-fast) var(--ease-out),
                transform var(--dur-fast) var(--ease-out);
}
.lyx-nav-more-panel a {
    display: flex;
    align-items: center;
    height: 34px;
    padding: 0 0.65rem;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--dur-fast) var(--ease-out),
                background-color var(--dur-fast) var(--ease-out);
}
.lyx-nav-more-panel a:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.06); }
.lyx-nav-more-col { display: flex; flex-direction: column; gap: 0.1rem; min-width: 180px; }
.lyx-nav-more-label { padding: 0.45rem 0.65rem 0.2rem; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.lyx-nav-more-panel a.nav-active { color: var(--primary-text); font-weight: 600; background: rgba(80, 210, 193, 0.10); }

/* The global reduced-motion kill-switch zeroes durations but not delays, and
   this panel parks its visibility flip on a delay. Clear it so closing is
   instant rather than 150ms of an invisible-but-present panel. */
@media (prefers-reduced-motion: reduce) {
    .lyx-nav-more-panel { transition-delay: 0s !important; }
}

/* ── Nav: actions ─────────────────────────────────────────────────────── */
.lyx-nav-actions { display: flex; align-items: center; gap: 0.15rem; flex: 0 0 auto; }

/* Utility links sit a full step below the destinations: tertiary ink, smaller,
   no resting accent. They stay reachable without competing with navigation. */
.lyx-nav-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    height: 34px;
    padding: 0 0.6rem;
    border-radius: 10px;
    color: var(--text-tertiary);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--dur-fast) var(--ease-out),
                background-color var(--dur-fast) var(--ease-out);
}
.lyx-nav-meta svg { flex: 0 0 auto; }
.lyx-nav-meta:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.05); }
.lyx-nav-meta--support svg { color: var(--primary-text); }
.lyx-nav-meta--support:hover { color: var(--primary-text); background: rgba(80, 210, 193, 0.10); }

/* The one hairline in the bar, placed where two things are actually adjacent:
   the quiet utility pair and the loud CTA. Between the links and the actions
   the gap already does that job. */
.lyx-nav-sep { flex: 0 0 auto; width: 1px; height: 22px; margin: 0 0.5rem; background: rgba(255, 255, 255, 0.10); }

/* Promoted from a 0.2rem-padded outline link to a real filled action — it is
   the one thing on every public page that feeds the core analyze flow. */
.lyx-nav-cta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    height: 40px;
    padding: 0 1.05rem;
    border-radius: var(--radius-md);
    background: var(--gradient-brand);
    color: #0a0a0a;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(80, 210, 193, 0.22);
    transition: box-shadow var(--dur-fast) var(--ease-out),
                transform var(--dur-fast) var(--ease-out),
                filter var(--dur-fast) var(--ease-out);
}
.lyx-nav-cta:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(80, 210, 193, 0.32); }
.lyx-nav-cta:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(80, 210, 193, 0.25); }
.lyx-nav-cta svg { transition: transform var(--dur-fast) var(--ease-out); }
.lyx-nav-cta:hover svg { transform: translateX(2px); }
.lyx-nav-cta-short { display: none; }

/* ── Nav: light mode ──────────────────────────────────────────────────── */
/* Consolidated here from a one-line override stranded in public_calculator.html,
   which tinted the shell but left every child at its dark-mode value. */
[data-theme="light"] .lyx-nav {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(80, 210, 193, 0.28);
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.10), 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}
[data-theme="light"] .lyx-nav--scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.14), 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}
[data-theme="light"] .lyx-nav-link:hover,
[data-theme="light"] .lyx-nav-meta:hover,
[data-theme="light"] .lyx-nav-more-btn[aria-expanded="true"],
[data-theme="light"] .lyx-nav-more-panel a:hover { background: rgba(15, 23, 42, 0.06); }
[data-theme="light"] .lyx-nav-sep { background: rgba(15, 23, 42, 0.12); }
[data-theme="light"] .lyx-nav-more-panel {
    background: #ffffff;
    border-color: rgba(80, 210, 193, 0.25);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
}
/* #50d2c1 as text on white is 1.9:1. Darkened to #0f7d70 (9.2:1) for the
   active pill and the support heart; the CTA keeps full-strength teal because
   there it is a background carrying near-black text (10.7:1). */
[data-theme="light"] .lyx-nav-link.nav-active,
[data-theme="light"] .lyx-nav-more-panel a.nav-active,
[data-theme="light"] .lyx-nav-meta--support:hover { color: #0f7d70; }
[data-theme="light"] .lyx-nav-meta--support svg { color: #0f7d70; }
[data-theme="light"] .lyx-nav-link.nav-active { background: rgba(80, 210, 193, 0.18); }
[data-theme="light"] .lyx-nav-link.nav-active:hover { background: rgba(80, 210, 193, 0.26); }
[data-theme="light"] .lyx-hamburger span { background: var(--text-secondary); }

body.lyx-scroll-lock { position: fixed; left: 0; right: 0; overflow: hidden; }
/* Ko-fi's floating widget uses z-index 99999999, above any in-page overlay —
   hide it while the full-screen mobile menu (which reuses this lock class) is open. */
body.lyx-scroll-lock .floatingchat-container-wrap,
body.lyx-scroll-lock .floatingchat-container-wrap-mobi { display: none; }

/* ── Dialog chrome suppression ──────────────────────────────────────────────
   The same collision, for in-page dialogs: three pieces of fixed chrome are
   pinned to the bottom-right corner and every one of them outranks a normal
   overlay — the Ko-fi "Tip Us" bubble (99999999) and .theme-toggle-fixed
   (9998). A dialog centred over that corner got a
   button punched through it. The dialog raises its own z-index above them
   (see .sc-modal), and these hide outright while it's open so their hit areas
   can't swallow clicks aimed at the dialog either — Ko-fi's is an iframe, so
   it eats pointer events across its whole box, not just the visible bubble.

   Purely visual: no scroll lock here, since callers manage that themselves.
   !important is required to beat Ko-fi's inline style attribute.

   body.lyx-consent-visible is the same problem in a different shape. The consent
   bar spans the full bottom edge rather than the centre, so it crosses all of this
   corner chrome at once, plus .news-back-top at bottom:16px/right:72px. It is
   non-modal by design (nothing is blocked, no scroll lock) — this class only
   clears the corner while the bar occupies it. */
body.lyx-modal-open .floatingchat-container-wrap,
body.lyx-modal-open .floatingchat-container-wrap-mobi,
body.lyx-modal-open .floating-chat-kofi-popup-iframe,
body.lyx-modal-open .floating-chat-kofi-popup-iframe-mobi,
body.lyx-modal-open .theme-toggle-fixed,
body.lyx-consent-visible .floatingchat-container-wrap,
body.lyx-consent-visible .floatingchat-container-wrap-mobi,
body.lyx-consent-visible .floating-chat-kofi-popup-iframe,
body.lyx-consent-visible .floating-chat-kofi-popup-iframe-mobi,
body.lyx-consent-visible .news-back-top,
body.lyx-consent-visible .theme-toggle-fixed { display: none !important; }

/* labelyx.xyz notice (base.html): sits above the theme toggle, yields like it. */
.lyx-domain-note {
    position: fixed;
    right: 1.25rem;
    bottom: 5rem;
    z-index: 9998;
    max-width: 320px;
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    padding: 0.85rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(12px);
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--text-secondary);
}
.lyx-domain-note[hidden],
body.lyx-modal-open .lyx-domain-note,
body.lyx-consent-visible .lyx-domain-note { display: none; }
.lyx-domain-note p { margin: 0; }
.lyx-domain-note strong { color: var(--text-primary); }
.lyx-domain-note button {
    flex-shrink: 0;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--accent);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
@media (max-width: 600px) {
    .lyx-domain-note { left: 0.75rem; right: 0.75rem; max-width: none; bottom: 4.5rem; }
}

/* ── Mobile menu ──────────────────────────────────────────────────────── */
/* Separate top-level element (sibling of .lyx-nav-wrapper), not nested inside
   .lyx-nav, so position:fixed here is relative to the real viewport — .lyx-nav's
   backdrop-filter would otherwise hijack it as a containing block (see the JS
   comment on the "More" dropdown for the same gotcha). */
.lyx-mobile-menu { display: none; }

/* Between 769px (where the hamburger takes over) and full width, the bar sheds
   text in two measured stages rather than one blunt one. Numbers are measured,
   not guessed: the complete layout needs 935px of content, and the bar's inner
   width is viewport − 64px, so the full treatment holds down to ~1000px before
   the two groups touch. Stage one buys back ~88px, which carries it to ~967px.
   Every stage keeps all nine targets and their hit areas; only text is dropped.

   Stage 1 — the wordmark goes. The mark still identifies the brand. */
@media (min-width: 967px) and (max-width: 1059px) {
    .lyx-nav .lyx-logo { margin-right: 1.25rem; }
    .lyx-logo-word { display: none; }
}
/* Stage 2 — utility links fall back to their icons and the CTA drops its
   qualifier. Both metas carry aria-label, so hiding their text costs no
   accessible name; the CTA keeps a full label via its short span. */
@media (min-width: 769px) and (max-width: 966px) {
    .lyx-nav .lyx-logo { margin-right: 1rem; }
    .lyx-logo-word { display: none; }
    .lyx-nav-link { padding: 0 0.5rem; }
    .lyx-nav-meta { padding: 0 0.45rem; }
    .lyx-nav-meta-label { display: none; }
    .lyx-nav-sep { margin: 0 0.35rem; }
    .lyx-nav-cta { padding: 0 0.85rem; }
    .lyx-nav-cta-full { display: none; }
    .lyx-nav-cta-short { display: inline; }
}

@media (max-width: 768px) {
    /* Shorter on phones: 68px of fixed chrome over a 667px-tall viewport is a
       meaningful bite out of the fold. html{scroll-padding-top} and the mobile
       menu's top padding both derive from this, so they follow automatically. */
    :root { --lyx-nav-h: 58px; }

    .lyx-nav { padding: 0 0.65rem 0 0.9rem; }
    .lyx-hamburger { display: flex; margin-left: auto; }
    .lyx-nav-links, .lyx-nav-actions { display: none; }

    .lyx-mobile-menu {
        display: flex;
        flex-direction: column;
        position: fixed;
        inset: 0;
        z-index: 99;
        background: rgba(5, 10, 10, 0.98);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
        pointer-events: none;
    }
    .lyx-mobile-menu.lyx-mobile-menu-open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        transition: opacity 0.2s ease, transform 0.2s ease;
        pointer-events: auto;
    }
    .lyx-mobile-menu-inner {
        flex: 1 1 auto;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 480px;
        margin: 0 auto;
        padding: calc(var(--lyx-nav-h) + var(--lyx-nav-top) + 20px) 1.5rem 1.5rem;
    }

    .lyx-mobile-group {
        margin-bottom: 0.85rem;
    }

    .lyx-mobile-link {
        color: var(--text-primary);
        text-decoration: none;
        font-size: 1rem;
        font-weight: 500;
        padding: 0.7rem 0.6rem;
        border-radius: var(--radius-sm, 8px);
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        transition: background-color var(--dur-fast, 0.18s) ease, color var(--dur-fast, 0.18s) ease;
    }
    .lyx-mobile-link:hover {
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-primary);
    }
    .lyx-mobile-link.nav-active {
        color: var(--primary-text);
        font-weight: 600;
        background: rgba(80, 210, 193, 0.12);
    }

    .lyx-mobile-pill {
        font-size: 0.68rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        padding: 2px 7px;
        border-radius: 999px;
        background: rgba(80, 210, 193, 0.18);
        color: var(--primary-text);
    }

    .lyx-mobile-ext {
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--accent);
    }

    .lyx-mobile-label {
        font-size: 0.72rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--text-tertiary);
        padding: 0.75rem 0.6rem 0.25rem;
    }

    .lyx-mobile-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 1rem 0; }

    .lyx-mobile-menu-footer {
        flex: 0 0 auto;
        width: 100%;
        max-width: 480px;
        margin: 0 auto;
        /* Keeps the CTA clear of the fixed bottom-right chrome (theme toggle,
           Ko-fi bubble) on every device. */
        padding: 0.75rem 1.5rem calc(76px + env(safe-area-inset-bottom, 0px));
        background: linear-gradient(to top, rgba(5,10,10,0.98) 70%, rgba(5,10,10,0));
    }

    .lyx-mobile-cta {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        text-align: center;
        color: #04211e;
        text-decoration: none;
        font-weight: 600;
        font-size: 1rem;
        padding: 0.85rem 1rem;
        border-radius: var(--radius-md);
        background: var(--gradient-brand);
        box-shadow: 0 4px 16px rgba(80, 210, 193, 0.3);
        transition: transform 0.18s ease, filter 0.18s ease;
    }
    .lyx-mobile-cta:active {
        transform: scale(0.98);
    }

    [data-theme="light"] .lyx-mobile-menu {
        background: rgba(255, 255, 255, 0.98);
    }
    [data-theme="light"] .lyx-mobile-link:hover {
        background: rgba(0, 0, 0, 0.04);
    }
    [data-theme="light"] .lyx-mobile-link.nav-active {
        color: var(--primary-text);
        background: rgba(80, 210, 193, 0.16);
    }
    [data-theme="light"] .lyx-mobile-pill {
        background: rgba(80, 210, 193, 0.22);
        color: var(--primary-text);
    }
    [data-theme="light"] .lyx-mobile-menu-footer {
        background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 70%, rgba(255, 255, 255, 0));
    }
}

/* ── Footer ───────────────────────────────────────────────────────────── */
/* ── Public footer ─────────────────────────────────────────────────────────
   Four named columns plus a brand block. The previous version was a single
   two-column grid of fifteen undifferentiated links, which read as a dump
   rather than a map — and told a crawler nothing about how the site is
   organised. Headings here are real <h2>s inside a <nav>, so the grouping is
   in the document outline and not only in the layout. */
.lyx-footer {
    max-width: 1200px;
    margin: 5rem auto 0;
    padding: 3.5rem 2rem 2rem;
    border-top: 1px solid var(--landing-hairline);
}

.lyx-footer-top {
    display: grid;
    grid-template-columns: minmax(15rem, 20rem) 1fr;
    gap: 3rem 4rem;
    margin-bottom: 3rem;
}

.lyx-footer-tag {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.65;
    margin-top: 1rem;
    max-width: 22rem;
}

.lyx-footer-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2rem 1.5rem;
}

.lyx-footer-col { display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem; }

.lyx-footer-col h2 {
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin: 0 0 0.35rem;
}

.lyx-footer-col a,
.lyx-footer-cookie {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.4;
    transition: color var(--dur-fast) var(--ease-out);
}

.lyx-footer-col a:hover,
.lyx-footer-cookie:hover { color: var(--primary-text); }

/* The consent trigger is a <button> because it opens a panel rather than
   navigating; these declarations only undo the UA button chrome so it sits
   flush with the links above it. */
.lyx-footer-cookie {
    appearance: none;
    background: none;
    border: 0;
    padding: 0;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.lyx-footer-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 2rem;
    color: var(--text-tertiary);
    font-size: 0.82rem;
    line-height: 1.6;
    padding-top: 1.75rem;
    border-top: 1px solid var(--landing-hairline);
}

.lyx-footer-bottom p { margin: 0; }
.lyx-footer-bottom p:last-child { max-width: 34rem; }

.lyx-footer-social { display: flex; gap: 0.6rem; margin-top: 1.25rem; }

.lyx-footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: rgba(var(--landing-surface-rgb), 0.35);
    border: 1px solid var(--landing-hairline);
    color: var(--text-secondary);
    transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.lyx-footer-social a:hover { color: var(--primary-text); border-color: var(--border-focus); }

@media (max-width: 1000px) {
    .lyx-footer-top { grid-template-columns: 1fr; gap: 2.5rem; }
    .lyx-footer-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .lyx-footer { padding: 2.5rem 1.25rem 2rem; }
    /* Two columns still beat one here: a single stack of 22 links is a long
       scroll past the end of the page. */
    .lyx-footer-nav { gap: 1.75rem 1rem; }
    .lyx-footer-col a, .lyx-footer-cookie { font-size: 0.86rem; }
}

/* ── Shared table/wallet bits used across public tables ─────────────────── */
.wallet-link { color: var(--text-primary); text-decoration: none; font-family: var(--font-mono, monospace); font-size: 0.8rem; transition: color 0.2s; }
.wallet-link:hover { color: var(--primary-text); }
.sort-arrow { opacity: 0.5; font-size: 0.7em; margin-left: 3px; }
.rank-badge { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; font-size: 0.75rem; font-weight: 700; background: rgba(80,210,193,0.1); color: var(--text-muted); }
.rank-badge.gold { background: rgba(255,200,50,0.15); color: #f5c518; }
.rank-badge.silver { background: rgba(180,180,180,0.15); color: #c0c0c0; }
.rank-badge.bronze { background: rgba(180,120,50,0.15); color: #cd7f32; }

/* ══════════════════════════════════════════════════════════════════════════
   SHARED FOUNDATIONS (visual revamp)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Heat-scaled cells ──────────────────────────────────────────────────────
   Set --heat (0..1, normalized magnitude) inline on the element; color
   intensity then encodes HOW big the value is, not just its sign.
   Used by: calendar day cells, sessions heatmap, funding APR heatmap. */
.heat-pos {
    background: rgba(16, 185, 129, calc(0.05 + var(--heat, 0.5) * 0.38));
    border-color: rgba(16, 185, 129, calc(0.15 + var(--heat, 0.5) * 0.35));
}
.heat-neg {
    background: rgba(244, 63, 94, calc(0.05 + var(--heat, 0.5) * 0.38));
    border-color: rgba(244, 63, 94, calc(0.15 + var(--heat, 0.5) * 0.35));
}
[data-theme="light"] .heat-pos { background: rgba(16, 185, 129, calc(0.08 + var(--heat, 0.5) * 0.42)); }
[data-theme="light"] .heat-neg { background: rgba(244, 63, 94, calc(0.08 + var(--heat, 0.5) * 0.42)); }

/* ── Signature: risk gradient bar ───────────────────────────────────────────
   LabelYX's one owned motif: the green→amber→red risk scale. Track + needle
   (position via inline left:%) or track + .risk-fill (width:%). Consumed by
   the calculator liq bar, risk-console gauge, positions liq cells, homepage. */
.risk-track {
    position: relative;
    height: 8px;
    border-radius: 99px;
    background: linear-gradient(90deg,
        rgba(16, 185, 129, 0.5)  0%,
        rgba(245, 158, 11, 0.55) 50%,
        rgba(244, 63, 94, 0.6)   100%);
}
.risk-track.sm { height: 5px; }
.risk-needle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-primary);
    border: 2px solid var(--bg-app);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    transition: left 0.3s ease;
}
.risk-track.sm .risk-needle { width: 10px; height: 10px; }

/* ── Cell bar: inline PnL magnitude underline in table cells.
   A rule beneath the number showing how big this row's |value| is relative to
   the largest in the table. `--w` is 0%–100% of the cell width (pre-scaled by
   the page). Sign is carried by colour, not direction: the bar is always
   right-anchored under a right-aligned number, so gains and losses share one
   geometry and the bar never runs underneath the digits.
   Usage:
   <div class="cell-bar tone-up" style="--w:32%">
     <span class="cell-bar-fill"></span><span class="cell-bar-value">+$1.2k</span>
   </div> ───────────────────────────────────────────────────────────────── */
.cell-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 70px;
    height: 1.5rem;
}
.cell-bar-fill {
    position: absolute;
    right: 0.35rem;
    bottom: 1px;
    height: 2px;
    border-radius: 1px;
    width: var(--w, 0%);
    max-width: calc(100% - 0.35rem);
}
.cell-bar.tone-up .cell-bar-fill   { background: var(--success); opacity: 0.7; }
.cell-bar.tone-down .cell-bar-fill { background: var(--danger);  opacity: 0.7; }
/* Liquidation runway, same geometry as the PnL bar above so the table reads as
   one system. Length = how far mark is from liq (capped), colour = risk band.
   Replaces a 56×5px green→amber→red gradient with a needle, which at that size
   couldn't resolve as a scale and read as decoration. */
.cell-bar.liq-safe .cell-bar-fill   { background: var(--text-tertiary); opacity: 0.55; }
.cell-bar.liq-warn .cell-bar-fill   { background: var(--warning); opacity: 0.75; }
.cell-bar.liq-danger .cell-bar-fill { background: var(--danger);  opacity: 0.8; }
.cell-bar-value {
    position: relative;
    z-index: 1;
    font-variant-numeric: tabular-nums;
    padding-right: 0.35rem;
}

.heatmap-cell.heat-pos, .heatmap-cell.heat-neg { border-width: 1px; border-style: solid; }

/* ── Alert-tinted table rows (extreme funding APR etc.) ────────────────── */
.row-alert-danger td { background: rgba(244, 63, 94, 0.08); }
.row-alert-warn td   { background: rgba(245, 158, 11, 0.07); }

/* ── Instrument components (promoted from calculator.html — the app's best
      input/result styling; consumed by calculator, risk, compound and the
      public calculator instead of per-page near-duplicates) ─────────────── */
.res-grid { display: grid; gap: 0.9rem; }
.res-grid.grid-2 { grid-template-columns: 1fr 1fr; }
.res-grid.grid-3 { grid-template-columns: repeat(3, 1fr); }
.res-card {
    background: rgba(0, 0, 0, 0.14);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
    text-align: center;
    transition: border-color 0.18s;
}
[data-theme="light"] .res-card { background: rgba(0, 0, 0, 0.03); }
.res-label {
    font-size: 0.65rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.45rem;
}
.res-val {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace;
    color: var(--text-primary);
    line-height: 1.2;
}
.res-primary {
    border-color: rgba(80, 210, 193, 0.22);
    background: radial-gradient(ellipse at center, rgba(80, 210, 193, 0.07) 0%, transparent 70%);
}
.res-danger {
    border-color: rgba(244, 63, 94, 0.22);
    background: rgba(244, 63, 94, 0.04);
}

.dir-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-tertiary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: all 0.18s;
}
.dir-btn:hover { color: var(--text-secondary); background: rgba(255, 255, 255, 0.03); }
.dir-btn.dir-long.active {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: rgba(16, 185, 129, 0.4);
}
.dir-btn.dir-short.active {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: rgba(244, 63, 94, 0.4);
}
[data-theme="light"] .dir-btn {
    background: #f8fafc;
    border-color: rgba(80, 210, 193, 0.22);
    color: var(--text-secondary);
}
[data-theme="light"] .dir-btn:hover {
    background: rgba(80, 210, 193, 0.07);
    color: var(--text-primary);
}

.input-icon-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: border-color 0.18s, box-shadow 0.18s;
    overflow: hidden;
}
[data-theme="light"] .input-icon-wrapper { background: rgba(0, 0, 0, 0.04); }
.input-icon-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(80, 210, 193, 0.1);
}
.input-icon-wrapper input,
.input-icon-wrapper select {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.6rem 0.7rem;
    font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace;
    font-size: 0.88rem;
    outline: none;
    -moz-appearance: textfield;
}
.input-icon-wrapper select { cursor: pointer; font-family: inherit; }
.input-icon-wrapper select option { background: var(--bg-primary, #0f172a); color: var(--text-primary); }
.input-icon-wrapper input::-webkit-inner-spin-button,
.input-icon-wrapper input::-webkit-outer-spin-button { -webkit-appearance: none; }
.i-prefix {
    padding: 0 0.1rem 0 0.7rem;
    color: var(--text-tertiary);
    font-size: 0.82rem;
    flex-shrink: 0;
}
.i-suffix {
    padding: 0 0.7rem 0 0.1rem;
    color: var(--text-tertiary);
    font-size: 0.72rem;
    flex-shrink: 0;
    font-weight: 600;
}

/* ── Masthead backdrop ─────────────────────────────────────────────────────
   The teal/amber wash plus ruled texture behind every public page's title.

   Anchored to the page container, NOT to the masthead element. It used to
   hang off .lyx-guide-hd / .page-header with a negative `top` big enough to
   reach the top of the page — but that distance is a sum of the nav height,
   the nav's float offset, the shell padding and (on articles) a breadcrumb
   that wraps at some widths. The guessed overshoot came up 5px short on
   articles and 10px short on data pages, leaving a hard black band across the
   top of the viewport above where the glow began.

   <main> starts at y=0 on every one of these pages, so `top:0` here is exact
   by construction and cannot drift when any of those tokens change. The fixed
   height replaces the old bottom:-1px, which tied the wash to the masthead's
   height and so rendered a different gradient on a 184px hub header than on a
   387px comparison header.

   left/right:0 rather than the old width:100vw + translateX: 100vw counts the
   scrollbar, so the wash was ~15px wider than the content area on any page
   tall enough to scroll.

   :has() scopes this to editorial and data pages. The landing page also
   carries .lyx-landing and is deliberately excluded — it has its own hero. */
.lyx-landing:has(> .lyx-guide),
.lyx-pub {
    position: relative;
    /* Keeps the z-index:-1 layer between this element's background and its
       content instead of letting it escape to the root stacking context and
       paint behind .lyx-landing's own gradient, i.e. nowhere. Stacking context
       only: it does not become a containing block, so .art-toc stays fixed to
       the viewport. */
    isolation: isolate;
}

.lyx-landing:has(> .lyx-guide)::before,
.lyx-pub::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 34rem;
    z-index: -1;
    pointer-events: none;
    background:
        /* A ruled ledger at the threshold of visibility. It reads as texture
           rather than pattern, and it is the one motif that says "this is a
           page about numbers" without drawing a single chart. */
        repeating-linear-gradient(to bottom, var(--landing-hairline) 0 1px, transparent 1px 2.5rem),
        radial-gradient(62rem 26rem at 20% -2%, var(--primary-glow), transparent 72%),
        radial-gradient(46rem 22rem at 88% 42%, rgba(255, 180, 84, 0.07), transparent 74%);
    mask-image: linear-gradient(to bottom, #000 46%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, #000 46%, transparent 100%);
}

/* ══════════════════════════════════════════════════════════════════════════
   EDITORIAL SYSTEM  —  /learn, /guides, /compare, /tools, /about, legal
   ══════════════════════════════════════════════════════════════════════════
   The register here is deliberately NOT the dashboard's. Wallet pages are a
   tool used under time pressure and earn their density; these are read once,
   at leisure, usually by someone who arrived from a search result and has no
   relationship with the product yet. So: display-scale headings, a real
   measure, generous leading, and section furniture (numerals, a contents
   rail, callouts) that makes a 2,000-word page look navigable at a glance
   instead of like a wall.

   Same tokens throughout — teal, amber, Fraunces, Instrument Sans. Nothing
   here introduces a colour the product does not already own. */

.lyx-guide {
    --art-measure: 46rem;      /* ≈68ch at the body size set below */
    max-width: var(--art-measure);
    margin: 0 auto;
    padding: var(--lyx-nav-clear) 1.5rem 4rem;
    line-height: 1.75;
    color: var(--text-secondary);
}

/* ── Masthead ──────────────────────────────────────────────────────────────
   A full-bleed band behind the title, not a boxed card: it reads as the top
   of a document rather than as one more panel on a dashboard. The glow pair
   (teal top-left, amber bottom-right, both under 10% alpha) is the same
   lighting the landing hero uses, so a reader arriving cold on an article
   still recognises where they are. */
.lyx-guide-hd {
    position: relative;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--landing-hairline);
}

.lyx-guide-bc {
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.lyx-guide-bc a { color: var(--primary-text); text-decoration: none; }
.lyx-guide-bc a:hover { text-decoration: underline; text-underline-offset: 3px; }
.lyx-guide-bc > span { opacity: 0.5; }
.lyx-guide-bc > span:last-child { opacity: 1; }

.lyx-guide h1 {
    font-family: var(--font-heading);
    font-size: clamp(2.1rem, 1.35rem + 3.1vw, 3.4rem);
    font-weight: 600;
    line-height: 1.08;
    color: var(--text-primary);
    margin: 0 0 1rem;
    letter-spacing: -0.025em;
    text-wrap: balance;
}

/* The standfirst carries the promise the headline cannot fit. Larger and
   lighter than body copy so the eye reads it as one unit with the title. */
.lyx-guide-sub {
    color: var(--text-secondary);
    font-size: clamp(1.02rem, 0.96rem + 0.3vw, 1.18rem);
    line-height: 1.6;
    max-width: 40rem;
    margin: 0;
}

.lyx-guide-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.9rem;
    color: var(--text-tertiary);
    font-size: 0.8rem;
    margin: 1.25rem 0 0;
}

/* Separator between meta items, drawn rather than typed so the markup stays
   a plain list of facts. */
.lyx-guide-meta > * + *::before {
    content: '';
    display: inline-block;
    width: 3px; height: 3px;
    border-radius: 50%;
    background: currentColor;
    vertical-align: middle;
    margin-right: 0.9rem;
    opacity: 0.6;
}

.art-readtime {
    color: var(--primary-text);
    font-weight: 600;
}

/* ── Section headings ──────────────────────────────────────────────────────
   The numeral hangs in the left margin on wide viewports (a genuine hanging
   indent, not a bullet), so a skim down the left edge reads as an index of
   the argument. Below that breakpoint it tucks above the heading instead of
   stealing measure from it.

   Scoped to `> h2` and `> section > h2` — the two shapes an article's own
   section headings actually take (verified against /learn, /guides, /compare,
   /tools and /about). A blanket `.lyx-guide h2` also caught every card title
   in the hub grids, stamping each one with a section rule and 1.75rem of
   top padding. Positive scoping beats a :not() blacklist here: a new card
   component inherits nothing by default instead of having to remember to
   opt out. */
.lyx-guide > h2,
.lyx-guide > section > h2 {
    position: relative;
    font-family: var(--font-heading);
    font-size: clamp(1.4rem, 1.2rem + 0.75vw, 1.85rem);
    font-weight: 600;
    line-height: 1.22;
    color: var(--text-primary);
    margin: 3.25rem 0 1rem;
    padding-top: 1.75rem;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

/* Hairline above each section — the cheapest possible "new chapter" signal,
   and it survives both themes. */
.lyx-guide > h2::before,
.lyx-guide > section > h2::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 2.5rem; height: 2px;
    border-radius: 2px;
    background: var(--gradient-brand);
}

.art-h2-num {
    display: block;
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--primary-text);
    margin-bottom: 0.4rem;
}

.art-h2-anchor {
    display: inline-flex;
    align-items: center;
    margin-left: 0.45rem;
    color: var(--text-tertiary);
    opacity: 0;
    transition: opacity var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
    vertical-align: middle;
}

.lyx-guide > h2:hover .art-h2-anchor,
.lyx-guide > section > h2:hover .art-h2-anchor { opacity: 1; }
.art-h2-anchor:hover { color: var(--primary-text); }
/* Keyboard users never trigger :hover, so the ring alone has to reveal it. */
.art-h2-anchor:focus-visible { opacity: 1; color: var(--primary-text); }

.lyx-guide h3 {
    font-family: var(--font-heading);
    font-size: 1.18rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 2.25rem 0 0.6rem;
    letter-spacing: -0.01em;
}

.lyx-guide h4 {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin: 1.75rem 0 0.5rem;
}

/* ── Body copy ─────────────────────────────────────────────────────────── */
.lyx-guide p {
    font-size: 1.02rem;
    line-height: 1.78;
    margin-bottom: 1.15rem;
}

/* Print-style lede: the first paragraph of the article proper gets a touch
   more size. Scoped to the one that directly follows the masthead, so it
   cannot fire on a random paragraph mid-page. */
.lyx-guide-hd + p {
    font-size: 1.12rem;
    line-height: 1.7;
    color: var(--text-primary);
}

/* Prose links. Deliberately ONE class of specificity: components opt out in
   the list below rather than being excluded with :not(). A growing :not()
   chain is self-defeating — each argument adds its own specificity, so the
   rule ends up out-ranking the very component styles meant to override it. */
.lyx-guide a {
    color: var(--primary-text);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: rgba(80, 210, 193, 0.45);
    transition: text-decoration-color var(--dur-fast) var(--ease-out);
}

.lyx-guide a:hover {
    text-decoration-color: var(--primary);
    text-decoration-thickness: 2px;
}

/* Links that are controls or cards, not prose. Each carries a .lyx-guide
   prefix so it out-ranks the rule above; colour is left to the component. */
.lyx-guide a.guide-card,
.lyx-guide a.guide-featured,
.lyx-guide a.path-step-card,
.lyx-guide a.glossary-related-card,
.lyx-guide a.glossary-deep-card,
.lyx-guide a.lyx-share-btn,
.lyx-guide a.art-h2-anchor,
.lyx-guide a.art-pager-link,
.lyx-guide a.art-more-all,
.lyx-guide .art-toc a {
    text-decoration: none;
}

.lyx-guide a.lyx-guide-btn { text-decoration: none; color: var(--primary-ink); }
.lyx-guide a.lyx-guide-btn-ghost { color: var(--text-primary); }

.lyx-guide strong { color: var(--text-primary); font-weight: 650; }

.lyx-guide code {
    font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace;
    font-size: 0.85em;
    color: var(--primary-text);
    background: rgba(80, 210, 193, 0.1);
    border: 1px solid var(--border-subtle);
    padding: 0.1em 0.4em;
    border-radius: var(--radius-sm);
}

/* ── Lists ─────────────────────────────────────────────────────────────────
   Custom markers on both: the browser default bullet is grey, sits too close
   to the text, and reads as an afterthought next to type this size.

   Scoped to *unclassed* lists (plus .tool-list, which is prose in all but
   name). A classed list inside an article is a component — .path-timeline,
   .path-steps, .path-checkpoint-items — and owns its own markers; a blanket
   `.lyx-guide ul` rule stamped teal dashes through all of them. */
.lyx-guide ol:not([class]), .lyx-guide ul:not([class]), .lyx-guide .tool-list {
    list-style: none;
    padding-left: 0;
    margin: 1rem 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    counter-reset: art-li;
}

.lyx-guide ol:not([class]) > li, .lyx-guide ul:not([class]) > li, .lyx-guide .tool-list > li {
    position: relative;
    font-size: 1.02rem;
    line-height: 1.7;
    padding-left: 1.9rem;
}

.lyx-guide ul:not([class]) > li::before, .lyx-guide .tool-list > li::before {
    content: '';
    position: absolute;
    left: 0.15rem;
    top: 0.72em;
    width: 0.7rem;
    height: 2px;
    border-radius: 2px;
    background: var(--primary);
    opacity: 0.75;
}

.lyx-guide ol:not([class]) > li::before {
    counter-increment: art-li;
    content: counter(art-li);
    position: absolute;
    left: 0;
    top: 0.12em;
    width: 1.3rem;
    text-align: right;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-text);
}

/* Nested lists keep the indent but drop to a quieter marker so the two
   levels do not compete. */
.lyx-guide li > ul:not([class]), .lyx-guide li > ol:not([class]) { margin: 0.6rem 0 0; }
.lyx-guide li > ul:not([class]) > li::before { background: var(--text-tertiary); width: 0.5rem; }

/* ── Quotes ────────────────────────────────────────────────────────────── */
.lyx-guide blockquote {
    margin: 2rem 0;
    padding: 0.25rem 0 0.25rem 1.5rem;
    border-left: 2px solid var(--primary);
    font-family: var(--font-heading);
    font-size: 1.2rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.lyx-guide blockquote p:last-child { margin-bottom: 0; }

/* ── Callouts ──────────────────────────────────────────────────────────────
   Three tones, all built from tokens the product already ships. Use them for
   the sentence a reader would otherwise learn the hard way — not to break up
   grey. A page with five callouts has none.

   The tone is carried by a label chip that straddles the top edge, not by a
   fat coloured bar down the left side. The bar is the single most worn-out
   shape in generated UI, and it also says nothing: a reader has to already
   know the colour code to decode it. A chip reading "WATCH OUT" needs no
   legend, and it survives greyscale, colour-blindness and print. */
.art-note {
    --note-tone: var(--primary);
    --note-tint: rgba(80, 210, 193, 0.05);
    position: relative;
    margin: 2.25rem 0;
    padding: 1.5rem 1.35rem 1.2rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--note-tint);
    font-size: 0.97rem;
    line-height: 1.7;
}

.art-note > b {
    position: absolute;
    top: 0;
    left: 1.1rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    /* Opaque, so the box border passes behind the chip rather than through it. */
    background: var(--bg-app);
    color: var(--note-tone);
    font-family: var(--font-body);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
}

.art-note > b > svg { flex: 0 0 auto; }
.art-note p { font-size: inherit; margin: 0; }
.art-note p + p { margin-top: 0.7rem; }

.art-note.is-warn {
    --note-tone: var(--accent-ink);
    --note-tint: var(--accent-soft);
}

.art-note.is-risk {
    --note-tone: var(--danger);
    --note-tint: var(--danger-bg);
}

/* ── Key takeaways ─────────────────────────────────────────────────────────
   The summary a reader who bounces after twenty seconds should still leave
   with. Placed directly under the masthead by convention. */
.art-key {
    margin: 0 0 2.5rem;
    padding: 1.4rem 1.6rem;
    border: 1px solid var(--border-focus);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(80, 210, 193, 0.08), rgba(80, 210, 193, 0.02));
}

.art-key > h2,
.art-key > h3 {
    font-family: var(--font-body);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary-text);
    margin: 0 0 0.9rem;
    padding: 0;
}
.art-key > h2::before, .art-key > h3::before { content: none; }

/* .lyx-guide prefix required: the prose list rule is `.lyx-guide ul:not([class])`
   (0,2,1) and would otherwise keep its 1.5rem bottom margin inside the box. */
.lyx-guide .art-key ul { margin: 0; gap: 0.6rem; }
.lyx-guide .art-key li { font-size: 0.97rem; }

/* .tool-list predates the marker system and carried its own indent. */
.lyx-guide .tool-list { padding-left: 0; }

/* ── Stat band ─────────────────────────────────────────────────────────────
   For the two or three numbers an article is actually about. Fraunces at
   display size, because a figure that matters should look like it does. */
.art-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 1px;
    margin: 2rem 0;
    background: var(--border-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.art-stat {
    background: var(--bg-app);
    padding: 1.2rem 1.25rem;
}

.art-stat b {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.9rem;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.art-stat span {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-tertiary);
}

/* ── Tables ────────────────────────────────────────────────────────────────
   Editorial tables, not data-grid tables: no zebra, no vertical rules, just a
   strong header and generous row padding. .data-table is excluded — that is
   the dashboard's sortable grid and it has its own look. */
.art-table-wrap {
    margin: 1.75rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

.lyx-guide .table-wrap { overflow-x: auto; margin: 1.25rem 0; }
.lyx-guide pre {
    overflow-x: auto;
    margin: 1.25rem 0;
    padding: 1rem 1.1rem;
    background: rgba(80, 210, 193, 0.06);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    line-height: 1.6;
}
.lyx-guide pre code { background: none; border: 0; padding: 0; font-size: 0.85rem; white-space: pre; }

.lyx-guide table:not(.data-table) {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
    line-height: 1.6;
}

.lyx-guide table:not(.data-table) th {
    text-align: left;
    font-family: var(--font-body);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    background: var(--bg-sidebar);
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-focus);
}

.lyx-guide table:not(.data-table) td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--landing-hairline);
    vertical-align: top;
}

.lyx-guide table:not(.data-table) tbody tr:last-child td { border-bottom: none; }
.lyx-guide table:not(.data-table) tbody tr:hover td { background: rgba(80, 210, 193, 0.04); }

/* ── Figures ───────────────────────────────────────────────────────────── */
.lyx-guide figure { margin: 2rem 0; }
.lyx-guide figure img { display: block; width: 100%; height: auto; border-radius: var(--radius-lg); border: 1px solid var(--border-subtle); }
.lyx-guide figcaption { margin-top: 0.7rem; font-size: 0.84rem; color: var(--text-tertiary); line-height: 1.55; }

.lyx-guide hr {
    border: 0;
    height: 1px;
    background: var(--landing-hairline);
    margin: 3rem 0;
}

/* ── Closing CTA ───────────────────────────────────────────────────────── */
.lyx-guide-cta {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(28rem 12rem at 50% 0%, var(--primary-glow), transparent 70%),
        rgba(var(--abyss-teal-rgb), 0.6);
    border: 1px solid var(--border-focus);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    text-align: center;
    margin-top: 3.5rem;
}

.lyx-guide-cta p {
    font-family: var(--font-heading);
    color: var(--text-primary);
    font-size: 1.35rem;
    line-height: 1.3;
    letter-spacing: -0.015em;
    margin-bottom: 1.35rem;
}

.lyx-guide-cta small { display: block; margin-top: 1rem; font-size: 0.8rem; color: var(--text-tertiary); }

.lyx-guide-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gradient-brand);
    border: 1px solid transparent;
    padding: 0.85rem 1.6rem;
    border-radius: var(--radius-md);
    color: var(--primary-ink);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}

.lyx-guide-btn:hover { transform: translateY(-2px); box-shadow: var(--landing-shadow-card-hover); }

.lyx-guide-btn-ghost {
    background: transparent;
    border-color: var(--border-focus);
    color: var(--text-primary);
}
.lyx-guide-btn-ghost:hover { border-color: var(--primary); background: rgba(80, 210, 193, 0.08); }

.lyx-guide-btns { display: flex; gap: 0.9rem; flex-wrap: wrap; justify-content: center; margin-top: 1.1rem; }

/* ── Contents rail (built by article-chrome.js) ────────────────────────────
   Fixed rather than sticky above 1200px. A sticky element is clipped by its
   own containing block, and giving it one tall enough would mean wrapping
   every article body in a new element — i.e. editing 75 templates for a
   decoration. Fixed positioning derives its left edge from --art-measure, the
   same value the prose column uses, so the two cannot drift apart. */
.art-toc {
    margin: 0 0 2.5rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: rgba(var(--abyss-teal-rgb), 0.45);
    font-size: 0.86rem;
}

.art-toc > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    min-height: 44px;
}

.art-toc > summary::-webkit-details-marker { display: none; }
.art-toc > summary:hover { color: var(--text-primary); }
.art-toc > summary:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.art-toc-caret { flex: 0 0 auto; transition: transform var(--dur-base) var(--ease-out); color: var(--text-tertiary); }
.art-toc[open] > summary .art-toc-caret { transform: rotate(180deg); }

.art-toc nav { padding: 0 0.5rem 0.75rem; }
.art-toc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.art-toc-list li { padding: 0; font-size: inherit; }

.lyx-guide .art-toc a {
    display: block;
    padding: 0.4rem 0.65rem;
    border-left: 2px solid transparent;
    color: var(--text-tertiary);
    text-decoration: none;
    line-height: 1.45;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.lyx-guide .art-toc a:hover { color: var(--text-primary); background: rgba(80, 210, 193, 0.06); }
.lyx-guide .art-toc a[aria-current] { color: var(--primary-text); border-left-color: var(--primary); font-weight: 600; }

@media (min-width: 1200px) {
    .art-toc {
        position: fixed;
        /* Anchored to the article's left edge, not to the viewport centre, so
           the 1.5rem gutter holds whatever --art-measure the page sets. */
        right: calc(50% + (var(--art-measure) / 2) + 1.5rem);
        left: auto;
        width: 14rem;
        /* Same clearance as the prose it sits beside, so the rail's first
           entry lines up with the breadcrumb. */
        top: var(--lyx-nav-clear);
        max-height: calc(100vh - var(--lyx-nav-h) - var(--lyx-nav-top) - 9rem);
        overflow-y: auto;
        overscroll-behavior: contain;
        margin: 0;
        background: none;
        border: 0;
        border-left: 1px solid var(--border-subtle);
        border-radius: 0;
    }

    .art-toc > summary {
        padding: 0 0.65rem 0.6rem;
        min-height: 0;
        cursor: default;
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        color: var(--text-tertiary);
    }

    .art-toc > summary .art-toc-caret { display: none; }
    .art-toc nav { padding: 0; }

    /* Set by article-chrome.js once the article has scrolled past the rail. */
    .art-toc.is-spent { opacity: 0; visibility: hidden; }
    .art-toc { transition: opacity var(--dur-base) var(--ease-out); }

    /* Gutter for the hanging section numeral, which only exists at this width. */
    .lyx-guide > h2,
    .lyx-guide > section > h2 { padding-left: 3.25rem; }
    .lyx-guide > h2::before,
    .lyx-guide > section > h2::before { left: 3.25rem; }
    .art-h2-num {
        position: absolute;
        left: 0;
        top: 1.75rem;
        margin: 0;
        line-height: 1.5;
    }
}

/* Narrower than the rail needs: --art-measure plus both gutters no longer
   fits, so the fixed rail would sit on top of the prose. Fall back to the
   in-flow disclosure. */
@media (max-width: 1199px) {
    .art-toc { position: static; }
}

/* Same fallback, higher threshold: /compare articles carry wide tables and
   run at 57.5rem, which needs ~1416px of viewport before a rail fits beside
   them. Everything here restores the in-flow presentation the base rules
   define; only the fixed-position block above has to be undone. */
@media (min-width: 1200px) and (max-width: 1439px) {
    .lyx-cmp-article > .art-toc {
        position: static;
        width: auto;
        max-height: none;
        overflow-y: visible;
        margin: 0 0 2.5rem;
        background: rgba(var(--abyss-teal-rgb), 0.45);
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-md);
    }

    .lyx-cmp-article > .art-toc > summary {
        padding: 0.85rem 1.1rem;
        min-height: 44px;
        cursor: pointer;
        font-size: 0.86rem;
        font-weight: 600;
        letter-spacing: normal;
        text-transform: none;
        color: var(--text-secondary);
    }

    .lyx-cmp-article > .art-toc > summary .art-toc-caret { display: block; }
    .lyx-cmp-article > .art-toc nav { padding: 0 0.5rem 0.75rem; }

    /* No gutter at this width, so the numeral goes back above the heading. */
    .lyx-cmp-article > h2,
    .lyx-cmp-article > section > h2 { padding-left: 0; }
    .lyx-cmp-article > h2::before,
    .lyx-cmp-article > section > h2::before { left: 0; }
    .lyx-cmp-article .art-h2-num { position: static; margin-bottom: 0.4rem; }
}

/* ── Reading progress ──────────────────────────────────────────────────────
   Two pixels at the very top of the viewport, above the floating nav. Purely
   an orientation cue, so it fades in only once the reader has committed. */
.art-progress {
    position: fixed;
    top: var(--ydy-promo-vis); left: 0; right: 0;
    height: 2px;
    z-index: 1000;
    opacity: 0;
    transition: opacity var(--dur-base) var(--ease-out);
    pointer-events: none;
}

.art-progress.is-on { opacity: 1; }

.art-progress > i {
    display: block;
    height: 100%;
    transform: scaleX(0);
    transform-origin: 0 50%;
    background: var(--gradient-brand);
}

/* ── End-of-article navigation (_article_more.html) ──────────────────────── */
.art-more { margin-top: 3.5rem; }

.art-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding-top: 2rem;
    border-top: 1px solid var(--landing-hairline);
}

.art-pager-link {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    background: rgba(var(--landing-surface-rgb), 0.28);
    transition: border-color var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}

.art-pager-link:hover { border-color: var(--border-focus); transform: translateY(-2px); }
.art-pager-next { text-align: right; align-items: flex-end; }

.art-pager-dir {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--primary-text);
}

.art-pager-title {
    font-family: var(--font-heading);
    font-size: 1.02rem;
    line-height: 1.35;
    color: var(--text-primary);
}

.art-pager-time { font-size: 0.78rem; color: var(--text-tertiary); }
.art-pager-spacer { display: none; }

@media (max-width: 640px) {
    .art-pager { grid-template-columns: 1fr; }
    .art-pager-next { text-align: left; align-items: flex-start; }
}

.art-related { margin-top: 3rem; }

.art-practice { margin-top: 2.5rem; }
.art-practice ul { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.5rem; }
.art-practice a { color: var(--accent); font-weight: 600; }

.art-more-head {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--text-primary);
    margin: 0 0 1.25rem;
    padding: 0;
    display: flex;
    align-items: baseline;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.art-more-head::before { content: none; }

.art-more-head span {
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.art-more-all {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-text);
}

.art-more-all:hover { gap: 0.7rem; }

@media (max-width: 720px) {
    .lyx-guide > h2,
    .lyx-guide > section > h2 { margin-top: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .art-more-all:hover { gap: 0.45rem; }
    .lyx-guide-btn:hover, .art-pager-link:hover { transform: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PUBLIC DATA PAGES  —  /markets, /whales, /funding, /leaderboard, /vaults,
   /news, /calculator, /funding/compare, /markets/<coin>
   ══════════════════════════════════════════════════════════════════════════
   These share ui.page_header() with the wallet dashboard, where the same
   markup has to stay compact — a trader checking a position does not need a
   display headline every time they switch tab. A visitor arriving from a
   search result does: this is the first thing they see of the product, and
   at dashboard scale it reads as a screenshot rather than a page.

   Hence .lyx-pub, set on the <main> of these pages only. It deliberately does
   NOT key off .lyx-landing, which the landing page also carries. */

/* Shell for the public data pages: the 1200px measure and the clearance under
   the floating nav, previously repeated as an inline style attribute on nine
   templates. Top padding has to clear the nav's own height *and* its float
   offset, which is why it derives from the same tokens the nav does instead
   of the flat 5rem that used to sit here — at display heading sizes the old
   value put the first line of the h1 under the bar. */
/* .grp-section sets padding-top:5rem, which puts the old compact h1 at 80px
   against a nav whose bottom edge is at 82px. The .lyx-pub masthead is much
   larger, so it needs the same derived clearance the shell uses. Scoped to
   .lyx-pub so the combined group view at /group/<addresses>, which shares
   .grp-section, keeps its own spacing. */
.lyx-pub .grp-section {
    padding-top: var(--lyx-nav-clear);
}

.lyx-pub-shell {
    /* The gutter is added to the max-width rather than taken out of it, so the
       content column stays exactly 1200px on a wide screen while gaining a
       margin once the viewport drops below that. Previously .lyx-section had
       no horizontal padding at all and content sat flush against the screen
       edge on narrow viewports; /news patched that for itself alone. */
    max-width: calc(1200px + 3rem);
    margin: 0 auto;
    padding-inline: 1.5rem;
    padding-top: var(--lyx-nav-clear);
}

@media (max-width: 560px) {
    .lyx-pub-shell { padding-inline: 1rem; }
}

.lyx-pub .page-header {
    position: relative;
    display: block;
    margin-bottom: 2rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--landing-hairline);
}

.lyx-pub .page-title {
    display: block;
    font-size: clamp(2rem, 1.3rem + 2.8vw, 3.1rem);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.025em;
    text-wrap: balance;
}

.lyx-pub .page-subtitle {
    font-size: clamp(1rem, 0.95rem + 0.25vw, 1.14rem);
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 42rem;
    margin-top: 0.85rem;
}

/* page_header() puts its actions in a sibling; with display:block above they
   need to be pulled back onto the title row. */
.lyx-pub .page-actions { margin-top: 1.25rem; }

/* ── Editorial band on a data page ─────────────────────────────────────────
   The prose that explains what the table above actually means. Set on the
   article measure rather than the table's full width — a 1200px line of body
   copy is unreadable no matter how good the copy is. */
.lyx-pub-explainer {
    /* Same column as .lyx-pub-shell so the section rule and the left edge line
       up with the tables above; the prose inside is capped at a readable
       measure by the child rule below rather than by this container, which
       would otherwise pull the whole band off-centre. */
    max-width: calc(1200px + 3rem);
    margin: 4rem auto 0;
    padding: 2.5rem 1.5rem 0;
    border-top: 1px solid var(--landing-hairline);
    color: var(--text-secondary);
    line-height: 1.78;
}

.lyx-pub-explainer > * { max-width: 46rem; }

/* Inside an article or hub that already owns the column (a .lyx-guide page),
   the explainer must not re-apply the data-page shell geometry or it insets
   itself from everything above it. */
.lyx-pub-explainer.is-inline {
    max-width: none;
    margin-top: 3.5rem;
    padding-inline: 0;
}

.lyx-pub-explainer h2 {
    position: relative;
    font-family: var(--font-heading);
    font-size: clamp(1.35rem, 1.15rem + 0.7vw, 1.7rem);
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-primary);
    letter-spacing: -0.015em;
    margin: 2.75rem 0 0.9rem;
    padding-top: 1.5rem;
}

.lyx-pub-explainer > h2:first-child { margin-top: 0; }

.lyx-pub-explainer h2::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 2.5rem; height: 2px;
    border-radius: 2px;
    background: var(--gradient-brand);
}

.lyx-pub-explainer h3 {
    font-family: var(--font-heading);
    font-size: 1.12rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.75rem 0 0.5rem;
}

.lyx-pub-explainer p { font-size: 1.02rem; margin: 0 0 1.15rem; }

.lyx-pub-explainer a {
    color: var(--primary-text);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: rgba(80, 210, 193, 0.45);
    transition: text-decoration-color var(--dur-fast) var(--ease-out);
}

.lyx-pub-explainer a:hover { text-decoration-color: var(--primary); text-decoration-thickness: 2px; }
.lyx-pub-explainer strong { color: var(--text-primary); font-weight: 650; }

.lyx-pub-explainer ul {
    list-style: none;
    padding: 0;
    margin: 1rem 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.lyx-pub-explainer li {
    position: relative;
    padding-left: 1.9rem;
    font-size: 1.02rem;
    line-height: 1.7;
}

.lyx-pub-explainer li::before {
    content: '';
    position: absolute;
    left: 0.15rem;
    top: 0.72em;
    width: 0.7rem;
    height: 2px;
    border-radius: 2px;
    background: var(--primary);
    opacity: 0.75;
}

/* Inline FAQ. <details> rather than a JS accordion: a crawler reads the
   answer either way, and a reader gets keyboard and find-in-page behaviour
   the browser already implements correctly. */
.lyx-pub-faq { margin-top: 1.25rem; display: flex; flex-direction: column; gap: 0.6rem; }

.lyx-pub-faq > details {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: rgba(var(--landing-surface-rgb), 0.25);
}

.lyx-pub-faq summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 1.1rem;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    color: var(--text-primary);
    min-height: 44px;
}

.lyx-pub-faq summary::-webkit-details-marker { display: none; }
.lyx-pub-faq summary::after {
    content: '';
    flex: 0 0 auto;
    width: 0.55rem; height: 0.55rem;
    border-right: 2px solid var(--text-tertiary);
    border-bottom: 2px solid var(--text-tertiary);
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform var(--dur-base) var(--ease-out);
}

.lyx-pub-faq details[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.lyx-pub-faq summary:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.lyx-pub-faq details > p { margin: 0; padding: 0 1.1rem 1.1rem; font-size: 0.97rem; line-height: 1.7; }

@media (max-width: 720px) {
    .lyx-pub .page-header { margin-bottom: 1.5rem; }
    .lyx-pub-explainer { margin-top: 3rem; }
}

@media (max-width: 560px) {
    .lyx-pub-explainer { padding-inline: 1rem; }
}

/* ── Hub orientation copy ──────────────────────────────────────────────────
   The paragraph between a hub's masthead and its card grid. Set slightly
   larger than body copy and capped short of the full hub width, so it reads
   as an editor's note rather than as the first article on the page. */
.lyx-hub-intro {
    max-width: 42rem;
    font-size: 1.02rem;
    line-height: 1.75;
    color: var(--text-secondary);
    margin: 0 0 1.15rem;
}

/* The card that follows the intro copy needs air; without this the featured
   panel butts straight up against the last line of the paragraph. */
.lyx-hub-intro + .guide-featured,
.lyx-hub-intro + .guide-card { margin-top: 2.25rem; }

/* Hubs are wider than an article, so the stat band gets more room to breathe
   and sits directly under the masthead as the first thing after the title. */
.lyx-guide--hub .art-stats { margin: 0 0 2rem; }

/* Phones fit two stat tiles per row. An odd count left the last one alone at
   half width (Leaderboard's third KPI, the /tools stat band) — let it span. */
@media (max-width: 520px) {
    .kpi-grid:not(.kpi-tight) > :last-child:nth-child(odd):not(:only-child),
    .art-stats > :last-child:nth-child(odd):not(:only-child) { grid-column: 1 / -1; }
}

/* ── Legal pages (/privacy, /terms) ────────────────────────────────────────
   These ride on the editorial system rather than the bespoke .lyx-legal
   stylesheet they each used to inline. Only two things differ: a policy is
   scanned for a clause rather than read start to finish, so the sections sit
   closer together; and the closing disclaimer is set as fine print. */
.lyx-legal { --art-measure: 48rem; }
.lyx-legal > h2 { margin-top: 2.75rem; }

.lyx-legal-fine {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--landing-hairline);
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-tertiary);
}

/* The consent trigger inside section 9 of the privacy policy. */
.lyx-legal .lyx-c-btn { margin-top: 0.25rem; }

/* ── /compare: commercial comparison articles ──────────────────────────────
   Wider measure than .lyx-guide because these pages carry tables; the prose
   inside still tops out at 780px so line length stays readable. Tokens only,
   per DESIGN.md — no new hex. */
/* Width is set through --art-measure, not max-width: the fixed contents rail
   positions itself from that variable, so a container that widens behind its
   back ends up underneath the prose. */
.lyx-cmp-article{--art-measure:57.5rem}
.lyx-cmp-article > p,.lyx-cmp-article > ul,.lyx-cmp-article > ol,
.lyx-cmp-article > h2,.lyx-cmp-article > h3,.lyx-cmp-article > .lyx-cmp-ps{max-width:780px}

/* Affiliate disclosure — deliberately quiet but not hidden. Amber, because
   this is the one block on the page that is about us rather than the product. */
.lyx-cmp-disc{display:flex;gap:.7rem;align-items:flex-start;background:var(--accent-soft);
  border:1px solid rgba(255,180,84,.28);border-radius:var(--radius-md);
  padding:.9rem 1.1rem;margin:1.5rem 0 2rem}
.lyx-cmp-disc svg{flex:none;margin-top:.15rem;color:var(--accent-ink)}
.lyx-cmp-disc p{font-size:.85rem;line-height:1.6;margin:0;color:var(--text-secondary)}
.lyx-cmp-disc strong{color:var(--text-primary)}

/* Draft banner — only ever renders behind the preview token. */
.lyx-cmp-draft{background:var(--danger-bg);border:1px solid var(--danger);
  border-radius:var(--radius-md);padding:.8rem 1.1rem;margin-bottom:1.5rem;
  font-size:.85rem;color:var(--text-secondary)}
.lyx-cmp-draft strong{color: var(--danger-text)}

/* Verdict — the answer, above the fold, before any prose. */
.lyx-cmp-verdict{background:var(--bg-card);border:1px solid var(--border-subtle);
  border-radius:var(--radius-lg);padding:1.5rem 1.6rem;margin:2rem 0 2.5rem}
.lyx-cmp-verdict-h{font-family:var(--font-heading);font-size:.75rem;
  text-transform:uppercase;letter-spacing:.09em;color:var(--text-tertiary);
  margin:0 0 1.1rem}
.lyx-cmp-verdict dl{margin:0;display:flex;flex-direction:column;gap:.85rem}
.lyx-cmp-verdict-row{display:grid;grid-template-columns:minmax(120px,1fr) 2.4fr;
  gap:.5rem 1.25rem;align-items:baseline}
.lyx-cmp-verdict dt{font-size:.82rem;color:var(--text-tertiary);line-height:1.5}
.lyx-cmp-verdict dd{margin:0;font-size:.95rem;line-height:1.55}
.lyx-cmp-verdict dd a{font-weight:700;color: var(--primary-text);text-decoration:none;
  border-bottom:1px solid var(--border-focus)}
.lyx-cmp-verdict dd a:hover{opacity:.8}
.lyx-cmp-verdict dd span{display:block;color:var(--text-secondary);font-size:.88rem;margin-top:.15rem}
@media(max-width:560px){.lyx-cmp-verdict-row{grid-template-columns:1fr;gap:.15rem}
  .lyx-cmp-verdict{padding:1.2rem}}

/* Comparison table. Scrolls inside its own container so the page body never
   scrolls sideways; the product column stays pinned while fees scroll past. */
.lyx-cmp-tablewrap{margin:1.5rem 0 2rem}
/* Shown only where the table actually overflows, so it never lies on desktop. */
.lyx-cmp-swipe{display:flex;align-items:center;gap:.35rem;margin:0 0 .45rem;
  font-size:.74rem;color:var(--text-tertiary)}
.lyx-cmp-swipe[hidden]{display:none}
.lyx-cmp-swipe svg{flex:none;color: var(--primary-text)}

.lyx-cmp-scroll{overflow-x:auto;
  border:1px solid var(--border-subtle);border-radius:var(--radius-md);
  -webkit-overflow-scrolling:touch;overscroll-behavior-x:contain;
  scroll-snap-type:x proximity}
.lyx-cmp-scroll:focus-visible{outline:2px solid var(--border-focus);outline-offset:2px}
table.lyx-cmp{width:100%;border-collapse:collapse;font-size:.85rem;min-width:640px}
table.lyx-cmp caption{caption-side:top;text-align:left;padding:.9rem 1rem .2rem;
  font-size:.8rem;color:var(--text-tertiary);line-height:1.5}
table.lyx-cmp th,table.lyx-cmp td{padding:.7rem .9rem;text-align:left;
  border-bottom:1px solid var(--landing-hairline);vertical-align:top;line-height:1.5}
table.lyx-cmp thead th{position:sticky;top:0;background:var(--bg-sidebar);
  color:var(--text-tertiary);font-weight:600;font-size:.72rem;
  text-transform:uppercase;letter-spacing:.07em;white-space:nowrap;z-index:2}
table.lyx-cmp tbody th[scope=row]{position:sticky;left:0;background:var(--bg-card);
  font-weight:700;white-space:nowrap;z-index:1;scroll-snap-align:start}
table.lyx-cmp tbody th[scope=row] a{color: var(--primary-text);text-decoration:none}
table.lyx-cmp tbody th[scope=row] a:hover{text-decoration:underline}
table.lyx-cmp tbody tr:last-child th,table.lyx-cmp tbody tr:last-child td{border-bottom:0}
table.lyx-cmp td{color:var(--text-secondary)}
/* Hover is pointer-only: on touch it sticks after a tap and reads as selection. */
@media (hover:hover) and (pointer:fine){
  table.lyx-cmp tbody tr:hover td{background:var(--bg-card-hover)}
}

/* Below the table's 640px min-width it genuinely scrolls, so say so, tighten the
   padding to fit more per swipe, and keep the sticky product column narrow. */
@media (max-width:760px){
  table.lyx-cmp{font-size:.8rem;min-width:0}
  table.lyx-cmp th,table.lyx-cmp td{padding:.6rem .75rem}
  /* Squeezing 9 columns into 640px gave each ~89px, so every cell wrapped to
     three or four lines and rows ran to 116px. A floor per column costs a
     little more horizontal scroll and roughly halves the vertical. */
  table.lyx-cmp thead th,table.lyx-cmp td{min-width:8.75rem}
  table.lyx-cmp tbody th[scope=row]{min-width:6.5rem;max-width:7.5rem;
    white-space:normal;box-shadow:1px 0 0 var(--border-subtle)}
}

/* Pick / skip — every product gets both, including the ones that pay us. */
.lyx-cmp-ps{display:flex;flex-direction:column;gap:.5rem;margin:1rem 0 1.75rem;
  padding-left:.9rem;border-left:2px solid var(--border-subtle)}
.lyx-cmp-ps p{margin:0;font-size:.9rem;line-height:1.6}
.lyx-cmp-ps-pick strong{color: var(--success-text)}
.lyx-cmp-ps-skip strong{color:var(--accent-ink)}

/* Per-product CTA — lighter than .lyx-guide-cta, which stays for the big
   end-of-article blocks. */
.lyx-cmp-cta{margin:1.25rem 0 2rem}
.lyx-cmp-cta small{display:block;margin-top:.6rem;font-size:.78rem;color:var(--text-muted);line-height:1.55}

/* Worked fee example — the numbers people screenshot, so they must hold their
   shape at every width. A grid does the aligning; the old approach padded a
   <p> with &nbsp; and fell apart below ~700px, wrapping a product's name away
   from its own result. */
.lyx-cmp-math{background:var(--bg-card);border:1px solid var(--border-subtle);
  border-radius:var(--radius-md);padding:1.25rem 1.4rem;margin:1.75rem 0 2rem;max-width:780px}
.lyx-cmp-math-hd{font-size:.9rem;font-weight:700;color:var(--text-primary);
  margin:0 0 .9rem;line-height:1.5;text-wrap:balance}
.lyx-cmp-math-rows{margin:0}
.lyx-cmp-math-sub{font-size:.72rem;font-weight:700;letter-spacing:.06em;
  text-transform:uppercase;color: var(--primary-text);margin:1.1rem 0 .35rem}
.lyx-cmp-math-sub:first-child{margin-top:0}

.lyx-cmp-math-row{display:grid;
  grid-template-columns:minmax(7.5rem,auto) 1fr max-content;
  gap:.1rem .9rem;align-items:baseline;padding:.5rem 0;
  border-bottom:1px solid var(--landing-hairline)}
.lyx-cmp-math-row:last-child{border-bottom:0}
.lyx-cmp-math-name{font-size:.85rem;font-weight:600;color:var(--text-primary);
  margin:0;line-height:1.45}
.lyx-cmp-math-calc{font-family:'JetBrains Mono',monospace;font-size:.76rem;
  color:var(--text-tertiary);margin:0;line-height:1.5;
  overflow-wrap:anywhere}
.lyx-cmp-math-res{font-family:'JetBrains Mono',monospace;font-size:.82rem;
  font-weight:700;color:var(--text-primary);margin:0;text-align:right;
  white-space:nowrap;font-variant-numeric:tabular-nums}
.lyx-cmp-math-row.is-total{border-bottom:0;margin-top:.2rem;
  border-top:1px solid var(--border-subtle);padding-top:.7rem}
.lyx-cmp-math-row.is-total .lyx-cmp-math-name{color: var(--primary-text)}
.lyx-cmp-math-row.is-total .lyx-cmp-math-res{color: var(--primary-text);font-size:.9rem}

.lyx-cmp-math-note{font-size:.85rem;line-height:1.65;color:var(--text-secondary);
  margin:1.1rem 0 0}
.lyx-cmp-math-note + .lyx-cmp-math-note{margin-top:.7rem}

/* Below ~600px the three-column grid stops fitting: name and result share the
   first line so the answer stays scannable and right-aligned, and the working
   drops underneath at full width. */
@media (max-width:600px){
  .lyx-cmp-math{padding:1.05rem 1rem;border-radius:var(--radius-sm)}
  .lyx-cmp-math-row{grid-template-columns:1fr max-content;gap:.2rem .7rem;padding:.6rem 0}
  .lyx-cmp-math-name{grid-column:1;grid-row:1}
  /* nowrap is right when there is room and an overflow bug when there is not:
     a multi-value result cannot shrink and pushed the page 10px wide at 320. */
  .lyx-cmp-math-res{grid-column:2;grid-row:1;white-space:normal;
    overflow-wrap:anywhere;text-align:right}
  .lyx-cmp-math-calc{grid-column:1/-1;grid-row:2;font-size:.72rem}
  .lyx-cmp-math-calc:empty{display:none}
}
@media (max-width:600px){
  .lyx-cmp-math-row{grid-template-columns:minmax(0,1fr) minmax(0,max-content)}
}

/* Touch targets. On a coarse pointer the breadcrumb links measured 22px tall
   and the product links inside the comparison table 15px, both well under the
   44px floor. Padding expands the hit area; negative margin keeps the visual
   position identical, so nothing shifts on desktop. */
@media (pointer:coarse){
  .lyx-guide-bc{gap:.15rem}
  .lyx-guide-bc a{display:inline-block;padding:.6rem .35rem;margin:-.6rem -.35rem}
  table.lyx-cmp tbody th[scope=row] a{display:block;padding:.45rem 0;margin:-.45rem 0}
  .lyx-cmp-verdict dd a{display:inline-block;padding:.35rem 0;margin:-.35rem 0}
  .tool-faq-item summary{padding-top:.9rem;padding-bottom:.9rem}
}

/* Hub: count line under the H1. */
.lyx-cmp-count{display:inline-flex;align-items:center;gap:.45rem;font-size:.78rem;
  color:var(--text-tertiary);background:var(--bg-card);border:1px solid var(--border-subtle);
  border-radius:var(--radius-pill);padding:.3rem .8rem;margin-top:.9rem}
.lyx-cmp-count b{color: var(--primary-text);font-weight:700}
/* Preview-only badge on an unpublished card. Amber, matching the draft banner. */
.lyx-cmp-sched{display:inline-block;align-self:flex-start;margin:.4rem 0 .1rem;
  font-size:.7rem;font-weight:700;letter-spacing:.04em;text-transform:uppercase;
  color:var(--accent-ink);background:var(--accent-soft);
  border:1px solid rgba(255,180,84,.3);border-radius:var(--radius-sm);padding:.15rem .45rem}

/* ── Inline explanatory diagrams inside /learn articles ──────────────────── */
.lyx-figure{margin:1.75rem 0;padding:1.25rem 1.5rem;background:var(--bg-card);border:1px solid var(--border-subtle);border-radius:var(--radius-lg);text-align:center}
.lyx-figure svg{width:100%;height:auto;max-width:460px}
.lyx-figure figcaption{margin-top:.75rem;font-size:.82rem;color:var(--text-tertiary)}
.lyx-figure-legend{display:flex;gap:1.1rem;justify-content:center;flex-wrap:wrap;margin-top:.6rem;font-size:.74rem;color:var(--text-tertiary);font-family:'JetBrains Mono',monospace}
.lyx-figure-legend span{display:inline-flex;align-items:center;gap:.4rem}
.lyx-figure-legend i{width:12px;height:2px;display:inline-block;border-radius:1px}

/* ── Inline wallet CTA (public tool pages → core paste-a-wallet action) ── */
.wallet-cta{display:flex;gap:.6rem;align-items:center;max-width:560px;margin:2.5rem auto;padding:1rem 1.1rem;background:rgba(80,210,193,.05);border:1px solid rgba(80,210,193,.18);border-radius:16px}
.wallet-cta input{flex:1;min-width:0;background:rgba(0,0,0,.25);border:1px solid var(--border-subtle);border-radius:10px;padding:.6rem .8rem;color:var(--text-primary);font-family:'JetBrains Mono',monospace;font-size:.82rem;outline:none;transition:border-color .18s}
.wallet-cta input:focus{border-color:var(--border-focus)}
.wallet-cta button{flex-shrink:0;background:linear-gradient(135deg,#50d2c1,#38b2ac);border:none;padding:.65rem 1.2rem;border-radius:10px;color:#04302b;font-weight:700;font-size:.85rem;cursor:pointer;transition:.2s;white-space:nowrap}
.wallet-cta button:hover{transform:translateY(-1px);opacity:.92}
[data-theme="light"] .wallet-cta input{background:#fff}
@media(max-width:520px){.wallet-cta{flex-direction:column;align-items:stretch}}

/* ── Skip link: first focusable element site-wide, so keyboard users can
   bypass the sidebar/floating nav instead of tabbing through every link
   on every page load. Docked off the top of the viewport and centered so it
   drops in above the floating pill nav (top:14px, z-index:100) instead of
   overlapping its left edge; uses the same focus-visible glow-ring language
   as every other interactive element on the site instead of a hard outline. */
.lyx-skip-link {
    position: fixed;
    top: 0;
    left: 50%;
    align-self: flex-start;
    width: max-content;
    transform: translate(-50%, -100%);
    z-index: 10000;
    background: var(--bg-sidebar);
    color: var(--text-primary);
    border: 1px solid var(--border-focus);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    padding: .75rem 1.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform .15s ease;
}
.lyx-skip-link:focus-visible {
    transform: translate(-50%, 0);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ── Reduced motion: honor OS-level preference site-wide ─────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Crypto news page ─────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
    /* .lyx-section has no horizontal padding of its own; below the 1200px
       measure the content would sit flush against the screen edges. */
    .news-page-section { padding-left: 1rem; padding-right: 1rem; }
}
/* Most blocks here set their own display, which outranks the UA's
   [hidden]{display:none}. One rule keeps `el.hidden = true` meaning hidden. */
.news-page-section [hidden] { display: none !important; }

.news-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.75rem; align-items: start; }
@media (min-width: 1024px) {
    .news-layout { grid-template-columns: minmax(0, 1fr) 300px; }
}

/* Masthead status: catch-up note + live countdown */
.news-status { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.news-catchup {
    font-size: 0.82rem; font-weight: 600; color: var(--primary-text);
    padding: 0.3rem 0.75rem; border-radius: 999px; background: var(--primary-glow);
}
.news-refresh-badge {
    display: inline-flex; align-items: center; gap: 0.45rem; min-height: 2.25rem;
    border: 1px solid var(--border-subtle); background: transparent; border-radius: 999px;
    padding: 0.3rem 0.8rem 0.3rem 0.55rem;
    color: var(--text-secondary); font-size: 0.78rem; cursor: pointer; transition: 0.15s;
    font-variant-numeric: tabular-nums;
}
.news-refresh-badge:hover { border-color: var(--border-focus); color: var(--text-primary); }
.news-refresh-badge.is-paused { color: var(--text-muted); }
.news-refresh-badge.is-paused #refreshRing { stroke: var(--text-muted); }
#refreshRing { transition: stroke-dashoffset 1s linear; }

/* ── Mood band: Fear & Greed + narrative tape ────────────────────────────── */
.news-mood {
    display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1rem;
    margin-bottom: 1.25rem;
}
.news-mood-label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
.news-fg {
    display: flex; flex-direction: column; justify-content: space-between; gap: 0.5rem;
    padding: 0.95rem 1rem 0.9rem; border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg); background: var(--bg-card);
}
.news-fg-top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.news-fg-delta { font-size: 0.72rem; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.news-fg-gauge { position: relative; width: 100%; max-width: 188px; aspect-ratio: 200 / 108; margin: 0 auto; }
.news-fg-gauge svg { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Needle pivots on the arc's centre (100,100 in the 200x108 viewBox). */
.news-fg-needle-wrap {
    position: absolute; left: 50%; top: 92.6%; width: 0; height: 0;
    transition: transform 0.9s var(--ease-out);
}
.news-fg-needle {
    position: absolute; left: -1.5px; bottom: 0; width: 3px; height: 70px;
    background: linear-gradient(to top, transparent 0 62%, var(--text-primary) 62%);
    border-radius: 2px 2px 0 0;
}
.news-fg-readout {
    position: absolute; left: 0; right: 0; bottom: 0;
    display: flex; flex-direction: column; align-items: center; line-height: 1;
}
.news-fg-value { font-family: var(--font-heading); font-size: 1.9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.news-fg-label { font-size: 0.74rem; font-weight: 600; margin-top: 0.2rem; }

.news-tape-wrap { min-width: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.news-tape-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.news-tape-hint { font-size: 0.72rem; color: var(--text-muted); }
.news-tape {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(158px, 1fr); gap: 0.6rem;
    overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin;
    /* Room for the 2px hover lift and the 2px+2px focus ring on every side:
       overflow-x:auto makes overflow-y auto too, so anything outside the
       padding box is cut off. Negative margin keeps the tiles aligned. */
    padding: 6px 6px 8px; margin: -6px -6px -8px; scroll-padding-inline: 6px;
    flex: 1;
    /* Fade the trailing edge so a clipped tile reads as "scrolls", not "broken". */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
}
.news-tape.at-end { -webkit-mask-image: none; mask-image: none; }
.news-tape-item {
    scroll-snap-align: start;
    display: flex; flex-direction: column; gap: 0.3rem; text-align: left;
    padding: 0.75rem 0.85rem; border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
    background: var(--bg-card); color: var(--text-primary); cursor: pointer; font: inherit;
    transition: border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast);
}
.news-tape-item:hover { border-color: var(--border-focus); transform: translateY(-2px); }
.news-tape-item:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.news-tape-item.active { border-color: var(--primary); background: var(--primary-glow); }
.tape-row { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.tape-sym { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 700; font-size: 0.95rem; }
.tape-chg, .tape-px { font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace; font-variant-numeric: tabular-nums; }
.tape-chg { font-size: 0.76rem; font-weight: 600; }
.tape-px { font-size: 0.8rem; color: var(--text-secondary); min-height: 1.2em; }
.tape-px.muted { font-family: inherit; font-size: 0.72rem; color: var(--text-muted); }
.tape-fund { font-size: 0.7rem; color: var(--text-muted); min-height: 1.1em; font-variant-numeric: tabular-nums; }
.tape-fund.hot { color: var(--accent); font-weight: 600; }
[data-theme="light"] .tape-fund.hot { color: #9a5b00; }
.tape-chg.up, .news-focus .up { color: var(--success-text); }
.tape-chg.down, .news-focus .down { color: var(--danger-text); }
.tape-spark { width: 100%; height: 22px; margin: 0.15rem 0 0.05rem; overflow: visible; }
.tape-spark polyline {
    fill: none; stroke: var(--primary); stroke-width: 1.5; stroke-linejoin: round;
    vector-effect: non-scaling-stroke; opacity: 0.8;
}
.tape-count { font-size: 0.76rem; color: var(--text-secondary); }
.tape-count strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.tape-lean { display: flex; gap: 2px; height: 5px; border-radius: 3px; overflow: hidden; }
.tape-lean i { display: block; min-width: 0; flex-basis: 0; }
.lean-bull { background: var(--success); }
.lean-neu { background: var(--text-muted); opacity: 0.3; }
.lean-bear { background: var(--danger); }
.tape-lean-label { font-size: 0.7rem; color: var(--text-muted); }
.news-tape-empty { color: var(--text-muted); font-size: 0.88rem; padding: 1.5rem 0; }

@media (max-width: 768px) {
    .news-mood { grid-template-columns: minmax(0, 1fr); }
    .news-fg { flex-direction: row; align-items: center; }
    .news-fg-top { flex-direction: column; gap: 0.2rem; }
    .news-fg-gauge { max-width: 132px; margin: 0; }
    .news-fg-value { font-size: 1.5rem; }
    .news-tape-hint { display: none; }
    .news-tape { grid-auto-columns: 148px; margin-right: -1rem; padding-right: 1rem; }
}


/* ── Signals ─────────────────────────────────────────────────────────────── */
.news-signals {
    margin-bottom: 1.5rem; padding: 1.1rem 1.2rem 0.6rem;
    border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--bg-card);
}
.news-signals-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1.5rem; margin-bottom: 0.5rem; }
.news-signals-head h2 { margin: 0; font-family: var(--font-heading); font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
.news-signals-head p { margin: 0; font-size: 0.78rem; color: var(--text-muted); }
.news-signal-list {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.5rem;
}
.news-signal-list > li { border-top: 1px solid var(--border-subtle); min-width: 0; }
.news-signal-list > li.news-skeleton-row { border-top: 0; }
.news-signal {
    width: 100%; height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "kind go" "text text" "detail detail";
    gap: 0.3rem 0.75rem; align-items: center; text-align: left;
    padding: 0.8rem 0.6rem; margin: 0 -0.6rem; width: calc(100% + 1.2rem);
    background: none; border: 0; border-radius: var(--radius-sm); color: inherit; font: inherit; cursor: pointer;
    transition: background-color var(--dur-fast);
}
.news-signal:hover { background: var(--primary-glow); }
.news-signal:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.sig-kind {
    grid-area: kind; justify-self: start; display: inline-flex; align-items: center; gap: 0.4rem;
    font-size: 0.72rem; font-weight: 700; color: var(--text-secondary);
}
.sig-kind::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.sig-spike { color: var(--primary-text); }
.sig-diverge { color: var(--accent); }
[data-theme="light"] .sig-diverge { color: #9a5b00; }
.sig-crowded { color: var(--danger-text); }
.sig-quiet { color: var(--text-secondary); }
.sig-story { color: var(--success-text); }
.sig-text { grid-area: text; overflow-wrap: anywhere; font-size: 0.95rem; font-weight: 600; line-height: 1.4; color: var(--text-primary); text-wrap: pretty; }
.sig-detail { grid-area: detail; font-size: 0.78rem; color: var(--text-muted); }
.sig-go { grid-area: go; font-size: 0.74rem; font-weight: 600; color: var(--primary-text); opacity: 0; transition: opacity var(--dur-fast); white-space: nowrap; }
.news-signal:hover .sig-go, .news-signal:focus-visible .sig-go { opacity: 1; }
@media (hover: none) { .sig-go { opacity: 1; } }
@media (max-width: 900px) {
    /* Declared after the base grid on purpose: an earlier breakpoint loses the cascade. */
    .news-signal-list { grid-template-columns: minmax(0, 1fr); }
    .news-signals { padding: 1rem 1rem 0.4rem; }
}
.news-signal-empty { grid-column: 1 / -1; padding: 0.9rem 0 1rem; font-size: 0.86rem; color: var(--text-muted); }

/* ── Same story, other outlets ───────────────────────────────────────────── */
.news-also { margin-top: 0.15rem; font-size: 0.78rem; }
.news-also summary {
    display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; list-style: none;
    color: var(--text-secondary); font-weight: 600; padding: 0.2rem 0; border-radius: 4px;
}
.news-also summary::-webkit-details-marker { display: none; }
.news-also summary::before { content: '+'; display: inline-grid; place-items: center; width: 1rem; height: 1rem; border-radius: 4px; border: 1px solid var(--border-subtle); font-size: 0.72rem; line-height: 1; }
.news-also[open] summary::before { content: '−'; }
.news-also summary:hover { color: var(--text-primary); }
.news-also summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.news-also ul { list-style: none; margin: 0.4rem 0 0; padding: 0 0 0 0.9rem; border-left: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 0.35rem; }
.news-also a { color: var(--text-secondary); text-decoration: none; line-height: 1.4; display: block; }
.news-also a:hover { color: var(--text-primary); }
.news-also a b { color: var(--primary-text); font-weight: 600; }
.news-also a span { color: var(--text-muted); white-space: nowrap; }
.news-main.compact .news-also { display: none; }

/* ── Headline mood chart ─────────────────────────────────────────────────── */
.news-moodchart .news-side-sub { margin-bottom: 0.6rem; }
.news-moodchart .news-side-sub b { font-variant-numeric: tabular-nums; }
.news-moodchart .up { color: var(--success-text); }
.news-moodchart .down { color: var(--danger-text); }
.news-moodchart-svg { display: block; width: 100%; height: 84px; }
.news-moodchart-svg .axis { stroke: var(--border-subtle); stroke-width: 1; vector-effect: non-scaling-stroke; }
.news-moodchart-svg .bull { fill: var(--success); }
.news-moodchart-svg .bear { fill: var(--danger); }
.news-moodchart-svg .hit { fill: transparent; }
.news-moodchart-svg g:hover .bull, .news-moodchart-svg g:hover .bear { opacity: 0.75; }
.news-moodchart-axis { display: flex; justify-content: space-between; align-items: center; margin-top: 0.35rem; font-size: 0.68rem; color: var(--text-muted); }
.news-moodchart-axis .lg { display: inline-flex; align-items: center; gap: 0.3rem; }
.news-moodchart-axis .lg i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; opacity: 1; }
.news-moodchart-axis .lg i + i, .news-moodchart-axis .lg i:last-of-type { margin-left: 0.35rem; }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.news-toolbar {
    position: sticky; top: calc(var(--lyx-nav-h) + var(--lyx-nav-top) + 6px); z-index: 20;
    background: var(--bg-app); box-shadow: 0 1px 0 var(--border-subtle);
    padding: 0.7rem 0; margin-bottom: 1.25rem;
}
.news-toolbar-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.news-search { position: relative; flex: 1; min-width: 220px; }
.news-search svg { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); pointer-events: none; }
.news-search .form-input { padding-left: 2.3rem; padding-right: 2.4rem; min-height: 2.6rem; }
.news-kbd, .news-shortcuts kbd {
    font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace; font-size: 0.7rem;
    color: var(--text-tertiary); border: 1px solid var(--border-subtle); border-bottom-width: 2px;
    border-radius: 5px; padding: 0.05rem 0.4rem; background: var(--bg-card);
}
.news-kbd { position: absolute; right: 0.7rem; top: 50%; transform: translateY(-50%); pointer-events: none; }
.news-search .form-input:focus ~ .news-kbd { opacity: 0; }
.seg-item .facet-count { margin-left: 0.35rem; font-weight: 500; font-size: 0.72rem; color: inherit; opacity: 0.65; font-variant-numeric: tabular-nums; }
.news-range-select { display: none; }

.news-tool-btn {
    display: inline-flex; align-items: center; gap: 0.45rem; min-height: 2.6rem; padding: 0 0.95rem;
    border: 1px solid var(--border-subtle); background: transparent; color: var(--text-secondary);
    border-radius: var(--radius-sm); font: inherit; font-size: 0.84rem; font-weight: 600; cursor: pointer;
    transition: 0.15s;
}
.news-tool-btn:hover { color: var(--text-primary); border-color: var(--border-focus); }
.news-tool-btn.active { border-color: var(--primary); color: var(--text-primary); background: var(--primary-glow); }
.news-tool-icon { width: 2.6rem; padding: 0; justify-content: center; }
.news-tool-count {
    min-width: 1.2rem; height: 1.2rem; padding: 0 0.3rem; border-radius: 999px;
    background: var(--primary); color: #04302b; font-size: 0.7rem; line-height: 1.2rem; text-align: center;
}

.news-active { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.65rem; }
.news-active .news-chip-row { flex: 1; min-width: 0; }
.news-clear {
    flex-shrink: 0; background: none; border: none; padding: 0.35rem 0.25rem; cursor: pointer;
    color: var(--text-secondary); font: inherit; font-size: 0.8rem; text-decoration: underline; text-underline-offset: 3px;
}
.news-clear:hover { color: var(--text-primary); }

.news-drawer {
    display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.1rem 2rem;
    margin-top: 0.75rem; padding: 1.1rem 1.2rem;
    border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-card);
    max-height: calc(100vh - 14rem); overflow-y: auto;
}
.news-drawer-group { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.news-drawer-wide { grid-column: 1 / -1; }
.news-drawer-label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
.news-drawer-label span { font-weight: 400; color: var(--text-muted); }
.news-chip-wrap { flex-wrap: wrap; overflow: visible; }
.news-source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0 1rem; }
.news-source-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.5rem; margin: 0 -0.5rem; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.84rem; color: var(--text-secondary); }
.news-source-item:hover { background: var(--primary-glow); color: var(--text-primary); }
.news-source-check { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.news-source-name { min-width: 0; }
.news-source-item .facet-count { margin-left: auto; font-variant-numeric: tabular-nums; }
.news-mute { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.news-mute .form-input { flex: 0 1 18rem; }
.news-shortcuts { grid-column: 1 / -1; margin: 0; font-size: 0.76rem; color: var(--text-muted); display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.news-shortcuts kbd + kbd { margin-left: -0.15rem; }
.news-shortcuts kbd:not(:first-child) { margin-left: 0.6rem; }
.news-shortcuts kbd + kbd:not(:first-child) { margin-left: -0.15rem; }

@media (max-width: 768px) {
    /* A multi-row toolbar pinned to a phone screen eats the feed. */
    .news-toolbar { position: static; }
    .news-search { flex-basis: 100%; }
    .news-kbd, .news-shortcuts { display: none; }
    #rangeSeg { display: none; }
    .news-range-select { display: block; flex: 1; width: auto; min-height: 2.6rem; }
    .news-drawer { grid-template-columns: minmax(0, 1fr); max-height: none; }
    .news-drawer .seg { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
    .news-drawer .seg-item { flex: 0 0 auto; }
}

/* ── Shared chips (also used by /group, /learn, /guides, /compare, /tools) ─ */
.news-chip-row {
    display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 2px;
    scrollbar-width: none;
}
.news-chip-row::-webkit-scrollbar { display: none; }
.news-chip, .news-tag {
    flex-shrink: 0; border: 1px solid var(--border-subtle); background: transparent;
    color: var(--text-secondary); border-radius: 999px; padding: 0.35rem 0.85rem;
    font-size: 0.78rem; cursor: pointer; white-space: nowrap; transition: 0.15s;
}
.news-chip:hover, .news-tag:hover { border-color: var(--border-focus); color: var(--text-primary); }
.news-chip.active, .news-tag.active {
    border-color: var(--primary); background: var(--primary-glow); color: var(--text-primary);
}
.news-chip:disabled { opacity: 0.6; cursor: default; }

/* ── Coin focus strip (single-coin filter) ───────────────────────────────── */
.news-focus {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.75rem;
    margin-bottom: 1.25rem; padding: 0.95rem 1.2rem;
    border: 1px solid var(--border-focus); border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--primary) 7%, transparent);
    animation: newsFocusIn 0.35s var(--ease-out);
}
.news-focus-coin { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 600; line-height: 1; }
.news-focus-stats { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; font-size: 0.86rem; color: var(--text-secondary); }
.news-focus-stats b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.news-focus-stats b.up { color: var(--success-text); }
.news-focus-stats b.down { color: var(--danger-text); }
.news-focus-link { margin-left: auto; font-size: 0.86rem; font-weight: 600; color: var(--primary-text); text-decoration: none; }
.news-focus-link:hover { text-decoration: underline; text-underline-offset: 3px; }
@keyframes newsFocusIn { from { opacity: 0; transform: translateY(-4px); } }

/* ── Story cards ─────────────────────────────────────────────────────────── */
.news-feed { display: flex; flex-direction: column; gap: 0.75rem; }
.news-card {
    position: relative; display: flex; gap: 1.1rem; padding: 1rem; cursor: pointer;
    border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-card);
    transition: border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
    scroll-margin-top: 9rem;
}
.news-card:hover { border-color: var(--border-focus); transform: translateY(-1px); }
.news-card.is-cursor { outline: 2px solid var(--primary); outline-offset: 2px; }
.news-card.read .news-title { color: var(--text-tertiary); }
.news-card.read .news-thumb { filter: grayscale(0.7); opacity: 0.75; }
.news-card.is-arriving { animation: newsArrive 2.4s var(--ease-out); }
@keyframes newsArrive {
    0%, 30% { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
}

.news-thumb {
    flex-shrink: 0; width: 104px; height: 104px; border-radius: var(--radius-sm);
    object-fit: cover; background: var(--primary-glow);
}
.news-thumb-ph { display: flex; align-items: center; justify-content: center; }
.news-thumb-ph.tone-1 { background: linear-gradient(135deg, rgba(80, 210, 193, 0.35), rgba(80, 210, 193, 0.06)); }
.news-thumb-ph.tone-2 { background: linear-gradient(135deg, rgba(255, 180, 84, 0.32), rgba(255, 180, 84, 0.05)); }
.news-thumb-ph.tone-3 { background: linear-gradient(135deg, rgba(129, 140, 248, 0.32), rgba(129, 140, 248, 0.05)); }
.news-thumb-ph .ph-fav-img { width: 34px; height: 34px; border-radius: 7px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }
.news-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.news-meta { display: flex; align-items: center; gap: 0.5rem; font-size: 0.76rem; min-width: 0; }
.news-favicon { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; }
.news-source { color: var(--primary-text); font-weight: 600; }
.news-time { color: var(--text-muted); margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.news-card h2, .news-card h3 { margin: 0; font: inherit; }
.news-title {
    overflow-wrap: anywhere;
    color: var(--text-primary); font-weight: 600; font-size: 1.04rem; line-height: 1.38;
    text-decoration: none; text-wrap: pretty;
}
.news-title:hover { color: var(--primary-text); }
.news-title:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }
.news-title mark, .news-snippet mark { background: var(--primary-glow); color: var(--text-primary); border-radius: 2px; padding: 0 1px; }
.news-snippet {
    margin: 0; color: var(--text-secondary); font-size: 0.86rem; line-height: 1.55; max-width: 68ch;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; margin-top: 0.2rem; }
.news-tag { padding: 0.22rem 0.6rem; font-size: 0.72rem; font-weight: 600; min-height: 1.75rem; }
.news-react { font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace; font-variant-numeric: tabular-nums; }
.news-tag.has-react .news-react { margin-left: 0.4rem; }
.news-tag.up { color: var(--success-text); background: var(--success-bg); border-color: transparent; }
.news-tag.down { color: var(--danger-text); background: var(--danger-bg); border-color: transparent; }
.news-tag.flat .news-react { color: var(--text-muted); }
.news-tag.up:hover, .news-tag.down:hover { border-color: currentColor; color: inherit; }
.news-tag.up:hover { color: var(--success-text); }
.news-tag.down:hover { color: var(--danger-text); }
.news-lean { font-size: 0.72rem; font-weight: 600; margin-right: 0.3rem; }
.news-lean.lean-bullish { color: var(--success-text); }
.news-lean.lean-bearish { color: var(--danger-text); }

.news-badge {
    font-size: 0.68rem; font-weight: 700; color: var(--success-text);
    background: var(--success-bg); border-radius: 999px; padding: 0.1rem 0.5rem;
    white-space: nowrap;
}
.news-badge-new { color: var(--accent); background: rgba(255, 180, 84, 0.14); }
[data-theme="light"] .news-badge-new { color: #9a5b00; }

@media (max-width: 640px) {
    .news-card { gap: 0.85rem; padding: 0.85rem; }
    .news-thumb { width: 76px; height: 76px; }
    .news-thumb-ph .ph-fav-img { width: 26px; height: 26px; }
    .news-meta { flex-wrap: wrap; row-gap: 0.15rem; }
    .news-snippet { display: none; }
}

/* Lead story: image beside the text on wide screens, stacked on narrow. */
.news-hero {
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.5rem;
    padding: 1.1rem; margin-bottom: 1.25rem;
}
.news-hero-thumb { width: 100%; height: 100%; min-height: 260px; max-height: 340px; border-radius: var(--radius-md); }
.news-hero .news-body { justify-content: center; gap: 0.65rem; padding: 0.5rem 0.5rem 0.5rem 0; }
.news-hero-title {
    font-family: var(--font-heading); font-weight: 600; font-size: clamp(1.35rem, 1rem + 1vw, 1.85rem);
    line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance;
}
.news-hero .news-snippet { -webkit-line-clamp: 4; line-clamp: 4; font-size: 0.95rem; display: -webkit-box; }
@media (max-width: 860px) {
    .news-hero { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .news-hero-thumb { min-height: 0; aspect-ratio: 16 / 9; height: auto; max-height: none; }
    .news-hero .news-body { padding: 0; }
}

/* Compact mode: one line of meta + title per story. */
.news-main.compact .news-card, .news-main.compact .news-hero {
    display: flex; padding: 0.6rem 0.85rem; gap: 0.75rem; margin-bottom: 0;
}
.news-main.compact .news-hero { margin-bottom: 0.75rem; }
.news-main.compact .news-thumb { width: 44px; height: 44px; min-height: 0; aspect-ratio: auto; }
.news-main.compact .news-snippet,
.news-main.compact .news-lean { display: none; }
.news-main.compact .news-title, .news-main.compact .news-hero-title { font-family: inherit; font-size: 0.93rem; line-height: 1.3; letter-spacing: 0; }
.news-main.compact .news-feed { gap: 0.45rem; }
.news-main.compact .news-body { gap: 0.25rem; padding: 0; }

.news-day-header {
    margin: 1rem 0 0; padding-bottom: 0.4rem;
    font-family: var(--font-heading); font-size: 1.05rem; font-weight: 600; color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
}
.news-day-header:first-child { margin-top: 0; }
.news-day-header.today { color: var(--text-primary); }

.news-caught-up {
    display: flex; align-items: center; gap: 0.9rem; margin: 0.75rem 0;
    font-size: 0.8rem; font-weight: 600; color: var(--primary-text);
}
.news-caught-up::before, .news-caught-up::after { content: ''; flex: 1; height: 1px; background: var(--border-focus); }

.news-empty { text-align: center; padding: 3rem 1rem; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 0.9rem; }
.news-empty p { margin: 0; }
.news-more { display: flex; justify-content: center; gap: 0.75rem; margin-top: 1.5rem; }
.news-more .news-chip { padding: 0.65rem 1.5rem; font-size: 0.84rem; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.news-side { display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 1024px) {
    .news-side { position: sticky; top: calc(var(--lyx-nav-h) + var(--lyx-nav-top) + 5.5rem); }
}
.news-movers, .news-side-card {
    padding: 1.1rem 1.15rem; border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg); background: var(--bg-card);
}
.news-movers h2, .news-side-card h2 {
    margin: 0; font-family: var(--font-heading); font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em;
}
.news-side-sub { margin: 0.25rem 0 0.8rem; font-size: 0.78rem; color: var(--text-muted); }
.news-movers-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.news-movers-list li + li { border-top: 1px solid var(--border-subtle); }
.news-mover {
    display: grid; grid-template-columns: 4.1rem minmax(0, 1fr); gap: 0.75rem; align-items: start;
    padding: 0.65rem 0.4rem; margin: 0 -0.4rem; border-radius: var(--radius-sm);
    text-decoration: none; color: inherit;
}
.news-mover:hover { background: var(--primary-glow); }
.news-mover:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.news-mover-move { display: flex; flex-direction: column; font-size: 0.7rem; font-weight: 600; color: var(--text-muted); }
.news-mover-move b {
    font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace; font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}
.news-mover-move.up b { color: var(--success-text); }
.news-mover-move.down b { color: var(--danger-text); }
.news-mover-text { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.news-mover-title {
    font-size: 0.84rem; line-height: 1.35; color: var(--text-primary); font-weight: 500;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-mover-meta { font-size: 0.72rem; color: var(--text-muted); }
.news-movers-empty { padding: 0.5rem 0; font-size: 0.82rem; color: var(--text-muted); }
.news-side-note { margin: 0.8rem 0 0; font-size: 0.72rem; line-height: 1.5; color: var(--text-muted); }
.news-skeleton-row {
    height: 3.2rem; margin: 0.35rem 0; border-radius: var(--radius-sm);
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--border-subtle) 50%, var(--bg-card) 75%);
    background-size: 200% 100%; animation: newsShimmer 1.4s ease infinite;
}
.news-movers-list li.news-skeleton-row + li { border-top: 0; }
.news-side-card p { margin: 0.45rem 0 0.9rem; font-size: 0.84rem; line-height: 1.55; color: var(--text-secondary); }
.news-side-cta {
    display: inline-flex; align-items: center; min-height: 2.5rem; padding: 0 1rem;
    border-radius: var(--radius-sm); background: var(--primary); color: #04302b;
    font-size: 0.86rem; font-weight: 700; text-decoration: none; transition: filter 0.15s;
}
.news-side-cta:hover { filter: brightness(1.08); }
.news-side-cta:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.news-explainer { margin-top: 3.5rem; }

/* ── Floating: new-stories pill + back-to-top ───────────────────────────── */
.news-pill {
    position: fixed; top: 6rem; left: 50%; transform: translateX(-50%); z-index: 30;
    background: var(--primary); color: #04302b; border: none; border-radius: 999px;
    padding: 0.6rem 1.25rem; font-weight: 700; font-size: 0.86rem; cursor: pointer;
    box-shadow: var(--shadow-hover); animation: newsPillIn 0.4s var(--ease-out);
}
@keyframes newsPillIn { from { opacity: 0; transform: translate(-50%, -8px); } }
.news-back-top {
    /* Sits left of .theme-toggle-fixed (right:1.25rem, 2.5rem wide) so the two
       never overlap. While the consent bar is up this hides instead; see the
       body.lyx-consent-visible set in the chrome-suppression block above. */
    position: fixed; bottom: 16px; right: 72px; z-index: 30;
    width: 2.75rem; height: 2.75rem; align-items: center; justify-content: center;
    background: var(--bg-card); color: var(--text-secondary); border: 1px solid var(--border-subtle);
    border-radius: 50%; cursor: pointer; box-shadow: var(--shadow-hover); transition: 0.15s;
}
/* display lives on :not([hidden]) so the hidden attribute still wins. */
.news-back-top:not([hidden]) { display: flex; }
.news-back-top:hover { color: var(--text-primary); border-color: var(--border-focus); }

/* ── Skeleton (Load-older network wait only) ─────────────────────────────── */
.news-skeleton-card {
    height: 104px; border-radius: var(--radius-md); border: 1px solid var(--border-subtle);
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--border-subtle) 50%, var(--bg-card) 75%);
    background-size: 200% 100%; animation: newsShimmer 1.4s ease infinite;
}
@keyframes newsShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.news-coin-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Content hubs: Learn / Guides card grid (shared by both hub pages) ───── */
.lyx-guide--hub{max-width:980px}
.guide-eyebrow{display:block;font-size:.75rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--text-tertiary);margin:0 0 .75rem}
.guide-eyebrow-start{color: var(--primary-text);margin-bottom:.6rem}
.guide-ico{width:42px;height:42px;border-radius:var(--radius-md);background:rgba(80,210,193,.12);display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:transform .2s,background .2s}
.guide-ico-lg{width:52px;height:52px}
.guide-card:hover .guide-ico,.guide-featured:hover .guide-ico{transform:scale(1.08);background:rgba(80,210,193,.2)}
.lyx-guide a.guide-card,.lyx-guide a.guide-featured{text-decoration:none}
.guide-featured{display:flex;align-items:flex-start;gap:1.25rem;background:rgba(80,210,193,.07);border:1px solid var(--border-focus);border-radius:var(--radius-xl);padding:1.75rem 2rem;text-decoration:none;transition:border-color .2s,transform .2s;margin-top:.5rem}
.guide-featured:hover{border-color:var(--primary);transform:translateY(-2px)}
.guide-featured h2{font-family:var(--font-heading);font-size:1.3rem;color:var(--text-primary);margin:0 0 .6rem;letter-spacing:-.01em}
.guide-featured p{font-size:.92rem;color:var(--text-secondary);margin:0 0 .9rem;line-height:1.6}
@media(max-width:640px){.guide-featured{flex-direction:column;padding:1.5rem}}
.guides-section{margin-top:2.75rem}
.guides-section.content-hub-hidden{display:none}
.guides-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:1.1rem;margin-top:1rem}
@media(max-width:900px){.guides-grid{grid-template-columns:1fr 1fr}}
@media(max-width:640px){.guides-grid{grid-template-columns:1fr}}
.guide-card{display:block;background:rgba(80,210,193,.04);border:1px solid var(--border-subtle);border-radius:16px;padding:1.4rem 1.5rem;text-decoration:none;transition:border-color .2s,transform .2s}
.guide-card:hover{border-color:var(--border-focus);transform:translateY(-2px)}
.guide-card.content-hub-hidden{display:none}
.guide-card .guide-ico{margin-bottom:.9rem}
.guide-card h2{font-family:var(--font-heading);font-size:1.05rem;color:var(--text-primary);margin:0 0 .55rem;letter-spacing:-.01em}
.guide-card p{font-size:.88rem;color:var(--text-secondary);margin:0 0 .8rem;line-height:1.6}
.guide-card-more{font-size:.82rem;color: var(--primary-text);font-weight:600}
.guide-card-time{color:var(--text-tertiary);font-weight:500}

/* ── Content hubs: search + tag filter bar ────────────────────────────────── */
.content-hub-filters{margin:1.75rem 0 0;display:flex;flex-direction:column;gap:.75rem}
.content-hub-search{position:relative;max-width:420px}
.content-hub-search svg{position:absolute;left:.75rem;top:50%;transform:translateY(-50%);color:var(--text-tertiary);pointer-events:none}
.content-hub-search input{padding-left:2.25rem}
.content-hub-empty{display:none;padding:2.5rem 0;text-align:center;color:var(--text-secondary)}
.content-hub-empty.visible{display:block}

/* ── Tools hub: calculator pages (/tools/*) ───────────────────────────────── */
/* Scoped under .tool-calc so these never collide with the page-local <style>
   block in public_calculator.html, which defines similarly-named classes. */
.lyx-tool .lyx-guide-hd{margin-bottom:1.5rem}
.tool-calc{background:rgba(80,210,193,.04);border:1px solid var(--border-subtle);border-radius:16px;padding:1.5rem}
.tool-calc .card-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:1.25rem}
.tool-calc .card-header h3{font-family:var(--font-heading);font-size:1rem;margin:0;color:var(--text-primary)}
.tool-calc .input-wrapper{display:flex;flex-direction:column;gap:.4rem}
.tool-calc .mb-16{margin-bottom:1rem}
.tool-calc .two-col{display:grid;grid-template-columns:1fr 1fr;gap:1rem}
.tool-calc .three-col{display:grid;grid-template-columns:repeat(3,1fr);gap:1rem}
@media(max-width:640px){.tool-calc .two-col,.tool-calc .three-col{grid-template-columns:1fr}}
.tool-calc .field-label{font-size:.68rem;letter-spacing:.08em;text-transform:uppercase;color:var(--text-tertiary);font-weight:600}
.tool-calc .field-opt{text-transform:none;letter-spacing:0;font-weight:400;opacity:.7}
.tool-calc .field-hint{font-size:.78rem;color:var(--text-tertiary);margin:.5rem 0 0;line-height:1.5}
/* .input-icon-wrapper / .i-prefix / .i-suffix already exist above as a flex
   row — do NOT re-declare them here. An earlier version absolutely positioned
   the prefix, which overlapped the input text. Only the select (not covered by
   that system) and the derived-field state need rules of their own. */
.tool-calc .i-prefix + input{padding-left:.35rem}
.tool-calc select{width:100%;background:rgba(0,0,0,.18);border:1px solid var(--border-subtle);border-radius:var(--radius-md);color:var(--text-primary);font-family:'JetBrains Mono',monospace;font-size:.88rem;padding:.6rem .7rem;transition:border-color .18s}
.tool-calc select:focus{outline:none;border-color:var(--border-focus);box-shadow:0 0 0 3px rgba(80,210,193,.1)}
.tool-calc .input-icon-wrapper input.is-derived{color: var(--primary-text)}
.tool-calc .input-icon-wrapper:has(input.is-derived){background:rgba(80,210,193,.08);border-color:var(--primary)}
.tool-calc .direction-toggle{display:grid;grid-template-columns:1fr 1fr;gap:.5rem}
.tool-calc .dir-btn{padding:.6rem;border-radius:var(--radius-md);border:1px solid var(--border-subtle);background:rgba(0,0,0,.2);color:var(--text-tertiary);font-weight:700;font-size:.8rem;letter-spacing:.06em;cursor:pointer;transition:all .18s;font-family:inherit}
.tool-calc .dir-btn.dir-long.active{background:rgba(16,185,129,.16);border-color:var(--success);color: var(--success-text)}
.tool-calc .dir-btn.dir-short.active{background:rgba(244,63,94,.16);border-color:var(--danger);color: var(--danger-text)}
.tool-calc .slider-wrap{margin-top:.6rem}
.tool-calc .lev-slider{width:100%;accent-color:var(--primary)}
.tool-calc .slider-ticks{display:flex;justify-content:space-between;font-size:.68rem;color:var(--text-tertiary);margin-top:.2rem;font-family:'JetBrains Mono',monospace}
.tool-calc .seg-row{display:flex;gap:.4rem;background:rgba(0,0,0,.22);padding:.3rem;border-radius:var(--radius-md);border:1px solid var(--border-subtle)}
.tool-calc .seg-btn{flex:1;padding:.5rem;border:none;background:none;color:var(--text-tertiary);font-size:.82rem;font-weight:600;border-radius:8px;cursor:pointer;transition:all .18s;font-family:inherit}
.tool-calc .seg-btn.active{background:rgba(80,210,193,.16);color: var(--primary-text)}
.tool-calc .res-grid{display:grid;gap:.75rem;margin-top:1.25rem}
.tool-calc .res-grid.grid-3{grid-template-columns:repeat(3,1fr)}
@media(max-width:640px){.tool-calc .res-grid.grid-3{grid-template-columns:1fr}}
.tool-calc .res-card{background:rgba(0,0,0,.22);border:1px solid var(--border-subtle);border-radius:var(--radius-md);padding:.85rem 1rem}
.tool-calc .res-card.res-primary{border-color:var(--primary);background:rgba(80,210,193,.08)}
.tool-calc .res-card.res-danger{border-color:rgba(244,63,94,.35)}
.tool-calc .res-label{font-size:.7rem;text-transform:uppercase;letter-spacing:.07em;color:var(--text-tertiary);font-weight:600}
.tool-calc .res-val{font-family:'JetBrains Mono',monospace;font-size:1.25rem;font-weight:700;color:var(--text-primary);margin-top:.3rem;letter-spacing:-.02em}
.tool-calc .info-box{background:rgba(0,0,0,.18);border:1px solid var(--border-subtle);border-radius:var(--radius-md);padding:.35rem .9rem}
.tool-calc .info-row{display:flex;justify-content:space-between;align-items:center;gap:1rem;padding:.5rem 0;font-size:.85rem;color:var(--text-secondary);border-bottom:1px solid var(--border-subtle)}
.tool-calc .info-row:last-child{border-bottom:none}
.tool-calc .mono-val{font-family:'JetBrains Mono',monospace;color:var(--text-primary);font-weight:600}
.tool-calc .avg-rows{display:flex;flex-direction:column;gap:.6rem}
.tool-calc .avg-row{display:grid;grid-template-columns:1.5rem minmax(0,1fr) minmax(0,1fr);gap:.75rem;align-items:end}
/* An <input> has an intrinsic ~20ch width; inside a 1fr track or a flex row
   that becomes its minimum and pushes the row off a phone screen. */
.input-icon-wrapper input, .input-wrapper input, .form-input { min-width: 0; }
.tool-calc .avg-row-n{font-family:'JetBrains Mono',monospace;color:var(--text-tertiary);font-size:.8rem;padding-bottom:.65rem}
.tool-calc .avg-hero{text-align:center;margin:1.5rem 0 .5rem}
.tool-calc .avg-giga{font-size:2.6rem;font-weight:800;font-family:'JetBrains Mono',monospace;letter-spacing:-.04em;line-height:1.1;color: var(--primary-text);margin:.4rem 0 0}
.tool-calc .calc-note{margin-top:1.25rem;padding-top:1.1rem;border-top:1px solid var(--border-subtle)}
.tool-warn,.tool-verdict{margin:1rem 0 0;padding:.7rem .9rem;border-radius:var(--radius-md);font-size:.85rem;line-height:1.55;border:1px solid transparent}
.tool-warn{background:rgba(244,63,94,.1);border-color:rgba(244,63,94,.35);color: var(--danger-text)}
.tool-verdict.verdict-good{background:rgba(16,185,129,.1);border-color:rgba(16,185,129,.32);color: var(--success-text)}
.tool-verdict.verdict-bad{background:rgba(255,180,84,.1);border-color:rgba(255,180,84,.32);color:var(--accent)}

/* Explainer prose shared by tool pages and the funding comparison */
.tool-explainer{margin-top:2.5rem;max-width:75ch}
.tool-explainer h2{font-family:var(--font-heading);font-size:1.4rem;color:var(--text-primary);margin:2rem 0 .8rem;letter-spacing:-.01em}
.tool-explainer h3{font-family:var(--font-heading);font-size:1.08rem;color:var(--text-primary);margin:1.75rem 0 .6rem}
.tool-explainer p{font-size:.94rem;line-height:1.75;color:var(--text-secondary);margin:0 0 1rem}
.tool-explainer a{color: var(--primary-text);text-decoration:underline;text-underline-offset:2px}
.tool-formula{background:rgba(0,0,0,.28);border:1px solid var(--border-subtle);border-radius:var(--radius-md);padding:1rem 1.15rem;overflow-x:auto;margin:0 0 1.25rem}
.tool-formula code{font-family:'JetBrains Mono',monospace;font-size:.84rem;line-height:1.8;color:var(--text-primary);white-space:pre}
.tool-list{margin:0 0 1.25rem;padding-left:1.15rem;color:var(--text-secondary)}
.tool-list li{font-size:.92rem;line-height:1.75;margin-bottom:.4rem}
.tool-table{width:100%;border-collapse:collapse;margin:0 0 1.5rem;font-size:.88rem;display:block;overflow-x:auto}
.tool-table th{text-align:left;padding:.6rem .75rem;border-bottom:1px solid var(--border-focus);color:var(--text-tertiary);font-size:.72rem;text-transform:uppercase;letter-spacing:.06em;white-space:nowrap}
.tool-table td{padding:.6rem .75rem;border-bottom:1px solid var(--border-subtle);color:var(--text-secondary)}
.tool-table tr:last-child td{border-bottom:none}

/* FAQ accordions (tools, coin pages) */
.tool-faq,.coin-faq{margin-top:2.5rem;max-width:75ch}
.tool-faq h2,.coin-faq h2{font-family:var(--font-heading);font-size:1.4rem;color:var(--text-primary);margin:0 0 1rem;letter-spacing:-.01em}
.tool-faq-item{border:1px solid var(--border-subtle);border-radius:var(--radius-md);margin-bottom:.6rem;background:rgba(80,210,193,.03)}
.tool-faq-item summary{padding:.9rem 1.1rem;cursor:pointer;font-weight:600;font-size:.92rem;color:var(--text-primary);list-style:none;display:flex;justify-content:space-between;gap:1rem;align-items:center}
.tool-faq-item summary::-webkit-details-marker{display:none}
.tool-faq-item summary::after{content:"+";color: var(--primary-text);font-size:1.15rem;font-weight:400;flex-shrink:0}
.tool-faq-item[open] summary::after{content:"\2212"}
.tool-faq-item p{padding:0 1.1rem 1rem;margin:0;font-size:.9rem;line-height:1.7;color:var(--text-secondary)}
.tool-faq-item a{color: var(--primary-text);text-decoration:underline;text-underline-offset:2px}
.tool-related{margin-top:2.75rem}
.tool-related h2{font-family:var(--font-heading);font-size:1.4rem;color:var(--text-primary);margin:0 0 .5rem;letter-spacing:-.01em}

/* ── Share row ────────────────────────────────────────────────────────────── */
.lyx-share{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;margin:2.25rem 0 0;padding-top:1.25rem;border-top:1px solid var(--border-subtle)}
.lyx-share-label{font-size:.72rem;text-transform:uppercase;letter-spacing:.08em;color:var(--text-tertiary);font-weight:600}
.lyx-share-btn{display:inline-flex;align-items:center;gap:.45rem;padding:.45rem .85rem;border-radius:999px;border:1px solid var(--border-subtle);background:rgba(80,210,193,.05);color:var(--text-secondary);font-size:.82rem;font-weight:600;text-decoration:none;cursor:pointer;font-family:inherit;transition:border-color .2s,color .2s}
.lyx-share-btn:hover{border-color:var(--primary);color: var(--primary-text)}
.lyx-share-btn:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
/* flex-basis:100% breaks the QR onto its own line inside the wrapping row,
   so opening it never reflows the buttons beside it. */
.lyx-share-qrbox{flex:0 0 100%;margin-top:.25rem;font-size:.8rem;color:var(--text-tertiary)}
.lyx-share-qrbox[hidden]{display:none}
/* White plate, black modules — a QR needs its quiet zone to be light, and the
   page around it is not. */
.lyx-share-qrbox img{display:block;background:#fff;padding:8px;border-radius:8px}

/* ── Glossary term pages ──────────────────────────────────────────────────── */
.lyx-glossary-term .lyx-guide-hd{margin-bottom:1.5rem}
.glossary-tldr{font-size:1.12rem;line-height:1.65;color:var(--text-secondary);font-weight:400;margin:.85rem 0 0;max-width:62ch}
.glossary-body{max-width:72ch}
.glossary-body p{font-size:.96rem;line-height:1.8;color:var(--text-secondary);margin:0 0 1.15rem}
.glossary-body a{color: var(--primary-text);text-decoration:underline;text-underline-offset:2px}
.glossary-related{margin-top:2.5rem}
.glossary-related h2{font-family:var(--font-heading);font-size:1.25rem;color:var(--text-primary);margin:0 0 1rem}
.glossary-related-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:.75rem}
@media(max-width:640px){.glossary-related-grid{grid-template-columns:1fr}}
.glossary-related-card{display:flex;flex-direction:column;gap:.3rem;padding:.9rem 1.1rem;border:1px solid var(--border-subtle);border-radius:var(--radius-md);background:rgba(80,210,193,.04);text-decoration:none;transition:border-color .2s,transform .2s}
.glossary-related-card:hover{border-color:var(--primary);transform:translateY(-2px)}
.glossary-related-card strong{color:var(--text-primary);font-size:.92rem}
.glossary-related-card span{color:var(--text-secondary);font-size:.82rem;line-height:1.55}
.glossary-back{margin-top:2rem;font-size:.88rem;color:var(--text-secondary)}
.glossary-back a{color: var(--primary-text);text-decoration:underline;text-underline-offset:2px}

/* Glossary hub: the deep-dive index that links every term page */
.glossary-deep{margin:1.5rem 0 2.5rem;padding:1.5rem;border:1px solid var(--border-focus);border-radius:16px;background:rgba(80,210,193,.05)}
.glossary-deep h2{margin-top:0}
.glossary-deep-intro{font-size:.92rem;color:var(--text-secondary);line-height:1.7;margin:0 0 1.25rem}
.glossary-deep-cat{font-size:.72rem;text-transform:uppercase;letter-spacing:.08em;color: var(--primary-text);font-weight:700;margin:1.5rem 0 .7rem}
.glossary-deep-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:.65rem}
@media(max-width:760px){.glossary-deep-grid{grid-template-columns:1fr}}
.glossary-deep-card{display:flex;flex-direction:column;gap:.25rem;padding:.75rem .95rem;border:1px solid var(--border-subtle);border-radius:var(--radius-md);background:rgba(0,0,0,.15);text-decoration:none;transition:border-color .2s}
.glossary-deep-card:hover{border-color:var(--primary)}
.glossary-deep-card strong{color:var(--text-primary);font-size:.88rem}
.glossary-deep-card span{color:var(--text-tertiary);font-size:.79rem;line-height:1.5}

/* ── Coin page: funding history block ─────────────────────────────────────── */
.coin-stat-row{display:grid;grid-template-columns:repeat(5,1fr);gap:.75rem}
@media(max-width:900px){.coin-stat-row{grid-template-columns:repeat(2,1fr)}}
.coin-stat{background:rgba(0,0,0,.2);border:1px solid var(--border-subtle);border-radius:var(--radius-md);padding:.75rem .9rem;display:flex;flex-direction:column;gap:.3rem}
.coin-stat-label{font-size:.68rem;text-transform:uppercase;letter-spacing:.06em;color:var(--text-tertiary);font-weight:600}
.coin-stat-val{font-size:1.05rem;font-weight:700;color:var(--text-primary)}
.coin-funding-prose{margin:1.25rem 0 0;font-size:.92rem;line-height:1.75;color:var(--text-secondary);max-width:80ch}
.coin-funding-prose a{color: var(--primary-text);text-decoration:underline;text-underline-offset:2px}

/* ── Funding comparison page ──────────────────────────────────────────────── */
.compare-lede{font-size:.94rem;line-height:1.75;color:var(--text-secondary);max-width:80ch;margin:0 0 1.25rem}
.compare-warn{margin:0 0 1.25rem;padding:.7rem .9rem;border-radius:var(--radius-md);font-size:.86rem;line-height:1.6;background:rgba(255,180,84,.1);border:1px solid rgba(255,180,84,.32);color:var(--accent)}

/* ══════════════════════════════════════════════════════════════════════════
   PAGE — Money Flow (/<wallet>/flow)
   ══════════════════════════════════════════════════════════════════════════ */

/* Chain identity colours. Defined at :root (not on .flow-page) because the
   graph reads them from getComputedStyle(documentElement) so the canvas can
   follow the theme toggle instead of hardcoding a second palette. */
/* One colour per chain in evm.CHAINS, plus 'hl'. Keep these in sync with that
   dict — a chain with no variable here falls back to --border-subtle and its
   edges become indistinguishable from every other chain's. */
:root {
    --flow-chain-hl:    #50d2c1;  /* Hyperliquid */
    --flow-chain-1:     #8a92b2;  /* Ethereum */
    --flow-chain-42161: #28a0f0;  /* Arbitrum */
    /* Lime, not HyperEVM's brand mint: mint sits a few degrees from the
       Hyperliquid teal above and the two edge colours were indistinguishable
       on screen, which is the one job a chain colour has. */
    --flow-chain-999:   #a3e635;  /* HyperEVM */
    --flow-chain-137:   #8247e5;  /* Polygon */
}

.flow-toolbar {
    display: flex; flex-wrap: wrap; gap: .75rem;
    align-items: center; justify-content: space-between;
    margin-bottom: 1rem;
}
.flow-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.flow-actions { display: flex; gap: .4rem; }

.flow-chip {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .32rem .7rem; border-radius: var(--radius-pill);
    border: 1px solid var(--border-subtle); background: transparent;
    color: var(--text-tertiary); font-size: .8rem; font-family: inherit;
    cursor: pointer; transition: color var(--dur-fast) var(--ease-out),
                                 border-color var(--dur-fast) var(--ease-out);
}
.flow-chip:hover { border-color: var(--border-focus); color: var(--text-secondary); }
.flow-chip.is-on { color: var(--text-primary); border-color: var(--border-focus); }
/* Off state reads as "filtered out" rather than "disabled": the dot drains of
   colour, which is the same signal as the edges vanishing from the canvas. */
.flow-chip:not(.is-on) .flow-chip-dot { background: var(--text-tertiary) !important; opacity: .35; }
.flow-chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.flow-notice {
    margin: 0 0 1rem; padding: .7rem .9rem; border-radius: var(--radius-md);
    font-size: .86rem; line-height: 1.6;
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}
.flow-notice code { font-size: .82em; color: var(--primary-text); }
.flow-notice--warn {
    background: rgba(255, 180, 84, .1);
    border-color: rgba(255, 180, 84, .32);
    color: var(--accent);
}

/* Wallet shell: related articles under each dashboard page (_page_reads.html). */
.page-reads { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border-subtle); }
.page-reads-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-reads-title { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.page-reads-all { font-size: .82rem; font-weight: 600; color: var(--primary-text); text-decoration: none; }
.page-reads-all:hover { text-decoration: underline; }
.page-reads-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.page-read {
    display: flex; flex-direction: column; gap: .35rem; padding: 1rem 1.1rem;
    border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: transparent;
    text-decoration: none; color: inherit;
    transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.page-read:hover { border-color: var(--border-focus); background: var(--bg-card); }
.page-read:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.page-read-kind { font-size: .72rem; font-weight: 600; color: var(--primary-text); }
.page-read-title { font-weight: 600; font-size: .95rem; color: var(--text-primary); line-height: 1.35; text-wrap: balance; }
.page-read-desc {
    font-size: .8rem; color: var(--text-secondary); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Group page: "Show all N markets" under the capped positions table. */
.grp-pos-more {
    display: block; width: 100%; padding: .85rem 1rem; font: inherit; font-size: .82rem; font-weight: 600;
    color: var(--primary-text); background: none; border: 0; border-top: 1px solid var(--border-subtle); cursor: pointer;
}
.grp-pos-more:hover { background: var(--bg-card-hover); }
.grp-pos-more:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
.grp-pos-more[hidden] { display: none; }

.flow-sum-note { font-size: .78rem; color: var(--text-tertiary); max-width: 72ch; margin: 0; }
.flow-graph-head { margin: 2.25rem 0 1rem; padding-top: 1.75rem; border-top: 1px solid var(--border-subtle); }
.flow-graph-head.is-first { margin-top: 0; padding-top: 0; border-top: 0; }
.flow-graph-title { font-family: var(--font-heading); font-size: 1.25rem; font-weight: 700; margin: 0 0 .2rem; color: var(--text-primary); }

.flow-layout { display: grid; grid-template-columns: 1fr 320px; gap: 1.25rem; align-items: start; }

.flow-canvas-panel { position: relative; padding: 0; overflow: hidden; }
/* Fixed height, not aspect-ratio: a force/concentric layout needs a stable box
   to fit into, and a reflowing container makes it re-fit on every resize tick. */
.flow-canvas { width: 100%; height: 620px; }

.flow-legend {
    position: absolute; left: .75rem; bottom: .75rem;
    display: flex; flex-wrap: wrap; gap: .1rem .8rem;
    padding: .45rem .65rem; border-radius: var(--radius-md);
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    backdrop-filter: var(--glass);
    font-size: .72rem; color: var(--text-tertiary); pointer-events: none;
}
.flow-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.flow-key { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.flow-hint {
    position: absolute; right: .75rem; top: .75rem;
    padding: .35rem .6rem; border-radius: var(--radius-md);
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    backdrop-filter: var(--glass);
    font-size: .72rem; color: var(--text-tertiary);
    max-width: 45%; pointer-events: none;
}
.flow-hint.is-warn { color: var(--accent); border-color: rgba(255, 180, 84, .32); }

.flow-detail { position: sticky; top: 1rem; max-height: 620px; overflow-y: auto; }
.flow-detail-body { display: flex; flex-direction: column; gap: .9rem; }

.flow-badge {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .04em;
    padding: .15rem .45rem; border-radius: var(--radius-sm);
    background: var(--bg-card-hover); color: var(--text-tertiary);
}

.flow-addr { display: flex; align-items: center; gap: .5rem; }
.flow-addr code {
    flex: 1; min-width: 0; font-size: .72rem; color: var(--text-secondary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.flow-stats { display: flex; flex-direction: column; gap: .3rem; margin: 0; }
.flow-stat { display: flex; justify-content: space-between; gap: 1rem; font-size: .82rem; }
.flow-stat dt { color: var(--text-tertiary); }
.flow-stat dd { margin: 0; color: var(--text-primary); text-align: right; }

.flow-links { display: flex; flex-wrap: wrap; gap: .4rem; }

.flow-subhead {
    margin: .3rem 0 0; font-size: .72rem; text-transform: uppercase;
    letter-spacing: .05em; color: var(--text-tertiary); font-weight: 600;
}

.flow-edge-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.flow-edge-list li { padding-bottom: .55rem; border-bottom: 1px solid var(--border-subtle); }
.flow-edge-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.flow-edge-head { display: flex; align-items: center; gap: .4rem; font-size: .82rem; }
.flow-edge-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-dir { font-weight: 700; }
.flow-dir.is-out { color: var(--danger-text); }
.flow-dir.is-in  { color: var(--success-text); }

.flow-table-panel { margin-top: 1.25rem; }

/* Below the sidebar breakpoint the detail panel stops being a sidebar and
   becomes a block under the canvas — a 320px column next to a graph is
   unusable on a phone, and so is a 620px canvas. */
@media (max-width: 1024px) {
    .flow-layout { grid-template-columns: 1fr; }
    .flow-canvas { height: 420px; }
    .flow-detail { position: static; max-height: none; }
    .flow-legend { position: static; margin: .5rem; }
    .flow-hint { max-width: 60%; }
}

/* ── Money Flow: filters, trail ───────────────────────────────────────────── */

.flow-toolbar--filters {
    display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
    margin-bottom: 1rem; padding-top: .75rem;
    border-top: 1px solid var(--border-subtle);
}
.flow-field { display: flex; align-items: center; gap: .35rem; }
.flow-field > label {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-tertiary);
}
.flow-select, .flow-searchbox {
    padding: .3rem .5rem; font-size: .8rem; font-family: inherit;
    color: var(--text-primary); background: var(--bg-card);
    border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
}
.flow-select:focus, .flow-searchbox:focus { outline: none; border-color: var(--border-focus); }
.flow-searchbox { min-width: 150px; }
/* Push the trace button to the far end — it performs an action, unlike every
   other control on this row, which only narrows the view. */
.flow-trace-wrap { margin-left: auto; }
#flowTrace.is-running { border-color: var(--accent); color: var(--accent); }

/* Group tray — the wallets picked off the graph. Accent-tinted to match the
   .ingroup ring drawn on the canvas (cytoscape stylesheet in flow.js), so the
   chip here and the ringed node there read as the same thing. */
/* Two rows, and deliberately so. The tray held one row of short chips plus its
   buttons until the chips became the full .gedit editor — a three-row block of
   chips, input and help. Sitting beside that block, the buttons were centred
   against its whole height, which landed them a few pixels off the input they
   appeared to belong to: aligned to nothing, and reading as a mistake.
   So: row one is the tray's own header (label, then the graph-specific
   actions), row two is the editor. Nothing has to line up with anything inside
   a sibling, which is why it stays aligned as the editor's height changes.
   Order is set here rather than in the markup so the label keeps its natural
   first position in the DOM and for screen readers. */
.flow-tray {
    display: flex; flex-wrap: wrap; gap: .55rem .75rem; align-items: center;
    margin-bottom: 1rem; padding: .6rem .75rem;
    background: rgba(255, 180, 84, .06);
    border: 1px solid rgba(255, 180, 84, .28);
    border-radius: var(--radius-md);
}
.flow-tray-label {
    order: 1;
    font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--accent); font-weight: 600;
}
.flow-tray-actions {
    order: 2; margin-left: auto;
    display: flex; gap: .4rem; flex-wrap: wrap;
    /* stretch, not center: "Open combined →" is an <a> whose arrow glyph has a
       taller line box than the sibling <button> text, so it came out 3px taller
       and centring left every top edge 1-2px apart. Stretching makes the row
       equalise itself instead of depending on what glyphs are in the labels. */
    align-items: stretch;
}
/* The shared .gedit editor: chips, the address input and the empty state all
   come from there, so this only has to hand it a full row of its own. */
.flow-tray-chips { order: 3; flex: 1 1 100%; min-width: 0; }
/* One wallet is not a group — it already has a dashboard. Kept visible rather
   than hidden so the button's purpose is clear before you have enough members. */
.flow-tray-actions .is-disabled { opacity: .45; pointer-events: none; }

@media (max-width: 640px) {
    .flow-tray-actions { margin-left: 0; width: 100%; }
    /* Basis auto, not 0: `flex: 1` packed all four onto one row whatever the
       width, so each label wrapped to three lines and — now that the row
       stretches — every button grew to match the tallest. Sized to their own
       labels they wrap onto a second row instead and stay button-height. */
    .flow-tray-actions .btn { flex: 1 1 auto; }
}

/* ── Shared: label/value stat list ────────────────────────────────────────
   Paired with ui.stat_row() in components.html. Rows are separated by a
   hairline rather than boxed — a list of ten stats does not want ten cards. */
.stat-list { margin: 0; display: flex; flex-direction: column; }
.stat-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border-subtle);
}
.stat-list .stat-line:last-child { border-bottom: none; padding-bottom: 0; }
.stat-list .stat-line:first-child { padding-top: 0; }
.stat-line dt {
    color: var(--text-secondary);
    font-size: 0.82rem;
    min-width: 0;
}
.stat-line dd {
    margin: 0;
    font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace;
    font-size: 0.86rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    text-align: right;
    white-space: nowrap;
}
/* Qualifier under a stat value (a date, a unit). Body font, not mono — it is
   prose about the number, not another number. */
.stat-sub {
    display: block;
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-tertiary);
}

/* ── Group member editor (.gedit) ──────────────────────────────────────────
   One control, four mount points: the sidebar draft panel, the Money Flow tray,
   the /group builder and the member bar on /group/<addrs>. Chips are teal, not
   the tray's amber: amber marks "picked off the graph, not yet a group", while
   these are the group. .flow-tray keeps its amber frame around them, which is
   what still ties the tray to the .ingroup ring on the canvas. */
.gedit { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.gedit-head { display: flex; align-items: baseline; gap: 0.5rem; }
.gedit-label {
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-secondary); font-weight: 600;
}
.gedit-count {
    margin-left: auto;
    font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-tertiary);
}
.gedit-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; min-width: 0; }
.gedit-empty { font-size: 0.78rem; color: var(--text-tertiary); align-self: center; }

/* Two targets in one pill: the name opens an inline rename, the × removes.
   Split as separate buttons rather than one chip with a nested control, so both
   halves are reachable by keyboard and each carries its own accessible name. */
.gedit-chip {
    display: inline-flex; align-items: center;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    background: var(--bg-card);
    max-width: 100%;
    transition: border-color var(--dur-fast) var(--ease-out);
}
.gedit-chip:hover { border-color: var(--border-focus); }
.gedit-chip-name {
    /* 44px touch floor is met by the row, not the glyph: the chip is ~30px tall
       by design (a row of eight has to fit), so the pair below restores it. */
    padding: 0.3rem 0.15rem 0.3rem 0.65rem;
    max-width: 14rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    background: none; border: none; cursor: text;
    font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.gedit-chip-name:hover { color: var(--primary-text); }
.gedit-chip-x {
    display: grid; place-items: center;
    width: 1.6rem; height: 1.6rem; margin-right: 0.15rem;
    padding: 0; background: none; border: none; border-radius: 50%;
    color: var(--text-tertiary); cursor: pointer;
    transition: color var(--dur-fast) var(--ease-out),
                background var(--dur-fast) var(--ease-out);
}
.gedit-chip-x:hover { color: var(--danger-text); background: var(--danger-bg); }
.gedit-chip-name:focus-visible,
.gedit-chip-x:focus-visible {
    outline: 2px solid var(--border-focus); outline-offset: 1px; border-radius: var(--radius-sm);
}
/* Rename in place: same metrics as the name it replaced, so the chip does not
   jump when it opens. */
.gedit-chip-input {
    width: 9rem; margin: 0.15rem 0.15rem 0.15rem 0.4rem;
    padding: 0.15rem 0.4rem;
    background: var(--bg-app);
    border: 1px solid var(--border-focus); border-radius: var(--radius-sm);
    font-family: var(--font-body); font-size: 0.78rem;
    color: var(--text-primary);
}
.gedit-chip-input:focus { outline: none; }

.gedit-entry { display: flex; gap: 0.4rem; min-width: 0; }
/* Capped rather than fluid: the field holds one 42-character address, and a
   full-panel-width input makes the Add button drift half a screen away from it. */
.gedit-input { flex: 1; min-width: 0; max-width: 32rem; padding: 0.5rem 0.7rem; font-size: 0.82rem; }
.gedit-add { flex-shrink: 0; }
.gedit-input:disabled, .gedit-add:disabled { opacity: 0.5; cursor: not-allowed; }
.gedit-help { font-size: 0.72rem; color: var(--text-tertiary); }
.gedit.is-full .gedit-help { color: var(--accent-ink); }
.gedit-error { font-size: 0.75rem; color: var(--danger-text); }

/* Sidebar and tray density: the label row is dropped by the caller, and the
   input has to survive a 260px column. The entry wraps rather than shrinks —
   squeezed onto one row in the sidebar the field showed about four characters
   of a forty-two character address, which is worse than no field at all. Wide
   mounts like the flow tray still get both on one line. */
.gedit-compact .gedit-chip-name { max-width: 9rem; font-size: 0.74rem; }
.gedit-compact .gedit-entry { flex-wrap: wrap; }
/* max-width is dropped here on purpose. Compact mounts span whatever their host
   gives them, and with the cap left on, a wide host (the flow tray) capped the
   input and handed every remaining pixel to Add — which then ran half the row.
   The input absorbs the slack; Add stays the size of its own label. */
.gedit-compact .gedit-input {
    flex: 1 1 12rem; max-width: none;
    padding: 0.4rem 0.55rem; font-size: 0.78rem;
}
.gedit-compact .gedit-add { flex: 0 0 auto; }
.gedit-compact .gedit-help { font-size: 0.68rem; }
/* The sidebar column is never wide enough to hold both on one line, so Add
   always lands on its own row — where content width would look stranded. */
.nav-subpanel .gedit-add { flex: 1 1 100%; }

@media (max-width: 520px) {
    /* The Add button below the field rather than beside it — at this width a
       42-character address in a shrunken input is unreadable. */
    .gedit-entry { flex-wrap: wrap; }
    .gedit-entry .gedit-add { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .gedit-chip, .gedit-chip-x, .gedit-chip-name { transition: none; }
}

/* Screen-reader-only live region. Used by the editor to announce adds, removes
   and renames — none of which move focus, so without this they are silent. */
.sr-only {
    position: absolute; width: 1px; height: 1px;
    margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ── Group pages: density ──────────────────────────────────────────────────
   Scoped to .grp-dense rather than retuned on .panel / .kpi-card, because
   those are shared by forty-odd templates and this page is the only one
   asking to be tighter. Roughly a fifth off the vertical rhythm.

   The floors do not move: body text stays on its own size, and the editor's
   controls keep their 44px touch target. Density is about the space between
   things, not about shrinking the things. */
.grp-dense .panel { margin-bottom: 0.9rem; }
.grp-dense .panel-header { padding: 0.7rem 0.9rem; }
.grp-dense .panel-body { padding: 0.9rem; }
.grp-dense .panel-body.flush { padding: 0; }
.grp-dense .panel-footer { padding: 0.5rem 0.9rem; }
.grp-dense .panel-grid { gap: 0.9rem; margin-bottom: 0.9rem; }
.grp-dense .kpi-grid { gap: 0.7rem; margin-bottom: 0.9rem; }
.grp-dense .kpi-card { padding: 0.8rem 0.9rem; }
.grp-dense .kpi-value { font-size: 1.5rem; }
.grp-dense .dash-headline { gap: 0.9rem; margin-bottom: 0.9rem; }
.grp-dense .dash-hero { padding: 0.9rem 1rem; }
.grp-dense .dash-hero-value { font-size: 2rem; }
/* The one measurement density must NOT take: .grp-section's 5rem puts the h1
   at 80px, and the fixed pill nav's bottom edge is at 82px — the title was
   touching it. Everything else on the page got tighter; this got looser.

   Both classes, not just .grp-dense: they have equal specificity and
   .grp-section is declared further down this file, so a single class here
   loses on source order and the padding silently stayed at 5rem. */
.grp-section.grp-dense { padding-top: 6.5rem; }
.grp-dense .page-header { margin-bottom: 0.9rem; }
.grp-dense .page-title { font-size: 1.6rem; }
.grp-dense .data-table th,
.grp-dense .data-table td { padding: 0.5rem 0.7rem; }
.grp-dense .stat-line { padding: 0.42rem 0; }
.grp-dense .grp-memberbar { padding: 0.75rem 0.9rem; margin-bottom: 0.9rem; }

/* Anchors have to clear BOTH fixed layers: the pill nav and this page's own
   sticky tab bar sitting on top of it.

   Two things about this are easy to get wrong, and both were:

   1. It must be scroll-margin-top on the TARGETS, not scroll-padding-top here.
      scroll-padding applies to the scroll *container* — <html> — so setting it
      on a descendant silently does nothing and every anchor lands under the bar.
   2. The two COMPOUND. html already carries
      scroll-padding-top: nav-h + nav-top + 24px (~106px), and this margin adds
      to it. So this value is only the extra the tab bar needs, not the whole
      offset — repeating the nav maths here pushed sections 150px too far down,
      past the scroll-spy's own trip line, and the pill stopped following.

   ~60px lands a section clearly below the bar; group.js measures its trip line
   from the same bar, with enough slack that the two cannot disagree. Bump this
   whenever .grp-tabs gets taller, or the gap closes back up. */
.grp-dense [id^="grp-"] { scroll-margin-top: 60px; }

/* ── Group section tabs ────────────────────────────────────────────────────
   Sticky under the floating nav. Borrows .news-chip-row/.news-chip wholesale,
   so the horizontal scroll on narrow screens comes for free. */
.grp-tabs {
    position: sticky;
    top: calc(var(--lyx-nav-h) + var(--lyx-nav-top) + 6px);
    z-index: 20;
    /* Room on all four sides. Flush against the panel below, the pills read as
       part of that card rather than as navigation for the page. */
    margin: 0.35rem 0 1.4rem;
    padding: 0.7rem 0 0.9rem;
    /* Full-bleed backdrop so content scrolling underneath does not show
       between the pills. */
    background: var(--bg-app);
    box-shadow: 0 1px 0 var(--border-subtle);
}
.grp-tabs .news-chip { text-decoration: none; }

/* ── Group breakdown: donuts + legends ─────────────────────────────────────
   The legend is not optional decoration. A donut is only readable as
   part-to-whole at a glance; the exact figures live in the list beside it,
   which is also what keeps identity from being carried by colour alone. */
.grp-donut {
    display: grid;
    grid-template-columns: minmax(0, 150px) minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
}
.grp-donut-canvas { position: relative; height: 150px; }
.grp-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.grp-legend-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: baseline;
    gap: 0.2rem 0.5rem;
    font-size: 0.78rem;
}
/* Spans the row under the figures. This is what rescues a holding too small to
   draw an arc: its share may be a fraction of a degree on the donut, but here
   it still gets a labelled row and a visible mark. */
.grp-legend-bar {
    grid-column: 2 / -1;
    height: 3px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    overflow: hidden;
    margin-bottom: 0.25rem;
}
/* The inline width is the true share; this only guarantees the mark is not
   sub-pixel. The exact value and percentage sit on the same row. */
.grp-legend-bar > span { display: block; height: 100%; min-width: 2px; border-radius: 999px; }
.grp-legend-dot { width: 9px; height: 9px; border-radius: 2px; align-self: center; }
/* Text wears text tokens; only the swatch carries the series colour. */
.grp-legend-label { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp-legend-val {
    font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}
.grp-legend-pct {
    min-width: 3.2rem; text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--text-tertiary);
}
.chart-wrap-short { height: 220px; }

/* Filter strip above a table. Its own band between the panel header (which
   carries the caveat) and the rows it filters. */
.grp-filterbar {
    display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
    border-bottom: 1px solid var(--border-subtle);
}
.grp-filter-input { flex: 1 1 14rem; min-width: 0; max-width: 22rem; padding: 0.45rem 0.7rem; font-size: 0.82rem; }
.grp-filter-count { margin-left: auto; font-variant-numeric: tabular-nums; }
.grp-filter-empty { padding: 2rem 1rem; }
@media (max-width: 560px) {
    .grp-filter-count { margin-left: 0; }
}

/* Sortable headers. The affordance was previously an inline style repeated on
   every <th> across markets/funding_compare; this is the same thing as a class. */
.is-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.is-sortable:hover { color: var(--text-primary); }
.is-sortable .sort-arrow { color: var(--text-tertiary); font-size: 0.7em; }

/* A panel header carrying a note and an action without them colliding. */
.grp-panel-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

@media (max-width: 560px) {
    .grp-donut { grid-template-columns: 1fr; justify-items: center; }
    .grp-legend { width: 100%; }
}

/* ── Refetch in progress ───────────────────────────────────────────────────
   An edit on /group/<addrs> navigates, and the server round trip is three
   upstream calls per member. The figures go quiet for that gap rather than
   sitting there looking current, and the page stops taking clicks it is about
   to throw away. */
.grp-refetching .dash-headline,
.grp-refetching .kpi-grid,
.grp-refetching .panel {
    opacity: 0.45;
    pointer-events: none;
    transition: opacity var(--dur-base) var(--ease-out);
}
.gedit.is-pending { opacity: 0.7; }

/* ── Wallet groups (/group) ───────────────────────────────────────────── */
.grp-section { padding-top: 5rem; max-width: 1200px; margin: 0 auto; }
.grp-title { cursor: default; }
.grp-note {
    margin: 1.5rem 0 0;
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--text-tertiary);
    max-width: 68ch;
}
.grp-empty { padding: 2.5rem 1rem; }
.grp-empty-title { font-weight: 600; color: var(--text-secondary); margin-bottom: 0.25rem; }

/* The series toggle and the range tabs are two different jobs, so they stay
   two controls; wrap them together and let them drop below the title on narrow
   panels rather than squeezing the heading. */
.grp-chart-header { flex-wrap: wrap; gap: 0.75rem; }
.grp-chart-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.grp-stats-tight { margin-top: 1.1rem; }

/* Long/short split. The ratio is the message, so it gets a proportional bar
   instead of two numbers the reader has to divide in their head. */
.grp-split { margin-bottom: 0.25rem; }
.grp-split-bar {
    display: flex;
    height: 8px;
    border-radius: var(--radius-pill);
    overflow: hidden;
    background: var(--bg-tertiary);
}
.grp-split-long { background: var(--success); }
.grp-split-short { background: var(--danger); }
.grp-split-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.5rem;
    margin-top: 0.7rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.grp-split-legend > div { display: flex; align-items: baseline; gap: 0.4rem; }
.grp-split-legend strong { font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace; font-variant-numeric: tabular-nums; }
.grp-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; align-self: center; }
.grp-dot-long { background: var(--success); }
.grp-dot-short { background: var(--danger); }

/* Share-of-equity bar sits under the number in the same cell — reading eight
   percentages down a column is slower than seeing eight bar lengths. */
.grp-share { display: inline-flex; align-items: center; gap: 0.5rem; justify-content: flex-end; }
.grp-share-bar {
    width: 46px;
    height: 4px;
    border-radius: var(--radius-pill);
    background: var(--bg-tertiary);
    overflow: hidden;
    flex-shrink: 0;
}
.grp-share-bar > span { display: block; height: 100%; background: var(--primary); }

.grp-market { display: inline-flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.grp-holders { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; }
.grp-holder {
    color: var(--text-tertiary);
    font-size: 0.78rem;
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.grp-holder:hover { color: var(--primary-text); background: var(--bg-card-hover); }

.grp-saved-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.grp-saved-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    transition: border-color var(--dur-fast) var(--ease-out);
}
.grp-saved-item:hover { border-color: var(--border-focus); }
.grp-saved-link { display: flex; flex-direction: column; gap: 0.3rem; flex: 1; min-width: 0; text-decoration: none; }
.grp-saved-link:hover .font-bold { color: var(--primary-text); }
/* Who is in it, shown rather than counted: "4 wallets" tells you nothing about
   whether this is the group you meant. */
.grp-saved-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.grp-saved-chip {
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-pill);
    background: var(--bg-tertiary);
    font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace;
    font-size: 0.68rem;
    color: var(--text-tertiary);
    max-width: 10rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.grp-saved-more { font-family: var(--font-body); }
.grp-saved-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }

/* Builder (/group) */
.grp-section-narrow { max-width: 1000px; }
/* The footer carries the action, so the panel ends on the thing you came to do
   rather than on a button floating under a form. */
.grp-build-footer { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.grp-build-footer .btn { margin-left: auto; }
.grp-build-footer .is-disabled { opacity: 0.45; pointer-events: none; }

/* Member bar (/group/<addrs>) — the manage surface, above the figures. Tinted
   a shade off the page so it reads as a control strip, not another panel. */
.grp-memberbar {
    margin-bottom: 1.25rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}
.grp-memberbar-nudge {
    margin: 0.75rem 0 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.grp-memberbar-nudge strong { color: var(--text-primary); }

/* Inline rename fields. Sized to what they replace so nothing reflows when one
   opens — the title keeps display metrics, the table cell keeps mono. */
.grp-title-input {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    max-width: 100%;
    width: 16ch;
}
.grp-name-input {
    font-family: var(--font-body);
    font-size: 0.8rem;
    padding: 0.2rem 0.45rem;
    width: 9rem;
}
.grp-title[role="button"] { cursor: text; }
.grp-title[role="button"]:hover { color: var(--primary-text); }
.grp-title:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 3px; border-radius: var(--radius-sm); }

.grp-row-actions { display: inline-flex; gap: 0.3rem; justify-content: flex-end; }
.grp-row-remove:hover { color: var(--danger-text); border-color: var(--danger); }
/* Saved is a state, not a success flash: quiet, and still clickable to undo. */
#groupSave.is-saved { color: var(--primary-text); border-color: var(--border-focus); }

@media (max-width: 640px) {
    .grp-section { padding-top: 4rem; }
    .grp-chart-controls { width: 100%; }
    .grp-share-bar { display: none; }
    .grp-build-footer .btn { margin-left: 0; width: 100%; }
}

/* The graph's own .trail / .searchdim / .searchhit styling lives in the
   cytoscape stylesheet in flow.js — those classes sit on canvas elements, not
   DOM nodes, so CSS cannot reach them. Below is the trail summary panel only. */
.flow-trail { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.flow-trail li { display: flex; gap: .55rem; align-items: flex-start; }
.flow-trail li.is-weak .flow-trail-share { color: var(--warning); }
.flow-trail-n {
    flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%;
    display: grid; place-items: center; font-size: .7rem; font-weight: 600;
    background: var(--primary); color: var(--bg-app);
}
.flow-trail-body { flex: 1; min-width: 0; }
.flow-trail-share { font-size: .78rem; font-weight: 600; color: var(--primary-text); }
.flow-trail-end {
    margin: 0; padding: .55rem .7rem; border-radius: var(--radius-md);
    background: var(--bg-card-hover); border: 1px solid var(--border-subtle);
    font-size: .8rem; color: var(--text-secondary);
}

@media (max-width: 1024px) {
    /* The trace button stops being right-aligned once the row wraps — pinned to
       the far end of a wrapped row it lands alone on its own line. */
    .flow-trace-wrap { margin-left: 0; }
    .flow-searchbox { min-width: 120px; }
}

/* Trail highlight colour. Deliberately NOT --primary: that is identical to
   --flow-chain-hl, so a trail drawn in it is invisible against the very
   Hyperliquid edges it runs along. High-contrast neutral instead, themed so it
   stays visible on both backgrounds. */
:root { --flow-trail: #ffffff; }
[data-theme="light"] { --flow-trail: #0f172a; }
.flow-trail-skip {
    margin-top: .15rem; font-size: .7rem; color: var(--accent);
}

/* ── Share cards (templates/_pnl_card.html + static/js/share-card.js) ───────
   Two panes: a sticky preview and a tabbed control column, with the actions
   pinned below both. The earlier single-column sheet scrolled the card out of
   view while you were composing it; once every kind became customisable that
   turned into the panel's defining problem, so the preview no longer moves. */

/* z-index 1200 was not enough: this is the only overlay that has to outrank
   third-party chrome, and Ko-fi ships its bubble at 99999999. 2147483000 wins
   outright and needs no revisiting when another widget arrives — the dialog is
   modal, so nothing on the site is legitimately meant to sit over it. The
   body.lyx-modal-open rules above are the companion half: they hide those
   widgets' hit areas, which stacking order alone can't neutralise. */
.sc-modal {
    position: fixed; inset: 0; z-index: 2147483000;
    display: flex; align-items: center; justify-content: center; padding: 1rem;
    background: rgba(0, 0, 0, .72); backdrop-filter: blur(4px);
}
.sc-modal[hidden] { display: none; }

.sc-sheet {
    position: relative; width: 100%; max-width: 760px;
    display: flex; flex-direction: column;
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    /* The panes scroll, not the sheet — the action bar has to stay put. */
    max-height: 92vh; overflow: hidden;
}
/* Its own row rather than floated over the panes. Absolutely positioned it
   landed on top of the Privacy tab — which made that tab unreachable, the one
   failure mode worse than looking untidy. The negative bottom margin buys the
   vertical space back from .sc-body's padding. */
.sc-close {
    align-self: flex-end; flex: none;
    margin: .4rem .55rem -.7rem 0;
    background: none; border: 0; cursor: pointer; line-height: 1;
    font-size: 1.5rem; color: var(--text-tertiary); padding: 0 .3rem;
    border-radius: var(--radius-sm);
}
.sc-close:hover { color: var(--text-primary); }
.sc-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.sc-body {
    display: grid; grid-template-columns: minmax(0, 1fr);
    gap: 1.1rem; padding: 1.25rem 1.25rem .5rem;
    overflow-y: auto; min-height: 0;
}
@media (min-width: 720px) {
    .sc-body { grid-template-columns: minmax(0, 1fr) minmax(272px, 300px); gap: 1.25rem; }
}

/* align-self:start is what makes the sticky work: a grid item stretches to
   the row height by default, and a full-height box has nothing to stick to. */
.sc-preview {
    position: sticky; top: 0; align-self: start; z-index: 1;
    background: var(--bg-card); padding-bottom: .5rem; min-width: 0;
}

/* The card used to sit naked on a same-dark sheet, so its edge — the actual
   crop line of the exported PNG — was invisible, and a light-themed card was
   unreadable against the app. The well is what gives it a boundary. */
.sc-well {
    background: var(--bg-app);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 14px;
}

/* ── The rasterised card ────────────────────────────────────────────────────
   Its colours are its own, not the page's: it is exported and posted
   elsewhere, so it carries the brand rather than whatever theme the trader
   happens to be running. Dark by default; the sharer can flip it to light for
   a light timeline.

   Declared as --sc-* rather than inline hex for the usual token reason, and
   for one specific to this node: html2canvas resolves computed values, so
   these must stay plain hex/rgb — no oklch(), color-mix() or backdrop-filter,
   which it drops or renders wrong. */
.sc-card {
    --sc-bg-a: #072020;
    --sc-bg-b: #051515;
    --sc-ink: #f7f6f3;
    --sc-ink-dim: #b8c4c3;
    --sc-ink-faint: #7a9190;
    --sc-rule: rgba(80, 210, 193, .14);
    --sc-edge: rgba(80, 210, 193, .22);
    --sc-accent: #50d2c1;
    --sc-up: var(--success);
    --sc-down: var(--danger);

    display: flex; flex-direction: column;
    background: linear-gradient(160deg, var(--sc-bg-a), var(--sc-bg-b) 60%);
    border: 1px solid var(--sc-edge);
    border-radius: var(--radius-lg); padding: 1.15rem 1.25rem 1rem;
    color: var(--sc-ink);
}
.sc-card--light {
    --sc-bg-a: #ffffff;
    --sc-bg-b: #eef4f3;
    --sc-ink: #0f172a;
    --sc-ink-dim: #334155;
    --sc-ink-faint: #64748b;
    --sc-rule: rgba(15, 23, 42, .1);
    --sc-edge: rgba(15, 23, 42, .14);
    /* --success/--danger measure 2.3:1 and 3.4:1 on the light card. Both are
       PnL figures, so both have to be readable, not merely tinted. */
    --sc-up: #047857;    /* 5.0:1 on #eef4f3 */
    --sc-down: #be123c;  /* 5.6:1 */
}

/* Accents. Each needs its own light-mode value: --accent measures 1.76:1 on
   white, which is the trap already documented at the top of this file. Every
   pair below clears 4.5:1 against its own card background. */
.sc-card--teal   { --sc-accent: #50d2c1; }
.sc-card--amber  { --sc-accent: #FFB454; --sc-rule: rgba(255, 180, 84, .14); --sc-edge: rgba(255, 180, 84, .22); }
.sc-card--violet { --sc-accent: #a78bfa; --sc-rule: rgba(167, 139, 250, .16); --sc-edge: rgba(167, 139, 250, .26); }
.sc-card--rose   { --sc-accent: #fb7185; --sc-rule: rgba(251, 113, 133, .16); --sc-edge: rgba(251, 113, 133, .26); }
.sc-card--mono   { --sc-accent: #e2e8f0; --sc-rule: rgba(226, 232, 240, .14); --sc-edge: rgba(226, 232, 240, .22); }
.sc-card--light.sc-card--teal   { --sc-accent: #0f8f80; }
.sc-card--light.sc-card--amber  { --sc-accent: #a75d00; }
.sc-card--light.sc-card--violet { --sc-accent: #6d28d9; }
.sc-card--light.sc-card--rose   { --sc-accent: #be123c; }
.sc-card--light.sc-card--mono   { --sc-accent: #334155; }
.sc-card--light.sc-card--amber  { --sc-rule: rgba(15, 23, 42, .1); --sc-edge: rgba(15, 23, 42, .14); }
.sc-card--light.sc-card--violet,
.sc-card--light.sc-card--rose,
.sc-card--light.sc-card--mono   { --sc-rule: rgba(15, 23, 42, .1); --sc-edge: rgba(15, 23, 42, .14); }

/* Export formats. Square is what Instagram and Discord embeds want, 16:9 what
   X crops to. If the content genuinely does not fit the ratio the card grows
   rather than clipping a figure — an aspect ratio is not worth a lost number. */
.sc-card--square { aspect-ratio: 1 / 1; }
.sc-card--post { aspect-ratio: 16 / 9; }

.sc-card .sc-up { color: var(--sc-up); }
.sc-card .sc-down { color: var(--sc-down); }

.sc-card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.sc-eyebrow {
    font-size: .72rem; font-weight: 600; letter-spacing: .07em;
    text-transform: uppercase; color: var(--sc-ink-dim);
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* The logo, not a wordmark. Sized in px rather than em so it stays identical
   across the three card formats, and never shrinks below a legible mark. */
.sc-mark { flex: none; display: block; width: 24px; height: 26px; }
.sc-hero { padding: 1.1rem 0 .9rem; text-align: center; }
.sc-hero[hidden] { display: none; }
.sc-value {
    font-family: var(--font-heading); font-weight: 700;
    font-size: 2.6rem; line-height: 1; font-variant-numeric: tabular-nums;
}
.sc-value-label {
    margin-top: .35rem; font-size: .68rem; text-transform: uppercase;
    letter-spacing: .08em; color: var(--sc-ink-faint);
}

/* Two-value hero. A group is defined by what it is worth and what it made;
   the whole book by its exposure and its unrealised. Both borrow the page's
   own two-up headline rather than the single-hero template. */
.sc-duo {
    display: grid; grid-template-columns: 1fr 1fr; gap: .75rem;
    padding: .9rem 0 .55rem;
}
.sc-duo[hidden] { display: none; }
.sc-duo-label {
    font-size: .62rem; text-transform: uppercase; letter-spacing: .08em;
    color: var(--sc-ink-faint); margin-bottom: .2rem;
}
.sc-duo-value {
    font-family: var(--font-heading); font-weight: 700;
    font-size: 1.5rem; line-height: 1.05; font-variant-numeric: tabular-nums;
    color: var(--sc-ink);
}

.sc-spark { display: block; width: 100%; height: 26px; color: var(--sc-accent); margin-bottom: .5rem; }
.sc-spark[hidden] { display: none; }

/* The member split — the element that makes this a group card rather than a
   recoloured account card. Same categorical hues the page's donuts use. */
.sc-split { padding: .35rem 0 .6rem; }
.sc-split[hidden] { display: none; }
.sc-split-bar {
    display: flex; height: 7px; border-radius: 999px; overflow: hidden;
    background: var(--sc-rule); gap: 2px;
}
.sc-split-seg { display: block; height: 100%; }
.sc-split-legend {
    display: flex; flex-wrap: wrap; gap: .3rem .7rem; margin-top: .45rem;
    font-size: .66rem; color: var(--sc-ink-dim);
}
.sc-split-key { display: inline-flex; align-items: center; gap: .3rem; }
.sc-split-key i { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.sc-seg-1, .sc-split-key i.sc-seg-1 { background: var(--cat-1); }
.sc-seg-2, .sc-split-key i.sc-seg-2 { background: var(--cat-2); }
.sc-seg-3, .sc-split-key i.sc-seg-3 { background: var(--cat-3); }
.sc-seg-4, .sc-split-key i.sc-seg-4 { background: var(--cat-4); }
.sc-seg-5, .sc-split-key i.sc-seg-5 { background: var(--cat-5); }
.sc-seg-other, .sc-split-key i.sc-seg-other { background: var(--cat-7); }

/* ── Whole-book card: allocation donut + per-position rows ───────────────── */
.sc-donut-wrap { display: flex; align-items: center; gap: 1rem; padding: .6rem 0 .7rem; }
.sc-donut-wrap[hidden] { display: none; }
.sc-donut { flex: none; display: block; }
.sc-donut-legend {
    flex-direction: column; flex-wrap: nowrap; gap: .28rem;
    margin-top: 0; min-width: 0;
}

.sc-book-rows { display: flex; flex-direction: column; padding: .3rem 0 .1rem; }
.sc-book-rows[hidden] { display: none; }
.sc-book-row {
    display: flex; align-items: center; justify-content: space-between; gap: .6rem;
    padding: .26rem 0; font-size: .74rem; font-variant-numeric: tabular-nums;
    border-top: 1px solid var(--sc-rule);
}
.sc-book-row:first-child { border-top: 0; }
.sc-book-coin {
    display: inline-flex; align-items: center; gap: .35rem; flex: none;
    font-weight: 700; color: var(--sc-ink);
}
.sc-book-coin i { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.sc-book-cells { display: flex; gap: .65rem; min-width: 0; color: var(--sc-ink-dim); }
.sc-book-cells span { white-space: nowrap; }
.sc-book-more { font-size: .68rem; color: var(--sc-ink-faint); padding-top: .3rem; }

.sc-rows { border-top: 1px solid var(--sc-rule); padding-top: .55rem; }
.sc-rows:empty { border-top: 0; padding-top: 0; }
.sc-row {
    display: flex; justify-content: space-between; gap: .75rem; padding: .22rem 0;
    font-size: .82rem; font-variant-numeric: tabular-nums;
}
.sc-row span:first-child { color: var(--sc-ink-faint); }
.sc-row span:last-child { color: var(--sc-ink); font-weight: 600; }

/* margin-top:auto pins the foot to the bottom, which is what lets the square
   and 16:9 formats distribute their extra height instead of stranding it. */
.sc-card-foot {
    display: flex; align-items: center; gap: .5rem; flex-wrap: nowrap;
    margin-top: auto; padding-top: .6rem; border-top: 1px solid var(--sc-rule);
    font-size: .68rem; color: var(--sc-ink-faint); letter-spacing: .04em;
}
.sc-addr {
    font-family: var(--font-mono, ui-monospace, monospace);
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sc-addr[hidden] { display: none; }
/* The foot is one line. The range must not wrap onto two, and a long address
   list ellipsises rather than pushing the domain off the card. */
.sc-range { white-space: nowrap; flex: 0 0 auto; }
.sc-range:empty { display: none; }
.sc-note {
    padding: .05rem .35rem; border-radius: var(--radius-sm); flex: none;
    background: rgba(245, 158, 11, .16); color: #b45309; font-weight: 600;
}
.sc-card:not(.sc-card--light) .sc-note { color: #f59e0b; }
.sc-note[hidden] { display: none; }
/* Not optional. The card travels away from the app, and with the address
   hidden by default the domain is often the only thing on it that says where
   it came from. */
.sc-domain { margin-left: auto; color: var(--sc-accent); font-weight: 600; flex: none; }

/* White chip, black modules: scannable on both themes without recolouring,
   and the padding doubles as part of the quiet zone. */
.sc-qr {
    flex: none; margin-left: .4rem; line-height: 0;
    background: #fff; padding: 4px; border-radius: 5px;
}
.sc-qr[hidden] { display: none; }
/* Dimensions are set inline by share-card.js from the code's own module count —
   a fixed box printed 8-wallet groups at 1.25 device px per module, which is a
   picture of a QR rather than a QR. These are only the pre-load fallback. */
.sc-qr-img { display: block; width: 48px; height: 48px; }

/* ── Control panel ──────────────────────────────────────────────────────── */
.sc-controls { display: flex; flex-direction: column; gap: .8rem; min-width: 0; }
.sc-tabs { width: 100%; }
.sc-tabs .seg-item { flex: 1 1 0; font-size: .78rem; padding: .35rem .5rem; min-height: 32px; }

.sc-panel { display: flex; flex-direction: column; gap: 1rem; animation: sc-fade var(--dur-fast) var(--ease-out); }
.sc-panel[hidden] { display: none; }
@keyframes sc-fade { from { opacity: 0; } to { opacity: 1; } }

.sc-opt-group { display: flex; flex-direction: column; gap: .4rem; }
.sc-opt-group[hidden] { display: none; }
.sc-opt-legend {
    display: flex; align-items: baseline; gap: .4rem;
    font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-tertiary); font-weight: 600;
}
.sc-opt-count { text-transform: none; letter-spacing: 0; font-weight: 400; }
.sc-opt-note { margin: 0; font-size: .72rem; line-height: 1.45; color: var(--text-tertiary); }
.sc-opt-note[hidden] { display: none; }

.sc-chips { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.sc-chip {
    position: relative;
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .3rem .6rem .3rem .45rem; border-radius: var(--radius-pill);
    border: 1px solid var(--border-subtle); background: transparent;
    font-size: .74rem; color: var(--text-secondary); cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease-out),
                background-color var(--dur-fast) var(--ease-out),
                color var(--dur-fast) var(--ease-out);
}
/* A native checkbox sitting next to a styled pill was two affordances for one
   control. The input stays focusable and in the accessibility tree; only the
   painting moves to the pill. */
.sc-chip input {
    position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0;
    pointer-events: none;
}
.sc-chip-tick {
    width: 13px; height: 13px; border-radius: 4px; flex: none;
    border: 1px solid var(--border-subtle);
    display: inline-flex; align-items: center; justify-content: center;
}
.sc-chip:hover { border-color: var(--border-focus); color: var(--text-primary); }
.sc-chip:active { transform: translateY(1px); }
.sc-chip:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.sc-chip.is-on {
    border-color: var(--primary); background: rgba(80, 210, 193, .12); color: var(--text-primary);
}
.sc-chip.is-on .sc-chip-tick { background: var(--primary); border-color: var(--primary); }
.sc-chip.is-on .sc-chip-tick::after {
    content: ''; width: 3px; height: 6px; margin-top: -2px;
    border: solid var(--primary-ink); border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
/* At the cap: still readable, clearly not clickable, and the legend says why. */
.sc-chip.is-off { opacity: .45; cursor: not-allowed; }
.sc-chip.is-off:hover { border-color: var(--border-subtle); color: var(--text-secondary); }
.sc-chip.is-off:active { transform: none; }

.sc-seg { flex-wrap: wrap; }
.sc-seg .seg-item { font-size: .74rem; padding: .3rem .6rem; min-height: 30px; }
.sc-seg .seg-item:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sc-seg .seg-item:disabled { opacity: .4; cursor: not-allowed; }
.sc-seg .seg-item:disabled:hover { background: none; color: var(--text-secondary); }

.sc-input {
    width: 100%; padding: .45rem .6rem; border-radius: var(--radius-sm);
    background: rgba(5, 21, 21, .6); border: 1px solid var(--border-subtle);
    color: var(--text-primary); font: inherit; font-size: .8rem;
}
.sc-input::placeholder { color: var(--text-tertiary); }
.sc-input:focus {
    outline: none; border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
/* Sits in the action bar, above the share buttons: copying the link IS a way
   of sharing, so it belongs with the other ways rather than behind a tab. */
.sc-link-row { display: flex; gap: .4rem; align-items: stretch; }
.sc-link-row .sc-input {
    min-width: 0; flex: 1 1 auto;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: .72rem; color: var(--text-secondary);
}
/* Readonly, not disabled: still selectable and still reachable by a screen
   reader, so the link can be dragged out by hand when the clipboard is not
   available (insecure origins, embedded webviews). */
.sc-link-row .sc-input:read-only { cursor: text; }

.sc-opt {
    display: flex; align-items: center; gap: .45rem; margin: 0;
    font-size: .82rem; color: var(--text-secondary); cursor: pointer;
}
.sc-opt input { margin: 0; }
.sc-opt:focus-within { color: var(--text-primary); }

.sc-reset {
    align-self: flex-start; background: none; border: 0; padding: .2rem 0;
    color: var(--text-tertiary); font: inherit; font-size: .75rem; cursor: pointer;
    text-decoration: underline; text-underline-offset: 3px; border-radius: var(--radius-sm);
}
.sc-reset:hover { color: var(--danger-text); }
.sc-reset:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── Action bar ─────────────────────────────────────────────────────────────
   Pinned, so it never scrolls away on a phone. One primary; the rest are one
   wrapping ghost row rather than six identical grid cells. */
.sc-actionbar {
    position: sticky; bottom: 0; flex: none;
    display: flex; flex-direction: column; gap: .5rem;
    padding: .8rem 1.25rem 1rem;
    background: var(--bg-card); border-top: 1px solid var(--border-subtle);
}
.sc-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.sc-btn {
    padding: .55rem .7rem; border-radius: var(--radius-sm); cursor: pointer;
    background: var(--bg-card-hover); color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    font: inherit; font-size: .82rem; font-weight: 600;
    transition: border-color var(--dur-fast) var(--ease-out),
                color var(--dur-fast) var(--ease-out);
}
.sc-actions .sc-btn { flex: 1 1 auto; }
.sc-btn:hover { border-color: var(--border-focus); }
.sc-btn:active { transform: translateY(1px); }
.sc-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sc-btn:disabled { opacity: .5; cursor: not-allowed; }
.sc-btn[hidden] { display: none; }
.sc-btn-primary {
    width: 100%;
    background: var(--primary); color: var(--primary-ink); border-color: var(--primary);
}
.sc-btn-sm { flex: none; padding: .4rem .7rem; font-size: .76rem; }
/* Reserved height, so a status message does not shift the bar under the cursor. */
.sc-status { min-height: 1.1rem; margin: 0; font-size: .78rem; color: var(--primary-text); }

@media (max-width: 719px) {
    .sc-sheet { max-width: 440px; }
    .sc-body { padding: 1.1rem 1rem .5rem; }
    .sc-actionbar { padding: .7rem 1rem .9rem; }
    /* A whole-book card runs past 600px tall. Left to grow, it pushes every
       control a full screen below the fold — you would scroll past the card to
       reach the tabs, then lose sight of it while using them. Capping the pane
       keeps the eyebrow and hero (which most controls change) in view, and the
       rest of the card is one flick away inside its own scroller. */
    /* The cap goes on the WELL, not the pane. The well already has a border,
       a radius and padding, so a card scrolling inside it reads as a framed
       viewport. Capping the pane instead cut the card against nothing, which
       looked like a rendering fault — and fading that edge only made the
       sticky pane transparent enough to show the controls through it. */
    .sc-well { max-height: 46vh; overflow-y: auto; }
}

/* ── Trigger buttons on position rows, cards and panel headers ───────────── */
.sc-trigger {
    background: none; border: 0; cursor: pointer; padding: .2rem .35rem;
    color: var(--text-tertiary); font: inherit; font-size: .78rem; font-weight: 600;
    border-radius: var(--radius-sm);
}
.sc-trigger:hover { color: var(--primary-text); }
.sc-trigger:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.sc-trigger--icon { display: inline-flex; align-items: center; padding: .3rem; }

/* A .pos-card is an <a>, and a button cannot legally nest inside one — so the
   share trigger is a sibling floated over the card's corner instead.
   Space for it is RESERVED in the header row rather than borrowed: overlaying
   it on an unreserved corner sat it directly on top of the unrealised PnL. */
.pos-card-wrap { position: relative; }
.pos-card-wrap .pos-card-head { padding-right: 1.6rem; }
.pos-card-wrap > .sc-trigger {
    position: absolute; top: .55rem; right: .55rem; z-index: 1;
    background: var(--bg-card); line-height: 0;
    border: 1px solid transparent;
    /* Dimmed until the card is hovered or the button is focused, matching how
       .pos-open behaves — the card is a link first, and a permanently lit
       button on every row turns the list into a wall of chrome. Never fully
       transparent, so it stays discoverable on touch, which gets no hover. */
    opacity: .45; transition: opacity var(--dur-fast) var(--ease-out);
}
.pos-card-wrap:hover > .sc-trigger,
.pos-card-wrap > .sc-trigger:focus-visible { opacity: 1; border-color: var(--border-subtle); }

/* ── Email Alert Modal ─────────────────────────────────────────── */
.email-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
.email-modal[hidden] { display: none !important; }

.email-modal-sheet {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: #0d1219;
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), 0 0 25px rgba(16, 185, 129, 0.1);
    overflow: hidden;
    animation: emailModalAnim 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes emailModalAnim {
    from { opacity: 0; transform: scale(0.96) translateY(6px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.email-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 0.5rem 1.25rem;
}

.email-modal-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #10b981;
    flex-shrink: 0;
}

.email-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-tertiary, #64748b);
    cursor: pointer;
    padding: 0 0.3rem;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s ease;
}
.email-modal-close:hover {
    color: #ffffff;
}

.email-modal-body {
    padding: 0.85rem 1.25rem 1.35rem 1.25rem;
}


/* Live hub summary (_live_summary.html) */
.lyx-live-summary { margin: 0 0 1.5rem; padding: 0.9rem 1.1rem; border-left: 3px solid var(--accent); background: var(--bg-secondary, transparent); border-radius: 0 8px 8px 0; }
.lyx-live-summary p { margin: 0; line-height: 1.6; color: var(--text-secondary); font-size: 0.95rem; }
.lyx-live-summary a { color: var(--primary-text, var(--accent)); text-decoration: underline; }
.lyx-live-summary .lyx-live-summary-src { margin-top: 0.4rem; font-size: 0.8rem; color: var(--text-tertiary); }

/* ── Yodoya partner promo strip (base.html) ──────────────────────────────
   Site theme tokens, so it follows light/dark mode. First row of body's flex
   column, in the normal flow: it pushes the page down by its own height and
   scrolls away with it instead of covering anything; see --ydy-promo-vis.
   The headline link's ::after covers the whole bar (stretched link); the
   buttons and the close button sit above it with position:relative + z-index. */
.ydy-promo {
  position: relative; flex-shrink: 0; z-index: 101; /* above .lyx-nav-wrapper (100) */
  padding: 8px 52px; font-family: var(--font-body); line-height: 1.3; cursor: pointer;
  /* Faint amber wash from the left, so the strip reads as an offer, not as more nav. */
  background: linear-gradient(90deg, var(--accent-soft), transparent 45%), var(--bg-sidebar);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); color: var(--text-primary);
}
.ydy-promo[hidden] { display: none; }
.ydy-promo-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px;
}

/* The account card: the one visual moment. Balance in the site's display face,
   equity line drawn once on load underneath it. */
.ydy-promo-card {
  position: relative; flex: none; width: 92px; height: 40px; padding: 3px 9px; overflow: hidden;
  background: var(--bg-card); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 8px;
}
.ydy-promo-card-bal {
  position: relative; z-index: 1; display: block; font-family: var(--font-heading); font-size: 18px; font-weight: 700; line-height: 1.15;
  font-variant-numeric: lining-nums tabular-nums; color: var(--accent-ink);
}
.ydy-promo-spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 13px; } /* under the balance, never through it */
.ydy-promo-spark-line {
  fill: none; stroke: var(--primary-text); stroke-width: 1.5; stroke-linejoin: round; vector-effect: non-scaling-stroke;
  stroke-dasharray: 1; stroke-dashoffset: 1; animation: ydy-draw 1.4s cubic-bezier(.3, .7, .2, 1) .35s forwards;
}
.ydy-promo-spark-fill { fill: var(--primary-glow); opacity: 0; animation: ydy-fade .8s ease-out 1.1s forwards; }
@keyframes ydy-draw { to { stroke-dashoffset: 0; } }
@keyframes ydy-fade { to { opacity: .5; } }
@media (prefers-reduced-motion: reduce) {
  .ydy-promo-spark-line { animation: none; stroke-dashoffset: 0; }
  .ydy-promo-spark-fill { animation: none; opacity: .5; }
}

.ydy-promo-copy { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ydy-promo-brand { font-size: 15px; font-weight: 600; letter-spacing: -0.005em; color: var(--text-primary); text-decoration: none; }
.ydy-promo:hover .ydy-promo-brand { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
/* No filter/transform on this link: either makes it the ::after's containing
   block, shrinking the stretched link to the word on hover. */
.ydy-promo-brand::after { content: ""; position: absolute; inset: 0; }
.ydy-promo-sub { margin: 0; font-size: 12.5px; color: var(--text-secondary); }
.ydy-promo-tag {
  margin-right: 4px; padding: 0 4px; font-size: 10px; font-weight: 500; vertical-align: 1px;
  color: var(--text-tertiary); border: 1px solid var(--border-subtle); border-radius: 3px;
}

.ydy-promo-offers { display: flex; align-items: center; gap: 6px 14px; }
.ydy-promo-claim, .ydy-promo-alt, .ydy-promo-close { position: relative; z-index: 1; }
/* Tear-off ticket (notched left edge, dashed border) joined to the button. */
.ydy-promo-claim {
  display: inline-flex; align-items: stretch; height: 36px; text-decoration: none; border-radius: 8px;
  transition: box-shadow .15s;
}
.ydy-promo-claim:hover { box-shadow: 0 0 0 3px var(--accent-soft); }
.ydy-promo-ticket {
  display: flex; align-items: center; padding: 0 11px 0 14px;
  background: var(--bg-card); border: 1px dashed var(--accent-ink); border-right: 0; border-radius: 8px 0 0 8px;
  -webkit-mask: radial-gradient(circle 5px at 0 50%, transparent 4.5px, #000 5px);
          mask: radial-gradient(circle 5px at 0 50%, transparent 4.5px, #000 5px);
}
.ydy-promo-ticket code {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; font-weight: 700; letter-spacing: 0.06em; color: var(--accent-ink); background: none; padding: 0;
}
.ydy-promo-cta {
  display: flex; align-items: center; justify-content: center; padding: 0 16px;
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  color: var(--primary-ink); background: var(--accent); border-radius: 0 8px 8px 0; /* dark ink in both themes */
}
.ydy-promo-claim:hover .ydy-promo-cta { background: color-mix(in srgb, var(--accent) 85%, #fff); }
.ydy-promo-alt {
  font-size: 12px; white-space: nowrap; color: var(--text-tertiary);
  text-decoration: underline; text-decoration-color: var(--border-subtle); text-underline-offset: 3px;
}
.ydy-promo-alt:hover { color: var(--text-primary); }
.ydy-promo-alt code { font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 600; color: var(--text-secondary); background: none; padding: 0; }

.ydy-promo-brand:focus-visible, .ydy-promo-claim:focus-visible, .ydy-promo-alt:focus-visible { outline: 2px solid var(--primary-text); outline-offset: 2px; }
.ydy-promo-close {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; font-size: 18px; line-height: 1; border-radius: 6px;
  color: var(--text-tertiary); background: none; border: 0; cursor: pointer;
}
.ydy-promo-close:hover { color: var(--text-primary); background: var(--bg-card-hover); }
/* Phones: card + headline side by side (close button in the corner), then the
   ticket+button full width with the discount link under it. */
@media (max-width: 640px) {
  .ydy-promo { padding: 10px 12px 8px; background: linear-gradient(160deg, var(--accent-soft), transparent 60%), var(--bg-sidebar); }
  .ydy-promo-inner { justify-content: flex-start; gap: 8px 10px; }
  .ydy-promo-copy { flex: 1 1 0; padding-right: 24px; }
  .ydy-promo-offers { flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 6px; }
  .ydy-promo-claim { height: 42px; }
  .ydy-promo-cta { flex: 1; }
  .ydy-promo-alt { align-self: center; }
  .ydy-promo-close { top: 6px; right: 4px; transform: none; }
}
/* Wallet app shell doesn't use --lyx-nav-top: keep its fixed pieces just under
   whatever part of the strip is still visible. */
.sidebar { top: var(--ydy-promo-vis); height: calc(100vh - var(--ydy-promo-vis)); }
#mobile-toggle { top: var(--ydy-promo-vis); }

/* ══════════════════════════════════════════════════════════════════════════
   PAGE — Overview (timeline redesign, 2026-10)
   One time axis for the account's story, then the open book, what needs a
   look, where the PnL came from and how the wallet trades. Markup in
   dashboard.html, rendering in js/overview.js. Spacing runs on one rhythm:
   --ov-gap between sections, the .panel paddings inside them.
   ══════════════════════════════════════════════════════════════════════════ */
:root { --font-mono: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace; --ov-gap: 1.25rem; }

.ov { display: flex; flex-direction: column; gap: var(--ov-gap); min-width: 0; }
.ov > .page-header { margin-bottom: 0; }
.ov .panel { margin-bottom: 0; }
.ov #dash-banners:empty { display: none; }
.ov #dash-banners .notice { margin-bottom: 0.5rem; }
.ov #dash-banners .notice:last-child { margin-bottom: 0; }
.ov .tone-warn { color: var(--accent-ink); }
.ov-muted { color: var(--text-tertiary); }
.ov-strong { color: var(--text-primary); }
.ov-live { font-size: 0.72rem; }

/* Labels / values / sub-lines shared by every figure on the page */
.ov-k { font-size: 0.75rem; font-weight: 500; color: var(--text-tertiary); line-height: 1.3; }
.ov-k-note { margin-left: 0.25rem; color: var(--success-text); font-weight: 600; }
.ov-v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.05rem; font-weight: 600; color: var(--text-primary); margin-top: 0.2rem; line-height: 1.25; }
/* .ov-v is defined after the global tone classes, so restate them or every
   signed KPI renders white. */
.ov-v.tone-up { color: var(--success-text); }
.ov-v.tone-down { color: var(--danger-text); }
.ov-v.tone-warn { color: var(--accent-ink); }
.ov-s { font-size: 0.78rem; color: var(--text-tertiary); margin-top: 0.2rem; line-height: 1.4; }

/* Verdict: the page's one-sentence summary */
.ov-verdict {
    margin: 0;
    max-width: 62rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: clamp(1.1rem, 1.6vw, 1.4rem);
    line-height: 1.4;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
    text-wrap: pretty;
}
.ov-verdict .tone-up, .ov-verdict .tone-down, .ov-verdict .tone-warn, .ov-verdict .ov-strong { white-space: nowrap; }
.ov-verdict[hidden] { display: none; }
.ov-skel-line { display: block; height: 1.1rem; width: 92%; border-radius: 6px; margin: 0.35rem 0; }
.ov-skel-line.is-short { width: 55%; }

/* ── Timeline panel ─────────────────────────────────────────────────────── */
.ov-tl-head {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
    gap: 1rem 1.5rem; padding: 1.1rem 1.35rem 0.85rem;
}
.ov-tl-figs { display: flex; flex-wrap: wrap; gap: 0.75rem 2.75rem; min-width: 0; }
.ov-tl-big {
    font-family: var(--font-heading); font-weight: 700; letter-spacing: -0.015em;
    font-size: clamp(1.45rem, 2.4vw, 1.9rem); line-height: 1.15; margin-top: 0.2rem;
    font-variant-numeric: tabular-nums; color: var(--text-primary); min-height: 1.15em;
}
.ov-tl-big .skel-title { display: block; width: 11rem; height: 1.6rem; }
.ov-tl-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.ov-tl-controls .seg-item { white-space: nowrap; }
.ov-select { height: 38px; width: auto; min-width: 9.5rem; padding: 0 2rem 0 0.75rem; font-size: 0.82rem; }

.ov-tl-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
    padding: 0 1.35rem 0.9rem; border-bottom: 1px solid var(--border-subtle);
}
.ov-tl-toolbar > .ov-k { margin-right: 0.35rem; }
.ov-chip {
    display: inline-flex; align-items: center; gap: 0.45rem;
    min-height: 32px; padding: 0 0.75rem;
    border: 1px solid var(--border-subtle); border-radius: var(--radius-pill);
    background: transparent; color: var(--text-tertiary);
    font: 600 0.78rem var(--font-body); cursor: pointer;
    transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.ov-chip:hover { color: var(--text-primary); border-color: var(--border-focus); }
.ov-chip:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.ov-chip[aria-pressed="true"] { color: var(--text-primary); background: rgba(80, 210, 193, 0.1); border-color: rgba(80, 210, 193, 0.35); }
.ov-chip[aria-pressed="false"] .ov-sw { opacity: 0.35; }
.ov-chip:disabled { opacity: 0.4; cursor: not-allowed; }
.ov-sw { display: inline-block; width: 14px; height: 10px; flex-shrink: 0; border-radius: 2px; }
.ov-sw.is-capital { height: 0; border-top: 2px dashed var(--accent); border-radius: 0; }
.ov-sw.is-marker { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.ov-sw.is-step { background: linear-gradient(90deg, var(--success) 50%, var(--danger) 50%); }
.ov-sw.is-dd { background: rgba(244, 63, 94, 0.35); border-top: 2px solid var(--danger); }

.ov-tl-body { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; }
.ov-tl-chart { position: relative; height: 30rem; padding: 0.75rem 0.75rem 0.75rem 0.5rem; min-width: 0; }
.ov-tl-chart canvas { width: 100% !important; height: 100% !important; }
.ov-tl-chart canvas[hidden] { display: none; }
.ov-events { list-style: none; margin: 0; padding: .25rem .75rem .75rem; display: flex; flex-direction: column; gap: .15rem; }
.ov-events[hidden] { display: none; }
.ov-ev { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: .6rem; width: 100%; min-height: 40px; padding: 0 .5rem; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-primary); font: 500 .85rem var(--font-body); text-align: left; cursor: pointer; }
.ov-ev:hover, .ov-ev:focus-visible { background: var(--bg-card-hover); }
.ov-ev-n { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; color: #071313; font: 700 .72rem var(--font-body); }
.ov-ev-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-ev-d { font-size: .75rem; color: var(--text-tertiary); white-space: nowrap; }
.ov-tl-chart .chart-skeleton { inset: 0.75rem; }
.ov-tl-chart .chart-skeleton[hidden] { display: none; }
.ov-tl-chart .empty-state { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; }
.ov-tl-chart .empty-state[hidden] { display: none; }

.ov-readout {
    display: flex; flex-direction: column; gap: 0.85rem;
    padding: 1.1rem 1.25rem; border-left: 1px solid var(--border-subtle);
    font-size: 0.82rem; min-width: 0;
}
.ov-ro-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-size: 0.75rem; color: var(--text-tertiary); font-weight: 500; }
.ov-ro-main { font-family: var(--font-heading); font-weight: 700; font-size: 1.45rem; line-height: 1.15; font-variant-numeric: tabular-nums; margin-top: -0.4rem; }
.ov-ro-sub { font-size: 0.75rem; color: var(--text-tertiary); margin-top: -0.6rem; }
.ov-ro-list { display: flex; flex-direction: column; gap: 0.55rem; margin: 0; padding-top: 0.85rem; border-top: 1px solid var(--border-subtle); }
.ov-ro-list > div { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; }
.ov-ro-list dt { color: var(--text-secondary); }
.ov-ro-list dd { margin: 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500; text-align: right; white-space: nowrap; }
.ov-ro-event {
    padding: 0.65rem 0.75rem; border-radius: var(--radius-sm);
    background: var(--accent-soft); color: var(--text-secondary); line-height: 1.45;
}
.ov-ro-event b { color: var(--accent); font-weight: 600; }
.ov-ro-foot { display: flex; flex-direction: column; gap: 0.55rem; padding-top: 0.85rem; border-top: 1px solid var(--border-subtle); }
.ov-ro-foot > div { display: flex; justify-content: space-between; gap: 0.75rem; }
.ov-ro-foot span { color: var(--text-secondary); }
.ov-ro-foot b { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.ov-ro-foot small { font-size: 0.72rem; opacity: 0.8; }
.ov-ro-hint { font-size: .7rem; color: var(--text-tertiary); white-space: nowrap; }
.ov-ro-unpin { flex-shrink: 0; min-height: 32px; padding: 0 .6rem; border-radius: var(--radius-pill); border: 1px solid var(--border-subtle); background: none; color: var(--text-secondary); font: 600 .72rem var(--font-body); cursor: pointer; }
.ov-ro-unpin:hover, .ov-ro-unpin:focus-visible { color: var(--text-primary); border-color: var(--border-focus); }
.ov-ro-link { margin-top: auto; color: var(--primary-text); font-weight: 600; font-size: 0.8rem; }
.ov-ro-link:hover { text-decoration: underline; }

/* ── Right-now strip ────────────────────────────────────────────────────── */
.ov-now { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.ov-now[hidden] { display: none; }
/* Hairlines drawn by each cell (right + bottom) rather than a coloured grid
   gap, so a short last row leaves plain panel, not a shaded hole. The panel's
   overflow:hidden trims the lines on the outer edges. */
.ov-now-cell { padding: 1rem 1.25rem; min-width: 0; box-shadow: 1px 0 0 var(--border-subtle), 0 1px 0 var(--border-subtle); margin: 0 1px 1px 0; }
.ov-now-cell .ov-v { font-size: 1.15rem; }
.ov-nw { white-space: nowrap; }
.ov-table td.num small.ov-cell-sub, .ov-cell-sub { display: block; margin: 0.15rem 0 0; opacity: 1; font: 0.7rem var(--font-body); color: var(--text-tertiary); }

/* ── Grids ──────────────────────────────────────────────────────────────── */
.ov-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--ov-gap); }
@media (min-width: 1200px) { .ov-grid-84 { grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); } }
@media (min-width: 1100px) { .ov-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ov-panel { display: flex; flex-direction: column; min-width: 0; }
.ov-panel[hidden] { display: none; }
.ov-panel > .panel-body { flex: 1; }
.ov-panel .panel-header > div { min-width: 0; }
.ov-pad { padding: 1rem 1.35rem; }
.ov-scroll-x { overflow-x: auto; }
.ov-count:not(:empty) {
    min-width: 1.6rem; padding: 0.1rem 0.5rem; border-radius: var(--radius-pill);
    background: var(--accent-soft); color: var(--accent); font: 700 0.75rem var(--font-mono); text-align: center;
}

/* ── Open positions table ───────────────────────────────────────────────── */
.ov-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ov-table th {
    padding: 0.65rem 1rem; text-align: left; white-space: nowrap;
    font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-subtle);
}
.ov-table td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; white-space: nowrap; font-size: 0.85rem; }
.ov-table tbody tr:last-child td { border-bottom: 0; }
.ov-table tbody tr:hover td { background: rgba(80, 210, 193, 0.035); }
.ov-table .num { text-align: right; font-family: var(--font-mono); }
.ov-table td.num small { font-size: 0.72rem; opacity: 0.8; margin-left: 0.25rem; }
.ov-table th:first-child, .ov-table td:first-child { padding-left: 1.35rem; }
.ov-table th:last-child, .ov-table td:last-child { padding-right: 1.1rem; }
.ov-coin { font-weight: 700; color: var(--text-primary); margin-right: 0.35rem; }
.ov-coin:hover { color: var(--primary-text); }
.ov-table .badge { font-size: 0.68rem; vertical-align: 1px; }
/* Wide screens: the side badge sits under the coin so the table fits beside the side panel. */
@media (min-width: 901px) { .ov-book-table td .ov-pos-badge { display: block; width: fit-content; margin: 0.3rem 0 0; } }
.ov-runway { display: inline-flex; align-items: center; justify-content: flex-end; gap: 0.55rem; }
.ov-runway i { display: block; width: 44px; height: 6px; border-radius: 3px; background: rgba(80, 210, 193, 0.12); overflow: hidden; }
.ov-runway b { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.ov-runway.is-warn span { color: var(--accent); }
.ov-runway.is-warn b { background: var(--accent); }
.ov-runway.is-danger span { color: var(--danger-text); }
.ov-runway.is-danger b { background: var(--danger); }
.ov-act { width: 1%; }
.ov-icon-link {
    display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
    border-radius: var(--radius-sm); color: var(--text-tertiary); border: 1px solid transparent;
}
.ov-icon-link:hover { color: var(--primary-text); border-color: var(--border-subtle); background: rgba(80, 210, 193, 0.06); }
.ov-icon-link:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }

/* ── What needs a look ──────────────────────────────────────────────────── */
.ov-look { list-style: none; margin: 0; padding: 0; }
.ov-look-item { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.8rem 0; border-bottom: 1px solid var(--border-subtle); font-size: 0.85rem; line-height: 1.5; }
.ov-look-item:first-child { padding-top: 0; }
.ov-look-item:last-child { border-bottom: 0; padding-bottom: 0; }
.ov-look-item b { color: var(--text-primary); font-weight: 600; }
.ov-look-text { color: var(--text-secondary); }
.ov-sev {
    flex: 0 0 3.6rem; margin-top: 0.1rem; padding: 0.15rem 0; border-radius: var(--radius-pill);
    text-align: center; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
}
.ov-sev.is-high { background: var(--danger-bg); color: var(--danger-text); }
.ov-sev.is-watch { background: var(--accent-soft); color: var(--accent); }
.ov-sev.is-good { background: var(--success-bg); color: var(--success-text); }
.ov-sev.is-data { background: var(--bg-tertiary); color: var(--text-secondary); }
.ov-allclear { display: flex; align-items: center; gap: 0.6rem; color: var(--success-text); font-weight: 600; }

/* ── Where the PnL came from ────────────────────────────────────────────── */
.ov-lead { margin: 0 0 1rem; font-family: var(--font-heading); font-weight: 600; font-size: 1.02rem; line-height: 1.45; color: var(--text-primary); }
.ov-lead .tone-up, .ov-lead .tone-down { white-space: nowrap; }
.ov-lead-sm { font-size: 0.92rem; margin: 0.85rem 0 0; color: var(--text-secondary); }
.ov-mkts { display: flex; flex-direction: column; }
/* Fixed columns so every ticker, bar, value and count sits on one line of a
   grid; rows are a fixed height so a venue chip cannot make one taller. */
.ov-mkt {
    display: grid; align-items: center; column-gap: 1rem;
    grid-template-columns: 8.5rem minmax(0, 1fr) 6rem 5.5rem;
    height: 34px; font-size: 0.82rem; border-bottom: 1px solid var(--border-subtle);
}
.ov-mkt:last-child { border-bottom: 0; }
.ov-mkt-head { height: 28px; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-tertiary); }
.ov-mkt-axis { display: flex; justify-content: space-between; padding: 0 0.15rem; text-transform: none; letter-spacing: 0; font-weight: 500; }
.ov-mkt-coin { display: flex; align-items: center; min-width: 0; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; }
.ov-mkt-coin:hover { color: var(--primary-text); }
.ov-mkt-coin .venue-badge { margin-left: 0.4rem; padding: 0 0.3rem; line-height: 1.5; font-size: 0.6rem; border-radius: 4px; }
/* Zero line in the middle of the track; bars grow out of it. */
.ov-mkt-track { position: relative; height: 10px; }
.ov-mkt-track::before { content: ''; position: absolute; left: 50%; top: -6px; bottom: -6px; width: 1px; background: var(--border-subtle); }
.ov-mkt-track b { position: absolute; top: 0; bottom: 0; min-width: 2px; border-radius: 3px; }
.ov-mkt-track b.is-pos { left: calc(50% + 1px); background: var(--success); border-top-left-radius: 0; border-bottom-left-radius: 0; }
.ov-mkt-track b.is-neg { right: calc(50% + 1px); background: var(--danger); border-top-right-radius: 0; border-bottom-right-radius: 0; }
.ov-mkt-val { font-family: var(--font-mono); font-weight: 600; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ov-mkt-head .ov-mkt-val { font-family: var(--font-body); }
.ov-mkt-meta { color: var(--text-tertiary); font-size: 0.75rem; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ov-sides { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-subtle); }
.ov-sides .ov-v { font-size: 0.95rem; }

/* ── How this wallet trades ─────────────────────────────────────────────── */
.ov-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.1rem; }
.ov-tag { padding: 0.25rem 0.7rem; border: 1px solid var(--border-subtle); border-radius: var(--radius-pill); font-size: 0.76rem; font-weight: 600; color: var(--text-secondary); }
.ov-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 1rem 1.25rem; }
.ov-figs .ov-v { font-size: 0.98rem; }
.ov-hours-wrap { margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--border-subtle); }
.ov-hours { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; margin-top: 0.5rem; }
.ov-hours span { height: 28px; border-radius: 4px; background: var(--bg-tertiary); }
.ov-hours .is-pos { background: color-mix(in srgb, var(--success) calc(var(--a) * 100%), transparent); }
.ov-hours .is-neg { background: color-mix(in srgb, var(--danger) calc(var(--a) * 100%), transparent); }
.ov-hours-axis { display: flex; justify-content: space-between; margin-top: 0.3rem; font: 0.68rem var(--font-mono); color: var(--text-tertiary); }

/* ── Last 30 days ───────────────────────────────────────────────────────── */
.ov-days { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 4px; }
.ov-day {
    position: relative; aspect-ratio: 1; min-height: 28px; border-radius: 5px;
    background: var(--bg-tertiary); display: flex; align-items: flex-end; justify-content: center;
}
.ov-day em { font: normal 0.62rem var(--font-mono); color: var(--text-secondary); padding-bottom: 3px; }
.ov-day.is-pos { background: color-mix(in srgb, var(--success) calc(var(--a) * 100%), transparent); }
.ov-day.is-neg { background: color-mix(in srgb, var(--danger) calc(var(--a) * 100%), transparent); }
.ov-day.is-pos em, .ov-day.is-neg em { color: var(--text-primary); }
.ov-day.is-none { background: transparent; border: 1px dashed var(--border-subtle); }
.ov-day.is-none em { color: var(--text-tertiary); }
a.ov-day:hover { outline: 2px solid var(--border-focus); outline-offset: 1px; }
a.ov-day:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.ov-days-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: 1rem; margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--border-subtle); }
.ov-days-stats .ov-v { font-size: 0.95rem; }

/* News sits in a grid column here, so its own bottom margin goes. */
.ov .dash-news { margin: 0; }

/* ── Tablet ─────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .ov-tl-body { grid-template-columns: minmax(0, 1fr); }
    .ov-readout { border-left: 0; border-top: 1px solid var(--border-subtle); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem 1.5rem; }
    .ov-readout > .ov-ro-head, .ov-readout > .ov-ro-main, .ov-readout > .ov-ro-sub { grid-column: 1 / -1; }
    .ov-ro-list, .ov-ro-foot { border-top: 0; padding-top: 0; }
    .ov-ro-event, .ov-ro-link { grid-column: 1 / -1; }
    .ov-tl-chart { height: 24rem; }
}

/* ── Positions as cards (tablet portrait and down) ──────────────────────── */
@media (max-width: 900px) {
    /* Positions table becomes one card per position */
    .ov-book-table thead { display: none; }
    .ov-book-table, .ov-book-table tbody { display: block; }
    .ov-book-table tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: 0.6rem 1rem; padding: 0.95rem 1rem; border-bottom: 1px solid var(--border-subtle); position: relative; }
    .ov-book-table tbody tr:last-child { border-bottom: 0; }
    .ov-book-table td { display: block; padding: 0 !important; border: 0; white-space: normal; text-align: left; }
    .ov-book-table td.num { text-align: left; }
    .ov-book-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 0.15rem; font: 500 0.7rem var(--font-body); color: var(--text-tertiary); }
    .ov-book-table td:first-child { grid-column: 1 / -1; padding-right: 2.5rem !important; }
    .ov-book-table td:first-child::before { display: none; }
    .ov-book-table .ov-act { position: absolute; top: 0.7rem; right: 0.6rem; width: auto; }
    .ov-runway { justify-content: flex-start; }
    .ov-book-table tbody tr:hover td { background: none; }

}

/* ── Phone ──────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
    :root { --ov-gap: 1rem; }
    .ov-tl-head { padding: 1rem 1rem 0.75rem; }
    .ov-tl-figs { gap: 0.75rem 1.75rem; }
    .ov-tl-controls { width: 100%; }
    .ov-tl-controls .seg { flex: 1; flex-wrap: nowrap; }
    .ov-tl-controls .seg-item { flex: 1; justify-content: center; }
    .ov-select { flex: 1; min-width: 0; }
    /* Chips wrap rather than scroll sideways: a hidden fourth chip and lane control were easy to miss. */
    .ov-tl-toolbar { padding: 0 1rem 0.75rem; flex-wrap: wrap; row-gap: 0.5rem; }
    .ov-tl-toolbar > .ov-k { flex-basis: 100%; }
    .ov-chip { flex-shrink: 0; min-height: 36px; }
    .ov-tl-chart { height: 20rem; padding: 0.5rem 0.25rem 0.5rem 0; }
    .ov-readout { grid-template-columns: minmax(0, 1fr); padding: 1rem; }
    .ov-now { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ov-now-cell:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .ov-now-cell { padding: 0.85rem 1rem; }
    .ov-now-cell .ov-v { font-size: 1rem; }

    .ov-look-item { flex-direction: column; gap: 0.4rem; }
    .ov-sev { flex-basis: auto; padding: 0.15rem 0.6rem; }
    .ov-mkt { grid-template-columns: 6.5rem minmax(0, 1fr) 5.25rem; column-gap: 0.75rem; }
    .ov-mkt-meta { display: none; }
    .ov-sides { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ov-days { grid-template-columns: repeat(10, minmax(0, 1fr)); }
    .ov-hours span { height: 22px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   WALLET SIDEBAR (sb2, 2026-10) + SECTION TABS
   One flat list from app/nav.py: eight wallet sections, five tools. No
   collapsing groups: thirteen rows fit a laptop screen, and a closed group
   hid where you were. Pages merged into a section stay reachable through the
   .wtabs strip above the page content.
   ══════════════════════════════════════════════════════════════════════════ */
.sidebar.sb2 {
    padding: calc(1rem + env(safe-area-inset-top, 0px)) 0.85rem calc(1rem + env(safe-area-inset-bottom, 0px));
    gap: 1rem;
    scrollbar-color: var(--border-subtle) transparent;
}
.sidebar.sb2::-webkit-scrollbar-thumb { background: var(--border-subtle); }

.sb2-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0 0.35rem; }
.sb2-logo { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--text-primary); text-decoration: none; font-family: var(--font-heading); font-weight: 700; font-size: 1.08rem; letter-spacing: -0.01em; }
.sb2-logo img { display: block; }
.sb2-icon-btn {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    background: transparent; border: 1px solid var(--border-subtle); color: var(--text-secondary); cursor: pointer;
    transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.sb2-icon-btn:hover { color: var(--primary-text); border-color: var(--border-focus); background: rgba(80, 210, 193, 0.06); }
.sb2-icon-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

/* Current wallet + lookup */
.sb2-wallet { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.75rem; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: rgba(80, 210, 193, 0.03); }
.sb2-wallet-id { display: flex; align-items: flex-end; gap: 0.5rem; min-width: 0; padding: 0.1rem 0.1rem 0; }
.sb2-wallet-text { flex: 1; min-width: 0; }
.sb2-wallet-sub { display: flex; align-items: center; gap: 0.4rem; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); }
.sb2-live { width: 6px; height: 6px; border-radius: 50%; background: var(--primary-text); box-shadow: 0 0 0 3px var(--primary-glow); }
.sb2-wallet-addr {
    display: inline-flex; align-items: center; gap: 0.45rem; max-width: 100%; margin: 0.3rem 0 0 -0.3rem; padding: 0.15rem 0.3rem;
    background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer;
    font-size: 0.95rem; font-weight: 600; letter-spacing: 0.01em; color: var(--text-primary); white-space: nowrap;
}
.sb2-wallet-addr span { overflow: hidden; text-overflow: ellipsis; }
.sb2-wallet-addr svg { flex-shrink: 0; color: var(--text-tertiary); transition: color var(--dur-fast) var(--ease-out); }
.sb2-wallet-addr:hover { background: rgba(80, 210, 193, 0.06); }
.sb2-wallet-addr:hover .i-copy { color: var(--primary-text); }
.sb2-wallet-addr:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.sb2-wallet-addr .i-ok, .sb2-wallet-addr.is-copied .i-copy { display: none; }
.sb2-wallet-addr.is-copied .i-ok { display: block; color: var(--success); }
.sb2-icon-btn-sm { width: 30px; height: 30px; }
.sb2-search { position: relative; display: flex; align-items: center; }
.sb2-search svg { position: absolute; left: 0.65rem; color: var(--text-tertiary); pointer-events: none; }
.sb2-search input {
    width: 100%; height: 36px; padding: 0 0.65rem 0 2rem;
    border-radius: var(--radius-sm); border: 1px solid var(--border-subtle);
    background: var(--bg-app); color: var(--text-primary); font-size: 0.78rem;
}
.sb2-search input::placeholder { color: var(--text-tertiary); font-family: var(--font-body); }
.sb2-search input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-glow); }
.sb2-search input[aria-invalid="true"] { border-color: var(--danger); }
.sb2-error { font-size: 0.72rem; line-height: 1.4; color: var(--danger-text); }

/* Nav list */
.sb2-nav { display: flex; flex-direction: column; gap: 2px; }
.sb2-label { padding: 0.85rem 0.75rem 0.35rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); }
.sb2-label:first-child { padding-top: 0.15rem; }
.sb2-item {
    position: relative; display: flex; align-items: center; gap: 0.7rem;
    min-height: 40px; padding: 0 0.75rem; border-radius: var(--radius-sm);
    color: var(--text-secondary); font-size: 0.88rem; font-weight: 500; text-decoration: none;
    transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.sb2-item svg { flex-shrink: 0; opacity: 0.8; }
.sb2-item span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb2-item:hover { background: rgba(80, 210, 193, 0.07); color: var(--text-primary); }
.sb2-item:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
.sb2-item.active { background: rgba(80, 210, 193, 0.13); color: var(--text-primary); font-weight: 600; }
.sb2-item.active svg { color: var(--primary-text); opacity: 1; }
.sb2-item.active::before { content: ''; position: absolute; left: -0.85rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.sb2-row { display: flex; align-items: center; gap: 2px; }
.sb2-row .sb2-item { flex: 1; min-width: 0; }
.sb2-count { flex: 0 0 auto !important; font-size: 0.7rem; }
.sb2-row-action {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    background: transparent; border: 1px solid transparent; color: var(--text-tertiary); cursor: pointer;
}
.sb2-row-action:hover { color: var(--primary-text); border-color: var(--border-subtle); }
.sb2-row-action:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.sb2-row-action.is-on { color: var(--primary-text); }
.sb2-row-action.is-on .nav-row-action-stem { display: none; }

/* Footer: referral, alerts, secondary links */
.sb2-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.65rem; padding-top: 0.75rem; border-top: 1px solid var(--border-subtle); }
.sb2-ref {
    display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md); background: var(--gradient-brand); color: var(--primary-ink); text-decoration: none;
    transition: filter var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.sb2-ref:hover { filter: brightness(1.06); transform: translateY(-1px); }
.sb2-ref:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sb2-ref-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sb2-ref-text b { font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.sb2-ref-text small { font-size: 0.68rem; color: var(--primary-ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb2-ref-arrow { opacity: 0.7; flex-shrink: 0; }
.sb2-alerts { display: flex; gap: 0.4rem; }
.sb2-alert-btn { flex: 1; min-height: 36px !important; font-size: 0.8rem; }
.sb2-links { display: flex; flex-wrap: wrap; gap: 0.15rem 0.85rem; padding: 0 0.35rem; }
.sb2-links a { font-size: 0.74rem; color: var(--text-tertiary); text-decoration: none; line-height: 1.9; }
.sb2-links a:hover, .sb2-links a.active { color: var(--primary-text); }
.sb2-feedback { display: block; padding: 0 0.35rem; font-size: 0.74rem; line-height: 1.45; color: var(--text-tertiary); text-decoration: none; }
.sb2-feedback b { display: block; margin-top: 0.2rem; font-weight: 600; color: var(--primary-text); }
.sb2-feedback:hover b { text-decoration: underline; }

/* ── Section tabs (pages inside a merged section) ───────────────────────── */
.wtabs {
    display: flex; gap: 0.25rem; margin: -0.5rem 0 1.5rem; border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto; scrollbar-width: none;
}
.wtabs::-webkit-scrollbar { display: none; }
.wtab {
    flex-shrink: 0; padding: 0.65rem 0.9rem; margin-bottom: -1px;
    border-bottom: 2px solid transparent; color: var(--text-secondary);
    font-size: 0.88rem; font-weight: 600; text-decoration: none; white-space: nowrap;
    transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.wtab:hover { color: var(--text-primary); border-bottom-color: var(--border-focus); }
.wtab.active { color: var(--text-primary); border-bottom-color: var(--primary); }
.wtab:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; border-radius: 6px 6px 0 0; }

@media (max-width: 1024px) {
    .sidebar.sb2 { width: min(300px, 86vw); }
    .sb2-item { min-height: 44px; }
    .wtabs { margin-top: 0; }
}

/* ══════════════════════════════════════════════════════════════════════════
   TRADE REPLAY (trades.html + js/trade-replay.js)
   A side drawer, not a modal: the table stays visible beside it on desktop so
   ←/→ can walk through trades. Full-screen sheet on phones.
   ══════════════════════════════════════════════════════════════════════════ */
.trade-row, .trade-card { cursor: pointer; transition: background var(--dur-fast) var(--ease-out); }
.trade-row:hover td, .trade-row:focus-visible td { background: rgba(80, 210, 193, 0.06); }
.trade-row:focus-visible, .trade-card:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
.trade-row.is-replaying td { background: rgba(80, 210, 193, 0.12); }
.trade-card.is-replaying { border-color: var(--border-focus); }
.tr-replay-btn {
    display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.6rem;
    border: 1px solid var(--border-subtle); border-radius: var(--radius-pill);
    color: var(--primary-text); font: 600 0.72rem var(--font-body); white-space: nowrap;
}
.trade-row:hover .tr-replay-btn, .trade-card:hover .tr-replay-btn { border-color: var(--border-focus); background: rgba(80, 210, 193, 0.08); }
.tr-card-foot { justify-content: flex-end; }

.tr-backdrop { position: fixed; inset: 0; z-index: 900; background: rgba(0, 0, 0, 0.45); }
.tr-backdrop[hidden] { display: none; }
.tr-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 901;
    width: min(760px, 100vw); display: flex; flex-direction: column;
    background: var(--bg-sidebar); border-left: 1px solid var(--border-subtle);
    box-shadow: -18px 0 40px rgba(0, 0, 0, 0.35);
}
.tr-drawer[hidden] { display: none; }
body.tr-open { overflow: hidden; }
.tr-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-subtle); }
.tr-title { display: flex; align-items: baseline; gap: 0.75rem; min-width: 0; }
.tr-title h2 { margin: 0; font: 600 1.1rem var(--font-heading); }
.tr-pos { font-size: 0.78rem; color: var(--text-tertiary); white-space: nowrap; }
.tr-nav { display: flex; gap: 0.35rem; }
.tr-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
    border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); background: transparent;
    color: var(--text-secondary); cursor: pointer;
}
.tr-btn:hover:not(:disabled) { color: var(--primary-text); border-color: var(--border-focus); }
.tr-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.tr-btn:disabled { opacity: 0.35; cursor: default; }
.tr-body { flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }

.tr-sum { display: grid; grid-template-columns: minmax(10rem, auto) 1fr; gap: 1rem 1.5rem; align-items: start; }
.tr-coin { font-weight: 700; font-size: 1.05rem; }
.tr-net { font: 700 1.6rem var(--font-heading); margin-top: 0.4rem; font-variant-numeric: tabular-nums; }
.tr-k, .tr-sub { font-size: 0.74rem; color: var(--text-tertiary); }
.tr-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem 1.25rem; margin: 0; }
.tr-facts dt, .tr-exc dt { font-size: 0.74rem; color: var(--text-tertiary); }
.tr-facts dd, .tr-exc dd { margin: 0.1rem 0 0; font: 600 0.92rem var(--font-mono); font-variant-numeric: tabular-nums; }
.tr-facts dd.tr-sub, .tr-exc dd.tr-sub { font: 400 0.72rem var(--font-body); color: var(--text-tertiary); }

.tr-chart { position: relative; height: 340px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 0.5rem 0.25rem 0.25rem; background: var(--bg-card); }
.tr-chart canvas { width: 100% !important; height: 100% !important; }
.tr-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-tertiary); font-size: 0.85rem; text-align: center; padding: 1rem; }
.tr-loading[hidden] { display: none; }
.tr-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.75rem; color: var(--text-secondary); }
.tr-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.tr-legend span[hidden] { display: none; }
.tr-sw { display: inline-block; width: 16px; height: 0; border-top: 2px dashed; }
.tr-sw.is-entry { border-color: var(--primary); }
.tr-sw.is-exit { border-color: var(--text-primary); border-top-style: dotted; }
.tr-sw.is-sl { border-color: var(--danger); }
.tr-sw.is-tp { border-color: var(--success); }
.tr-sw.is-held { height: 10px; border: 0; background: rgba(80, 210, 193, 0.18); border-radius: 2px; }

.tr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.tr-card { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 1rem; background: var(--bg-card); }
.tr-card h3 { margin: 0 0 0.75rem; font: 600 0.92rem var(--font-heading); }
.tr-exc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin: 0; }
.tr-line { margin: 0.75rem 0 0; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }
.tr-line b { color: var(--text-primary); }
.tr-note { margin: 0.6rem 0 0; font-size: 0.72rem; color: var(--text-tertiary); }
.tr-muted { color: var(--text-tertiary); font-size: 0.85rem; line-height: 1.5; margin: 0; }
.tr-orders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.85rem; }
.tr-orders b { font-family: var(--font-mono); }
.tr-tag { display: inline-block; min-width: 2.2rem; margin-right: 0.5rem; padding: 0.1rem 0.4rem; border-radius: var(--radius-pill); text-align: center; font: 700 0.68rem var(--font-body); }
.tr-tag.is-sl { background: var(--danger-bg); color: var(--danger-text); }
.tr-tag.is-tp { background: var(--success-bg); color: var(--success-text); }

@media (max-width: 720px) {
    .tr-drawer { width: 100vw; border-left: 0; }
    .tr-head { padding: 0.75rem 1rem; }
    .tr-body { padding: 1rem; }
    .tr-sum { grid-template-columns: minmax(0, 1fr); }
    .tr-chart { height: 280px; }
    .tr-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Venue chips and side badges in overview tables: one size, one baseline. */
.ov-coin .venue-badge, .ov-table .badge { display: inline-block; padding: 0 0.35rem; line-height: 1.55; font-size: 0.62rem; border-radius: 4px; vertical-align: 1px; }
.ov-coin .venue-badge { margin-left: 0.35rem; }

/* Lower overview: two stacked columns rather than rows of paired panels. */
.ov-cols { align-items: start; }
.ov-col { display: flex; flex-direction: column; gap: var(--ov-gap); min-width: 0; }

/* Book split, under "What needs a look" (pinned to the panel bottom). */
#ovLookBody { display: flex; flex-direction: column; }
.ov-mix { margin-top: auto; padding-top: 1.1rem; border-top: 1px solid var(--border-subtle); }
.ov-mix-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.45rem; }
.ov-mix-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--bg-tertiary); gap: 2px; }
.ov-mix-bar b { display: block; height: 100%; }
.ov-mix-bar .is-long { background: var(--success); }
.ov-mix-bar .is-short { background: var(--danger); }
.ov-mix-legend { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.1rem 0.75rem; margin-top: 0.4rem; font: 600 0.72rem var(--font-mono); white-space: nowrap; }
.ov-mix-sub { margin: 1rem 0 0.35rem; }
.ov-mix-list { list-style: none; margin: 0; padding: 0; }
.ov-mix-list li {
    display: grid; align-items: center; column-gap: 0.6rem; height: 30px;
    grid-template-columns: 4.75rem 2.4rem minmax(2.5rem, 1fr) 4.25rem; font-size: 0.8rem;
}
.ov-mix-coin { display: flex; align-items: center; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; }
.ov-mix-coin .venue-badge { margin-left: 0.35rem; padding: 0 0.3rem; line-height: 1.5; font-size: 0.6rem; border-radius: 4px; }
.ov-mix-side { font-size: 0.72rem; font-weight: 600; }
.ov-mix-track { height: 6px; border-radius: 3px; background: var(--bg-tertiary); overflow: hidden; }
.ov-mix-track b { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.ov-mix-val { text-align: right; font: 600 0.8rem var(--font-mono); }
#ovLookBody > .ov-look, #ovLookBody > .ov-allclear { margin-bottom: 1.1rem; }

/* Last 30 days as a calendar: 7 weekday columns + a weekly total. */
.ov-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(3.5rem, 0.9fr); gap: 4px; }
.ov-cal-h { padding: 0 0 0.3rem; font-size: 0.68rem; font-weight: 600; color: var(--text-tertiary); text-align: center; }
.ov-cal-h:last-child { text-align: right; padding-right: 0.25rem; }
.ov-cal-day {
    position: relative; display: flex; flex-direction: column; justify-content: space-between;
    height: 3.25rem; padding: 0.3rem 0.4rem; border-radius: 6px; min-width: 0;
    background: var(--bg-tertiary); text-decoration: none; color: var(--text-primary);
}
.ov-cal-day em { font: normal 0.66rem var(--font-body); color: var(--text-secondary); white-space: nowrap; }
.ov-cal-day b { font: 600 0.74rem var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; overflow: hidden; }
.ov-cal-day.is-pos { background: color-mix(in srgb, var(--success) calc(var(--a) * 100%), transparent); }
.ov-cal-day.is-neg { background: color-mix(in srgb, var(--danger) calc(var(--a) * 100%), transparent); }
.ov-cal-day.is-pos em, .ov-cal-day.is-neg em { color: var(--text-primary); opacity: 0.8; }
.ov-cal-day.is-pad { background: transparent; }
.ov-cal-day.is-none { background: transparent; border: 1px dashed var(--border-subtle); }
.ov-cal-day.is-today { box-shadow: inset 0 0 0 2px var(--primary); }
a.ov-cal-day:hover { outline: 2px solid var(--border-focus); outline-offset: 1px; }
a.ov-cal-day:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.ov-cal-week {
    display: flex; align-items: center; justify-content: flex-end; padding-right: 0.25rem;
    font: 700 0.76rem var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap;
    border-left: 1px solid var(--border-subtle);
}
[data-theme="light"] .ov-cal-day.is-pos b, [data-theme="light"] .ov-cal-day.is-neg b { color: var(--text-primary); }
@media (max-width: 720px) {
    .ov-cal { gap: 3px; grid-template-columns: repeat(7, minmax(0, 1fr)) 2.9rem; }
    .ov-cal-day { height: 2.9rem; padding: 0.2rem 0.25rem; }
    .ov-cal-day em { font-size: 0.58rem; }
    .ov-cal-day b { font-size: 0.58rem; text-align: left; }
    .ov-cal-week { font-size: 0.62rem; }
}

/* Lane height control, pushed to the right end of the chart toolbar. */
.ov-tl-lanes { margin-left: auto; display: inline-flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.seg-sm .seg-item { padding: 0.3rem 0.65rem; font-size: 0.75rem; min-width: 2rem; justify-content: center; }
.seg-sm .seg-item:disabled { opacity: 0.4; cursor: not-allowed; }
@media (max-width: 720px) { .ov-tl-lanes { margin-left: 0; } }

/* ══════════════════════════════════════════════════════════════════════════
   PAGE CSS (merged from the 2026-10 redesign): positions
   ══════════════════════════════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════════════════════════════
   PAGE — Positions & risk (positions.html + js/positions.js, risk.html)
   Built on the overview vocabulary (.ov, .ov-now, .ov-table, .ov-runway,
   .ov-mix-*); only what that vocabulary lacks lives here, prefixed .pr-.
   Tables become one card per row under 900px, like .ov-book-table.
   ══════════════════════════════════════════════════════════════════════════ */

.pr-head-tags { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.pr-head-tags .ov-tag { cursor: help; }
.pr-count {
    display: inline-block; margin-left: 0.4rem; vertical-align: 2px;
    font: 500 0.78rem var(--font-mono); color: var(--text-tertiary);
}
.pr-count:empty { display: none; }

/* One badge size for every tag on the page: TP / SL / closest. */
.pr-k {
    display: inline-block; padding: 0 0.4rem; border-radius: 4px; line-height: 1.55;
    font: 700 0.62rem var(--font-body); letter-spacing: 0.04em; text-transform: uppercase;
    border: 1px solid var(--border-subtle); color: var(--text-secondary); vertical-align: 1px;
}
.pr-k.is-tp { color: var(--success-text); background: var(--success-bg); border-color: transparent; }
.pr-k.is-sl, .pr-k.is-watch { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

/* Plain-language line under a panel: text left, onward link right. */
.pr-ins {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.35rem 1rem;
    margin-top: 1rem; padding-top: 0.85rem; border-top: 1px solid var(--border-subtle);
    font-size: 0.84rem; line-height: 1.5; color: var(--text-secondary);
}
.pr-ins b { color: var(--text-primary); font-weight: 600; }
.pr-ins > span { flex: 1 1 18rem; min-width: 0; }
.pr-ins-pad { padding: 0 1.35rem 1rem; }
.pr-ins-pad .pr-ins:first-child { margin-top: 0; }
.pr-ins-pad[hidden] { display: none; }

.pr-foot { margin: 0; padding: 0.75rem 1.35rem 1rem; font-size: 0.76rem; line-height: 1.5; color: var(--text-tertiary); border-top: 1px solid var(--border-subtle); }
.pr-foot-page { padding: 0; border-top: 0; }

/* ── Liquidation ladder ─────────────────────────────────────────────────── */
.pr-ladder { min-height: 150px; }
.pr-ladder svg { display: block; overflow: visible; }
.pr-mark { cursor: pointer; outline: none; }
.pr-mark:hover circle, .pr-mark:focus-visible circle { stroke-width: 2.5; fill-opacity: 0.5; }
.pr-mark:focus-visible circle { stroke: var(--border-focus); }
.pr-readout {
    min-height: 1.6rem; margin-top: 0.4rem; font-size: 0.82rem; color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.pr-readout b { color: var(--text-primary); }
.pr-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 1.1rem; margin-top: 0.35rem; font-size: 0.75rem; color: var(--text-secondary); }
.pr-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.pr-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.pr-dot.is-long { background: color-mix(in srgb, var(--success) 30%, transparent); border: 1.5px solid var(--success); }
.pr-dot.is-short { background: color-mix(in srgb, var(--danger) 30%, transparent); border: 1.5px solid var(--danger); }
.pr-zone { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
.pr-zone.is-danger { background: color-mix(in srgb, var(--danger) 22%, transparent); }
.pr-zone.is-watch { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* ── Concentration ──────────────────────────────────────────────────────── */
.pr-stack { display: flex; gap: 2px; height: 22px; border-radius: 6px; overflow: hidden; background: var(--bg-tertiary); }
.pr-stack b { display: block; height: 100%; min-width: 2px; }
.pr-stack .is-long, .pr-leg i.is-long { background: var(--success); }
.pr-stack .is-short, .pr-leg i.is-short { background: var(--danger); }
.pr-stack .is-other, .pr-leg i.is-other { background: var(--text-tertiary); }
/* One legend column until the panel is wide enough that a ticker plus its
   venue tag never gets cut ("SKH", "GOL" at 1440). */
.pr-leg { list-style: none; margin: 0.9rem 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 1.5rem; }
@media (min-width: 1680px) { .pr-leg { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pr-leg li {
    display: grid; grid-template-columns: 10px minmax(0, 1fr) 2.6rem 4.5rem 3rem; align-items: center; column-gap: 0.6rem;
    height: 30px; font-size: 0.8rem; border-bottom: 1px solid var(--border-subtle);
}
.pr-leg i { width: 10px; height: 10px; border-radius: 2px; }
.pr-leg-coin { display: flex; align-items: center; min-width: 0; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; }
.pr-leg-coin .venue-badge { margin-left: 0.35rem; padding: 0 0.3rem; line-height: 1.5; font-size: 0.6rem; border-radius: 4px; }
.pr-leg-side { font-size: 0.72rem; font-weight: 600; }
.pr-leg-coin.is-wide { grid-column: 2 / 4; font-weight: 600; color: var(--text-secondary); }
.pr-leg-val, .pr-leg-pct { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pr-leg-val { font-weight: 600; }
.pr-leg-pct { color: var(--text-tertiary); font-size: 0.75rem; }
.pr-ls-head { margin-top: 1.25rem; }

/* ── Tables (positions / stress / orders / spot) ───────────────────────── */
.pr-two { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 0.1rem; line-height: 1.3; }
.pr-two > small { font-size: 0.72rem; color: var(--text-tertiary); }
.pr-pbar { display: inline-block; height: 4px; border-radius: 2px; margin-right: 0.4rem; vertical-align: middle; opacity: 0.8; }
.pr-pbar.is-up { background: var(--success); }
.pr-pbar.is-down { background: var(--danger); }
.pr-pos-table td, .pr-pos-table th { padding-left: 0.75rem; padding-right: 0.75rem; }
.pr-pos-table td { height: 52px; }
.pr-pos-table .ov-runway i.is-safe { display: none; }
.pr-pos-table .pos-act { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; }
.pr-pos-table td, .pr-pos-table th { padding-left: 0.6rem; padding-right: 0.6rem; }
@media (min-width: 901px) {
    .pr-pos-table .pos-act { width: 32px; padding: 0; }
    .pr-pos-table .pos-act-txt { display: none; }
}
.pr-pos-table tr.pos-row[hidden], .pr-pos-table tr.pr-tpsl[hidden], .pr-pos-table tr.pos-detail[hidden] { display: none; }
.pr-pos-table .pos-actions .pos-act { min-height: 32px; }
.pr-act-cell { width: 1%; }
.pr-pos-table td.tone-warn, .pr-stress-table .tone-warn { color: var(--accent-ink); }

.pr-tpsl > td { height: auto; padding-top: 0.4rem !important; padding-bottom: 0.5rem !important; background: rgba(80, 210, 193, 0.025); white-space: normal; }
.pr-tpsl > td:first-child { padding-left: 3.4rem !important; }
.pr-ord { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.45rem; margin-right: 1.5rem; font: 0.76rem var(--font-mono); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.pr-ord b { color: var(--text-primary); font-weight: 600; }

.pr-detail { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: 1.25rem; white-space: normal; }
.pr-detail-chart { min-width: 0; }
.pr-kv { margin: 0; align-self: start; }
.pr-kv > div { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.45rem 0; border-bottom: 1px solid var(--border-subtle); font-size: 0.8rem; }
.pr-kv > div:last-child { border-bottom: 0; }
.pr-kv dt { color: var(--text-secondary); }
.pr-kv dd { margin: 0; font-family: var(--font-mono); font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.pos-levels .lvl-tp { color: var(--success-text); }
.pos-levels .lvl-sl { color: var(--text-secondary); }

.pr-pos-head .panel-title { white-space: nowrap; }
.pr-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.9rem; }
.pr-filter { width: 11rem; min-height: 36px; padding: 0 0.75rem; font-size: 0.82rem; }
.pr-bands { font-size: 0.75rem; white-space: nowrap; }
.pr-bands .tone-warn { color: var(--accent-ink); }

.pr-stress-table td { height: 46px; }
.pr-wrap { white-space: normal !important; }
.pr-stress-table small, .pr-ord-table td.num small { margin-left: 0.35rem; font-size: 0.72rem; }
.pr-side { font-weight: 600; }
.pr-time { white-space: nowrap; color: var(--text-secondary); font-family: var(--font-mono); font-size: 0.8rem; }
.pr-ord-table td, .pr-spot-table td { height: 44px; }
.pr-spot-table tfoot td { font-weight: 600; color: var(--text-secondary); border-top: 1px solid var(--border-subtle); padding: 0.7rem 1rem; }
.pr-spot-table tfoot td:first-child { padding-left: 1.35rem; }

/* ── Risk console ───────────────────────────────────────────────────────── */
.pr-risk-grid { align-items: start; }
.pr-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
.pr-figs > div { min-width: 0; }
.pr-meter { position: relative; height: 8px; margin-top: 0.5rem; border-radius: 4px; background: var(--bg-tertiary); overflow: hidden; }
.pr-meter b { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.pr-meter.is-warn b { background: var(--accent); }
.pr-meter.is-danger b { background: var(--danger); }
.pr-meter-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.pr-meter-sub { display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.35rem; font: 0.74rem var(--font-mono); color: var(--text-tertiary); }
.pr-block { margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--border-subtle); }
.pr-score { display: flex; align-items: baseline; gap: 0.6rem; }
.pr-score .ov-v { font-size: 1.6rem; font-family: var(--font-heading); }
.pr-score-track { position: relative; height: 8px; margin: 0.6rem 0 0.35rem; border-radius: 4px;
    background: linear-gradient(90deg, var(--success) 0 30%, var(--accent) 30% 70%, var(--danger) 70% 100%); opacity: 0.85; }
.pr-score-track i { position: absolute; top: -4px; width: 3px; height: 16px; margin-left: -1.5px; border-radius: 2px; background: var(--text-primary); }
.pr-score-legend { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--text-tertiary); }
.pr-warn { margin-top: 0.75rem; padding: 0.6rem 0.85rem; border-radius: var(--radius-sm); background: var(--danger-bg); color: var(--danger-text); font-size: 0.8rem; }
.pr-mode { margin: 0.75rem 0 0; font-size: 0.8rem; line-height: 1.5; color: var(--text-secondary); }

/* Sizer form, restyled into the panel vocabulary. */
.pr-sizer { display: flex; flex-direction: column; gap: 1rem; }
.pr-field { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.pr-field > label, .pr-field > .ov-k { font-size: 0.75rem; font-weight: 500; color: var(--text-tertiary); }
.pr-field-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.pr-hint { font-size: 0.74rem; color: var(--text-tertiary); }
.pr-sizer .input-icon-wrapper { height: 44px; }
.pr-sizer .input-icon-wrapper:focus-within { box-shadow: 0 0 0 3px var(--primary-glow); }
.pr-sizer input[type=number]::-webkit-inner-spin-button,
.pr-sizer input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pr-dir { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.pr-dir .dir-btn { min-height: 44px; }
.pr-risk-row { display: flex; gap: 0.5rem; align-items: center; }
.pr-risk-row .ov-chip { flex: 1; justify-content: center; min-height: 44px; }
.pr-risk-row .input-icon-wrapper { width: 5.5rem; flex-shrink: 0; }
.pr-result { padding-top: 1rem; border-top: 1px solid var(--border-subtle); }
.pr-result-big { font-family: var(--font-heading); font-weight: 700; font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.15; font-variant-numeric: tabular-nums; margin-top: 0.2rem; }
.pr-result-list { margin: 0.9rem 0 0; }
.pr-result-list > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border-subtle); font-size: 0.84rem; }
.pr-result-list > div:last-child { border-bottom: 0; }
.pr-result-list dt { color: var(--text-secondary); }
.pr-result-list dd { margin: 0; font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.pr-result-list .tone-warn { color: var(--accent-ink); }
.pr-error { display: flex; gap: 0.5rem; align-items: center; padding: 0.6rem 0.85rem; border-radius: var(--radius-sm); background: var(--danger-bg); color: var(--danger-text); font-size: 0.8rem; }
.pr-error[hidden] { display: none; }

/* ── Cards under 900px ──────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .pr-detail { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
    .pr-pos-table thead, .pr-stress-table thead, .pr-ord-table thead, .pr-spot-table thead { display: none; }
    .pr-pos-table, .pr-pos-table tbody, .pr-stress-table, .pr-stress-table tbody,
    .pr-ord-table, .pr-ord-table tbody, .pr-spot-table, .pr-spot-table tbody, .pr-spot-table tfoot { display: block; }
    .pr-pos-table tr, .pr-stress-table tr, .pr-ord-table tr, .pr-spot-table tbody tr {
        display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.65rem 1rem;
        padding: 0.95rem 1rem; border-bottom: 1px solid var(--border-subtle); position: relative;
    }
    .pr-pos-table td, .pr-stress-table td, .pr-ord-table td, .pr-spot-table td {
        display: block; height: auto; padding: 0 !important; border: 0; white-space: normal; text-align: left;
    }
    .pr-pos-table td.num, .pr-stress-table td.num, .pr-ord-table td.num, .pr-spot-table td.num { text-align: left; }
    .pr-pos-table td[data-label]::before, .pr-stress-table td[data-label]::before,
    .pr-ord-table td[data-label]::before, .pr-spot-table td[data-label]::before {
        content: attr(data-label); display: block; margin-bottom: 0.15rem; font: 500 0.7rem var(--font-body); color: var(--text-tertiary);
    }
    .pr-stress-table td:first-child::before, .pr-ord-table td:nth-child(2)::before { display: none; }
    .pr-pos-table td:first-child, .pr-stress-table td:first-child, .pr-spot-table td:first-child, .pr-ord-table td:nth-child(2) { grid-column: 1 / -1; }
    .pr-ord-table td:first-child { grid-column: 1 / -1; order: 2; }
    .pr-ord-table td:nth-child(2) { order: 1; }
    .pr-ord-table td { order: 3; }
    .pr-pos-table tbody tr:hover td, .pr-stress-table tbody tr:hover td,
    .pr-ord-table tbody tr:hover td, .pr-spot-table tbody tr:hover td { background: none; }
    .pr-two { align-items: flex-start; }
    .pr-pos-table .ov-runway { justify-content: flex-start; }
    .pr-pos-table td.pr-act-cell { grid-column: 1 / -1; width: auto; }
    .pr-pos-table .pos-actions { justify-content: stretch; }
    .pr-pos-table .pos-actions .pos-act { flex: 1; min-height: 40px; }
    .pr-pos-table tr.pr-tpsl, .pr-pos-table tr.pos-detail, .pr-pos-table tr.pr-empty { display: block; padding: 0; }
    .pr-pos-table tr.pr-tpsl > td, .pr-pos-table tr.pos-detail > td, .pr-pos-table tr.pr-empty > td { display: block; padding: 0.6rem 1rem !important; }
    .pr-pos-table tr.pr-tpsl > td:first-child { padding-left: 1rem !important; }
    .pr-pos-table tr.pos-detail > td { padding: 0 !important; }
    .pr-pos-table tr.pos-row { border-bottom: 0; }
    .pr-pos-table tr.pos-row + tr.pos-row { border-top: 1px solid var(--border-subtle); }
    .pr-pos-table tr.pr-tpsl { border-bottom: 0; }
    .pr-ord { margin-right: 0; width: 100%; }
    .pr-spot-table tfoot tr { display: flex; justify-content: space-between; padding: 0.8rem 1rem; }
    .pr-spot-table tfoot td { padding: 0 !important; border: 0; }
    .pr-spot-table tfoot td:empty { display: none; }
    .pr-tools { width: 100%; }
    .pr-filter { flex: 1 1 10rem; width: auto; }
    /* Position cards: asset + side on one line, then a 3-up grid, so 40+
       positions stay scannable on a phone instead of ~400px each. */
    .pr-pos-table tr.pos-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.7rem 0.75rem; }
    .pr-pos-table tr.pos-row > td:first-child { grid-column: 1 / 3; align-self: center; }
    .pr-pos-table tr.pos-row > td:nth-child(2) { grid-column: 3; justify-self: end; align-self: center; white-space: nowrap; }
    .pr-pos-table tr.pos-row > td:nth-child(2)::before { display: none; }
    .pr-pos-table .pr-two > span { font-size: 0.82rem; }
    .pr-pos-table .ov-runway i { width: 32px; }
    /* Touch targets: 40px minimum on cards and controls. */
    .pr-pos-table .pos-actions .pos-act { min-height: 40px; }
    .pr-pos-table .pos-expand { width: 40px; height: 40px; margin: -10px -8px -10px -12px; }
    .pr-pos-table .pos-coin-link { display: inline-flex; align-items: center; min-height: 40px; }
    .pr-filter, .pr-tools .seg-item { min-height: 40px; }
    .pr .link-inline { display: inline-flex; align-items: center; min-height: 40px; }
    /* Nothing under 11px on phones. */
    .pr .badge, .pr .venue-badge, .pr .pr-k, .pr .ov-sev { font-size: 0.6875rem; }
    /* Stress test: scenario on top, then PnL / equity / closest in one row;
       "Past liquidation" only when something actually crosses. */
    .pr-stress-table tr { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem 0.75rem; padding: 0.8rem 1rem; }
    .pr-stress-table td.is-none { display: none; }
    .pr-stress-table td.pr-wrap { grid-column: 1 / -1; }
}
.pr-more {
    display: block; width: calc(100% - 2rem); min-height: 44px; margin: 0.75rem 1rem;
    border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: transparent;
    color: var(--primary-text); font: 600 0.85rem var(--font-body); cursor: pointer;
}
.pr-more:hover { border-color: var(--border-focus); background: rgba(80, 210, 193, 0.06); }
.pr-more:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.pr-more[hidden] { display: none; }
@media (max-width: 720px) {
    /* Open orders as two short lines: asset · type · side, then limit · size ·
       value. Placed time, filled % and reduce-only stay in the desktop table
       and on Order history (15 orders were 2,800px of 9-field cards). */
    .pr-ord-table tr { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem 0.75rem; padding: 0.75rem 1rem; }
    .pr-ord-table td:nth-child(1), .pr-ord-table td:nth-child(7), .pr-ord-table td:nth-child(9) { display: none; }
    .pr-ord-table td:nth-child(2) { grid-column: auto; order: 1; }
    .pr-ord-table td:nth-child(3) { order: 2; }
    .pr-ord-table td:nth-child(4) { order: 3; text-align: right; }
    .pr-ord-table td:nth-child(3)::before, .pr-ord-table td:nth-child(4)::before { display: none; }
    .pr-ord-table td:nth-child(5) { order: 4; }
    .pr-ord-table td:nth-child(6) { order: 5; }
    .pr-ord-table td:nth-child(8) { order: 6; text-align: right; }
    /* Spot holdings: one line per token (token · balance · value). */
    .pr-spot-table tbody tr { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem 0.75rem; padding: 0.65rem 1rem; align-items: end; }
    .pr-spot-table td:first-child { grid-column: auto; align-self: center; }
    .pr-spot-table td:nth-child(3), .pr-spot-table td:nth-child(5) { display: none; }
    .pr-spot-table td:nth-child(4) { text-align: right; }
    .pr-leg { grid-template-columns: minmax(0, 1fr); }
    .pr-figs, .pr-field-2 { grid-template-columns: minmax(0, 1fr); }
    .pr-bands { display: none; }
    .pr-detail-inner, .pr-detail { padding-left: 1rem; padding-right: 1rem; }
    .pr-foot { padding-left: 1rem; padding-right: 1rem; }
    .pr-ins-pad { padding: 0 1rem 1rem; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PAGE CSS (merged from the 2026-10 redesign): trades
   ══════════════════════════════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════════════════════════════
   PAGE — Trades & orders (trades.html, orders.html)
   Builds on the overview vocabulary (.ov, .ov-verdict, .ov-now, .ov-look,
   .ov-grid). Everything page-specific is prefixed .td-. Tokens only.
   ══════════════════════════════════════════════════════════════════════════ */

.td-window { font-size: 0.78rem; color: var(--text-tertiary); }
/* Two figures in one KPI (avg win / loss, longs / shorts): a step smaller, and
   when they must wrap it is after the slash, never inside an amount. */
.td-kpis .ov-v.is-pair { font-size: 1rem; }
.td-kpis .ov-v.is-pair span { white-space: nowrap; }

/* KPI strip: six cells on desktop, three on tablet, two on phones. */
.td-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.td-kpis.is-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1200px) { .td-kpis, .td-kpis.is-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Breakdown panels sit three across on wide screens. */
.td-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--ov-gap); }
@media (min-width: 1100px) { .td-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .td-grid > :last-child { grid-column: 1 / -1; } }
/* Three across only when each list keeps room for its PnL bar (sidebar eats ~260px). */
@media (min-width: 1760px) { .td-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .td-grid > :last-child { grid-column: auto; } }

/* ── Bucket lists (hold time, trade size) ───────────────────────────────── */
.td-buckets { display: flex; flex-direction: column; }
.td-brow {
    display: grid; align-items: center; column-gap: 0.75rem;
    grid-template-columns: 5rem minmax(2.5rem, 1fr) 3rem 3.25rem 5.25rem;
    height: 34px; font-size: 0.82rem; border-bottom: 1px solid var(--border-subtle);
}
.td-brow:last-child { border-bottom: 0; }
.td-brow.is-head { height: 28px; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-tertiary); }
.td-brow.is-empty { color: var(--text-tertiary); }
.td-blabel { font-weight: 600; white-space: nowrap; color: var(--text-primary); }
.td-brow.is-empty .td-blabel { color: var(--text-tertiary); font-weight: 500; }
.td-bnum { text-align: right; white-space: nowrap; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.td-brow.is-head .td-bnum { font-family: var(--font-body); }
.td-bnum.is-net { font-weight: 600; }
/* Net PnL bar grows out of a centre zero line, like .ov-mkt-track. */
.td-track { position: relative; height: 10px; }
.td-track::before { content: ''; position: absolute; left: 50%; top: -6px; bottom: -6px; width: 1px; background: var(--border-subtle); }
.td-track b { position: absolute; top: 0; bottom: 0; min-width: 2px; border-radius: 3px; }
.td-track b.is-pos { left: calc(50% + 1px); background: var(--success); border-top-left-radius: 0; border-bottom-left-radius: 0; }
.td-track b.is-neg { right: calc(50% + 1px); background: var(--danger); border-top-right-radius: 0; border-bottom-right-radius: 0; }
.td-note { margin: 0.85rem 0 0; font-size: 0.75rem; line-height: 1.45; color: var(--text-tertiary); }

.td-look-link {
    background: none; border: 0; padding: 0; cursor: pointer;
    font: inherit; font-weight: 600; color: var(--primary-text);
}
.td-look-link:hover { text-decoration: underline; }
.td-look-link:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; border-radius: 3px; }

/* ── Filter bar + pager ─────────────────────────────────────────────────── */
.td-filters {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
    padding: 0.85rem 1.35rem; border-bottom: 1px solid var(--border-subtle);
}
.td-filters .form-input { width: auto; min-width: 0; height: 38px; padding: 0 1.9rem 0 0.7rem; font-size: 0.8rem; }
.td-filters input.form-input { width: 7rem; padding-right: 0.7rem; }
.td-filters .td-spacer { flex: 1; }
.td-filters[hidden] { display: none; }
.td-btn {
    display: inline-flex; align-items: center; gap: 0.4rem; height: 38px; padding: 0 0.85rem;
    border-radius: var(--radius-sm); border: 1px solid var(--border-focus);
    background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary-text);
    font: 600 0.8rem var(--font-body); white-space: nowrap; cursor: pointer;
}
.td-btn:hover { background: color-mix(in srgb, var(--primary) 20%, transparent); }
.td-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.td-btn.is-quiet { background: transparent; border-color: var(--border-subtle); color: var(--text-secondary); }
.td-btn.is-quiet:hover { color: var(--text-primary); border-color: var(--border-focus); }
.td-btn[hidden] { display: none; }

.td-pager {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem;
    padding: 0.75rem 1.35rem; border-top: 1px solid var(--border-subtle);
}
.td-pager-info { font-size: 0.78rem; color: var(--text-tertiary); }
.td-pages { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.td-pages button {
    min-width: 36px; height: 36px; padding: 0 0.6rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle); background: transparent; color: var(--text-secondary);
    font: 500 0.8rem var(--font-mono); cursor: pointer;
}
.td-pages button:hover:not(:disabled) { color: var(--text-primary); border-color: var(--border-focus); }
.td-pages button[aria-current="page"] { color: var(--text-primary); background: color-mix(in srgb, var(--primary) 14%, transparent); border-color: var(--border-focus); }
.td-pages button:disabled { opacity: 0.35; cursor: default; }
.td-pages button:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.td-pages span { align-self: center; padding: 0 0.2rem; color: var(--text-tertiary); }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.td-table th.is-sort { cursor: pointer; user-select: none; }
.td-table th.is-sort:hover { color: var(--text-primary); }
.td-table th.is-sort:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
.td-table th .td-arrow { display: inline-block; width: 0.8em; margin-left: 0.2rem; opacity: 0.45; font-size: 0.85em; }
.td-table th[aria-sort="ascending"] .td-arrow, .td-table th[aria-sort="descending"] .td-arrow { opacity: 1; color: var(--primary-text); }
.td-table th.num { text-align: right; }
.td-table td { font-size: 0.82rem; }
.td-table .td-date { color: var(--text-tertiary); font-family: var(--font-mono); font-size: 0.78rem; }
.td-table .td-muted { color: var(--text-tertiary); }
.td-table .ov-coin { margin-right: 0; }
/* One badge size for side, status, TP/SL and reduce-only chips. */
.td .badge, .td-chip {
    display: inline-block; padding: 0 0.4rem; border-radius: 4px; vertical-align: 1px;
    font: 700 0.66rem/1.6 var(--font-body); letter-spacing: 0.02em; white-space: nowrap;
}
.td-chip { border: 1px solid var(--border-subtle); color: var(--text-secondary); font-weight: 600; margin-left: 0.3rem; }
.td-chip.is-tp { background: var(--success-bg); color: var(--success-text); border-color: transparent; }
.td-chip.is-sl { background: var(--danger-bg); color: var(--danger-text); border-color: transparent; }
.td-reason { margin-left: 0.35rem; font-size: 0.74rem; color: var(--text-tertiary); }
.td .venue-badge { margin-left: 0.3rem; }
.td-table td.td-act { width: 1%; padding-left: 0.25rem; }
.td-table tr.td-total td { border-top: 1px solid var(--border-focus); border-bottom: 0; background: color-mix(in srgb, var(--primary) 5%, transparent); font-weight: 600; }
.td-table tr.td-total:hover td { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.td-table tbody tr.td-total td { cursor: default; }
.td-empty td { white-space: normal; }
.td-empty .empty-state { padding: 2rem 1rem; }

/* ── Cards under 900px (pattern: .ov-book-table) ────────────────────────── */
@media (max-width: 900px) {
    .td-table thead { display: none; }
    .td-table, .td-table tbody { display: block; }
    .td-table tbody tr {
        display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem 1rem;
        padding: 0.9rem 1rem; border-bottom: 1px solid var(--border-subtle);
    }
    .td-table td { display: block; padding: 0 !important; border: 0; white-space: normal; text-align: left; min-width: 0; overflow-wrap: anywhere; }
    .td-table td.num { text-align: left; }
    .td-table td[data-label]::before {
        content: attr(data-label); display: block; margin-bottom: 0.15rem;
        font: 500 0.7rem var(--font-body); color: var(--text-tertiary);
    }
    .td-table tbody tr:hover td { background: none; }
    .td-table tr.td-total { grid-template-columns: minmax(0, 1fr) auto; }
    .td-table tr.td-total td { border-top: 0; background: none; }
    .td-table tr.td-total { background: color-mix(in srgb, var(--primary) 5%, transparent); }
    .td-table .td-hide-card { display: none; }

    /* Trades: asset · side · net on top, then date/held/size, entry/close/fee */
    .td-trades .td-c-asset { order: 1; }
    .td-trades .td-c-side { order: 2; }
    .td-trades .td-c-net { order: 3; text-align: right; font-size: 0.95rem; }
    .td-trades .td-c-date { order: 4; }
    .td-trades .td-c-held { order: 5; }
    .td-trades .td-c-size { order: 6; }
    .td-trades .td-c-entry { order: 7; }
    .td-trades .td-c-close { order: 8; }
    .td-trades .td-c-fee { order: 9; }
    .td-trades .td-c-pnl { display: none; }
    .td-trades .td-c-act { order: 10; grid-column: 1 / -1; width: auto; text-align: right; }
    .td-trades .td-c-asset, .td-trades .td-c-side { align-self: center; }

    /* Orders: asset · side · status on top */
    .td-orders .td-c-asset { order: 1; }
    .td-orders .td-c-side { order: 2; }
    .td-orders .td-c-status { order: 3; text-align: right; }
    .td-orders .td-c-date { order: 4; }
    .td-orders .td-c-type { order: 5; grid-column: span 2; }
    .td-orders .td-c-trigger { order: 6; }
    .td-orders .td-c-limit { order: 7; }
    .td-orders .td-c-filled { order: 8; }
    .td-orders .td-c-size { display: none; }
    .td-orders .td-c-asset, .td-orders .td-c-side { align-self: center; }

    .td-filters { padding: 0.75rem 1rem; }
    .td-filters .form-input, .td-filters input.form-input { flex: 1 1 8.5rem; }
    .td-filters .td-spacer { display: none; }
    .td-pager { padding: 0.75rem 1rem; }
    /* The desktop 1% width on the replay cell would push the button off the
       card's right edge; on cards it sizes to its content. */
    .td-table td.td-c-act { width: auto; }
    /* The empty state spans the card, not one grid column. */
    .td-table tbody tr.td-empty { display: block; }
    .td-table .tr-replay-btn { min-height: 40px; padding-left: 0.85rem; padding-right: 0.85rem; }
    /* Touch targets: 40px minimum. */
    .td-filters .form-input, .td-btn, .td-pages button, .td .notice-dismiss { min-height: 40px; }
    .td-pages button { min-width: 40px; }
    .td-look-link { display: inline-flex; align-items: center; min-height: 40px; }
    /* Nothing under 11px on phones. */
    .td .badge, .td .venue-badge, .td .ov-sev, .td .td-chip, .td-brow.is-head, .td-brow.is-head .td-bnum { font-size: 0.6875rem; }
}

@media (max-width: 720px) {
    .td-kpis, .td-kpis.is-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .td-brow { grid-template-columns: 4.6rem minmax(0, 1fr) 2.4rem 2.9rem 4.9rem; column-gap: 0.5rem; font-size: 0.78rem; }
}
@media (max-width: 420px) {
    .td-brow { grid-template-columns: 4.6rem 2.4rem 2.9rem minmax(0, 1fr); }
    .td-track, .td-trackh { display: none; }
    .td-table tbody tr { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.55rem 0.75rem; }
    /* Trade cards stay 3-up: the long close date takes two columns and
       Replay shares the fee row, so a card is four short rows. */
    .td-trades .td-c-date { grid-column: span 2; }
    .td-trades .td-c-act { grid-column: span 2; align-self: end; justify-self: end; }
    .td-orders .td-c-date { grid-column: span 2; }
    .td-orders .td-c-type { grid-column: span 1; }
}
@media (max-width: 900px) {
    .td-table tr.trade-row.is-replaying { background: color-mix(in srgb, var(--primary) 12%, transparent); }
    .td-table tr.trade-row.is-replaying td { background: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PAGE CSS (merged from the 2026-10 redesign): calendar
   ══════════════════════════════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════════════════════════════
   PAGE — Calendar & journal (calendar.html, day.html, journal.html)
   Builds on the overview vocabulary (.ov, .ov-k/.ov-v/.ov-s, .ov-now,
   .ov-table, .ov-chip). Heat cells use the same colour-mix as .ov-day: the
   cell sets --a (0..1), the class picks success or danger.
   ══════════════════════════════════════════════════════════════════════════ */

.cl-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.cl-dim { color: var(--text-tertiary); }
.cl-link { color: var(--primary-text); font-weight: 600; text-decoration: none; white-space: nowrap; }
.cl-link:hover { text-decoration: underline; }
.cl-link:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; border-radius: 3px; }
.cl-head-note { margin: 0; text-align: right; }
.cl-foot { margin: 0; }
.cl-notice { margin: 0; font-size: 0.875rem; color: var(--text-secondary); }
.cl-notice strong { color: var(--text-primary); }
.cl-h3 { margin: 0; font-size: 0.88rem; font-weight: 600; color: var(--text-primary); }

/* ── Header actions ─────────────────────────────────────────────────────── */
.cl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.cl-nav { display: inline-flex; align-items: center; gap: 0.15rem; padding: 0.2rem; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-card); }
.cl-nav-label { min-width: 9rem; text-align: center; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.cl-nav-btn {
    display: inline-grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0;
    border-radius: var(--radius-sm); color: var(--text-secondary); text-decoration: none; font-size: 1.1rem; line-height: 1;
    transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.cl-nav-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.cl-nav-btn.is-sm { width: 32px; height: 32px; border: 1px solid var(--border-subtle); }
.cl-nav-btn[aria-disabled="true"] { opacity: 0.35; pointer-events: none; }
.cl-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    min-height: 38px; padding: 0 0.9rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle); background: transparent; color: var(--text-primary);
    font: 600 0.82rem var(--font-body); text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.cl-btn:hover { border-color: var(--border-focus); background: rgba(80, 210, 193, 0.06); }
.cl-btn.is-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.cl-btn.is-primary:hover { filter: brightness(1.06); }
.cl-btn.is-danger { color: var(--danger-text); }
.cl-btn.is-sm { min-height: 36px; padding: 0 0.7rem; font-size: 0.78rem; }
.cl-nav-btn:focus-visible, .cl-btn:focus-visible, .cl-month:focus-visible, a.cl-cell:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

/* ── Data window callout ────────────────────────────────────────────────── */
.cl-window { margin: 0; align-items: center; }
.cl-window-link { text-decoration: none; white-space: nowrap; }

/* ── Year strip ─────────────────────────────────────────────────────────── */
.cl-year-title { display: flex; align-items: center; gap: 0.5rem; }
.cl-months { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)) minmax(0, 1.4fr); gap: 6px; }
.cl-month {
    display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 0.5rem 0.6rem;
    border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); text-decoration: none;
    transition: border-color var(--dur-fast) var(--ease-out);
}
.cl-month:hover { border-color: var(--border-focus); }
.cl-month.is-pos { background: color-mix(in srgb, var(--success) calc(var(--a, 0.2) * 100%), transparent); }
.cl-month.is-neg { background: color-mix(in srgb, var(--danger) calc(var(--a, 0.2) * 100%), transparent); }
.cl-month.is-current { box-shadow: 0 0 0 2px var(--primary); border-color: transparent; }
.cl-month.is-future { opacity: 0.45; }
.cl-month.is-total { background: var(--bg-tertiary); }
.cl-month-name { font-size: 0.72rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-month-name small { font-weight: 500; color: var(--text-tertiary); }
.cl-month-pnl { font: 600 0.78rem var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-month.is-idle .cl-month-pnl { color: var(--text-tertiary); }

/* ── KPI strip ──────────────────────────────────────────────────────────── */
.cl-kpis { overflow: hidden; }
.cl-kpis .ov-v { font-size: 1.15rem; }

/* ── Month grid ─────────────────────────────────────────────────────────── */
.cl-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(0, 0.9fr); gap: 6px; }
.cl-dows { margin-bottom: 6px; }
.cl-dow { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-tertiary); padding: 0 2px; }
.cl-dows .cl-wkcol { text-align: right; }

.cl-cell {
    position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 88px;
    padding: 7px 9px 8px; border: 1px solid var(--border-subtle); border-radius: 8px;
    text-decoration: none; color: var(--text-primary);
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
a.cl-cell:hover { border-color: var(--border-focus); box-shadow: 0 0 0 1px var(--border-focus); }
.cl-cell.is-pad { border-color: transparent; background: none; }
.cl-cell.is-pos { background-color: color-mix(in srgb, var(--success) calc(var(--a, 0.2) * 100%), transparent); }
.cl-cell.is-neg { background-color: color-mix(in srgb, var(--danger) calc(var(--a, 0.2) * 100%), transparent); }
.cl-cell.is-open { border-style: dashed; border-color: var(--border-focus); background: transparent; }
/* Account-PnL-only days: hatched so they never read as realized PnL. */
/* Quieter than realized days: softer fill, faint fine hatch. */
.cl-cell.is-acct.is-pos { background-color: color-mix(in srgb, var(--success) calc(var(--a, 0.2) * 55%), transparent); }
.cl-cell.is-acct.is-neg { background-color: color-mix(in srgb, var(--danger) calc(var(--a, 0.2) * 55%), transparent); }
.cl-cell.is-acct { background-image: repeating-linear-gradient(135deg, transparent 0 9px, color-mix(in srgb, var(--bg-app) 30%, transparent) 9px 10px); }
.cl-cell.is-none, .cl-cell.is-future, .cl-cell.is-gap { background: transparent; }
.cl-cell.is-future { opacity: 0.45; }
.cl-cell.is-gap { border-style: dotted; }
.cl-cell.is-none .cl-dn, .cl-cell.is-future .cl-dn, .cl-cell.is-gap .cl-dn { color: var(--text-tertiary); }
.cl-cell.is-today { box-shadow: inset 0 0 0 1px var(--primary); }
.cl-cell.is-today .cl-dn { color: var(--primary-text); }

.cl-dn { font: 600 0.72rem var(--font-mono); color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 12px; }
.cl-dn small { font: 500 0.66rem var(--font-body); }
.cl-pn {
    display: block; margin-top: auto; max-width: 100%;
    font: 600 0.88rem var(--font-mono); font-variant-numeric: tabular-nums;
    white-space: nowrap; overflow: hidden; text-overflow: clip;
}
.cl-pn-sm { font: 500 0.74rem var(--font-body); }
.cl-cm { display: block; min-height: 1.25em; font: 0.68rem var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; }
.cl-push { margin-top: auto; }
/* Journal marker: an amber square in the top-right corner. */
.cl-jm { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }
.cl-jm[hidden] { display: none; }

.cl-week { align-items: flex-end; text-align: right; background: var(--bg-tertiary); }
.cl-week .cl-dow { padding: 0; }

.cl-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; margin-top: 0.9rem; font-size: 0.75rem; color: var(--text-secondary); }
.cl-legend > span { display: inline-flex; align-items: center; gap: 4px; }
.cl-sw { display: inline-block; width: 14px; height: 10px; border-radius: 3px; border: 1px solid var(--border-subtle); }
.cl-sw.is-pos { background-color: color-mix(in srgb, var(--success) calc(var(--a, 0.3) * 100%), transparent); }
.cl-sw.is-neg { background-color: color-mix(in srgb, var(--danger) calc(var(--a, 0.3) * 100%), transparent); }
.cl-sw.is-open { border: 1px dashed var(--border-focus); }
.cl-sw.is-acct { background-image: repeating-linear-gradient(135deg, transparent 0 3px, var(--bg-app) 3px 4px); }
.cl-sw-jm { width: 8px; height: 8px; border: 0; border-radius: 2px; background: var(--accent); }

/* Weekday row + streaks */
.cl-sub-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; margin: 1.35rem 0 0.6rem; padding-top: 1.1rem; border-top: 1px solid var(--border-subtle); }
.cl-sub-head .ov-s { margin: 0; }
.cl-wd { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 0.55rem 0.6rem; border: 1px solid var(--border-subtle); border-radius: 8px; }
.cl-wd.is-pos { background: color-mix(in srgb, var(--success) calc(var(--a, 0.2) * 100%), transparent); }
.cl-wd.is-neg { background: color-mix(in srgb, var(--danger) calc(var(--a, 0.2) * 100%), transparent); }
.cl-wd .cl-pn { margin-top: 0; font-size: 0.82rem; }
.cl-wd.is-note { justify-content: flex-end; align-items: flex-end; text-align: right; background: var(--bg-tertiary); }
.cl-streaks { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; margin: 1rem 0 0; font-size: 0.8rem; }
.cl-streaks > div { display: flex; align-items: baseline; gap: 0.5rem; }
.cl-streaks dt { color: var(--text-tertiary); }
.cl-streaks dd { margin: 0; color: var(--text-secondary); }
.cl-streaks b { font: 600 0.82rem var(--font-mono); color: var(--text-primary); }
.cl-streaks b.tone-up { color: var(--success-text); }
.cl-streaks b.tone-down { color: var(--danger-text); }
.cl-streaks .cl-streak-note { flex-basis: 100%; font-size: 0.74rem; }
.cl-streaks .cl-streak-note dd { color: var(--text-tertiary); }

.cl-chart { position: relative; height: 200px; }

/* ── Day page ───────────────────────────────────────────────────────────── */
.cl-chart-lg { position: relative; height: 240px; }
.cl-axis-note { margin-top: 0.5rem; }
.cl-trades .cl-net { font-weight: 600; }
.cl-trades tfoot td { font-weight: 700; border-top: 1px solid var(--border-subtle); border-bottom: 0; background: rgba(80, 210, 193, 0.05); }
.cl-dir { display: inline-block; min-width: 6.5rem; color: var(--text-secondary); }
.cl-dir.is-close { color: var(--text-primary); }
.cl-more { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.75rem 1.35rem; border-top: 1px solid var(--border-subtle); }
.cl-more[hidden], .cl-trades tr[hidden], .cl-kpis[hidden], .cl-filters[hidden] { display: none !important; }
#clRowsMore { justify-content: center; }

/* Journal notes (day page panel + journal list) */
.cl-notes { display: flex; flex-direction: column; gap: 0.75rem; }
.cl-note { padding: 0.85rem 1rem; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--bg-tertiary); }
.cl-note-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.cl-note h3 { margin: 0; font-family: var(--font-heading); font-size: 0.98rem; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.cl-note-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; margin: 0.45rem 0 0.55rem; font-size: 0.75rem; color: var(--text-tertiary); }
.cl-note p { margin: 0; color: var(--text-secondary); font-size: 0.85rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.cl-note-acts { display: flex; gap: 0.35rem; flex-shrink: 0; }

.cl-cat { display: inline-flex; align-items: center; height: 22px; padding: 0 0.6rem; border-radius: var(--radius-pill); border: 1px solid var(--border-subtle); font-size: 0.7rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.cl-cat.is-win { color: var(--success-text); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.cl-cat.is-loss { color: var(--danger-text); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.cl-cat.is-lesson { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

.cl-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem 1rem; }
.cl-form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.75rem; font-weight: 500; color: var(--text-tertiary); min-width: 0; }
.cl-form .is-wide { grid-column: 1 / -1; }
.cl-form .form-input { padding: 0.55rem 0.7rem; min-height: 38px; font-size: 0.85rem; }
.cl-form textarea.form-input { resize: vertical; min-height: 7rem; line-height: 1.5; }
.cl-form-acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }
.cl-form[hidden] { display: none; }
.cl-local { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: 0.75rem; color: var(--text-tertiary); }
.cl-local::before { content: ''; flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* ── Journal page ───────────────────────────────────────────────────────── */
.cl-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; padding: 0.85rem 1.35rem; border-bottom: 1px solid var(--border-subtle); }
.cl-filters .ov-chip small { font: 500 0.7rem var(--font-mono); color: var(--text-tertiary); }
.cl-search { margin-left: auto; width: 13rem; min-height: 36px; padding: 0 0.75rem !important; font-size: 0.82rem; }
.cl-jtable td { vertical-align: top; }
.cl-jtable .cl-jtitle { font-weight: 600; color: var(--text-primary); white-space: normal; min-width: 10rem; overflow-wrap: anywhere; }
.cl-jtable .cl-jtext { white-space: normal; max-width: 26rem; min-width: 12rem; color: var(--text-secondary); font-size: 0.8rem; line-height: 1.5; overflow-wrap: anywhere; }
.cl-jtable .cl-jlink { white-space: normal; min-width: 8rem; font-size: 0.78rem; color: var(--text-secondary); }
.cl-jtable .cl-acts { white-space: nowrap; text-align: right; }
.cl-jday { font: 600 0.82rem var(--font-mono); color: var(--text-primary); text-decoration: none; }
.cl-jday:hover { color: var(--primary-text); }
.cl-modal { max-width: min(640px, 94vw) !important; width: 94%; }
/* Above the fixed partner strip (101) and mobile header, which covered the modal's title. */
#jModal { z-index: 1050; }
/* ponytail: shared .modal-overlay sits at z-index 100, under the partner strip on every page; raise it there if other modals show the same overlap. */
.cl-modal-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.cl-modal-head h3 { margin: 0; font-family: var(--font-heading); }

/* ── Tablet ─────────────────────────────────────────────────────────────── */
/* Five KPI cards on a tablet: 3 + 2 with the last one wide, not 4 + a lone one. */
@media (min-width: 721px) and (max-width: 1100px) {
    .cl .ov-now:has(> .ov-now-cell:nth-child(5):last-child),
    .an .ov-now:has(> .ov-now-cell:nth-child(5):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .cl .ov-now > .ov-now-cell:nth-child(5):last-child,
    .an .ov-now > .ov-now-cell:nth-child(5):last-child { grid-column: span 2; }
}
@media (max-width: 1100px) {
    .cl-months { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .cl-month.is-total { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: baseline; }
}
/* "Oct · partial" doesn't fit a month tile at any width; the panel subtitle
   already says where the data starts. */
.cl-month-name small { display: none; }

/* Journal table becomes cards */
@media (max-width: 900px) {
    .cl-cards thead { display: none; }
    .cl-cards, .cl-cards tbody, .cl-cards tfoot { display: block; }
    .cl-cards tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: 0.55rem 1rem; padding: 0.9rem 1rem; border-bottom: 1px solid var(--border-subtle); }
    .cl-cards tbody tr:last-child { border-bottom: 0; }
    .cl-cards td { display: block; padding: 0 !important; border: 0 !important; white-space: normal; text-align: left !important; min-width: 0 !important; max-width: none !important; }
    .cl-cards td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 0.15rem; font: 500 0.7rem var(--font-body); color: var(--text-tertiary); }
    .cl-cards td.is-wide { grid-column: 1 / -1; }
    .cl-cards td:empty { display: none; }
    .cl-cards tbody tr:hover td { background: none; }
    .cl-cards tfoot tr { background: rgba(80, 210, 193, 0.05); }
    .cl-search { margin-left: 0; width: 100%; }
}

/* ── Phone ──────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
    .cl-actions { width: 100%; }
    .cl-nav { flex: 1; justify-content: space-between; }
    .cl-nav-label { min-width: 0; }
    .cl-months { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .cl-head-note { text-align: left; }
    /* The week column costs an eighth of a width a phone doesn't have. */
    .cl-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
    .cl-wkcol { display: none !important; }
    .cl-cell { min-height: 58px; padding: 4px 4px 5px; border-radius: 6px; }
    .cl-cm { display: none; }
    .cl-cell .cl-push { display: none; }
    /* 11px floor for phone text; the fit script compacts figures that overflow. */
    .cl-dn { font-size: 0.7rem; padding-right: 8px; }
    .cl-dn small { display: none; }
    .cl-pn { font-size: 0.7rem; letter-spacing: -0.03em; }
    .cl-pn-sm { font-size: 0.7rem; }
    .cl-dow { font-size: 0.7rem; letter-spacing: 0.02em; }
    .cl-nav-btn { width: 40px; height: 40px; }
    .cl-btn, .cl-btn.is-sm { min-height: 40px; }
    .cl-window-link { min-height: 40px; display: inline-flex; align-items: center; }
    /* Standalone text links: a taller hit area without moving the layout. */
    .cl-link { display: inline-block; padding: 0.7rem 0; margin: -0.7rem 0; }
    .cl .seg-item { min-height: 40px; }
    .cl .venue-badge { font-size: 0.7rem; }
    .cl-jm { top: 5px; right: 4px; width: 5px; height: 5px; }
    /* Weekdays: seven rows (day · avg · days) instead of seven squeezed tiles. */
    .cl-wds { grid-template-columns: minmax(0, 1fr); gap: 4px; }
    .cl-wd { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) auto; align-items: baseline; gap: 0.75rem; padding: 0.5rem 0.75rem; }
    .cl-wd .ov-k { font-size: 0.75rem; }
    .cl-wd .cl-pn { font-size: 0.82rem; }
    .cl-wd .cl-cm { display: block; font-size: 0.7rem; text-align: right; }
    .cl-wd.is-empty { display: none; }
    .cl-form { grid-template-columns: minmax(0, 1fr); }
    .cl-note-head { flex-direction: column; }
    .cl-filters { padding: 0.75rem 1rem; }
    .cl-more { padding: 0.75rem 1rem; flex-direction: column; align-items: flex-start; }
    #clRowsMore { align-items: stretch; }
    /* Day trades: two quiet lines per order instead of an eight-label card.
       Market · direction · net, then time · size · price. Realized and fee
       stay in the desktop table and the totals row. */
    /* Fixed thirds, so the direction column lines up row to row. */
    .cl-trades tbody tr { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 0.2rem 0.75rem; padding: 0.6rem 1rem; }
    .cl-trades tbody td[data-label]::before { display: none; }
    .cl-trades tbody td[data-label="Realized"], .cl-trades tbody td[data-label="Fee"] { display: none; }
    .cl-trades tbody td[data-label="Market"] { grid-area: 1 / 1; }
    .cl-trades tbody td[data-label="Direction"] { grid-area: 1 / 2; }
    .cl-trades tbody td[data-label="Net"] { grid-area: 1 / 3; text-align: right !important; }
    .cl-trades tbody td[data-label="Time"] { grid-area: 2 / 1; }
    .cl-trades tbody td[data-label="Size"] { grid-area: 2 / 2; }
    .cl-trades tbody td[data-label="Price"] { grid-area: 2 / 3; text-align: right !important; }
    .cl-trades tbody td[data-label="Time"], .cl-trades tbody td[data-label="Size"], .cl-trades tbody td[data-label="Price"] { font-size: 0.75rem; color: var(--text-tertiary); }
    .cl-trades .cl-dir { min-width: 0; }
    .cl-trades tbody td[data-label="Size"]::before { display: inline; content: 'size '; margin: 0; font: inherit; }
    .cl-trades tbody td[data-label="Price"]::before { display: inline; content: '@ '; margin: 0; font: inherit; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PAGE CSS (merged from the 2026-10 redesign): analytics
   ══════════════════════════════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════════════════════════════
   PAGE — Analytics (performance.html, drawdown.html, sessions.html)
   Builds on the overview vocabulary (.ov, .ov-k/.ov-v/.ov-s, .ov-now,
   .ov-mkt, .ov-table/.ov-book-table, .ov-look). Only page-specific pieces
   live here, prefixed .an-. Shared markup macros: templates/_analytics.html.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Source tag: full history vs fills window ───────────────────────────── */
.an-src {
    display: inline-flex; align-items: center; flex-shrink: 0;
    height: 1.25rem; padding: 0 0.45rem; margin-left: 0.4rem; vertical-align: 1px;
    border: 1px solid var(--border-subtle); border-radius: 5px;
    font: 600 0.62rem/1 var(--font-body); letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--text-tertiary); white-space: nowrap;
}
.an-src.is-window { color: var(--accent); border-color: var(--accent-soft); }
/* Amber text is 1.8:1 on white; light theme uses the ink shade (6.5:1). */
[data-theme="light"] .an-src.is-window, [data-theme="light"] .an .tone-warn, [data-theme="light"] .cl .tone-warn { color: var(--accent-ink); }
.panel-header > .an-src { margin-left: 0; }
.an-foot { padding: 0.75rem 1.35rem; border-top: 1px solid var(--border-subtle); }
.an-foot .an-src { margin: 0 0.35rem 0 0; }

/* ── In-page jump links ─────────────────────────────────────────────────── */
.an-jump { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.an-jump a {
    display: inline-flex; align-items: center; min-height: 36px; padding: 0 0.85rem;
    border: 1px solid var(--border-subtle); border-radius: var(--radius-pill);
    color: var(--text-secondary); font-size: 0.8rem; font-weight: 600; text-decoration: none;
    transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.an-jump a:hover { color: var(--text-primary); border-color: var(--border-focus); }
.an-jump a:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.an .panel[id] { scroll-margin-top: 1rem; }

/* ── Scorecard ──────────────────────────────────────────────────────────── */
.an-sc { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; }
.an-sc-main { padding: 0.25rem 1.35rem 0.5rem; border-right: 1px solid var(--border-subtle); min-width: 0; }
.an-overall { display: flex; align-items: center; gap: 1.1rem; padding: 0.9rem 0; border-bottom: 1px solid var(--border-subtle); }
.an-overall-grade { flex: 0 0 auto; min-width: 2.6rem; font: 700 2.6rem/1 var(--font-heading); text-align: center; }
.an-overall-title { font: 600 1rem var(--font-heading); color: var(--text-primary); }

.an-dims { display: flex; flex-direction: column; }
.an-dim {
    display: grid; align-items: center; column-gap: 1rem;
    grid-template-columns: 11.5rem minmax(5rem, 9rem) 2rem 1.75rem minmax(0, 1fr);
    padding: 0.7rem 0; border-bottom: 1px solid var(--border-subtle); font-size: 0.84rem;
}
.an-dim:last-child { border-bottom: 0; }
.an-dim-name { font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.an-dim-src { display: block; margin-top: 0.2rem; }
.an-dim-src .an-src { margin-left: 0; }
.an-dim-score { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-secondary); text-align: right; }
.an-dim-why { color: var(--text-secondary); line-height: 1.45; min-width: 0; }
.an-dim-why .link-inline { white-space: nowrap; font-weight: 600; }

.an-grade { font: 700 1.05rem/1 var(--font-heading); text-align: center; }
.is-good.an-grade, .is-good.an-overall-grade { color: var(--primary-text); }
.is-watch.an-grade, .is-watch.an-overall-grade { color: var(--accent); }
.is-bad.an-grade, .is-bad.an-overall-grade { color: var(--danger-text); }
.is-none.an-grade, .is-none.an-overall-grade { color: var(--text-tertiary); }

/* Score / share meter: one height everywhere */
.an-meter { display: block; height: 8px; border-radius: 4px; background: var(--bg-tertiary); overflow: hidden; }
.an-meter > b { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.an-meter.is-watch > b { background: var(--accent); }
.an-meter.is-bad > b { background: var(--danger); }
.an-meter.is-good > b { background: var(--primary); }

/* KPI list beside the scorecard */
.an-kpis { margin: 0; display: flex; flex-direction: column; min-width: 0; }
.an-kpi {
    display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem;
    padding: 0.7rem 1.25rem; border-bottom: 1px solid var(--border-subtle);
}
.an-kpi:last-child { border-bottom: 0; }
.an-kpi dt { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; min-width: 0; }
.an-kpi dt .an-src { margin-left: 0.3rem; }
.an-kpi dt small { display: block; margin-top: 0.15rem; font-size: 0.7rem; color: var(--text-tertiary); line-height: 1.35; }
.an-kpi dd {
    margin: 0; font: 600 0.98rem var(--font-mono); font-variant-numeric: tabular-nums;
    color: var(--text-primary); white-space: nowrap; text-align: right;
}

/* ── Long vs short ──────────────────────────────────────────────────────── */
.an-wr { display: flex; flex-direction: column; gap: 0.15rem; margin-bottom: 1rem; }
.an-wr-row {
    display: grid; align-items: center; column-gap: 1rem;
    grid-template-columns: 9.5rem minmax(0, 1fr) 6rem; height: 34px; font-size: 0.84rem;
}
.an-wr-name { color: var(--text-secondary); white-space: nowrap; }
.an-wr-val { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.an-dir-table { border-top: 1px solid var(--border-subtle); }
.an .an-dir-table th:first-child, .an .an-dir-table td:first-child { padding-left: 0; }
.an .an-dir-table th:last-child, .an .an-dir-table td:last-child { padding-right: 0; }
.an-side { font-weight: 600; color: var(--text-primary); }
.an-strong { font-weight: 700; }
.an-total td { border-top: 1px solid var(--border-subtle); }

/* ── Monthly grid: year rows x 12 months + year total ───────────────────── */
.an-mg { display: flex; flex-direction: column; gap: 3px; }
.an-mg-row { display: grid; grid-template-columns: 3.5rem repeat(12, minmax(0, 1fr)) minmax(0, 1.25fr); gap: 3px; }
.an-mg-head { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-tertiary); }
.an-mg-head > span { padding: 0 0.4rem 0.3rem; text-align: right; }
.an-mg-head > span:first-child { text-align: left; }
.an-mg-year { display: flex; align-items: center; font-weight: 600; font-size: 0.84rem; color: var(--text-primary); }
.an-mg-cell {
    display: flex; align-items: center; justify-content: flex-end; min-height: 36px; padding: 0 0.4rem;
    border-radius: 5px; background: var(--bg-tertiary);
    font: 500 0.74rem var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden;
}
.an-mg-cell em { display: none; font-style: normal; }
.an-mg-cell.is-none { background: transparent; border: 1px dashed var(--border-subtle); color: var(--text-tertiary); }
.an-mg-total { font-weight: 700; background: color-mix(in srgb, var(--primary) 9%, transparent); }
.an-insights { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--border-subtle); }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.an-table-wrap { overflow-x: auto; }
.an .ov-coin { display: inline-flex; align-items: center; gap: 0.35rem; text-decoration: none; }
.an .ov-coin .venue-badge { padding: 0 0.3rem; line-height: 1.5; font-size: 0.6rem; border-radius: 4px; }

/* ── Drawdown ───────────────────────────────────────────────────────────── */
.an-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.5rem; }
.an-pair .ov-v { font-size: 1.15rem; }
.an-eq-head { flex-wrap: wrap; gap: 0.75rem; }
.an-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; margin-bottom: 0.75rem; font-size: 0.75rem; color: var(--text-tertiary); }
.an-legend > span { display: inline-flex; align-items: center; gap: 0.45rem; }
.an-sw { display: inline-block; width: 14px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.an-sw.is-line { height: 0; border-top: 2px solid var(--primary); border-radius: 0; }
.an-sw.is-peak { height: 0; border-top: 1px dashed var(--text-tertiary); border-radius: 0; }
.an-sw.is-dd { background: var(--danger-bg); border-top: 2px solid var(--danger); }
.an-sw.is-flow { width: 11px; height: 10px; border-radius: 0; background: var(--accent); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.an-flows { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-subtle); }
/* Row even on phones, where .ov-look-item stacks: stacked, the label's 6.5rem
   flex-basis became a 6.5rem-tall gap. */
.an-flows .ov-look-item { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; }
/* The signed amount already says which way money moved; the label is a quiet word, not a pill. */
.an-flows .ov-sev { flex: 0 0 6.5rem; margin: 0; padding: 0; background: none; border: 0; color: var(--text-tertiary); letter-spacing: 0.05em; justify-content: flex-start; text-align: left; }
.an-flows + .ov-s { margin-top: 0.6rem; }
.an-ep-table .badge { font-size: 0.68rem; }
.an-card-only { display: none; }

/* ── Sessions ───────────────────────────────────────────────────────────── */
.an-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; font-size: 0.8rem; color: var(--text-tertiary); }
.an-meta > span { display: inline-flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.an-meta .an-src { margin-left: 0; }
.an-meta > .an-tz { flex-wrap: nowrap; align-items: flex-start; }
.an-tz svg { color: var(--primary-text); flex-shrink: 0; margin-top: 0.15rem; }
.an-tz b { color: var(--text-primary); font-weight: 600; }

.an-counts-wrap { margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--border-subtle); }
.an-counts { display: grid; gap: 3px; margin-top: 0.5rem; }
.an-counts-24 { grid-template-columns: repeat(24, minmax(0, 1fr)); }
.an-counts-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.an-counts > span {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem;
    min-height: 40px; border-radius: 4px;
    background: color-mix(in srgb, var(--primary) calc(var(--a, 0.1) * 100%), transparent);
    font: 600 0.7rem var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-primary);
}
.an-counts-7 > span { background: var(--bg-tertiary); min-height: 52px; font-size: 0.8rem; }
.an-counts > span.is-zero { background: transparent; color: var(--text-tertiary); opacity: 0.6; }
.an-counts em { font: normal 0.6rem var(--font-mono); color: var(--text-tertiary); }
.an-counts small { font: 500 0.66rem var(--font-mono); color: var(--text-secondary); }

.an-heat-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.an-heat { width: 100%; min-width: 640px; table-layout: fixed; border-collapse: separate; border-spacing: 3px; }
.an-heat th { font: 600 0.66rem var(--font-mono); color: var(--text-tertiary); padding: 0 0 0.2rem; text-align: center; }
.an-heat thead th:first-child, .an-heat tbody th { width: 2.75rem; }
.an-heat tbody th {
    position: sticky; left: 0; z-index: 1; background: var(--bg-card);
    text-align: left; font-family: var(--font-body); font-size: 0.72rem; padding: 0 0.4rem 0 0;
}
.an-heat .session-cell { width: auto; min-width: 0; height: 30px; }
.an-heat-key { display: inline-block; width: 14px; height: 14px; min-width: 0; vertical-align: middle; }

/* ── Tablet ─────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .an-sc { grid-template-columns: minmax(0, 1fr); }
    .an-sc-main { border-right: 0; border-bottom: 1px solid var(--border-subtle); }
    .an-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .an-kpi { box-shadow: 1px 0 0 var(--border-subtle); }
    .an-kpi:last-child { border-bottom: 1px solid var(--border-subtle); }
}

@media (max-width: 900px) {
    .an-dim { grid-template-columns: minmax(0, 1fr) 2rem 1.75rem; row-gap: 0.45rem; }
    .an-dim-name { grid-column: 1; }
    .an-dim-score { grid-column: 2; grid-row: 1; }
    .an-dim .an-grade { grid-column: 3; grid-row: 1; }
    .an-dim .an-meter { grid-column: 1 / -1; grid-row: 2; }
    .an-dim-why { grid-column: 1 / -1; grid-row: 3; }
    .an-dim-src { display: inline; margin: 0 0 0 0.4rem; }

    /* Month grid: one card per year, months in a 6 x 2 grid with their names */
    .an-mg-head { display: none; }
    .an-mg { gap: 1rem; }
    .an-mg-row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .an-mg-year { grid-column: 1 / 4; min-height: 32px; }
    .an-mg-total { grid-column: 4 / -1; grid-row: 1; }
    .an-mg-cell { flex-direction: column; align-items: flex-end; justify-content: center; min-height: 44px; }
    .an-mg-cell em { display: block; font: 600 0.6rem var(--font-body); color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; }
    .an-mg-total { flex-direction: row; justify-content: space-between; align-items: center; }
    .an-mg-total em { font-size: 0.66rem; }

    .an-table-wrap { overflow-x: visible; }
    .an-card-only { display: inline; color: var(--text-tertiary); font-weight: 500; }
    .an-ep-table td:first-child { font-weight: 600; }
}

/* ── Phone ──────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
    .an-sc-main { padding: 0.25rem 1rem 0.5rem; }
    .an-kpis { grid-template-columns: minmax(0, 1fr); }
    .an-kpi { padding: 0.7rem 1rem; box-shadow: none; }
    .an-kpi:last-child { border-bottom: 0; }
    .an-foot { padding: 0.75rem 1rem; }
    .an-overall-grade { font-size: 2.1rem; min-width: 2.1rem; }
    .an-wr-row { grid-template-columns: 7.5rem minmax(0, 1fr) 5.5rem; column-gap: 0.75rem; }
    .an-mg-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .an-mg-year { grid-column: 1 / 3; }
    .an-mg-total { grid-column: 3 / -1; }
    .an-pair { grid-template-columns: minmax(0, 1fr); }
    .an-counts-24 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
    /* Phone cards keep the three figures that answer "how did this market go";
       W/L, fees, avg, best and worst stay in the desktop table. */
    .an-asset-table tr { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0.7rem 1rem; gap: 0.4rem 1rem; }
    .an-asset-table td[data-label="W / L"], .an-asset-table td[data-label="Fees"], .an-asset-table td[data-label="Avg / trade"],
    .an-asset-table td[data-label="Best"], .an-asset-table td[data-label="Worst"] { display: none; }
    .an-ep-table tr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    /* Day x hour: 24 narrow columns fit a phone, so the busy hours aren't scrolled off-screen. */
    .an-heat { min-width: 0; border-spacing: 2px; }
    .an-heat thead th:first-child, .an-heat tbody th { width: 2.1rem; }
    .an-heat thead th:not(:first-child) { font-size: 0; }
    .an-heat thead th:nth-child(3n+2) { font-size: 0.55rem; overflow: visible; }
    .an-heat .session-cell { height: 24px; border-radius: 3px; }
    .an-counts-7 > span { min-height: 48px; font-size: 0.72rem; }
    /* Section links wrap (two rows) rather than scroll half-hidden off the edge. */
    .an-jump a { min-height: 40px; }
    /* 11px floor for phone text. */
    .an-src { font-size: 0.7rem; height: 1.35rem; }
    .an-mg-cell em, .an-counts em, .an-counts small { font-size: 0.7rem; }
    .an-heat thead th:nth-child(3n+2) { font-size: 0.7rem; }
    .an-heat tbody th { font-size: 0.72rem; }
    .an .ov-mkt-head, .an .ov-sev, .an .venue-badge, .an-ep-table .badge { font-size: 0.7rem; }
    .an .seg-item { min-height: 40px; }
    /* Row links (markets, assets) and inline links: taller hit area, same layout. */
    .an .ov-mkt-coin, .an .ov-coin, .an-meta .link-inline { display: inline-flex; padding: 0.65rem 0; margin: -0.65rem 0; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PAGE CSS (merged from the 2026-10 redesign): money
   ══════════════════════════════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════════════════════════════
   PAGE — Money (portfolio.html + flow.html), prefix .mn-
   Built on the overview vocabulary (.ov, .ov-k/-v/-s, .ov-table, .ov-tag).
   Tokens only; no new colours.
   ══════════════════════════════════════════════════════════════════════════ */

.mn .page-header { margin-bottom: 0; }
.mn-notice { margin-bottom: 0; }
.mn-head-btn { min-height: 36px; padding: 0.4rem 0.85rem; font-size: 0.8rem; font-weight: 600; text-decoration: none; color: var(--text-secondary); }
.mn-head-btn:hover { color: var(--text-primary); }
.mn-head-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.mn-flat { margin: 0; }
.mn-empty { padding: 2.25rem 1rem; }

/* ── Headline figures ───────────────────────────────────────────────────── */
.mn-now { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr); }
.mn-cell {
    padding: 1.05rem 1.35rem; min-width: 0;
    box-shadow: 1px 0 0 var(--border-subtle), 0 1px 0 var(--border-subtle); margin: 0 1px 1px 0;
}
.mn-big {
    font-family: var(--font-heading); font-weight: 700; letter-spacing: -0.015em;
    font-size: clamp(1.35rem, 2.1vw, 1.75rem); line-height: 1.15; margin-top: 0.2rem;
    font-variant-numeric: tabular-nums; color: var(--text-primary);
}
.mn-big.tone-up { color: var(--success-text); }
.mn-big.tone-down { color: var(--danger-text); }
.mn-mid { font-size: 1.2rem; margin-top: 0.3rem; }
.mn-spark { display: block; width: 100%; max-width: 12rem; height: 24px; margin-top: 0.35rem; }
.mn-src { font-size: 0.72rem; }
.mn-mode {
    display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 0.75rem;
    padding: 0.75rem 1.35rem; font-size: 0.82rem; color: var(--text-secondary); line-height: 1.45;
}
.mn-mode .ov-tag { flex-shrink: 0; color: var(--primary-text); border-color: var(--border-focus); }

/* ── Chart ──────────────────────────────────────────────────────────────── */
.mn-chart-head { align-items: flex-start; }
.mn-controls { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.mn-controls .seg-item { white-space: nowrap; }
.mn-chart { position: relative; height: 22rem; }
.mn-chart canvas { width: 100% !important; height: 100% !important; }
.mn-chart canvas[hidden] { display: none; }
.mn-chart-empty { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; }
.mn-chart-empty[hidden] { display: none; }

/* ── Allocation ─────────────────────────────────────────────────────────── */
.mn-bar { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; background: var(--bg-tertiary); }
.mn-bar b { display: block; height: 100%; min-width: 2px; }
.mn-bar .is-perp, .mn-al i.is-perp { background: var(--primary); }
.mn-bar .is-spot, .mn-al i.is-spot { background: var(--accent); }
.mn-bar .is-vault, .mn-al i.is-vault { background: var(--text-secondary); }
.mn-bar .is-staked, .mn-al i.is-staked { background: var(--cat-3, var(--success)); }
.mn-al-list { margin-top: 0.75rem; }
.mn-al {
    display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 3.5rem; align-items: center; gap: 0.65rem;
    min-height: 38px; font-size: 0.84rem; border-bottom: 1px solid var(--border-subtle);
}
.mn-al:last-child { border-bottom: 0; }
.mn-al i { width: 10px; height: 10px; border-radius: 3px; }
.mn-al span { min-width: 0; color: var(--text-secondary); }
.mn-al small { font-size: 0.72rem; }
.mn-al b, .mn-al em { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mn-al b { font-weight: 600; color: var(--text-primary); }
.mn-al em { font-style: normal; color: var(--text-tertiary); font-size: 0.78rem; }

/* ── Where the equity came from (waterfall) ─────────────────────────────── */
.mn-wf { display: flex; flex-direction: column; }
.mn-wf-row {
    display: grid; grid-template-columns: 12.5rem minmax(0, 1fr) 7rem; align-items: center; column-gap: 1rem;
    min-height: 52px; border-bottom: 1px solid var(--border-subtle);
}
.mn-wf-row:last-child { border-bottom: 0; }
.mn-wf-label { display: flex; flex-direction: column; min-width: 0; font-size: 0.84rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.mn-wf-label small { font-size: 0.72rem; font-weight: 500; color: var(--text-tertiary); }
.mn-wf-track { position: relative; height: 14px; }
.mn-wf-track::before { content: ''; position: absolute; left: var(--zero); top: -10px; bottom: -10px; width: 1px; background: var(--border-focus); }
.mn-wf-track b { position: absolute; top: 0; bottom: 0; min-width: 2px; border-radius: 3px; }
.mn-wf-track b.is-total { background: var(--primary); opacity: 0.75; }
.mn-wf-track b.is-up { background: var(--success); }
.mn-wf-track b.is-down { background: var(--danger); }
.mn-wf-val { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; font-size: 0.9rem; }
.mn-wf-row.is-end .mn-wf-val { color: var(--text-primary); }
.mn-eq {
    margin: 0.85rem 0 0.5rem; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm);
    background: var(--bg-tertiary); font-size: 0.78rem; color: var(--text-secondary);
    overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
}
.mn-nowrap { white-space: nowrap; }
/* .btn sets display, which beats the hidden attribute: "Show -22 more" on a
   ledger shorter than one page. */
.mn-head-btn[hidden], .ac-morebar[hidden] { display: none; }

/* ── Phone floor for Money, Money flow, Activity and Groups: 40px touch
   targets, nothing under 11px. Hit areas grow by padding with a matching
   negative margin where a taller box would change the layout. ─────────── */
@media (max-width: 720px) {
    .mn .seg-item, .mn .mn-head-btn, .mn .mn-open,
    .ac .seg-item, .ac #acGroup, .ac .ac-search, .ac .btn-sm,
    .flow-page .flow-select, .flow-page .flow-searchbox, .flow-page .flow-chip,
    .gedit-chip-name, .gedit .form-input,
    .ov.gp .seg-item, .ov.gp .news-chip, .ov.gp .btn-xs, .ov.gp .wl-act, .ov.gp .form-input { min-height: 40px; }
    .ov.gp .news-chip { display: inline-flex; align-items: center; }
    .gedit-chip-x { min-width: 40px; min-height: 40px; }
    .mn .panel-header .link-inline { display: inline-flex; align-items: center; min-height: 40px; }
    .ov.ac .notice-dismiss, .ov.ac .panel-footer .link-inline,
    .ov.gp .grp-holder, .ov.gp .ov-mkt-coin { display: inline-block; padding-top: .7rem; padding-bottom: .7rem; margin-top: -.55rem; margin-bottom: -.55rem; }
    /* Specificity matches the page rules that come later in the file. */
    .ov.ac .ac-kind, .ov.ac .ac-coin .badge, .ov.ac .ov-sev, .ov.ac .ac-hist-axis,
    .ov .gedit-help, .gedit .gedit-help,
    .ov.gp .ov-sev, .ov.gp .badge, .ov.gp .gp-hb-head span, .ov.gp .ov-table th, .ov.ac .badge { font-size: .75rem; }
}

/* ── Funding P&L ────────────────────────────────────────────────────────── */
.mn-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--border-subtle); }
.mn-trio > div { padding: 0.9rem 1.35rem; box-shadow: 1px 0 0 var(--border-subtle); }
.mn-trio > div:last-child { box-shadow: none; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.mn-ev { font-weight: 600; }
.mn-cp, .mn-sub { display: block; margin-top: 0.1rem; font-size: 0.72rem; color: var(--text-tertiary); font-weight: 400; }
.mn-date { font-size: 0.78rem; color: var(--text-tertiary); }
.mn-hash { color: var(--text-tertiary); text-decoration: none; }
.mn-hash:hover, .mn-hash:focus-visible { color: var(--primary-text); text-decoration: underline; }
.mn-ledger td.num small { display: block; margin: 0.1rem 0 0; }
.mn-ledger tr[hidden] { display: none; }
.mn-tag {
    display: inline-block; margin-left: 0.35rem; padding: 0 0.4rem; border-radius: var(--radius-pill);
    font-size: 0.66rem; font-weight: 600; line-height: 1.6; vertical-align: 1px;
    color: var(--accent); background: var(--accent-soft);
}
.mn-dim td { opacity: 0.72; }
.mn-spot td:first-child, .mn-subs td:first-child { white-space: normal; }
.mn-current td { background: rgba(80, 210, 193, 0.05); }
.mn-open { white-space: nowrap; display: inline-flex; align-items: center; min-height: 36px; }
/* Waterfall + funding table side by side only once each half fits a
   five-column table next to the sidebar. */
@media (min-width: 1280px) { .mn-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Panels of very different length: let each end where its content does
   instead of stretching the shorter one into an empty box. */
.mn-grid-top { align-items: start; }
.mn-al small { display: block; margin-top: 0.1rem; }
.mn-stack { display: flex; flex-direction: column; gap: var(--ov-gap); min-width: 0; }
.mn .facet-count { margin-left: 0.3rem; font-weight: 500; font-size: 0.72rem; opacity: 0.7; font-variant-numeric: tabular-nums; }

/* ── Tablet ─────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .mn-now { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Tables become cards (same pattern as .ov-book-table) */
@media (max-width: 900px) {
    .mn-cards thead { display: none; }
    .mn-cards, .mn-cards tbody { display: block; }
    .mn-cards tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: 0.5rem 1rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--border-subtle); }
    .mn-cards tbody tr:last-child { border-bottom: 0; }
    .mn-cards tr[hidden] { display: none; }
    .mn-cards td { display: block; padding: 0 !important; border: 0; white-space: normal; text-align: left; }
    .mn-cards td.num { text-align: left; }
    .mn-cards td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 0.15rem; font: 500 0.7rem var(--font-body); color: var(--text-tertiary); }
    .mn-cards td:first-child { grid-column: 1 / -1; }
    .mn-cards tbody tr:hover td { background: none; }
    .mn-wf-row { grid-template-columns: 10rem minmax(0, 1fr) 6.5rem; column-gap: 0.75rem; }
    /* Ledger and funding as one compact line each instead of label grids:
       what + when on the left, the amount on the right. From tablet width
       down: the label grid made each event three lines tall. */
    .mn-ledger tr, .mn-fund-table tr { grid-template-columns: minmax(0, 1fr) auto; gap: 0.2rem 0.75rem; padding: 0.7rem 1rem; align-items: baseline; }
    .mn-ledger td[data-label]::before { display: none; }
    .mn-ledger td:first-child { grid-column: 1; grid-row: 1; }
    .mn-ledger td.mn-date { grid-column: 1; grid-row: 2; font-size: 0.75rem; }
    .mn-ledger td[data-label="Amount"] { grid-column: 2; grid-row: 1; text-align: right; }
    .mn-ledger td[data-label="Net deposited after"] { display: none !important; }
    .mn-fund-table tr { grid-template-columns: auto auto minmax(0, 1fr) auto; }
    .mn-fund-table td:first-child { grid-column: 1 / 4; grid-row: 1; }
    .mn-fund-table td[data-label="Net"] { grid-column: 4; grid-row: 1; text-align: right; }
    .mn-fund-table td[data-label="Net"]::before { display: none; }
    .mn-fund-table td[data-label="Payments"] { display: none !important; }
    .mn-fund-table td[data-label="Received"], .mn-fund-table td[data-label="Paid"] { grid-row: 2; font-size: 0.75rem; }
    .mn-fund-table td[data-label="Received"] { grid-column: 1; }
    .mn-fund-table td[data-label="Paid"] { grid-column: 2 / -1; }
    .mn-fund-table td[data-label]::before { display: inline; margin: 0 0.3rem 0 0; }
}

/* ── Phone ──────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
    .mn-cell { padding: 0.85rem 1rem; }
    .mn-mode { padding: 0.75rem 1rem; }
    .mn-controls { width: 100%; }
    .mn-controls .seg { flex: 1 1 auto; flex-wrap: nowrap; }
    .mn-controls .seg-item { flex: 1; }
    .mn-chart { height: 17rem; }
    .mn-wf-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0.4rem; padding: 0.65rem 0; }
    .mn-wf-track { grid-column: 1 / -1; grid-row: 2; }
    .mn-trio > div { padding: 0.8rem 1rem; }
    .mn-trio .ov-v { font-size: 0.92rem; }
}
@media (max-width: 420px) {
    .mn-big { font-size: 1.25rem; }
    .mn-mid { font-size: 1.05rem; }
}

/* ══════════════════════════════════════════════════════════════════════════
   Money flow (flow.html). The graph, toolbar and tray keep their .flow-*
   rules in main.css; this re-seats the page in the overview rhythm.
   ══════════════════════════════════════════════════════════════════════════ */
.mn-flow .flow-notice { margin: 0; }
.mn-flow .flow-toolbar, .mn-flow .flow-tray, .mn-flow .flow-layout { margin-top: 0; margin-bottom: 0; }
.mn-flow .flow-table-panel { margin-top: 0; }
.mn-sec { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.25rem 1rem; padding-top: 0.5rem; }
.mn-sec h2 { margin: 0; font-family: var(--font-heading); font-weight: 600; font-size: 1.2rem; color: var(--text-primary); }
.mn-flow .ov-now .ov-v { font-size: 1.15rem; }
.flow-fold > summary {
    display: flex; align-items: center; gap: 0.6rem; width: fit-content; cursor: pointer; list-style: none;
    padding: 0.45rem 0.75rem; border: 1px dashed rgba(255, 180, 84, .35); border-radius: var(--radius-sm);
    font-size: 0.8rem; color: var(--text-secondary);
}
.flow-fold > summary::-webkit-details-marker { display: none; }
.flow-fold > summary::before { content: '+'; font-weight: 700; color: var(--accent); }
.flow-fold[open] > summary::before { content: '−'; }
.flow-fold > summary:hover { color: var(--text-primary); border-color: rgba(255, 180, 84, .6); }
.flow-fold > summary:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.flow-fold-n { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-tertiary); }
.flow-fold[open] > summary { margin-bottom: 0.6rem; }
/* Five totals on a tablet: 3 + 2 full rows rather than 4 + a lone cell. */
@media (min-width: 721px) and (max-width: 1100px) {
    .ac-now { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .ac-now > .ov-now-cell { grid-column: span 2; }
    .ac-now > .ov-now-cell:nth-child(n+4) { grid-column: span 3; }
}
.mn-flow .flow-sum-note { margin: 0; }
@media (max-width: 720px) {
    .mn-flow .ov-now { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ══════════════════════════════════════════════════════════════════════════
   PAGE CSS (merged from the 2026-10 redesign): activity
   ══════════════════════════════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════════════════════════════
   PAGE — Activity (feed.html), prefix .ac-
   Timeline grouped by UTC day; bursts of fills and funding settlements fold
   into one row. Built on the overview vocabulary; tokens only.
   ══════════════════════════════════════════════════════════════════════════ */

.ac .page-header { margin-bottom: 0; }
.ac .notice { margin-bottom: 0; }
.ac-head-btn { min-height: 36px; padding: 0.4rem 0.85rem; font-size: 0.8rem; font-weight: 600; text-decoration: none; color: var(--text-secondary); }
.ac-head-btn:hover { color: var(--text-primary); }
.ac-head-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.ac-empty { padding: 3.5rem 1rem; }
.ac-flat { margin: 0; }
.ac .facet-count { margin-left: 0.3rem; font-weight: 500; font-size: 0.72rem; opacity: 0.7; font-variant-numeric: tabular-nums; }
.ac-now .ov-v { white-space: nowrap; }

/* ── Hourly histogram ───────────────────────────────────────────────────── */
.ac-hist { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; height: 7rem; align-items: end; }
.ac-bin { position: relative; height: 100%; display: flex; align-items: flex-end; border-radius: 3px; background: var(--bg-tertiary); }
.ac-bin i { display: block; width: 100%; min-height: 0; border-radius: 3px; background: var(--primary); }
.ac-bin.is-none { background: repeating-linear-gradient(135deg, transparent 0 4px, var(--accent-soft) 4px 8px); }
.ac-bin.is-partial { box-shadow: inset 0 0 0 1px var(--accent-soft); }
.ac-hist-axis { display: flex; justify-content: space-between; margin-top: 0.35rem; font: 0.68rem var(--font-mono); color: var(--text-tertiary); }
.ac-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; margin-top: 0.75rem; font-size: 0.75rem; color: var(--text-tertiary); }
.ac-legend span { display: inline-flex; align-items: center; gap: 0.45rem; }
.ac-legend i { width: 12px; height: 10px; border-radius: 2px; }
.ac-legend i.is-full { background: var(--primary); }
.ac-legend i.is-none { background: repeating-linear-gradient(135deg, transparent 0 3px, var(--accent) 3px 5px); opacity: 0.6; }

/* ── Timeline toolbar ───────────────────────────────────────────────────── */
.ac-tools { gap: 0.6rem; }
.ac-tools-right { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ac-search { height: 36px; width: 12rem; padding: 0 0.75rem; font-size: 0.82rem; }

/* ── Rows: one fixed grid for every kind, so nothing jumps ──────────────── */
.ac-row {
    display: grid;
    grid-template-columns: 6.25rem 4.75rem minmax(9rem, 1fr) 8.5rem 6.5rem 4.25rem;
    grid-template-areas: "t k e p a f";
    align-items: center; column-gap: 0.75rem;
    min-height: 40px; padding: 0.35rem 1.35rem;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.82rem;
}
.ac-t { grid-area: t; font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-tertiary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ac-k { grid-area: k; }
.ac-e { grid-area: e; min-width: 0; color: var(--text-secondary); line-height: 1.35;
    /* Two lines, then an ellipsis: an event reads in full, a row never grows past two lines. */
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ac-e b { color: var(--text-primary); font-weight: 600; }
.ac-coin { font-weight: 700; color: var(--text-primary); }
.ac-coin .venue-badge { margin-left: 0.25rem; padding: 0 0.3rem; line-height: 1.5; font-size: 0.6rem; border-radius: 4px; }
.ac-p, .ac-a, .ac-f { text-align: right; white-space: nowrap; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ac-p { grid-area: p; font-size: 0.76rem; color: var(--text-secondary); }
.ac-a { grid-area: a; font-weight: 600; }
.ac-f { grid-area: f; font-size: 0.74rem; color: var(--text-tertiary); }
.ac-head {
    min-height: 32px; font: 600 0.68rem var(--font-body); letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-tertiary);
}
.ac-head > span { font: inherit; color: inherit; }

/* Type tags: one size, colour carries the kind */
.ac-kind {
    display: inline-block; padding: 0 0.45rem; border-radius: 5px; border: 1px solid var(--border-subtle);
    font: 600 0.66rem/1.6 var(--font-body); letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
}
.ac-kind.is-fill { color: var(--primary-text); }
.ac-kind.is-funding { color: var(--text-primary); }
.ac-kind.is-ledger { color: var(--accent); border-color: var(--accent-soft); }

/* Days */
.ac-day-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.25rem 1rem; padding: 1rem 1.35rem 0.5rem; border-bottom: 1px solid var(--border-focus); }
.ac-day-head h3 { margin: 0; font-family: var(--font-heading); font-weight: 600; font-size: 0.95rem; color: var(--text-primary); }
.ac-day-head span { font: 0.72rem var(--font-mono); color: var(--text-tertiary); }
.ac-day[hidden], .ac-item[hidden], .ac-none[hidden] { display: none; }
.ac-none { padding: 2rem 1.35rem; text-align: center; color: var(--text-tertiary); font-size: 0.85rem; }
.ac-morebar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.85rem 1.35rem; border-top: 1px solid var(--border-subtle); font-size: 0.8rem; color: var(--text-tertiary); }

/* Bursts */
.ac-burst-head {
    width: 100%; background: rgba(80, 210, 193, 0.035); border: 0; border-bottom: 1px solid var(--border-subtle);
    font: inherit; font-size: 0.82rem; color: inherit; text-align: left; cursor: pointer;
}
.ac-burst-head:hover { background: rgba(80, 210, 193, 0.07); }
.ac-burst-head:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
.ac-cv { display: inline-block; width: 0.8rem; color: var(--text-tertiary); }
.ac-cv::before { content: '▸'; }
.ac-burst-head[aria-expanded="true"] .ac-cv::before { content: '▾'; }
.ac-child { padding-left: 2.35rem; background: rgba(80, 210, 193, 0.02); }
.ac-child .ac-t { color: var(--text-tertiary); }
.ac-more .ac-e { grid-area: auto; grid-column: 1 / -1; white-space: normal; }
/* "Group bursts" off: every fill on its own line */
.ac-tl.is-flat .ac-burst-head { display: none; }
.ac-tl.is-flat .ac-children[hidden] { display: block; }
.ac-tl.is-flat .ac-child { padding-left: 1.35rem; background: none; }

.ac-coins td:first-child { white-space: nowrap; }
/* The timeline needs ~50rem for its six columns, so the side panel only sits
   beside it on wide screens. */
@media (min-width: 1600px) { .ac-main { grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); align-items: start; } }

/* ── Tablet: drop the type column, keep one line per row ────────────────── */
@media (max-width: 1279px) and (min-width: 901px) {
    .ac-row { grid-template-columns: 6.25rem 5.25rem minmax(0, 1fr) 7.5rem 4.5rem; grid-template-areas: "t k e a f"; }
    .ac-p { display: none; }
}

/* ── Phone/tablet portrait: two lines per row ───────────────────────────── */
@media (max-width: 900px) {
    .ac-head { display: none; }
    .ac-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas: "k e a" "t p f";
        column-gap: 0.6rem; row-gap: 0.2rem; padding: 0.6rem 1rem; min-height: 0;
    }
    .ac-p { text-align: left; }
    .ac-e { white-space: normal; }
    .ac-child { padding-left: 1.75rem; }
    .ac-day-head { padding: 0.9rem 1rem 0.45rem; }
    .ac-tools { flex-direction: column; align-items: stretch; }
    .ac-tools .seg { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .ac-tools .seg-item { flex: 1 0 auto; }
    .ac-tools-right { width: 100%; }
    .ac-search { flex: 1; width: auto; min-width: 0; }
    .ac-tl.is-flat .ac-child { padding-left: 1rem; }
}
@media (max-width: 720px) {
    .ac-hist { gap: 2px; height: 5.5rem; }
    .ac-now { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* An odd cell out (Last activity) takes the full row, not half of one. */
    .ac-now > :last-child:nth-child(odd) { grid-column: 1 / -1; }
    /* Four filters with counts don't fit one phone row; a 2×2 grid keeps
       every one visible instead of scrolling Ledger off the edge. */
    .ac-tools .seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
    /* No column header on phones, so the fee says what it is. */
    .ac-row .ac-fl { display: inline; }
}
.ac-fl { display: none; color: var(--text-tertiary); font-family: var(--font-body); }

/* ══════════════════════════════════════════════════════════════════════════
   PAGE CSS (merged from the 2026-10 redesign): tools
   ══════════════════════════════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════════════════════════════
   PAGES — Wallet tools: Calculator, Forecast (/compound), Funding scanner
   Inputs left (5/12), live results right (7/12); stacks under 1100px.
   Builds on the overview vocabulary (.ov, .ov-k/.ov-v/.ov-s, .ov-table,
   .ov-chip, .ov-sev); only what those lack lives here, prefixed .tl-.
   Tokens only: no new colours.
   ══════════════════════════════════════════════════════════════════════════ */

.tl .page-header { margin-bottom: 0; }
.tl-head-link { border: 1px solid var(--border-subtle); }
.tl-link {
    appearance: none; background: none; border: 0; padding: 0; cursor: pointer;
    color: var(--primary-text); font: inherit; font-weight: 600; text-decoration: none;
}
.tl-link:hover { text-decoration: underline; }
.tl-link:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; border-radius: 3px; }
.tl-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tl-prose { margin: 0; font-size: 0.85rem; line-height: 1.6; color: var(--text-secondary); max-width: 60ch; }
.tl-note { margin: 0; font-size: 0.8rem; line-height: 1.5; color: var(--text-tertiary); max-width: 72rem; }

/* ── Two-column tool layout ────────────────────────────────────────────── */
.tl-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--ov-gap); align-items: start; }
@media (min-width: 1100px) { .tl-layout { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
.tl-col { display: flex; flex-direction: column; gap: var(--ov-gap); min-width: 0; }
.tl-col > .panel { margin-bottom: 0; }
.tl-col > .panel[hidden] { display: none; }

/* ── Tab strip + prefill chip ──────────────────────────────────────────── */
.tl-tabbar {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
    gap: 0.5rem 1rem; border-bottom: 1px solid var(--border-subtle);
}
.tl-tabs { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; min-width: 0; max-width: 100%; }
.tl-tabs::-webkit-scrollbar { display: none; }
/* Phones: five tabs wrap onto two rows rather than hiding "Break-even" off-screen. */
@media (max-width: 520px) { .tl-tabs { flex-wrap: wrap; overflow: visible; } }
.tl-tab {
    flex-shrink: 0; appearance: none; background: none; border: 0; cursor: pointer;
    min-height: 40px; padding: 0.6rem 0.9rem; margin-bottom: -1px;
    border-bottom: 2px solid transparent; color: var(--text-secondary);
    font: 600 0.88rem var(--font-body); white-space: nowrap;
    transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.tl-tab:hover { color: var(--text-primary); border-bottom-color: var(--border-focus); }
.tl-tab[aria-selected="true"] { color: var(--text-primary); border-bottom-color: var(--primary); }
.tl-tab:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; border-radius: 6px 6px 0 0; }
.tl-prefill { display: flex; align-items: center; gap: 0.75rem; padding-bottom: 0.5rem; font-size: 0.82rem; }
.tl-prefill-chip { color: var(--text-primary); border-color: rgba(80, 210, 193, 0.35); background: rgba(80, 210, 193, 0.08); }
.tl-prefill .tl-link { min-height: 36px; display: inline-flex; align-items: center; }

/* ── Form fields ───────────────────────────────────────────────────────── */
.tl-fields { display: flex; flex-direction: column; gap: 1.1rem; }
.tl-field { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.tl-f2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem 0.9rem; }
.tl-label { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); }
.tl-hint { margin: 0; font-size: 0.75rem; line-height: 1.45; color: var(--text-tertiary); }
.tl-hint:empty { display: none; }
.tl-fields .input-icon-wrapper { min-height: 40px; }
.tl-fields .input-icon-wrapper select { min-height: 38px; }
.tl-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.tl-grow { flex: 1 1 10rem; }
.tl-narrow { flex: 0 0 7.5rem; }
.tl-chipset { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tl-chipset .ov-chip, .tl-inline > .ov-chip { min-height: 36px; }
.tl-dir { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.tl-dir .dir-btn { min-height: 40px; }
.tl-dir .dir-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.tl-seg { width: 100%; flex-wrap: nowrap; }
.tl-seg .seg-item { flex: 1; white-space: nowrap; padding-left: 0.5rem; padding-right: 0.5rem; }
.tl-slider { margin-top: -0.35rem; }
.tl-slider input[type="range"] { width: 100%; height: 28px; margin: 0; accent-color: var(--primary); cursor: pointer; }
/* Chrome draws the unfilled track dark when the accent is light; the darker
   teal in light mode gets a light track. */
[data-theme="light"] .tl-slider input[type="range"] { accent-color: var(--primary-text); }
.tl-ticks { display: flex; justify-content: space-between; font: 0.68rem var(--font-mono); color: var(--text-tertiary); margin-bottom: 0.35rem; }
.tl-stubs {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem;
    padding: 0.85rem 1rem; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: rgba(80, 210, 193, 0.03);
}
.tl-err, .tl-callout { margin: 0; padding: 0.7rem 0.85rem; border-radius: var(--radius-sm); font-size: 0.82rem; line-height: 1.5; }
.tl-err { background: var(--danger-bg); color: var(--danger-text); }
.tl-callout { background: var(--accent-soft); color: var(--text-secondary); margin-top: 1rem; }
.tl-err[hidden], .tl-callout[hidden] { display: none; }
.tl-actions { display: flex; justify-content: flex-end; margin-top: 1rem; }
.tl-actions .ov-chip { min-height: 36px; }

/* ── Results: hero figures + key/value lists ───────────────────────────── */
.tl-hero { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--border-subtle); }
.tl-hero > div { padding: 1rem 1.35rem; min-width: 0; box-shadow: 1px 0 0 var(--border-subtle); }
.tl-hero > div:last-child { box-shadow: none; }
.tl-big {
    font-family: var(--font-heading); font-weight: 700; letter-spacing: -0.015em;
    font-size: clamp(1.25rem, 2vw, 1.6rem); line-height: 1.2; margin-top: 0.25rem;
    font-variant-numeric: tabular-nums; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#resRange { white-space: normal; }  /* a "low – high" range wraps instead of ending in "…" */
.tl-big.tone-up { color: var(--success-text); }
.tl-big.tone-down { color: var(--danger-text); }
.tl-kv-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 2rem; }
@media (min-width: 640px) { .tl-kv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tl-kv { margin: 0; display: flex; flex-direction: column; }
.tl-kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; min-height: 36px; padding: 0.45rem 0; border-bottom: 1px solid var(--border-subtle); font-size: 0.84rem; }
.tl-kv > div:last-child { border-bottom: 0; }
.tl-kv dt { color: var(--text-secondary); min-width: 0; }
.tl-kv dd { margin: 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; color: var(--text-primary); }
.tl-kv dd.tone-up { color: var(--success-text); }
.tl-kv dd.tone-down { color: var(--danger-text); }
.tl-kv .is-total dt { color: var(--text-primary); font-weight: 600; }

/* Price axis: where liquidation, entry, break-even and target sit */
.tl-axis { position: relative; height: 4.6rem; margin: 0.25rem 0.5rem 1.1rem; }
.tl-axis[hidden] { display: none; }
.tl-axis-track { position: absolute; left: 0; right: 0; top: 2rem; height: 8px; border-radius: 4px; background: rgba(80, 210, 193, 0.12); }
.tl-axis-danger { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: color-mix(in srgb, var(--danger) 45%, transparent); }
.tl-axis-be { position: absolute; top: 1.7rem; width: 2px; height: calc(8px + 0.6rem); margin-left: -1px; background: var(--text-tertiary); }
.tl-pin {
    position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap;
    font: 500 0.72rem var(--font-mono); color: var(--text-secondary); font-variant-numeric: tabular-nums;
}
.tl-pin b { font-family: var(--font-body); font-weight: 700; }
.tl-pin::after { content: ''; position: absolute; left: 50%; top: 1.25rem; width: 2px; height: calc(8px + 0.9rem); margin-left: -1px; background: currentColor; }
.tl-pin.is-low { top: auto; bottom: 0; }
.tl-pin.is-low::after { top: auto; bottom: 1.25rem; }
.tl-pin.is-start { transform: none; }
.tl-pin.is-start::after { left: 0; margin-left: 0; }
.tl-pin.is-end { transform: translateX(-100%); }
.tl-pin.is-end::after { left: auto; right: 0; margin-left: 0; }
.tl-pin.is-liq { color: var(--danger-text); }
.tl-pin.is-entry { color: var(--text-primary); }
.tl-pin.is-target { color: var(--primary-text); }

/* Severity pill sized to its text inside tables */
.tl-sev { display: inline-block; flex: none; padding: 0.15rem 0.6rem; white-space: nowrap; }
.tl-empty-row { padding: 1.25rem 1.35rem !important; white-space: normal !important; }

/* ── Tables → cards (tablet portrait and down), same as .ov-book-table ─── */
.tl-scroll { overflow-x: auto; }
/* Headers keep the body face: .ov-table .num would set numeric column
   headers in mono next to sans ones. */
.ov-table th.num { text-align: right; font-family: var(--font-body); }
.tl-sort { cursor: pointer; user-select: none; }
.tl-sort:hover { color: var(--text-primary); }
.tl-sort:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
.tl-sort .tl-arrow { display: inline-block; width: 0.7rem; margin-left: 0.2rem; color: var(--primary-text); }
@media (max-width: 900px) {
    .tl-cards thead { display: none; }
    .tl-cards, .tl-cards tbody { display: block; }
    .tl-cards tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: 0.6rem 1rem; padding: 0.9rem 1rem; border-bottom: 1px solid var(--border-subtle); }
    .tl-cards tbody tr:last-child { border-bottom: 0; }
    .tl-cards td { display: block; padding: 0 !important; border: 0; white-space: normal; text-align: left; }
    .tl-cards td.num { text-align: left; }
    .tl-cards td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 0.15rem; font: 500 0.7rem var(--font-body); color: var(--text-tertiary); }
    .tl-cards td:first-child { grid-column: 1 / -1; }
    .tl-cards tbody tr:hover td { background: none; }
}

/* ── Forecast ──────────────────────────────────────────────────────────── */
.tl-fc-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.tl-toggle { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 36px; font-size: 0.82rem; color: var(--text-secondary); cursor: pointer; user-select: none; }
.tl-toggle input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.tl-run { width: 100%; min-height: 40px; }
.tl-chart { position: relative; height: 26rem; padding: 0.75rem 0.75rem 0.5rem 0.5rem; }
.tl-chart canvas { width: 100% !important; height: 100% !important; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.75rem; color: var(--text-secondary); }
.tl-legend span { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.tl-sw { display: inline-block; width: 14px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.tl-sw.is-hist { height: 2px; background: var(--text-primary); }
.tl-sw.is-med { height: 0; border-top: 2px dashed var(--primary); border-radius: 0; }
.tl-sw.is-inner { background: color-mix(in srgb, var(--primary) 34%, transparent); }
.tl-sw.is-outer { background: color-mix(in srgb, var(--primary) 14%, transparent); }
.tl-sw.is-goal { height: 0; border-top: 2px dotted var(--accent); border-radius: 0; }
.tl-badge { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.75rem; color: var(--text-tertiary); }
.tl-badge[hidden] { display: none; }
.tl-pay-strip {
    display: flex; align-items: flex-end; gap: 2px; height: 56px; padding: 4px 6px;
    border-radius: var(--radius-sm); background: var(--bg-tertiary); overflow: hidden;
}
.tl-pay-strip i { flex: 1; min-width: 2px; border-radius: 1px; }
.tl-pay-strip i.is-pos { background: var(--success); }
.tl-pay-strip i.is-neg { background: var(--danger); }
.tl-split { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.tl-meter { height: 8px; border-radius: 4px; background: var(--bg-tertiary); overflow: hidden; margin-top: 0.5rem; }
.tl-meter b { display: block; height: 100%; border-radius: 4px; }
.tl-meter b.is-pos { background: var(--success); }
.tl-meter b.is-neg { background: var(--danger); }
.tl-sub-head { margin: 1.25rem 0 0.5rem; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); }
/* Seven result cells: 4 + 3 (last spans two) so no cell is orphaned */
@media (min-width: 721px) {
    .tl-fc-now { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .tl-fc-now .ov-now-cell:last-child { grid-column: span 2; }
}
@media (min-width: 1680px) {
    .tl-fc-now { grid-template-columns: repeat(7, minmax(0, 1fr)); }
    .tl-fc-now .ov-now-cell:last-child { grid-column: auto; }
}
/* Funding by market: compact two-up list, largest first */
.tl-fund-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); column-gap: 2rem; }
.tl-fund-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; min-height: 38px; padding: 0.5rem 0; border-bottom: 1px solid var(--border-subtle); font-size: 0.84rem; }
.tl-fund-list li > span:last-child { white-space: nowrap; }
.tl-showall.tl-fund-more { width: 100%; margin: 0.85rem 0 0; }

/* ── Funding scanner ───────────────────────────────────────────────────── */
.tl-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.tl-search { position: relative; flex: 1 1 14rem; max-width: 22rem; }
.tl-search svg { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); pointer-events: none; }
.tl-search input { min-height: 40px; padding: 0 0.75rem 0 2.25rem; font-size: 0.85rem; }
.tl-filters { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tl-filters .ov-chip { min-height: 36px; }
.tl-filters .ov-chip small { font: 600 0.72rem var(--font-mono); color: var(--text-tertiary); }
.tl-heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.25rem, 1fr)); gap: 6px; }
.tl-tile {
    display: flex; flex-direction: column; justify-content: space-between; gap: 0.35rem;
    min-height: 64px; padding: 0.5rem 0.6rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle); color: var(--text-primary); text-decoration: none;
    background: color-mix(in srgb, var(--primary) calc(var(--heat, 0) * 60%), transparent);
}
.tl-tile:hover { border-color: var(--border-focus); }
.tl-tile:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.tl-tile.is-held { box-shadow: inset 0 0 0 1px var(--text-primary); }
.tl-tile-top { display: flex; justify-content: space-between; align-items: center; gap: 0.3rem; font-weight: 700; font-size: 0.78rem; min-width: 0; }
.tl-tile-top span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-tile-apr { font: 600 0.85rem var(--font-mono); font-variant-numeric: tabular-nums; }
.tl-tile-rate { display: flex; justify-content: space-between; gap: 0.3rem; font: 0.66rem var(--font-mono); color: var(--text-secondary); white-space: nowrap; }
.tl-tile-rate span:last-child:not(:first-child) { color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; }
/* Search and the zero-OI toggle sit on one line beside the title */
.panel-header .tl-toolbar { flex: 1 1 auto; justify-content: flex-end; }
@media (min-width: 721px) { .panel-header .tl-toolbar { flex-wrap: nowrap; } .panel-header .tl-toolbar .tl-toggle { white-space: nowrap; } }
/* Phones and tablets: market and position rows as two compact lines
   instead of a labelled card per column. */
@media (max-width: 900px) {
    .tl-mkt tr, .tl-held tr { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.35rem 0.75rem; padding: 0.7rem 1rem; }
    .tl-mkt td:first-child, .tl-held td:first-child { grid-column: 1 / 3; grid-row: 1; align-self: center; }
    .tl-mkt td:nth-child(5), .tl-held td:nth-child(6) { grid-column: 3; grid-row: 1; text-align: right; font-weight: 600; }
    .tl-mkt td:nth-child(5)::before, .tl-held td:nth-child(6)::before { display: none !important; }
    .tl-mkt td:nth-child(n+6), .tl-held td:nth-child(4) { display: none !important; }
    .tl-mkt td[data-label]::before, .tl-held td[data-label]::before { font-size: 0.66rem; margin-bottom: 0.05rem; }
}
@media (max-width: 720px) {
    .tl-heat { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tl-heat .tl-tile:nth-child(n+13) { display: none; }
}
.tl-tag {
    display: inline-block; flex-shrink: 0; padding: 0 0.3rem; border-radius: 4px; line-height: 1.5;
    font: 700 0.6rem var(--font-body); letter-spacing: 0.04em; text-transform: uppercase;
}
.tl-tag.is-hot { background: var(--accent); color: var(--bg-app); }
.tl-tag.is-high { background: var(--accent-soft); color: var(--accent); }
.tl-tag.is-held { background: var(--bg-tertiary); color: var(--text-secondary); }
.tl-coin { font-weight: 700; color: var(--text-primary); }
.ov-table .tl-coin + .badge, .ov-table .tl-tag { margin-left: 0.3rem; vertical-align: 1px; }
.tl-venue { font-size: 0.78rem; color: var(--text-secondary); }
.tl-carry-out { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--border-subtle); }
.tl-carry-out > div { padding: 1rem 1.35rem; min-width: 0; }
.tl-carry-out > div + div { box-shadow: -1px 0 0 var(--border-subtle); }
.tl-empty { padding: 1.5rem 1.35rem; color: var(--text-tertiary); font-size: 0.85rem; }

/* ── Phone ─────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
    .tl-hero { grid-template-columns: minmax(0, 1fr); }
    /* One line per result: label and note left, value right */
    .tl-hero > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 1rem; align-items: center; padding: 0.7rem 1rem; box-shadow: 0 1px 0 var(--border-subtle); }
    .tl-hero > div > .tl-big { grid-column: 2; grid-row: 1 / span 2; text-align: right; }
    .tl-hero > div > .ov-s { grid-column: 1; }
    .tl-back { flex: 0 0 auto !important; width: auto !important; }
    .tl-hero > div:last-child { box-shadow: none; }
    .tl-prefill { padding-bottom: 0.35rem; }
    .tl-chart { height: 20rem; padding: 0.5rem 0.25rem 0.5rem 0; }
    .tl-split { grid-template-columns: minmax(0, 1fr); }
    .tl-search { max-width: none; }
    .tl-carry-out > div { padding: 0.85rem 1rem; }
}
@media (max-width: 480px) {
    .tl-f2 { grid-template-columns: minmax(0, 1fr); }
    .tl-narrow { flex: 1 1 100%; }
    .tl-carry-out { grid-template-columns: minmax(0, 1fr); }
    .tl-carry-out > div + div { box-shadow: 0 -1px 0 var(--border-subtle); }
}
@media (prefers-reduced-motion: reduce) {
    .tl-tab { transition: none; }
}
.tl-hero.is-foot { border-top: 1px solid var(--border-subtle); border-bottom: 0; }
.tl-gap { margin-top: 0.75rem; }
.tl-filterbar { padding: 0.85rem 1.35rem; border-bottom: 1px solid var(--border-subtle); }
.ov-table tbody tr[hidden], .tl-cards tbody tr[hidden] { display: none; }
@media (max-width: 720px) { .tl-filterbar { padding: 0.75rem 1rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .tl-filterbar .ov-chip { flex-shrink: 0; } }

/* Phones, tool pages (calculator, forecast, funding, watchlist, tax export):
   44px fields, 40px+ chips and buttons, no text under 11px. */
@media (max-width: 720px) {
    :is(.tl, .wl, .ex) :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]), select) { min-height: 44px; }
    :is(.tl, .wl, .ex) :is(.ov-chip, .tl-showall, .tl-filters .ov-chip, .seg-item, .wl-act, .wl-head-btn, .ex-rebuild, .tl-head-link) { min-height: 42px; }
    .tl-toggle { min-height: 44px; }
    .tl-ticks, .tl-tile-rate, .ex .ex-cov-axis { font-size: 0.72rem; }
    :is(.tl, .wl, .ex) .badge, .tl-tag { font-size: 0.7rem; }
    :is(.tl, .ex) .ov-sev { font-size: 0.7rem; }
    /* Twelve month cells are ~20px wide here: colour carries the state, the
       row count stays in each cell's tooltip. */
    .ex-cov-cell em { display: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PAGE CSS (merged from the 2026-10 redesign): tools2
   ══════════════════════════════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════════════════════════════
   PAGES — Watchlist (.wl-), Tax export (.ex-), Wallet group (.gp-)
   Built on the overview vocabulary (.ov, .ov-k/.ov-v/.ov-s, .ov-now,
   .ov-table, .ov-look). Only tokens; light theme comes from them.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Shared bits ───────────────────────────────────────────────────────── */
.wl-meter, .gp-meter { display: block; width: 64px; height: 6px; border-radius: 3px; background: var(--bg-tertiary); overflow: hidden; flex-shrink: 0; }
.wl-meter b, .gp-meter b { display: block; height: 100%; border-radius: 3px; background: var(--primary); }

/* ══ TAX EXPORT ═══════════════════════════════════════════════════════════ */
.ex-status {
    display: flex; gap: 0.75rem; align-items: flex-start;
    padding: 0.85rem 1.1rem; border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
    background: var(--bg-card); font-size: 0.85rem; line-height: 1.55; color: var(--text-secondary);
}
.ex-status p { margin: 0; }
.ex-status strong { color: var(--text-primary); }
.ex-status .ov-sev { flex: 0 0 auto; padding: 0.15rem 0.6rem; }
.ex-status.is-watch { border-color: var(--accent-soft); }

.ex-cols { align-items: start; }
@media (min-width: 1200px) { .ex-cols { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); } }
.ex-side { display: flex; flex-direction: column; gap: var(--ov-gap); min-width: 0; }
/* Single column: the preview (what the file holds, and whether it is
   complete) comes straight after the form, the reference list last. */
@media (max-width: 1199px) {
    .ex-side { display: contents; }
    .ex-side > section:last-child { order: 2; }
}

.ex-form { display: flex; flex-direction: column; gap: 1.1rem; }
.ex-field { display: flex; flex-direction: column; gap: 0.4rem; }
.ex-select { max-width: 12rem; min-height: 40px; padding: 0 0.75rem; }
.ex-formats { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.ex-formats legend { padding: 0; margin-bottom: 0.4rem; }
.ex-format {
    display: flex; gap: 0.7rem; align-items: flex-start; cursor: pointer;
    padding: 0.7rem 0.85rem; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
    transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.ex-format:hover { border-color: var(--border-focus); }
.ex-format:has(input:checked) { border-color: var(--border-focus); background: rgba(80, 210, 193, 0.06); }
.ex-format input { margin-top: 0.2rem; accent-color: var(--primary); flex-shrink: 0; }
.ex-format span { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.ex-format strong { color: var(--text-primary); font-size: 0.88rem; }
.ex-format small { color: var(--text-tertiary); font-size: 0.76rem; line-height: 1.45; }
.ex-wallet code { font-size: 0.85rem; color: var(--text-primary); }
.ex-download { align-self: stretch; min-height: 44px; font-weight: 600; font-variant-numeric: tabular-nums; }
#exFileName { margin-top: -0.6rem; font-family: var(--font-mono); word-break: break-all; }

.ex-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ex-list li { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: 0.75rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border-subtle); font-size: 0.82rem; line-height: 1.5; color: var(--text-secondary); }
.ex-list li:first-child { padding-top: 0; }
.ex-list li:last-child { border-bottom: 0; }
.ex-list b { color: var(--text-primary); font-weight: 600; }
.ex-disclaimer { margin: 1rem 0 0; padding-top: 0.9rem; border-top: 1px solid var(--border-subtle); line-height: 1.55; }

.ex-preview .panel-header { gap: 1rem; }
.ex-rebuild { min-height: 36px; padding: 0 0.9rem; font-size: 0.82rem; flex-shrink: 0; }
.ex-rebuild:disabled { opacity: 0.5; cursor: progress; }
.ex-preview .panel-body { display: flex; flex-direction: column; gap: 1.25rem; }
.ex-preview .panel-body.is-loading > :not(.skel-row):not(#exLoading) { opacity: 0.45; }
#exLoading { margin: 0; }
.ex-notes { margin: 0; }
.ex-block { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }

/* Coverage: one row per data type, one cell per month. */
.ex-cov { display: flex; flex-direction: column; gap: 4px; }
.ex-cov-row { display: grid; grid-template-columns: 5.5rem repeat(12, minmax(0, 1fr)); gap: 4px; align-items: center; }
.ex-cov-name { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); }
.ex-cov-cell {
    display: flex; align-items: center; justify-content: center; height: 28px; border-radius: 4px;
    font: normal 0.66rem var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-primary);
}
.ex-cov-cell em { font-style: normal; }
.ex-cov-cell.is-rows { background: color-mix(in srgb, var(--primary) 32%, transparent); }
.ex-cov-cell.is-none { background: var(--bg-tertiary); }
.ex-cov-cell.is-maybe_missing { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.ex-cov-cell.is-not_fetched { background: var(--danger-bg); box-shadow: inset 0 0 0 1px var(--danger); }
.ex-cov-cell.is-future { box-shadow: inset 0 0 0 1px var(--border-subtle); }
.ex-cov-axis { font: 0.66rem var(--font-mono); color: var(--text-tertiary); text-align: center; }
.ex-cov-axis b { font-weight: inherit; }
.ex-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; font-size: 0.74rem; color: var(--text-tertiary); }
.ex-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.ex-legend .ex-cov-cell { width: 12px; height: 12px; border-radius: 3px; }

.ex-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem 1.25rem; padding: 0.9rem 1rem; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); }
.ex-table-wrap { overflow-x: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); }
.ex-table th, .ex-table td { padding: 0.55rem 0.75rem; font-size: 0.76rem; }
.ex-table th:first-child, .ex-table td:first-child { padding-left: 0.85rem; }
.ex-table td { font-family: var(--font-mono); color: var(--text-secondary); }

@media (max-width: 900px) {
    .ex-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* First rows become one card per row */
    .ex-table-wrap { overflow: visible; border: 0; }
    .ex-table thead { display: none; }
    .ex-table, .ex-table tbody { display: block; }
    .ex-table tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.5rem 1rem; padding: 0.8rem 0.9rem; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); margin-bottom: 0.5rem; }
    .ex-table td { display: block; padding: 0 !important; border: 0; white-space: normal; word-break: break-all; text-align: left; }
    .ex-table td::before { content: attr(data-label); display: block; margin-bottom: 0.1rem; font: 500 0.68rem var(--font-body); color: var(--text-tertiary); }
    /* A 66-character hash would wrap to four lines; one line is enough to recognise it */
    .ex-table td[data-label*="Hash" i] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; word-break: normal; }
    .ex-table tbody tr:hover td { background: none; }
}
@media (max-width: 720px) {
    .ex-status { flex-direction: column; gap: 0.4rem; }
    .ex-cov-row { grid-template-columns: 4.2rem repeat(12, minmax(0, 1fr)); gap: 2px; }
    .ex-cov-cell { height: 24px; font-size: 0.56rem; }
    .ex-cov-axis b { display: none; }
    .ex-list li { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; }
}

/* ══ WATCHLIST ════════════════════════════════════════════════════════════ */
.wl [hidden], .ex [hidden] { display: none !important; }
.wl-head-btn { min-height: 38px; padding: 0 1rem; font-size: 0.85rem; font-weight: 600; }
.wl-banner {
    display: flex; align-items: center; gap: 0.75rem 1rem; flex-wrap: wrap;
    padding: 0.8rem 1.1rem; border: 1px solid var(--accent-soft); border-radius: var(--radius-md);
    background: var(--bg-card); font-size: 0.85rem; line-height: 1.5; color: var(--text-secondary);
}
.wl-banner[hidden] { display: none; }
.wl-banner p { flex: 1 1 20rem; margin: 0; }
.wl-banner strong { color: var(--text-primary); }
.wl-banner .ov-sev { flex: 0 0 auto; padding: 0.15rem 0.6rem; }
.wl-banner-acts { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.wl-cols { align-items: start; }
@media (min-width: 1200px) { .wl-cols { grid-template-columns: minmax(0, 8.4fr) minmax(0, 3.6fr); } }
@media (min-width: 1200px) { .wl-form-panel { position: sticky; top: 1rem; } }

.wl-list-head { flex-wrap: wrap; gap: 0.6rem 1rem; }
.wl-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.wl-chips .ov-chip b { font: 600 0.72rem var(--font-mono); color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.wl-chips .ov-chip[aria-pressed="true"] b { color: var(--primary-text); }

.wl-table td { vertical-align: middle; }
.wl-table tr.is-triggered td { background: var(--accent-soft); }
.wl-table tr.is-triggered:hover td { background: var(--accent-soft); }
.wl-asset { min-width: 9rem; }
.wl-asset .ov-coin { display: inline-flex; align-items: center; gap: 0.3rem; }
.wl-asset .venue-badge { font-size: 0.6rem; padding: 0 0.3rem; line-height: 1.5; border-radius: 4px; }
.wl-sub { display: block; margin-top: 0.15rem; font: 500 0.7rem var(--font-body); color: var(--text-tertiary); white-space: nowrap; }
.wl-held {
    display: table; margin-top: 0.3rem; padding: 0.1rem 0.5rem; border-radius: var(--radius-pill);
    background: rgba(80, 210, 193, 0.1); color: var(--primary-text); font-size: 0.7rem; font-weight: 600; white-space: nowrap; text-decoration: none;
}
.wl-held:hover { background: rgba(80, 210, 193, 0.18); }
.wl-held:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.wl-trig { display: inline-block; padding: 0.05rem 0.5rem; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.wl-dist { display: inline-flex; align-items: center; justify-content: flex-end; gap: 0.55rem; }
.wl-dist-text { font-family: var(--font-mono); font-variant-numeric: tabular-nums; min-width: 3.2rem; text-align: right; }
.wl-dist.is-near b { background: var(--accent); }
.wl-dist.is-near .wl-dist-text { color: var(--accent); }
.wl-notes { max-width: 13rem; white-space: normal !important; font-size: 0.8rem !important; color: var(--text-secondary); line-height: 1.4; }
.wl-skel { display: inline-block; width: 4.5rem; height: 0.9rem; border-radius: 4px; vertical-align: middle; }
.wl-acts { width: 1%; text-align: right; white-space: nowrap; }
.wl-act {
    min-height: 36px; padding: 0 0.6rem; border: 1px solid transparent; border-radius: var(--radius-sm);
    background: none; color: var(--text-tertiary); font: 600 0.78rem var(--font-body); cursor: pointer;
}
.wl-act:hover { color: var(--text-primary); border-color: var(--border-subtle); }
.wl-act:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.wl-act.is-pri { color: var(--primary-text); }
.wl-act.is-danger:hover { color: var(--danger-text); }
.wl-empty { padding: 2.5rem 1rem; }
.wl.is-empty .ov-now, .wl.is-empty .wl-banner, .wl.is-empty .wl-chips, .wl.is-empty .wl-table thead { display: none; }
.wl-linkbtn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; min-height: 36px; }
.wl-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; font-size: 0.78rem; color: var(--text-tertiary); line-height: 1.5; }
.wl-foot span { flex: 1 1 24rem; }

.wl-form { display: flex; flex-direction: column; gap: 1rem; }
.wl-field { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; border: 0; padding: 0; margin: 0; }
.wl-field[hidden] { display: none; }
.wl-field legend { padding: 0; margin-bottom: 0.4rem; }
.wl-field .form-input { min-height: 40px; font-family: var(--font-mono); font-size: 0.88rem; }
.wl-notes-input { font-family: var(--font-body) !important; resize: vertical; min-height: 4rem !important; }
.wl-field input[aria-invalid="true"] { border-color: var(--danger); }
#wlSymHint { line-height: 1.5; }
#wlSymHint code { font-size: 0.75rem; }
.wl-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wl-seg .seg-item { position: relative; cursor: pointer; }
.wl-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.wl-seg .seg-item:has(input:checked) { background: var(--gradient-brand); color: var(--primary-ink); }
.wl-seg .seg-item:has(input:focus-visible) { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.wl-form-acts { display: flex; gap: 0.5rem; }
.wl-form-acts .btn { flex: 1; min-height: 44px; font-weight: 600; }

@media (max-width: 900px) {
    .wl-table thead { display: none; }
    .wl-table, .wl-table tbody { display: block; }
    .wl-table tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: 0.6rem 1rem; padding: 0.95rem 1rem; border-bottom: 1px solid var(--border-subtle); position: relative; }
    .wl-table tbody tr:last-child { border-bottom: 0; }
    .wl-table td { display: block; padding: 0 !important; border: 0; white-space: normal; text-align: left; }
    .wl-table td.num { text-align: left; }
    .wl-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 0.15rem; font: 500 0.7rem var(--font-body); color: var(--text-tertiary); }
    .wl-table td.wl-asset { grid-column: 1 / -1; }
    .wl-table td.wl-notes { grid-column: 1 / -1; max-width: none; }
    .wl-table td.wl-acts { grid-column: 1 / -1; width: auto; text-align: left; display: flex; gap: 0.25rem; margin-left: -0.6rem; }
    .wl-table tbody tr:hover td { background: none; }
    .wl-table tr.is-triggered { background: var(--accent-soft); }
    .wl-table tr.is-triggered td { background: none; }
    .wl-dist { justify-content: flex-start; }
    .wl-dist-text { text-align: left; min-width: 0; }
}
@media (max-width: 720px) {
    .wl .page-actions { width: 100%; }
    .wl .page-actions .btn { flex: 1; }

}

/* ══ WALLET GROUP (public shell, overview vocabulary) ═════════════════════ */
.gp { gap: var(--ov-gap); }
.gp .page-header { margin-bottom: 0; }
.gp .grp-tabs { margin: 0; }
.gp .grp-memberbar { margin-bottom: 0; }
.gp #groupNoticeBox:empty { display: none; }
.grp-refetching .ov-now, .grp-refetching .ov-verdict { opacity: 0.45; transition: opacity var(--dur-base) var(--ease-out); }
.gp [hidden] { display: none !important; }

.gp-skel { display: inline-block; width: 6rem; height: 1.1rem; border-radius: 4px; vertical-align: middle; }
.gp-skel-sm { display: inline-block; width: 3.5rem; height: 0.9rem; border-radius: 4px; vertical-align: middle; }
.gp-now { grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); }
.gp-big { font-family: var(--font-heading); font-weight: 700; font-size: 1.45rem; letter-spacing: -0.01em; }
.gp-now .ov-k .ov-muted { margin-left: 0.25rem; font-weight: 500; }
.gp-spark { display: block; width: 100%; max-width: 12rem; height: 22px; margin-top: 0.35rem; }

.gp-chart-skel .skel-shimmer { width: 100%; height: 300px; border-radius: var(--radius-md); }
.gp-donut-skel { padding: 1.5rem 0; }
.gp-donut-skel .skel-shimmer { width: 170px; height: 170px; border-radius: 50%; margin: 0 auto; }

/* Hedged within the group: one row per market, both legs off a zero line. */
.gp-hb {
    display: grid; grid-template-columns: 7rem minmax(0, 1fr) 6.5rem 5.5rem; column-gap: 1rem; row-gap: 0.2rem;
    align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--border-subtle); font-size: 0.82rem;
}
.gp-hb-head { padding: 0 0 0.4rem; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-tertiary); }
.gp-hb-axis { display: flex; justify-content: space-between; text-transform: none; letter-spacing: 0; font-weight: 500; }
.gp-hb .ov-mkt-coin .venue-badge { margin-left: 0.4rem; padding: 0 0.3rem; line-height: 1.5; font-size: 0.6rem; border-radius: 4px; }
.gp-hb-track { position: relative; height: 10px; }
.gp-hb-track::before { content: ''; position: absolute; left: 50%; top: -6px; bottom: -6px; width: 1px; background: var(--border-focus); }
.gp-hb-track b { position: absolute; top: 0; bottom: 0; min-width: 2px; }
.gp-hb-track b.is-long { left: calc(50% + 1px); background: var(--success); border-radius: 0 3px 3px 0; }
.gp-hb-track b.is-short { right: calc(50% + 1px); background: var(--danger); border-radius: 3px 0 0 3px; }
.gp-hb-net, .gp-hb-usd { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.gp-hb-head .gp-hb-net, .gp-hb-head .gp-hb-usd { font-family: var(--font-body); }
.gp-hb-sub { grid-column: 1 / -1; font-size: 0.74rem; color: var(--text-tertiary); line-height: 1.45; }
.gp-hb-sub span[data-addr], .gp-look span[data-addr] { color: var(--text-secondary); font-weight: 600; }
#gpHedgedBody > .ov-s { margin: 0.75rem 0 0; }
.gp-look { margin-top: 0.9rem; }
#gpHedgedBody .gp-look { padding-top: 0.9rem; border-top: 1px solid var(--border-subtle); }
.gp-look .ov-sev { flex-basis: 5.5rem; }

.gp-conc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gp-conc .ov-now-cell { padding: 1rem 1.25rem; }
#gpCrowded { padding-top: 0; }
#gpCrowded .gp-look { margin-top: 0.9rem; }

.gp-figs { margin-top: 1.1rem; }
.gp-figs .ov-v small { font-size: 0.72rem; color: var(--text-tertiary); margin-left: 0.15rem; font-weight: 500; }

/* Tables */
.gp-cards th.is-sortable { cursor: pointer; user-select: none; }
.gp-cards th.is-sortable:hover { color: var(--text-primary); }
.gp-cards th.num { text-align: right; }
.gp-cards .sort-arrow { font-size: 0.65rem; opacity: 0.7; }
.gp-cards .badge { margin-left: 0.4rem; }
.gp-perf tr.gp-total td { border-top: 1px solid var(--border-focus); font-weight: 700; color: var(--text-primary); background: rgba(80, 210, 193, 0.035); }
.gp-act { width: 1%; text-align: right; white-space: nowrap; }
.gp-share { display: inline-flex; align-items: center; justify-content: flex-end; gap: 0.5rem; }
.gp-btn { min-height: 36px; padding: 0 0.9rem; }
.grp-holder.is-long { box-shadow: inset 0 -2px 0 var(--success); }
.grp-holder.is-short { box-shadow: inset 0 -2px 0 var(--danger); }
#groupMembers td:first-child, #groupPositions td:first-child { white-space: nowrap; }
.gp-window { margin: 0; max-width: 72rem; line-height: 1.55; }
.gp-window span[data-addr] { color: var(--text-secondary); font-weight: 600; }

/* Wide tables scroll inside their panel above the card breakpoint. */
@media (min-width: 901px) {
    #grp-members .panel-body, #grp-performance .panel-body, #grpPositionsTableWrap { overflow-x: auto; }
}

@media (max-width: 900px) {
    .gp-cards thead { display: none; }
    .gp-cards, .gp-cards tbody { display: block; }
    .gp-cards tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: 0.6rem 1rem; padding: 0.95rem 1rem; border-bottom: 1px solid var(--border-subtle); }
    .gp-cards tbody tr:last-child { border-bottom: 0; }
    .gp-cards td { display: block; padding: 0 !important; border: 0; white-space: normal; text-align: left; }
    .gp-cards td.num { text-align: left; }
    .gp-cards td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 0.15rem; font: 500 0.7rem var(--font-body); color: var(--text-tertiary); }
    .gp-cards td:first-child { grid-column: 1 / -1; font-weight: 700; }
    .gp-cards td.gp-act { grid-column: 1 / -1; width: auto; text-align: left; margin-left: -0.6rem; }
    .gp-cards td[data-label="Held by"] { grid-column: 1 / -1; }
    .gp-cards tbody tr:hover td { background: none; }
    .gp-perf tr.gp-total { background: rgba(80, 210, 193, 0.035); }
    .gp-perf tr.gp-total td { border-top: 0; background: none; }
    .gp-share { justify-content: flex-start; }
    .gp-hb { grid-template-columns: 5.5rem minmax(0, 1fr) 5.5rem; }
    .gp-hb-usd { display: none; }
}
@media (max-width: 720px) {
    .gp .page-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
    .gp .page-actions .btn { min-height: 40px; }
    .gp-now { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gp-big { font-size: 1.2rem; }
    .gp-conc .ov-now-cell { padding: 0.85rem 1rem; }
    .gp-look .ov-sev { flex-basis: auto; }
    /* Net positions: three short lines per market instead of a seven-label
       card — market + notional, net size + unrealized, then who holds it.
       Long/short legs are dropped here; the net size and badge carry them. */
    #groupPositions tr { grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 0.75rem; padding: 0.7rem 1rem; align-items: baseline; }
    #groupPositions td:first-child { grid-column: 1; grid-row: 1; }
    #groupPositions td[data-label="Notional"] { grid-column: 2; grid-row: 1; text-align: right; }
    #groupPositions td[data-label="Net size"] { grid-column: 1; grid-row: 2; font-size: 0.8rem; }
    #groupPositions td[data-label="Unrealized"] { grid-column: 2; grid-row: 2; text-align: right; font-size: 0.8rem; }
    #groupPositions td[data-label="Long"], #groupPositions td[data-label="Short"] { display: none; }
    #groupPositions td[data-label="Held by"] { grid-column: 1 / -1; grid-row: 3; }
    #groupPositions td[data-label]::before { display: inline; margin: 0 0.35rem 0 0; }
    #groupPositions td[data-label="Notional"]::before { display: none; }
}
/* The public shell gives this section no side padding of its own, so below
   its 1200px max width the page ran to the screen edge. */
@media (max-width: 1240px) { .grp-section { padding-left: 16px; padding-right: 16px; } }
@media (max-width: 1100px) { .wl .ov-now-cell:last-child { grid-column: 1 / -1; } }
@media (min-width: 901px) {
    #groupMembers th, #groupMembers td, .gp-perf th, .gp-perf td { padding-left: 0.6rem; padding-right: 0.6rem; }
    #groupMembers th:first-child, #groupMembers td:first-child, .gp-perf th:first-child, .gp-perf td:first-child { padding-left: 1.1rem; }
}

/* Funding scanner: long lists wait behind a "Show all" button. */
section:not(.is-all) > .panel-body .tl-more { display: none !important; }
.tl-showall { display: block; width: calc(100% - 2.7rem); margin: 0.75rem 1.35rem 1rem; min-height: 38px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: transparent; color: var(--primary-text); font: 600 0.82rem var(--font-body); cursor: pointer; }
.tl-showall:hover { border-color: var(--border-focus); background: rgba(80, 210, 193, 0.06); }
.tl-showall:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.tl-showall.is-inline { display: inline-block; width: auto; margin: 0; min-height: 32px; padding: 0 0.85rem; }
.tl-showall.is-inline[hidden] { display: none; }
.tl-flow { display: block; font-size: 0.7rem; }
@media (max-width: 720px) { .cl-window { flex-direction: column; align-items: stretch; gap: 0.75rem; } .cl-window-link { align-self: flex-start; } }
/* All-markets table: ten columns fit a 1280px+ screen without sideways scroll. */
.tl-scroll .ov-table th, .tl-scroll .ov-table td { padding-left: 0.6rem; padding-right: 0.6rem; }
.tl-scroll .ov-table th:first-child, .tl-scroll .ov-table td:first-child { padding-left: 1.35rem; }

/* ═══ MONEY FLOW REPORT (flow.html, flow-report.js) ═══════════════════════
   Range cards, flow diagram, money-moved-vs-trading split, counterparties,
   linked wallets, transfers and the alert form. The network graph keeps its
   .flow-* styles above. */
:root {
    --fr-bridge: #ffb454; --fr-vault: #ffb454; --fr-subaccount: #a78bfa; --fr-trader: #50d2c1;
    --fr-cex: #f43f5e; --fr-peer: #8fa3a2; --fr-contract: #8fa3a2; --fr-others: #5f7473;
}
[data-theme="light"] { --fr-bridge: #b45309; --fr-vault: #b45309; --fr-subaccount: #7c3aed; --fr-trader: #0f766e; --fr-peer: #64748b; --fr-contract: #64748b; --fr-others: #94a3b8; }
.fr-range { flex: 0 0 auto; }
.fr-kpis .fr-kname { display: block; font: 600 1.05rem var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border-subtle); }
.fr-tab { position: relative; padding: .7rem 1rem; min-height: 44px; background: none; border: 0; color: var(--text-tertiary); font: 600 .9rem var(--font-body); cursor: pointer; }
.fr-tab:hover { color: var(--text-secondary); }
.fr-tab.is-on { color: var(--text-primary); }
.fr-tab.is-on::after { content: ""; position: absolute; left: .5rem; right: .5rem; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); }
.fr-tab:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; border-radius: var(--radius-sm); }
.fr-panel { display: flex; flex-direction: column; gap: var(--ov-gap, 1.25rem); }
.fr-panel[hidden] { display: none; }
.fr-empty { margin: 0; padding: 1rem 0; font-size: .85rem; }

/* Flow diagram: SVG from 720px up, two ranked lists below. */
.fr-sankey svg { display: block; width: 100%; height: auto; }
.fr-sankey { max-width: 1040px; margin: 0 auto; padding: .5rem 0; }
/* Faint bands: the nodes carry the counterparty type, the band only the direction. */
.fr-band { opacity: .14; transition: opacity var(--dur-fast) var(--ease-out); }
.fr-band.is-in { fill: var(--success); }
.fr-band.is-out { fill: var(--danger); }
.fr-band:hover { opacity: .34; }
.fr-sk-root { fill: var(--primary); }
.fr-sk-head { font: 600 11px var(--font-body); letter-spacing: .08em; fill: var(--text-tertiary); }
.fr-sk-label { font: 600 14px var(--font-body); fill: var(--text-primary); }
.fr-sk-amt { font: 500 12px var(--font-mono); fill: var(--text-tertiary); }
.fr-sk-amt .is-in { fill: var(--success-text, var(--success)); }
.fr-sk-amt .is-out { fill: var(--danger-text, var(--danger)); }
.fr-sides { display: none; }
.fr-sidelist + .fr-sidelist { margin-top: 1.1rem; }
.fr-sidelist ol { list-style: none; margin: .4rem 0 0; padding: 0; }
.fr-sidelist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .75rem; padding: .55rem 0; border-top: 1px solid var(--border-subtle); }
.fr-sl-name { font-weight: 600; font-size: .88rem; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-sl-amt { font: 600 .85rem var(--font-mono); text-align: right; }
.fr-sl-amt.is-in { color: var(--success-text, var(--success)); }
.fr-sl-amt.is-out { color: var(--danger-text, var(--danger)); }
.fr-sl-bar { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--bg-tertiary); overflow: hidden; }
.fr-sl-bar b { display: block; height: 100%; min-width: 2px; border-radius: 3px; }
.fr-sl-bar b.is-in { background: var(--success); }
.fr-sl-bar b.is-out { background: var(--danger); }

/* Money moved vs trading */
.fr-eq-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.fr-eq-cell .ov-v { font-size: 1.2rem; }
.fr-eq-op { font: 600 1.1rem var(--font-mono); color: var(--text-tertiary); }
.fr-c-cap { color: var(--accent-ink); }
.fr-eq-read { margin: .75rem 0 0; font-size: .85rem; color: var(--text-secondary); }
.fr-split-chart { position: relative; height: 280px; margin-top: 1rem; }

/* Counterparties + side column */
.fr-cols { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: var(--ov-gap, 1.25rem); align-items: start; }
.fr-cols > .panel { min-width: 0; }
.fr-table td { vertical-align: middle; }
.fr-name { font-weight: 600; color: var(--text-primary); text-decoration: none; }
a.fr-name:hover, a.fr-name:focus-visible { color: var(--primary-text); text-decoration: underline; }
.fr-type { display: inline-block; margin-left: .35rem; padding: 0 .35rem; border-radius: 4px; font: 600 .7rem/1.6 var(--font-body); border: 1px solid currentColor; }
.fr-type[data-type="bridge"], .fr-type[data-type="vault"] { color: var(--fr-bridge); }
.fr-type[data-type="subaccount"] { color: var(--fr-subaccount); }
.fr-type[data-type="trader"] { color: var(--fr-trader); }
.fr-type[data-type="cex"] { color: var(--fr-cex); }
.fr-type[data-type="peer"], .fr-type[data-type="contract"] { color: var(--fr-peer); }
.fr-sub { display: block; margin-top: .1rem; font-size: .72rem; color: var(--text-tertiary); }
.fr-spark { display: block; }
.fr-spark-zero { stroke: var(--border-subtle); stroke-width: 1; }
.fr-spark .is-in { fill: var(--success); }
.fr-spark .is-out { fill: var(--danger); }
.fr-last { color: var(--text-tertiary); white-space: nowrap; font-size: .8rem; }
.fr-more { display: block; margin: .75rem auto 1rem; min-height: 40px; }

.fr-link-item { padding: .9rem 0; border-top: 1px solid var(--border-subtle); }
.fr-link-item:first-child { border-top: 0; padding-top: 0; }
.fr-link-why { margin: .3rem 0 0; font-size: .8rem; color: var(--text-secondary); }
.fr-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.fr-chip { display: inline-flex; align-items: center; min-height: 32px; padding: 0 .7rem; border-radius: var(--radius-pill); border: 1px solid color-mix(in srgb, var(--fr-subaccount) 45%, transparent); color: var(--text-primary); font-size: .8rem; font-weight: 600; text-decoration: none; }
.fr-chip:hover, .fr-chip:focus-visible { border-color: var(--fr-subaccount); background: color-mix(in srgb, var(--fr-subaccount) 12%, transparent); }
.fr-link-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.fr-strength { flex-shrink: 0; padding: .05rem .45rem; border-radius: var(--radius-pill); font: 600 .7rem/1.6 var(--font-body); }
.fr-strength.is-certain { color: var(--success-text, var(--success)); background: color-mix(in srgb, var(--success) 14%, transparent); }
.fr-strength.is-strong { color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.fr-strength.is-possible { color: var(--text-secondary); background: var(--bg-tertiary); }
.fr-reasons { margin: .35rem 0 0; padding-left: 1rem; font-size: .8rem; color: var(--text-secondary); }
.fr-reasons li + li { margin-top: .15rem; }
.fr-group-btn { margin-top: .9rem; min-height: 40px; }

.fr-alert-form { display: flex; flex-direction: column; gap: .9rem; }
.fr-field { display: flex; flex-direction: column; gap: .35rem; font-size: .75rem; color: var(--text-tertiary); }
.fr-field .form-input { min-height: 42px; width: 100%; }
.fr-amounts { display: flex; width: 100%; }
.fr-amounts .seg-item { flex: 1 1 0; min-height: 40px; justify-content: center; }
.fr-alert-btn { min-height: 44px; width: 100%; justify-content: center; }
.fr-alert-msg { margin: 0; font-size: .78rem; color: var(--text-tertiary); }

/* Transfers */
.fr-move-list { list-style: none; margin: 0; padding: 0; }
.fr-move { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) auto 2rem; align-items: center; gap: .75rem; padding: .6rem 1.25rem; border-top: 1px solid var(--border-subtle); }
.fr-move:first-child { border-top: 0; }
.fr-mv-when { font-size: .8rem; color: var(--text-tertiary); white-space: nowrap; }
.fr-mv-what { font-size: .88rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-mv-amt { font: 600 .9rem var(--font-mono); text-align: right; white-space: nowrap; }
.fr-mv-tx { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; color: var(--text-tertiary); text-decoration: none; border-radius: var(--radius-sm); }
.fr-mv-tx:hover { color: var(--primary-text); background: var(--bg-card-hover); }

@media (max-width: 1100px) {
    .fr-cols { grid-template-columns: minmax(0, 1fr); }
    .fr-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Below 900px the diagram's labels would shrink under 11px: show the ranked lists. */
@media (max-width: 900px) {
    .fr-sankey { display: none; }
    .fr-sides { display: block; }
}
@media (max-width: 720px) {
    .fr-split-chart { height: 240px; }
    .fr-eq-cell .ov-v { font-size: 1.05rem; }
    .fr-eq-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem; }
    .fr-eq-op { display: none; }
    .fr-trend-h, .fr-table td.fr-trend { display: none; }
    .fr-table thead { display: none; }
    .fr-table, .fr-table tbody { display: block; }
    .fr-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem .75rem; padding: .8rem 1rem; border-bottom: 1px solid var(--border-subtle); }
    .fr-table td { display: block; padding: 0 !important; border: 0; text-align: left !important; }
    .fr-table td:first-child { grid-column: 1 / -1; }
    .fr-table td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; font: 500 .7rem var(--font-body); color: var(--text-tertiary); }
    .fr-table td.fr-last { display: none; }
    .fr-move { grid-template-columns: 3.4rem minmax(0, 1fr) auto 40px; padding: .45rem .5rem .45rem 1rem; gap: .5rem; }
    /* The amount's sign and colour already say in or out. */
    .fr-mv-kind { display: none; }
    .fr-mv-what { white-space: nowrap; font-size: .82rem; }
    .fr-mv-amt { font-size: .82rem; }
    .fr-mv-tx { min-width: 40px; min-height: 40px; }
    .fr-tab { flex: 1 1 0; }
}
