/* =====================================================================
   SCADA Water Monitoring System - UI foundation
   Theme architecture: every colour is a CSS custom property. The active
   theme is set server-side on <html data-theme="light|dark|night"> by the
   master page, so every page and component inherits it automatically.
   Components must use the tokens below - never hard-coded colours.
   ===================================================================== */

/* ---------- Tokens: Light (daytime) ---------- */
:root,
[data-theme="light"] {
    color-scheme: light;
    --bg: #f2f4f7;
    --surface: #ffffff;
    --surface-2: #f7f9fb;
    --surface-hover: #eef2f6;
    --border: #dce2e9;
    --border-strong: #c3ccd6;
    --text: #15202b;
    --text-muted: #5a6776;
    --text-inverse: #ffffff;

    --primary: #0a66c2;
    --primary-hover: #0853a0;
    --primary-soft: #e6f0fa;
    --primary-contrast: #ffffff;
    --danger: #c42b2b;
    --danger-hover: #a32121;
    --focus: #0a66c2;

    --sidebar-bg: #0f1b29;
    --sidebar-border: #1c2a3b;
    --sidebar-text: #b9c6d4;
    --sidebar-text-strong: #ffffff;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active: rgba(58, 160, 255, 0.16);
    --sidebar-accent: #3aa0ff;

    --topbar-bg: rgba(255, 255, 255, 0.92);

    --status-online: #1a7f37;      --status-online-bg: #e5f4e9;
    --status-warning: #8a5a00;     --status-warning-bg: #fff3d1;
    --status-offline: #c42b2b;     --status-offline-bg: #fdeaea;
    --status-maint: #0b5cad;       --status-maint-bg: #e4effb;
    --status-unknown: #57606a;     --status-unknown-bg: #eceff3;

    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);
}

/* ---------- Tokens: Dark (standard dark SCADA) ---------- */
[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0d131a;
    --surface: #141c26;
    --surface-2: #19232f;
    --surface-hover: #1e2a38;
    --border: #243140;
    --border-strong: #324357;
    --text: #e2e8ef;
    --text-muted: #94a3b4;
    --text-inverse: #0d131a;

    --primary: #3d9cf5;
    --primary-hover: #62b0fa;
    --primary-soft: rgba(61, 156, 245, 0.14);
    --primary-contrast: #06121f;
    --danger: #f0605a;
    --danger-hover: #ff7b75;
    --focus: #62b0fa;

    --sidebar-bg: #0a0f15;
    --sidebar-border: #18212c;
    --sidebar-text: #a3b1c1;
    --sidebar-text-strong: #f1f5f9;
    --sidebar-hover: rgba(255, 255, 255, 0.05);
    --sidebar-active: rgba(61, 156, 245, 0.16);
    --sidebar-accent: #3d9cf5;

    --topbar-bg: rgba(20, 28, 38, 0.92);

    --status-online: #4ac26b;      --status-online-bg: rgba(74, 194, 107, 0.14);
    --status-warning: #e3b341;     --status-warning-bg: rgba(227, 179, 65, 0.14);
    --status-offline: #f47067;     --status-offline-bg: rgba(244, 112, 103, 0.15);
    --status-maint: #6cb6ff;       --status-maint-bg: rgba(108, 182, 255, 0.14);
    --status-unknown: #9aa6b2;     --status-unknown-bg: rgba(154, 166, 178, 0.14);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
}

/* ---------- Tokens: Night (low-light control room) ----------
   Darker and softer than Dark: warm, desaturated neutrals and an amber
   accent to cut blue light and glare. Alarm/status hues stay distinct and
   readable, and status is always paired with an icon and text. */
[data-theme="night"] {
    color-scheme: dark;
    --bg: #080807;
    --surface: #10100e;
    --surface-2: #151512;
    --surface-hover: #1b1a17;
    --border: #23221e;
    --border-strong: #312f29;
    --text: #c8c1b3;
    --text-muted: #8c8577;
    --text-inverse: #080807;

    --primary: #c08a45;
    --primary-hover: #d29c56;
    --primary-soft: rgba(192, 138, 69, 0.13);
    --primary-contrast: #120d06;
    --danger: #cf6a5f;
    --danger-hover: #dd7b70;
    --focus: #d29c56;

    --sidebar-bg: #060605;
    --sidebar-border: #171613;
    --sidebar-text: #9a9384;
    --sidebar-text-strong: #d8d1c2;
    --sidebar-hover: rgba(255, 240, 210, 0.04);
    --sidebar-active: rgba(192, 138, 69, 0.14);
    --sidebar-accent: #c08a45;

    --topbar-bg: rgba(16, 16, 14, 0.94);

    --status-online: #7fae6c;      --status-online-bg: rgba(127, 174, 108, 0.13);
    --status-warning: #cfa54a;     --status-warning-bg: rgba(207, 165, 74, 0.13);
    --status-offline: #d7695e;     --status-offline-bg: rgba(215, 105, 94, 0.15);
    --status-maint: #86a3c3;       --status-maint-bg: rgba(134, 163, 195, 0.13);
    --status-unknown: #8c8577;     --status-unknown-bg: rgba(140, 133, 119, 0.13);

    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.7);
}

/* ---------- Base ---------- */
:root {
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --sidebar-w: 264px;
    --topbar-h: 60px;
    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

/* The hidden attribute always wins over component display rules. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
p { margin: 0 0 12px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: 12px; top: -48px; z-index: 100;
    background: var(--primary); color: var(--primary-contrast);
    padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 600;
}
.skip-link:focus { top: 12px; }

.text-muted { color: var(--text-muted); }
.small { font-size: 12px; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 14px; height: 14px; }
.icon--xl { width: 36px; height: 36px; stroke-width: 1.5; }

/* ---------- App layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: var(--sidebar-w);
    display: flex; flex-direction: column;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
}

.sidebar__brand {
    display: flex; align-items: center; gap: 10px;
    height: var(--topbar-h); padding: 0 20px;
    border-bottom: 1px solid var(--sidebar-border);
    color: var(--sidebar-text-strong);
}

.brand-mark {
    position: relative; width: 30px; height: 30px; flex: none; border-radius: 8px;
    background: var(--sidebar-accent);
}
/* Water droplet cut-out, drawn with a mask so it follows the theme colours. */
.brand-mark::after {
    content: ""; position: absolute; inset: 5px;
    background: var(--sidebar-bg);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5c3.6 4.3 6.5 8 6.5 11.5a6.5 6.5 0 0 1-13 0c0-3.5 2.9-7.2 6.5-11.5z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5c3.6 4.3 6.5 8 6.5 11.5a6.5 6.5 0 0 1-13 0c0-3.5 2.9-7.2 6.5-11.5z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.brand-text { font-weight: 700; font-size: 15px; letter-spacing: 0.02em; display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { font-weight: 500; font-size: 11px; letter-spacing: 0.04em; opacity: 0.75; text-transform: uppercase; }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav__list + .nav__group, .nav__group + .nav__group { margin-top: 6px; }
.nav__list--sub { padding: 2px 0 6px 12px; }

.nav__link, .nav__group-title {
    display: flex; align-items: center; gap: 11px;
    padding: 8px 12px; border-radius: var(--radius-sm);
    color: var(--sidebar-text); font-weight: 500;
    cursor: pointer; text-decoration: none;
}
.nav__link:hover, .nav__group-title:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); text-decoration: none; }
.nav__link.is-active {
    background: var(--sidebar-active); color: var(--sidebar-text-strong);
    box-shadow: inset 3px 0 0 var(--sidebar-accent);
}
.nav__link.is-active .icon { color: var(--sidebar-accent); }
.nav__list--sub .nav__link { font-size: 13.5px; padding: 7px 12px; }

.nav__group-title { list-style: none; user-select: none; }
.nav__group-title::-webkit-details-marker { display: none; }
.nav__group-title span { flex: 1; }
.nav__chevron { transition: transform 0.15s ease; opacity: 0.7; }
.nav__group[open] > .nav__group-title .nav__chevron { transform: rotate(180deg); }



.sidebar-backdrop { display: none; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

/* ---------- Top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 16px;
    height: var(--topbar-h); padding: 0 24px;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(160%) blur(8px);
}
.icon-btn.topbar__menu { display: inline-flex; }

/* Collapsed (icon-only) sidebar on desktop - toggled by the top-bar menu button, remembered per browser. */
@media (min-width: 992px) {
    .sidebar, .main { transition: width 0.18s ease, margin-left 0.18s ease; }
    .sidebar-collapsed .sidebar { width: 72px; }
    .sidebar-collapsed .main { margin-left: 72px; }
    .sidebar-collapsed .sidebar__brand { justify-content: center; padding: 0 8px; }
    .sidebar-collapsed .brand-text small { display: none; }
    .sidebar-collapsed .nav { padding: 14px 10px; }
    .sidebar-collapsed .nav__link,
    .sidebar-collapsed .nav__group-title { justify-content: center; padding: 10px 0; }
    .sidebar-collapsed .nav__link span,
    .sidebar-collapsed .nav__group-title span,
    .sidebar-collapsed .nav__chevron { display: none; }
    .sidebar-collapsed .nav__list--sub { padding: 2px 0 6px; border-left: 0; }
    .sidebar-collapsed .nav__group[open] > .nav__group-title { background: var(--sidebar-hover); }
}
.topbar__crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; }
.crumb--current { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.crumb-sep { opacity: 0.5; }
.topbar__actions { display: flex; align-items: center; gap: 12px; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    cursor: pointer;
}
.icon-btn:hover { background: var(--surface-hover); }

.theme-switch {
    position: relative; isolation: isolate;
    display: inline-flex; padding: 3px; gap: 2px; margin: 0;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2);
}
/* Sliding thumb behind the selected button (position follows aria-pressed; step = button 32px + gap 2px). */
.theme-switch::before {
    content: ""; position: absolute; z-index: -1; top: 3px; left: 3px; width: 32px; height: 28px;
    border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm);
    transition: transform .32s cubic-bezier(.34, 1.36, .64, 1);
}
.theme-switch:has(.theme-switch__btn:nth-of-type(2)[aria-pressed="true"])::before { transform: translateX(34px); }
.theme-switch:has(.theme-switch__btn:nth-of-type(3)[aria-pressed="true"])::before { transform: translateX(68px); }
.theme-switch__btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 28px; border-radius: 999px;
    border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
    transition: color .25s ease;
}
.theme-switch__btn:hover { color: var(--text); }
.theme-switch__btn[aria-pressed="true"] { color: var(--primary); }
.theme-switch__btn svg { transition: transform .4s cubic-bezier(.34, 1.36, .64, 1); }
.theme-switch__btn[aria-pressed="true"] svg { transform: rotate(-20deg) scale(1.08); }
@media (prefers-reduced-motion: reduce) {
    .theme-switch::before, .theme-switch__btn svg { transition: none; }
}

.user-menu { position: relative; }
.user-menu__trigger {
    display: flex; align-items: center; gap: 10px; list-style: none; cursor: pointer;
    padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid transparent;
}
.user-menu__trigger::-webkit-details-marker { display: none; }
.user-menu__trigger:hover, .user-menu[open] .user-menu__trigger { border-color: var(--border); background: var(--surface-2); }
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 12px;
}
.user-menu__meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-menu__name { font-weight: 600; font-size: 13px; }
.user-menu__role { font-size: 11.5px; color: var(--text-muted); }
.user-menu__panel {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; padding: 6px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.user-menu__panel form { margin: 0; }
.user-menu__item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 10px; border-radius: var(--radius-sm); border: 0; background: none;
    font: inherit; color: var(--text); text-align: left; cursor: pointer; text-decoration: none;
}
.user-menu__item:hover { background: var(--surface-hover); text-decoration: none; }
.user-menu__item--danger { color: var(--danger); }

/* ---------- Content ---------- */
.app-footer {
    padding: 16px 24px; border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-muted); text-align: center;
}
.content { flex: 1; margin: 0; }
main#main { padding: 24px; width: 100%; box-sizing: border-box; outline: none; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 22px; letter-spacing: -0.01em; }
.page-subtitle { margin: 4px 0 0; color: var(--text-muted); }
.page-actions { display: flex; gap: 8px; }

.grid { display: grid; gap: 20px; margin-bottom: 20px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--main-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.stack { display: grid; gap: 20px; align-content: start; }
.grid > *, .stack > * { min-width: 0; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.grid > .card, .stack > .card { margin-bottom: 0; }
.card__header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card__title { font-size: 15px; }
.card__subtitle { margin: 2px 0 0; font-size: 12.5px; color: var(--text-muted); }
.card__body { padding: 20px; }
.card__note { margin: 0; padding: 12px 20px; font-size: 13px; color: var(--text-muted); border-top: 1px solid var(--border); background: var(--surface-2); }
.card__footer { padding: 14px 20px; border-top: 1px solid var(--border); }
.card__footer--split { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card--form { max-width: 520px; padding: 24px; }

.details { display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; margin: 0; padding: 20px; }
.details dt { color: var(--text-muted); }
.details dd { margin: 0; }

.empty-state { text-align: center; padding: 56px 24px; }
.empty-state__icon {
    width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary-soft); color: var(--primary);
}
.empty-state__title { font-size: 17px; margin-bottom: 6px; }
.empty-state__text { max-width: 520px; margin: 0 auto; color: var(--text-muted); }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 11px 20px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
.table thead th {
    font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted); background: var(--surface-2); white-space: nowrap;
}
.table tbody tr:hover td { background: var(--surface-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table--compact th, .table--compact td { padding: 8px 20px; }
.table__group th {
    background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--text);
    text-transform: none; letter-spacing: 0;
}
.table-empty { padding: 28px 20px; margin: 0; text-align: center; color: var(--text-muted); }
.cell-strong { font-weight: 600; }
.cell-sub { display: block; font-size: 12px; color: var(--text-muted); }
.cell-actions { text-align: right; white-space: nowrap; }

/* ---------- Status badges (colour + icon + text; never colour alone) ---------- */
.status {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px 3px 8px; border-radius: 999px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap;
    border: 1px solid currentColor;
}
.status--online { color: var(--status-online); background: var(--status-online-bg); }
.status--warning { color: var(--status-warning); background: var(--status-warning-bg); }
.status--offline { color: var(--status-offline); background: var(--status-offline-bg); }
.status--maintenance { color: var(--status-maint); background: var(--status-maint-bg); }
.status--unknown, .status--muted { color: var(--status-unknown); background: var(--status-unknown-bg); }
.status--muted { border-color: transparent; font-weight: 500; }

.tag {
    display: inline-block; padding: 1px 8px; border-radius: var(--radius-sm);
    font-size: 11.5px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
}
.tag--role { color: var(--primary); background: var(--primary-soft); border-color: transparent; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field__label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; }
.field__hint { margin: 6px 0 0; font-size: 12px; color: var(--text-muted); }
.field--check label { margin-left: 6px; }
.input {
    display: block; width: 100%; height: 40px; padding: 8px 12px;
    font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
select.input { padding-right: 32px; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--primary-soft); }
.input--sm { height: 34px; padding: 6px 10px; }
.input::placeholder { color: var(--text-muted); opacity: 0.8; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; vertical-align: -3px; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }

.search { display: flex; gap: 8px; }
.search .input { width: 220px; }

.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
    padding: 4px 10px; font-size: 12px; font-weight: 600; color: var(--text-muted);
    cursor: pointer; border-left: 1px solid var(--border); user-select: none;
}
.segmented label:first-of-type { border-left: 0; }
.segmented input:checked + label { background: var(--primary-soft); color: var(--primary); }
.segmented input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: -2px; }
.segmented .aspNetDisabled label, .segmented.aspNetDisabled label, .segmented input:disabled + label { cursor: not-allowed; opacity: 0.75; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 16px; border-radius: var(--radius-sm);
    font: inherit; font-weight: 600; font-size: 13.5px; line-height: 1;
    border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--primary); color: var(--primary-contrast); }
.btn--primary:hover { background: var(--primary-hover); }
.btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn--secondary:hover { background: var(--surface-hover); }
.btn--ghost { background: transparent; color: var(--primary); }
.btn--ghost:hover { background: var(--primary-soft); }
.btn--danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: var(--text-inverse); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn--block { width: 100%; }

/* ---------- Alerts ---------- */
.alert {
    display: block; padding: 12px 14px; margin-bottom: 16px;
    border-radius: var(--radius-sm); border: 1px solid; border-left-width: 4px; font-size: 13.5px;
}
.alert--info { color: var(--text); background: var(--status-maint-bg); border-color: var(--status-maint); }
.alert--success { color: var(--text); background: var(--status-online-bg); border-color: var(--status-online); }
.alert--warning { color: var(--text); background: var(--status-warning-bg); border-color: var(--status-warning); }
.alert--danger { color: var(--text); background: var(--status-offline-bg); border-color: var(--status-offline); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs__tab {
    padding: 10px 16px; font-weight: 600; color: var(--text-muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs__tab:hover { color: var(--text); text-decoration: none; }
.tabs__tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Permission grid ---------- */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; padding: 20px; }
.perm-group { margin: 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.perm-group__title { padding: 0 6px; font-weight: 700; font-size: 13px; }
.perm-item { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.perm-item label { cursor: pointer; }

/* ---------- Auth screens (sign-in / setup) ---------- */
.auth-body { min-height: 100vh; }

.login { display: grid; grid-template-columns: minmax(420px, 5fr) 7fr; min-height: 100vh; }

/* Form side */
.login__panel {
    display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
    padding: 40px clamp(24px, 5vw, 72px);
    background: var(--surface);
}
.login__brand { display: flex; align-items: center; gap: 12px; }
.login__logo { width: 40px; height: 40px; object-fit: contain; }
.login__brand-text { display: flex; flex-direction: column; font-weight: 700; font-size: 16px; letter-spacing: 0.02em; line-height: 1.15; }
.login__brand-text small { font-weight: 500; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }

.login__form { width: 100%; max-width: 400px; margin: 0 auto; }
.login__eyebrow {
    display: inline-block; margin-bottom: 12px; padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--primary); background: var(--primary-soft);
}
.auth-title { font-size: 26px; letter-spacing: -0.01em; margin-bottom: 8px; }
.login__intro { margin-bottom: 28px; }
.login__help { margin: 20px 0 0; font-size: 12.5px; color: var(--text-muted); text-align: center; }

.login__foot { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; color: var(--text-muted); }

/* Inputs with a leading icon and an optional trailing action */
.input-wrap { position: relative; }
.input-wrap__icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.input--lg { height: 46px; font-size: 14.5px; border-radius: var(--radius); }
.input--with-icon { padding-left: 42px; }
.input--with-action { padding-right: 46px; }
.input-wrap:focus-within .input-wrap__icon { color: var(--primary); }
.input-wrap__action {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-muted); cursor: pointer;
}
.input-wrap__action:hover { color: var(--text); background: var(--surface-hover); }
.input-wrap__show { display: inline-flex; }
.input-wrap__hide { display: none; }
.input-wrap__action[aria-pressed="true"] .input-wrap__show { display: none; }
.input-wrap__action[aria-pressed="true"] .input-wrap__hide { display: inline-flex; }
.field__hint--warn { display: flex; align-items: center; gap: 6px; color: var(--status-warning); font-weight: 600; }
.field__hint--warn[hidden] { display: none; }
.btn--lg { height: 46px; font-size: 14.5px; border-radius: var(--radius); margin-top: 6px; }

/* Illustration side (always dark, follows the sidebar tokens so it adapts per theme) */
.login__visual {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: center; gap: 28px;
    padding: 56px clamp(32px, 5vw, 80px);
    color: var(--sidebar-text);
    background-color: var(--sidebar-bg);
    background-image:
        radial-gradient(ellipse at 85% 10%, var(--sidebar-active), transparent 55%),
        radial-gradient(ellipse at 10% 95%, var(--sidebar-active), transparent 50%),
        radial-gradient(var(--sidebar-hover) 1px, transparent 1.5px);
    background-size: auto, auto, 22px 22px;
    border-left: 1px solid var(--sidebar-border);
}
.login__copy { max-width: 520px; }
.login__kicker { margin-bottom: 12px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sidebar-accent); }
.login__headline { font-size: clamp(24px, 2.6vw, 34px); line-height: 1.2; letter-spacing: -0.015em; color: var(--sidebar-text-strong); margin-bottom: 14px; }
.login__lead { margin: 0; font-size: 15px; line-height: 1.6; }

.network { width: 100%; max-width: 680px; height: auto; }
.network__pipes path { fill: none; stroke: var(--sidebar-border); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.network__flow path {
    fill: none; stroke: var(--sidebar-accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
    stroke-dasharray: 5 13; animation: network-flow 1.8s linear infinite;
}
.network__shape { fill: var(--sidebar-hover); stroke: var(--sidebar-text); stroke-width: 1.5; stroke-opacity: 0.55; }
.network__water { fill: var(--sidebar-accent); fill-opacity: 0.35; }
.network__window { fill: var(--sidebar-accent); fill-opacity: 0.45; }
.network__line { fill: none; stroke: var(--sidebar-text); stroke-opacity: 0.55; stroke-width: 1.5; stroke-linecap: round; }
.network__ring { fill: var(--sidebar-bg); stroke: var(--sidebar-accent); stroke-width: 2; }
.network__dot { fill: var(--sidebar-accent); }
.network__node .network__ring { transform-box: fill-box; transform-origin: center; animation: network-pulse 3s ease-in-out infinite; }
.network__label { fill: var(--sidebar-text); font-family: var(--font); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }

@keyframes network-flow { to { stroke-dashoffset: -36; } }
@keyframes network-pulse { 0%, 100% { stroke-opacity: 1; } 50% { stroke-opacity: 0.35; } }

.login__chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.login__chips li {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
    color: var(--sidebar-text-strong); background: var(--sidebar-hover); border: 1px solid var(--sidebar-border);
}
.login__chips .icon { color: var(--sidebar-accent); }

/* Generic error page card (Error.aspx) */
.auth-card {
    width: 100%; max-width: 400px; padding: 32px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.auth-card--narrow { margin: 10vh auto 0; max-width: 460px; }
.auth-card .brand-mark::after { background: var(--surface); }
.auth-card .auth-title { font-size: 22px; }
.auth-card > .text-muted { margin-bottom: 22px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .grid--main-side { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow-lg); }
    .sidebar-open .sidebar { transform: none; }
    .sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, 0.45); }
    .main { margin-left: 0; }
    .grid--2 { grid-template-columns: minmax(0, 1fr); }
    .login { grid-template-columns: minmax(0, 1fr); }
    .login__visual { display: none; }
    .login__panel { min-height: 100vh; }
}

@media (max-width: 640px) {
    .topbar { padding: 0 16px; gap: 10px; }
    .user-menu__meta { display: none; }
    main#main { padding: 16px; }
    .page-title { font-size: 19px; }
    .search { width: 100%; }
    .search .input { width: auto; flex: 1; }
    .details { grid-template-columns: 1fr; gap: 2px 0; }
    .details dd { margin-bottom: 10px; }
    .auth-card { padding: 24px 20px; }
    .login__panel { padding: 24px 16px; gap: 24px; }
    .auth-title { font-size: 22px; }
    .table th, .table td { padding: 10px 14px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
    .sidebar, .topbar, .page-actions { display: none !important; }
    .main { margin: 0; }
}

/* =====================================================================
   Site Info Management (list, wizard dialog, equipment & rules editor)
   ===================================================================== */
.toolbar { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; align-items: center; }
.toolbar__field { min-width: 180px; }
.toolbar__field--grow { flex: 1; max-width: 360px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 4px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--border); }
.pager:empty { display: none; }
.pager__info { font-size: 12.5px; color: var(--text-muted); }
.btn--ghost-danger { color: var(--danger); }
.btn--ghost-danger:hover { background: var(--status-offline-bg); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.tag--new { color: var(--status-online); background: var(--status-online-bg); border-color: transparent; margin-left: 6px; }

/* Toasts */
.toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px;
    background: var(--surface); color: var(--text); border: 1px solid var(--border);
    border-left: 4px solid var(--status-online); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast .icon { color: var(--status-online); }
.toast--error { border-left-color: var(--status-offline); }
.toast--error .icon { color: var(--status-offline); }
.toast.is-leaving { opacity: 0; transform: translateY(8px); }

/* Dialog base */
dialog { color: var(--text); }
dialog::backdrop { background: rgba(4, 10, 20, 0.55); backdrop-filter: blur(2px); }

/* Wizard */
.wizard {
    /* Fixed size so every tab (Site Info, Unit, Equipment & Rules, Review) looks the same; the body scrolls. */
    width: min(1180px, calc(100vw - 32px)); height: min(820px, calc(100vh - 32px)); max-height: calc(100vh - 32px); padding: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    flex-direction: column; overflow: hidden;
}
.wizard[open] { display: flex; }
.wizard__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.wizard__title { font-size: 17px; }
.wizard__steps { display: flex; gap: 4px; margin: 0; padding: 10px 24px; list-style: none; border-bottom: 1px solid var(--border); background: var(--surface-2); overflow-x: auto; }
.wizard__step {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 0; border-radius: 999px;
    background: transparent; color: var(--text-muted); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.wizard__step:hover { background: var(--surface-hover); color: var(--text); }
.wizard__num {
    display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%;
    font-size: 11.5px; border: 1.5px solid currentColor;
}
.wizard__step.is-active { background: var(--primary-soft); color: var(--primary); }
.wizard__step.is-active .wizard__num { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.wizard__step.is-done { color: var(--status-online); }
.wizard__step.has-error { color: var(--danger); }
.wizard__step.has-error .wizard__num { border-color: var(--danger); }
.wizard__body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px; }
.wizard__panel { display: none; }
.wizard__panel.is-active { display: block; }
.wizard__section { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin: 4px 0 12px; }
.wizard__panel .form-grid + .wizard__section { margin-top: 12px; }
.wizard__footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--surface-2); }
.wizard__hint { font-size: 12.5px; color: var(--text-muted); }
.wizard__actions { display: flex; gap: 8px; }
.wizard.is-readonly .wizard__body .input:disabled { background: var(--surface-2); color: var(--text); opacity: 1; }
.wizard .alert ul { margin: 6px 0 0; padding-left: 18px; }

/* 12-column form grid */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0 16px; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.span-12 { grid-column: span 12; }
.field__label.is-required::after { content: " *"; color: var(--danger); }
.field__error { display: none; margin: 6px 0 0; font-size: 12px; color: var(--danger); font-weight: 600; }
.field.has-error .field__error { display: block; }
.field.has-error .input { border-color: var(--danger); box-shadow: 0 0 0 3px var(--status-offline-bg); }
.field--inline { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; padding-top: 26px; cursor: pointer; }
.form-actions--end { justify-content: flex-end; }

/* Maintenance / repair toggles */
.mode-toggle {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px;
    padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); cursor: pointer;
}
.mode-toggle__text { display: grid; gap: 2px; }
.mode-toggle__title { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.mode-toggle__hint { font-size: 12px; color: var(--text-muted); }
input[type="checkbox"].switch {
    appearance: none; -webkit-appearance: none; flex: none; position: relative;
    width: 44px; height: 24px; border-radius: 999px; margin: 0;
    background: var(--border-strong); cursor: pointer; transition: background 0.15s ease;
}
input[type="checkbox"].switch::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.15s ease;
}
input[type="checkbox"].switch:checked { background: var(--status-warning); }
input[type="checkbox"].switch:checked::after { transform: translateX(20px); }
input[type="checkbox"].switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Equipment */
.equip-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.equip-bar .wizard__section { margin: 0; }
.equip-bar .btn { margin-left: auto; }
.equip-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.equip-list { display: grid; gap: 8px; }
.equip-empty { margin: 0; padding: 16px; font-size: 13px; color: var(--text-muted); text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.equip-card { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.equip-card:hover { border-color: var(--border-strong); }
.equip-card.is-active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.equip-card__main {
    flex: 1; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; padding: 10px 12px;
    border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.equip-card__icon { grid-row: span 2; display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); }
.equip-card__meta { display: grid; min-width: 0; }
.equip-card__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.equip-card__sub { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.equip-card .rule-badges { grid-column: 2; }
.icon-btn.icon-btn--danger { border: 0; border-left: 1px solid var(--border); border-radius: 0; height: auto; width: 40px; color: var(--text-muted); }
.icon-btn.icon-btn--danger:hover { color: var(--danger); background: var(--status-offline-bg); }
.rule-badges { display: inline-flex; gap: 3px; }
.rule-badge { padding: 0 5px; border-radius: 4px; font-size: 10px; font-weight: 700; line-height: 16px; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); opacity: 0.6; }
.rule-badge--hh, .rule-badge--ll { color: var(--status-offline); background: var(--status-offline-bg); border-color: transparent; opacity: 1; }
.rule-badge--h, .rule-badge--l { color: var(--status-warning); background: var(--status-warning-bg); border-color: transparent; opacity: 1; }
.rule-badge--nn { color: var(--status-online); background: var(--status-online-bg); border-color: transparent; opacity: 1; }
.equip-editor { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.equip-editor__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.equip-editor__head h4, .rules__head h4, .rule-editor h5 { font-size: 14px; margin: 0; }
.rules { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.rules__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.rules .table-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.rules tr.is-editing td { background: var(--primary-soft); }
.rule-type { font-weight: 600; margin-left: 6px; }
.rule-editor { margin-top: 12px; padding: 14px; border: 1px solid var(--primary); border-radius: var(--radius); background: var(--surface); }
.rule-editor h5 { margin-bottom: 12px; }
.formula { display: flex; flex-wrap: wrap; gap: 8px; }
.formula > .input { width: 150px; }
.formula__group { display: inline-flex; gap: 8px; }
.formula__group[hidden] { display: none; }
.formula__group .input { width: 130px; }
.formula__group select.input { width: 80px; }

/* Colour dots (fixed palette, no inline styles) */
.color-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: -1px; border: 1px solid var(--border-strong); background: var(--surface-2); }
.color-dot--ff0000 { background: #ff0000; }
.color-dot--ff7636 { background: #ff7636; }
.color-dot--ffff00 { background: #ffff00; }
.color-dot--00ff00 { background: #00ff00; }
.color-dot--0000ff { background: #0000ff; }
.color-dot--c0c0c0 { background: #c0c0c0; }

/* Review */
.review { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.review__card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.review__card--wide { grid-column: 1 / -1; }
.review__card[hidden] { display: none; }
.review__head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.review__head h3 { font-size: 14px; }
.review__grid { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; padding: 14px 16px; font-size: 13px; }
.review__grid dt { color: var(--text-muted); }
.review__grid dd { margin: 0; word-break: break-word; }
.review__grid dd.is-empty { color: var(--text-muted); font-style: italic; }
#rvEquip { padding: 14px 16px; }
.review__equip { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.review__tile { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); display: grid; gap: 6px; align-content: start; }
.review__tile-name { font-weight: 600; }
.review__rules { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.rule-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; background: var(--surface); border: 1px solid var(--border); font-family: var(--font-mono); }
.diff { margin: 0; padding: 12px 16px; list-style: none; display: grid; gap: 8px; font-size: 13px; }
.diff__row { display: flex; align-items: flex-start; gap: 10px; }
.diff__chip { flex: none; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.diff__chip--added { color: var(--status-online); background: var(--status-online-bg); }
.diff__chip--removed { color: var(--status-offline); background: var(--status-offline-bg); }
.diff__chip--changed { color: var(--status-warning); background: var(--status-warning-bg); }
.diff__after { font-weight: 600; }


@media (max-width: 900px) {
    .equip-layout, .review { grid-template-columns: minmax(0, 1fr); }
    .span-3, .span-4, .span-6 { grid-column: span 12; }
    .field--inline { padding-top: 0; margin-bottom: 16px; }
    .wizard__body { padding: 16px; }
    .wizard__header, .wizard__footer, .wizard__steps { padding-left: 16px; padding-right: 16px; }
    .wizard__hint { display: none; }
}

/* Manage lists dialog (SuperAdmin) */
.field__label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.link-btn { border: 0; background: none; padding: 0; margin-bottom: 6px; font: inherit; font-size: 12px; font-weight: 600; color: var(--primary); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.lists-dialog {
    width: min(1180px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    flex-direction: column; overflow: hidden;
}
.lists-dialog[open] { display: flex; }
.lists-dialog__body { padding: 20px 24px; overflow-y: auto; }
/* Districts / Site types / Version IDs on one row; Multipliers full width underneath (its builder needs room). */
.lists-dialog__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lists-dialog__grid > [data-panel-kind="multiplier"] { grid-column: 1 / -1; }
.lists-dialog__grid > [data-panel-kind="multiplier"] .lists-panel__items { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); column-gap: 8px; }
.lists-dialog--single { width: min(680px, calc(100vw - 32px)); }
.lists-dialog--single .lists-dialog__grid { grid-template-columns: minmax(0, 1fr); }
.lists-dialog--single .lists-dialog__grid > [data-panel-kind="multiplier"] .lists-panel__items { grid-template-columns: minmax(0, 1fr); }
.lists-dialog__body { overflow-x: hidden; }
.lists-panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); display: flex; flex-direction: column; }
.lists-panel__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.lists-panel__head h3 { font-size: 14px; }
.lists-panel__add { display: flex; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.lists-panel__add .input { flex: 1; }
.lists-panel__items { list-style: none; margin: 0; padding: 6px; max-height: 340px; overflow-y: auto; }
.lists-panel__item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); }
.lists-panel__item:hover { background: var(--surface-hover); }
.lists-panel__name { flex: 1; font-weight: 600; }
.lists-panel__meta { font-size: 12px; color: var(--text-muted); }
.lists-panel__empty { padding: 16px; text-align: center; font-size: 13px; color: var(--text-muted); }
@media (max-width: 1000px) { .lists-dialog__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .lists-dialog__grid { grid-template-columns: minmax(0, 1fr); } }

/* Fixed prefix inside an input (e.g. +60 for SIM numbers) */
.input-prefix { display: flex; align-items: stretch; }
.input-prefix__text {
    display: inline-flex; align-items: center; padding: 0 12px; font-weight: 600; color: var(--text-muted);
    background: var(--surface-2); border: 1px solid var(--border-strong); border-right: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.input-prefix .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.field.has-error .input-prefix__text { border-color: var(--danger); }

/* Rules: header actions and quick fill */
.rules__actions { display: flex; gap: 4px; }
.quick-fill .table-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 10px 0; }
.quick-fill .qf-num { width: 88px; }
.quick-fill select.input { min-width: 96px; }
.quick-fill .table th, .quick-fill .table td { padding-left: 10px; padding-right: 10px; }

/* Site active toggle: green when on */
input[type="checkbox"].switch.switch--success:checked { background: var(--status-online); }
.mode-toggle--status .mode-toggle__title .icon { color: var(--status-online); }

/* New multiplier builder (Type / Function / Decimals / Formula) */
.multiplier-builder { flex-direction: column; align-items: stretch; }
.multiplier-builder__title { font-size: 12.5px; font-weight: 700; }
.multiplier-builder__row { display: flex; gap: 8px; align-items: center; }
.multiplier-builder__row .input { flex: none; width: auto; }
.multiplier-builder__row select.input { width: 104px; }
.multiplier-builder__row #lsMulType { width: 92px; }
.multiplier-builder__row #lsMulFunc { width: 128px; }
.multiplier-builder__digits { width: 56px !important; text-align: center; }
.multiplier-builder__formula { flex: 1 !important; min-width: 0; }
.multiplier-builder__row .field__hint { flex: 1; margin: 0; }

/* =====================================================================
   Standard confirm dialog (Scripts/app.js - ScadaConfirm), used on every page
   ===================================================================== */
.modal-confirm {
    --mc-accent: var(--danger); --mc-accent-bg: var(--status-offline-bg);
    width: min(500px, calc(100vw - 32px)); padding: 0; overflow: hidden;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-top: 3px solid var(--mc-accent);
    border-radius: var(--radius-lg); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.modal-confirm--warning { --mc-accent: var(--status-warning); --mc-accent-bg: var(--status-warning-bg); }
.modal-confirm::backdrop { background: rgba(4, 8, 16, 0.6); backdrop-filter: blur(3px); }
.modal-confirm[open] { animation: modal-in 0.16s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.97); } to { opacity: 1; transform: none; } }
.modal-confirm__head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 28px 28px 6px; }
.modal-confirm__badge {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border-radius: 50%;
    color: var(--mc-accent); background: var(--mc-accent-bg);
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--mc-accent) 8%, transparent);
}
.modal-confirm__badge .icon { width: 26px; height: 26px; }
.modal-confirm__title { font-size: 19px; font-weight: 700; margin: 4px 0 6px; }
.modal-confirm__text { margin: 0 auto; max-width: 400px; color: var(--text-muted); font-size: 13.5px; line-height: 1.55; }
.modal-confirm__details {
    display: grid; grid-template-columns: max-content 1fr; margin: 18px 28px 0; padding: 4px 16px;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); font-size: 13px;
}
.modal-confirm__details dt, .modal-confirm__details dd { padding: 9px 0; border-bottom: 1px solid var(--border); }
.modal-confirm__details dt:nth-last-of-type(1), .modal-confirm__details dd:nth-last-of-type(1) { border-bottom: 0; }
.modal-confirm__details dt { color: var(--text-muted); padding-right: 24px; }
.modal-confirm__details dd { margin: 0; font-weight: 600; text-align: right; word-break: break-word; }
.modal-confirm__note {
    margin: 12px 28px 0; padding: 10px 12px; font-size: 12.5px; color: var(--mc-accent);
    background: var(--mc-accent-bg); border-radius: var(--radius);
}
.modal-confirm__actions {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; padding: 16px 28px 20px;
    border-top: 1px solid var(--border); background: var(--surface-2);
}
.modal-confirm__actions .btn { justify-content: center; min-height: 40px; }
.btn--danger-solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn--danger-solid:hover { background: var(--danger-hover); border-color: var(--danger-hover); }

/* Site image (Site Info step) */
.site-image { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.site-image__preview {
    flex: none; width: 180px; height: 120px; border-radius: var(--radius-sm); overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface); border: 1px dashed var(--border-strong);
}
.site-image__preview img { width: 100%; height: 100%; object-fit: cover; }
.site-image__empty { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.site-image__body { flex: 1; min-width: 0; }
.site-image__status { margin: 0 0 4px; font-weight: 600; }
.site-image__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.site-image__pick { cursor: pointer; }
.site-image .field__error:empty { display: none; }
.site-image.has-error .field__error { display: block; }
@media (max-width: 640px) { .site-image { flex-direction: column; } .site-image__preview { width: 100%; height: 160px; } }

/* Icon-only row actions (Edit / Delete) */
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
    border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--text-muted); cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.icon-btn .icon { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--border); }
.icon-btn--danger:hover { background: var(--status-offline-bg); color: var(--danger); }
.icon-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }


/* Manage lists: Contacts panel (full width) */
.lists-dialog__grid > [data-panel-kind="contact"] { grid-column: 1 / -1; }
.contact-form { flex-direction: column; align-items: stretch; }
.contact-form__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 150px; gap: 12px; }
.contact-form__grid .field { margin: 0; }
.contact-form .multiplier-builder__row { margin-top: 4px; }
.contact-table { margin: 0; border: 0; border-radius: 0; }
.contact-table .table { margin: 0; }
.contact-table__name { font-weight: 600; }
.contact-table tr.is-editing td { background: var(--primary-soft); }
.contact-table .cell-actions { text-align: right; white-space: nowrap; }
.contact-table .lists-panel__empty { margin: 0; padding: 14px 16px; }
@media (max-width: 800px) { .contact-form__grid { grid-template-columns: minmax(0, 1fr); } }

/* Collapsible list entries (Manage lists) */
.lists-panel__more { list-style: none; display: flex; justify-content: center; padding: 6px 12px 10px; }
.lists-dialog__grid > [data-panel-kind="multiplier"] .lists-panel__more { grid-column: 1 / -1; }
.lists-panel__toggle {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface-2); color: var(--primary); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.lists-panel__toggle:hover { border-color: var(--primary); background: var(--primary-soft); }
.lists-panel__toggle .icon { transition: transform 0.15s; }
.lists-panel__toggle .icon.is-flipped { transform: rotate(180deg); }

/* Site list: Active / Inactive switch */
.status-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.status-switch.is-on { color: var(--status-online); }
.status-switch .switch { flex: none; }
/* Fixed width so switching Active <-> Inactive never changes the column width */
.status-switch { white-space: nowrap; }
.status-switch__text { display: inline-block; width: 60px; }

/* Manage lists: fold a panel by clicking its header */
.lists-panel__head { cursor: pointer; user-select: none; }
.lists-panel__head:hover h3 { color: var(--primary); }
.lists-panel__head:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.lists-panel__head .tag { margin-left: auto; }
.lists-panel__chevron { margin-left: 8px; color: var(--text-muted); transition: transform 0.15s; transform: rotate(180deg); }
.lists-panel.is-folded .lists-panel__chevron { transform: none; }
.lists-panel.is-folded > :not(.lists-panel__head) { display: none !important; }
.lists-panel.is-folded .lists-panel__head { border-bottom: 0; }
.lists-dialog__grid { align-items: start; }
/* Manage lists: per-panel search */
.lists-panel__search { position: relative; padding: 10px 14px 4px; }
.lists-panel__search .icon { position: absolute; left: 24px; top: 50%; margin-top: 3px; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.lists-panel__search .input { width: 100%; padding-left: 32px; }

/* Rules table: dispatch contacts per rule */
.dispatch-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px dashed var(--border-strong); border-radius: 999px;
    background: transparent; color: var(--text-muted); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.dispatch-btn:hover, .dispatch-btn.is-open { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.dispatch-btn.has-contacts { border-style: solid; color: var(--primary); }
.dispatch-editor__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dispatch-editor__search { padding: 4px 0 8px; }
.dispatch-editor__search .icon { left: 10px; }
.dispatch-editor__list {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px;
    max-height: 280px; overflow-y: auto; padding: 2px;
}
.dispatch-option {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
    padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer;
}
.dispatch-option:hover { border-color: var(--border-strong); }
.dispatch-option.is-on { border-color: var(--primary); background: var(--primary-soft); }
.dispatch-option input { grid-row: 1 / span 2; }
.dispatch-option__name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dispatch-option__post { grid-column: 2; font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dispatch-option .tag { grid-column: 3; grid-row: 1 / span 2; }
.rule-chip__contacts { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; color: var(--primary); font-weight: 600; }

/* Equipment step: list on top, editor full width below (no sideways scrolling in the rules table) */
.equip-layout { grid-template-columns: minmax(0, 1fr); }
.equip-list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.rule-badge--lg { display: inline-block; min-width: 30px; text-align: center; font-size: 11.5px; line-height: 20px; padding: 0 7px; }
.dispatch-cell { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }

/* Dispatch picker: copy contacts to other rules */
.dispatch-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.dispatch-copy__label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.dispatch-copy__targets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dispatch-copy__btn {
    display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); cursor: pointer;
}
.dispatch-copy__btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.dispatch-copy__btn .rule-badge { font-size: 11px; line-height: 18px; padding: 0 6px; }
.dispatch-copy__btn.is-same { color: var(--status-online); }

/* =====================================================================
   Reports (Event Report)
   ===================================================================== */
.report-filters { padding: 18px 20px; margin-bottom: 16px; }
.report-filters__grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px 16px; }
.report-filters__grid .field { margin: 0; }
.report-filters__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.report-filters__quick { display: flex; flex-wrap: wrap; gap: 4px; }
.report-filters .alert { margin: 12px 0 0; }
.report-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-tile {
    display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--border); border-left: 4px solid var(--border-strong);
    border-radius: var(--radius); background: var(--surface);
}
.stat-tile__label { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: var(--text-muted); }
.stat-tile__value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-tile--hh, .stat-tile--ll { border-left-color: var(--status-offline); }
.stat-tile--h, .stat-tile--l { border-left-color: var(--status-warning); }
.stat-tile--nn { border-left-color: var(--status-online); }
.stat-tile--total { border-left-color: var(--primary); }
.report-note { margin: 0; border-radius: 0; }
.report-table .num { text-align: right; }
.report-table .nowrap { white-space: nowrap; }
.report-table td.report-empty { padding: 32px 20px; text-align: center; color: var(--text-muted); }
.th-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.th-sort:hover { color: var(--primary); }
.th-sort.is-asc::after { content: " \25B2"; font-size: 9px; }
.th-sort.is-desc::after { content: " \25BC"; font-size: 9px; }
.report-count { margin-left: auto; }
@media (max-width: 1200px) { .report-filters__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .report-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .report-filters__grid, .report-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Report date range: one field + two-month calendar */
.report-filters__grid { grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.6fr); }
.report-filters__range { position: relative; }
.date-range__btn { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; cursor: pointer; font-variant-numeric: tabular-nums; }
.date-range__btn .icon { color: var(--primary); flex: none; }
.date-range__btn[aria-expanded="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.date-range__days { margin-left: auto; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: var(--primary); background: var(--primary-soft); }
.date-range__days:empty { display: none; }
.date-range {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 50; width: 580px; max-width: calc(100vw - 32px);
    padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.date-range[hidden] { display: none !important; }
.date-range__months { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.date-range__head { display: grid; grid-template-columns: 32px 1fr 32px; align-items: center; text-align: center; margin-bottom: 8px; font-size: 14px; }
.date-range__nav {
    width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text);
    font-size: 18px; line-height: 1; cursor: pointer;
}
.date-range__nav:hover { border-color: var(--primary); color: var(--primary); }
.date-range__grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.date-range__dow { font-size: 11px; font-weight: 700; color: var(--text-muted); text-align: center; padding: 4px 0 6px; }
.date-range__day {
    height: 34px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; border-radius: 8px;
    font-variant-numeric: tabular-nums;
}
.date-range__day:hover { background: var(--surface-hover); }
.date-range__day.is-outside { color: var(--text-muted); opacity: 0.4; }
.date-range__day.is-today { box-shadow: inset 0 0 0 1.5px var(--primary); }
.date-range__day.in-range { background: var(--primary-soft); border-radius: 0; opacity: 1; }
.date-range__day.is-start, .date-range__day.is-end { background: var(--primary); color: var(--primary-contrast); font-weight: 700; opacity: 1; }
.date-range__day.is-start { border-radius: 8px 0 0 8px; }
.date-range__day.is-end { border-radius: 0 8px 8px 0; }
.date-range__day.is-start.is-end { border-radius: 8px; }
.date-range__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.date-range__summary { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.date-range__summary.is-error { color: var(--danger); }
.date-range__actions { display: flex; gap: 8px; }

/* Segmented control (quick date ranges) */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); }
.segmented__btn {
    padding: 6px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--text-muted);
    font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background 0.12s, color 0.12s;
}
.segmented__btn:hover { color: var(--text); background: var(--surface-hover); }
.segmented__btn.is-active { background: var(--primary); color: var(--primary-contrast); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.segmented__btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

@media (max-width: 1200px) { .report-filters__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
    .date-range__months { grid-template-columns: 1fr; }
    .date-range__month + .date-range__month { display: none; }
    .date-range { left: 0; right: auto; }
    .segmented { flex-wrap: wrap; border-radius: var(--radius); }
}

/* Segmented control: sliding highlight */
.segmented { position: relative; }
.segmented__thumb {
    position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 999px;
    background: var(--primary); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); opacity: 0; pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), width 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
}
.segmented__thumb.is-visible { opacity: 1; }
.segmented__btn { position: relative; z-index: 1; }
.segmented__btn.is-active { background: transparent; box-shadow: none; transition: color 0.2s 0.05s; }
@media (prefers-reduced-motion: reduce) { .segmented__thumb { transition: none; } }

/* Compact summary tiles: label and count on one line */
.stat-tile { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px; }
.stat-tile__label { font-size: 12.5px; }
.stat-tile__value { font-size: 20px; line-height: 1.2; }
.report-summary { gap: 10px; }

/* Report pager: rows per page, "Showing x-y of z", numbered pages */
.report-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px 20px; border-top: 1px solid var(--border); }
.report-pager__size { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.report-pager__size .input { width: auto; }
.report-pager__pages { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.page-btn {
    min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
    color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums;
}
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn.is-current { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.page-btn:disabled:not(.is-current) { opacity: 0.4; cursor: default; }
.page-gap { padding: 0 4px; color: var(--text-muted); }

/* =====================================================================
   Report chart view. Colours: validated categorical palette, fixed order
   (LL, L, NN, H, HH), separate light and dark steps.
   ===================================================================== */
:root { --chart-1: #2a78d6; --chart-2: #eb6834; --chart-3: #1baf7a; --chart-4: #eda100; --chart-5: #e87ba4; --chart-other: #8a8f98; }
html[data-theme="dark"], html[data-theme="night"] { --chart-1: #3987e5; --chart-2: #d95926; --chart-3: #199e70; --chart-4: #c98500; --chart-5: #d55181; --chart-other: #7b8089; }
.report-view-switch { margin-left: 0; flex: none; }
.report-chart { position: relative; padding: 16px 20px 12px; }
.report-chart__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 20px; margin-bottom: 8px; }
.report-chart__title { font-size: 14px; margin: 0; }
.report-chart__sub { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }
.report-chart__legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--text); }
.report-chart__key { display: inline-flex; align-items: center; gap: 6px; }
.report-chart__keyval { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.report-chart__swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.report-chart__swatch--1, .seg--1 { background: var(--chart-1); fill: var(--chart-1); }
.report-chart__swatch--2, .seg--2 { background: var(--chart-2); fill: var(--chart-2); }
.report-chart__swatch--3, .seg--3 { background: var(--chart-3); fill: var(--chart-3); }
.report-chart__swatch--4, .seg--4 { background: var(--chart-4); fill: var(--chart-4); }
.report-chart__swatch--5, .seg--5 { background: var(--chart-5); fill: var(--chart-5); }
.report-chart__swatch--other, .seg--other { background: var(--chart-other); fill: var(--chart-other); }
.report-chart__plot { width: 100%; overflow: hidden; }
.report-chart__svg { display: block; width: 100%; height: auto; }
.report-chart__svg .grid { stroke: var(--border); stroke-width: 1; }
.report-chart__svg .axis { stroke: var(--border-strong); stroke-width: 1; }
.report-chart__svg .tick { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.report-chart__svg .hit { fill: transparent; cursor: crosshair; }
.report-chart__svg .hit.is-hover { fill: var(--text); fill-opacity: 0.06; }
.report-chart__empty { margin: 0; padding: 60px 20px; text-align: center; color: var(--text-muted); }
.report-chart__tip {
    position: absolute; z-index: 5; min-width: 150px; padding: 8px 10px; pointer-events: none;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    font-size: 12.5px; color: var(--text);
}
.report-chart__tip strong { display: block; margin-bottom: 4px; }
.report-chart__tiprow { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; padding: 1px 0; }
.report-chart__tiptotal { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); font-weight: 700; }

/* ECharts report chart */
.report-chart__plot { height: 380px; }

/* Event Summary view: per-date groups, count pills per type */
.summary-table .num { text-align: center; }
.summary-table__date th {
    padding: 8px 20px; text-align: left; font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em;
    color: var(--primary); background: var(--primary-soft); border-bottom: 1px solid var(--border);
}
.summary-table__date .icon { margin-right: 6px; vertical-align: -3px; }
.count-pill {
    display: inline-block; min-width: 34px; padding: 2px 8px; border-radius: 999px; text-align: center;
    font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: #1a1a1a;
}
.count-pill.is-zero { color: var(--text-muted); font-weight: 500; border: 1px dashed var(--border-strong); opacity: 0.7; }
.count-pill--hh { background: #e03131; color: #fff; }
.count-pill--h { background: #f783ac; }
.count-pill--nn { background: #2f9e44; color: #fff; }
.count-pill--l { background: #f0d43a; }
.count-pill--ll { background: #f08c00; }

/* Chart tooltip (built as DOM by Scripts/report.js; same type colours as Scripts/charts.js) */
.chart-tip {
    min-width: 170px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius);
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); font-size: 12.5px; line-height: 1.5;
}
.chart-tip__title { font-weight: 700; font-size: 13px; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.chart-tip__row { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; padding: 2px 0; }
.chart-tip__row.is-zero { color: var(--text-muted); }
.chart-tip__val { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.chart-tip__row.is-zero .chart-tip__val { font-weight: 500; }
.chart-tip__total { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); font-weight: 700; }
.chart-tip__dot { width: 10px; height: 10px; border-radius: 50%; background: #868e96; }
.chart-tip__dot--hh { background: #e03131; }
.chart-tip__dot--h { background: #f783ac; }
.chart-tip__dot--nn { background: #2f9e44; }
.chart-tip__dot--l { background: #f0d43a; }
.chart-tip__dot--ll { background: #f08c00; }

/* ---------- Smooth sidebar collapse (desktop) and group open/close ---------- */
@media (min-width: 992px) {
    .sidebar, .main { transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
    .sidebar { overflow: hidden; }
    .nav { overflow-x: hidden; }
    .nav__link, .nav__group-title { transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), gap 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.15s, color 0.15s; }
    .nav__link span, .nav__group-title span, .nav__chevron {
        display: block; white-space: nowrap; overflow: hidden; max-width: 200px;
        transition: opacity 0.2s ease, max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .brand-text { white-space: nowrap; overflow: hidden; max-width: 200px; transition: opacity 0.2s ease, max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
    .sidebar__brand { transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), gap 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
    .sidebar-collapsed .sidebar__brand { gap: 0; }
    /* Collapsed: labels fade and shrink instead of disappearing at once. */
    .sidebar-collapsed .nav__link span,
    .sidebar-collapsed .nav__group-title span,
    .sidebar-collapsed .nav__chevron { display: block; opacity: 0; max-width: 0; flex: 0 0 0; }
    .sidebar-collapsed .brand-text { opacity: 0; max-width: 0; }
    .sidebar-collapsed .nav__link,
    .sidebar-collapsed .nav__group-title { gap: 0; justify-content: center; padding: 10px 0; }
    /* No animation while the page first applies the saved state. */
    .sidebar-no-anim .sidebar, .sidebar-no-anim .main, .sidebar-no-anim .sidebar *, .sidebar-no-anim .brand-text { transition: none !important; }
}
/* Groups (Report, Management, ...) open and close smoothly where the browser supports it. */
@supports (interpolate-size: allow-keywords) {
    .nav { interpolate-size: allow-keywords; }
    .nav__group::details-content {
        block-size: 0; overflow: hidden;
        transition: block-size 0.28s cubic-bezier(0.4, 0, 0.2, 1), content-visibility 0.28s allow-discrete;
    }
    .nav__group[open]::details-content { block-size: auto; }
}
.nav__chevron { transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
@media (prefers-reduced-motion: reduce) {
    .sidebar, .main, .nav__link, .nav__group-title, .nav__link span, .nav__group-title span, .brand-text, .nav__chevron { transition: none !important; }
    .nav__group::details-content { transition: none !important; }
}

/* Report types beyond HH..LL (Voltage Report): tiles, pills, badges, tooltip dots */
.report-summary { grid-template-columns: repeat(var(--tile-count, 6), minmax(0, 1fr)); }
@media (max-width: 1200px) { .report-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .report-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-tile--criticallow { border-left-color: var(--status-offline); }
.stat-tile--low { border-left-color: var(--status-warning); }
.stat-tile--normal { border-left-color: var(--status-online); }
.count-pill--criticallow { background: #e03131; color: #fff; }
.count-pill--low { background: #f08c00; }
.count-pill--normal { background: #2f9e44; color: #fff; }
.rule-badge--criticallow { color: var(--status-offline); background: var(--status-offline-bg); border-color: transparent; opacity: 1; }
.rule-badge--low { color: var(--status-warning); background: var(--status-warning-bg); border-color: transparent; opacity: 1; }
.rule-badge--normal { color: var(--status-online); background: var(--status-online-bg); border-color: transparent; opacity: 1; }
.rule-badge--lg { white-space: nowrap; }
.chart-tip__dot--criticallow { background: #e03131; }
.chart-tip__dot--low { background: #f08c00; }
.chart-tip__dot--normal { background: #2f9e44; }

/* OVERVOLTAGE (Voltage Report) */
.stat-tile--overvoltage { border-left-color: #7048e8; }
.count-pill--overvoltage { background: #7048e8; color: #fff; }
.rule-badge--overvoltage { color: #7048e8; background: rgba(112, 72, 232, 0.14); border-color: transparent; opacity: 1; }
html[data-theme="dark"] .rule-badge--overvoltage, html[data-theme="night"] .rule-badge--overvoltage { color: #b197fc; }
.chart-tip__dot--overvoltage { background: #7048e8; }

.report-chart__plot--tall { height: 460px; }

/* Multi Trending: selected-site chips */
.report-sites { grid-column: span 2; }
.field__hint-inline { font-weight: 500; color: var(--text-muted); }
.site-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.site-chips:empty { display: none; }
.site-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 999px;
    background: var(--primary-soft); color: var(--primary); font-size: 12.5px; font-weight: 600;
}
.site-chip__x {
    width: 20px; height: 20px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; font-size: 15px; line-height: 1;
}
.site-chip__x:hover { background: var(--primary); color: var(--primary-contrast); }

/* Maintenance Report statuses */
.stat-tile--completed { border-left-color: var(--status-online); }
.stat-tile--ongoing { border-left-color: var(--status-warning); }
.count-pill--completed { background: #2f9e44; color: #fff; }
.count-pill--ongoing { background: #f08c00; }
.rule-badge--completed { color: var(--status-online); background: var(--status-online-bg); border-color: transparent; opacity: 1; }
.rule-badge--ongoing { color: var(--status-warning); background: var(--status-warning-bg); border-color: transparent; opacity: 1; }
.chart-tip__dot--completed { background: #2f9e44; }
.chart-tip__dot--ongoing { background: #f08c00; }

/* Multi Trending: searchable site picker */
.site-combo { position: relative; }
.site-combo__list {
    position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0; max-height: 260px; overflow-y: auto;
    margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.site-combo__option { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.site-combo__option:hover, .site-combo__option.is-active { background: var(--primary-soft); color: var(--primary); }
.site-combo__meta { font-size: 11.5px; color: var(--text-muted); }
.site-combo__empty { padding: 10px; font-size: 12.5px; color: var(--text-muted); text-align: center; }

/* Date range field: keep "dd/mm/yyyy -> dd/mm/yyyy" and the day badge on one line */
.report-filters__grid { grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(290px, 1.6fr); }
@media (max-width: 1200px) { .report-filters__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.date-range__btn { white-space: nowrap; overflow: hidden; }
#rpRangeText { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date-range__days { flex: none; white-space: nowrap; }

/* Alarm Report types (same colours as the previous system) */
.stat-tile--intruderalert { border-left-color: #c30010; }
.stat-tile--possiblesensorfailure { border-left-color: #f28b8f; }
.stat-tile--batterylow { border-left-color: #e0d63a; }
.stat-tile--batterylowintruderalert { border-left-color: #e69b00; }
.count-pill--intruderalert { background: #c30010; color: #fff; }
.count-pill--possiblesensorfailure { background: #faafb1; }
.count-pill--batterylow { background: #ece75f; }
.count-pill--batterylowintruderalert { background: #e69b00; }
.rule-badge--intruderalert { background: #c30010; color: #fff; border-color: transparent; opacity: 1; }
.rule-badge--possiblesensorfailure { background: #faafb1; color: #1a1a1a; border-color: transparent; opacity: 1; }
.rule-badge--batterylow { background: #ece75f; color: #1a1a1a; border-color: transparent; opacity: 1; }
.rule-badge--batterylowintruderalert { background: #e69b00; color: #1a1a1a; border-color: transparent; opacity: 1; }
.chart-tip__dot--intruderalert { background: #c30010; }
.chart-tip__dot--possiblesensorfailure { background: #f28b8f; }
.chart-tip__dot--batterylow { background: #e0d63a; }
.chart-tip__dot--batterylowintruderalert { background: #e69b00; }
.stat-tile__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* OverFlow Report */
.stat-tile--overflow { border-left-color: var(--status-offline); }
.stat-tile--falsealarm { border-left-color: #f59f00; }
.count-pill--overflow { background: #e03131; color: #fff; }
.count-pill--falsealarm { background: #f59f00; }
.rule-badge--overflow { color: var(--status-offline); background: var(--status-offline-bg); border-color: transparent; opacity: 1; }
.rule-badge--falsealarm { color: #b35c00; background: rgba(245, 159, 0, 0.18); border-color: transparent; opacity: 1; }
html[data-theme="dark"] .rule-badge--falsealarm, html[data-theme="night"] .rule-badge--falsealarm { color: #ffc266; }
.chart-tip__dot--overflow { background: #e03131; }
.chart-tip__dot--falsealarm { background: #f59f00; }
.ov-dialog {
    width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; flex-direction: column; overflow: hidden;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.ov-dialog[open] { display: flex; }
.ov-dialog::backdrop { background: rgba(4, 8, 16, 0.6); backdrop-filter: blur(3px); }
.ov-dialog__body { padding: 18px 24px; overflow-y: auto; }
.ov-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; margin: 0 0 16px; padding: 12px 14px;
            border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.ov-facts dt { font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ov-facts dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.ov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.ov-calc { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 4px 0 16px; }
.ov-calc__item { padding: 10px 12px; border-radius: var(--radius); background: var(--primary-soft); }
.ov-calc__item span { display: block; font-size: 11.5px; color: var(--text-muted); }
.ov-calc__item strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.ov-calc__item--total { background: var(--status-offline-bg); }
.ov-dialog .wizard__hint { font-size: 11.5px; }
@media (max-width: 640px) { .ov-facts, .ov-grid, .ov-calc { grid-template-columns: 1fr 1fr; } }

/* =====================================================================
   Dashboard
   ===================================================================== */
.dash-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dash-live { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.dash-live__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--status-online); box-shadow: 0 0 0 0 rgba(47, 158, 68, 0.5); animation: dash-pulse 2s infinite; }
.dash-live.is-loading .dash-live__dot { background: var(--status-warning); }
@keyframes dash-pulse { 0% { box-shadow: 0 0 0 0 rgba(47, 158, 68, 0.45); } 70% { box-shadow: 0 0 0 8px rgba(47, 158, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 158, 68, 0); } }
.dash-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.dash-card {
    --accent: var(--primary); --accent-bg: var(--primary-soft);
    position: relative; display: flex; align-items: center; gap: 14px; padding: 16px 18px; overflow: hidden;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm, none);
}
.dash-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent); }
.dash-card--online { --accent: var(--status-online); --accent-bg: var(--status-online-bg); }
.dash-card--delayed { --accent: var(--status-warning); --accent-bg: var(--status-warning-bg); }
.dash-card--offline { --accent: var(--status-offline); --accent-bg: var(--status-offline-bg); }
.dash-card--maintenance { --accent: var(--status-maint, #1c7ed6); --accent-bg: var(--status-maint-bg, rgba(28, 126, 214, 0.14)); }
.dash-card__icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; color: var(--accent); background: var(--accent-bg); }
.dash-card__icon .icon { width: 22px; height: 22px; }
.dash-card__body { display: flex; flex-direction: column; min-width: 0; }
.dash-card__label { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.dash-card__value { font-size: 30px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--text); }
.dash-card__hint { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-card__pct { position: absolute; top: 12px; right: 14px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: var(--accent); background: var(--accent-bg); }
.dash-card__pct:empty { display: none; }
.dash-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.dash-chart { padding: 16px 18px 10px; margin: 0; }
.dash-chart--wide { grid-column: span 2; }
.dash-chart__head { margin-bottom: 4px; }
.dash-chart__title { margin: 0; font-size: 15px; }
.dash-chart__sub { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); min-height: 16px; }
.dash-chart__plot { height: 300px; }
@media (max-width: 1280px) { .dash-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } .dash-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .dash-cards, .dash-charts { grid-template-columns: minmax(0, 1fr); } .dash-chart--wide { grid-column: auto; } }
@media (prefers-reduced-motion: reduce) { .dash-live__dot { animation: none; } }
.dash-card__pct ~ .dash-card__body, .dash-card:has(.dash-card__pct) .dash-card__body { padding-right: 40px; }
.dash-card__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Compact dashboard cards */
.dash-card { padding: 10px 14px; gap: 12px; }
.dash-card__icon { width: 36px; height: 36px; border-radius: 10px; }
.dash-card__icon .icon { width: 18px; height: 18px; }
.dash-card__label { font-size: 11.5px; }
.dash-card__value { font-size: 24px; line-height: 1.1; }
.dash-card__hint { font-size: 11.5px; }
.dash-card__pct { top: 8px; right: 10px; }

/* Dashboard: clickable cards + site list dialog */
button.dash-card { width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s; }
button.dash-card:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); transform: translateY(-1px); }
button.dash-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dash-sites {
    width: min(1100px, calc(100vw - 32px)); height: min(720px, calc(100vh - 32px)); padding: 0; flex-direction: column; overflow: hidden;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.dash-sites[open] { display: flex; }
.dash-sites::backdrop { background: rgba(4, 8, 16, 0.6); backdrop-filter: blur(3px); }
.dash-sites__bar { display: flex; align-items: center; gap: 10px; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.dash-sites__bar .input { max-width: 340px; }
.dash-sites__bar .tag { margin-left: auto; }
.dash-sites__table { flex: 1; min-height: 0; overflow: auto; margin: 0; border: 0; border-radius: 0; }
.dash-sites__table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); }
.dash-sites__table td.report-empty { padding: 32px 20px; text-align: center; color: var(--text-muted); }
.site-state { display: inline-block; min-width: 92px; padding: 2px 10px; border-radius: 999px; text-align: center; font-size: 12px; font-weight: 700; }
.site-state--online { color: #fff; background: #2f9e44; }
.site-state--delayed { color: #1a1a1a; background: #f59f00; }
.site-state--offline { color: #fff; background: #e03131; }
.site-state--maintenance { color: #fff; background: #1c7ed6; }

/* Dashboard: 4 charts in a 2 x 2 grid on wide screens; clickable slices */
.dash-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1500px) { .dash-charts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 760px) { .dash-charts { grid-template-columns: minmax(0, 1fr); } }
/* Dashboard: 3 charts */
@media (min-width: 1100px) { .dash-charts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* User Edit: Data access */
.scope-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 10px 0 14px; }
.scope-group { margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.scope-group legend { padding: 0 6px; font-size: 12.5px; font-weight: 700; }
.scope-all { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 6px; }
.scope-list { max-height: 200px; overflow-y: auto; padding-left: 4px; display: grid; }
.scope-list > span, .scope-list label { font-size: 13px; }
.scope-list input { margin-right: 6px; }
.scope-list.is-disabled { opacity: 0.45; }
@media (max-width: 700px) { .scope-grid { grid-template-columns: 1fr; } }
.dash-chart__head { text-align: center; }
/* Chart header: centred title + date, info icon on the right */
.dash-chart__head { position: relative; padding: 0 32px; }
.dash-chart__info { position: absolute; top: 0; right: 0; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; color: var(--text-muted); cursor: help; }
.dash-chart__info:hover, .dash-chart__info:focus-visible { color: var(--primary); background: var(--primary-soft); outline: none; }
.dash-chart__info .icon { width: 17px; height: 17px; }
/* Info icon tooltip (CSS only; text comes from data-tip) */
.dash-chart__info { z-index: 3; }
.dash-chart__info::after {
    content: attr(data-tip); position: absolute; top: calc(100% + 8px); right: 0; width: max-content; max-width: 280px;
    padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    box-shadow: var(--shadow-lg); font-size: 12.5px; font-weight: 500; line-height: 1.45; text-align: left; white-space: normal;
    opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity 0.12s, transform 0.12s, visibility 0.12s; pointer-events: none;
}
.dash-chart__info:hover::after, .dash-chart__info:focus-visible::after { opacity: 1; visibility: visible; transform: none; }
.dash-chart { overflow: visible; }

/* Input with a fixed unit suffix (Site Info: Capacity MGal) */
.input-unit { position: relative; display: flex; align-items: center; }
.input-unit .input { padding-right: 56px; width: 100%; }
.input-unit__suffix { position: absolute; right: 12px; font-size: 12.5px; font-weight: 600; color: var(--text-muted, #6b7280); pointer-events: none; }

/* Review: dispatch contacts pop up on hover / focus of the rule's contact count */
.dispatch-pop { position: relative; display: inline-flex; align-items: center; gap: 3px; margin-left: 4px; color: var(--accent, #2563eb); cursor: default; border-radius: 4px; }
.dispatch-pop:focus-visible { outline: 2px solid var(--accent, #2563eb); outline-offset: 2px; }
.dispatch-pop__panel { position: absolute; z-index: 30; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) translateY(4px);
    min-width: 160px; max-width: 260px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
    border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); font-family: var(--font-sans, inherit); font-size: 12px;
    opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .12s ease, transform .12s ease, visibility .12s; }
.dispatch-pop:hover .dispatch-pop__panel, .dispatch-pop:focus .dispatch-pop__panel { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.dispatch-pop__title { display: block; font-weight: 700; margin-bottom: 4px; color: var(--text-muted, #6b7280); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.dispatch-pop__list { margin: 0; padding-left: 16px; display: grid; gap: 2px; white-space: nowrap; }
.dispatch-pop__list li { display: list-item; }
.dispatch-pop__sim { margin-left: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--text-muted, #6b7280); }
.dispatch-pop__panel { max-width: 320px; }

/* ---------------------------------------------------------------- Summary page */
.sum-filters { margin-bottom: 14px; }
.sum-filters__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 12px 16px; align-items: end; padding: 14px 16px; }
.sum-filters__grid .field { margin: 0; }
.sum-filters__actions { display: flex; gap: 8px; }
.sum-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 10px; }
.sum-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-muted); }
.sum-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sum-search { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.sum-search .input { width: 220px; }
.sum-group { margin-bottom: 16px; overflow: hidden; }
.sum-group__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sum-group__head .card__title { font-size: 17px; letter-spacing: .02em; }
.sum-group__count { font-size: 12.5px; color: var(--text-muted); }
.sum-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.sum-table thead th { position: sticky; top: 0; z-index: 1; padding: 0; background: #1f2937; color: #fff; text-align: left; white-space: nowrap; }
.sum-sort { display: flex; align-items: center; gap: 4px; width: 100%; padding: 8px 10px; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.sum-sort sup { font-size: 9.5px; margin-left: 1px; }
.sum-sort__arrow { margin-left: auto; opacity: .45; font-size: 11px; }
.sum-sort.is-active .sum-sort__arrow { opacity: 1; }
.sum-sort:hover { background: rgba(255, 255, 255, .06); }
.sum-table tbody td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.sum-table tbody tr:hover td { background: var(--surface-hover); }
.sum-table td.num { text-align: right; }
.sum-name { font-weight: 600; }
.sum-name > span { vertical-align: middle; }
.sum-dot { display: inline-block; width: 9px; height: 9px; margin-right: 10px; border-radius: 50%; vertical-align: middle; background: #e03131; }
.sum-dot--online { background: #2fbf4a; box-shadow: 0 0 0 3px rgba(47, 191, 74, .18); }
.sum-dot--delayed { background: #f08c00; }
.sum-dot--offline { background: #e03131; }
.sum-dot--maintenance { background: #1c7ed6; }
.sum-table td.sum-ev { text-align: center; }
.sum-badge { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 58px; padding: 3px 10px;
    border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .04em; border: 1px solid transparent; line-height: 1.3; }
.sum-badge__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sum-badge.sum-ev--nn { background: #e6f9ea; color: #1b7a32; border-color: #b4e8c0; }
.sum-badge.sum-ev--warn { background: #fff6db; color: #9a6700; border-color: #ffe29a; }
.sum-badge.sum-ev--alarm { background: #ffe8e8; color: #c92a2a; border-color: #ffc0c0; }
.sum-badge.sum-ev--other { background: var(--surface-2); color: var(--text); border-color: var(--border); }
:root[data-theme="dark"] .sum-badge.sum-ev--nn, :root[data-theme="night"] .sum-badge.sum-ev--nn { background: rgba(47, 191, 74, .16); color: #69db7c; border-color: rgba(47, 191, 74, .35); }
:root[data-theme="dark"] .sum-badge.sum-ev--warn, :root[data-theme="night"] .sum-badge.sum-ev--warn { background: rgba(252, 196, 25, .14); color: #ffd43b; border-color: rgba(252, 196, 25, .35); }
:root[data-theme="dark"] .sum-badge.sum-ev--alarm, :root[data-theme="night"] .sum-badge.sum-ev--alarm { background: rgba(250, 82, 82, .16); color: #ff8787; border-color: rgba(250, 82, 82, .4); }
.sum-bat { white-space: nowrap; }
.sum-bat > span { display: inline-block; min-width: 46px; vertical-align: middle; }
.bat { width: 30px; height: 16px; margin-left: 8px; vertical-align: middle; }
.bat__body { fill: var(--surface); stroke: #495057; stroke-width: 1.4; }
.bat__cap { fill: #495057; }
.bat__cell:not(.is-on) { fill: var(--surface-2); }
.bat--normal .bat__cell.is-on { fill: #d4b106; }
.bat--over .bat__cell.is-on { fill: #37b24d; }
.bat--over .bat__body { stroke: #2f9e44; }
.bat--low .bat__cell.is-on { fill: #f08c00; }
.bat--verylow .bat__cell.is-on { fill: #e03131; animation: sd-blink 1.2s ease-in-out infinite; }
.bat--none .bat__body { stroke: var(--border-strong); }
:root[data-theme="dark"] .bat__body, :root[data-theme="night"] .bat__body { stroke: #ced4da; }
:root[data-theme="dark"] .bat__cap, :root[data-theme="night"] .bat__cap { fill: #ced4da; }
.sum-fus { text-align: center; }
.fus { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--text-muted); }
.fus svg { width: 28px; height: 28px; }
.fus__sun { fill: #fab005; }
.fus__ray { stroke: #fab005; stroke-width: 1.2; stroke-linecap: round; fill: none; }
.fus__cell { fill: #1c7ed6; stroke: #a5d8ff; stroke-width: .5; }
.fus__stand { stroke: var(--text-muted); stroke-width: 1.5; stroke-linecap: round; fill: none; }
.fus__tower { stroke: #495057; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; fill: none; }
:root[data-theme="dark"] .fus__tower, :root[data-theme="night"] .fus__tower { stroke: #ced4da; }
@media (max-width: 900px) {
    .sum-filters__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sum-filters__actions { grid-column: 1 / -1; }
    .sum-search .input { width: 100%; }
}
@media (max-width: 520px) { .sum-filters__grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- Site Detail page */
.sd-head { padding: 16px 20px; margin-bottom: 16px; background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%); }
.sd-head__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.sd-head__title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sd-head__title h2 { margin: 0; font-size: 20px; }
.sd-head__time { font-size: 12.5px; color: var(--text-muted); }
.sd-chip { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); font-family: var(--font-mono); }
.sd-status.is-maint { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: #e7f1fd; color: #1c7ed6; }
.sd-info { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 20px; margin: 0 0 12px; }
.sd-info__item { display: grid; gap: 1px; min-width: 0; }
.sd-info dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.sd-info dd { margin: 0; font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; }
.sd-info dd.is-empty { color: var(--text-muted); font-weight: 400; }
.sd-links { display: flex; gap: 8px; flex-wrap: wrap; }

.sd-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 2.4fr); gap: 16px; margin-bottom: 16px; }
.sd-panel { display: flex; flex-direction: column; overflow: hidden; }
.sd-panel__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 38px; padding: 6px 14px;
    background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12.5px; }
.sd-panel__bar--title { justify-content: center; font-weight: 700; font-size: 14px; }
.sd-panel__body { padding: 14px; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.sd-equip { font-weight: 600; text-align: center; }

.sd-volt { font-family: var(--font-mono); font-weight: 600; }

/* Tank drawing: Ground (wide tank on the ground) or Elevated (smaller tank on a tower), from reservoirType.
   The scale sits inside the vessel so its 0 and Max line up with the water. */
.sd-tank { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 0 4px; }
.sd-tank__stage { position: relative; display: flex; flex-direction: column; align-items: center; }
.sd-tank__vessel { position: relative; width: 170px; height: 210px; margin: 15px 0;
    border-left: 2px solid #adb5bd; border-right: 2px solid #adb5bd;
    background: linear-gradient(90deg, rgba(173,181,189,.28), rgba(255,255,255,.55) 45%, rgba(173,181,189,.3)); }
.sd-tank__scale { position: absolute; top: 0; bottom: 0; right: calc(100% + 12px); width: 34px; border-right: 1px solid var(--border-strong); }
.sd-tank__scale span { position: absolute; right: 6px; transform: translateY(50%); font-size: 11px; line-height: 1; color: var(--text-muted); font-family: var(--font-mono); }
.sd-tank__scale span::after { content: ""; position: absolute; right: -7px; top: 50%; width: 5px; border-top: 1px solid var(--border-strong); }
.sd-tank__top, .sd-tank__bottom { position: absolute; left: -2px; right: -2px; height: 30px; border: 2px solid #adb5bd; border-radius: 50%; }
.sd-tank__top { top: -15px; background: #e9ecef; z-index: 2; }
.sd-tank__bottom { bottom: -15px; background: #74c0fc; border-color: #4dabf7; }
.sd-tank__water { position: absolute; left: 0; right: 0; bottom: 0; height: 0; overflow: visible;
    background: linear-gradient(90deg, #4dabf7, #a5d8ff 45%, #339af0); transition: height 1.1s cubic-bezier(.25, .8, .25, 1); }
.sd-tank__surface { position: absolute; left: -2px; right: -2px; top: -15px; height: 30px; border-radius: 50%; background: #74c0fc; border: 2px solid #4dabf7;
    animation: sd-bob 3.2s ease-in-out infinite; }
.sd-tank__wave { position: absolute; left: 12%; right: 12%; top: -4px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.45);
    animation: sd-wave 3.2s ease-in-out infinite; }
.sd-tank__water.is-empty .sd-tank__surface, .sd-tank__water.is-empty .sd-tank__wave { display: none; }
@keyframes sd-bob { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.82); } }
@keyframes sd-wave { 0%, 100% { transform: translateX(-10%) scaleX(.85); opacity: .35; } 50% { transform: translateX(10%) scaleX(1); opacity: .6; } }
.sd-tank__tower { display: none; }
.sd-tank__ground { width: 240px; height: 10px; margin-top: 2px; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(0,0,0,.22), rgba(0,0,0,0) 70%); }
.sd-tank__type { font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }

.sd-tank--elevated .sd-tank__vessel { width: 120px; height: 140px; margin-bottom: 15px; }
.sd-tank--elevated .sd-tank__tower { display: block; position: relative; width: 120px; height: 110px; margin-top: 2px; }
.sd-tank__tower i { position: absolute; top: 0; bottom: 0; width: 5px; border-radius: 2px; background: linear-gradient(90deg, #868e96, #ced4da, #868e96); }
.sd-tank__tower i:nth-child(1) { left: 8px; transform: rotate(6deg); transform-origin: top; }
.sd-tank__tower i:nth-child(2) { left: 38px; }
.sd-tank__tower i:nth-child(3) { right: 38px; }
.sd-tank__tower i:nth-child(4) { right: 8px; transform: rotate(-6deg); transform-origin: top; }
.sd-tank__tower span { position: absolute; left: 12px; right: 12px; top: 30%; height: 40%;
    background: linear-gradient(to top right, transparent calc(50% - 1.5px), #adb5bd calc(50% - 1.5px), #adb5bd calc(50% + 1.5px), transparent calc(50% + 1.5px)),
                linear-gradient(to top left, transparent calc(50% - 1.5px), #adb5bd calc(50% - 1.5px), #adb5bd calc(50% + 1.5px), transparent calc(50% + 1.5px));
    border-top: 3px solid #adb5bd; border-bottom: 3px solid #adb5bd; }
.sd-tank--elevated .sd-tank__ground { width: 180px; }
:root[data-theme="dark"] .sd-tank__vessel, :root[data-theme="night"] .sd-tank__vessel { background: linear-gradient(90deg, rgba(73,80,87,.55), rgba(134,142,150,.4) 45%, rgba(73,80,87,.6)); }
:root[data-theme="dark"] .sd-tank__ground, :root[data-theme="night"] .sd-tank__ground { background: radial-gradient(ellipse at center, rgba(0,0,0,.55), rgba(0,0,0,0) 70%); }

/* Signal (column signal, %): coloured bars by band, unlit bars white; bars grow in when the level changes. */
.sd-signal { display: inline-flex; align-items: center; gap: 6px; }
.sd-signal__bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 20px; }
.sd-signal__bars i { width: 5px; border-radius: 1px; background: #fff; border: 1px solid #ced4da; transform-origin: bottom; }
.sd-signal__bars i:nth-child(1) { height: 25%; } .sd-signal__bars i:nth-child(2) { height: 43%; } .sd-signal__bars i:nth-child(3) { height: 62%; }
.sd-signal__bars i:nth-child(4) { height: 81%; } .sd-signal__bars i:nth-child(5) { height: 100%; }
.sd-signal--b1 i.is-on { background: #e03131; border-color: #c92a2a; }
.sd-signal--b2 i.is-on { background: #f59f00; border-color: #e67700; }
.sd-signal--b3 i.is-on { background: #fcc419; border-color: #f0b400; }
.sd-signal--b4 i.is-on { background: #94d82d; border-color: #74b816; }
.sd-signal--b5 i.is-on { background: #2b9a3e; border-color: #237a32; }
.sd-signal__text { font-size: 11.5px; font-family: var(--font-mono); color: var(--text-muted); }
.sd-signal.is-anim i.is-on { animation: sd-bar-in .45s cubic-bezier(.34, 1.4, .64, 1) both; }
.sd-signal.is-anim i:nth-child(2) { animation-delay: .08s; } .sd-signal.is-anim i:nth-child(3) { animation-delay: .16s; }
.sd-signal.is-anim i:nth-child(4) { animation-delay: .24s; } .sd-signal.is-anim i:nth-child(5) { animation-delay: .32s; }
@keyframes sd-bar-in { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* Battery (External_Voltage), horizontal: very low 1 red (blinks), low 2 orange, normal 3 yellow, overcharge 4 green.
   Cells fill in from the left when the level changes. */
.sd-batt { display: inline-flex; align-items: center; gap: 8px; }
.sd-batt__icon { position: relative; display: inline-flex; gap: 2px; width: 36px; height: 18px; padding: 2px; box-sizing: border-box;
    border: 2px solid #495057; border-radius: 4px; background: #fff; margin-right: 4px; }
.sd-batt__icon::after { content: ""; position: absolute; right: -5px; top: 50%; width: 3px; height: 7px; margin-top: -3.5px; border-radius: 0 2px 2px 0; background: #495057; }
.sd-batt__icon i { flex: 1; border-radius: 1.5px; background: #e9ecef; transform-origin: left; }
.sd-batt--verylow i.is-on { background: #e03131; }
.sd-batt--low i.is-on { background: #f59f00; }
.sd-batt--normal i.is-on { background: #e0c200; }
.sd-batt--over .sd-batt__icon { border-color: #2f9e44; }
.sd-batt--over .sd-batt__icon::after { background: #2f9e44; }
.sd-batt--over i.is-on { background: #51cf66; }
.sd-batt--none .sd-batt__icon { border-color: var(--border-strong); }
:root[data-theme="dark"] .sd-batt__icon, :root[data-theme="night"] .sd-batt__icon { background: #212529; border-color: #ced4da; }
:root[data-theme="dark"] .sd-batt__icon::after, :root[data-theme="night"] .sd-batt__icon::after { background: #ced4da; }
:root[data-theme="dark"] .sd-batt__icon i:not(.is-on), :root[data-theme="night"] .sd-batt__icon i:not(.is-on) { background: #343a40; }
:root[data-theme="dark"] .sd-batt--over .sd-batt__icon, :root[data-theme="night"] .sd-batt--over .sd-batt__icon { border-color: #69db7c; }
.sd-batt--verylow .sd-batt__icon i.is-on { animation: sd-blink 1.2s ease-in-out infinite; }
.sd-batt.is-anim i.is-on { animation: sd-cell-in .35s ease-out both; }
.sd-batt.is-anim i:nth-child(2) { animation-delay: .1s; } .sd-batt.is-anim i:nth-child(3) { animation-delay: .2s; } .sd-batt.is-anim i:nth-child(4) { animation-delay: .3s; }
.sd-batt--verylow.is-anim .sd-batt__icon i.is-on { animation: sd-cell-in .35s ease-out both, sd-blink 1.2s ease-in-out .35s infinite; }
@keyframes sd-cell-in { from { transform: scaleX(0); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }
@keyframes sd-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

@media (prefers-reduced-motion: reduce) {
    .sd-tank__surface, .sd-tank__wave, .sd-signal.is-anim i.is-on, .sd-batt i.is-on, .sd-batt.is-anim i.is-on { animation: none !important; }
}
.sd-reading { text-align: center; font-size: 22px; font-weight: 700; font-family: var(--font-mono); display: flex; justify-content: center; align-items: center; gap: 10px; }
.sd-badge { font-size: 12px; font-family: var(--font-sans, inherit); padding: 2px 10px; border-radius: 999px; font-weight: 700; }
.sd-badge--nn { background: #e6f9ea; color: #1b7a32; }
.sd-badge--warn { background: #fff6db; color: #9a6700; }
.sd-badge--alarm { background: #ffe8e8; color: #c92a2a; }
.sd-badge--none { background: var(--surface-2); color: var(--text-muted); }

.sd-chart { width: 100%; height: 370px; }
.sd-ranges { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.sd-stats { align-self: stretch; width: 100%; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.sd-stats__title { padding: 8px 12px; text-align: center; font-weight: 700; color: var(--text); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.sd-stats__grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.sd-stats__grid div { display: grid; gap: 2px; padding: 8px; text-align: center; }
.sd-stats__grid span { font-size: 11.5px; color: var(--text-muted); }
.sd-stats__grid strong { font-family: var(--font-mono); }

.sum-name a { color: inherit; text-decoration: none; }
.sum-name a:hover { color: var(--primary); text-decoration: underline; }
@media (max-width: 1000px) { .sd-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .sd-tank__water, .sd-ruler__pin, .sd-ruler__label { transition: none; } }

/* Pages without a description show no empty subtitle line */
.page-subtitle:empty { display: none; }

/* Site Detail layout: header with picture, ruler beside the tank */
.sd-head__body { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; align-items: stretch; }
.sd-head__main { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; min-width: 0; }
.sd-head__main .sd-info { margin: 0; }
.sd-pic { position: relative; display: block; width: 100%; height: 160px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface-2); overflow: hidden; cursor: zoom-in; }
.sd-pic img { display: none; width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.sd-pic.has-img img { display: block; }
.sd-pic.has-img:hover img { transform: scale(1.04); }
.sd-pic__empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12.5px; color: var(--text-muted); }
.sd-pic.has-img .sd-pic__empty { display: none; }
.sd-pic:disabled { cursor: default; }
@media (max-width: 900px) { .sd-head__body { grid-template-columns: 1fr; } .sd-pic { height: 200px; } }

/* Centre the whole group: scale (~46px) on the left, ruler + labels (~115px) on the right. */
.sd-tank { padding: 6px 0 0; }
.sd-ruler { position: absolute; top: 0; bottom: 0; left: calc(100% + 18px); width: 12px; border-radius: 3px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.sd-ruler__seg { position: absolute; left: 0; right: 0; }
.sd-ruler__seg:first-child { border-radius: 0 0 3px 3px; }
.sd-ruler__label { position: absolute; left: calc(100% + 10px); transform: translateY(50%); display: grid; line-height: 1.15; white-space: nowrap; transition: bottom .3s ease; }
.sd-ruler__label strong { font-size: 11.5px; }
.sd-ruler__label span { font-size: 10.5px; font-family: var(--font-mono); color: var(--text-muted); }
.sd-ruler__label--nn strong { color: #1c7ed6; }
.sd-ruler__label--warn strong { color: #b08900; }
.sd-ruler__label--alarm strong { color: #e03131; }
.sd-ruler__pin { position: absolute; left: -9px; width: 0; height: 0; transform: translateY(50%); border-top: 6px solid transparent; border-bottom: 6px solid transparent;
    border-left: 8px solid var(--text); transition: bottom 1.1s cubic-bezier(.25, .8, .25, 1); }
.sd-ruler__pin::after { content: ""; position: absolute; left: -2px; top: -1px; width: 22px; border-top: 2px solid var(--text); }

/* Tank illustration (Scripts/tank-art.js) */
.sd-tank__art { width: 100%; max-width: 420px; }
.ta { display: block; width: 100%; height: auto; overflow: visible; }
.ta-level { transition: transform 1.2s cubic-bezier(.25, .8, .25, 1); }
.ta-surface { fill: #4dabf7; stroke: #339af0; stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: ta-bob 3.4s ease-in-out infinite; }
.ta-glint { fill: rgba(255, 255, 255, .45); transform-box: fill-box; transform-origin: center; animation: ta-glint 3.4s ease-in-out infinite; }
.ta-shell { stroke: none; }
.ta-corr { stroke: rgba(255, 255, 255, .55); stroke-width: 1.4; }
.ta-ta--ground .ta-corr { opacity: 1; }
.ta-panel { stroke: rgba(255, 255, 255, .14); stroke-width: 1; }
.ta-outline { fill: none; stroke: #868e96; stroke-width: 1.5; }
.ta-outline--navy { stroke: #1d3557; }
.ta-steel line, .ta-steel path { stroke: #868e96; stroke-width: 1.6; stroke-linecap: round; }
.ta-conc { fill: #d5d8dc; stroke: #b4b9be; stroke-width: .8; }
.ta-back { opacity: .55; }
.ta-stairs { fill: none; stroke: #868e96; stroke-width: 2; stroke-dasharray: 3 2; }
.ta-scale__axis { stroke: var(--border-strong); stroke-width: 1; }
.ta-scale__txt { fill: var(--text-muted); font-size: 10.5px; font-family: var(--font-mono); }
.ta-ruler__bg { fill: var(--surface-2); stroke: var(--border); }
.ta-ruler__type { font-size: 10.5px; font-weight: 700; }
.ta-ruler__type--nn { fill: #1c7ed6; } .ta-ruler__type--warn { fill: #b08900; } .ta-ruler__type--alarm { fill: #e03131; } .ta-ruler__type--none { fill: var(--text-muted); }
.ta-ruler__range { font-size: 9.5px; fill: var(--text-muted); font-family: var(--font-mono); }
.ta-pin path { fill: var(--text); } .ta-pin line { stroke: var(--text); stroke-width: 2; }
.ta-pin { transition: transform 1.2s cubic-bezier(.25, .8, .25, 1); }
/* HH: overflow */
.ta-stream { fill: none; stroke: #4dabf7; stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: 9 7; animation: ta-flow .55s linear infinite; }
.ta-stream--sheet { stroke: rgba(116, 192, 252, .45); stroke-width: 7; stroke-dasharray: none; animation: ta-sheet 1.1s ease-in-out infinite; }
.ta-puddle { fill: rgba(77, 171, 247, .55); transform-box: fill-box; transform-origin: center; animation: ta-puddle 1.3s ease-in-out infinite; }
.ta-drop { fill: #74c0fc; animation: ta-drop 0.9s ease-out infinite; }
.ta-drop--1 { animation-delay: .3s; } .ta-drop--2 { animation-delay: .6s; }
.ta-ovf-label { font-size: 11px; font-weight: 800; letter-spacing: .12em; fill: #e03131; animation: sd-blink 1s ease-in-out infinite; }
.is-overflow .ta-surface { animation-duration: 1.4s; }
@keyframes ta-bob { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.8); } }
@keyframes ta-glint { 0%, 100% { transform: translateX(-6px); opacity: .35; } 50% { transform: translateX(8px); opacity: .7; } }
@keyframes ta-flow { to { stroke-dashoffset: -16; } }
@keyframes ta-sheet { 0%, 100% { opacity: .5; } 50% { opacity: .9; } }
@keyframes ta-puddle { 0%, 100% { transform: scale(.85); opacity: .5; } 50% { transform: scale(1.15); opacity: .85; } }
@keyframes ta-drop { 0% { transform: translate(0, 0); opacity: 1; } 100% { transform: translate(6px, -10px); opacity: 0; } }
:root[data-theme="dark"] .ta-conc, :root[data-theme="night"] .ta-conc { fill: #9aa1a8; stroke: #6c757d; }
:root[data-theme="dark"] .ta-outline, :root[data-theme="night"] .ta-outline { stroke: #adb5bd; }
@media (prefers-reduced-motion: reduce) {
    .ta-level, .ta-pin { transition: none; }
    .ta-surface, .ta-glint, .ta-stream, .ta-stream--sheet, .ta-puddle, .ta-drop, .ta-ovf-label { animation: none; }
}

/* Ground tank: bolted galvanized panels on a concrete plinth */
.ta-seam { fill: none; stroke: rgba(70, 80, 90, .45); stroke-width: 1.1; }
.ta-seam--v { stroke: rgba(70, 80, 90, .35); }
.ta-rivet { fill: rgba(60, 68, 76, .65); }
.ta-stiffener { fill: none; stroke: #9aa3ab; stroke-width: 2.4; }
.ta-roof-band { fill: #2b2f33; }
.ta-roof-lip { fill: #c9cfd5; stroke: #8d969e; stroke-width: 1; }
.ta-roof-top { fill: #dfe3e7; }
.ta-plinth-top { fill: #dcdcd8; stroke: #b9b9b3; }
.ta-plinth-front { fill: #c4c4be; stroke: #a9a9a2; }
.ta-plinth-joint { stroke: #b0b0a9; stroke-width: .8; }
.ta-stones circle { fill: rgba(80, 74, 66, .45); }
.ta-post rect { fill: #1f2326; }
.ta-post .ta-post__rod { fill: #9aa3ab; }
:root[data-theme="dark"] .ta-plinth-top, :root[data-theme="night"] .ta-plinth-top { fill: #a9a9a3; stroke: #8a8a84; }
:root[data-theme="dark"] .ta-plinth-front, :root[data-theme="night"] .ta-plinth-front { fill: #8f8f89; }

/* Site Detail popups: same look as the dashboard lists (header + close, scrolling body) */
.sd-modal { padding: 0; flex-direction: column; overflow: hidden; max-height: calc(100vh - 32px);
    background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.sd-modal[open] { display: flex; animation: modal-in .16s ease-out; }
.sd-modal::backdrop { background: rgba(4, 8, 16, 0.6); backdrop-filter: blur(3px); }
.sd-modal--hist { width: min(900px, calc(100vw - 32px)); height: min(640px, calc(100vh - 32px)); }
.sd-modal--photo { width: min(1100px, calc(100vw - 32px)); }
.sd-modal__head { flex: none; }
.sd-modal__titles { min-width: 0; }
.sd-modal__titles .card__subtitle { margin: 2px 0 0; }
.sd-modal__bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.sd-modal__body { flex: 1; min-height: 0; overflow: auto; }
.sd-modal__body--photo { padding: 16px 24px 24px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); }
.sd-modal__body--photo img { display: block; max-width: 100%; max-height: calc(100vh - 140px); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.sd-hist__ranges { display: flex; gap: 6px; flex-wrap: wrap; }
.sd-hist__period { font-size: 12.5px; color: var(--text-muted); }
.sd-hist__table { width: 100%; margin: 0; border-collapse: collapse; font-size: 13px; }
.sd-hist__table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); padding: 10px 14px; text-align: left; font-weight: 700; border-bottom: 1px solid var(--border); }
.sd-hist__table thead th.num, .sd-hist__table td.num { text-align: right; }
.sd-hist__table td { padding: 9px 14px; border-bottom: 1px solid var(--border); }
.sd-hist__table td.report-empty { padding: 40px 20px; text-align: center; color: var(--text-muted); }
.sd-hist__sort { border: 0; background: transparent; padding: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; }
.sd-links .btn .icon { margin-right: 4px; }

/* Site Detail header (compact) */
.sd-head { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 16px; align-items: stretch; padding: 14px 16px; margin-bottom: 14px; }
.sd-head:has(.sd-pic[hidden]) { grid-template-columns: minmax(0, 1fr); }
.sd-head .sd-pic { width: 168px; height: 100%; min-height: 104px; max-height: 132px; align-self: center; }
.sd-head__main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sd-head__top { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin: 0; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.sd-head__title { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; min-width: 0; }
.sd-head__title h2 { margin: 0; font-size: 18px; line-height: 1.2; }
.sd-head__time { font-size: 12px; color: var(--text-muted); }
.sd-head__time strong { color: var(--text); font-weight: 600; }
.sd-head .sd-links { gap: 6px; }
.sd-head .sd-links .btn { min-height: 30px; padding: 4px 10px; }
.sd-head .sd-info { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px 18px; margin: 0; }
.sd-head .sd-info dt { font-size: 10.5px; }
.sd-head .sd-info dd { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-head .sd-info__item--wide { grid-column: span 2; }
@media (max-width: 700px) {
    .sd-head { grid-template-columns: 1fr; }
    .sd-head .sd-pic { width: 100%; max-height: 180px; height: 160px; }
}

/* Tank panel: the drawing takes the free height next to the (taller) trend panel */
.sd-grid > .sd-panel:first-child .sd-panel__body { justify-content: flex-start; }
.sd-grid > .sd-panel:first-child .sd-tank { flex: 1; justify-content: center; }
.sd-tank__art { max-width: 460px; }

/* Rules ruler labels: badge + range on one line, leader line to the band */
.ta-ruler__lead { fill: none; stroke: var(--border-strong); stroke-width: 1; }
.ta-ruler__badge--alarm { fill: #e03131; } .ta-ruler__badge--warn { fill: #f2c200; } .ta-ruler__badge--nn { fill: #1c7ed6; } .ta-ruler__badge--none { fill: #868e96; }
.ta .ta-ruler__type { font-size: 8.5px; font-weight: 800; fill: #fff; letter-spacing: .02em; }
.ta .ta-ruler__badge--warn + .ta-ruler__type { fill: #3d3000; }
.ta .ta-ruler__range { font-size: 9.5px; fill: var(--text-muted); font-family: var(--font-mono); }

/* Trending Details bar: title centred, Screenshot button on the right */
.sd-panel__bar--title { position: relative; }
.sd-shot { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); min-height: 28px; padding: 3px 10px; font-weight: 600; font-size: 12.5px; }
.sd-shot { width: 32px; padding: 0; justify-content: center; }
.sd-shot .icon { margin: 0; }
@media (max-width: 600px) { .sd-shot span { display: none; } }

/* Location popup */
.sd-modal--map { width: min(980px, calc(100vw - 32px)); height: min(680px, calc(100vh - 32px)); }
.sd-modal__body--map { padding: 0; background: var(--surface-2); }
.sd-modal__body--map iframe { display: block; width: 100%; height: 100%; border: 0; }
.sd-modal__foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 24px; border-top: 1px solid var(--border); }
.sd-map__coords { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); }

/* ---------------------------------------------------------------- Trending Selection popup */
.sd-tsel-open .icon { margin-right: 4px; }
.sd-modal--tsel { width: min(1240px, calc(100vw - 32px)); height: min(860px, calc(100vh - 32px)); }
.ts-filters { flex: none; display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.ts-filters .field { margin: 0; }
.ts-filters__equip { min-width: 240px; }
.ts-filters input[type="date"] { min-width: 150px; }
.ts-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.ts-quick .btn.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
.ts-apply { min-width: 90px; }
.ts-hint { flex-basis: 100%; margin: 0; }
.ts-tabs { flex: none; display: flex; align-items: center; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.ts-tab { position: relative; padding: 10px 14px; border: 0; background: transparent; color: var(--text-muted); font: inherit; font-weight: 600; cursor: pointer; }
.ts-tab:hover { color: var(--text); }
.ts-tab.is-active { color: var(--primary); }
.ts-tab.is-active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); }
.ts-tabs__info { margin-left: auto; font-size: 12.5px; color: var(--text-muted); }
.ts-export { margin-left: 10px; }
.ts-export .icon { margin-right: 4px; }
.ts-body { position: relative; padding: 16px 24px 20px; }
.ts-error { margin: 0 0 12px; }
.ts-pane { display: none; }
.ts-pane.is-active { display: block; }
.ts-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.ts-tile { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); text-align: center; }
.ts-tile span { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.ts-tile strong { font-family: var(--font-mono); font-size: 16px; }
.ts-chart { width: 100%; height: min(520px, calc(100vh - 360px)); min-height: 300px; }
.ts-table { width: 100%; margin: 0; border-collapse: collapse; font-size: 13px; }
.ts-table thead th { position: sticky; top: -16px; z-index: 1; background: var(--surface-2); padding: 10px 14px; text-align: left; font-weight: 700; border-bottom: 1px solid var(--border); }
.ts-table th.num, .ts-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ts-table td { padding: 8px 14px; border-bottom: 1px solid var(--border); }
.ts-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.ts-table tbody tr:hover td { background: var(--surface-hover); }
.ts-table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--border); }
.ts-table td.report-empty { padding: 40px 20px; text-align: center; color: var(--text-muted); }
.ts-table td.is-max { color: #e03131; font-weight: 700; } .ts-table td.is-min { color: #1c7ed6; font-weight: 700; }
.ts-col-ev { width: 110px; text-align: center !important; }
.ts-table td.ts-ev { text-align: center; }
.ts-logbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ts-logbar .input { max-width: 360px; }
.ts-pager { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.ts-sort { border: 0; background: transparent; padding: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; }
.ts-body.is-loading::after { content: "Loading…"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--text-muted); font-weight: 600; }
@media (max-width: 800px) { .ts-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ts-tabs__info { display: none; } }

/* Trending Selection: one date-range field (same picker as the reports) */
.ts-range { position: relative; min-width: 270px; }
.ts-range .date-range { z-index: 40; }
.date-range__day.is-disabled { opacity: .35; cursor: not-allowed; }

/* Trending Selection filter row: every control the same 40px height as the inputs, quick buttons equal width */
.ts-quick .btn, .ts-apply { height: 40px; min-height: 40px; padding-top: 0; padding-bottom: 0; display: inline-flex; align-items: center; justify-content: center; }
.ts-quick .btn { min-width: 96px; font-size: 13px; }
.ts-apply { min-width: 110px; }

/* Busy buttons (exports, screenshot): spinner while working, check mark when done, shake on failure.
   The label is hidden by colour (works for bare text and icons alike) and the spinner / check draw on top. */
.btn.is-busy, .btn.is-done, .btn.is-failed { position: relative; }
.btn.is-busy, .btn.is-done { color: transparent !important; cursor: progress; }
.btn.is-busy .icon, .btn.is-done .icon { opacity: 0; }
.btn.is-busy::after { content: ""; position: absolute; top: 50%; left: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
    border: 2px solid var(--btn-spin, var(--text)); border-right-color: transparent; animation: btn-spin .7s linear infinite; }
.btn--primary { --btn-spin: #fff; }
.btn.is-done { border-color: #2f9e44 !important; }
.btn.is-done::after { content: "\2713"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    color: #2f9e44; font-weight: 800; font-size: 15px; animation: btn-pop .3s ease-out; }
.btn--primary.is-done::after { color: #fff; }
.btn.is-failed { animation: btn-shake .4s ease; border-color: #e03131 !important; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
@keyframes btn-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes btn-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .btn.is-busy::after { animation-duration: 1.6s; } .btn.is-done::after, .btn.is-failed { animation: none; } }

/* Trending Selection filter row: keep everything on one line (wrap only on narrow screens) */
.ts-filters { flex-wrap: nowrap; gap: 10px; }
.ts-filters__equip { flex: 1 1 220px; min-width: 180px; }
.ts-range { flex: 0 1 280px; min-width: 250px; }
.ts-quick { flex: none; flex-wrap: nowrap; gap: 6px; }
.ts-quick .btn { min-width: 0; padding-left: 12px; padding-right: 12px; white-space: nowrap; font-weight: 600; border: 1px solid var(--border-strong); }
.ts-quick .btn.is-on { border-color: var(--primary); }
.ts-apply { flex: none; min-width: 96px; }
@media (max-width: 1180px) { .ts-filters { flex-wrap: wrap; } .ts-quick { flex-wrap: wrap; } }

/* Screenshot button keeps its place at the right of the bar in every state (busy / done / failed) */
.sd-shot, .sd-shot.is-busy, .sd-shot.is-done, .sd-shot.is-failed { position: absolute; right: 10px; top: 50%; margin-top: -15px; transform: none; height: 30px; min-height: 30px; }

/* ---------------------------------------------------------------- Dashboard: view switch + Tank View */
.dash-view { margin-right: 6px; }
.dash-view .segmented__btn { display: inline-flex; align-items: center; gap: 6px; }
.dash-view .segmented__btn .icon { width: 15px; height: 15px; }
.tv-bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 14px; }
.tv-bar .field { margin: 0; min-width: 150px; }
.tv-bar__search { flex: 1 1 220px; max-width: 320px; }
.tv-bar__count { margin-left: auto; align-self: center; }
.tv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 14px; }
.tv-empty { grid-column: 1 / -1; padding: 40px 0; text-align: center; color: var(--text-muted); }
.tv-card { display: flex; flex-direction: column; min-width: 0; color: var(--text); text-decoration: none; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.tv-card:hover, .tv-card:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary); outline: none; }
.tv-card__head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.tv-card__dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #e03131; }
.tv-card--online .tv-card__dot { background: #2fbf4a; box-shadow: 0 0 0 3px rgba(47, 191, 74, .18); }
.tv-card--delayed .tv-card__dot { background: #f08c00; }
.tv-card--maintenance .tv-card__dot { background: #1c7ed6; }
.tv-card__name { flex: 1; min-width: 0; font-weight: 700; font-size: 13.5px; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; }
.tv-card__sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px 0; font-size: 11px; font-weight: 700;
    letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.tv-card__id { font-family: var(--font-mono); font-weight: 600; letter-spacing: 0; }
.tv-card__art { padding: 4px 10px 0; }
.tv-card__art .ta { max-height: 210px; margin: 0 auto; }
.tv-card__reading { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 4px 12px 10px; }
.tv-card__value { font-family: var(--font-mono); font-weight: 700; font-size: 17px; }
.tv-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding: 8px 12px;
    background: var(--surface-2); border-top: 1px solid var(--border); font-size: 12px; }
.tv-card__time { font-family: var(--font-mono); color: var(--text-muted); }
.tv-card .sd-batt__icon { transform: scale(.85); transform-origin: right center; }
.tv-card.is-overflow { border-color: #e03131; }
@media (max-width: 640px) { .tv-bar .field { min-width: 0; flex: 1 1 140px; } .dash-view .segmented__btn .icon { display: none; } }

/* Dashboard tank cards: readable ruler badges and scale numbers at card size */
.ta .ta-ruler__type--lg { font-size: 11.5px; }
.tv-card .ta-scale__txt { font-size: 15px; }
.ta .ta-ruler__range--lg { font-size: 12.5px; }

/* Tank label drawn inside the tank SVG (centred under the tank) */
.ta-label { font-size: 12.5px; letter-spacing: .06em; fill: var(--text-muted); font-family: var(--font-sans, inherit); }
.sd-tank__type:empty { display: none; }
.tv-card__when { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.tv-card__when .sd-badge { font-size: 11px; padding: 1px 8px; }

/* Sidebar brand: water waves moving inside the "YTL" letters.
   Two layers clipped to the text: a rolling wave (data-URI SVG, allowed by img-src data:) over the normal text colour,
   so the top of the letters stays readable while the water flows and rises/falls through them. */
.brand-text { font-weight: 800; letter-spacing: 0.04em; }
.brand-wave {
    display: inline-block; font-size: 24px; line-height: 1.05; font-weight: 900; letter-spacing: 0.06em;
    color: transparent;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='40' viewBox='0 0 60 40'%3E%3Cpath d='M0 14 Q7.5 9 15 14 T30 14 T45 14 T60 14 V40 H0Z' fill='%2374c0fc'/%3E%3Cpath d='M0 18 Q7.5 14 15 18 T30 18 T45 18 T60 18 V40 H0Z' fill='%231c7ed6'/%3E%3C/svg%3E"),
        linear-gradient(var(--sidebar-text-strong), var(--sidebar-text-strong));
    background-size: 60px 40px, 100% 100%;
    background-repeat: repeat-x, no-repeat;
    background-position: 0 0, 0 0;
    -webkit-background-clip: text; background-clip: text;
    animation: brand-wave 2.4s linear infinite, brand-tide 5s ease-in-out infinite;
}
.brand-text small { font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; opacity: .8; margin-top: 2px; color: var(--sidebar-text-strong); }
@keyframes brand-wave { from { background-position-x: 0, 0; } to { background-position-x: -60px, 0; } }
@keyframes brand-tide { 0%, 100% { background-position-y: 3px, 0; } 50% { background-position-y: -6px, 0; } }
@media (prefers-reduced-motion: reduce) { .brand-wave { animation: none; background-position: 0 -2px, 0 0; } }

/* Site Info: choose the trend source (signal / battery / tank) */
.sd-metric { display: inline-flex; align-items: center; padding: 4px 8px; border: 1px solid transparent; border-radius: var(--radius-sm);
    background: transparent; color: inherit; font: inherit; cursor: pointer; transition: background .15s, border-color .15s; }
.sd-metric:hover { background: var(--surface-hover); border-color: var(--border); }
.sd-metric.is-active { background: color-mix(in srgb, var(--primary) 14%, transparent); border-color: var(--primary); }
.sd-metric:focus-visible, .sd-metric-tank:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sd-metric-tank { cursor: pointer; border-radius: var(--radius); border: 1px solid transparent; transition: background .15s, border-color .15s; }
.sd-metric-tank:hover { background: var(--surface-hover); }
.sd-metric-tank.is-active { border-color: color-mix(in srgb, var(--primary) 45%, transparent); }

/* =====================================================================
   Sign-in "Ocean": animated water scene + centred glass card (Auth.master)
   Decorative only; every animation is CSS (CSP-safe) and stops for prefers-reduced-motion.
   ===================================================================== */
.ocean-body { position: relative; min-height: 100vh; overflow-x: hidden; background: #04121f; color: var(--text); }
.ocean { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
    background: radial-gradient(120% 90% at 50% 0%, #0f3a5f 0%, #0a2742 38%, #061827 70%, #030d17 100%); }
.ocean__glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; }
.ocean__glow--a { width: 520px; height: 520px; left: -120px; top: -140px; background: #1c7ed6; animation: ocean-drift 16s ease-in-out infinite; }
.ocean__glow--b { width: 460px; height: 460px; right: -120px; top: 18%; background: #0ca678; opacity: .32; animation: ocean-drift 20s ease-in-out infinite reverse; }
.ocean__grid { position: absolute; inset: 0; opacity: .14;
    background-image: linear-gradient(rgba(165, 216, 255, .35) 1px, transparent 1px), linear-gradient(90deg, rgba(165, 216, 255, .35) 1px, transparent 1px);
    background-size: 46px 46px; -webkit-mask-image: radial-gradient(ellipse at 50% 35%, #000 20%, transparent 75%); mask-image: radial-gradient(ellipse at 50% 35%, #000 20%, transparent 75%); }
.ocean__waves { position: absolute; left: 0; bottom: 0; width: 200%; height: 38vh; min-height: 220px; }
.ocean__wave { animation: ocean-roll 18s linear infinite; }
.ocean__wave--back { fill: #1864ab; opacity: .35; animation-duration: 26s; }
.ocean__wave--mid { fill: #1c7ed6; opacity: .45; animation-duration: 19s; animation-direction: reverse; }
.ocean__wave--front { fill: #339af0; opacity: .55; animation-duration: 13s; }
.ocean__bubbles i { position: absolute; bottom: -20px; width: 10px; height: 10px; border-radius: 50%;
    border: 1px solid rgba(165, 216, 255, .55); background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .55), rgba(165, 216, 255, .08) 60%);
    animation: ocean-bubble 14s linear infinite; }
.ocean__bubbles i:nth-child(1) { left: 6%; animation-duration: 15s; }
.ocean__bubbles i:nth-child(2) { left: 14%; width: 6px; height: 6px; animation-duration: 11s; animation-delay: -4s; }
.ocean__bubbles i:nth-child(3) { left: 23%; width: 14px; height: 14px; animation-duration: 18s; animation-delay: -9s; }
.ocean__bubbles i:nth-child(4) { left: 31%; animation-duration: 13s; animation-delay: -2s; }
.ocean__bubbles i:nth-child(5) { left: 42%; width: 7px; height: 7px; animation-duration: 16s; animation-delay: -11s; }
.ocean__bubbles i:nth-child(6) { left: 53%; width: 12px; height: 12px; animation-duration: 20s; animation-delay: -6s; }
.ocean__bubbles i:nth-child(7) { left: 61%; width: 5px; height: 5px; animation-duration: 10s; animation-delay: -3s; }
.ocean__bubbles i:nth-child(8) { left: 70%; animation-duration: 17s; animation-delay: -13s; }
.ocean__bubbles i:nth-child(9) { left: 78%; width: 15px; height: 15px; animation-duration: 22s; animation-delay: -8s; }
.ocean__bubbles i:nth-child(10) { left: 86%; width: 7px; height: 7px; animation-duration: 12s; animation-delay: -1s; }
.ocean__bubbles i:nth-child(11) { left: 92%; animation-duration: 15s; animation-delay: -10s; }
.ocean__bubbles i:nth-child(12) { left: 48%; width: 5px; height: 5px; animation-duration: 9s; animation-delay: -5s; }
@keyframes ocean-roll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes ocean-bubble { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: 1; } 50% { transform: translate(14px, -50vh); } 90% { opacity: .8; } 100% { transform: translate(-8px, -105vh); opacity: 0; } }
@keyframes ocean-drift { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(60px, 40px) scale(1.12); } }

.ocean-shell { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 22px; padding: 32px 16px 120px; }
.ocean-card { width: 100%; max-width: 430px; padding: 34px 34px 30px; border-radius: 22px;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    border: 1px solid color-mix(in srgb, #a5d8ff 30%, transparent);
    box-shadow: 0 30px 80px rgba(2, 10, 20, .55), inset 0 1px 0 rgba(255, 255, 255, .12);
    -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
    animation: ocean-card-in .6s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes ocean-card-in { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.ocean-card__brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 22px; }
.ocean-card__logo { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 14px;
    background: #fff; border: 1px solid rgba(28, 126, 214, .25); box-shadow: 0 8px 22px rgba(28, 126, 214, .35); }
.ocean-card__logo img { width: 36px; height: 36px; object-fit: contain; }
.ocean-card__brand-text { --sidebar-text-strong: var(--text); }
.ocean-card__brand-text .brand-wave { font-size: 30px; }
.ocean-card__brand-text small { color: var(--text-muted); letter-spacing: .14em; }
.ocean-card__form { max-width: none; }
.ocean-card .login__eyebrow { display: table; margin: 0 auto 10px; }
.ocean-card .auth-title { text-align: center; font-size: 23px; }
.ocean-card .login__intro { text-align: center; margin-bottom: 24px; }
.ocean-card .input--lg { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.ocean-card .btn--primary.btn--lg { position: relative; overflow: hidden; height: 48px; margin-top: 10px; border: 0; font-weight: 700; letter-spacing: .02em;
    background: linear-gradient(135deg, #1c7ed6 0%, #1971c2 45%, #0c8599 100%); box-shadow: 0 10px 26px rgba(28, 126, 214, .4); }
.ocean-card .btn--primary.btn--lg:hover { filter: brightness(1.08); box-shadow: 0 12px 30px rgba(28, 126, 214, .55); }
.ocean-card .login__help { margin-top: 18px; }

.ocean-foot { display: flex; flex-direction: column; align-items: center; gap: 12px; color: #a5c8e4; }
.ocean-foot__note { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12.5px; }
.ocean-foot__chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ocean-foot__chips li { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
    color: #d0ebff; background: rgba(12, 40, 66, .55); border: 1px solid rgba(165, 216, 255, .22);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.ocean-foot__chips .icon { color: #74c0fc; }
@media (max-width: 520px) { .ocean-card { padding: 26px 20px 22px; border-radius: 18px; } .ocean-foot__chips { display: none; } }
@media (prefers-reduced-motion: reduce) { .ocean__wave, .ocean__bubbles i, .ocean__glow, .ocean-card { animation: none !important; } }

/* =====================================================================
   Sign-in "Telemetry sphere" (Auth.master + Scripts/login-sphere.js)
   Black page, Fibonacci sphere of capability tiles around a centred headline, glass sign-in panel.
   ===================================================================== */
.orbit-body { --o-ink: #f4f2ef; --o-dim: #8c8783; --o-pad: clamp(14px, 2.6vw, 34px); --o-ease: cubic-bezier(.22, .61, .36, 1);
    --o-serif: "Playfair Display", Georgia, "Times New Roman", serif; --o-panel: 460px; --hw: min(40vw, 560px);
    position: relative; min-height: 100vh; min-height: 100dvh; overflow: hidden; background: #000; color: var(--o-ink); }

/* splash */
.orbit-splash { position: fixed; inset: 0; z-index: 250; display: grid; place-items: center; align-content: center; gap: 26px; background: #000; transition: opacity .6s ease; }
.orbit-splash.out { opacity: 0; pointer-events: none; }
.orbit-splash__mark { font-family: var(--o-serif); font-size: clamp(28px, 4.4vw, 52px); letter-spacing: .005em; color: var(--o-ink); opacity: 0; animation: orbit-rise 1.25s ease .15s forwards; }
.orbit-splash__mark em { font-style: normal; color: #74c0fc; margin-left: .25em; }
.orbit-splash__bar { display: block; width: clamp(120px, 17vw, 210px); height: 1px; background: rgba(244, 242, 239, .16); overflow: hidden; }
.orbit-splash__bar s { display: block; height: 100%; background: var(--o-ink); transform: scaleX(0); transform-origin: left; transition: transform .25s ease; }
.orbit-splash__tag { font-size: 10px; letter-spacing: .26em; text-transform: uppercase; color: rgba(244, 242, 239, .38); opacity: 0; animation: orbit-rise .9s ease .5s forwards; }
@keyframes orbit-rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

/* 3D stage: the circle and its centre are the same point */
.orbit-stage { position: fixed; inset: 0; z-index: 10; perspective: var(--persp, 1150px); perspective-origin: 50% 50%; overflow: hidden; touch-action: none; cursor: grab; }
.orbit-stage:active { cursor: grabbing; }
@media (pointer: coarse) { .orbit-stage { touch-action: pan-y; } }
#world { position: absolute; top: 50%; left: 50%; width: 0; height: 0; transform-style: preserve-3d; will-change: transform; }
#orb { position: absolute; top: 0; left: 0; width: 0; height: 0; transform-style: preserve-3d; opacity: 1; transform: none; }
/* headline: centred on the sphere origin (centre of the stage), in front of every tile */
.orbit-title { position: absolute; top: 50%; left: 50%; z-index: 2; width: var(--hw); margin: 0; transform: translate(-50%, -50%); text-align: center;
    font-family: var(--o-serif); font-weight: 400; font-size: clamp(26px, 3.2vw, 50px); line-height: 1.06; letter-spacing: -.005em; color: #fff;
    text-shadow: 0 2px 34px rgba(0, 0, 0, .85), 0 0 2px rgba(0, 0, 0, .6); pointer-events: none; user-select: none; -webkit-user-select: none; }
#headline .w { display: inline-block; opacity: 0; transform: translateY(.42em); filter: blur(7px); }
.revealed #headline .w { opacity: 1; transform: none; filter: blur(0); transition: opacity 1.05s var(--o-ease), transform 1.15s var(--o-ease), filter 1.05s var(--o-ease); }
.revealed #headline .w:nth-child(1) { transition-delay: .55s; }
.revealed #headline .w:nth-child(2) { transition-delay: .635s; }
.revealed #headline .w:nth-child(3) { transition-delay: .72s; }
.revealed #headline .w:nth-child(4) { transition-delay: .805s; }

/* sphere tiles (reset the app's .card inside the sphere) */
#orb .card { position: absolute; top: 0; left: 0; padding: 0; margin: 0; border: 0; border-radius: 6px; background: none; box-shadow: none; overflow: visible; cursor: pointer; }
.orbit-tile { position: relative; width: 100%; height: 100%; margin: 0; overflow: hidden; border-radius: 6px; display: flex; flex-direction: column; justify-content: space-between;
    padding: calc(var(--cw, 140px) * .07); background: #0a0a0a; transition: transform .5s ease; box-sizing: border-box; }
#orb .card:hover .orbit-tile { transform: scale(1.045); }
.orbit-tile::after { content: ""; position: absolute; inset: 0; border-radius: 6px; pointer-events: none; background: rgba(0, 0, 0, var(--d, 0)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .09); }
.orbit-tile--h0 { background: linear-gradient(150deg, #1c4f86 0%, #0b2440 60%, #050d18 100%); }
.orbit-tile--h1 { background: linear-gradient(150deg, #0f6b6b 0%, #083c40 60%, #031617 100%); }
.orbit-tile--h2 { background: linear-gradient(150deg, #3b3f8f 0%, #1a1c4d 60%, #08091c 100%); }
.orbit-tile--h3 { background: linear-gradient(150deg, #8a5a12 0%, #47300a 60%, #1a1104 100%); }
.orbit-tile--h4 { background: linear-gradient(150deg, #8c2532 0%, #47121a 60%, #1a0609 100%); }
.orbit-tile--h5 { background: linear-gradient(150deg, #23733d 0%, #103d20 60%, #04160b 100%); }
.orbit-tile__art { display: flex; align-items: center; justify-content: center; flex: 1; min-height: 0; }
.orbit-tile__icon { width: 30%; height: auto; aspect-ratio: 1; stroke: rgba(244, 242, 239, .9); stroke-width: 1.5; fill: none; }
.orbit-tile__cap { display: grid; gap: 2px; text-align: left; min-width: 0; }
.orbit-tile__cap b { font-family: var(--o-serif); font-weight: 400; font-size: calc(var(--cw, 140px) * .088); line-height: 1.1; color: var(--o-ink); }
.orbit-tile__cap span { font-size: calc(var(--cw, 140px) * .05); letter-spacing: .12em; text-transform: uppercase; color: rgba(244, 242, 239, .55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.orbit-vig { position: fixed; inset: 0; z-index: 12; pointer-events: none; transition: opacity .6s ease;
    background: radial-gradient(ellipse 88% 92% at 50% 50%, transparent 48%, rgba(0, 0, 0, .26) 80%, rgba(0, 0, 0, .72) 100%); }
.lit .orbit-vig { opacity: 0; }

/* chrome */
.orbit-chrome { opacity: 0; transition: opacity 1.2s ease .15s, transform .5s ease; }
.revealed .orbit-chrome { opacity: 1; }
.lit .orbit-bio, .lit .orbit-cue { opacity: 0; pointer-events: none; }
.orbit-head { position: fixed; top: calc(var(--o-pad) * .8); left: var(--o-pad); z-index: 60; pointer-events: none; }
.orbit-head__brand { --sidebar-text-strong: #f4f2ef; }
.orbit-head__brand small { color: rgba(244, 242, 239, .72); }
.orbit-bio { position: fixed; left: var(--o-pad); bottom: var(--o-pad); z-index: 55; max-width: min(320px, 30vw); }
.orbit-bio__who { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.orbit-bio__logo { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; background: none; }
.orbit-bio__logo img { width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .5)); }
.orbit-bio b { font-family: var(--o-serif); font-weight: 400; font-size: 18px; letter-spacing: .01em; }
.orbit-bio p { margin: 0; font-size: 12.5px; line-height: 1.62; color: rgba(244, 242, 239, .72); }
.orbit-cue { position: fixed; left: 50%; bottom: calc(var(--o-pad) + 4px); z-index: 54; display: flex; align-items: center; gap: 10px; margin: 0;
    transform: translateX(-50%); font-size: 10px; letter-spacing: .24em; text-transform: uppercase; color: rgba(244, 242, 239, .42); white-space: nowrap; pointer-events: none; }
.orbit-cue s { position: relative; display: block; width: 44px; height: 1px; background: rgba(244, 242, 239, .28); overflow: hidden; }
.orbit-cue s::after { content: ""; position: absolute; inset: 0; background: #f4f2ef; transform: translateX(-100%); animation: orbit-sweep 2.6s ease infinite; }
@keyframes orbit-sweep { 55% { transform: translateX(0); } 100% { transform: translateX(100%); } }

/* sign-in panel: its own dark tokens so it looks the same in every theme */
.orbit-panel { --surface: #0f151c; --surface-2: #151d26; --surface-hover: #1b2530; --text: #f4f2ef; --text-muted: #9aa4ad; --border: rgba(244, 242, 239, .14);
    --border-strong: rgba(244, 242, 239, .24); --primary: #4dabf7; --primary-soft: rgba(77, 171, 247, .14); --primary-contrast: #04121f;
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 70; width: var(--o-panel); display: flex; align-items: center; justify-content: center;
    padding: 32px 36px; overflow-y: auto; color: var(--text); box-sizing: border-box;
    background: linear-gradient(180deg, rgba(10, 14, 20, .86), rgba(6, 9, 13, .92)); border-left: 1px solid rgba(244, 242, 239, .1);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    opacity: 0; transform: translateX(24px); transition: opacity .9s var(--o-ease) .2s, transform .9s var(--o-ease) .2s; }
.revealed .orbit-panel { opacity: 1; transform: none; }
.orbit-panel__card { width: 100%; max-width: 380px; }
.orbit-panel__form { max-width: none; }
.orbit-panel .login__eyebrow { color: #74c0fc; background: rgba(77, 171, 247, .14); }
.orbit-panel .auth-title { font-family: var(--o-serif); font-weight: 400; font-size: 30px; letter-spacing: -.01em; }
.orbit-panel .input--lg { background: rgba(255, 255, 255, .04); color: var(--text); }
.orbit-panel .btn--primary.btn--lg { height: 48px; border: 0; font-weight: 700; letter-spacing: .02em; color: #04121f; background: linear-gradient(135deg, #74c0fc, #4dabf7 55%, #3bc9db); }
.orbit-panel .btn--primary.btn--lg:hover { filter: brightness(1.08); }
.orbit-panel__note { display: flex; align-items: center; gap: 8px; margin: 26px 0 0; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }

/* wide screens: the sphere fills the space left of the panel */
@media (min-width: 1100px) {
    .orbit-stage, .orbit-vig { right: var(--o-panel); }
    .orbit-cue { left: calc((100% - var(--o-panel)) / 2); }
}
/* smaller screens: sign-in card centred over a dimmed sphere */
@media (max-width: 1099px) {
    .orbit-panel { left: 0; width: auto; background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; padding: 80px 16px 24px; pointer-events: none; transform: translateY(16px); }
    .orbit-panel__card { pointer-events: auto; max-width: 420px; padding: 28px 26px 22px; border-radius: 18px; border: 1px solid rgba(244, 242, 239, .14);
        background: rgba(8, 12, 18, .82); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
    #headline, .orbit-cue, .orbit-bio { display: none; }
    .orbit-stage { opacity: .65; }
}
@media (max-width: 640px) { .orbit-panel .auth-title { font-size: 25px; } .orbit-head { top: 14px; left: 16px; } }

/* capability details */
.orbit-lit { width: min(72vw, 760px); max-width: calc(100vw - 32px); padding: 0; border: 0; background: transparent; color: #f4f2ef; overflow: visible; }
.orbit-lit::backdrop { background: rgba(0, 0, 0, .35); }
.orbit-lit[open] .orbit-lit__plate { animation: orbit-plate .5s cubic-bezier(.22, .61, .36, 1); }
@keyframes orbit-plate { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
.orbit-lit__plate { position: relative; }
.orbit-lit__shot { width: 100%; aspect-ratio: 3 / 2; border-radius: 4px; overflow: hidden; box-shadow: 0 30px 90px rgba(0, 0, 0, .75); --cw: min(72vw, 760px); }
.orbit-lit__shot .orbit-tile { padding: 32px; }
.orbit-lit__shot .orbit-tile__cap b { font-size: clamp(22px, 3vw, 34px); }
.orbit-lit__shot .orbit-tile__cap span { font-size: 12px; }
.orbit-lit__close { position: absolute; top: 12px; right: 14px; min-width: 44px; min-height: 44px; padding: 10px 14px; border-radius: 6px; cursor: pointer;
    font: inherit; font-size: 12.5px; color: #f4f2ef; background: rgba(0, 0, 0, .35); border: 1px solid rgba(244, 242, 239, .78); }
.orbit-lit__close:hover { border-color: #fff; background: rgba(0, 0, 0, .55); }
.orbit-lit__meta { display: grid; grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr); gap: clamp(22px, 3.2vw, 48px); padding-top: 16px; }
.orbit-lit__meta h3 { margin: 0 0 6px; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(22px, 2.15vw, 32px); line-height: 1.08; color: #f4f2ef; }
.orbit-lit__where { margin: 0; font-size: 13px; color: rgba(244, 242, 239, .62); }
.orbit-lit__note { margin: 0; font-size: 13.5px; line-height: 1.55; color: rgba(244, 242, 239, .92); }
@media (max-width: 640px) { .orbit-lit__meta { grid-template-columns: 1fr; gap: 10px; } }
@media (prefers-reduced-motion: reduce) {
    .orbit-body *, .orbit-body *::before, .orbit-body *::after { animation-duration: .01ms !important; transition-duration: .14s !important; }
}

/* ---------------------------------------------------------------- Voltage & Network report */
.vn-filters { padding: 16px; margin-bottom: 16px; }
.vn-filters__row { display: grid; grid-template-columns: minmax(260px, 1.3fr) repeat(3, minmax(0, 1fr)); gap: 12px 16px; align-items: end; }
.vn-filters__row .field { margin: 0; }
.vn-filters__actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.vn-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.vn-quick .btn.is-on { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.vn-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.vn-grid { overflow: hidden; }
.vn-grid__head { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 14px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
    font-size: 13px; color: #fff; background: #1f2937; }
.vn-grid__table { width: 100%; margin: 0; }
.vn-grid__table thead th { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); background: var(--surface-2); text-align: center; }
.vn-grid__table thead th:first-child, .vn-grid__table tbody th { text-align: center; width: 90px; }
.vn-grid__table tbody th { font-weight: 600; font-size: 12.5px; }
.vn-grid__table td.num { text-align: center; }
.vn-grid__total th, .vn-grid__total td { background: var(--surface-2); font-weight: 700; }
.vn-sigicon { display: inline-flex; align-items: flex-end; gap: 1.5px; height: 13px; }
.vn-sigicon i { width: 3px; background: #fff; border-radius: 1px; }
.vn-sigicon i:nth-child(1) { height: 30%; } .vn-sigicon i:nth-child(2) { height: 55%; } .vn-sigicon i:nth-child(3) { height: 80%; } .vn-sigicon i:nth-child(4) { height: 100%; }
.vn-count { min-width: 46px; padding: 2px 10px; border-radius: 999px; border: 1px solid transparent; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
    font-variant-numeric: tabular-nums; transition: transform .12s ease, box-shadow .12s ease; }
.vn-count:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.vn-count.is-zero { background: transparent; color: var(--text-muted); border: 1px dashed var(--border-strong); cursor: default; }
.vn-count.is-on { outline: 2px solid var(--primary); outline-offset: 2px; }
/* band colours (voltage + signal) */
.vn-b--critical-low { background: #c92a2a; color: #fff; }
.vn-b--low { background: #ffe066; color: #5c4400; }
.vn-b--normal { background: #2f9e44; color: #fff; }
.vn-b--overvoltage { background: #e03131; color: #fff; }
.vn-b--no-signal { background: #c92a2a; color: #fff; }
.vn-b--poor { background: #f59f00; color: #3d2600; }
.vn-b--fair { background: #ffe066; color: #5c4400; }
.vn-b--good { background: #2f9e44; color: #fff; }
.vn-b--none { background: var(--surface-2); color: var(--text-muted); }
.vn-count.is-zero.vn-b--critical-low, .vn-count.is-zero.vn-b--low, .vn-count.is-zero.vn-b--normal, .vn-count.is-zero.vn-b--overvoltage,
.vn-count.is-zero.vn-b--no-signal, .vn-count.is-zero.vn-b--poor, .vn-count.is-zero.vn-b--fair, .vn-count.is-zero.vn-b--good { background: transparent; color: var(--text-muted); }

.vn-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.vn-cols { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0; padding: 0; border: 0; font-size: 13px; }
.vn-cols legend { float: left; margin-right: 6px; font-weight: 700; padding: 0; }
.vn-cols label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.vn-search { margin-left: auto; width: 240px; }
.vn-filter-tag { cursor: pointer; background: var(--primary-soft); color: var(--primary); }
.vn-table { width: 100%; margin: 0; font-size: 12.5px; }
.vn-table thead th { position: sticky; top: 0; z-index: 1; background: #1f2937; color: #fff; white-space: nowrap; }
.vn-table th.vn-slot, .vn-table td.vn-slot { text-align: center; }
.vn-sort { display: inline-flex; align-items: center; gap: 2px; border: 0; background: transparent; padding: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; }
.vn-name { font-weight: 600; }
.vn-cell { display: inline-flex; gap: 4px; flex-wrap: nowrap; }
.vn-chip { display: inline-flex; align-items: baseline; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 11px; white-space: nowrap; }
.vn-chip b { font-family: var(--font-mono); font-size: 11.5px; }
.vn-chip span { font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; opacity: .9; }
.vn-none { color: var(--text-muted); }
.vn-pager { display: flex; align-items: center; gap: 8px; }
@media (max-width: 1100px) { .vn-filters__row { grid-template-columns: repeat(2, minmax(0, 1fr)); } .vn-summary { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .vn-filters__row { grid-template-columns: 1fr; } .vn-search { width: 100%; margin-left: 0; } }

/* no text highlighting while dragging the login sphere */
.orbit-stage, .orbit-stage * { -webkit-user-select: none; user-select: none; }

/* Live password checks */
.pw-check { display: grid; gap: 4px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--text-muted); }
.pw-check li { position: relative; padding-left: 22px; transition: color .15s; }
.pw-check li::before { content: ""; position: absolute; left: 2px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; border: 1.5px solid var(--border-strong); box-sizing: border-box; }
.pw-check li.is-ok { color: var(--status-online, #2f9e44); }
.pw-check li.is-ok::before { border: 0; background: var(--status-online, #2f9e44); }
.pw-check li.is-ok::after { content: ""; position: absolute; left: 6px; top: 50%; width: 3px; height: 6px; margin-top: -4.5px; border: solid #fff; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.pw-check li.is-bad { color: var(--status-offline, #e03131); }
.pw-check li.is-bad::before { border-color: var(--status-offline, #e03131); }
.pw-check .pw-check__meter { display: flex; align-items: center; gap: 8px; padding-left: 0; margin-top: 2px; }
.pw-check .pw-check__meter::before, .pw-check .pw-check__meter::after { display: none; }
.pw-meter { display: inline-grid; grid-template-columns: repeat(4, 1fr); gap: 3px; width: 120px; }
.pw-meter i { height: 4px; border-radius: 2px; background: var(--border); transition: background .2s; }
.pw-check[data-strength="1"] .pw-meter i:nth-child(-n+1) { background: #e03131; }
.pw-check[data-strength="2"] .pw-meter i:nth-child(-n+2) { background: #f59f00; }
.pw-check[data-strength="3"] .pw-meter i:nth-child(-n+3) { background: #74b816; }
.pw-check[data-strength="4"] .pw-meter i:nth-child(-n+4) { background: #2f9e44; }
.pw-meter__text { font-size: 11.5px; }
.pw-check.is-attention { animation: btn-shake .4s ease; }
.pw-match { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 12.5px; font-weight: 600; }
.pw-match.is-ok { color: var(--status-online, #2f9e44); }
.pw-match.is-bad { color: var(--status-offline, #e03131); }
.pw-match.is-ok::before { content: "\2713"; }
.pw-match.is-bad::before { content: "\2715"; }

/* Sign-in panel: alerts readable on the dark glass panel */
.orbit-panel .alert { border: 1px solid; border-left-width: 3px; background: rgba(255, 255, 255, .04); }
.orbit-panel .alert--info { color: #a5d8ff; background: rgba(77, 171, 247, .12); border-color: rgba(77, 171, 247, .45); }
.orbit-panel .alert--danger { color: #ffc9c9; background: rgba(250, 82, 82, .12); border-color: rgba(250, 82, 82, .5); }
.orbit-panel .alert--success { color: #b2f2bb; background: rgba(64, 192, 87, .12); border-color: rgba(64, 192, 87, .45); }
.orbit-panel .alert--warning { color: #ffe8a1; background: rgba(250, 176, 5, .12); border-color: rgba(250, 176, 5, .45); }

/* Sidebar logo links to the Dashboard */
.brand-link { display: inline-flex; align-items: center; color: inherit; text-decoration: none; border-radius: var(--radius-sm); -webkit-user-select: none; user-select: none; transition: opacity .15s; }
.brand-link:hover { opacity: .85; }
.brand-link:focus-visible { outline: 2px solid var(--sidebar-accent, #4dabf7); outline-offset: 4px; }
.brand-text, .brand-wave { -webkit-user-select: none; user-select: none; }

/* Tank stays clickable (back to the level trend) but shows no border / hover box */
.sd-metric-tank, .sd-metric-tank:hover, .sd-metric-tank.is-active { border-color: transparent; background: none; }
.sd-metric-tank:focus { outline: none; }
.sd-metric-tank:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.brand-link, .brand-link:hover, .brand-link:focus, .brand-link:visited, .brand-link *, .brand-link:hover * { text-decoration: none !important; }

/* Tank View cards: link without underlines; drawing centred in the card */
.tv-card, .tv-card:hover, .tv-card:focus, .tv-card *, .tv-card:hover * { text-decoration: none !important; }
.tv-card__art { display: flex; justify-content: center; }
.tv-card__art .ta { width: 100%; }

/* ---------------------------------------------------------------- Site Info report */
.si-filters { padding: 16px; margin-bottom: 16px; }
.si-filters__row { display: flex; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; }
.si-filters__row .field { margin: 0; min-width: 220px; }
.si-versions { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.si-ver { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 14px; border-radius: var(--radius); cursor: pointer; font: inherit;
    text-align: left; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--si-c, #868e96);
    box-shadow: var(--shadow-sm); transition: transform .12s ease, box-shadow .12s ease; }
.si-ver:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.si-ver.is-on { outline: 2px solid var(--primary); outline-offset: 1px; }
.si-ver.is-zero { opacity: .55; cursor: default; }
.si-ver__label { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.si-ver strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.si-ver--sms-unit { --si-c: #868e96; } .si-ver--m5 { --si-c: #f59f00; } .si-ver--m5n { --si-c: #e8590c; } .si-ver--m6 { --si-c: #7048e8; }
.si-ver--m7-none-4g { --si-c: #1c7ed6; } .si-ver--m7-4g { --si-c: #2f9e44; } .si-ver--s1 { --si-c: #0c8599; } .si-ver--other { --si-c: #495057; }
.si-ver--total { --si-c: var(--primary); background: var(--surface-2); }
.si-vtag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap;
    color: var(--text); background: color-mix(in srgb, var(--si-c, #868e96) 18%, transparent); border: 1px solid color-mix(in srgb, var(--si-c, #868e96) 45%, transparent); }
.si-band { display: inline-block; padding: 1px 7px; border-radius: 6px; font-family: var(--font-mono); font-size: 11.5px; white-space: nowrap; }
.si-band--alarm { background: rgba(224, 49, 49, .12); color: #e03131; }
.si-band--warn { background: rgba(240, 180, 0, .16); color: #b08900; }
.si-table td.mono { font-size: 12px; }
.si-table td a { color: inherit; text-decoration: none; }
.si-table td a:hover { color: var(--primary); text-decoration: underline; }

/* Acknowledge report (Reports/AcknowledgeReport.aspx) */
.vn-filters__row.ak-filters__row { grid-template-columns: minmax(220px, 1.4fr) repeat(5, minmax(120px, 1fr)); }
.ak-summary { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ak-tile { text-align: left; font: inherit; color: inherit; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.ak-tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.ak-tile.is-on { outline: 2px solid var(--primary); outline-offset: -2px; }
.ak-table .ak-comment { min-width: 220px; white-space: normal; }
@media (max-width: 1100px) { .vn-filters__row.ak-filters__row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .vn-filters__row.ak-filters__row, .ak-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Roles list (Management/Roles.aspx) */
.role-table tr.is-selected td { background: var(--surface-2); }
.role-table .num { text-align: right; }
.role-table .cell-actions { white-space: nowrap; }
.tag--custom { color: var(--primary); border-color: var(--primary); }
.btn--danger-text { color: var(--danger); }
.btn--danger-text:hover:not(:disabled) { background: var(--status-offline-bg); }
.btn--danger-text:disabled { color: var(--text-muted); opacity: .55; cursor: not-allowed; }
.role-form__actions { display: flex; gap: 8px; }
.role-form__actions .btn { flex: 1; }
.input.role-form__desc { height: auto; min-height: 110px; padding-top: 10px; padding-bottom: 10px; line-height: 1.5; resize: vertical; }
.role-form__desc + .field__hint, .card__body .field:has(.role-form__desc) { margin-bottom: 16px; }

/* Header bell + alarm sound (Scripts/alerts.js) */
.hdr-alerts {
    position: relative; display: inline-flex; align-items: center; padding: 3px; gap: 2px; margin: 0;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2);
}
.hdr-alerts__btn { position: relative; }
.hdr-alerts__btn .hdr-alerts__on { display: none; }
.hdr-alerts__btn.is-on .hdr-alerts__on { display: inline-flex; }
.hdr-alerts__btn.is-on .hdr-alerts__off { display: none; }
.hdr-alerts__btn .hdr-alerts__off { display: inline-flex; color: var(--text-muted); }
.hdr-alerts__btn.is-on { color: var(--primary); }
#hdrBell.has-alerts { color: var(--status-offline); }
#hdrBell.has-alerts .icon { animation: hdr-ring 2.4s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes hdr-ring { 0%, 80%, 100% { transform: rotate(0); } 84% { transform: rotate(14deg); } 88% { transform: rotate(-12deg); } 92% { transform: rotate(8deg); } 96% { transform: rotate(-4deg); } }
@media (prefers-reduced-motion: reduce) { #hdrBell.has-alerts .icon { animation: none; } }
.hdr-alerts__badge {
    position: absolute; top: -5px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
    background: #e03131; color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
    box-shadow: 0 0 0 2px var(--surface); font-variant-numeric: tabular-nums;
}
.hdr-alerts__panel {
    position: absolute; top: calc(100% + 10px); right: 0; z-index: 60; width: 360px; max-width: calc(100vw - 32px);
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden;
}
.hdr-alerts__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.hdr-alerts__sub { font-size: 12px; color: var(--text-muted); }
.hdr-alerts__list { list-style: none; margin: 0; padding: 4px 0; max-height: 380px; overflow-y: auto; }
.hdr-alerts__item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 8px 14px; color: inherit; text-decoration: none; }
.hdr-alerts__item:hover, .hdr-alerts__item:focus-visible { background: var(--surface-2); text-decoration: none; }
.hdr-alerts__item .count-pill { min-width: 36px; }
.hdr-alerts__text { display: flex; flex-direction: column; min-width: 0; }
.hdr-alerts__site { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr-alerts__meta { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr-alerts__time { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.hdr-alerts__empty, .hdr-alerts__more { padding: 14px; text-align: center; font-size: 13px; color: var(--text-muted); }
.hdr-alerts__more { padding: 8px 14px 10px; font-size: 12px; border-top: 1px solid var(--border); }

/* Dashboard site map (Scripts/dash-map.js) + small tank markers (TankArt.icon) */
.ta-icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.ta-icon { display: block; overflow: visible; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .45)); }
.ta-icon.is-dim { filter: grayscale(.85) drop-shadow(0 2px 2px rgba(0, 0, 0, .45)); opacity: .7; }
.ta-icon__line { stroke: #495057; stroke-width: .7; }
.ta-icon__seam path, .ta-icon__seam line { fill: none; stroke: #6c757d; stroke-width: .45; opacity: .7; }
.ta-icon__pad { opacity: .95; stroke: rgba(0, 0, 0, .35); stroke-width: .6; }

.dmap { margin-bottom: 16px; padding: 0; overflow: hidden; min-width: 0; }
.dmap__bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.dmap__legend { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; letter-spacing: .02em; text-transform: uppercase; }
.dmap__legend--end { justify-self: end; }
.dmap__legend-icon .ta-icon { width: 28px; height: 36px; }
.dmap__filters { display: flex; gap: 8px; }
.dmap__filters .input { width: auto; min-width: 150px; }
.dmap__site { min-width: 240px; }
.dmap__events { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.dmap__event {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 6px; border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s;
}
.dmap__event:hover { border-color: var(--border-strong); }
.dmap__event.is-on { border-color: var(--primary); background: var(--surface-2); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); }
.dmap__event .ta-icon { width: 22px; height: 28px; }
.dmap__event-all { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--primary); font-size: 9px; font-weight: 800; color: var(--primary); }
.dmap__event-text { display: inline-flex; align-items: baseline; gap: 6px; }
.dmap__event-text span { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.dmap__canvas { height: 560px; background: #1b2a33; }
.dmap__note { margin: 0; padding: 8px 16px; font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border); }

.dmap .leaflet-container { font: inherit; }
.leaflet-div-icon.dmap-marker { background: transparent; border: 0; }
.dmap-marker:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.dmap-tip { font-weight: 600; font-size: 12px; }
.dmap-popup .leaflet-popup-content-wrapper, .dmap-popup .leaflet-popup-tip { background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.dmap-popup .leaflet-popup-content { margin: 12px 14px; font-size: 13px; line-height: 1.45; }
.dmap-popup a.leaflet-popup-close-button { color: var(--text-muted); }
.dmap-pop__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-right: 14px; }
.dmap-pop__sub { margin-top: 2px; font-size: 12px; color: var(--text-muted); }
.dmap-pop__grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 10px 0 12px; }
.dmap-pop__grid dt { color: var(--text-muted); }
.dmap-pop__grid dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.dmap-pop__st--online { color: var(--status-online); }
.dmap-pop__st--delayed { color: var(--status-warning); }
.dmap-pop__st--offline { color: var(--status-offline); }
.dmap-pop__link { width: 100%; justify-content: center; }
.dmap-popup .dmap-pop__link, .dmap-popup .dmap-pop__link:hover { color: #fff; text-decoration: none; }
.dmap .leaflet-control-attribution { font-size: 10px; }
@media (max-width: 900px) {
    .dmap__bar { grid-template-columns: 1fr 1fr; }
    .dmap__filters { grid-column: 1 / -1; grid-row: 2; flex-wrap: wrap; }
    .dmap__filters .input, .dmap__site { flex: 1; min-width: 0; }
    .dmap__canvas { height: 420px; }
}
.dmap-marker .ta-icon { width: 30px; height: 39px; }
.dmap .leaflet-control-attribution { font-size: 9px; padding: 0 5px; background: rgba(0, 0, 0, .35); color: rgba(255, 255, 255, .7); border-radius: 4px 0 0 0; }
.dmap .leaflet-control-attribution a { color: inherit; }
/* Charts row layout: 6-column grid -> three donuts per row (span 2), the two statistics charts side by side (span 3). */
.dash-charts { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.dash-charts > .dash-chart { grid-column: span 2; }
.dash-charts > .dash-chart--full { grid-column: span 3; }
.dash-chart--full .dash-chart__plot { height: 280px; }
@media (max-width: 1280px) { .dash-charts > .dash-chart { grid-column: span 3; } .dash-charts > .dash-chart--full { grid-column: 1 / -1; } }
@media (max-width: 760px) { .dash-charts > .dash-chart, .dash-charts > .dash-chart--full { grid-column: 1 / -1; } }
/* Map: HH / LL sites blink (a glowing ring pulses under the tank) so critical sites stand out */
.dmap-marker.is-critical .ta-icon { animation: dmap-blink 1s ease-in-out infinite; }
.dmap-marker.is-critical::after {
    content: ""; position: absolute; left: 50%; bottom: 0; width: 30px; height: 12px; margin-left: -15px; border-radius: 50%;
    background: var(--ring, #e03131); opacity: .7; z-index: -1; animation: dmap-ring 1.4s ease-out infinite;
}
.dmap-marker--hh { --ring: #e03131; }
.dmap-marker--ll { --ring: #f08c00; }
@keyframes dmap-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes dmap-ring { 0% { transform: scale(.6); opacity: .8; } 100% { transform: scale(2.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .dmap-marker.is-critical .ta-icon, .dmap-marker.is-critical::after { animation: none; }
    .dmap-marker.is-critical::after { opacity: .6; transform: scale(1.4); }
}
/* Map: "Hold Ctrl and scroll to zoom" hint, shown briefly when the wheel is used without Ctrl */
.dmap__canvas { position: relative; }
.dmap__hint {
    position: absolute; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; pointer-events: none;
    background: rgba(0, 0, 0, .45); color: #fff; font-size: 18px; font-weight: 600; text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
    opacity: 0; transition: opacity .25s ease;
}
.dmap__hint.is-on { opacity: 1; }

/* Map + Alerts panel row (Dashboard Overview) */
.dmap-row { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr); gap: 14px; margin-bottom: 16px; align-items: stretch; }
.dmap-row > .dmap { margin-bottom: 0; }
.dalerts { contain: size; display: flex; flex-direction: column; min-height: 0;   /* height follows the map card, list scrolls */ padding: 0; margin: 0; overflow: hidden; }
.dalerts__head { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 16px 12px; border-bottom: 1px solid var(--border); }
.dalerts__title { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; }
.dalerts__title .icon { width: 18px; height: 18px; }
.dalerts__count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: #e03131; color: #fff; font-size: 11.5px; font-weight: 700; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.dalerts__sub { margin: 0; padding: 0 16px 10px; text-align: center; font-size: 12px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.dalerts__list { flex: 1 1 0; min-height: 0; list-style: none; margin: 0; padding: 6px 0; overflow-y: auto; }
.dalerts__item { border-left: 3px solid transparent; }
.dalerts__item--hh { border-left-color: #e03131; }
.dalerts__item--ll { border-left-color: #f08c00; }
.dalerts__item--h { border-left-color: #f783ac; }
.dalerts__item--l { border-left-color: #f0d43a; }
.dalerts__btn {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 8px 14px 8px 11px;
    border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.dalerts__btn:hover, .dalerts__btn:focus-visible { background: var(--surface-2); }
.dalerts__btn .count-pill { min-width: 36px; }
.dalerts__text { display: flex; flex-direction: column; min-width: 0; }
.dalerts__site { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dalerts__meta { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dalerts__time { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.dalerts__empty, .dalerts__more { padding: 24px 16px; text-align: center; font-size: 13px; color: var(--text-muted); }
.dalerts__more { padding: 8px 16px 10px; font-size: 12px; border-top: 1px solid var(--border); }
@media (max-width: 1100px) { .dmap-row { grid-template-columns: minmax(0, 1fr); } .dalerts { contain: none; } .dalerts__list { max-height: 360px; flex: none; } }
/* Alerts panel: count badge sits on the bell's top-right corner */
.dalerts__bell { position: relative; display: inline-flex; }
.dalerts__bell .dalerts__count { position: absolute; top: -5px; left: 10px; min-width: 13px; height: 13px; padding: 0 3px; font-size: 8.5px; line-height: 13px; box-shadow: 0 0 0 1.5px var(--surface); }
/* Alarm sound blocked by the browser (autoplay rule): prompt until the first click / key press */
.sound-prompt {
    position: fixed; left: 50%; bottom: 24px; z-index: 2000; transform: translateX(-50%);
    padding: 10px 18px; border: 0; border-radius: 999px; background: #e03131; color: #fff;
    font: inherit; font-size: 14px; font-weight: 600; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); cursor: pointer;
    animation: sound-prompt-pulse 1.6s ease-in-out infinite;
}
.sound-prompt[hidden] { display: none; }
@keyframes sound-prompt-pulse { 0%, 100% { box-shadow: 0 6px 20px rgba(0, 0, 0, .35), 0 0 0 0 rgba(224, 49, 49, .55); } 50% { box-shadow: 0 6px 20px rgba(0, 0, 0, .35), 0 0 0 10px rgba(224, 49, 49, 0); } }
.hdr-alerts__btn.is-blocked { color: #e03131; animation: dmap-blink 1s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .sound-prompt, .hdr-alerts__btn.is-blocked { animation: none; } }
/* Alerts panel tree: district groups (foldable) with their sites */
.dalerts__group > summary { list-style: none; }
.dalerts__group > summary::-webkit-details-marker { display: none; }
.dalerts__district {
    display: flex; align-items: center; gap: 8px; padding: 8px 14px; cursor: pointer; user-select: none;
    font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--text-muted);
}
.dalerts__district:hover { color: var(--text); background: var(--surface-2); }
.dalerts__chev { width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease; flex: none; }
.dalerts__group[open] .dalerts__chev { transform: rotate(45deg); }
.dalerts__dname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dalerts__dcount { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 11px; line-height: 17px; text-align: center; color: var(--text); }
.dalerts__sites { list-style: none; margin: 0 0 4px 18px; padding: 0; border-left: 1px dashed var(--border-strong); }
.dalerts__sites .dalerts__btn { padding-left: 10px; }
@media (prefers-reduced-motion: reduce) { .dalerts__chev { transition: none; } }
.dalerts__time { white-space: nowrap; text-align: right; }
/* Take action dialog (Dashboard Alerts panel, operators) */
.dalarm { width: min(1100px, calc(100vw - 32px)); }
.dalarm__msg { margin: 0 20px 10px; }
.dalarm__table td { vertical-align: top; }
.dalarm__action { min-width: 230px; }
.dalarm__cmt { min-width: 260px; width: 40%; }
.dalarm__comment { width: 100%; min-height: 54px; resize: vertical; line-height: 1.4; padding-top: 6px; padding-bottom: 6px; height: auto; }
.dalarm__left { display: block; margin-top: 2px; font-size: 11px; color: var(--text-muted); text-align: right; }
.dalarm__left.is-low { color: var(--status-warning); }
.dalarm__take { white-space: nowrap; }

/* Take action dialog v2: one card per alert (replaces the table layout) */
dialog.dalarm {
    width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--border);
    border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden;
}
dialog.dalarm[open] { display: flex; flex-direction: column; }
dialog.dalarm::backdrop { background: rgba(10, 15, 25, .55); }
.dalarm .wizard__header { padding: 18px 22px 14px; border-bottom: 1px solid var(--border); }
.dalarm .wizard__title { font-size: 18px; }
.dalarm__msg { margin: 12px 22px 0; }
.dalarm__list { flex: 1 1 auto; overflow-y: auto; padding: 16px 22px; display: flex; flex-direction: column; gap: 14px; background: var(--surface-2); }
.dalarm__card { border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: 10px; background: var(--surface); overflow: hidden; }
.dalarm__card--hh { border-left-color: #e03131; }
.dalarm__card--h { border-left-color: #f783ac; }
.dalarm__card--l { border-left-color: #f0d43a; }
.dalarm__card--ll { border-left-color: #f08c00; }
.dalarm__card.is-locked { opacity: .78; }
.dalarm__head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.dalarm__pill { min-width: 42px; font-size: 13px; padding: 4px 10px; }
.dalarm__what { display: flex; flex-direction: column; min-width: 0; }
.dalarm__what strong { font-size: 14.5px; }
.dalarm__what span { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.dalarm__value { display: flex; flex-direction: column; align-items: flex-end; }
.dalarm__value span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.dalarm__value b { font-size: 20px; font-variant-numeric: tabular-nums; }
.dalarm__lock, .dalarm__mine { margin: 0; padding: 8px 16px; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.dalarm__lock { background: var(--status-warning-bg); color: var(--status-warning); font-weight: 600; }
.dalarm__mine { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); }
.dalarm__body { display: grid; gap: 6px; padding: 12px 16px 14px; }
.dalarm__label { margin-top: 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.dalarm__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dalarm__chip {
    padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text);
    font: inherit; font-size: 12.5px; line-height: 1.3; text-align: left; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.dalarm__chip:hover:not(:disabled) { border-color: var(--primary); }
.dalarm__chip.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
.dalarm__chip:disabled { cursor: not-allowed; opacity: .55; }
.dalarm__comment { width: 100%; min-height: 72px; height: auto; resize: vertical; line-height: 1.45; padding-top: 8px; padding-bottom: 8px; }
.dalarm__foot-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.dalarm__left { font-size: 11.5px; color: var(--text-muted); }
.dalarm__left.is-low { color: var(--status-warning); font-weight: 600; }
.dalarm__take { min-width: 140px; }
.dalarm__empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 36px 16px; text-align: center; color: var(--text-muted); }
.dalarm__empty strong { font-size: 16px; color: var(--status-online); }
.dalarm__foot { margin: 0; padding: 10px 22px 14px; font-size: 11.5px; color: var(--text-muted); border-top: 1px solid var(--border); }
.dalerts__claim { font-size: 11px; font-weight: 600; color: var(--status-warning); }
@media (max-width: 560px) {
    .dalarm__head { grid-template-columns: auto 1fr; }
    .dalarm__value { grid-column: 1 / -1; flex-direction: row; gap: 8px; align-items: baseline; }
    .dalarm__foot-row { flex-direction: column; align-items: stretch; }
}
/* Alerts panel: alert another operator is working on (not clickable for other operators) */
.dalerts__item.is-busy .dalerts__btn { cursor: not-allowed; opacity: .75; }
.dalerts__item.is-busy .dalerts__btn:hover { background: transparent; }
.dalerts__claim { display: block; white-space: normal; }

/* Take action dialog: done / empty screen */
.dalarm__done { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 20px 24px; text-align: center;
    border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.dalarm__done-icon { width: 64px; height: 64px; margin-bottom: 4px; }
.dalarm__done-icon circle { fill: var(--status-online-bg); stroke: var(--status-online); stroke-width: 2; }
.dalarm__done-icon path { fill: none; stroke: var(--status-online); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round;
    stroke-dasharray: 40; stroke-dashoffset: 40; animation: dalarm-tick .5s .15s ease-out forwards; }
@keyframes dalarm-tick { to { stroke-dashoffset: 0; } }
.dalarm__done-title { font-size: 18px; color: var(--text); }
.dalarm__done-text { max-width: 420px; font-size: 13.5px; color: var(--text-muted); }
.dalarm__done-list { list-style: none; margin: 8px 0 4px; padding: 0; width: 100%; max-width: 440px; display: grid; gap: 6px; }
.dalarm__done-list li { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 10px; padding: 8px 12px;
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); text-align: left; font-size: 13px; }
.dalarm__done-time { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.dalarm__done-act { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dalarm__done-btn { min-width: 140px; margin-top: 8px; }
.dalarm__done-hint { min-height: 16px; font-size: 11.5px; color: var(--text-muted); }
@media (prefers-reduced-motion: reduce) { .dalarm__done-icon path { animation: none; stroke-dashoffset: 0; } }

/* Take action dialog: multi-select */
.dalarm__toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 12px;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.dalarm__selall { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; cursor: pointer; user-select: none; }
.dalarm__toolbar-hint { font-size: 12px; color: var(--text-muted); }
.dalarm__check { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: pointer; flex: none; }
.dalarm__head.has-check { grid-template-columns: auto auto 1fr auto; }
.dalarm__card.is-selected { box-shadow: 0 0 0 2px var(--primary); }
.dalarm__card.is-selected .dalarm__body { display: none; }   /* selected alerts use the shared form below */
.dalarm__bulk { position: sticky; bottom: -16px; display: grid; gap: 6px; padding: 14px 16px; border: 2px solid var(--primary);
    border-radius: 12px; background: var(--surface); box-shadow: 0 -8px 20px rgba(0, 0, 0, .12); }
.dalarm__bulk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dalarm__bulk-head strong { font-size: 14px; color: var(--primary); }
.dalarm__bulk-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.dalarm__bulk-pills .count-pill { font-size: 11px; padding: 1px 8px; }

/* Alerts panel: select several sites (Operator) */
.dalerts__item.has-pick { display: flex; align-items: center; }
.dalerts__item.has-pick .dalerts__btn { flex: 1; min-width: 0; padding-left: 6px; }
.dalerts__pick { width: 16px; height: 16px; margin: 0 0 0 10px; accent-color: var(--primary); cursor: pointer; flex: none; }
.dalerts__pick:disabled { cursor: not-allowed; opacity: .4; }
.dalerts__pick--district { margin: 0; }
.dalerts__item.is-picked { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.dalerts__bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface); }
.dalerts__bar[hidden] { display: none; }
.dalerts__bar span { flex: 1; font-size: 13px; font-weight: 600; color: var(--primary); }
.dalarm__site { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; padding: 0 2px; }
.dalarm__site strong { font-size: 14px; }
.dalarm__site span { font-size: 12px; color: var(--text-muted); }

/* Take action: multi-select action chips */
.dalarm__label-hint { margin-left: 4px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-muted); opacity: .85; }
.dalarm__chip.is-on::before { content: "\2713"; margin-right: 6px; font-weight: 700; }

/* Take action window: table, one alert per row */
dialog.dalarm { width: min(1240px, calc(100vw - 32px)); }
.dalarm__list { padding: 12px 16px; background: var(--surface); }
.dalarm__wrap { border: 1px solid var(--border); border-radius: 10px; max-height: calc(100vh - 260px); overflow: auto; }
.dalarm__table { margin: 0; }
.dalarm__table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); white-space: nowrap; }
.dalarm__table td { vertical-align: middle; }
.dalarm__row td:first-child { border-left: 4px solid transparent; }
.dalarm__row--hh td:first-child { border-left-color: #e03131; }
.dalarm__row--h td:first-child { border-left-color: #f783ac; }
.dalarm__row--l td:first-child { border-left-color: #f0d43a; }
.dalarm__row--ll td:first-child { border-left-color: #f08c00; }
.dalarm__row.is-locked td { background: var(--status-warning-bg); }
.dalarm__row.is-flash td { animation: dalarm-flash 1.6s ease-out 1; }
@keyframes dalarm-flash { 0% { background: color-mix(in srgb, var(--primary) 22%, transparent); } 100% { background: transparent; } }
.dalarm__sitecell strong { display: block; white-space: nowrap; }
.dalarm__sitecell span, .dalarm__time small { display: block; font-size: 11.5px; color: var(--text-muted); }
.dalarm__time span { white-space: nowrap; font-variant-numeric: tabular-nums; }
.dalarm__action { min-width: 210px; max-width: 260px; }
.dalarm__cmt { min-width: 220px; width: 30%; }
.dalarm__cmt .dalarm__comment { width: 100%; }
.dalarm__cmt .dalarm__left { display: block; margin-top: 2px; text-align: right; }
.dalarm__lock-inline { font-size: 12.5px; font-weight: 600; color: var(--status-warning); }
.dalarm__btncell { white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .dalarm__row.is-flash td { animation: none; } }
.dalarm__table input.dalarm__comment { min-height: 0; height: 32px; padding-top: 0; padding-bottom: 0; resize: none; }
/* Take action table: taller comment box (2-3 lines) */
.dalarm__table textarea.dalarm__comment { height: 64px; min-height: 64px; padding-top: 7px; padding-bottom: 7px; line-height: 1.4; resize: vertical; }
/* User Management list: icon actions (view / delete) */
.user-actions { white-space: nowrap; text-align: right; }
.user-actions .icon-btn { margin-left: 4px; }
.icon-btn--sm { width: 30px; height: 30px; }
.icon-btn--sm .icon { width: 16px; height: 16px; }
.icon-btn--delete { color: var(--danger); }
.icon-btn--delete:hover { background: var(--status-offline-bg); border-color: var(--danger); }

/* =====================================================================
   Mobile (phones, up to 640px): shared fixes for every page
   ===================================================================== */
@media (max-width: 640px) {
    /* Top bar: page name hidden (the page title below shows it), compact buttons */
    .topbar { gap: 6px; padding: 0 10px; }
    .topbar__crumbs { display: none; }
    .topbar__actions { margin-left: auto; gap: 6px; }
    .theme-switch, .hdr-alerts { padding: 2px; }
    .theme-switch__btn, .hdr-alerts__btn { width: 30px; height: 28px; }
    .theme-switch::before { width: 30px; }
    .theme-switch:has(.theme-switch__btn:nth-of-type(2)[aria-pressed="true"])::before { transform: translateX(32px); }
    .theme-switch:has(.theme-switch__btn:nth-of-type(3)[aria-pressed="true"])::before { transform: translateX(64px); }
    .hdr-alerts__panel { position: fixed; top: 60px; left: 10px; right: 10px; width: auto; }

    /* Page header: title on its own row, actions in a full-width row below */
    .page-header { gap: 10px; margin-bottom: 14px; }
    .page-header > div:first-child { flex: 1 1 100%; }
    .page-actions { flex: 1 1 100%; flex-wrap: wrap; align-items: center; }

    /* Segmented switches never wrap (the sliding highlight needs one row); full width, equal buttons,
       scroll sideways if the labels still do not fit */
    .segmented { flex-wrap: nowrap; border-radius: 999px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
    .segmented::-webkit-scrollbar { display: none; }
    .page-actions .segmented, .report-filters__quick.segmented { flex: 1 1 100%; }
    .page-actions .segmented__btn, .report-filters__quick .segmented__btn { flex: 1 0 auto; justify-content: center; text-align: center; }

    /* Report filters: one field per row is easier to tap; the date range always gets the full width */
    .report-filters { padding: 14px; }
    .report-filters__grid, .vn-filters__row, .vn-filters__row.ak-filters__row, .si-filters__row { grid-template-columns: minmax(0, 1fr) !important; }
    .report-filters__range { grid-column: 1 / -1; }
    .report-filters__actions, .vn-filters__actions { flex-direction: column; align-items: stretch; }
    .report-filters__actions > .btn, .vn-filters__actions > .btn { width: 100%; justify-content: center; }
    .vn-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .vn-quick .btn { justify-content: center; }
    .report-summary, .ak-summary { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

    /* Dashboard */
    .dash-live { font-size: 12px; }
    .dmap__bar { grid-template-columns: 1fr 1fr; padding: 10px 12px; }
    .dmap__filters { grid-column: 1 / -1; grid-row: 2; }
    .dmap__filters .input, .dmap__site { flex: 1; min-width: 0; }
    .dmap__canvas { height: 360px; }
    .dmap__events { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; }
    .dmap__event { flex: none; }
    .dalerts { contain: none; min-height: 140px; }
    .dash-chart__plot { height: 260px; }

    /* Dialogs use (almost) the whole screen */
    dialog.dalarm, dialog.dash-sites, dialog.wizard { width: calc(100vw - 16px); max-width: none; max-height: calc(100vh - 16px); margin: auto; }
    .dalarm__wrap { max-height: calc(100vh - 220px); }

    /* Tables keep scrolling inside their card; the toolbar above them stacks */
    .card__header { flex-wrap: wrap; gap: 10px; }
    .vn-bar { flex-wrap: wrap; }
    .vn-search { flex: 1 1 100%; }
}
.field[hidden] { display: none !important; }
/* Site Info: "Pick on map" for latitude / longitude (Scripts/site-pin.js) */
.pin-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: -6px; }
.pin-row .field__hint { margin: 0; }
dialog.pin-dialog { width: min(900px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 1px solid var(--border); border-radius: 14px;
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden; }
dialog.pin-dialog[open] { display: flex; flex-direction: column; }
dialog.pin-dialog::backdrop { background: rgba(10, 15, 25, .55); }
.pin-dialog .wizard__header { padding: 16px 20px 12px; border-bottom: 1px solid var(--border); }
.pin-dialog__map { height: min(520px, calc(100vh - 220px)); min-height: 280px; background: #1b2a33; }
.pin-dialog__foot { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pin-dialog__coords { flex: 1; min-width: 200px; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.pin-dialog .leaflet-container { font: inherit; }
@media (max-width: 640px) { .pin-row { justify-content: flex-start; flex-wrap: wrap; } .pin-dialog__foot .btn { flex: 1; } }
.leaflet-marker-icon:focus:not(:focus-visible) { outline: none; }
.input-wrap__action.pin-open { color: var(--primary); }
.pin-dialog__bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.pin-dialog__bar .field__label { margin: 0; }
.pin-dialog__bar select { width: auto; min-width: 240px; }
.pin-dialog__hint { font-size: 12px; color: var(--text-muted); }
@media (max-width: 640px) { .pin-dialog__bar select { flex: 1; min-width: 0; } }
.pin-search { border-bottom: 0; padding-bottom: 0; }
.pin-search__box { position: relative; display: flex; gap: 8px; flex: 1; min-width: 260px; }
.pin-search__box .input { flex: 1; }
.pin-search__results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 1000; list-style: none; margin: 0; padding: 4px 0;
    max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-lg); }
.pin-search__results[hidden] { display: none; }
.pin-search__item { display: block; width: 100%; padding: 8px 12px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.pin-search__item:hover, .pin-search__item:focus-visible { background: var(--surface-2); }
.pin-search__msg { padding: 8px 12px; font-size: 12.5px; color: var(--text-muted); }
.pin-dialog__credit { display: block; margin-top: 2px; font-size: 10.5px; opacity: .7; }
/* Site list: Maintenance mode switch (amber when on) */
input[type="checkbox"].switch.switch--warning:checked { background: var(--status-warning); }
.status-switch--maint.is-on .status-switch__text { color: var(--status-warning); }

/* Dashboard map popup v2: site card */
.dmap-popup .leaflet-popup-content-wrapper { padding: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.dmap-popup .leaflet-popup-content { margin: 0; font-size: 13px; line-height: 1.4; }
.dmap-popup a.leaflet-popup-close-button { top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%; color: var(--text-muted); font: 18px/20px sans-serif; }
.dmap-popup a.leaflet-popup-close-button:hover { background: var(--surface-2); color: var(--text); }
.dmap-pop { display: flex; flex-direction: column; width: 280px; box-sizing: border-box; overflow-wrap: anywhere; }
.dmap-pop *, .dmap-pop *::before { box-sizing: border-box; }
.dmap-pop__head { display: flex; align-items: center; gap: 10px; padding: 12px 36px 10px 14px; border-top: 4px solid var(--border-strong); background: var(--surface-2); }
.dmap-pop--online .dmap-pop__head { border-top-color: var(--status-online); }
.dmap-pop--delayed .dmap-pop__head { border-top-color: var(--status-warning); }
.dmap-pop--offline .dmap-pop__head { border-top-color: var(--status-offline); }
.dmap-pop--maintenance .dmap-pop__head { border-top-color: #1c7ed6; }
.dmap-pop__tank { flex: none; width: 34px; }
.dmap-pop__tank .ta-icon { width: 34px; height: 44px; }
.dmap-pop__title { display: flex; flex-direction: column; min-width: 0; }
.dmap-pop__title strong { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dmap-pop__title span { font-size: 11.5px; color: var(--text-muted); }
.dmap-pop__badges { display: flex; align-items: center; gap: 6px; padding: 10px 14px 0; }
.dmap-pop__status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); }
.dmap-pop__status i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.dmap-pop__status--online { color: var(--status-online); background: var(--status-online-bg); }
.dmap-pop__status--delayed { color: var(--status-warning); background: var(--status-warning-bg); }
.dmap-pop__status--offline { color: var(--status-offline); background: var(--status-offline-bg); }
.dmap-pop__status--maintenance { color: #1c7ed6; background: color-mix(in srgb, #1c7ed6 14%, transparent); }
.dmap-pop__level { margin: 10px 14px 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.dmap-pop__label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.dmap-pop__reading { display: flex; align-items: baseline; gap: 6px; margin-top: 2px; }
.dmap-pop__reading b { font-size: 22px; font-variant-numeric: tabular-nums; }
.dmap-pop__reading span { font-size: 12px; color: var(--text-muted); }
.dmap-pop__level.is-empty .dmap-pop__reading b { font-size: 15px; color: var(--text-muted); }
.dmap-pop__bar { height: 6px; margin-top: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.dmap-pop__fill { display: block; height: 100%; width: 0; border-radius: 999px; background: #1971c2; transition: width .4s ease; }
.dmap-pop__fill--hh { background: #e03131; } .dmap-pop__fill--h { background: #f783ac; } .dmap-pop__fill--l { background: #f0d43a; } .dmap-pop__fill--ll { background: #f08c00; }
.dmap-pop__chips { display: flex; gap: 6px; padding: 8px 14px 0; }
.dmap-pop__chip { padding: 2px 8px; border-radius: 6px; background: var(--surface-2); font-size: 11.5px; color: var(--text-muted); }
.dmap-pop__chip b { color: var(--text); font-variant-numeric: tabular-nums; }
.dmap-pop__time { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 0 8px; padding: 10px 14px 0; font-size: 12px; }
.dmap-pop__time span { color: var(--text-muted); }
.dmap-pop__time b { text-align: right; font-variant-numeric: tabular-nums; }
.dmap-pop__time small { grid-column: 2; text-align: right; font-size: 11px; color: var(--text-muted); }
.dmap-pop .dmap-pop__link { margin: 12px 14px 14px; width: auto; }

/* =====================================================================
   Mimic Page Builder (Management/MimicPages.aspx, Scripts/mimic-builder.js, Scripts/mimic-components.js)
   ===================================================================== */
.mp-list__head { flex-wrap: wrap; gap: 10px; }
.mp-list__tools { display: flex; align-items: center; gap: 8px; flex: 1; }
.mp-list__tools .input { max-width: 320px; }
.mp-list__tools .mp-filter { width: auto; max-width: 200px; }
@media (max-width: 640px) { .mp-list__tools { flex-wrap: wrap; } .mp-list__tools .mp-filter { flex: 1 1 140px; max-width: none; } }
.mp-tag--pub { color: var(--status-online); border-color: var(--status-online); }
.mp-editor[hidden] { display: none; }
.mp-editor { display: flex; flex-direction: column; gap: 12px; }
.mp-toolbar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px 14px; padding: 12px 14px; margin: 0; }
.mp-toolbar .field { margin: 0; }
.mp-toolbar__name { flex: 1 1 220px; }
.mp-toolbar__name .input { width: 100%; }
.mp-toolbar select.input { min-width: 170px; }
.mp-size { display: inline-flex; align-items: center; gap: 4px; }
.mp-size .input { width: 82px; }
.mp-toolbar__right { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.mp-zoom { display: inline-flex; align-items: center; gap: 4px; padding: 2px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); }
.mp-zoom .icon-btn { width: 28px; height: 28px; border-radius: 999px; font-size: 16px; }
.mp-zoom span { min-width: 44px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.mp-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.mp-back-icon { transform: rotate(90deg); }
#mpSave.is-dirty::after { content: ""; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: #f08c00; }
#mpPreview.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
.mp-body { display: grid; grid-template-columns: 240px minmax(0, 1fr) 280px; gap: 12px; align-items: start; }
.mp-editor.is-preview .mp-palette, .mp-editor.is-preview .mp-props { opacity: .45; pointer-events: none; }
.mp-palette, .mp-props { margin: 0; padding: 12px; max-height: calc(100vh - 230px); overflow-y: auto; position: sticky; top: 76px; }
.mp-panel__title { margin: 0 0 4px; font-size: 14px; }
.mp-panel__hint { margin: 0 0 10px; font-size: 12px; color: var(--text-muted); }
.mp-lib__group { margin: 12px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.mp-lib__item { display: flex; align-items: center; gap: 10px; width: 100%; margin-bottom: 6px; padding: 8px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: grab; transition: border-color .15s, box-shadow .15s; }
.mp-lib__item:hover:not(:disabled) { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.mp-lib__item:disabled { cursor: not-allowed; opacity: .6; }
.mp-lib__thumb { flex: none; width: 34px; display: flex; justify-content: center; }
.mp-lib__thumb .ta-icon { width: 30px; height: 40px; }
.mp-lib__text { display: flex; flex-direction: column; min-width: 0; }
.mp-lib__text b { font-size: 13px; }
.mp-lib__text small { font-size: 11px; color: var(--text-muted); line-height: 1.3; }
.mp-stage { margin: 0; padding: 0; overflow: hidden; }
.mp-scroll { height: calc(100vh - 270px); min-height: 420px; overflow: auto; padding: 12px; background: var(--surface-2); }
.mp-canvas { position: relative; margin: 0 auto; background: #eef4fb; border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm); outline: none; }
:root[data-theme="dark"] .mp-canvas, :root[data-theme="night"] .mp-canvas { background: #121a24; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mp-canvas { background: #121a24; } }
.mp-canvas.is-grid {
    background-image: linear-gradient(to right, rgba(120, 140, 170, .16) 1px, transparent 1px), linear-gradient(to bottom, rgba(120, 140, 170, .16) 1px, transparent 1px);
    background-size: var(--mp-grid, 10px) var(--mp-grid, 10px);
}
.mp-canvas__empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; padding: 20px; text-align: center; color: var(--text-muted); font-size: 14px; pointer-events: none; }
.mp-comp { position: absolute; box-sizing: border-box; border: 1px dashed transparent; border-radius: 4px; cursor: move; touch-action: none; user-select: none; }
.mp-comp:hover { border-color: rgba(25, 113, 194, .45); }
.mp-comp.is-selected { border: 1px solid var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent); }
.mp-canvas.is-preview .mp-comp { cursor: default; border-color: transparent; box-shadow: none; }
.mp-comp__inner { width: 100%; height: 100%; overflow: hidden; pointer-events: none; }
.mp-comp__unknown { display: block; padding: 6px; font-size: 11px; color: var(--danger); }
.mp-handle { position: absolute; width: 10px; height: 10px; border: 2px solid var(--primary); border-radius: 2px; background: #fff; }
.mp-handle--nw { left: -6px; top: -6px; cursor: nwse-resize; } .mp-handle--se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.mp-handle--ne { right: -6px; top: -6px; cursor: nesw-resize; } .mp-handle--sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.mp-stage__foot { margin: 0; padding: 8px 14px; font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border); }
.mp-field { margin-bottom: 8px; }
.mp-field .input { width: 100%; }
.mp-geo { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.mp-props__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }
/* tank component */
.mc-tank { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: .3em; }
.mc-tank__title { max-width: 100%; font-size: 1em; font-weight: 600; color: var(--text); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-tank__art { flex: 1 1 auto; min-height: 0; width: 100%; display: flex; }
.mc-tank__art .ta { width: 100%; height: 100%; max-height: none; }
.mc-value { display: inline-flex; align-items: baseline; gap: .45em; padding: .2em .6em; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); box-shadow: var(--shadow-sm); font-size: .95em; white-space: nowrap; }
.mc-value__label { color: var(--text); }
.mc-value__num { font-family: var(--font-mono); font-size: 1.15em; color: #c92a2a; }
.mc-value__unit { font-size: .8em; color: var(--primary); font-weight: 700; }
.mc-ev--hh, .mc-ev--ll { color: #e03131; } .mc-ev--nn { color: #2f9e44; }
body.mp-editing .page-header { margin-bottom: 10px; }
@media (max-width: 1200px) { .mp-body { grid-template-columns: 200px minmax(0, 1fr); } .mp-props { grid-column: 1 / -1; position: static; max-height: none; } }
@media (max-width: 760px) {
    .mp-body { grid-template-columns: minmax(0, 1fr); }
    .mp-palette { position: static; max-height: none; }
    .mp-palette #mpLibrary { display: flex; gap: 6px; overflow-x: auto; }
    .mp-palette .mp-lib__group { display: none; }
    .mp-palette .mp-lib__item { width: auto; flex: none; }
    .mp-scroll { height: 60vh; min-height: 320px; }
    .mp-toolbar__right { margin-left: 0; }
}
/* Site Info list: Mimic Page column */
.mimic-cell { display: flex; align-items: center; gap: 6px; }
.mimic-cell__select { width: auto; min-width: 140px; max-width: 200px; }
.mimic-cell .icon-btn { flex: none; font-weight: 700; text-decoration: none; }

/* ===== Mimic view (read-only, MimicView.aspx) ===== */
.mv-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mv-title { font-size: 1.05rem; margin: 0; flex: 1; min-width: 0; }
.mv-time { font-size: .8rem; }
.mv-card { overflow: hidden; }
.mv-card .card__header { padding-top: 10px; padding-bottom: 10px; }
.mv-scroll { min-height: 320px; padding: 0; overflow: auto; }
.mv-scroll.is-fitted { overflow: hidden; display: flex; align-items: center; justify-content: center; }
.mv-scroll .mp-canvas { border: 0; box-shadow: none; flex: none; background: transparent; }
.mv-empty { padding: 40px 16px; text-align: center; color: var(--text-muted, #8b949e); margin: 0; }
.mp-wires { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }

/* ===== Mimic pipelines (connector SVG layer) ===== */
.mp-wires { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; z-index: 0; }
.mp-canvas .mp-comp { z-index: 1; }
.mc-pipe path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.mc-pipe__hit { stroke: transparent; }
.mp-wires.is-edit .mc-pipe__hit { pointer-events: stroke; cursor: pointer; }
.mc-pipe__shell { stroke: #495057; }
.mc-pipe__flow { stroke: rgba(255, 255, 255, .85); animation: mc-pipe-flow 1s linear infinite; }
@keyframes mc-pipe-flow { to { stroke-dashoffset: -32; } }
@media (prefers-reduced-motion: reduce) { .mc-pipe__flow { animation: none; } }
.mc-pipe.is-selected .mc-pipe__shell { stroke: var(--primary, #339af0); }
.mc-pipe__label { fill: var(--text, #212529); font-weight: 600; paint-order: stroke; stroke: var(--surface, #fff); stroke-width: 3px; }
.mp-canvas.is-connecting .mp-comp { cursor: crosshair; outline: 1px dashed var(--primary, #339af0); }
.mp-canvas.is-connecting .mp-comp.is-from { outline: 2px solid var(--primary, #339af0); }
.mp-stage__foot.is-connecting { color: var(--primary, #339af0); font-weight: 600; }
.mp-lib__pipe { width: 34px; height: 34px; }
.mp-lib__pipe path { fill: none; stroke-linejoin: round; }
.mp-lib__pipe .mc-pipe__water { stroke: #4dabf7; }
.mp-geo.is-hidden { display: none; }
.mp-pipe-ends { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0 0 10px; font-size: 13px; }

/* ===== Mimic: square / funnel tanks ===== */
.mc-sq__wall { stroke: #868e96; stroke-width: .8; }
.mc-sq__floor { fill: #9aa3ab; }
.mc-sq__surface { fill: #74c0fc; stroke: #339af0; stroke-width: 1; opacity: .9; }
.mc-sq__glass { opacity: .42; }
.mc-sq__seam { stroke: rgba(255, 255, 255, .6); stroke-width: 1; fill: none; }
.mc-sq__bolts { stroke-dasharray: 1.2 2.4; stroke: #6c757d; }
.mc-sq__edge { fill: none; stroke: #868e96; stroke-width: 1.5; stroke-linejoin: round; }
.mc-sq__rim { fill: none; stroke: #6c757d; stroke-width: 2.4; stroke-linejoin: round; }
.mc-sq__top { fill: #e2e5e8; }
.mc-sq__shade { fill: #c1c6cb; }
.mc-sq__brace { stroke: #c4c8cc; stroke-width: 3.5; stroke-linecap: round; }
.mc-fn__leg { stroke: #b4b9be; stroke-width: 6; stroke-linecap: round; }
.mc-fn__outlet { fill: #868e96; }
.mc-fn__lid { fill: #dee2e6; stroke: #868e96; stroke-width: 1.5; }
.mc-fn__ray { stroke: #adb5bd; stroke-width: .8; }
.mc-fn__vent { fill: #868e96; }
.mc-fn__col { stroke: #a5abb1; stroke-width: 1; }
.mc-fn__colseam { stroke: rgba(0, 0, 0, .08); stroke-width: 1; }
.mp-lib__thumb .mp-lib__art { width: 34px; height: 34px; display: block; }

/* ===== Mimic: pump, river, dam, flow meters, pressure gauge ===== */
@keyframes mc-spin { to { transform: rotate(360deg); } }
.mc-pump__motor { stroke: #3d4852; stroke-width: 1; }
.mc-pump__fin { stroke: rgba(255, 255, 255, .25); stroke-width: 1.5; }
.mc-pump__casing { stroke: #868e96; stroke-width: 1.2; }
.mc-pump__flange { fill: #868e96; stroke: #6c757d; stroke-width: .8; }
.mc-pump__eye { fill: #495057; }
.mc-pump__blade { fill: none; stroke: #ced4da; stroke-width: 3; stroke-linecap: round; }
.mc-pump__imp { transform-box: fill-box; transform-origin: center; }
.mc-pump.is-run .mc-pump__imp { animation: mc-spin 1.1s linear infinite; }
.mc-pump__lamp { fill: #adb5bd; stroke: #495057; stroke-width: 1.5; }
.mc-pump.is-run .mc-pump__lamp { fill: #40c057; }
.mc-pump.is-stop .mc-pump__lamp { fill: #fa5252; }
.mc-state { display: inline-block; margin: 2px auto 0; padding: 1px 8px; border-radius: 999px; font-size: .75em; font-weight: 700; letter-spacing: .04em; }
.mc-state--run { color: #2b8a3e; background: #d3f9d8; }
.mc-state--stop { color: #c92a2a; background: #ffe3e3; }
.mc-state--none { color: var(--text-muted); background: var(--surface-2); }
.mc-river { position: relative; width: 100%; height: 100%; }
.mc-river__svg { display: block; width: 100%; height: 100%; }
.mc-river__title { position: absolute; left: 8px; top: 6px; padding: 1px 8px; border-radius: 999px; font-weight: 700; font-size: .85em; color: #0b3d6e; background: rgba(255, 255, 255, .8); box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.mc-river__water { stroke: rgba(11, 61, 110, .35); stroke-width: .6; }
.mc-river__current { fill: rgba(255, 255, 255, .13); }
.mc-river__grass { fill: none; stroke: rgba(43, 138, 62, .6); stroke-width: .8; }
.mc-river__reed { fill: none; stroke: #2b8a3e; stroke-width: 1.1; stroke-linecap: round; }
.mc-river__stone { fill: #adb5bd; stroke: #868e96; stroke-width: .5; }
.mc-river__flow--fast { animation-duration: 1s; opacity: .55; }
.mc-river__flow { fill: none; stroke: rgba(255, 255, 255, .7); stroke-width: 1.4; stroke-dasharray: 10 14; stroke-linecap: round; animation: mc-pipe-flow 1.4s linear infinite; }
.mc-river__flow--slow { animation-duration: 2.2s; opacity: .7; }
.mc-dam__ground { fill: #d9b98c; }
.mc-dam__surface { stroke: #a5d8ff; stroke-width: 1.5; }
.mc-dam__wall { stroke: #868e96; stroke-width: 1; }
.mc-dam__crest { fill: #adb5bd; }
.mc-dam__joint { stroke: rgba(0, 0, 0, .12); stroke-width: 1; }
.mc-dam__tail { fill: #74c0fc; }
.mc-flow__pipe { stroke: #868e96; stroke-width: 1; }
.mc-flow__arrows { fill: none; stroke: rgba(28, 126, 214, .0); stroke-width: 4; stroke-dasharray: 8 10; }
.mc-flow.is-run .mc-flow__arrows { stroke: rgba(28, 126, 214, .55); animation: mc-pipe-flow .9s linear infinite; }
.mc-flow__body { stroke: rgba(0, 0, 0, .25); stroke-width: 1; }
.mc-flow--treated .mc-flow__body { fill: #1c7ed6; }
.mc-flow--backwash .mc-flow__body { fill: #f08c00; }
.mc-flow__head { fill: #343a40; }
.mc-flow__lcd { fill: #c3fae8; }
.mc-flow__lcdarrow { fill: none; stroke: #2b8a3e; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mc-gauge__bezel { fill: #adb5bd; stroke: #495057; stroke-width: 2; }
.mc-gauge__face { fill: #f8f9fa; stroke: #ced4da; stroke-width: 1; }
.mc-gauge__band { fill: none; stroke-width: 5; }
.mc-gauge__band--ok { stroke: #40c057; } .mc-gauge__band--warn { stroke: #fab005; } .mc-gauge__band--high { stroke: #fa5252; }
.mc-gauge__tick { stroke: #343a40; stroke-width: 1.4; }
.mc-gauge__needle { fill: #e03131; }
.mc-gauge .is-none { opacity: .25; }
.mc-gauge__hub { fill: #343a40; }
@media (prefers-reduced-motion: reduce) { .mc-pump.is-run .mc-pump__imp, .mc-river__flow, .mc-flow.is-run .mc-flow__arrows { animation: none; } }
.mc-river__svg path, .mc-river__svg ellipse { vector-effect: non-scaling-stroke; }

/* ===== Mimic 3D (isometric) view + 2D / 3D switch ===== */
.mv-mode { display: inline-flex; padding: 2px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); }
.mv-mode__btn { border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: 12.5px; font-weight: 700; padding: 4px 12px; border-radius: 999px; cursor: pointer; }
.mv-mode__btn:hover { color: var(--text); }
.mv-mode__btn.is-on { background: var(--primary, #339af0); color: #fff; }
.mp-canvas.is-3d { background: transparent; border: 0; box-shadow: none; }
.mp3d__layer { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.mp3d__plane { fill: #e7f0f8; stroke: #b6c8d9; stroke-width: 1; }
.mp3d__side { fill: #c5d3e0; }
.mp3d__side--dark { fill: #a9bacb; }
.mp3d__grid { stroke: rgba(51, 102, 153, .12); stroke-width: 1; }
.mp3d__flat { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.mp3d__item { position: absolute; border-color: transparent !important; box-shadow: none !important; }
.mp3d__shadow { position: absolute; left: 18%; right: 18%; bottom: 9%; height: 8%; border-radius: 50%; background: rgba(0, 0, 0, .14); z-index: -1; }
:root[data-theme="dark"] .mp3d__plane, :root[data-theme="night"] .mp3d__plane { fill: #1c2733; stroke: #2f3f50; }
:root[data-theme="dark"] .mp3d__side, :root[data-theme="night"] .mp3d__side { fill: #121b24; }
:root[data-theme="dark"] .mp3d__side--dark, :root[data-theme="night"] .mp3d__side--dark { fill: #0d141b; }
:root[data-theme="dark"] .mp3d__grid, :root[data-theme="night"] .mp3d__grid { stroke: rgba(160, 190, 220, .08); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mp3d__plane { fill: #1c2733; stroke: #2f3f50; }
  :root:not([data-theme="light"]) .mp3d__side { fill: #121b24; }
  :root:not([data-theme="light"]) .mp3d__side--dark { fill: #0d141b; }
  :root:not([data-theme="light"]) .mp3d__grid { stroke: rgba(160, 190, 220, .08); }
}

.mp-canvas.is-3d {
    background-image: linear-gradient(to right, rgba(120, 140, 170, .16) 1px, transparent 1px), linear-gradient(to bottom, rgba(120, 140, 170, .16) 1px, transparent 1px);
    background-size: var(--mp-grid, 20px) var(--mp-grid, 20px);
}

.mp-canvas.is-3d:not(.is-preview) .mp3d__item, .mp-canvas.is-3d:not(.is-preview) .mp3d__flat { cursor: move; }
.mp-canvas.is-3d .mp3d__item.is-selected, .mp-canvas.is-3d .mp3d__flat.is-selected { outline: 2px dashed var(--primary, #339af0); outline-offset: 2px; }
.mp-canvas.is-3d.is-connecting .mp3d__item, .mp-canvas.is-3d.is-connecting .mp3d__flat { cursor: crosshair; }

/* 3D: labels stay readable (solid pill over pipes, minimum size, never clipped) */
.mp-canvas.is-3d .mp-comp__inner { overflow: visible; }
.mp-canvas.is-3d .mc-tank__title {
    position: relative; z-index: 2; align-self: center; width: auto; max-width: none; margin: 0 auto 2px;
    padding: 1px 7px; border-radius: 6px; white-space: nowrap; overflow: visible; text-overflow: clip;
    font-size: max(10px, 1em); font-weight: 700; line-height: 1.5; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong, var(--border)); box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.mp-canvas.is-3d .mc-value { position: relative; z-index: 2; font-size: max(9px, 1em); background: var(--surface); white-space: nowrap; }
.mp-canvas.is-3d .mc-state { position: relative; z-index: 2; font-size: max(8.5px, .75em); }
.mp-canvas.is-3d .mp3d__item:hover, .mp-canvas.is-3d .mp3d__item.is-selected { z-index: 5; }
/* 3D: title above / value below the drawing (outside the box), so the drawing keeps its full size */
.mp-canvas.is-3d .mc-tank { position: relative; justify-content: flex-end; gap: 0; }
.mp-canvas.is-3d .mc-tank__title { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin: 0 0 3px; }
.mp-canvas.is-3d .mc-tank .mc-value { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 2px; }
.mp-canvas.is-3d .mc-tank .mc-state { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 2px; }
.mp-canvas.is-3d .mc-tank:has(.mc-state) .mc-value { margin-top: 20px; }
.mp-canvas.is-3d .mc-tank__art { flex: 1 1 auto; min-height: 0; width: 100%; }

/* Mimic view, 3D: the grid fills the whole card (not only the scene box) */
.mv-scroll.is-3d {
    background-image: linear-gradient(to right, rgba(120, 140, 170, .16) 1px, transparent 1px), linear-gradient(to bottom, rgba(120, 140, 170, .16) 1px, transparent 1px);
    background-size: var(--mp-grid, 20px) var(--mp-grid, 20px);
}
.mv-scroll.is-3d .mp-canvas.is-3d { background-image: none; }
/* 3D: raised flat items (River) */
.mp3d__blockshadow { fill: rgba(0, 0, 0, .16); }
.mp3d__blockside { stroke: rgba(0, 0, 0, .18); stroke-width: .8; }
.mp3d__blockrim { fill: none; stroke: #2f9e44; stroke-width: 2; stroke-linejoin: round; }

.mp-source { margin: 2px 0 10px; padding: 8px 10px 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.mp-source__title { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

/* pipe with no flow (an end has no data / is offline / delayed / pump stopped): no animation, dimmed water */
.mc-pipe.is-idle .mc-pipe__water { opacity: .45; }

/* Mimic view: no page title row; the mimic card is the whole page (Back button lives in its header) */
main:has(#mvApp) > .page-header { display: none; }
.mv-back { flex: none; }
/* 3D pump: status pill on one line, value box stacked below it (no overlap) */
.mp-canvas.is-3d .mc-tank .mc-state { white-space: nowrap; line-height: 1.4; padding: 1px 8px; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.mp-canvas.is-3d .mc-tank:has(.mc-state) .mc-value { margin-top: calc(max(8.5px, .75em) * 1.4 + 8px); }

/* Mimic view: clickable values -> trend popup */
.mc-value--link { cursor: pointer; pointer-events: auto; transition: border-color .15s, box-shadow .15s; }
.mc-value--link:hover, .mc-value--link:focus-visible { border-color: var(--primary, #339af0); box-shadow: 0 0 0 2px rgba(51, 154, 240, .35); outline: none; }
.mv-trend { width: min(960px, calc(100vw - 32px)); height: min(620px, calc(100vh - 32px)); }
.mv-trend__ranges { display: flex; gap: 6px; flex-wrap: wrap; }
.mv-trend__period { font-size: 12.5px; }
.mv-trend__body { display: flex; flex-direction: column; padding: 12px 20px 16px; }
.mv-trend__chart { flex: 1; min-height: 260px; }
.mv-trend__stats { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.mv-trend__stats div { display: flex; flex-direction: column; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.mv-trend__stats span { font-size: 12px; color: var(--text-muted); }
.mv-trend__stats b { font-family: var(--font-mono); font-size: 15px; }
@media (max-width: 640px) { .mv-trend__stats { grid-template-columns: repeat(2, 1fr); } }

/* Tank water: rolling waves on the surface (tank-art.js) */
@keyframes ta-wave-l { to { transform: translateX(calc(-1 * var(--wl, 30px))); } }
@keyframes ta-wave-r { from { transform: translateX(calc(-1 * var(--wl, 30px))); } to { transform: translateX(0); } }
.ta-wave { stroke: none; }
.ta-wave--back { fill: #4dabf7; opacity: .75; animation: ta-wave-l 2.6s linear infinite; }
.ta-wave--front { fill: #339af0; opacity: .85; animation: ta-wave-r 1.8s linear infinite; }
.ta-surface { animation-duration: 2.2s; }
@keyframes ta-bob { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.65); } }
@media (prefers-reduced-motion: reduce) { .ta-wave--back, .ta-wave--front { animation: none; } }

/* square tanks: waves on the slanted faces (right face drifts the other way) */
.mc-sq__wave--r.ta-wave--back { animation-name: ta-wave-r; }
.mc-sq__wave--r.ta-wave--front { animation-name: ta-wave-l; }
.mc-sq__surface { animation: mc-sq-shimmer 2.8s ease-in-out infinite; }
@keyframes mc-sq-shimmer { 0%, 100% { opacity: .9; } 50% { opacity: .6; } }
/* pressure gauge: needle flicker + glare */
.mc-gauge__wobble { transform-box: view-box; animation: mc-gauge-wobble 1.6s ease-in-out infinite; }
@keyframes mc-gauge-wobble { 0%, 100% { transform: rotate(-2.5deg); } 30% { transform: rotate(1.8deg); } 55% { transform: rotate(-1deg); } 80% { transform: rotate(2.6deg); } }
.mc-gauge__glare { fill: rgba(255, 255, 255, .45); transform-box: view-box; transform-origin: 60px 56px; animation: mc-gauge-glare 5s ease-in-out infinite; }
@keyframes mc-gauge-glare { 0%, 100% { transform: rotate(-20deg); opacity: .25; } 50% { transform: rotate(25deg); opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .mc-gauge__wobble, .mc-gauge__glare, .mc-sq__surface { animation: none; } }

/* Mimic view: timestamps panel + highlight */
.mv-body { display: flex; min-height: 0; }
.mv-body .mv-scroll { flex: 1; min-width: 0; }
.mv-side { flex: none; width: 330px; display: flex; flex-direction: column; border-left: 1px solid var(--border); background: var(--surface); }
.mv-side[hidden] { display: none; }
.mv-side__head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.mv-side__title { margin: 0; font-size: 14px; font-weight: 700; }
.mv-side__scroll { flex: 1; min-height: 0; overflow: auto; }
.mv-side__table th, .mv-side__table td { padding: 7px 10px; font-size: 12.5px; vertical-align: top; }
.mv-side__table thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.mv-side__row { cursor: default; }
.mv-side__row:hover td, .mv-side__row:focus td { background: var(--primary-soft, rgba(51, 154, 240, .12)); }
.mv-side__row:focus { outline: none; }
.mv-side__name { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.mv-side__sub { margin-top: 2px; font-size: 11.5px; color: var(--text-muted); }
.mv-side__time { white-space: nowrap; }
.mv-side-toggle.is-on { border-color: var(--primary, #339af0); color: var(--primary, #339af0); }
.mp-canvas.has-hl .mp-comp:not(.is-hl) { opacity: .35; transition: opacity .15s; }
.mp-canvas.has-hl .mc-pipe { opacity: .35; }
.mp-comp.is-hl { opacity: 1; z-index: 6; outline: 3px solid var(--primary, #339af0); outline-offset: 4px; border-radius: 10px; animation: mv-hl 1.2s ease-in-out infinite; }
@keyframes mv-hl { 0%, 100% { outline-color: var(--primary, #339af0); } 50% { outline-color: rgba(51, 154, 240, .35); } }
@media (max-width: 900px) { .mv-body { flex-direction: column; } .mv-side { width: auto; height: auto !important; max-height: 320px; border-left: 0; border-top: 1px solid var(--border); } }
.mv-side__table td.num { white-space: nowrap; }

/* Tank overflow: realistic spill (tank-art.js overflowArt) */
.ta-lip { fill: none; stroke: #74c0fc; stroke-width: 4; stroke-linecap: round; opacity: .9; animation: ta-sheet 1.1s ease-in-out infinite; }
.ta-stream--streak { stroke: rgba(255, 255, 255, .7); stroke-width: 1.1; stroke-dasharray: 4 11; animation: ta-flow .4s linear infinite; }
.ta-fall { fill: #a5d8ff; transform-box: fill-box; transform-origin: center; opacity: 0; animation: ta-fall 0.9s cubic-bezier(.45, 0, .9, .6) infinite; }
@keyframes ta-fall { 0% { transform: translate(0, 0); opacity: 0; } 12% { opacity: .95; } 100% { transform: translate(var(--drift, 2px), var(--fall, 60px)); opacity: .2; } }
.ta-ripple { fill: none; stroke: rgba(116, 192, 252, .8); stroke-width: 1.2; transform-box: fill-box; transform-origin: center; opacity: 0; animation: ta-ripple 1.4s ease-out infinite; }
@keyframes ta-ripple { 0% { transform: scale(.25); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }
.ta-mist { fill: rgba(208, 235, 255, .55); transform-box: fill-box; transform-origin: center bottom; animation: ta-mist 1.2s ease-in-out infinite; }
@keyframes ta-mist { 0%, 100% { transform: scale(.7, .6); opacity: .25; } 50% { transform: scale(1.15, 1.2); opacity: .6; } }
.ta-splash { fill: #74c0fc; transform-box: fill-box; transform-origin: center; opacity: 0; animation: ta-splash .85s ease-out infinite; }
@keyframes ta-splash {
    0% { transform: translate(0, 0) scale(.6); opacity: 0; }
    15% { opacity: 1; }
    55% { transform: translate(calc(var(--dx) * .65), var(--dy)) scale(1); opacity: .95; }
    100% { transform: translate(var(--dx), 3px) scale(.5); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .ta-lip, .ta-fall, .ta-ripple, .ta-mist, .ta-splash, .ta-stream--streak { animation: none; } .ta-fall, .ta-splash, .ta-ripple { opacity: 0; } }

/* overflow all around the rim: foam, rivulets down the wall, drips, spray */
.ta-rim-sheet { fill: none; stroke: rgba(116, 192, 252, .55); stroke-width: 6; stroke-linecap: round; animation: ta-sheet 1.1s ease-in-out infinite; }
.ta-rim-foam { fill: none; stroke: rgba(255, 255, 255, .9); stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 3 5 8 4; animation: ta-flow .7s linear infinite; }
.ta-rivulet { fill: none; stroke: rgba(231, 245, 255, .75); stroke-width: 1.3; stroke-linecap: round; stroke-dasharray: 6 5; animation: ta-rivulet .6s linear infinite; }
.ta-rivulet--slow { stroke-width: 1; opacity: .7; animation-duration: .9s; }
@keyframes ta-rivulet { to { stroke-dashoffset: -11; } }
.ta-drip { fill: #e7f5ff; transform-box: fill-box; transform-origin: center; opacity: 0; animation: ta-drip 1.4s cubic-bezier(.5, 0, .9, .5) infinite; }
@keyframes ta-drip { 0% { transform: translateY(0) scale(.6); opacity: 0; } 15% { opacity: .95; transform: translateY(0) scale(1); } 100% { transform: translateY(var(--fall, 40px)) scale(.8); opacity: 0; } }
.ta-spray { fill: #e7f5ff; animation-duration: 1.1s; }
@media (prefers-reduced-motion: reduce) { .ta-rim-sheet, .ta-rim-foam, .ta-rivulet, .ta-drip, .ta-spray { animation: none; } .ta-drip, .ta-spray { opacity: 0; } }

/* Multi Trending: site + equipment options */
.site-combo__option--eq { align-items: center; }
.site-combo__name { display: flex; flex-direction: column; min-width: 0; }
.site-combo__eq { color: var(--text-muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* small "i" information badge with a hover / focus tooltip (text from data-tip; CSS only, CSP-safe) */
.info-tip { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; margin-left: 4px;
    border-radius: 50%; border: 1px solid var(--primary, #339af0); color: var(--primary, #339af0); font: italic 700 10px/1 Georgia, serif;
    cursor: help; vertical-align: 1px; }
.info-tip:hover, .info-tip:focus-visible { background: var(--primary, #339af0); color: #fff; outline: none; }
.info-tip::after { content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); z-index: 50;
    width: max-content; max-width: 260px; padding: 8px 10px; border-radius: 8px; background: #1f2937; color: #f1f3f5; box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
    font: 500 12px/1.45 var(--font, inherit); font-style: normal; text-align: left; white-space: normal; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .12s; }
.info-tip:hover::after, .info-tip:focus-visible::after { opacity: 1; visibility: visible; }

/* Tank View: Event / Status toggle chips */
.tv-bar .tv-chips-field { min-width: 0; }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 12px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font: inherit; font-size: 12.5px; font-weight: 700;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s; --fc: var(--primary, #339af0); }
.fchip:hover { border-color: var(--fc); color: var(--text); }
.fchip:focus-visible { outline: 2px solid var(--fc); outline-offset: 2px; }
.fchip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fc); }
.fchip__n { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-2); color: var(--text-muted); font-size: 11px; font-family: var(--font-mono); }
.fchip.is-on { color: var(--text); border-color: var(--fc); background: color-mix(in srgb, var(--fc) 16%, var(--surface)); box-shadow: inset 0 0 0 1px var(--fc); }
.fchip.is-on .fchip__n { background: var(--fc); color: #fff; }
.fchip.is-empty:not(.is-on) { opacity: .5; }
.fchip--all { padding: 0 14px; }
.fchip--all.is-on { --fc: var(--primary, #339af0); }
.fchip--alarm { --fc: #e03131; } .fchip--warn { --fc: #f59f00; } .fchip--nn { --fc: #1c7ed6; }
.fchip--online { --fc: var(--status-online, #2f9e44); } .fchip--delayed { --fc: var(--status-warning, #f59f00); }
.fchip--offline { --fc: var(--status-offline, #e03131); } .fchip--maintenance { --fc: #4dabf7; }

/* Sign-in: sun / moon switch + light (day) mode */
.orbit-mode { position: fixed; top: calc(var(--o-pad) * .8); right: calc(var(--o-panel) + var(--o-pad)); z-index: 80; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto; }
.orbit-mode__track { position: relative; display: block; width: 64px; height: 32px; border-radius: 999px; transition: background .5s, box-shadow .5s;
    background: linear-gradient(135deg, #0b1830, #1d3557); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18), 0 6px 18px rgba(0, 0, 0, .35); }
.orbit-mode__thumb { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
    background: #e9ecef; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); transition: transform .5s cubic-bezier(.22, .61, .36, 1), background .5s; }
.orbit-mode__thumb .icon { position: absolute; width: 15px; height: 15px; transition: opacity .4s, transform .5s; }
.orbit-mode__moon { color: #1d3557; }
.orbit-mode__sun { color: #fff; opacity: 0; transform: rotate(-90deg) scale(.6); }
.orbit-mode:hover .orbit-mode__track { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), 0 6px 20px rgba(0, 0, 0, .4); }
.orbit-mode:focus-visible { outline: 2px solid #74c0fc; outline-offset: 4px; border-radius: 999px; }
.orbit-mode[aria-pressed="true"] .orbit-mode__track { background: linear-gradient(135deg, #74c0fc, #a5d8ff); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6), 0 6px 18px rgba(30, 90, 140, .35); }
.orbit-mode[aria-pressed="true"] .orbit-mode__thumb { transform: translateX(32px); background: #fab005; box-shadow: 0 0 14px rgba(250, 176, 5, .8); }
.orbit-mode[aria-pressed="true"] .orbit-mode__moon { opacity: 0; transform: rotate(90deg) scale(.6); }
.orbit-mode[aria-pressed="true"] .orbit-mode__sun { opacity: 1; transform: none; }
@media (max-width: 900px) { .orbit-mode { right: var(--o-pad); } }

.orbit-body.orbit-day { background: radial-gradient(ellipse 80% 70% at 40% 45%, #f7fafc, #e3eaf1 70%, #d6dfe8); }
.orbit-body { transition: background .6s ease; }
.orbit-day .orbit-chrome { --o-ink: #0b2236; --o-dim: #3a5168; color: #0b2236; }
.orbit-day .orbit-chrome { text-shadow: 0 1px 10px rgba(255, 255, 255, .55); }
.orbit-day .orbit-mode { text-shadow: none; }
.orbit-day .orbit-head__brand { --sidebar-text-strong: #0b2236; }
.orbit-day .orbit-head__brand small { color: #06182a; font-weight: 800; text-shadow: 0 1px 6px rgba(255, 255, 255, .6); }
.orbit-day .orbit-bio p { color: rgba(11, 34, 54, .8); }
.orbit-day .orbit-cue s { background: rgba(11, 34, 54, .3); }
.orbit-day .orbit-cue s::after { background: #0b2236; }
.orbit-day .orbit-vig { background: radial-gradient(ellipse 88% 92% at 50% 50%, transparent 55%, rgba(10, 40, 70, .10) 82%, rgba(10, 40, 70, .28) 100%); }
.orbit-day .orbit-panel { --surface: #ffffff; --surface-2: #f1f5f9; --surface-hover: #e9eef4; --text: #0b2236; --text-muted: #51657a;
    --border: rgba(11, 34, 54, .14); --border-strong: rgba(11, 34, 54, .26); --primary: #1c7ed6; --primary-soft: rgba(28, 126, 214, .12); --primary-contrast: #fff;
    background: linear-gradient(180deg, rgba(255, 255, 255, .84), rgba(240, 246, 252, .92)); border-left-color: rgba(11, 34, 54, .12); }
.orbit-day .orbit-panel .login__eyebrow { color: #1c7ed6; background: rgba(28, 126, 214, .12); }
.orbit-day .orbit-panel .input--lg { background: rgba(255, 255, 255, .85); }
.orbit-day .orbit-panel .btn--primary.btn--lg { color: #fff; background: linear-gradient(135deg, #1c7ed6, #228be6 55%, #15aabf); }
.orbit-panel, .orbit-panel .input--lg, .orbit-head__brand small, .orbit-bio p { transition: background .6s, color .6s, border-color .6s; }

/* Sign-in: abstract ocean background with sun / moon (Scripts/login-bg.js) behind the sphere */
.orbit-bg { position: fixed; inset: 0; z-index: 1; display: block; pointer-events: none; }
