/* ==========================================================================
   Swiss Orbit - operator console design system
   Swiss Systems house palette (shared with Swiss VMS): navy ink, signal
   green, Inter Tight. Dark-first NOC surface with a light theme that is a
   genuine alternative, not an afterthought. Everything is token driven so a
   customer-branded portal only needs --orbit-accent overridden.
   ========================================================================== */

:root {
    /* Swiss Systems brand marks */
    --brand-navy: #282C68;
    --brand-blue: #5D6BA9;
    --brand-grey: #8A8A8A;

    /* house ink + signal green (identical values to Swiss VMS) */
    --ink: #001433;
    --ink-2: #0a2748;
    --ink-3: #143a6b;
    --green: #1f9d6b;
    --green-hi: #25b87d;
    --green-lo: #178556;

    --ok: #1f9d6b;
    --info: #2F6FED;
    --warn: #ffb100;
    --high: #f97316;
    --crit: #e85b6b;
    --idle: #66768b;
    --maint: #5D6BA9;

    --grad-green: linear-gradient(180deg, #1f9d6b 0%, #178556 100%);
    --grad-btn: linear-gradient(180deg, #1c9465 0%, #15794f 100%);
    --grad-navy: radial-gradient(120% 120% at 100% -10%, rgba(255,255,255,.06) 0, transparent 55%),
                 linear-gradient(180deg, #001433 0%, #052551 100%);
    --glow-green: 0 6px 20px rgba(31, 157, 107, .28);

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .28);
    --shadow: 0 8px 24px rgba(0, 0, 0, .32);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .45);

    --font-sans: 'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Mono', Consolas, monospace;

    --sidebar-w: 248px;
    --sidebar-w-collapsed: 68px;
    --topbar-h: 56px;
}

/* dark (default) */
:root, [data-theme="dark"] {
    --orbit-accent: #25b87d;
    --orbit-accent-strong: #1f9d6b;
    --orbit-accent-soft: rgba(37, 184, 125, .16);

    --bg: #08101f;
    --bg-alt: #0b1730;
    --surface: #0f1b36;
    --surface-2: #132244;
    --surface-3: #1a2d54;
    --border: #1e3157;
    --border-strong: #2a4273;
    --text: #edf2f9;
    --text-muted: #a7b6cd;
    --text-dim: #7b8ba4;
    --grid-line: rgba(167, 182, 205, .12);
    --ring: rgba(37, 184, 125, .35);
}

[data-theme="light"] {
    --orbit-accent: #178556;
    --orbit-accent-strong: #125f3e;
    --orbit-accent-soft: rgba(31, 157, 107, .12);

    --bg: #f3f6fa;
    --bg-alt: #eef2f7;
    --surface: #ffffff;
    --surface-2: #f6f8fb;
    --surface-3: #eef2f7;
    --border: #dde3ec;
    --border-strong: #c3cbd9;
    --text: #001433;
    --text-muted: #3b4a64;
    --text-dim: #66768b;
    --grid-line: rgba(0, 20, 51, .08);
    --ring: rgba(31, 157, 107, .22);
    --shadow-sm: 0 1px 0 rgba(0, 20, 51, .04), 0 1px 2px rgba(0, 20, 51, .04);
    --shadow: 0 6px 18px rgba(0, 20, 51, .06), 0 2px 4px rgba(0, 20, 51, .04);
    --shadow-lg: 0 18px 48px rgba(0, 20, 51, .12), 0 6px 12px rgba(0, 20, 51, .06);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

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

a { color: var(--orbit-accent); text-decoration: none; }
a:hover { color: var(--orbit-accent-strong); text-decoration: none; }

code, kbd, pre, .mono, .tabular { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ---------- shell ------------------------------------------------------- */

.orbit-shell { display: flex; min-height: 100vh; }

.orbit-sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--bg-alt);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: width .16s ease, flex-basis .16s ease;
    z-index: 40;
}

.orbit-shell.collapsed .orbit-sidebar { width: var(--sidebar-w-collapsed); flex-basis: var(--sidebar-w-collapsed); }
.orbit-shell.collapsed .nav-label,
.orbit-shell.collapsed .nav-section-title,
.orbit-shell.collapsed .brand-text { display: none; }
.orbit-shell.collapsed .orbit-nav a { justify-content: center; padding-inline: 0; }

.orbit-brand {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}

/* Swiss Systems ring mark - one asset, recoloured per surface */
.swiss-mark { display: block; width: 100%; height: 100%; }
.swiss-mark .m-a { fill: var(--brand-navy); }
.swiss-mark .m-b { fill: var(--brand-blue); }
[data-theme="dark"] .swiss-mark .m-a { fill: #ffffff; }
[data-theme="dark"] .swiss-mark .m-b { fill: #9fd4bc; }

.brand-mark {
    width: 32px; height: 32px; flex: 0 0 32px;
    display: grid; place-items: center;
}

.brand-text { font-weight: 650; letter-spacing: .2px; font-size: 15px; white-space: nowrap; }
.brand-text small { display: block; font-size: 10px; color: var(--text-dim); font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }

.orbit-nav { flex: 1 1 auto; overflow-y: auto; padding: 10px 8px 24px; }
.nav-section-title {
    font-size: 10px; text-transform: uppercase; letter-spacing: .13em;
    color: var(--text-dim); padding: 14px 10px 6px; font-weight: 600;
}

.orbit-nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 8px 10px; margin-bottom: 1px;
    border-radius: var(--radius-sm);
    color: var(--text-muted); font-weight: 500;
    white-space: nowrap; position: relative;
}
.orbit-nav a i { font-size: 15px; width: 18px; text-align: center; flex: 0 0 18px; }
.orbit-nav a:hover { background: var(--surface-2); color: var(--text); }
.orbit-nav a.active { background: var(--orbit-accent-soft); color: var(--orbit-accent); }
.orbit-nav a.active::before {
    content: ''; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3px;
    border-radius: 0 3px 3px 0; background: var(--orbit-accent);
}
.orbit-nav .nav-count {
    margin-left: auto; font-size: 11px; font-weight: 600;
    background: var(--surface-3); color: var(--text-muted);
    padding: 1px 7px; border-radius: 999px;
}
.orbit-nav .nav-count.crit { background: rgba(239, 68, 68, .18); color: var(--crit); }
.orbit-nav .nav-count.warn { background: rgba(234, 179, 8, .16); color: var(--warn); }

.orbit-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.orbit-topbar {
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 12px;
    padding: 0 18px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
}

.icon-btn {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    border: 1px solid transparent; background: transparent; color: var(--text-muted);
    display: inline-grid; place-items: center; cursor: pointer; font-size: 15px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.orbit-search { position: relative; flex: 0 1 380px; }
.orbit-search input {
    width: 100%; height: 34px; padding: 0 12px 0 32px;
    background: var(--surface); border: 1px solid var(--border); color: var(--text);
    border-radius: var(--radius-sm); font-size: 13px;
}
.orbit-search input:focus { outline: none; border-color: var(--orbit-accent); box-shadow: 0 0 0 3px var(--orbit-accent-soft); }
.orbit-search i { position: absolute; left: 10px; top: 9px; color: var(--text-dim); font-size: 14px; }
.orbit-search kbd {
    position: absolute; right: 8px; top: 7px; font-size: 10px; padding: 2px 5px;
    border: 1px solid var(--border); border-radius: 4px; color: var(--text-dim); background: var(--surface-2);
}

.orbit-content { padding: 18px 22px 40px; flex: 1 1 auto; }
.orbit-content.wide { padding-inline: 14px; }

.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; font-weight: 650; margin: 0 0 2px; letter-spacing: -.01em; }
.page-head .sub { color: var(--text-muted); font-size: 13px; margin: 0; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.breadcrumbs { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs .sep { opacity: .5; }

/* ---------- cards & panels --------------------------------------------- */

.card, .panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.panel-head {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.panel-head h2, .panel-head h3 { font-size: 13px; font-weight: 620; margin: 0; letter-spacing: .01em; }
.panel-head .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.panel-body { padding: 16px; }
.panel-body.tight { padding: 10px 12px; }
.panel-body.flush { padding: 0; }
.panel-foot { padding: 10px 16px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 12px; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1400px) { .grid.cols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1200px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
    .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-6 { grid-template-columns: minmax(0, 1fr); }
    .orbit-sidebar { position: fixed; left: 0; transform: translateX(-100%); }
    .orbit-shell.mobile-open .orbit-sidebar { transform: translateX(0); }
}

/* ---------- stat tiles -------------------------------------------------- */

.stat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden;
}
.stat .label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 660; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.stat .delta.up { color: var(--ok); }
.stat .delta.down { color: var(--crit); }
.stat .spark { position: absolute; right: 0; bottom: 0; left: 0; height: 34px; opacity: .55; }
.stat.accent-ok { border-left: 3px solid var(--ok); }
.stat.accent-warn { border-left: 3px solid var(--warn); }
.stat.accent-crit { border-left: 3px solid var(--crit); }
.stat.accent-info { border-left: 3px solid var(--info); }
.stat.accent-idle { border-left: 3px solid var(--idle); }

/* ---------- pills, badges, states -------------------------------------- */

.pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
    border: 1px solid transparent; white-space: nowrap;
}
.pill i { font-size: 11px; }
.pill.ok { background: rgba(31, 157, 107, .14); color: var(--ok); border-color: rgba(31, 157, 107, .30); }
.pill.info { background: rgba(47, 111, 237, .13); color: var(--info); border-color: rgba(47, 111, 237, .30); }
.pill.warn { background: rgba(255, 177, 0, .15); color: var(--warn); border-color: rgba(255, 177, 0, .32); }
.pill.high { background: rgba(249, 115, 22, .14); color: var(--high); border-color: rgba(249, 115, 22, .3); }
.pill.crit { background: rgba(232, 91, 107, .15); color: var(--crit); border-color: rgba(232, 91, 107, .34); }
.pill.idle { background: rgba(102, 118, 139, .16); color: var(--idle); border-color: rgba(102, 118, 139, .32); }
.pill.maint { background: rgba(93, 107, 169, .15); color: var(--maint); border-color: rgba(93, 107, 169, .34); }
.pill.plain { background: var(--surface-3); color: var(--text-muted); border-color: var(--border); }

/* light theme: pill labels sit on near-white, so use the deeper step of each
   house hue for the text while the fill keeps the bright signal colour */
[data-theme="light"] .pill.ok { color: #178556; }
[data-theme="light"] .pill.warn { color: #9a6700; }
[data-theme="light"] .pill.high { color: #c2410c; }
[data-theme="light"] .pill.crit { color: #b8354a; }
[data-theme="light"] .pill.maint { color: #4a5891; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 8px; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(234, 179, 8, .18); }
.dot.crit { background: var(--crit); box-shadow: 0 0 0 3px rgba(239, 68, 68, .2); }
.dot.idle { background: var(--idle); }
.dot.maint { background: var(--maint); }
.dot.live { animation: pulse 2s ease-in-out infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.sev-bar { width: 3px; border-radius: 3px; align-self: stretch; }
.sev-bar.crit { background: var(--crit); }
.sev-bar.high { background: var(--high); }
.sev-bar.warn { background: var(--warn); }
.sev-bar.info { background: var(--info); }

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

.orbit-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.orbit-table thead th {
    position: sticky; top: 0; z-index: 2;
    background: var(--surface-2); color: var(--text-dim);
    font-size: 11px; font-weight: 640; letter-spacing: .06em; text-transform: uppercase;
    padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.orbit-table thead th.sortable { cursor: pointer; user-select: none; }
.orbit-table thead th.sortable:hover { color: var(--text); }
.orbit-table tbody td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.orbit-table tbody tr:hover td { background: var(--surface-2); }
.orbit-table tbody tr.selected td { background: var(--orbit-accent-soft); }
.orbit-table tbody tr:last-child td { border-bottom: none; }
.orbit-table td.num, .orbit-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.orbit-table td.shrink { width: 1%; white-space: nowrap; }
.orbit-table .row-link { color: var(--text); font-weight: 550; }
.orbit-table .row-link:hover { color: var(--orbit-accent); }
.table-wrap { overflow-x: auto; }
.table-scroll { max-height: 520px; overflow-y: auto; }

.meter { height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 64px; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--ok); transition: width .3s ease; }
.meter > span.warn { background: var(--warn); }
.meter > span.crit { background: var(--crit); }

.empty {
    padding: 48px 20px; text-align: center; color: var(--text-dim);
}
.empty i { font-size: 30px; display: block; margin-bottom: 10px; opacity: .5; }

/* ---------- forms & buttons -------------------------------------------- */

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 32px; padding: 0 12px;
    border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
    background: var(--surface-2); color: var(--text);
    font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap;
    transition: background .12s ease, border-color .12s ease, transform .06s ease;
}
.btn:hover { background: var(--surface-3); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .5; pointer-events: none; }
.btn i { font-size: 14px; }
.btn.primary { background: var(--grad-btn); border-color: #15794f; color: #ffffff; font-weight: 600; box-shadow: var(--glow-green); }
.btn.primary:hover { background: linear-gradient(180deg, #23a673 0%, #1a8a5b 100%); border-color: #1a8a5b; }
.btn.danger { background: rgba(239, 68, 68, .12); border-color: rgba(239, 68, 68, .4); color: #fca5a5; }
.btn.danger:hover { background: rgba(239, 68, 68, .2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn.lg { height: 38px; padding: 0 16px; font-size: 14px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn.active { background: var(--orbit-accent-soft); color: var(--orbit-accent); border-color: var(--orbit-accent); z-index: 1; }

.form-row { margin-bottom: 14px; }
.form-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.field-hint { font-size: 11.5px; color: var(--text-dim); margin-top: 4px; }
.form-control, .form-select, textarea.form-control {
    width: 100%; min-height: 34px; padding: 6px 10px;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit;
}
textarea.form-control { min-height: 90px; }
.form-control:focus, .form-select:focus {
    outline: none; border-color: var(--orbit-accent); box-shadow: 0 0 0 3px var(--orbit-accent-soft);
}
.form-control::placeholder { color: var(--text-dim); }
.form-control.mono { font-family: var(--font-mono); font-size: 12.5px; }
.field-validation-error, .validation-summary-errors { color: #fca5a5; font-size: 12px; margin-top: 4px; }
.input-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); margin-bottom: 8px; }
.input-check input[type=checkbox], .input-check input[type=radio] { width: 15px; height: 15px; accent-color: var(--orbit-accent-strong); }

.filter-bar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 10px 12px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); margin-bottom: 14px;
}
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 150px; height: 30px; font-size: 12.5px; }
.filter-bar .spacer { margin-left: auto; }

/* ---------- tabs -------------------------------------------------------- */

.orbit-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.orbit-tabs a {
    padding: 8px 13px; font-size: 13px; font-weight: 550; color: var(--text-muted);
    border-bottom: 2px solid transparent; white-space: nowrap;
}
.orbit-tabs a:hover { color: var(--text); }
.orbit-tabs a.active { color: var(--orbit-accent); border-bottom-color: var(--orbit-accent); }
.orbit-tabs .count { font-size: 11px; color: var(--text-dim); margin-left: 4px; }

/* ---------- terminal & console ----------------------------------------- */

.terminal {
    background: #05080f; border: 1px solid var(--border); border-radius: var(--radius);
    font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; color: #d8e2f0;
    padding: 12px 14px; height: 460px; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
}
.terminal .t-err { color: #fca5a5; }
.terminal .t-cmd { color: var(--orbit-accent); }
.terminal .t-sys { color: var(--text-dim); font-style: italic; }
.terminal-input {
    display: flex; align-items: center; gap: 8px; margin-top: 8px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 10px;
}
.terminal-input span.prompt { color: var(--orbit-accent); font-family: var(--font-mono); font-size: 13px; }
.terminal-input input {
    flex: 1; background: transparent; border: none; outline: none; color: var(--text);
    font-family: var(--font-mono); font-size: 13px; height: 36px;
}

.log-view {
    background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-family: var(--font-mono); font-size: 12px; padding: 10px 12px;
    max-height: 380px; overflow: auto; white-space: pre-wrap; color: var(--text-muted);
}

/* ---------- timeline ---------------------------------------------------- */

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 1px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before {
    content: ''; position: absolute; left: -20px; top: 5px; width: 9px; height: 9px;
    border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong);
}
.timeline-item.crit::before { border-color: var(--crit); }
.timeline-item.ok::before { border-color: var(--ok); }
.timeline-item .when { font-size: 11.5px; color: var(--text-dim); }
.timeline-item .what { font-size: 13px; }

/* ---------- toasts & overlays ------------------------------------------ */

#orbit-toasts { position: fixed; right: 18px; bottom: 18px; z-index: 1080; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast-item {
    background: var(--surface); border: 1px solid var(--border-strong); border-left-width: 3px;
    border-radius: var(--radius-sm); box-shadow: var(--shadow);
    padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start;
    animation: toast-in .18s ease-out;
}
.toast-item.crit { border-left-color: var(--crit); }
.toast-item.warn { border-left-color: var(--warn); }
.toast-item.ok { border-left-color: var(--ok); }
.toast-item.info { border-left-color: var(--info); }
.toast-item .t-title { font-weight: 600; font-size: 13px; }
.toast-item .t-body { font-size: 12.5px; color: var(--text-muted); }
.toast-item .t-close { margin-left: auto; cursor: pointer; color: var(--text-dim); }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 92vw);
    background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
    z-index: 1060; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .18s ease;
}
.drawer.open { transform: none; }
.drawer-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; }
.drawer-foot { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.scrim { position: fixed; inset: 0; background: rgba(2, 6, 16, .6); z-index: 1050; opacity: 0; pointer-events: none; transition: opacity .18s ease; }
.scrim.show { opacity: 1; pointer-events: auto; }

/* ---------- charts ------------------------------------------------------ */

.chart-box { position: relative; height: 240px; }
.chart-box.sm { height: 150px; }
.chart-box.lg { height: 340px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.chart-legend .key { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .swatch { width: 9px; height: 9px; border-radius: 2px; }

/* wallboard mode: bigger type, no chrome, for a NOC screen on the wall */
body.wallboard { font-size: 16px; }
body.wallboard .orbit-sidebar, body.wallboard .orbit-topbar { display: none; }
body.wallboard .stat .value { font-size: 40px; }
body.wallboard .orbit-content { padding: 24px; }

.health-ring { --pct: 100; width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; position: relative;
    background: conic-gradient(var(--ring-colour, var(--ok)) calc(var(--pct) * 1%), var(--surface-3) 0); }
.health-ring::after { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.health-ring span { position: relative; z-index: 1; font-weight: 660; font-size: 19px; font-variant-numeric: tabular-nums; }

.kv { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--text-dim); font-weight: 500; }
.kv dd { margin: 0; color: var(--text); }

.copyable { cursor: pointer; border-bottom: 1px dashed var(--border-strong); }
.copyable:hover { color: var(--orbit-accent); }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
@media (max-width: 1200px) { .split { grid-template-columns: minmax(0, 1fr); } }

.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.nowrap { white-space: nowrap; }
.text-ok { color: var(--ok); } .text-warn { color: var(--warn); } .text-crit { color: var(--crit); } .text-high { color: var(--high); }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.flex { display: flex; } .flex-col { flex-direction: column; } .items-center { align-items: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.ml-auto { margin-left: auto; }
.w-100 { width: 100%; }
.small { font-size: 12px; }
.fw-600 { font-weight: 600; }

/* Names a table (or any region) for assistive tech without changing the visual design.
   Panels whose <caption> would only repeat the .panel-head heading use this. */
.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;
}

/* Grid row selection. One class for every bulk-action checkbox in the console so the
   accent colour matches the checkboxes inside .input-check rather than the browser default. */
.orbit-table .row-pick { width: 15px; height: 15px; accent-color: var(--orbit-accent-strong); cursor: pointer; }
.orbit-table thead th .row-pick { vertical-align: middle; }

/* ==========================================================================
   People, deep telemetry, maintenance routines and the screen viewer.
   Everything below is built from the same tokens as the rest of the sheet —
   no new colours, only new shapes.
   ========================================================================== */

/* ---------- section heading between panel groups ------------------------ */

.section-title {
    font-size: 11px; text-transform: uppercase; letter-spacing: .13em;
    color: var(--text-dim); font-weight: 650;
    margin: 20px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}

/* ---------- avatars ------------------------------------------------------ */

.orbit-avatar {
    width: 28px; height: 28px; flex: 0 0 28px;
    border-radius: 50%; display: inline-grid; place-items: center;
    font-size: 11px; font-weight: 700; color: #041018; letter-spacing: .02em;
    text-transform: uppercase; user-select: none;
}
.orbit-avatar.lg { width: 46px; height: 46px; flex-basis: 46px; font-size: 16px; }
.orbit-avatar.sm { width: 22px; height: 22px; flex-basis: 22px; font-size: 9px; }
.orbit-avatar.stacked { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }
.orbit-avatar.stacked:first-child { margin-left: 0; }

/* A row for a sign-in outside the customer's working hours. Tinted, not shouted:
   after-hours is a fact worth noticing, not an alert. */
.orbit-table tbody tr.after-hours td { background: rgba(234, 179, 8, .05); }
.orbit-table tbody tr.after-hours:hover td { background: rgba(234, 179, 8, .1); }

/* ---------- working-window histogram ------------------------------------ */

.hour-histogram { display: flex; align-items: flex-end; gap: 2px; height: 56px; }
.hour-histogram .hour {
    flex: 1 1 0; min-width: 0; background: var(--surface-3); border-radius: 2px 2px 0 0;
    position: relative; transition: background .12s ease;
}
.hour-histogram .hour.busy { background: var(--orbit-accent); }
.hour-histogram .hour.quiet { background: var(--orbit-accent-soft); }
.hour-histogram .hour.outside { background: rgba(234, 179, 8, .45); }
.hour-scale { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-dim); margin-top: 3px; }

/* ---------- per-core small multiples ------------------------------------ */

.core-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.core-cell { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px 4px; background: var(--surface-2); }
.core-title { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 2px; }
.core-canvas { position: relative; height: 74px; }

/* ---------- maintenance task builder ------------------------------------ */

.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-card {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface-2); overflow: hidden;
}
.task-card.disabled { opacity: .55; }
.task-card-head {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer;
    border-bottom: 1px solid transparent;
}
.task-card.open .task-card-head { border-bottom-color: var(--border); }
.task-card-head:hover { background: var(--surface-3); }
.task-order {
    width: 22px; height: 22px; flex: 0 0 22px; border-radius: 6px;
    background: var(--surface-3); color: var(--text-muted);
    display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.task-title { font-weight: 600; font-size: 13px; }
.task-sub { font-size: 11.5px; color: var(--text-dim); }
.task-card-body { padding: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.task-card-body .full { grid-column: 1 / -1; }
@media (max-width: 900px) { .task-card-body { grid-template-columns: minmax(0, 1fr); } }

.task-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 8px; }
.task-option {
    text-align: left; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface-2); padding: 9px 11px; cursor: pointer; color: var(--text);
}
.task-option:hover { border-color: var(--orbit-accent); background: var(--surface-3); }
.task-option .t-name { font-weight: 600; font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.task-option .t-desc { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; line-height: 1.35; }

.chip-set { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-set label {
    display: inline-flex; align-items: center; gap: 5px;
    border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px;
    font-size: 12px; cursor: pointer; background: var(--surface-2);
}
.chip-set label:has(input:checked) {
    border-color: var(--orbit-accent); background: var(--orbit-accent-soft); color: var(--orbit-accent);
}
.chip-set input { accent-color: var(--orbit-accent-strong); width: 13px; height: 13px; }

.expr-help {
    background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 10px 12px; font-size: 12px; color: var(--text-muted); margin-top: 6px;
}
.expr-help code { color: var(--orbit-accent); font-size: 11.5px; }
.expr-help dl { display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: 3px 12px; margin: 6px 0 0; }
.expr-help dt { font-family: var(--font-mono); font-size: 11.5px; color: var(--orbit-accent); }
.expr-help dd { margin: 0; }

/* ---------- remote-control viewer --------------------------------------- */

.rc-stage {
    position: relative; background: #05080f;
    border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; min-height: 420px;
    display: flex; align-items: center; justify-content: center;
}
.rc-stage.fit { }
.rc-stage.actual { overflow: auto; align-items: flex-start; justify-content: flex-start; }
.rc-stage:focus-within { border-color: var(--orbit-accent); box-shadow: 0 0 0 3px var(--orbit-accent-soft); }
.rc-stage canvas.rc-screen { display: block; image-rendering: auto; outline: none; cursor: default; }
.rc-stage.fit canvas.rc-screen { max-width: 100%; max-height: calc(100vh - 260px); }
.rc-stage.grabbing canvas.rc-screen { cursor: grabbing; }
.rc-stage.dropping::after {
    content: 'Release to send this file to the endpoint';
    position: absolute; inset: 0; z-index: 6;
    background: var(--orbit-accent-soft); border: 2px dashed var(--orbit-accent);
    display: grid; place-items: center; color: var(--orbit-accent);
    font-weight: 600; font-size: 15px; pointer-events: none;
}

.rc-cursor {
    position: absolute; width: 14px; height: 20px; pointer-events: none; z-index: 4;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .8));
}

.rc-hud {
    position: absolute; left: 10px; bottom: 10px; z-index: 5;
    display: flex; gap: 10px; align-items: center;
    background: rgba(5, 8, 15, .82); border: 1px solid var(--border-strong);
    border-radius: 999px; padding: 4px 12px;
    font-family: var(--font-mono); font-size: 11px; color: var(--text-muted);
    backdrop-filter: blur(6px);
}
.rc-hud b { color: var(--text); font-weight: 600; }
.rc-hud .sep { opacity: .35; }
.rc-hud.warn { border-color: rgba(234, 179, 8, .5); color: var(--warn); }

.rc-overlay {
    position: absolute; inset: 0; z-index: 8;
    background: rgba(5, 8, 15, .9); backdrop-filter: blur(3px);
    display: grid; place-items: center; text-align: center; padding: 32px;
}
.rc-overlay .box { max-width: 460px; }
.rc-overlay i.glyph { font-size: 38px; display: block; margin-bottom: 12px; color: var(--orbit-accent); }
.rc-overlay h3 { margin: 0 0 6px; font-size: 17px; font-weight: 640; color: var(--text); }
.rc-overlay p { margin: 0 0 14px; color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.rc-overlay.crit i.glyph { color: var(--crit); }
.rc-overlay.warn i.glyph { color: var(--warn); }
.rc-overlay.ok i.glyph { color: var(--ok); }

.rc-spinner {
    width: 34px; height: 34px; margin: 0 auto 14px;
    border: 3px solid var(--surface-3); border-top-color: var(--orbit-accent);
    border-radius: 50%; animation: rc-spin .9s linear infinite;
}
@keyframes rc-spin { to { transform: rotate(360deg); } }

.rc-toolbar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 8px 10px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); margin-bottom: 10px;
}
.rc-toolbar .spacer { margin-left: auto; }
.rc-toolbar .form-select { width: auto; height: 28px; font-size: 12.5px; }
.rc-toolbar .rc-timer { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); }

.rc-stage:fullscreen, .rc-stage:-webkit-full-screen {
    border-radius: 0; border: none; min-height: 100vh; background: #000;
}
.rc-stage:fullscreen canvas.rc-screen { max-height: 100vh; }

.rc-scrub { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.rc-scrub input[type=range] { flex: 1; accent-color: var(--orbit-accent-strong); }
.rc-scrub .time { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); min-width: 96px; }

/* ---------- signed-in board --------------------------------------------- */

.presence-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.presence-card {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface-2); padding: 10px 12px;
    display: flex; gap: 10px; align-items: flex-start;
}
.presence-card .who { min-width: 0; flex: 1; }
.presence-card .name { font-weight: 600; font-size: 13px; }
.presence-card .meta { font-size: 11.5px; color: var(--text-dim); }

/* failed run output - keeps the log mono treatment, flags it as an error */
.log-view.error { border-color: rgba(232, 91, 107, .4); color: var(--crit); }

/* transient page-level messages, one treatment everywhere they appear */
.flash {
    display: flex; gap: 9px; align-items: flex-start;
    padding: 11px 14px; margin-bottom: 14px;
    border: 1px solid var(--border); border-left-width: 3px;
    border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
    font-size: 13px; line-height: 1.45;
}
.flash > i { font-size: 14px; margin-top: 1px; }
.flash.ok { border-left-color: var(--ok); background: rgba(31, 157, 107, .09); }
.flash.ok > i { color: var(--ok); }
.flash.warn { border-left-color: var(--warn); background: rgba(255, 177, 0, .1); }
.flash.warn > i { color: var(--warn); }
.flash.crit { border-left-color: var(--crit); background: rgba(232, 91, 107, .1); }
.flash.crit > i { color: var(--crit); }
