/* ============================================================================
   Sync Pulse — Mission Control / Light theme
   Editorial paper aesthetic. Warm off-white surfaces, deep charcoal type,
   chartreuse signal accent, monospace data. ECG waveform signature.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=IBM+Plex+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    /* --- Surfaces (warm paper) --- */
    --bg-base:        #faf9f4;     /* Warm off-white, paper-like */
    --bg-surface:     #ffffff;
    --bg-elevated:    #f5f3ec;     /* Headers / hover */
    --bg-input:       #ffffff;

    /* --- Borders --- */
    --border:         #e7e3d4;     /* Warm beige */
    --border-strong:  #d4cfbc;
    --border-glow:    rgba(101, 163, 13, 0.22);

    /* --- Text --- */
    --text-primary:   #15171a;
    --text-secondary: #545558;
    --text-muted:     #898a85;
    --text-faint:     #b8b5a6;

    /* --- Signal accent (chartreuse — distinct from generic Bootstrap green) --- */
    --accent:         #4d7c0f;     /* lime-700, legible on light */
    --accent-deep:    #3f6212;     /* lime-800 */
    --accent-bright:  #84cc16;     /* lime-500, for dots/glows */
    --accent-soft:    rgba(132, 204, 22, 0.13);
    --accent-glow:    rgba(132, 204, 22, 0.40);

    /* --- Status colors --- */
    --danger:         #b91c1c;     /* red-700 */
    --danger-bright:  #ef4444;
    --danger-soft:    rgba(239, 68, 68, 0.10);
    --warning:        #b45309;     /* amber-700 */
    --warning-bright: #f59e0b;
    --warning-soft:   rgba(245, 158, 11, 0.12);
    --info:           #0369a1;     /* sky-700 */
    --info-soft:      rgba(2, 132, 199, 0.10);

    /* --- Type --- */
    --font-display:   'Instrument Serif', 'Times New Roman', serif;
    --font-sans:      'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono:      'JetBrains Mono', 'IBM Plex Mono', 'SF Mono', Menlo, monospace;

    /* --- Motion --- */
    --ease-out:       cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html, body {
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--bg-base);
    margin: 0;
    padding: 0;
    font-feature-settings: "ss01", "cv11";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Atmospheric base layer — fine grid, sits behind everything */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(rgba(20, 20, 20, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(20, 20, 20, 0.025) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse at top, black 5%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at top, black 5%, transparent 70%);
}

/* Subtle paper grain */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    mix-blend-mode: multiply;
}

#react-entry-point, #_dash-app-content { position: relative; z-index: 1; }

/* ============================================================================
   Headings
   ============================================================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin: 0;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }

/* ============================================================================
   App layout — single-column page shell
   ============================================================================ */
.page-shell {
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.6rem 2.2rem 4rem 2.2rem;
    min-height: 100vh;
    position: relative;
}

/* Section divider — used between sections */
.section-divider {
    margin: 1.8rem 0;
    border: none;
    height: 1px;
    background: var(--border);
}

/* ============================================================================
   Scope strip — replaces the old filter bar
   Hierarchy: Platform (primary) · Window (secondary) · Timezone (ambient).
   ============================================================================ */
.scope-strip {
    margin-bottom: 1.1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}
/* Faint inner glow on the left edge — signals "primary scope" without shouting */
.scope-strip::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-bright) 30%, transparent 100%);
    opacity: 0.55;
}

.scope-row {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    padding: 0.85rem 1.1rem;
}
.scope-row--primary {
    align-items: center;
    flex-wrap: wrap;
    gap: 0.85rem 1.1rem;
}
.scope-row--secondary {
    background: linear-gradient(180deg, transparent 0%, rgba(20,20,20,0.018) 100%);
    border-top: 1px dashed var(--border);
    padding: 0.55rem 1.1rem;
    gap: 0.7rem;
}

/* Axis meta — the small "CHANNEL / source platform" stack on the left */
.scope-axis-meta {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    flex-shrink: 0;
    padding-right: 0.4rem;
    margin-right: 0.4rem;
    border-right: 1px solid var(--border);
}
.scope-axis-label {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-primary);
}
.scope-axis-label--sm {
    font-size: 0.56rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.18em;
}
.scope-axis-help {
    font-family: var(--font-mono);
    font-size: 0.54rem;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 400;
}

/* ── Platform channels — primary navigation row ──────────────────────────── */
.platform-channels {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
}
.platform-channels label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.95rem;
    margin: 0 !important;
    cursor: pointer;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-secondary);
    transition: all 0.15s var(--ease-out);
    user-select: none;
    position: relative;
}
.platform-channels label::before {
    /* Status dot prefix — neutral by default */
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--text-faint);
    flex-shrink: 0;
    transition: all 0.18s var(--ease-out);
}
/* "All" gets a hollow ring to read as "everything" */
.platform-channels label:first-of-type::before {
    border-color: var(--text-muted);
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--bg-base);
}
.platform-channels label:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
    background: var(--bg-elevated);
}
.platform-channels label:hover::before {
    border-color: var(--text-secondary);
}
.platform-channels input[type="radio"] {
    display: none;
}
.platform-channels label:has(input:checked) {
    color: var(--accent-deep);
    background: var(--accent-soft);
    border-color: var(--accent);
    box-shadow:
        0 0 0 1px var(--accent-soft),
        0 1px 0 rgba(20,20,20,0.02);
}
.platform-channels label:has(input:checked)::before {
    background: var(--accent-bright);
    border-color: var(--accent);
    box-shadow: 0 0 6px var(--accent-glow);
}
/* ── Beta channels — sensor wired but not yet broadcasting ───────────────────
   Chips for platforms in BETA_PLATFORMS (app.py) render with a dashed status
   dot and an amber readout badge to signal "provisional, excluded from ALL". */
.platform-channels label:has(.platform-beta-badge) {
    color: var(--text-muted);
}
.platform-channels label:has(.platform-beta-badge)::before {
    /* Dashed ring instead of a solid dot — channel is connected but offline */
    border-style: dashed;
    border-color: var(--warning-bright);
    background: transparent;
}
.platform-channels label:has(.platform-beta-badge):hover {
    color: var(--text-secondary);
}
.platform-channels label:has(.platform-beta-badge):has(input:checked)::before {
    /* Selected: fill goes warning-amber (not the live-signal lime) so the
       chip's selected state never gets confused with a healthy production
       channel. The dashed border persists as a signature. */
    background: var(--warning-bright);
    border-color: var(--warning);
    box-shadow: 0 0 6px var(--warning-soft);
}
.platform-channels label:has(.platform-beta-badge):has(input:checked) {
    color: var(--warning);
    background: var(--warning-soft);
    border-color: var(--warning-bright);
    box-shadow:
        0 0 0 1px var(--warning-soft),
        0 1px 0 rgba(20,20,20,0.02);
}
.platform-beta-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.55rem;
    /* Asymmetric horizontal padding compensates for the trailing space that
       letter-spacing leaves after the final letter (~0.09rem at 0.52rem font
       with 0.18em tracking); symmetric vertical padding keeps the cap-height
       visually centered in the box. */
    padding: 0.18rem 0.32rem 0.18rem 0.41rem;
    font-family: var(--font-mono);
    font-size: 0.52rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    color: var(--warning);
    background: transparent;
    border: 1px solid var(--warning);
    border-radius: 1px;
    line-height: 1;
    text-transform: uppercase;
    vertical-align: middle;
}
.platform-channels label:has(input:checked) .platform-beta-badge {
    /* On the selected beta chip, lift the badge to a solid block so it stays
       legible against the warning-soft chip fill. */
    color: var(--bg-surface);
    background: var(--warning);
    border-color: var(--warning);
}

/* ── Window pills — compact segmented control ────────────────────────────── */
.scope-window {
    align-items: center;
}
.window-segments {
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 2px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
}
.window-segments label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0.32rem 0.7rem;
    cursor: pointer;
    background: transparent;
    border: none;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    transition: all 0.15s var(--ease-out);
    user-select: none;
    min-width: 36px;
}
.window-segments label:hover {
    color: var(--text-primary);
}
.window-segments input[type="radio"] {
    display: none;
}
.window-segments label:has(input:checked) {
    background: var(--bg-surface);
    color: var(--accent-deep);
    box-shadow:
        0 1px 2px rgba(20,20,20,0.06),
        inset 0 0 0 1px var(--accent);
}

/* (Timezone selector lives in the footer — see .footer-tz-* below) */

/* ============================================================================
   Header — command bar with brand + ECG + status readouts
   ============================================================================ */
.pulse-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 2rem;
    padding: 0.4rem 0 1.4rem 0;
    margin-bottom: 1.6rem;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.pulse-brand {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
}
.pulse-brand .logo {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, var(--accent-bright) 0%, var(--accent-bright) 32%, transparent 34%),
        radial-gradient(circle at center, transparent 40%, var(--accent-glow) 50%, transparent 70%);
    display: inline-block;
    flex-shrink: 0;
    align-self: center;
    animation: heartbeat 1.6s var(--ease-out) infinite;
    position: relative;
}
.pulse-brand .logo::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid var(--accent-bright);
    opacity: 0;
    animation: ring 2.4s var(--ease-out) infinite;
}
@keyframes heartbeat {
    0%, 60%, 100% { transform: scale(1); }
    20% { transform: scale(1.18); }
    40% { transform: scale(0.94); }
}
@keyframes ring {
    0% { transform: scale(0.7); opacity: 0; }
    30% { opacity: 0.7; }
    100% { transform: scale(1.8); opacity: 0; }
}

.pulse-brand .name {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 1.7rem;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1;
}
.pulse-brand .sep {
    color: var(--text-faint);
    font-weight: 300;
    font-size: 1.15rem;
    margin: 0 0.1rem;
}
.pulse-brand .sub {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-weight: 500;
}

/* ECG waveform — the signature live element */
.pulse-ecg {
    position: relative;
    height: 44px;
    overflow: hidden;
    margin: 0 0.5rem;
    border-radius: 2px;
}
.pulse-ecg::before, .pulse-ecg::after {
    content: "";
    position: absolute;
    top: 0; bottom: 0;
    width: 60px;
    z-index: 2;
    pointer-events: none;
}
.pulse-ecg::before { left: 0; background: linear-gradient(90deg, var(--bg-base), transparent); }
.pulse-ecg::after  { right: 0; background: linear-gradient(270deg, var(--bg-base), transparent); }

.pulse-ecg img {
    display: block;
    width: 200%;
    height: 100%;
    animation: ecg-scroll 5s linear infinite;
    opacity: 0.85;
}
.pulse-ecg > div {
    width: 100%;
    height: 100%;
}
@keyframes ecg-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* Status readouts on the right — Snapshot · Age (Age carries the freshness signal) */
.pulse-status {
    display: flex;
    align-items: center;
    gap: 1.6rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
}
.pulse-status .item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    align-items: flex-end;
}
.pulse-status .label {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.58rem;
}
.pulse-status .value {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.78rem;
    letter-spacing: -0.01em;
    font-feature-settings: "tnum";
}
/* Long/short timestamp toggle — long shown by default, short on narrow widths */
.pulse-status .value-long { display: inline; }
.pulse-status .value-short { display: none; }
/* Stale: amber-tinted age value with a small pulsing indicator */
.pulse-status .item--warn .label { color: var(--warning); }
.pulse-status .item--warn .value {
    color: var(--warning);
    position: relative;
    padding-left: 0.6rem;
}
.pulse-status .item--warn .value::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--warning-bright);
    box-shadow: 0 0 6px var(--warning-bright);
    animation: blink 1.6s ease-in-out infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* ============================================================================
   Tabs
   ============================================================================ */
/* Override Dash inline tab styles via attribute selector trick */
.dash-tab {
    background: transparent !important;
    border: none !important;
    border-bottom: 1px solid transparent !important;
    color: var(--text-muted) !important;
    font-family: var(--font-mono) !important;
    font-size: 0.7rem !important;
    font-weight: 500 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.16em !important;
    padding: 0.85rem 1.4rem !important;
    cursor: pointer !important;
    transition: color 0.18s var(--ease-out), border-color 0.18s var(--ease-out) !important;
    position: relative;
}
.dash-tab:hover { color: var(--text-secondary) !important; }
.dash-tab--selected,
.tab--selected {
    color: var(--text-primary) !important;
    border-bottom-color: var(--accent) !important;
}

/* ============================================================================
   Section headers (numbered, accent-bar prefix)
   ============================================================================ */
.section-header {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-secondary);
    margin: 0 0 0.95rem 0;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.section-header::before {
    content: "";
    width: 6px;
    height: 6px;
    background: var(--accent-bright);
    border-radius: 1px;
    box-shadow: 0 0 6px var(--accent-glow);
    flex-shrink: 0;
    align-self: center;
    transform: translateY(-1px);
}
.section-header .num {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-faint);
    font-weight: 500;
    letter-spacing: 0.14em;
}
.section-header .title {
    color: var(--text-primary);
    flex: 1;
}

.section-caption {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: -0.5rem;
    margin-bottom: 1rem;
    line-height: 1.55;
    max-width: 720px;
}

.subsection-label {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-secondary);
    margin: 0.3rem 0 0.7rem 0;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.subsection-label::before {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-faint);
    flex-shrink: 0;
}

/* ============================================================================
   Hero metric — reserved for the single most important KPI
   ============================================================================ */
.metric-hero {
    background:
        radial-gradient(ellipse at top right, var(--accent-soft) 0%, transparent 55%),
        var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.5rem 1.7rem 1.6rem 1.7rem;
    margin-bottom: 0.8rem;
    position: relative;
    overflow: hidden;
}
.metric-hero::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-bright) 40%, transparent 90%);
    opacity: 0.85;
}
.metric-hero-row {
    display: grid;
    grid-template-columns: minmax(280px, 1.1fr) 2fr;
    gap: 2rem;
    align-items: center;
    position: relative;
}
.metric-hero-label {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-bottom: 0.55rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
}
.metric-hero-label::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-bright);
    box-shadow: 0 0 8px var(--accent-bright);
    animation: blink 1.6s ease-in-out infinite;
}
.metric-hero-value {
    font-family: var(--font-mono);
    font-size: 3.6rem;
    font-weight: 500;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    font-feature-settings: "tnum";
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
}
.metric-hero-value .unit {
    font-size: 1.3rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: -0.02em;
}
.metric-hero-sub {
    font-family: var(--font-sans);
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-top: 0.65rem;
    line-height: 1.5;
}
.metric-hero-trend {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
    border-left: 1px solid var(--border);
    padding-left: 2rem;
}
.metric-hero-trend .stat-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    margin-bottom: 0.4rem;
    font-weight: 500;
}
.metric-hero-trend .stat-value {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    line-height: 1.1;
    font-feature-settings: "tnum";
}
.metric-hero-trend .stat-sub {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ============================================================================
   Standard metric cards
   ============================================================================ */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.4rem;
}
.metric-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem 1.15rem 1.15rem 1.15rem;
    transition: border-color 0.18s var(--ease-out), transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
    position: relative;
    overflow: hidden;
}
.metric-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(20, 20, 20, 0.04);
}

.metric-label {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    margin-bottom: 0.6rem;
}
.metric-value {
    font-family: var(--font-mono);
    font-size: 1.7rem;
    font-weight: 500;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    font-feature-settings: "tnum";
    line-height: 1.1;
}
.metric-sub {
    font-family: var(--font-sans);
    font-size: 0.74rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 0.45rem;
    line-height: 1.4;
}

/* Trend indicators inside metric values */
.metric-value .arrow-up   { color: var(--accent); }
.metric-value .arrow-down { color: var(--danger); }
.metric-value .arrow-flat { color: var(--text-muted); }

/* ============================================================================
   Alerts (label-prefix system)
   ============================================================================ */
.alert {
    border-radius: 5px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--info);
    padding: 0.75rem 1rem;
    background: var(--info-soft);
    font-family: var(--font-sans);
    font-size: 0.84rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    line-height: 1.5;
}
.alert::before {
    content: "INFO";
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    color: var(--info);
    padding: 0.18rem 0.45rem;
    border: 1px solid var(--info);
    border-radius: 2px;
    flex-shrink: 0;
    line-height: 1.1;
    margin-top: 0.05rem;
}
.alert-warning {
    border-left-color: var(--warning);
    background: var(--warning-soft);
}
.alert-warning::before { content: "WARN"; color: var(--warning); border-color: var(--warning); }
.alert-success {
    border-left-color: var(--accent);
    background: var(--accent-soft);
}
.alert-success::before { content: "OK"; color: var(--accent); border-color: var(--accent); }
.alert-error {
    border-left-color: var(--danger);
    background: var(--danger-soft);
}
.alert-error::before { content: "ERR"; color: var(--danger); border-color: var(--danger); }

/* ============================================================================
   Chart containers
   ============================================================================ */
.chart-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem 0.75rem 0.6rem 0.75rem;
    margin-bottom: 1rem;
    position: relative;
}

/* ============================================================================
   Two-column layout
   ============================================================================ */
.two-col-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
.col-half { min-width: 0; }

/* ============================================================================
   Status filter pills
   ============================================================================ */
.status-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.4rem 0 0.95rem 0;
    align-items: center;
}
.status-pills label {
    padding: 0.4rem 0.85rem;
    margin: 0;
    cursor: pointer;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    transition: all 0.15s var(--ease-out);
    user-select: none;
}
.status-pills label:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
    background: var(--bg-elevated);
}
.status-pills input[type="radio"] { display: none; }
.status-pills label:has(input:checked) {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-soft);
}

/* ============================================================================
   DataTable
   ============================================================================ */
.table-container {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-surface);
    overflow: hidden;
    margin-bottom: 1rem;
}
.dash-spreadsheet-container .dash-spreadsheet-inner td,
.dash-spreadsheet-container .dash-spreadsheet-inner th {
    font-family: var(--font-sans) !important;
    font-size: 0.82rem !important;
}
.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner table {
    background: var(--bg-surface) !important;
}
.dash-table-container .previous-next-container {
    color: var(--text-muted) !important;
    font-family: var(--font-mono) !important;
    font-size: 0.72rem !important;
    padding: 0.6rem !important;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.dash-table-container .previous-next-container .page-number input {
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
}
.dash-table-container .previous-next-container .previous-page,
.dash-table-container .previous-next-container .next-page,
.dash-table-container .previous-next-container .first-page,
.dash-table-container .previous-next-container .last-page {
    color: var(--text-secondary) !important;
}
.dash-table-container .column-header--sort {
    color: var(--text-muted) !important;
}
.dash-table-container .column-header--sort:hover {
    color: var(--accent) !important;
}

/* ============================================================================
   Loading state
   ============================================================================ */
.loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
}

/* Dash loading dots — recolor */
.dash-spinner.dash-default-spinner > div,
._dash-loading {
    color: var(--accent) !important;
    background: var(--accent) !important;
}

/* ============================================================================
   Footer — brand caption · ambient timezone readout · transmission tag
   ============================================================================ */
.footer-text {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-faint);
    margin-top: 2.5rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.footer-text::after {
    content: "// END TRANSMISSION";
    color: var(--text-faint);
    opacity: 0.7;
    flex-shrink: 0;
}
.footer-brand {
    flex-shrink: 0;
}

/* Ambient TZ readout — text + chevron, no field chrome */
.footer-tz {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-faint);
    flex-shrink: 0;
}
.footer-tz-prefix {
    color: var(--text-faint);
    opacity: 0.85;
}

/* Dash 4.x Radix-based dropdown — strip the button chrome to inline text + chevron */
.footer-tz-select.dash-dropdown {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    cursor: pointer;
    color: var(--text-muted) !important;
    font-family: var(--font-mono) !important;
    font-size: 0.65rem !important;
    font-weight: 500 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.14em !important;
    transition: color 0.15s var(--ease-out);
}
.footer-tz-select.dash-dropdown:hover,
.footer-tz-select.dash-dropdown:focus,
.footer-tz-select.dash-dropdown[data-state="open"] {
    color: var(--accent) !important;
    background: transparent !important;
}
.footer-tz-select .dash-dropdown-grid-container {
    grid-template-columns: auto auto !important;
    gap: 0.3rem !important;
    padding: 0 !important;
}
.footer-tz-select .dash-dropdown-value,
.footer-tz-select .dash-dropdown-value-item {
    color: inherit !important;
    font-family: inherit !important;
    font-size: inherit !important;
    text-transform: inherit !important;
    letter-spacing: inherit !important;
    padding: 0 !important;
    background: transparent !important;
}
.footer-tz-select .dash-dropdown-trigger-icon {
    color: var(--text-faint);
    width: 12px !important;
    height: 12px !important;
    transition: transform 0.18s var(--ease-out), color 0.15s var(--ease-out);
}
.footer-tz-select.dash-dropdown:hover .dash-dropdown-trigger-icon,
.footer-tz-select.dash-dropdown[data-state="open"] .dash-dropdown-trigger-icon {
    color: var(--accent);
}
.footer-tz-select.dash-dropdown[data-state="open"] .dash-dropdown-trigger-icon {
    transform: rotate(180deg);
}

/* ============================================================================
   Scrollbar
   ============================================================================ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 5px;
    border: 2px solid var(--bg-base);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================================
   Selection
   ============================================================================ */
::selection {
    background: var(--accent-bright);
    color: var(--text-primary);
}

/* ============================================================================
   Responsive
   ============================================================================ */

/* Mid-desktop — tighten before ECG drops out */
@media (max-width: 1280px) {
    .pulse-header { gap: 1.4rem; }
    .pulse-status { gap: 1rem; }
    .pulse-status .value { font-size: 0.74rem; }
}

/* Tablet — drop the ECG signature, keep brand left + status right */
@media (max-width: 1024px) {
    .page-shell { padding: 1.4rem 1.5rem 3rem 1.5rem; }
    .pulse-ecg { display: none; }
    .pulse-header {
        grid-template-columns: 1fr auto;
        gap: 1.2rem;
    }
    .metric-hero-row { grid-template-columns: 1fr; gap: 1.2rem; }
    .metric-hero-trend {
        border-left: none;
        border-top: 1px solid var(--border);
        padding-left: 0;
        padding-top: 1rem;
    }
    .two-col-row { grid-template-columns: 1fr; }
}

/* Mobile — header becomes brand row + telemetry-rail row */
@media (max-width: 768px) {
    .page-shell {
        padding: 1rem 0.9rem 3rem 0.9rem;
    }

    /* Header: brand on row 1, status rail on row 2 — connected by hairline */
    .pulse-header {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0.1rem 0 0.9rem 0;
        margin-bottom: 1rem;
    }
    .pulse-brand { gap: 0.55rem; align-items: center; }
    .pulse-brand .name { font-size: 1.4rem; }
    .pulse-brand .sub,
    .pulse-brand .sep { display: none; }

    /* Status: horizontal meta rail, right-aligned, hairline divider above */
    .pulse-status {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: flex-end;
        align-items: center;
        gap: 0;
        margin-top: 0.7rem;
        padding-top: 0.6rem;
        border-top: 1px solid var(--border);
        width: 100%;
        font-size: 0.62rem;
    }
    .pulse-status .item {
        flex-direction: row;
        align-items: baseline;
        gap: 0.45rem;
        min-width: 0;
        padding: 0 0.75rem;
        position: relative;
    }
    .pulse-status .item:last-child { padding-right: 0; }
    .pulse-status .item:first-child { padding-left: 0; }
    .pulse-status .item + .item::before {
        content: "";
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 1px;
        height: 11px;
        background: var(--border);
    }
    .pulse-status .item .label {
        flex-shrink: 0;
        font-size: 0.5rem;
        letter-spacing: 0.16em;
    }
    .pulse-status .item .value {
        font-size: 0.7rem;
        white-space: nowrap;
        line-height: 1;
    }
    .pulse-status .item--warn .value { padding-left: 0.55rem; }

    /* Scope strip — meta above wrapped pill grid; window + tz stack in secondary */
    .scope-row { gap: 0.6rem; padding: 0.7rem 0.8rem; }
    .scope-row--primary {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
    }
    .scope-axis-meta {
        flex-direction: row;
        align-items: baseline;
        gap: 0.45rem;
        padding-right: 0;
        margin-right: 0;
        border-right: none;
        border-bottom: 1px dashed var(--border);
        padding-bottom: 0.4rem;
    }
    .scope-axis-help { display: none; }  /* subtitle dropped on small screens */
    .platform-channels {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 0.35rem;
    }
    .platform-channels label {
        /* 3-up — generous slack so sub-pixel rounding can never wrap us */
        flex: 0 0 32% !important;
        max-width: 32% !important;
        width: 32% !important;
        margin: 0 !important;
        padding: 0.45rem 0.4rem;
        font-size: 0.6rem;
        letter-spacing: 0.08em;
        gap: 0.3rem;
        justify-content: center;
        min-width: 0;
        text-align: center;
        white-space: normal;
        overflow-wrap: anywhere;
        line-height: 1.15;
        box-sizing: border-box;
    }
    .scope-row--secondary {
        padding: 0.5rem 0.8rem 0.6rem;
        gap: 0.5rem;
        align-items: center;
    }
    .window-segments { flex: 1; justify-content: stretch; }
    .window-segments label { flex: 1; padding: 0.36rem 0.4rem; font-size: 0.62rem; min-width: 0; }

    /* Tabs */
    .dash-tab { padding: 0.7rem 1rem !important; font-size: 0.66rem !important; }

    /* Section headers / captions */
    .section-header { font-size: 0.66rem; letter-spacing: 0.16em; }
    .section-caption { font-size: 0.8rem; }

    /* Hero metric */
    .metric-hero { padding: 1.1rem 1.15rem 1.2rem 1.15rem; }
    .metric-hero-value { font-size: 2.4rem; }
    .metric-hero-value .unit { font-size: 1rem; }
    .metric-hero-trend {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.7rem;
        padding-top: 0.85rem;
    }
    .metric-hero-trend .stat-value { font-size: 1rem; }
    .metric-hero-trend .stat-label { font-size: 0.55rem; }
    .metric-hero-trend .stat-sub { font-size: 0.65rem; }

    /* Metric tiles */
    .metrics-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.55rem;
    }
    .metric-card { padding: 0.8rem 0.9rem 0.9rem 0.9rem; }
    .metric-value { font-size: 1.35rem; }
    .metric-label { font-size: 0.58rem; letter-spacing: 0.14em; }
    .metric-sub { font-size: 0.7rem; }

    .chart-container { padding: 0.7rem 0.35rem 0.4rem 0.35rem; }
    .status-pills label { padding: 0.35rem 0.7rem; font-size: 0.65rem; }

    .footer-text {
        flex-direction: column;
        gap: 0.35rem;
        align-items: flex-start;
    }
    .footer-text::after { content: ""; display: none; }

    body::before { background-size: 40px 40px; }
}

/* Small phones — covers iPhone SE through iPhone 14 Pro Max */
@media (max-width: 540px) {
    .platform-channels label {
        /* 2-up on small phones — generous slack */
        flex: 0 0 48% !important;
        max-width: 48% !important;
        width: 48% !important;
    }
    .footer-tz-prefix { display: none; }

    /* Telemetry rail: keep labels, switch to compact date format */
    .pulse-status .item { padding: 0 0.6rem; }
    .pulse-status .value-long { display: none; }
    .pulse-status .value-short { display: inline; }
}
@media (max-width: 480px) {
    .metric-hero-value { font-size: 2rem; }
    .metric-hero-trend { grid-template-columns: 1fr 1fr; }
    .metric-hero-trend > div:nth-child(3) { grid-column: 1 / -1; }
    .metrics-row { grid-template-columns: 1fr 1fr; }
    .metric-value { font-size: 1.2rem; }
    .dash-tab { padding: 0.6rem 0.8rem !important; }
}

