/*
 * City Alerts shared theme
 * Loaded last on the dashboard, statistics, resident view and configuration pages.
 * It redefines each page's colour variables and restyles the shared building blocks,
 * so all four pages read as one product. No icons: hierarchy comes from type,
 * spacing and a single accent colour; red/amber/green are kept for status only.
 */

@font-face {
    font-family: "Inter";
    src: url("city-alerts-fonts/Inter-Regular.ttf") format("truetype");
    font-weight: 400 500;
    font-display: swap;
}
@font-face {
    font-family: "Inter";
    src: url("city-alerts-fonts/Inter-Bold.ttf") format("truetype");
    font-weight: 600 800;
    font-display: swap;
}

/* ---------------------------------------------------------------- tokens */

body.cat {
    --cat-ink: #0a1020;
    --cat-ink-line: rgba(255, 255, 255, 0.08);
    --cat-ink-text: #e9eef7;
    --cat-ink-muted: #8b97ad;
    --cat-bg: #f2f4f7;
    --cat-surface: #ffffff;
    --cat-surface-2: #f7f8fa;
    --cat-line: #e2e6ec;
    --cat-line-strong: #cbd2dc;
    --cat-text: #0e1726;
    --cat-text-2: #4a5568;
    --cat-text-3: #8691a3;
    --cat-accent: #1f4fd8;
    --cat-accent-hover: #1a43b8;
    --cat-accent-soft: #e9effd;
    --cat-accent-solid: #1f4fd8;        /* filled buttons: always white text */
    --cat-accent-solid-hover: #1a43b8;
    --cat-red: #c62828;
    --cat-red-soft: #fcebeb;
    --cat-amber: #a85a07;
    --cat-amber-soft: #fdf2e2;
    --cat-green: #08795a;
    --cat-green-soft: #e5f4ee;
    --cat-radius: 8px;
    --cat-radius-sm: 6px;
    --cat-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);

    /* The pages' own variables, mapped onto the theme */
    --bg-primary: var(--cat-bg);
    --bg-secondary: var(--cat-surface);
    --bg-tertiary: var(--cat-surface-2);
    --bg-soft: var(--cat-surface-2);
    --text-primary: var(--cat-text);
    --text-secondary: var(--cat-text-2);
    --text-tertiary: var(--cat-text-3);
    --border-color: var(--cat-line);
    --border-hover: var(--cat-line-strong);
    --accent-blue: var(--cat-accent);
    --accent-blue-hover: var(--cat-accent-hover);
    --accent-green: var(--cat-green);
    --accent-red: var(--cat-red);
    --accent-orange: var(--cat-amber);
    --radius-sm: var(--cat-radius-sm);
    --radius-md: var(--cat-radius);
    --shadow-sm: var(--cat-shadow);
    --shadow-md: var(--cat-shadow);
    --red-bg: var(--cat-red-soft);
    --red-text: var(--cat-red);
    --blue-bg: var(--cat-accent-soft);
    --blue-text: var(--cat-accent);
    --green-bg: var(--cat-green-soft);
    --green-text: var(--cat-green);
    --amber-bg: var(--cat-amber-soft);
    --amber-text: var(--cat-amber);
}

[data-theme="dark"] body.cat {
    --cat-accent-solid: #3366e6;
    --cat-accent-solid-hover: #2a58cf;
    --cat-bg: #0b1120;
    --cat-surface: #111a2c;
    --cat-surface-2: #16213a;
    --cat-line: #222f49;
    --cat-line-strong: #33425f;
    --cat-text: #e8edf6;
    --cat-text-2: #a6b1c4;
    --cat-text-3: #717e97;
    --cat-accent: #6b9bff;
    --cat-accent-hover: #8ab0ff;
    --cat-accent-soft: rgba(107, 155, 255, 0.14);
    --cat-red: #ff7a7a;
    --cat-red-soft: rgba(255, 99, 99, 0.13);
    --cat-amber: #f2b45a;
    --cat-amber-soft: rgba(242, 180, 90, 0.13);
    --cat-green: #4fd1a5;
    --cat-green-soft: rgba(79, 209, 165, 0.12);
    --cat-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) body.cat {
        --cat-accent-solid: #3366e6;
        --cat-accent-solid-hover: #2a58cf;
        --cat-bg: #0b1120;
        --cat-surface: #111a2c;
        --cat-surface-2: #16213a;
        --cat-line: #222f49;
        --cat-line-strong: #33425f;
        --cat-text: #e8edf6;
        --cat-text-2: #a6b1c4;
        --cat-text-3: #717e97;
        --cat-accent: #6b9bff;
        --cat-accent-hover: #8ab0ff;
        --cat-accent-soft: rgba(107, 155, 255, 0.14);
        --cat-red: #ff7a7a;
        --cat-red-soft: rgba(255, 99, 99, 0.13);
        --cat-amber: #f2b45a;
        --cat-amber-soft: rgba(242, 180, 90, 0.13);
        --cat-green: #4fd1a5;
        --cat-green-soft: rgba(79, 209, 165, 0.12);
        --cat-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
        color-scheme: dark;
    }
}

/* ---------------------------------------------------------------- base */

body.cat {
    margin: 0 !important;
    padding: 0 !important;
    background: var(--cat-bg) !important;
    color: var(--cat-text);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif !important;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "cv11", "ss01";
}

body.cat * { font-family: inherit; }
body.cat .num, body.cat td.num, body.cat .tile-value, body.cat .value, body.cat .chart-gridline span { font-variant-numeric: tabular-nums; }

body.cat .container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 28px 24px 64px;
    background: none;
}

body.cat h1, body.cat h2, body.cat h3 { color: var(--cat-text); letter-spacing: -0.015em; }

body.cat a { color: var(--cat-accent); }

/* Icons and emoji containers are not used in this design */
body.cat .meta-icon, body.cat .traffic-meta-icon, body.cat .lock-icon, body.cat .theme-icon,
body.cat .empty-state .icon, body.cat .time-item .icon { display: none !important; }
body.cat .traffic-alerts-section h2::before { content: none !important; }

/* ---------------------------------------------------------------- top bar */

.cat-topbar {
    background: var(--cat-ink);
    border-bottom: 1px solid var(--cat-ink-line);
    position: sticky;
    top: 0;
    z-index: 40;
}

.cat-topbar-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 28px;
}

.cat-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none !important;
    white-space: nowrap;
}

.cat-brand-mark {
    width: 10px;
    height: 22px;
    border-radius: 2px;
    background: linear-gradient(180deg, #6b9bff 0%, #1f4fd8 100%);
}

.cat-brand-name { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.cat-brand-product {
    color: var(--cat-ink-muted);
    font-weight: 500;
    font-size: 14px;
    padding-left: 10px;
    border-left: 1px solid var(--cat-ink-line);
}

.cat-tabs { display: flex; align-self: stretch; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.cat-tabs::-webkit-scrollbar { display: none; }
body.cat .cat-tabs a {
    display: flex;
    align-items: center;
    padding: 0 12px;
    color: var(--cat-ink-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
body.cat .cat-tabs a:hover { color: var(--cat-ink-text); }
body.cat .cat-tabs a.is-active { color: #fff; border-bottom-color: #6b9bff; }

.cat-topbar-note { color: var(--cat-ink-muted); font-size: 13px; }

.cat-theme-toggle {
    margin-left: auto;
    height: 30px;
    padding: 0 12px;
    border-radius: var(--cat-radius-sm);
    border: 1px solid var(--cat-ink-line);
    background: transparent;
    color: var(--cat-ink-text);
    font: 600 12px/1 "Inter", system-ui, sans-serif;
    letter-spacing: 0.02em;
    cursor: pointer;
}
.cat-theme-toggle:hover { background: rgba(255, 255, 255, 0.06); }
.cat-theme-toggle .cat-theme-light { display: none; }
[data-theme="dark"] .cat-theme-toggle .cat-theme-light { display: inline; }
[data-theme="dark"] .cat-theme-toggle .cat-theme-dark { display: none; }

/* ---------------------------------------------------------------- page heading */

.cat-pagehead {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 4px 0 24px;
}
.cat-pagehead h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.025em; }
.cat-pagehead p { margin: 4px 0 0; color: var(--cat-text-2); font-size: 14px; }
.cat-pagehead-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Each page's old header is replaced by the top bar and page heading */
body.cat .header { display: none !important; }

/* Small section label used above groups of cards */
body.cat .cat-eyebrow {
    display: block;
    margin: 0 0 10px;
    color: var(--cat-text-3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ---------------------------------------------------------------- buttons */

body.cat .btn, body.cat .tab-button, body.cat .more-btn, body.cat .embed-actions a, body.cat .embed-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border-radius: var(--cat-radius-sm) !important;
    border: 1px solid var(--cat-line-strong) !important;
    background: var(--cat-surface) !important;
    color: var(--cat-text) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    box-shadow: none !important;
    transform: none !important;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
body.cat .btn:hover, body.cat .embed-actions a:hover, body.cat .embed-actions button:hover { background: var(--cat-surface-2) !important; border-color: var(--cat-text-3) !important; }

body.cat .btn-primary, body.cat .btn-success, body.cat .embed-actions .primary, body.cat .cityhelp-btn,
body.cat .alert-filter-bar .btn-primary, body.cat .login-button {
    background: var(--cat-accent-solid) !important;
    border-color: var(--cat-accent-solid) !important;
    color: #fff !important;
}
body.cat .btn-primary:hover, body.cat .btn-success:hover, body.cat .embed-actions .primary:hover, body.cat .cityhelp-btn:hover { background: var(--cat-accent-solid-hover) !important; border-color: var(--cat-accent-solid-hover) !important; }

/* ---------------------------------------------------------------- surfaces */

body.cat .panel, body.cat .alerts-section, body.cat .config-section, body.cat .disclaimer-section,
body.cat .area-summary-section, body.cat .traffic-alerts-section, body.cat .log-section, body.cat .status-card,
body.cat .tile, body.cat .picker, body.cat .summary, body.cat .alert, body.cat .alert-card, body.cat .cityhelp-card,
body.cat .config-card {
    background: var(--cat-surface) !important;
    border: 1px solid var(--cat-line) !important;
    border-radius: var(--cat-radius) !important;
    box-shadow: var(--cat-shadow) !important;
    background-image: none !important;
}

body.cat .alerts-section, body.cat .config-section, body.cat .area-summary-section, body.cat .traffic-alerts-section,
body.cat .log-section, body.cat .panel {
    padding: 22px 24px !important;
    margin-bottom: 20px !important;
}

body.cat .alerts-section h2, body.cat .area-summary-section h2, body.cat .traffic-alerts-section h2, body.cat .log-section h2,
body.cat .panel h2, body.cat .config-section .section-title, body.cat .disclaimer-section h3 {
    margin: 0 0 16px !important;
    padding: 0 !important;
    border: 0 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em !important;
    color: var(--cat-text) !important;
}

body.cat .section-note, body.cat .panel-sub, body.cat .panel-note, body.cat .section-intro { color: var(--cat-text-2) !important; }

/* Notice / purpose strips: quiet, left accent */
body.cat .disclaimer-section, body.cat .notice, body.cat .note {
    border-left: 3px solid var(--cat-accent) !important;
    background: var(--cat-surface) !important;
    border-radius: var(--cat-radius) !important;
}
body.cat .note { background: var(--cat-surface-2) !important; border: 1px solid var(--cat-line) !important; border-left: 3px solid var(--cat-accent) !important; }

/* ---------------------------------------------------------------- KPI cards (dashboard + stats) */

body.cat .status-grid, body.cat .tiles { gap: 12px !important; }

body.cat .status-card, body.cat .tile {
    padding: 18px 20px !important;
    position: relative;
    overflow: hidden;
}
body.cat .status-card h3, body.cat .tile-label {
    margin: 0 0 10px !important;
    color: var(--cat-text-3) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
}
body.cat .status-card .value, body.cat .tile-value {
    color: var(--cat-text) !important;
    font-size: 34px !important;
    font-weight: 700 !important;
    letter-spacing: -0.03em !important;
    line-height: 1.1 !important;
}
body.cat .status-card .label, body.cat .tile-sub { margin-top: 6px; color: var(--cat-text-2) !important; font-size: 13px !important; }
body.cat .status-card::before, body.cat .status-card::after { display: none !important; }
body.cat .tiles-small .tile-value { font-size: 24px !important; }

/* Status light on the dashboard */
body.cat .status-indicator { gap: 8px; }
body.cat .status-light { width: 8px !important; height: 8px !important; box-shadow: 0 0 0 3px var(--cat-green-soft) !important; background: var(--cat-green) !important; }
body.cat .status-light.offline { background: var(--cat-red) !important; box-shadow: 0 0 0 3px var(--cat-red-soft) !important; }
body.cat .status-text { font-size: 22px !important; font-weight: 700 !important; }

/* ---------------------------------------------------------------- badges and chips */

body.cat .badge, body.cat .pill, body.cat .tag, body.cat .alert-count-badge, body.cat .severity-pill, body.cat .traffic-badge {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px !important;
    border-radius: 4px !important;
    border: 0 !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase;
    background: var(--cat-surface-2) !important;
    color: var(--cat-text-2) !important;
    box-shadow: none !important;
}
body.cat .badge-unplanned, body.cat .tag-unplanned, body.cat .alert-count-badge.unplanned, body.cat .severity-pill.is-high,
body.cat .severity-pill.is-critical, body.cat .badge-status.is-now, body.cat .tag-now { background: var(--cat-red-soft) !important; color: var(--cat-red) !important; }
body.cat .badge-planned, body.cat .tag-planned, body.cat .alert-count-badge.planned { background: var(--cat-accent-soft) !important; color: var(--cat-accent) !important; }
body.cat .badge-relevant, body.cat .badge-area { background: var(--cat-green-soft) !important; color: var(--cat-green) !important; }
body.cat .badge-status.is-upcoming, body.cat .tag-upcoming { background: var(--cat-amber-soft) !important; color: var(--cat-amber) !important; }
body.cat .badge-status.is-ended { background: var(--cat-surface-2) !important; color: var(--cat-text-3) !important; }
body.cat .traffic-header-badge { background: var(--cat-amber-soft) !important; color: var(--cat-amber) !important; border-radius: 4px !important; font-size: 11px !important; text-transform: uppercase; letter-spacing: 0.06em; }

/* Filter chips (public page, stats picker) */
body.cat .chip {
    height: 32px;
    display: inline-flex;
    align-items: center;
    padding: 0 14px !important;
    border-radius: var(--cat-radius-sm) !important;
    border: 1px solid var(--cat-line-strong) !important;
    background: var(--cat-surface) !important;
    color: var(--cat-text) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
}
body.cat .chip[aria-pressed="true"], body.cat .chip.is-active { background: var(--cat-text) !important; border-color: var(--cat-text) !important; color: var(--cat-surface) !important; }
body.cat .chip-small { height: 28px; padding: 0 10px !important; font-size: 12px !important; }

/* Dashboard filter buttons behave like segmented controls */
body.cat .alert-filter-bar { background: var(--cat-surface); border: 1px solid var(--cat-line); border-radius: var(--cat-radius); padding: 16px 20px; box-shadow: var(--cat-shadow); }
body.cat .alert-filter-bar .btn { height: 30px; padding: 0 11px; font-size: 12px !important; }
body.cat .alert-filter-bar .btn-primary { background: var(--cat-text) !important; border-color: var(--cat-text) !important; color: var(--cat-surface) !important; }
body.cat .alert-filter-label, body.cat .filter-label, body.cat .picker-label {
    color: var(--cat-text-3) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ---------------------------------------------------------------- forms */

body.cat input[type="text"], body.cat input[type="email"], body.cat input[type="password"], body.cat input[type="number"],
body.cat input[type="time"], body.cat input[type="search"], body.cat input[type="url"], body.cat select, body.cat textarea {
    border: 1px solid var(--cat-line-strong) !important;
    border-radius: var(--cat-radius-sm) !important;
    background: var(--cat-surface) !important;
    color: var(--cat-text) !important;
    font-size: 14px !important;
    padding: 8px 10px !important;
    box-shadow: none !important;
}
body.cat input:focus, body.cat select:focus, body.cat textarea:focus {
    outline: none !important;
    border-color: var(--cat-accent) !important;
    box-shadow: 0 0 0 3px var(--cat-accent-soft) !important;
}
body.cat label { color: var(--cat-text); }
body.cat .form-help { color: var(--cat-text-3) !important; font-size: 12px !important; }

/* ---------------------------------------------------------------- tables */

body.cat table { border-collapse: collapse; }
body.cat th {
    color: var(--cat-text-3) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--cat-line-strong) !important;
}
body.cat td { border-bottom: 1px solid var(--cat-line) !important; }

/* ---------------------------------------------------------------- alert cards */

body.cat .alert-card, body.cat .alert {
    padding: 18px 20px !important;
    border-left-width: 3px !important;
}
body.cat .alert-card.relevant, body.cat .alert.is-unplanned { border-left-color: var(--cat-red) !important; }
body.cat .alert-card.not-relevant { opacity: 0.78; border-left-color: var(--cat-line-strong) !important; }
body.cat .alert.is-planned { border-left-color: var(--cat-accent) !important; }
body.cat .alert-title, body.cat .alert h3 { font-size: 16px !important; font-weight: 700 !important; letter-spacing: -0.01em; margin: 10px 0 12px !important; }
body.cat .meta-item { gap: 0 !important; }
body.cat .meta-content strong, body.cat .facts dt, body.cat .time-item .content strong {
    display: block;
    color: var(--cat-text-3) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
body.cat .alert-description, body.cat .description {
    background: var(--cat-surface-2) !important;
    border: 1px solid var(--cat-line) !important;
    border-radius: var(--cat-radius-sm) !important;
    color: var(--cat-text-2) !important;
}
body.cat .alert-times { background: none !important; border: 0 !important; padding: 0 !important; }
body.cat .time-item { background: var(--cat-surface-2) !important; border: 1px solid var(--cat-line) !important; border-radius: var(--cat-radius-sm) !important; }
body.cat .map-container { border-radius: var(--cat-radius-sm) !important; overflow: hidden; border: 1px solid var(--cat-line); }

/* Area summary cards */
body.cat .area-summary-card {
    background: var(--cat-surface-2) !important;
    border: 1px solid var(--cat-line) !important;
    border-top: 3px solid var(--cat-line-strong) !important;
    border-radius: var(--cat-radius-sm) !important;
    box-shadow: none !important;
}
body.cat .area-summary-card.has-unplanned { border-top-color: var(--cat-red) !important; }
body.cat .area-summary-card.has-alerts { border-top-color: var(--cat-accent) !important; }
body.cat .area-summary-card.no-alerts { border-top-color: var(--cat-green) !important; opacity: 1 !important; }
body.cat .area-summary-card.no-alerts h3 { color: var(--cat-text) !important; }
body.cat .area-summary-card.is-selected { outline: 2px solid var(--cat-text) !important; outline-offset: 2px; }

/* Traffic section */
body.cat .traffic-alerts-section { border-left: 3px solid var(--cat-amber) !important; }
body.cat .traffic-status-card, body.cat .traffic-alert-card, body.cat .traffic-config-info, body.cat .traffic-not-configured {
    background: var(--cat-surface-2) !important;
    border: 1px solid var(--cat-line) !important;
    border-radius: var(--cat-radius-sm) !important;
    box-shadow: none !important;
}

/* Logs: terminal-style */
body.cat .log-content {
    background: #0a1020 !important;
    color: #c9d4e6 !important;
    border: 1px solid #1c2740 !important;
    border-radius: var(--cat-radius-sm) !important;
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace !important;
    font-size: 12px !important;
}

/* ---------------------------------------------------------------- statistics page */

body.cat .summary {
    padding: 20px 24px !important;
    font-size: 17px !important;
    line-height: 1.55 !important;
    border-left: 3px solid var(--cat-accent) !important;
}
body.cat .section { margin-top: 40px !important; }
body.cat .section-head {
    align-items: center !important;
    justify-content: space-between;
    padding-bottom: 10px;
    margin-bottom: 12px !important;
    border-bottom: 1px solid var(--cat-line);
}
body.cat .section-head h2 {
    font-size: 19px !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em !important;
}
body.cat details.more > summary { border-radius: var(--cat-radius-sm) !important; border: 1px solid var(--cat-line-strong) !important; }
body.cat .bar-fill { border-radius: 0 3px 3px 0 !important; }

/* ---------------------------------------------------------------- configuration panel */

body.cat .nav-tabs {
    display: flex;
    flex-wrap: nowrap !important;
    scrollbar-width: thin;
    gap: 0 !important;
    padding: 0 !important;
    background: var(--cat-surface) !important;
    border: 1px solid var(--cat-line) !important;
    border-radius: var(--cat-radius) !important;
    overflow-x: auto;
    box-shadow: var(--cat-shadow) !important;
}
body.cat .nav-tabs .tab-button {
    height: 44px;
    border: 0 !important;
    border-right: 1px solid var(--cat-line) !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--cat-text-2) !important;
    white-space: nowrap;
}
body.cat .nav-tabs .tab-button:last-child { border-right: 0 !important; }
body.cat .nav-tabs .tab-button.active { color: var(--cat-text) !important; box-shadow: inset 0 -2px 0 var(--cat-accent) !important; background: var(--cat-surface-2) !important; }
body.cat .checkbox-group, body.cat .priority-item {
    background: var(--cat-surface-2) !important;
    border: 1px solid var(--cat-line) !important;
    border-radius: var(--cat-radius-sm) !important;
}
body.cat .checkbox-group { padding: 10px 12px !important; margin-bottom: 12px !important; }
body.cat input[type="checkbox"] { accent-color: var(--cat-accent-solid); width: 16px; height: 16px; }
body.cat .save-bar {
    background: var(--cat-surface) !important;
    border: 1px solid var(--cat-line) !important;
    border-radius: var(--cat-radius) !important;
    box-shadow: 0 -4px 16px rgba(16, 24, 40, 0.06) !important;
}
body.cat .alert-success { background: var(--cat-green-soft) !important; color: var(--cat-green) !important; border: 1px solid transparent !important; border-radius: var(--cat-radius-sm) !important; }
body.cat .alert-warning { background: var(--cat-amber-soft) !important; color: var(--cat-amber) !important; border: 1px solid transparent !important; border-radius: var(--cat-radius-sm) !important; }

/* Older inline colours in the configuration panel, mapped onto the theme */
body.cat-config [style*="color: #333"], body.cat-config [style*="color: #555"], body.cat-config [style*="color: #666"] { color: var(--cat-text) !important; }
body.cat-config [style*="color: #667eea"] { color: var(--cat-accent) !important; }
body.cat-config .alert[style] { border-width: 1px !important; border-radius: var(--cat-radius-sm) !important; }
body.cat-config code { background: var(--cat-surface-2) !important; color: var(--cat-text) !important; border: 1px solid var(--cat-line); }
body.cat-config .config-section h3 { font-size: 13px !important; text-transform: uppercase; letter-spacing: 0.06em; color: var(--cat-text-3) !important; }
body.cat-config .form-group label { font-weight: 600; font-size: 13px; }

/* ---------------------------------------------------------------- login screen */

body.cat .login-container {
    background: var(--cat-surface) !important;
    border: 1px solid var(--cat-line) !important;
    border-radius: var(--cat-radius) !important;
    box-shadow: 0 12px 40px rgba(10, 16, 32, 0.12) !important;
}
body.cat .login-header h1 { font-size: 22px !important; letter-spacing: -0.02em; }
body.cat .login-button { background: var(--cat-accent) !important; border-radius: var(--cat-radius-sm) !important; box-shadow: none !important; transform: none !important; }
body.cat .security-note { background: var(--cat-surface-2) !important; color: var(--cat-text-2) !important; border: 1px solid var(--cat-line) !important; border-radius: var(--cat-radius-sm) !important; }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 720px) {
    .cat-topbar-inner { gap: 14px; padding: 0 16px; flex-wrap: wrap; }
    .cat-brand-product { display: none; }
    .cat-tabs { order: 3; width: 100%; min-height: 40px; }
    body.cat .container { padding: 20px 16px 48px; }
    .cat-pagehead h1 { font-size: 22px; }
    body.cat .status-card .value, body.cat .tile-value { font-size: 28px !important; }
}

/* ---------------------------------------------------------------- live stats bar (site-pulse.js) */

.pulse-bar {
    background: var(--cat-surface);
    border-bottom: 1px solid var(--cat-line);
    min-height: 44px;
    font-size: 13px;
    color: var(--cat-text-2);
}
.pulse-bar:empty { visibility: hidden; }
.pulse-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
    min-height: 44px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}
.pulse-inner::-webkit-scrollbar { display: none; }
.pulse-live {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-right: 16px;
    color: var(--cat-green);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.pulse-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--cat-green); }
.pulse-dot::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--cat-green);
    animation: pulse-ring 2s ease-out infinite;
}
@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(3.2); opacity: 0; }
}
body.cat .pulse-item {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 0 16px;
    border-left: 1px solid var(--cat-line);
    color: var(--cat-text-2);
    text-decoration: none;
    line-height: 1.2;
}
body.cat a.pulse-item:hover { color: var(--cat-text); }
body.cat a.pulse-item:hover b { color: var(--cat-accent); }
.pulse-item b {
    color: var(--cat-text);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    border-radius: 3px;
    transition: color 0.2s ease;
}
.pulse-item b.is-changed { animation: pulse-flash 1.4s ease-out; }
@keyframes pulse-flash {
    0% { background: var(--cat-accent-soft); color: var(--cat-accent); box-shadow: 0 0 0 3px var(--cat-accent-soft); }
    100% { background: transparent; box-shadow: 0 0 0 3px transparent; }
}
.pulse-item b.pulse-warn { color: var(--cat-amber); }
.pulse-muted { color: var(--cat-text-3); margin-left: 4px; }
.pulse-updated { margin-left: auto; padding-left: 16px; color: var(--cat-text-3); font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
    .pulse-dot::after, .pulse-item b.is-changed { animation: none; }
}
@media (max-width: 720px) {
    .pulse-inner { padding: 0 16px; }
    .pulse-updated { display: none; }
    .pulse-bar { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
}
.pulse-inner.is-switched { animation: pulse-switch 0.9s ease-out; }
@keyframes pulse-switch {
    0% { background: var(--cat-accent-soft); }
    100% { background: transparent; }
}
@media (prefers-reduced-motion: reduce) { .pulse-inner.is-switched { animation: none; } }

/* ---------------------------------------------------------------- report period (7, 30, 60, 90 days, all time)
   One control used on the homepage, the City Alerts pages and the portal. period-filter.js switches it. */
.iw-period { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--cat-surface-2); border: 1px solid var(--cat-line); border-radius: 8px; vertical-align: middle; }
.iw-period button {
    height: 28px; margin: 0; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; box-shadow: none;
    color: var(--cat-text-2); font: inherit; font-size: 12.5px; font-weight: 600; line-height: 1; letter-spacing: 0; text-transform: none;
    cursor: pointer; white-space: nowrap;
}
.iw-period button:hover { color: var(--cat-text); }
.iw-period button[aria-pressed="true"] { background: var(--cat-surface); color: var(--cat-text); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.1); }
.iw-period button:focus-visible { outline: 2px solid var(--cat-accent); outline-offset: 1px; }
[data-period-show][hidden] { display: none !important; }
.iw-period-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 0 0 12px; }
.iw-period-row > h2, .iw-period-row > h3 { margin: 0; }
/* On its own row (narrow panels, cards) the buttons share the width so they stay on one line */
.iw-period-row > .iw-period:only-child { display: flex; width: 100%; }
.iw-period-row > .iw-period:only-child button { flex: 1 1 0; padding: 0 4px; }
@media (max-width: 560px) {
    .iw-period { display: flex; width: 100%; }
    .iw-period button { flex: 1 1 auto; padding: 0 6px; }
}
