/* ---- reset: kill the default body margin so the app reaches the window edges
   (otherwise an 8px inset looks like a border around the UI) ---- */
html, body { margin: 0; padding: 0; }
#react-entry-point, #_dash-app-content { height: 100%; }
html, body { height: 100%; }

/* ---- theme variables ---- */
.app.dark {
    --bg: #0f141b;
    --bg-panel: #161c26;
    --bg-sidebar: #131922;
    --text: #e8eaed;
    --muted: #9aa0a6;
    --border: #2a3340;
    --accent: #4ea1ff;
    --on-accent: #ffffff;
}
.app.light {
    --bg: #f5f6f8;
    --bg-panel: #ffffff;
    --bg-sidebar: #eef1f5;
    --text: #1b1f24;
    --muted: #5f6368;
    --border: #d8dce2;
    --accent: #1a73e8;
    --on-accent: #ffffff;
}

.app {
    accent-color: var(--accent);   /* native checkboxes/radios follow the scheme */
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, sans-serif;
    min-height: 100vh;
}

/* ---- layout ---- */
.body-row { display: flex; min-height: 100vh; }
.sidebar {
    width: 210px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: sticky;
    top: 0;
    height: 100vh;
    box-sizing: border-box;
}
.brand { margin-bottom: 18px; }
/* Watchdesk lockup: scales to the sidebar width, keeps its own aspect ratio.
   Only the lockup matching the active theme is shown (cream wordmark on dark,
   navy on light) — see the theme rules below. */
.brand-mark { display: block; width: 100%; max-width: 170px; height: auto; }
.app.dark .brand-light, .app.light .brand-dark { display: none; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link {
    color: var(--text);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
}
.nav-link:hover { background: var(--bg-panel); color: var(--accent); }
/* Alert-sounds toggle (app/sound_alerts.py). Accent when on; while the
   browser still blocks audio (fresh load, no click yet) it says so, because a
   toggle that reads "on" but can't make a sound is worse than one reading off. */
.sound-row { display: flex; gap: 6px; }
.sound-row .btn { margin: 0; }
.sound-row .sound-btn { flex: 1; }
.sound-gear { padding: 8px 11px; }
/* The settings panel floats beside the sidebar, over the page, rather than
   inside it: the sidebar is a fixed-height column already full of nav, so an
   in-flow panel would be pushed under the ticker or off the screen. */
.sound-ctl { position: relative; }
.sound-panel {
    position: absolute;
    left: calc(100% + 14px);
    bottom: 0;
    width: 240px;
    z-index: 60;
    padding: 10px 12px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-panel);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    font-size: 12.5px;
}
.sound-panel-hidden { display: none; }
.sound-panel-label { color: var(--muted); margin: 2px 0; }
.sound-panel .rc-slider { margin: 4px 0 10px; }
.sound-cats label { display: flex; gap: 6px; align-items: center; margin: 3px 0; cursor: pointer; }
.sound-btn.sound-on { border-color: var(--accent); color: var(--accent); }
html.wd-audio-locked .sound-btn.sound-on::after {
    content: "Click anywhere to activate";
    display: block;
    font-size: 11px;
    opacity: 0.8;
}
.content { flex: 1; padding: 20px 28px; min-width: 0; }

/* ---- panels & cards ---- */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 14px;
    flex: 1;
    min-width: 280px;
}
.panel-row { display: flex; gap: 14px; flex-wrap: wrap; }

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin: 14px 0;
}
.kpi-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
}
.kpi-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 28px; font-weight: 700; margin-top: 4px; }

.graph-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
    gap: 16px;
    margin: 16px 0;
}
.graph-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    overflow: hidden;
}

/* ---- controls ---- */
.btn {
    background: var(--bg-panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 16px;
    margin: 4px 6px 4px 0;
    cursor: pointer;
    font-size: 14px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover { opacity: 0.9; color: var(--on-accent); }

.text-input {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    margin: 4px 8px 4px 0;
    font-size: 14px;
}
.text-input.wide { width: 100%; max-width: 560px; box-sizing: border-box; }

.muted { color: var(--muted); font-size: 13px; }
.error-text { color: #ff6b6b; font-size: 13px; }

.status-pill { font-weight: 600; font-size: 13px; }
.status-on { color: #2ecc71; }
.status-off { color: #ff6b6b; }

/* Filter/section labels and checklist/radio option text. Uses --text (not
   --muted) so the controls stay readable — muted grey on the panel background
   was too low-contrast to read. */
label { font-size: 13px; color: var(--text); display: block; margin-top: 8px; }
/* dcc.Checklist / dcc.RadioItems options render as <label><input>text; keep
   their text bright and normal-weight in both themes. */
.app .dash-checklist label, .app .dash-radioitems label,
.app label > input[type="checkbox"] ~ *, .app label:has(> input) {
    color: var(--text);
}

/* dropdowns readable in dark mode */
.app.dark .Select-control, .app.dark .Select-menu-outer,
.app.dark .Select-value-label, .app.dark .Select-input > input,
.app.dark .Select-placeholder {
    background: var(--bg) !important;
    color: var(--text) !important;
}
.app.dark .Select-menu-outer .VirtualizedSelectOption { background: var(--bg-panel); color: var(--text); }
.app.dark .Select-menu-outer .VirtualizedSelectFocusedOption { background: var(--border); }
.dropdown { margin-bottom: 8px; }

/* ---- custom frameless title bar (desktop build) ---- */
.titlebar {
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    user-select: none;
}
.tb-drag {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    flex: 1;
    -webkit-app-region: drag;   /* fallback for app-region drag */
}
.tb-logo { width: 18px; height: 18px; display: block; border-radius: 4px; }
.tb-title { font-size: 13px; font-weight: 600; color: var(--text); letter-spacing: 0.3px; }
.tb-controls { display: flex; -webkit-app-region: no-drag; }
.win-btn {
    width: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: var(--muted);
    cursor: default;
}
.win-btn:hover { background: var(--border); color: var(--text); }
.win-close:hover { background: #d62b32; color: #fff; }

/* When the title bar is present, lay out the app as a column and let the body
   fill the remaining height (no native chrome, no extra scroll). */
.app.has-titlebar { display: flex; flex-direction: column; height: 100vh; min-height: 0; overflow: hidden; }
.app.has-titlebar .body-row { flex: 1; min-height: 0; height: auto; }
.app.has-titlebar .sidebar { height: auto; position: static; }
.app.has-titlebar .content { overflow-y: auto; }

/* ---- station detail page (gauge stick + LFG impacts) ---- */
.gauge-link {
    display: block;
    padding: 8px 12px 2px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}
.gauge-link:hover { text-decoration: underline; }

.station-row { display: flex; gap: 16px; margin: 16px 0; flex-wrap: wrap; }
.station-stick-card { flex: 0 1 360px; min-width: 300px; }
.station-graph-card { flex: 1 1 480px; min-width: 320px; }

.impact-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
}
.impact-table th, .impact-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}
.impact-table th {
    background: var(--bg-sidebar);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    color: var(--muted);
}
.impact-height { white-space: nowrap; font-weight: 700; }
.impact-reached { color: #1f77b4; font-weight: 700; white-space: nowrap; }
.impact-row-reached td { background: rgba(31, 119, 180, 0.10); }

/* markdown station links inside the flood table */
.dash-table-container .dash-cell a { color: var(--accent); text-decoration: none; }
.dash-table-container .dash-cell a:hover { text-decoration: underline; }
.dash-table-container .dash-cell p { margin: 0; }

/* ---- sidebar VicEmergency incident log ---- */
.side-log {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-top: 14px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}
.side-log-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 6px;
}
.side-log-row {
    font-size: 11px;
    line-height: 1.35;
    padding: 3px 2px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.side-log-dot { margin-right: 5px; font-size: 9px; }
.side-log-time { color: var(--muted); font-family: Consolas, monospace; }
.side-log-empty { font-size: 11px; color: var(--muted); }

/* A newly-arrived incident slots in at the top: it grows from height 0 (which
   pushes the rows below it smoothly down), slides down from just above, and
   flashes a fading accent glow so it catches the eye. Only rows the server
   tagged .side-log-new animate, so the list is calm between arrivals. */
.side-log-new {
    animation: feed-slot-in 0.6s ease-out;
}
@keyframes feed-slot-in {
    0% {
        max-height: 0;
        opacity: 0;
        transform: translateY(-10px);
        padding-top: 0;
        padding-bottom: 0;
        background: rgba(78, 161, 255, 0.30);
    }
    55% {
        max-height: 48px;
        opacity: 1;
        transform: translateY(0);
        background: rgba(78, 161, 255, 0.22);
    }
    100% {
        max-height: 48px;
        opacity: 1;
        transform: translateY(0);
        background: transparent;
    }
}
@media (prefers-reduced-motion: reduce) {
    .side-log-new { animation: none; }
}

/* ---- bottom news ticker ---- */
.content { padding-bottom: 60px; }  /* keep page bottom clear of the ticker */
.ticker {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 36px;
    display: flex;
    align-items: center;
    overflow: hidden;
    background: var(--bg-sidebar);
    border-top: 2px solid var(--accent);
    color: var(--text);
    font-size: 14px;
    z-index: 900;
}
.ticker-hidden { display: none; }
/* The fixed ticker overlays the bottom of the sticky sidebar; while it is
   showing, lift the docked controls (sounds, display, theme) clear of it. */
.app:has(.ticker:not(.ticker-hidden)) .sidebar { padding-bottom: 150px; }
.app.layout-classic:has(.ticker:not(.ticker-hidden)) .shell-controls { bottom: 54px; }
.ticker-emergency {
    background: #a11212;
    border-top-color: #ff5a5a;
    color: #ffffff;
}
.ticker-emergency .ticker-time { color: #ffd9d9; }
.ticker-label {
    flex-shrink: 0;
    align-self: stretch;
    display: flex;
    align-items: center;
    padding: 0 14px;
    font-weight: 700;
    letter-spacing: 1px;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.25);
}
.ticker-track {
    white-space: nowrap;
    display: inline-block;
    padding-left: 100vw;
    animation: ticker-scroll linear infinite;
}
.ticker-time { color: var(--muted); font-family: Consolas, monospace; }
.ticker-sep { opacity: 0.5; }
@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* ---- Intelligence Feed (/feed) ----
   Each entry is a left-accented card: one headline row (time · layer chip ·
   what moved) over the quantified lines. The accent colour is the entry's
   severity, so the eye can scan a long feed by colour alone. */
.feed { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.feed-entry {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);   /* colour set per entry inline */
    border-radius: 10px;
    padding: 10px 14px;
}
.feed-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
}
.feed-time {
    font-family: Consolas, monospace;
    font-size: 15px;
    font-weight: 700;
    color: var(--muted);
}
.feed-chip {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border: 1px solid currentColor;
    border-radius: 999px;
    padding: 1px 8px;
}
.feed-headline {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}
.feed-headline:hover { color: var(--accent); text-decoration: underline; }
/* The numbers. Monospace so a column of "214 → 296 ha" lines reads as data. */
.feed-body { margin: 5px 0 0 4px; }
.feed-line {
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
    font-family: Consolas, "Segoe UI", monospace;
}
/* The first line is the delta itself — the whole point of the entry. */
.feed-line:first-child { color: var(--text); font-weight: 600; }
.feed-empty-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }

/* A newly-detected entry slots in at the top, reusing the sidebar log's
   animation shape at card scale (grow from 0 height, slide down, accent glow
   fading out). Only entries the page has not painted before get the class. */
.feed-entry-new { animation: feed-card-in 0.7s ease-out; }
@keyframes feed-card-in {
    0% {
        max-height: 0;
        opacity: 0;
        transform: translateY(-14px);
        padding-top: 0;
        padding-bottom: 0;
        background: rgba(78, 161, 255, 0.30);
    }
    55% {
        max-height: 320px;
        opacity: 1;
        transform: translateY(0);
        background: rgba(78, 161, 255, 0.18);
    }
    100% {
        max-height: 320px;
        opacity: 1;
        transform: translateY(0);
        background: var(--bg-panel);
    }
}
@media (prefers-reduced-motion: reduce) {
    .feed-entry-new { animation: none; }
}

/* Filter controls on the feed panel: options on one line each, tight. */
.radio-row label, .check-row label { margin-top: 4px; font-size: 13px; }

/* ---- Overview "What changed" panel ---- */
.feed-compact .feed-entry { padding: 7px 10px; border-radius: 8px; }
.feed-compact .feed-time { font-size: 13px; }
.feed-compact .feed-headline { font-size: 13px; }
.feed-compact .feed-line { font-size: 12px; }

/* ---- flood rate-of-rise / trend projection ---- */
.trend-summary { font-size: 14px; margin: 6px 0 4px; line-height: 1.6; }

/* The projection caveat is deliberately prominent and always adjacent to any
   ETA: an extrapolated arrival time read as a forecast is the one genuinely
   dangerous thing this page can produce. */
.trend-disclaimer {
    font-size: 12px;
    color: var(--muted);
    border-left: 3px solid #d62728;
    padding: 6px 10px;
    margin: 10px 0 14px;
    background: rgba(214, 39, 40, 0.07);
    border-radius: 0 6px 6px 0;
    max-width: 900px;
}
.trend-disclaimer-strong { color: #d62728; font-weight: 700; }

.trend-table-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin: 12px 0 6px;
}
.trend-table { border-collapse: collapse; font-size: 13px; }
.trend-table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    padding: 4px 16px 4px 0;
    font-weight: 700;
}
.trend-table td {
    padding: 3px 16px 3px 0;
    border-bottom: 1px solid var(--border);
}
/* Readings are a column of numbers — monospace so they line up and a rise is
   visible as a shape, not just as text. */
.trend-time, .trend-height { font-family: Consolas, monospace; }
.trend-height { font-weight: 600; }
.trend-up { color: #d62728; font-family: Consolas, monospace; }
.trend-down { color: #2ca02c; font-family: Consolas, monospace; }

/* --- Briefing Mode ------------------------------------------------------ */
/* Warning rows are links, but a panel of default-blue anchors is unreadable
   against the dark theme and turns the section into a wall of colour. Same
   treatment as .feed-headline: body colour, accent only on hover. */
.briefing-warning {
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
}
.briefing-warning:hover { color: var(--accent); text-decoration: underline; }
.briefing-level { font-weight: 600; margin: 8px 0 4px; }

/* --- Event Replay ------------------------------------------------------- */
/* Timeline entries are real <button>s so they are keyboard-reachable, but they
   must read as a list, not a row of chrome buttons. */
.replay-seek {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    color: var(--text);
    border: none;
    border-left: 3px solid transparent;
    padding: 6px 8px;
    margin-bottom: 2px;
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
}
.replay-seek:hover { background: var(--bg-panel); }
/* The entry nearest the selected moment — this is what ties the timeline to
   the slider, so it has to be obvious at a glance. */
.replay-seek-active {
    background: var(--bg-panel);
    border-left-color: var(--accent);
}

/* --- Feedback widget ---------------------------------------------------- */
/* The launcher sits above the news ticker (z-index 900) and clear of its
   36px bar, so the two never overlap on a page with an active ticker. */
.fab {
    position: fixed;
    right: 22px;
    bottom: 50px;
    z-index: 950;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: var(--on-accent);
    border: none;
    border-radius: 24px;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.fab:hover { filter: brightness(1.1); }
.fab:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.fab-icon { font-size: 16px; line-height: 1; }

.fb-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.55);
    overflow-y: auto;
}
.fb-hidden { display: none; }
.fb-panel {
    background: var(--bg-panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px 22px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.fb-head { display: flex; align-items: flex-start; justify-content: space-between; }
.fb-title { margin: 0 0 4px; }
.fb-x {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    padding: 4px 6px;
    cursor: pointer;
}
.fb-x:hover { color: var(--text); }

/* Kind picker reads as two choices, not a settings row, so it gets more space
   than the shared `label` rule gives radio items elsewhere. */
.fb-kind { margin: 6px 0 4px; }
.fb-kind label { display: inline-flex; align-items: center; margin-right: 18px; }
.fb-dropdown { max-width: 100%; margin-bottom: 4px; }
.fb-textarea { min-height: 130px; resize: vertical; font-family: inherit; }
.fb-row { display: flex; gap: 14px; flex-wrap: wrap; }
.fb-col { flex: 1; min-width: 200px; }
.fb-note { margin: 12px 0 4px; font-size: 12px; }
.fb-actions { margin-top: 8px; }
.fb-error { margin-top: 10px; }

/* Receipt. The reference is the one thing the reporter has to be able to read
   back and retype, so it is set large, monospaced and selectable. */
.fb-receipt { text-align: center; padding: 8px 0 4px; }
.fb-tick {
    font-size: 34px;
    color: #2ecc71;
    line-height: 1;
    margin-bottom: 6px;
}
.fb-ref {
    font-family: Consolas, monospace;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--accent);
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 10px;
    margin: 6px auto 12px;
    user-select: all;
}

/* Admin report queue */
.fb-admin-row { border-top: 1px solid var(--border); padding: 10px 0; }
.fb-admin-row:first-child { border-top: none; }
.fb-admin-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.fb-admin-ref { font-family: Consolas, monospace; font-weight: 600; }
.fb-admin-body { white-space: pre-wrap; font-size: 13px; margin: 6px 0 4px; }
.fb-tag {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    padding: 2px 7px;
}
.fb-tag-bug { background: rgba(214, 39, 40, 0.18); color: #ff8080; }
.fb-tag-suggestion { background: rgba(78, 161, 255, 0.18); color: var(--accent); }
.fb-tag-high { background: rgba(214, 39, 40, 0.18); color: #ff8080; }
.fb-tag-medium { background: rgba(242, 169, 59, 0.18); color: #f2a93b; }
.fb-tag-low { background: rgba(154, 160, 166, 0.18); color: var(--muted); }
.app.light .fb-tag-bug, .app.light .fb-tag-high { color: #b3261e; }

@media (max-width: 620px) {
    /* Collapse to the icon so the launcher never covers page content on a
       phone; the title attribute still names it for screen readers. */
    .fab { padding: 12px 14px; }
    .fab span:last-child { display: none; }
    /* No room beside the sidebar on a phone: open the sound panel upward,
       over the sidebar, instead of off the right edge of the screen. */
    .sound-panel { left: 0; bottom: calc(100% + 6px); width: auto; min-width: 186px; }
}

/* ======================================================================
   Colour schemes (app/shell.py SCHEMES). Each overrides the theme tokens
   for BOTH light and dark, so the ☀/☾ button keeps working in every scheme.
   Three classes (.app.dark.scheme-x) out-rank the two-class defaults above.
   ====================================================================== */
.app.dark.scheme-midnight {
    --bg: #0a0f1f; --bg-panel: #111a33; --bg-sidebar: #0d152b;
    --text: #e6ecff; --muted: #97a3c4; --border: #22305a;
    --accent: #5cc8ff; --on-accent: #041526;
}
.app.light.scheme-midnight {
    --bg: #eef2fb; --bg-panel: #ffffff; --bg-sidebar: #e3e9f7;
    --text: #111a33; --muted: #4f5b7a; --border: #c9d3ea;
    --accent: #2456d6; --on-accent: #ffffff;
}
.app.dark.scheme-graphite {
    --bg: #121212; --bg-panel: #1c1c1c; --bg-sidebar: #171717;
    --text: #ececec; --muted: #a3a3a3; --border: #333333;
    --accent: #2dd4bf; --on-accent: #06201d;
}
.app.light.scheme-graphite {
    --bg: #f4f4f4; --bg-panel: #ffffff; --bg-sidebar: #eaeaea;
    --text: #1a1a1a; --muted: #5c5c5c; --border: #d4d4d4;
    --accent: #0f766e; --on-accent: #ffffff;
}
/* Night Ops: warm, low-blue palette for a dark room on a night shift.
   Warning colours are NOT changed by any scheme — red/orange/yellow keep
   their meaning everywhere. */
.app.dark.scheme-nightops {
    --bg: #120d0a; --bg-panel: #1b1410; --bg-sidebar: #160f0c;
    --text: #f0dcc8; --muted: #b39a84; --border: #3a2a20;
    --accent: #ff9f43; --on-accent: #1b1000;
}
.app.light.scheme-nightops {
    --bg: #f7f1ea; --bg-panel: #fffaf4; --bg-sidebar: #efe5d8;
    --text: #2a1d12; --muted: #6b5646; --border: #dccbb8;
    --accent: #b4500a; --on-accent: #ffffff;
}
.app.dark.scheme-contrast {
    --bg: #000000; --bg-panel: #0b0b0b; --bg-sidebar: #050505;
    --text: #ffffff; --muted: #d0d0d0; --border: #6b6b6b;
    --accent: #4db8ff; --on-accent: #000000;
}
.app.light.scheme-contrast {
    --bg: #ffffff; --bg-panel: #ffffff; --bg-sidebar: #f2f2f2;
    --text: #000000; --muted: #2e2e2e; --border: #1a1a1a;
    --accent: #0040a8; --on-accent: #ffffff;
}
.scheme-swatch {
    display: inline-block; width: 26px; height: 12px; margin-right: 8px;
    border-radius: 3px; border: 1px solid var(--border); vertical-align: -1px;
}
.swatch-watchdesk { background: linear-gradient(90deg, #0f141b 55%, #4ea1ff 55%); }
.swatch-midnight  { background: linear-gradient(90deg, #0a0f1f 55%, #5cc8ff 55%); }
.swatch-graphite  { background: linear-gradient(90deg, #121212 55%, #2dd4bf 55%); }
.swatch-nightops  { background: linear-gradient(90deg, #120d0a 55%, #ff9f43 55%); }
.swatch-contrast  { background: linear-gradient(90deg, #000000 55%, #ffffff 55%); }

/* ======================================================================
   Shared shell controls — rendered once (shell.controls), docked by layout.
   ====================================================================== */
.shell-controls { position: fixed; z-index: 880; display: flex; gap: 6px; }
.shell-controls .btn { margin: 0; }
.display-row { display: flex; gap: 6px; }
.app.layout-classic .shell-controls {
    left: 12px; bottom: 16px; width: 186px; flex-direction: column;
}
.app.layout-classic .display-btn { flex: 1; }
.app.layout-classic .sidebar { padding-bottom: 110px; }
.app.layout-console .shell-controls { top: 10px; right: 16px; align-items: center; }
.app.has-titlebar.layout-console .shell-controls { top: 46px; }
.app.layout-console .shell-controls .btn { padding: 7px 11px; font-size: 13px; }
/* Popovers: beside the sidebar in classic, dropping down in console. */
.display-panel {
    position: absolute; z-index: 60; width: 270px;
    padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg-panel); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    font-size: 13px;
}
.app.layout-classic .display-panel { left: calc(100% + 14px); bottom: 0; }
.app.layout-console .display-panel { right: 0; top: calc(100% + 8px); }
.app.layout-console .sound-panel { left: auto; right: 0; bottom: auto; top: calc(100% + 8px); }
.display-panel-hidden { display: none; }
.display-panel-label {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.6px; color: var(--muted); margin: 6px 0 2px;
}
.display-options label { display: flex; align-items: center; gap: 6px; margin-top: 5px; cursor: pointer; }
.display-panel-note { font-size: 12px; color: var(--muted); margin: 10px 0 6px; }
.display-panel-link { color: var(--accent); text-decoration: none; font-size: 13px; }
.display-panel-link:hover { text-decoration: underline; }

/* ======================================================================
   Console layout — top bar with grouped menus + statewide status strip.
   ====================================================================== */
.console-head { display: none; }
.app.layout-console .console-head { display: block; position: sticky; top: 0; z-index: 800; }
.app.layout-console .sidebar { display: none; }
.console-topbar {
    height: 56px; display: flex; align-items: center; gap: 22px;
    padding: 0 400px 0 20px;   /* right: room for the docked controls */
    background: var(--bg-sidebar); border-bottom: 1px solid var(--border);
}
.console-brand { display: flex; align-items: center; }
.console-brand .brand-mark.brand-compact { height: 28px; width: auto; max-width: none; }
.console-nav { display: flex; gap: 2px; }
.cnav-group { position: relative; }
.cnav-btn {
    background: transparent; border: 0; color: var(--text); cursor: pointer;
    font: inherit; font-size: 14px; padding: 8px 12px; border-radius: 8px;
}
.cnav-btn:hover, .cnav-group:focus-within .cnav-btn { background: var(--bg-panel); }
.cnav-btn.cnav-active { color: var(--accent); font-weight: 600; }
.cnav-menu {
    display: none; position: absolute; top: 100%; left: 0; z-index: 850;
    flex-direction: column; min-width: 220px; padding: 6px;
    background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.cnav-group:hover .cnav-menu, .cnav-group:focus-within .cnav-menu { display: flex; }
.cnav-link {
    padding: 8px 10px; border-radius: 6px; font-size: 14px;
    color: var(--text); text-decoration: none;
}
.cnav-link:hover, .cnav-link:focus-visible { background: var(--bg); color: var(--accent); }
.cnav-link-active { color: var(--accent); font-weight: 600; }
.console-spacer { flex: 1; }
.console-sources {
    font-size: 12px; padding: 5px 11px; border-radius: 999px; white-space: nowrap;
    text-decoration: none; border: 1px solid var(--border); color: var(--muted);
    max-width: 320px; overflow: hidden; text-overflow: ellipsis;
}
.console-sources.sources-ok { color: #2ecc71; border-color: rgba(46, 204, 113, 0.45); }
.console-sources.sources-stale { color: #f5a623; border-color: rgba(245, 166, 35, 0.6); }
.console-strip {
    display: flex; align-items: center; gap: 10px; padding: 8px 20px;
    background: var(--bg); border-bottom: 1px solid var(--border); overflow-x: auto;
}
.strip-now {
    font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase;
    color: var(--muted); flex-shrink: 0;
}
.strip-chips { display: flex; gap: 8px; }
.strip-chip {
    display: flex; align-items: baseline; gap: 7px; white-space: nowrap;
    padding: 5px 11px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg-panel); color: var(--text); text-decoration: none; font-size: 13px;
}
.strip-chip:hover { border-color: var(--accent); }
.chip-value { font-size: 16px; }
.chip-label { color: var(--muted); }
.strip-clock {
    margin-left: auto; flex-shrink: 0; color: var(--muted);
    font-family: Consolas, monospace; font-size: 13px;
}
/* Severity tones (strip chips + wall tiles). Only applied while the count is
   above zero. Fixed colours: warning meaning must not change with scheme. */
.chip-emergency { background: rgba(229, 72, 77, 0.16); border-color: #e5484d; }
.chip-watch { background: rgba(245, 166, 35, 0.14); border-color: #f5a623; }
.chip-advice { background: rgba(217, 187, 43, 0.14); border-color: #d9bb2b; }
.chip-alert { border-color: #ff7a45; }
.chip-emergency .chip-label, .chip-watch .chip-label, .chip-advice .chip-label { color: var(--text); }

/* ---- console Overview (/ in the Console layout) ---- */
.ops-grid {
    display: grid; grid-template-columns: 330px minmax(0, 1fr) 370px; gap: 14px;
    height: calc(100vh - 186px); min-height: 520px;
}
.app.has-titlebar .ops-grid { height: calc(100vh - 222px); }
.ops-col { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.ops-head { display: flex; justify-content: space-between; align-items: baseline; }
.ops-head h3 { margin: 4px 0 0; font-size: 15px; }
.ops-more { font-size: 12px; color: var(--accent); text-decoration: none; }
.ops-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.ops-map {
    position: relative; min-height: 0; border: 1px solid var(--border);
    border-radius: 12px; overflow: hidden; background: var(--bg-panel);
}
.ops-map-graph { height: 100%; }
.ops-map-link {
    position: absolute; top: 10px; right: 10px; z-index: 5; font-size: 12px;
    padding: 6px 10px; border-radius: 8px; text-decoration: none; color: var(--text);
    background: var(--bg-panel); border: 1px solid var(--border);
}
.ops-actions { display: flex; gap: 8px; }
.ops-actions .btn { flex: 1; margin: 0; text-align: center; text-decoration: none; }
.ops-sources {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px;
    background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
    padding: 10px 12px;
}
.source-row { display: flex; gap: 4px; font-size: 12px; white-space: nowrap; }
.source-age { margin-left: auto; color: var(--muted); }
.source-stale .source-name { color: #f5a623; }
.warn-row {
    display: flex; gap: 10px; padding: 10px 12px; margin-bottom: 8px;
    background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
}
.warn-diamond { width: 10px; height: 10px; margin-top: 5px; flex-shrink: 0; transform: rotate(45deg); }
.warn-level { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; }
.warn-title { font-size: 14px; font-weight: 600; color: var(--text); text-decoration: none; }
.warn-title:hover { color: var(--accent); text-decoration: underline; }
.warn-meta { font-size: 12px; color: var(--muted); }
.warn-more { padding: 2px 4px; }
@media (max-width: 1100px) {
    .ops-grid { grid-template-columns: minmax(0, 1fr); height: auto; }
    .ops-map { height: 60vh; }
    .console-topbar { padding-right: 20px; flex-wrap: wrap; height: auto; padding-top: 8px; padding-bottom: 8px; }
    .app.layout-console .shell-controls { position: static; padding: 6px 20px; background: var(--bg-sidebar); }
}

/* ======================================================================
   Wall display (/wall). The shell hides its own chrome on this path.
   ====================================================================== */
.app.wall-mode .sidebar, .app.wall-mode .console-head, .app.wall-mode .fab,
.app.wall-mode .display-row, .app.wall-mode .display-panel { display: none; }
.app.wall-mode .content { padding: 0; }
/* Sounds stay reachable (a wall screen is where they are most useful) but
   recede until pointed at. */
.app.wall-mode .shell-controls {
    top: auto; left: auto; right: 40px; bottom: 30px; width: auto;
    flex-direction: row; opacity: 0.35; transition: opacity 0.2s;
}
.app.wall-mode .shell-controls:hover, .app.wall-mode .shell-controls:focus-within { opacity: 1; }
.app.wall-mode:has(.ticker:not(.ticker-hidden)) .shell-controls { bottom: 52px; }
.app.wall-mode .sound-panel { left: auto; right: 0; top: auto; bottom: calc(100% + 8px); }
.wall-page {
    height: 100vh; box-sizing: border-box; padding: 20px 26px;
    display: flex; flex-direction: column; gap: 16px;
}
.app:has(.ticker:not(.ticker-hidden)) .wall-page { height: calc(100vh - 36px); }
.app.has-titlebar .wall-page { height: calc(100vh - 36px); }
.wall-head { display: flex; align-items: center; gap: 14px; }
.wall-head .btn { margin: 0; text-decoration: none; white-space: nowrap; }
.wall-brand .brand-mark { max-width: 190px; }
.wall-stale:empty { display: none; }
.wall-stale {
    min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-size: 16px; color: #f5a623; padding: 6px 12px; border-radius: 8px;
    background: rgba(245, 166, 35, 0.12); border: 1px solid rgba(245, 166, 35, 0.55);
}
.wall-clock { font-family: Consolas, monospace; font-size: 44px; font-weight: 600; line-height: 1; }
.wall-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.wall-tile {
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: 14px; padding: 12px 18px;
}
.wall-tile.chip-emergency { background: rgba(229, 72, 77, 0.16); border: 2px solid #e5484d; }
.wall-tile.chip-watch { background: rgba(245, 166, 35, 0.14); border: 2px solid #f5a623; }
.wall-tile.chip-advice { background: rgba(217, 187, 43, 0.14); border: 2px solid #d9bb2b; }
.wall-tile.chip-alert { border-color: #ff7a45; }
.wall-tile.chip-emergency .wall-tile-label, .wall-tile.chip-watch .wall-tile-label,
.wall-tile.chip-advice .wall-tile-label { color: var(--text); }
.wall-tile-label { font-size: clamp(13px, 1.15vw, 22px); color: var(--muted); }
.wall-tile-value { font-size: clamp(34px, 4.2vw, 88px); font-weight: 700; line-height: 1.1; }
.wall-body {
    flex: 1; min-height: 0; display: grid; gap: 14px;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 31%);
}
.wall-map { min-height: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.wall-map-graph { height: 100%; }
.wall-panel {
    min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 18px 22px;
    background: var(--bg-panel); border: 1px solid var(--border); border-radius: 14px;
}
.wall-panel-title {
    font-size: 15px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted);
}
.wall-panel-body { flex: 1; min-height: 0; overflow: hidden; }
.wall-panel .feed-headline, .wall-panel .warn-title { font-size: 19px; }
.wall-panel .feed-time { font-size: 17px; }
.wall-panel .feed-line { font-size: 15px; }
.wall-panel .source-row { font-size: 17px; margin-bottom: 6px; }
.wall-panel .warn-meta, .wall-panel .warn-level { font-size: 13px; }
.wall-dots { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.wall-dot { width: 28px; height: 4px; border-radius: 2px; background: var(--border); }
.wall-dot-on { background: var(--accent); }
.wall-next { margin-left: 8px; }
@media (max-width: 1000px) {
    .wall-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .wall-body { grid-template-columns: minmax(0, 1fr); }
    .wall-page { height: auto; }
    .wall-map { height: 55vh; }
}
