/* Design tokens now live in static/css/tokens.css (loaded first).
   This file is component styles only — everything below uses var().
   (:root moved to tokens.css 2026-07-19, design-system import.) */

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--background);
    color: var(--foreground);
    overflow: hidden;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Top Navigation Bar */
.navbar {
    height: 64px;
    background: var(--card);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 24px;
    position: relative;
    z-index: 100;
}

/* Hamburger Menu (hidden on desktop) */
.hamburger { display: none; flex-direction: column; gap: 4px; cursor: pointer; padding: 8px; background: none; border: none; }
.hamburger span { width: 20px; height: 2px; background: var(--foreground); border-radius: 2px; transition: all 0.3s; }

.logo { font-weight: 600; font-size: 18px; color: var(--foreground); display: flex; align-items: center; gap: 8px; }
.logo-icon { width: 6px; height: 20px; background: var(--primary); border-radius: 2px; }

.search-container {
    flex: 0 0 400px;
    position: relative;
}

.search-input {
    width: 100%;
    background: var(--background-secondary);
    border: 1px solid var(--outline);        /* visible resting outline (Material) */
    border-radius: 8px;
    padding: 10px 16px 10px 40px;
    color: var(--foreground);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}

.search-input:hover { border-color: var(--outline-hover); }
.search-input:focus { outline: none; border-color: var(--primary); background: var(--card); box-shadow: 0 0 0 3px var(--primary-bg-hover); }
.search-input::placeholder { color: var(--foreground-muted); }

.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--foreground-muted); width: 16px; height: 16px; }
.search-icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 2; }

.nav-links {
    display: flex;
    gap: 8px;
    margin-left: auto;
    align-items: center;
}

.nav-link {
    padding: 8px 16px;
    color: var(--foreground-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-link:hover { color: var(--foreground); background: var(--background-secondary); }
.nav-link.active { color: var(--primary); }

.subscribe-btn {
    background: var(--primary);
    border: none;
    color: var(--ink);
    padding: 9px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.subscribe-btn:hover { background: var(--primary-hover); }

/* Main Layout */
.main-container {
    display: flex;
    height: calc(100vh - 64px);
    margin-top: 64px;
    position: relative;
}

/* Chart Container */
.chart-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-right: var(--icon-bar-width);
}

/* Chart top bar (owner mock 2026-07-26): instrument identity left, the
   weather read as a pill right. A flex ROW rather than a floating overlay
   — an absolutely-positioned pill would sit on top of the price-axis
   labels in the top-right corner, which is exactly where they live. */
.chart-topbar {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-right: 12px;
}
.chart-topbar .stock-header { flex: 1 1 auto; min-width: 0; }

/* Stock Header — the pair/symbol text was hidden outright (2026-07-17)
   because the toolbar wheel owns symbol switching. Restored on DESKTOP
   only (owner mock 07-26): there is room for the identity there, and the
   wheel remains the switcher. Mobile keeps them hidden — the mock for
   small screens is the pill alone. */
.stock-pair, .stock-symbol { display: none; }
@media (min-width: 769px) {
    /* full-basis pair forces the symbol onto its own line, so identity
       reads as a stacked block beside the wheel */
    .stock-pair { display: block; flex: 0 0 100%; }
    .stock-symbol { display: block; }
}

/* The weather pill. Styling lives here rather than inline on the element
   so the media queries below can actually win. */
#weatherStrip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--surface-card, #111219);
    border: 1px solid var(--outline);
    font-size: 13px;
    line-height: 1.1;
    white-space: nowrap;
    cursor: pointer;
    max-width: 100%;
    overflow: hidden;
    transition: background 0.12s, border-color 0.12s;
}
#weatherStrip:hover { border-color: var(--outline-hover); }
#weatherStrip:empty { display: none; }   /* no data -> no empty capsule */

/* Stock Header */
.stock-header {
    /* In normal flow since the phone-UI pass (2026-07-16): the header,
       chip row and weather strip must never sit ON the canvas. */
    position: relative;   /* in flow, but still the dropdown's anchor */
    z-index: 30;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    column-gap: 12px;
    row-gap: 2px;
    padding: 10px 12px 2px;
}
.stock-header #intervalChips { flex-wrap: wrap; }

.stock-pair { font-size: 11px; color: var(--foreground-muted); margin-bottom: 2px; }
.stock-symbol { font-size: 20px; font-weight: 700; color: var(--foreground); cursor: pointer; user-select: none; }
.stock-symbol:hover { color: var(--primary); }
.symbol-chevron { font-size: 12px; color: var(--foreground-muted); margin-left: 4px; }

/* Symbol Dropdown */
.symbol-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 40;
    margin-top: 6px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 4px;
    min-width: 140px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 20;
}
.symbol-dropdown-item {
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--foreground-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.12s;
}
.symbol-dropdown-item:hover { background: var(--background-secondary); color: var(--foreground); }
.symbol-dropdown-item.active { color: var(--primary); background: var(--primary-bg); }

/* Chart Area */
.chart-area {
    flex: 1;
    background: var(--chart-background);
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.chart-area #chartContainer { flex: 1; min-height: 0; }

/* Flow Timeline Canvas */
#flowTimelineCanvas { width: 100%; display: block; height: 580px; }

/* Lambda Timeline Canvas */
#lambdaTimelineCanvas { width: 100%; display: block; height: 180px; }

/* VPIN Timeline Canvas */
#vpinTimelineCanvas { width: 100%; display: block; height: 180px; }

/* Flow Timeline Tabs */
.ft-tab {
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: var(--foreground-muted);
    background: transparent;
    border: 1px solid var(--outline);        /* visible resting outline (Material) */
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}
/* hover = state-layer fill + stronger outline; the outline never disappears */
.ft-tab:hover { color: var(--foreground-secondary); background: var(--primary-bg); border-color: var(--outline-hover); }
.ft-tab:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg-hover); }
/* selected toggle = primary border + tinted fill */
.ft-tab.active { color: var(--foreground); background: var(--primary-bg); border-color: var(--primary); }

/* Flow Timeline Controls Row */
.ft-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 8px;
}

/* Flow Timeline Zoom Controls */
.ft-zoom-controls {
    display: flex;
    align-items: center;
    gap: 2px;
}
.ft-zoom-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
    color: var(--foreground-muted);
    background: transparent;
    border: 1px solid var(--outline);        /* visible resting outline (Material) */
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}
.ft-zoom-btn:hover { color: var(--foreground); background: var(--primary-bg); border-color: var(--outline-hover); }
.ft-zoom-btn:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg-hover); }
.ft-zoom-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--foreground-secondary);
    min-width: 26px;
    text-align: center;
    user-select: none;
}

/* Wide panel variant for Timeline */
.side-panel.wide-panel { width: 35vw; min-width: 420px; right: -35vw; }
.side-panel.wide-panel.open { right: var(--icon-bar-width); }

/* Icon Bar */
.icon-bar {
    position: fixed;
    right: 0;
    top: 64px;
    bottom: 0;
    width: var(--icon-bar-width);
    /* the app's black — it is chrome BEHIND the raised panel, not a card;
       its left border is the divider between the two */
    background: var(--bg);
    border-left: 1px solid var(--outline);
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    gap: 4px;
    z-index: 200;
}

.icon-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--foreground-muted);
    position: relative;
}

.icon-btn:hover { background: var(--background-secondary); color: var(--foreground-secondary); }
.icon-btn.active { background: var(--background-secondary); color: var(--primary); }

.icon-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 32px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

.icon-wrapper { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }

.icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-label { font-size: 10px; font-weight: 500; letter-spacing: 0.3px; }

/* Side Panel */
/* The open panel sits BETWEEN the chart (left) and the icon bar (right).
   Both were --card with a --card-border edge, and --card-border is
   transparent by design, so they merged into one surface that read as
   floating (owner 2026-07-26).

   ELEVATION DIRECTION (owner 2026-07-26, second pass): the OPEN panel is
   the raised surface (--surface-card) and the chrome behind it — icon bar
   and chart — is the app's black (--bg). The first attempt had it the
   other way round, which made the thing you opened look like a hole rather
   than a sheet on top. Plus two real edges: the panel's own left border +
   shadow against the chart, and the icon bar's left border against it. */
.side-panel {
    position: fixed;
    right: calc(-1 * var(--panel-width));
    top: 64px;
    bottom: 0;
    width: var(--panel-width);
    background: var(--surface-card);
    border-left: 1px solid var(--outline);
    box-shadow: -16px 0 36px rgba(0, 0, 0, 0.55);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 150;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.side-panel.open {
    right: var(--icon-bar-width);
}

.panel-header {
    padding: 16px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card);
    flex-shrink: 0;
}

.panel-title {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
    color: var(--foreground);
}

/* Copy-positioning button — a real, tappable pill (LLM/post-ready text) */
.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    padding: 5px 12px;
    background: var(--background-secondary);
    color: var(--foreground-secondary);
    border: none;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.copy-btn:hover { background: rgba(255, 255, 255, 0.10); color: var(--foreground); }
.copy-btn:active { transform: scale(0.97); }
.copy-btn svg { display: block; }
.copy-btn .check-ico { display: none; }
.copy-btn.copied { color: var(--success); }
.copy-btn.copied .copy-ico { display: none; }
.copy-btn.copied .check-ico { display: block; }

.close-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--foreground-muted);
    font-size: 20px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-btn:hover { background: var(--background-secondary); color: var(--foreground); }

.panel-content {
    padding: 16px;
    word-break: break-word;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Status Cards */
.status-card {
    background: var(--background-secondary);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.status-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--foreground-muted);
    font-weight: 600;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.metric-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.metric-row:first-child {
    padding-top: 0;
}

.metric-label {
    font-size: 13px;
    color: var(--foreground-secondary);
}

.metric-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--foreground);
    font-family: 'Inter', sans-serif;
}

.value-green { color: var(--success); }
.value-red { color: var(--danger); }

.cluster-indicator { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; padding: 4px 8px; border-radius: 4px; background: var(--card); font-weight: 500; }
.cluster-dot { width: 6px; height: 6px; border-radius: 50%; }
.dot-demand { background: var(--success); }
.dot-supply { background: var(--danger); }

.section-title {
    font-size: 11px;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--foreground);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Weather / Signals / Prints pills (Atlas handoff, 2026-07-26). Pills, not
   a segmented control: the active one is filled with brand periwinkle so the
   current view is unmistakable at a glance on a phone. Periwinkle is a brand
   hue, never a direction hue, so the green/red colour law is untouched. */
.pf-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}
.pf-tab {
    padding: 6px 14px;
    border: none;
    border-radius: 16px;
    font-size: 12.5px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    background: var(--background-secondary);
    color: var(--foreground-muted);
    transition: background 0.12s, color 0.12s;
}
.pf-tab.active {
    background: var(--primary);
    color: var(--ink, #0A0C08);
    font-weight: 600;
}
.pf-tab:hover:not(.active) { color: var(--foreground-secondary); }
.pf-tab-hint { font-size: 11px; color: var(--foreground-muted); margin-bottom: 10px; line-height: 1.5; }
/* first row in a weather group: no divider hugging the group title */
.wx-group > div:first-child { border-top: none !important; }

/* Scrollbar */
/* Respect reduced-motion: shimmer and eases become instant */
@media (prefers-reduced-motion: reduce) {
    .skel { animation: none; }
    .side-panel, .pane-label, button, [id^="wxDetail"] {
        transition-duration: 0.01ms !important;
    }
}

/* Touch feedback + keyboard focus: every tappable thing responds to the
   finger (subtle press scale) and to the keyboard (visible focus ring). */
button:active, .icon-btn:active, .pane-label:active, .family-card:active,
.checkbox-item:active, .watch-card [onclick]:active {
    transform: scale(0.97);
    transition: transform 0.05s;
}
button:focus-visible, a:focus-visible, select:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary, #AFD8FF);
    outline-offset: 1px;
}

/* Loading skeletons: shimmer placeholders instead of "Loading..." text —
   the layout arrives first, the numbers fill in. */
.skel {
    display: block;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg,
        rgba(128,128,128,0.12) 25%,
        rgba(128,128,128,0.22) 50%,
        rgba(128,128,128,0.12) 75%);
    background-size: 200% 100%;
    animation: skel-shimmer 1.4s ease-in-out infinite;
}
@keyframes skel-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* In-pane indicator labels (TradingView grammar): name chip anchored to
   the pane; actions appear on hover (desktop) or tap (mobile). Today the
   only action is hide — per-indicator settings land here later. */
.pane-label {
    position: absolute;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: var(--foreground-muted);
    background: color-mix(in srgb, var(--card) 82%, transparent);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 2px 7px;
    cursor: pointer;
    user-select: none;
}
.pane-label .pane-actions { display: none; }
.pane-label:hover .pane-actions,
.pane-label.open .pane-actions { display: inline-flex; }
.pane-action {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 5px;
    cursor: pointer;
    background: var(--background-secondary);
    border: 1px solid var(--card-border);
    color: var(--foreground-muted);
}
.pane-action:hover { color: var(--foreground); }
.pane-label-val {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    min-width: 44px;
}
.pane-label.minimized .pane-label-val { display: none; }
.pane-label .pane-show { display: none; }
/* Minimized = a clear restore chip, not a ghost: opaque card, eye-off
   icon, full-strength text. Tapping anywhere on it brings the pane back. */
.pane-label.minimized {
    background: var(--card);
    border-color: var(--primary, #AFD8FF);
    color: var(--foreground);
}
.pane-label.minimized .pane-actions { display: none !important; }
.pane-label.minimized .pane-label-val { display: none; }
.pane-label.minimized .pane-show {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

/* Panel scrollbar rules removed 2026-07-26: the app-wide macOS-style
   scrollbar in tokens.css now covers this, and the local 6px override was
   both narrower and flush against the edge. */

/* Mobile Menu Drawer */
.mobile-menu {
    position: fixed;
    top: 64px;
    right: -100%;
    width: 100%;
    height: calc(100vh - 64px);
    background: var(--card);
    border-left: 1px solid var(--card-border);
    z-index: 200;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 24px 0;
}

.mobile-menu.open { right: 0; }

.mobile-menu-overlay {
    position: fixed;
    top: 64px;
    left: 0;
    width: 100%;
    height: calc(100vh - 64px);
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.open { opacity: 1; pointer-events: auto; }

.mobile-nav-link {
    display: block;
    padding: 16px 24px;
    color: var(--foreground-secondary);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.mobile-nav-link:hover { background: var(--background-secondary); color: var(--foreground); }
.mobile-nav-link.active { color: var(--primary); border-left-color: var(--primary); background: var(--background-secondary); }

.mobile-subscribe-btn {
    margin: 24px;
    padding: 12px 24px;
    background: var(--primary);
    color: var(--ink);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.mobile-subscribe-btn:hover { background: var(--primary-hover); }

/* Hamburger animation */
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
    }

    /* Show hamburger on mobile (already on right in HTML order) */
    .hamburger {
        display: flex;
        margin-left: auto;
    }

    /* Hide desktop nav items */
    .nav-links {
        display: none !important;
    }

    /* Simplify search on mobile */
    .search-container {
        flex: 0 0 auto;
        max-width: 200px;
        margin-right: 12px;
    }

    .search-input {
        padding: 8px 12px 8px 36px;
        font-size: 14px;
    }

    /* Chart: full width — the icon bar moves to the bottom on mobile */
    .chart-wrapper {
        margin-right: 0;
        /* tab bar (56) + wheel toolbar (90, height-locked) + safe area + 4 */
        margin-bottom: calc(150px + env(safe-area-inset-bottom, 0px));
    }
    .chart-area {
        padding: 4px;
    }
    .stock-header {
        padding: 6px 8px 0;
    }

    /* Mobile: identity is hidden and the interval chips dock to the bottom
       toolbar, so the header is empty and the pill IS the top row. Left-
       aligned, because the price axis owns the right edge. */
    .chart-topbar {
        justify-content: flex-start;
        padding-right: 8px;
        padding-left: 8px;
    }
    .chart-topbar .stock-header { flex: 0 0 auto; padding: 0; }
    #weatherStrip {
        margin-top: 6px;
        font-size: 12.5px;
        padding: 7px 12px;
    }
    /* Phone gets the state word and the one number, nothing else — the
       full set ran off the right edge of a 390px screen, and the headline
       is longer now than the "Calm" it replaced. Size, tier and live
       events are all one tap away in the panel. */
    .wx-pill-extra { display: none; }

    /* Chart tool chips dock to the THUMB ZONE: a fixed toolbar strip
       directly above the bottom tab bar (TradingView grammar). Bigger
       touch targets; horizontal scroll, never wrap, never overlap. */
    #intervalChips {
        position: fixed;
        left: 0;
        right: 0;
        bottom: calc(56px + env(safe-area-inset-bottom, 0px));
        z-index: 180;               /* under sheet (190) and tab bar (200) */
        display: flex;
        flex-wrap: nowrap;
        overflow: hidden;
        justify-content: space-between;
        gap: 4px;
        margin: 0;
        height: 90px;
        box-sizing: border-box;
        align-items: center;
        padding: 6px 12px;
        background: color-mix(in srgb, var(--background, #0b1220) 92%, transparent);
        backdrop-filter: blur(8px);
        border-top: 1px solid var(--card-border);
    }
    #intervalChips::-webkit-scrollbar { display: none; }
    #intervalChips button {
        flex: 0 0 auto;
        font-size: 15px !important;
        padding: 8px 9px !important;
        margin-left: 0 !important;
        line-height: 1 !important;
    }

    /* Icon bar becomes a bottom tab bar (broker-app pattern): fixed,
       horizontal, thumb-reachable, labels under icons. */
    .icon-bar {
        top: auto;
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        height: 56px;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px));
        border-left: none;
        border-top: 1px solid var(--card-border);
    }
    .icon-btn {
        flex: 1;
        max-width: 90px;
        gap: 3px;
        padding: 4px 0;
    }
    .icon-btn.active::before {
        display: none;
    }

    /* Panels become a bottom sheet on mobile: slide up from below
       instead of covering the chart from the side (thumb-reachable,
       and price stays visible above the sheet). */
    .side-panel,
    .side-panel.wide-panel {
        top: auto;
        left: 0;
        right: 0;
        bottom: -80vh;
        width: 100%;
        min-width: 0;
        height: 68vh;
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));  /* clear of the tab bar */
        border-left: none;
        border-top: 1px solid var(--outline);
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.55);
        transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .side-panel.open,
    .side-panel.wide-panel.open {
        right: 0;
        bottom: 0;
        z-index: 190;  /* sheet below the tab bar (200) so tabs stay tappable */
    }

    /* Grab handle: the swipe affordance every bottom sheet needs */
    .side-panel .panel-header::before {
        content: '';
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: var(--card-border);
    }
    .side-panel .panel-header { position: relative; }

    /* Adjust panel padding */
    .panel-content {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .logo span {
        display: none; /* Hide "PlainFlow" text, keep logo icon only */
    }

    .search-container {
        flex: 0 0 40px; /* Just show search icon */
    }

    .search-input {
        width: 40px;
        padding: 8px;
        border-radius: 50%;
        cursor: pointer;
    }

    .search-input::placeholder {
        opacity: 0;
    }
}

/* Track Record Panel */
.hypothesis-section {
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 12px;
}

.hypothesis-section:last-child { border-bottom: none; }

.hypothesis-header {
    cursor: pointer;
    padding: 10px;
    background: var(--primary-bg);
    border-radius: 6px;
    margin-bottom: 8px;
    transition: background 0.2s;
    font-size: 13px;
    font-weight: 500;
}

.hypothesis-header:hover { background: var(--primary-bg-hover); }
.hypothesis-empty .hypothesis-header { background: transparent; cursor: default; }
.signal-list { padding-left: 4px; }

.signal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12px;
}

.signal-item:last-child { border-bottom: none; }

/* Desktop (owner 2026-07-18 v2): chart TOOLS join the existing right
   icon-bar (below a separator); the symbol/interval wheel docks at the
   BOTTOM of the screen like mobile. Mobile rules unchanged. */
@media (min-width: 769px) {
    #intervalChips {
        position: fixed;
        left: 0;
        right: var(--icon-bar-width);
        bottom: 0;
        z-index: 60;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 8px;
        margin: 0;
        padding: 8px 12px;
        background: color-mix(in srgb, var(--background, #0b1220) 94%, transparent);
        backdrop-filter: blur(8px);
        border-top: 1px solid var(--card-border);
    }
    .chart-wrapper { margin-bottom: 96px; }
    .icon-bar #chartTools {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }
    .icon-bar #chartTools button { margin-left: 0 !important; }
    .chart-tools-sep {
        width: 22px;
        height: 1px;
        background: var(--card-border);
        margin: 10px auto 6px;
    }
}


/* Dashboard mobile (owner 2026-07-19): NO top navigation strip — the
   burger moves into the bottom-right tab (TradingView grammar) and the
   chart owns the full height. Desktop keeps the top nav.
   SCOPED to .dashboard-body (2026-07-22): dashboard.css is shared by every
   app page, so an unscoped `.nav { display:none }` was hiding the shared nav
   partial on mobile for health/signals/watches/account too. */
.icon-btn-menu { display: none; }
@media (max-width: 768px) {
    .dashboard-body .icon-btn-menu { display: flex; }
    .dashboard-body .nav { display: none !important; }
    .dashboard-body .main-container { margin-top: 0; height: 100vh; }
    /* NOTE: no .side-panel top override here — mobile panels are bottom
       sheets (top: auto; hidden via bottom: -80vh). Re-pinning top made
       them full-screen and unclosable (bug, 2026-07-19). */
    /* drawer covers the whole screen and sits above the tab bar */
    .dashboard-body .nav-mobile-menu { top: 0 !important; z-index: 300 !important; }
}


/* .wx-icon retired 2026-07-26: the per-line icon is gone from every
   breakpoint, not just mobile (Atlas). Eleven glyphs implied eleven
   categories the rows don't have, and the label already names the signal. */

/* Alert modal → bottom-sheet drawer on mobile (a floating card is bad on
   phones). Overrides the JS-set inline left/top with !important so it always
   docks to the bottom, full-width, with a grab handle. 2026-07-22. */
@media (max-width: 768px) {
    #alertModalCard {
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 88vh !important;
        overflow-y: auto !important;
        border-radius: 18px 18px 0 0 !important;
        border-bottom: none !important;
        padding-top: 30px !important;
    }
    #alertModalCard::before {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: var(--card-border);
    }
}

/* Alert-modal selects & fields: Material hover/focus states. The toggle
   buttons get their selected fill from JS; this covers the selectors and
   text fields. !important beats their inline resting border. 2026-07-22. */
#alertModalCard select:hover,
#alertModalCard input:hover,
#alertModalCard textarea:hover { border-color: var(--outline-hover) !important; }
#alertModalCard select:focus,
#alertModalCard input:focus,
#alertModalCard textarea:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--primary-bg-hover);
}
/* Outline toggle chips (channels / condition op): hover state layer. Selected
   state (JS) still shows its stronger primary fill. */
#alertModalCard .alertChan:hover,
#alertModalCard .alertCondOp:hover { background: var(--primary-bg-hover) !important; border-color: var(--outline-hover) !important; }

/* ── Mobile viewport height (2026-07-25): 100vh measures the LARGEST
   viewport, so full-height layouts overshoot under the browser chrome
   (address bar) and the bottom of the dashboard falls off-screen. svh =
   the stable small viewport (web.dev viewport-units guidance); dvh is
   deliberately avoided — it relayouts on every toolbar show/hide, which
   is visible jank on a chart this heavy. Older browsers keep the vh
   fallbacks declared above. */
@supports (height: 100svh) {
    body.dashboard-body { height: 100svh; }
    .main-container { height: calc(100svh - 64px); }
    .mobile-menu { height: calc(100svh - 64px); }
    .mobile-menu-overlay { height: calc(100svh - 64px); }
    @media (max-width: 768px) {
        .dashboard-body .main-container { height: 100svh; }
        .side-panel,
        .side-panel.wide-panel { bottom: -80svh; height: 68svh; }
    }
}

/* Compact snap wheel (symbol x interval): hide the scrollbar so the PEEK
   slivers of the neighbouring rows are the only scrollability cue. */
.pf-wheel::-webkit-scrollbar { display: none; }
