/* Canopyd Ops Console — design tokens + shell.
   Recreated from docs/Canopyd.dc.html + docs/screens (the fidelity target).
   Non-negotiables: dark #080b10 canvas, cyan #00e5d4 accent, Space Grotesk UI +
   JetBrains Mono numerics, #0d121a cards with hairline borders (no drop shadows). */

:root {
    /* surfaces */
    --bg:       #080b10;   /* app canvas               */
    --panel:    #0d121a;   /* cards / panels           */
    --inset:    #0a0e14;   /* inputs / sidebar         */
    --code:     #07090d;   /* terminal / code inset    */

    /* text ramp */
    --text:     #dfe7ef;
    --text-2:   #cdd6e0;
    --muted:    #aeb9c7;
    --dim:      #8a97a8;
    --faint:    #5a6675;
    --faintest: #46505e;

    /* hairlines */
    --line:        rgba(125,148,176,0.12);
    --line-strong: rgba(125,148,176,0.18);
    --line-soft:   rgba(125,148,176,0.06);

    /* accent (cyan) */
    --ac:      #00e5d4;
    --ac-dim:  rgba(0,229,212,0.13);
    --ac-soft: rgba(0,229,212,0.30);
    --ac-ink:  #04201d;    /* text on cyan fill */

    /* status */
    --green:    #2fd98a;
    --amber:    #f5b03e;
    --red:      #fb5a6a;
    --red-text: #fb8590;
    --purple:   #8b9cf7;

    /* fonts */
    --ui:   'Space Grotesk', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    --radius: 12px;

    /* ---- legacy aliases (still referenced by Servers/Users/Login/forms) ---- */
    --panel-2: var(--inset);
    --ink:     var(--text);
    --ink-dim: var(--dim);
    --teal:    var(--green);
    --danger:  var(--red);
    --ok:      var(--green);
    --info:    var(--purple);
    --accent:  var(--ac);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 var(--ui);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--ac); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.mono { font-family: var(--mono); }
.muted { color: var(--dim); }
.err { color: var(--red); }
.warn { color: var(--amber); font-weight: 600; }

::selection { background: var(--ac-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(125,148,176,0.18); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(125,148,176,0.30); }
::-webkit-scrollbar-track { background: transparent; }

@keyframes cpulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes cring  { 0% { transform: scale(.8); opacity: .7; } 100% { transform: scale(2.6); opacity: 0; } }
@keyframes csweep { 0% { transform: translateX(-120%); } 100% { transform: translateX(420%); } }
@keyframes cspin  { to { transform: rotate(360deg); } }

/* ============================================================= *
 *  APP SHELL
 * ============================================================= */
.app-shell { display: flex; min-height: 100vh; }

/* ---- sidebar ---- */
.sidebar {
    width: 240px; flex: none;
    background: var(--inset);
    border-right: 1px solid rgba(125,148,176,0.1);
    display: flex; flex-direction: column;
    padding: 20px 14px;
    position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.side-brand .wordmark { font-size: 16.5px; font-weight: 700; letter-spacing: .04em; }
.side-label {
    font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
    color: var(--faintest); text-transform: uppercase; padding: 0 10px 10px;
}
.nav-item {
    display: flex; align-items: center; gap: 8px;
    width: 100%; text-align: left;
    padding: 9px 12px; margin-bottom: 2px;
    border: none; border-left: 2px solid transparent; border-radius: 8px;
    background: transparent; color: var(--dim);
    font: 500 13.5px var(--ui); cursor: pointer;
    transition: background .15s, color .15s;
}
.nav-item:hover { color: var(--text-2); background: rgba(125,148,176,0.05); text-decoration: none; }
.nav-item.active {
    color: var(--ac); background: var(--ac-dim);
    border-left-color: var(--ac); border-radius: 0 8px 8px 0;
}
.nav-item .nav-grow { flex: 1; }
.nav-badge {
    flex: none; min-width: 18px; padding: 1px 6px; border-radius: 999px;
    font: 600 10.5px var(--mono); text-align: center;
    background: rgba(251,90,106,0.14); color: var(--red-text);
}
.nav-badge.is-hidden { display: none; }
.nav-item.is-disabled {
    color: var(--faintest); cursor: default; pointer-events: none;
}
.nav-badge--soon {
    background: rgba(125,148,176,0.12); color: var(--faint);
    font-weight: 500; letter-spacing: .04em;
}

.persona {
    display: flex; align-items: center; gap: 11px;
    padding: 11px; border-radius: 10px;
    background: var(--panel); border: 1px solid rgba(125,148,176,0.1);
}
.avatar {
    width: 34px; height: 34px; flex: none; border-radius: 8px;
    background: linear-gradient(135deg, var(--ac), #0a6b63);
    display: flex; align-items: center; justify-content: center;
    color: var(--ac-ink); font-weight: 700; font-size: 13px;
}
.persona .who { min-width: 0; }
.persona .who .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.persona .who .role { font-family: var(--mono); font-size: 10px; color: var(--ac); letter-spacing: .06em; }
.icon-btn {
    flex: none; width: 28px; height: 28px; border-radius: 7px;
    border: 1px solid var(--line-strong); background: transparent;
    color: var(--dim); cursor: pointer; font-size: 13px;
    display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--text); border-color: rgba(125,148,176,0.3); text-decoration: none; }

/* ---- main column ---- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.nav-backdrop { display: none; }
.nav-toggle { display: none; flex: none; width: 34px; height: 34px; border-radius: 8px;
              border: 1px solid var(--line-strong); background: var(--panel); color: var(--text);
              cursor: pointer; font-size: 15px; line-height: 1; }
.nav-toggle:hover { border-color: rgba(125,148,176,0.3); }

@media (max-width: 960px) {
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .sidebar { position: fixed; top: 0; left: 0; height: 100vh; z-index: 60;
               transform: translateX(-100%); transition: transform .2s ease; }
    .app-shell.nav-open .sidebar { transform: none; box-shadow: 0 30px 80px rgba(0,0,0,0.6); }
    .app-shell.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(4,7,11,0.6); }
}

.topbar { border-bottom: 1px solid rgba(125,148,176,0.1); background: rgba(10,14,20,0.6); }
.topbar-row { display: flex; align-items: center; gap: 16px; padding: 15px 26px 13px; }
.page-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.page-crumb { font-family: var(--mono); font-size: 11px; color: var(--faint); letter-spacing: .04em; }
.topbar-spacer { flex: 1; }

.tb-pill {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 13px; border-radius: 8px;
    background: var(--panel); border: 1px solid var(--line-strong);
    font-family: var(--mono); font-size: 12px; color: var(--dim);
}
.tb-pill .spin { animation: cspin 8s linear infinite; }
.tb-pill .accent { color: var(--ac); }
.tb-clock {
    font-family: var(--mono); font-size: 13px; color: var(--text);
    letter-spacing: .04em; padding: 7px 12px; border-radius: 8px;
    background: var(--panel); border: 1px solid var(--line-strong);
}
.tb-fail {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 13px; border-radius: 8px;
    background: rgba(251,90,106,0.1); border: 1px solid rgba(251,90,106,0.28);
    font-family: var(--mono); font-size: 12px; color: var(--red-text);
}
.tb-fail.is-hidden { display: none; }
.tb-fail .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: cpulse 1.8s ease-in-out infinite; }

.site-row { display: flex; align-items: center; gap: 8px; padding: 0 26px 14px; flex-wrap: wrap; }
.site-row .lbl {
    font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
    text-transform: uppercase; color: var(--faint); margin-right: 3px;
}
.site-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 12px; border-radius: 9px;
    background: var(--panel); border: 1px solid var(--line-strong);
    color: var(--text-2); font-size: 12.5px; cursor: pointer;
}
.site-chip:hover { border-color: rgba(125,148,176,0.3); text-decoration: none; }
.site-chip.active { background: var(--ac-dim); border-color: var(--ac-soft); color: var(--ac); }
.site-chip .count {
    font-family: var(--mono); font-size: 10.5px; padding: 1px 6px; border-radius: 5px;
    background: rgba(125,148,176,0.12); color: var(--dim);
}
.site-chip.active .count { background: var(--ac); color: var(--ac-ink); }

/* ---- scroll / content ---- */
.scroll { flex: 1; position: relative; }
.content-pad { position: relative; padding: 24px 26px 40px; display: flex; flex-direction: column; gap: 18px; }

/* unauthenticated (login) centering */
.bare-main { min-height: 100vh; display: flex; align-items: center; justify-content: center;
             background: radial-gradient(1200px 600px at 70% -10%, rgba(0,229,212,0.06), transparent 60%), var(--bg); }

/* ============================================================= *
 *  CARDS / SECTIONS
 * ============================================================= */
.card { border-radius: 14px; border: 1px solid var(--line); background: var(--panel); }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-head .title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.section-head .rule { flex: 1; height: 1px; background: rgba(125,148,176,0.1); }

/* ---- gauges row ---- */
.gauge-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: stretch; }
.gauge-card {
    flex: 1 1 170px; min-width: 160px;
    border-radius: 14px; border: 1px solid var(--line); background: var(--panel);
    padding: 18px; display: flex; flex-direction: column; align-items: center;
}
.card-label {
    font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
    text-transform: uppercase; color: var(--dim); align-self: flex-start;
}
.gauge-wrap { position: relative; width: 130px; height: 130px; margin: 8px 0; }
.gauge-face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-num { font-size: 34px; font-weight: 700; line-height: 1; }
.gauge-unit { font-family: var(--mono); font-size: 10px; color: var(--faint); }
.gauge-sub { font-size: 11.5px; color: var(--faint); }

.fleet-load {
    flex: 3 1 320px; min-width: 300px;
    border-radius: 14px; border: 1px solid var(--line); background: var(--panel);
    padding: 18px; display: flex; flex-direction: column;
}
.fleet-load-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.fleet-load-head .avg { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ac); }
.fleet-load-body { flex: 1; min-height: 120px; position: relative; }

/* ---- fleet status wall ---- */
.fleet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; align-items: start; }
.tile {
    border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
    padding: 14px; display: block; text-align: left; cursor: pointer; color: inherit;
    transition: border-color .15s, background .15s;
}
.tile:hover { border-color: rgba(125,148,176,0.28); background: #0f1622; text-decoration: none; }
.tile-head { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; }
.tile-head .host { font-family: var(--mono); font-size: 12px; color: var(--text); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sub { font-family: var(--mono); font-size: 10px; color: var(--faint); margin: -6px 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* circular status indicator (fleet tiles + panels). `.dot` is reserved for the
   WoL text-pill that wakeDevices.js drives, so the circle uses `.ind`. */
.ind { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.ind-7 { width: 7px; height: 7px; }
.ind-6 { width: 6px; height: 6px; }
.ind--green { background: var(--green); box-shadow: 0 0 7px var(--green); }
.ind--amber { background: var(--amber); box-shadow: 0 0 7px var(--amber); }
.ind--red   { background: var(--red);   box-shadow: 0 0 7px var(--red); }
.ind--cyan  { background: var(--ac);    box-shadow: 0 0 7px var(--ac); }
.ind--dim   { background: var(--faint); }
.svc-pill {
    flex: none; font-family: var(--mono); font-size: 9.5px; padding: 2px 7px; border-radius: 5px;
    background: rgba(47,217,138,0.1); color: var(--green); border: 1px solid rgba(47,217,138,0.22);
}
.svc-pill--bad { background: rgba(245,176,62,0.1); color: var(--amber); border-color: rgba(245,176,62,0.25); }
.metric-row { display: flex; justify-content: space-between; margin-bottom: 3px; }
.metric-row .k { font-family: var(--mono); font-size: 9.5px; color: var(--faint); }
.metric-row .v { font-family: var(--mono); font-size: 10px; }
.bar { height: 4px; border-radius: 2px; background: rgba(125,148,176,0.12); overflow: hidden; margin-bottom: 8px; }
.bar:last-child { margin-bottom: 0; }
.bar > span { display: block; height: 100%; }

.tile-stale { margin-top: 10px; font-size: 10.5px; color: var(--amber);
              background: rgba(245,176,62,0.1); border: 1px solid rgba(245,176,62,0.25);
              border-radius: 7px; padding: 6px 9px; }

.empty {
    border: 1px dashed rgba(125,148,176,0.22); border-radius: 12px;
    background: rgba(13,18,26,0.5); padding: 48px 24px; text-align: center;
}
.empty .glyph { font-size: 26px; opacity: .5; margin-bottom: 12px; }
.empty .lead { font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.empty .note { font-family: var(--mono); font-size: 11.5px; color: var(--faint); line-height: 1.6; max-width: 420px; margin: 0 auto; }

/* ---- bottom 3-col panels ---- */
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; align-items: start; }
.panel { border-radius: 12px; border: 1px solid var(--line); background: var(--panel); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 9px; padding: 14px 16px; border-bottom: 1px solid rgba(125,148,176,0.1); }
.panel-head .h { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.panel-head .spacer { margin-left: auto; }
.panel-row { display: flex; align-items: center; gap: 11px; padding: 11px 16px; border-bottom: 1px solid var(--line-soft); }
.panel-row:last-child { border-bottom: none; }
.panel-row .grow { flex: 1; min-width: 0; }
.panel-row .l1 { font-family: var(--mono); font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-row .l2 { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.panel-empty { padding: 22px 16px; text-align: center; font-family: var(--mono); font-size: 11.5px; color: var(--faint); line-height: 1.6; }
.panel-row .right { font-family: var(--mono); font-size: 11px; color: var(--dim); white-space: nowrap; }

.hf-error { padding: 28px 16px; text-align: center; }
.hf-error .h { font-size: 13px; font-weight: 600; color: var(--red); margin-bottom: 7px; }
.hf-error .m { font-family: var(--mono); font-size: 11px; color: var(--faint); line-height: 1.6; }
.failed-block { padding: 12px 16px; border-top: 1px solid rgba(125,148,176,0.1); background: rgba(251,90,106,0.04); }
.failed-block .h { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--red-text); margin-bottom: 9px; }
.failed-row { padding: 6px 0; border-bottom: 1px solid rgba(125,148,176,0.05); }
.failed-row:last-child { border-bottom: none; }
.failed-row .top { display: flex; justify-content: space-between; gap: 8px; }
.failed-row .ex { font-family: var(--mono); font-size: 10.5px; color: var(--red-text); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================= *
 *  SERVER DETAIL (screens 05-06)
 * ============================================================= */
.back-link { align-self: flex-start; font-family: var(--mono); font-size: 11.5px; color: var(--dim); letter-spacing: .04em; }
.back-link:hover { color: var(--text); text-decoration: none; }
/* Auto-refreshing live regions — their blocks sit a level below .content-pad (injected into a
   placeholder), so re-establish the same column gap that spaces the head, banner, gauges and
   services rows. Without this the gauges row sits flush against the Fleet status wall heading. */
#detail-content,
#servers-placeholder { display: flex; flex-direction: column; gap: 18px; }
.detail-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.detail-name { font-size: 24px; font-weight: 700; letter-spacing: .01em; }
.detail-meta { font-size: 12px; color: var(--dim); }
.chip { font-size: 11.5px; color: var(--dim); border: 1px solid var(--line-strong); border-radius: 5px; padding: 3px 9px; }

.banner { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 11px; font-size: 12.5px; line-height: 1.4; }
.banner-icon { width: 22px; height: 22px; flex: none; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 12px; background: rgba(255,255,255,0.04); }
.banner--red { background: rgba(251,90,106,0.1); border: 1px solid rgba(251,90,106,0.28); color: var(--red-text); }
.banner--red .banner-icon { color: var(--red); }
.banner--amber { background: rgba(245,176,62,0.1); border: 1px solid rgba(245,176,62,0.28); color: var(--amber); }
.banner--amber .banner-icon { color: var(--amber); }

.detail-gauges { display: flex; flex-wrap: wrap; gap: 14px; align-items: stretch; }
.gauge-card--metric { flex: 0 1 200px; min-width: 170px; }
.detail-charts { flex: 1 1 320px; min-width: 300px; display: flex; flex-direction: column; gap: 14px; }
.chart-card { flex: 1; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); padding: 15px 18px; }
.chart-card .card-label { margin-bottom: 8px; display: block; }
.chart-svg { width: 100%; height: 70px; }
.detail-lower { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; align-items: start; }

/* Phones: keep the CPU + Memory gauges side by side (they otherwise wrap and stack),
   shrink the dial to fit two-up, and drop the charts to a full-width row below. */
@media (max-width: 560px) {
    .gauge-card--metric { flex: 1 1 0; min-width: 0; padding: 16px 12px; }
    .gauge-card--metric .gauge-wrap { width: 108px; height: 108px; }
    .gauge-card--metric .gauge-wrap svg { width: 100%; height: 100%; }
    .gauge-card--metric .gauge-num { font-size: 28px; }
    .detail-charts { flex-basis: 100%; min-width: 0; }
}

/* Once the two lower columns stack, flatten them so Storage leads and the empty
   Recent-events placeholder sinks below the service list. */
@media (max-width: 820px) {
    .detail-lower { display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
    .detail-lower > .svc-stack { display: contents; }
    .detail-lower > .svc-stack:last-child > .panel:first-child { order: -1; }
    .detail-lower > .svc-stack:last-child > .panel:last-child { order: 1; }
}

/* Collapsible secondary service groups (server detail — Manual / Disabled & other) */
.svc-stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.svc-group { border-radius: 12px; border: 1px solid var(--line); background: var(--panel); overflow: hidden; }
.svc-group > summary { cursor: pointer; list-style: none; }
.svc-group > summary::-webkit-details-marker { display: none; }
.svc-group:not([open]) > summary { border-bottom: none; }
.svc-summary .svc-caret { color: var(--faint); font-size: 11px; transition: transform .15s ease; }
.svc-group[open] > summary .svc-caret { transform: rotate(90deg); }
.svc-summary:hover .h { color: var(--text); }

/* ============================================================= *
 *  HANGFIRE (screens 07-13)
 * ============================================================= */
.hf-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.hf-tab { display: flex; align-items: center; gap: 8px; padding: 11px 15px; font: 500 13px var(--ui); color: var(--dim); background: transparent; border: none; cursor: pointer; }
.hf-tab:hover { color: var(--text-2); text-decoration: none; }
.hf-tab.active { color: #eaf2f8; box-shadow: inset 0 -2px 0 var(--ac); }
.hf-tab .b { font-family: var(--mono); font-size: 10px; padding: 1px 6px; border-radius: 5px; background: rgba(125,148,176,0.12); color: var(--dim); }

.hf-counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: 12px; }
.hf-counter { border-radius: 12px; border: 1px solid var(--line); background: var(--panel); padding: 15px 16px; }
.hf-counter .lbl { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
.hf-counter .val { font-size: 24px; font-weight: 600; line-height: 1; }

.hf-statepills { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hf-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line-strong); color: var(--text-2); font-size: 12.5px; cursor: pointer; }
.hf-pill:hover { border-color: rgba(125,148,176,0.3); text-decoration: none; }
.hf-pill.active { background: var(--ac-dim); border-color: var(--ac-soft); color: var(--ac); }
.hf-pill .c { font-family: var(--mono); font-size: 10.5px; padding: 1px 6px; border-radius: 5px; background: rgba(125,148,176,0.12); color: var(--dim); }
.hf-pill.active .c { background: var(--ac); color: var(--ac-ink); }

.hf-rowhead, .hf-row { display: grid; align-items: center; padding: 12px 16px; }
.hf-rowhead { border-bottom: 1px solid var(--line); }
.hf-rowhead span { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.hf-row { border-bottom: 1px solid var(--line-soft); color: inherit; }
.hf-row:last-child { border-bottom: none; }
.hf-row.link { cursor: pointer; }
.hf-row.link:hover { background: #0f1622; text-decoration: none; }
.hf-row .l1 { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hf-row .l2 { font-size: 10.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.state-badge { justify-self: start; font-size: 10.5px; font-weight: 600; border-radius: 5px; padding: 3px 9px; background: rgba(255,255,255,0.03); border: 1px solid; }
.hf-realtime-svg { width: 100%; height: 170px; }
.hf-legend { display: flex; align-items: center; gap: 6px; }
.hf-legend .swatch { width: 9px; height: 3px; border-radius: 2px; }

.detail-id { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--ac); }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.kv-row { display: flex; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--line-soft); }
.kv-row:last-child { border-bottom: none; }
.kv-row .k { font-family: var(--mono); font-size: 11.5px; color: var(--dim); flex: none; width: 120px; }
.kv-row .v { font-family: var(--mono); font-size: 11.5px; color: var(--text); word-break: break-all; }
.console { padding: 10px 16px; background: var(--code); }

/* ============================================================= *
 *  STAT ROW + DIRECTORY TABLE (Users / Network — screens 14,16)
 * ============================================================= */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 760px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat-card { border-radius: 12px; border: 1px solid var(--line); background: var(--panel); padding: 16px 18px; }
.stat-card .lbl { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
.stat-card .val { font-size: 28px; font-weight: 600; line-height: 1; }

.dir-head, .dir-row { display: grid; grid-template-columns: 2fr 1.4fr 1fr 0.7fr; align-items: center; }
/* Companies directory carries an extra Admins column (Company · Status · Users · Admins · actions). */
.dir--co .dir-head, .dir--co .dir-row { grid-template-columns: 2fr 1.2fr 0.7fr 0.7fr 1fr; }
.dir-head { padding: 11px 18px; border-bottom: 1px solid var(--line); }
.dir-head span { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.dir-row { padding: 13px 18px; border-bottom: 1px solid var(--line-soft); }
.dir-row:last-of-type { border-bottom: none; }
.dir-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dir-user .who { min-width: 0; }
.dir-user .who .display { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dir-user .who .uname { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.avatar-sm { width: 34px; height: 34px; flex: none; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--ac-ink); font-weight: 700; font-size: 12px; }
.role-badge { font-size: 10.5px; padding: 2px 9px; border-radius: 6px; border: 1px solid transparent; white-space: nowrap; }
.role-badge--admin  { color: var(--ac); background: var(--ac-dim); border-color: var(--ac-soft); }
.role-badge--op     { color: var(--amber); background: rgba(245,176,62,0.1); border-color: rgba(245,176,62,0.28); }
.role-badge--viewer { color: var(--dim); background: rgba(125,148,176,0.08); border-color: rgba(125,148,176,0.2); }
.row-actions { display: flex; gap: 7px; justify-content: flex-end; align-items: center; }
.dir-foot { padding: 12px 18px; font-size: 11.5px; color: var(--faint); background: rgba(0,229,212,0.03); }
.toolbar-search { display: flex; align-items: center; gap: 9px; background: var(--inset); border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 12px; }
.toolbar-search input { background: transparent; border: none; outline: none; color: var(--text); font-size: 12.5px; width: 140px; }
.stat-row--auto { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* network tables */
.panel-head .sub { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.net-head, .net-row { display: grid; align-items: center; gap: 12px; padding: 12px 18px; }
.net-head { border-bottom: 1px solid var(--line); }
.net-head span { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.net-row { border-bottom: 1px solid var(--line-soft); }
.net-row:last-child { border-bottom: none; }
.cols-net { grid-template-columns: 1.4fr 1.4fr 1fr 1.3fr; }
.net-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
@media (max-width: 720px) { .cols-net { grid-template-columns: 1.2fr 1fr auto; } .cols-net span:nth-child(2), .net-row.cols-net > .mono:nth-child(2) { display: none; } }

/* ============================================================= *
 *  MODAL (shared — user / device / recurring)
 * ============================================================= */
.modal-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(4,7,11,0.74);
                 -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
                 display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-overlay[hidden] { display: none; }
.modal { width: 480px; max-width: 100%; background: var(--panel); border: 1px solid var(--line-strong);
         border-radius: 16px; box-shadow: 0 40px 90px rgba(0,0,0,0.6); overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head .h { font-size: 15px; font-weight: 600; }
.modal-close { margin-left: auto; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line-strong); background: transparent; color: var(--dim); cursor: pointer; font-size: 13px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 17px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); background: var(--inset); }
.btn-cancel { padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line-strong); background: transparent; color: var(--text-2); font: 500 13px var(--ui); cursor: pointer; }
.btn-cancel:hover { color: var(--text); }
.field-mb0 { margin-bottom: 0; }
.modal-input { width: 100%; background: var(--inset); border: 1px solid var(--line-strong); border-radius: 9px;
               padding: 11px 13px; font-size: 13.5px; color: var(--text); outline: none; font-family: var(--mono); }
.modal-input:focus { border-color: var(--ac-soft); }
.modal-input--ui { font-family: var(--ui); }
.modal-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check-row { display: flex; align-items: center; gap: 11px; cursor: pointer; }
.check-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--ac); flex: none; }

/* ============================================================= *
 *  PILLS / BUTTONS
 * ============================================================= */
.pill-green { font-size: 10.5px; color: var(--green); background: rgba(47,217,138,0.1);
              border: 1px solid rgba(47,217,138,0.25); border-radius: 5px; padding: 2px 8px; }
.pill-admin { font-size: 10px; color: var(--ac); border: 1px solid var(--ac-soft);
              border-radius: 5px; padding: 2px 7px; }
.pill-count { font-size: 10.5px; color: var(--faint); }

.btn-accent {
    font: 600 12.5px var(--ui); color: var(--ac-ink);
    background: var(--ac); border: none; border-radius: 8px; padding: 9px 15px; cursor: pointer;
}
.btn-accent:hover { filter: brightness(1.06); text-decoration: none; }
.btn-accent--sm { font-size: 11px; padding: 5px 12px; }
.btn-link {
    font-family: var(--mono); font-size: 10.5px; color: var(--ac);
    background: transparent; border: 1px solid var(--ac-soft); border-radius: 5px;
    padding: 3px 9px; cursor: pointer;
}
.btn-link:hover { background: var(--ac-dim); text-decoration: none; }
.btn-soft {
    font: 600 10.5px var(--ui); color: var(--ac);
    background: var(--ac-dim); border: 1px solid var(--ac-soft);
    border-radius: 6px; padding: 5px 12px; cursor: pointer;
}
.btn-soft:hover { filter: brightness(1.1); text-decoration: none; }
.btn-ghost-icon {
    flex: none; width: 28px; height: 28px; border-radius: 7px;
    border: 1px solid var(--line-strong); background: transparent;
    color: var(--dim); cursor: pointer; font-size: 11px;
}
.btn-ghost-icon:hover { color: var(--text); text-decoration: none; }
.lock { font-family: var(--mono); font-size: 11px; color: var(--faintest); }

/* ============================================================= *
 *  ALERTS
 * ============================================================= */
.alert { padding: 13px 16px; border-radius: 11px; margin-bottom: 16px; font-size: 12.5px; line-height: 1.4; }
.alert-error { background: rgba(251,90,106,0.1); border: 1px solid rgba(251,90,106,0.28); color: var(--red-text); }
.alert-info { background: var(--ac-dim); border: 1px solid var(--ac-soft); color: var(--ac); }
.alert-token { background: rgba(245,176,62,0.08); border: 1px solid rgba(245,176,62,0.28); border-radius: 11px; padding: 14px; margin-bottom: 18px; }
.alert-token code { display: inline-block; margin: 6px 0; padding: 4px 8px; background: var(--inset); border-radius: 4px; color: var(--text); font-size: 13px; word-break: break-all; }

/* ============================================================= *
 *  LEGACY COMPONENTS (Servers / Users / Login / forms / tables)
 *  Restyled to the new palette so non-rebuilt pages stay coherent.
 * ============================================================= */
h1 { font-size: 24px; font-weight: 700; margin: 0 0 16px; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 22px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

.badge { display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: 999px;
         font-size: 12px; font-weight: 600; text-align: center;
         background: rgba(125,148,176,0.1); color: var(--dim); border: 1px solid var(--line); }
.badge-hidden { display: none; }
.badge--info   { background: rgba(139,156,247,0.15); color: #aeb9f7; border-color: transparent; }
.badge--ok     { background: rgba(47,217,138,0.15);  color: #8fe7bf; border-color: transparent; }
.badge--danger { background: rgba(251,90,106,0.18);  color: var(--red-text); border-color: transparent; }

.mod-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.mod-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-weight: 600; }
.mod-card__head > div { display: flex; align-items: center; gap: 8px; }

.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid th, .grid td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid th { color: var(--faint); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.grid td.err { color: var(--red-text); max-width: 360px; }
.grid .actions { white-space: nowrap; }

/* WoL status text-pill — class is swapped by wwwroot/js/wakeDevices.js. */
.dot { display: inline-block; font-family: var(--mono); font-size: 10.5px;
       padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line-strong); }
.dot--unknown  { color: var(--dim); }
.dot--checking { color: var(--purple); border-color: rgba(139,156,247,0.4); }
.dot--online   { color: #8fe7bf; border-color: rgba(47,217,138,0.4); }
.dot--offline  { color: var(--red-text); border-color: rgba(251,90,106,0.4); }

.btn { display: inline-block; padding: 9px 14px; border-radius: 8px; cursor: pointer;
       background: var(--ac); color: var(--ac-ink); border: 1px solid transparent;
       font-size: 13px; font-weight: 600; line-height: 1; font-family: var(--ui); }
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn--sm, .btn-small { padding: 4px 10px; font-size: 12px; }
.btn--ghost, .btn-danger { background: transparent; }
.btn--ghost { color: var(--text); border-color: var(--line-strong); }
.btn--ghost:hover { background: rgba(125,148,176,0.08); }
.btn-primary { background: var(--ac); color: var(--ac-ink); }
.btn-danger  { color: var(--red-text); border-color: rgba(251,90,106,0.4); }
.btn-danger:hover { background: rgba(251,90,106,0.12); }

.edit-slot:empty { display: none; }
.edit-form { margin-top: 12px; padding: 12px; background: var(--inset); border-radius: var(--radius); border: 1px solid var(--line); }
.edit-form__row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.edit-form__row label { width: 80px; color: var(--dim); font-size: 12px; }
.edit-form__row input, .edit-form__row select { flex: 1; padding: 8px 10px; border-radius: 8px;
    background: var(--bg); border: 1px solid var(--line-strong); color: var(--text); font-family: var(--mono); }
.edit-form__actions { display: flex; gap: 8px; margin-top: 10px; }

.inline-form { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack-form  { display: flex; flex-direction: column; gap: 12px; max-width: 420px;
               background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stack-form > div { display: flex; flex-wrap: wrap; gap: 10px; }
.stack-form input[type="text"], .inline-form input[type="text"] {
    padding: 9px 11px; border-radius: 8px; background: var(--inset);
    border: 1px solid var(--line-strong); color: var(--text); font-family: var(--mono); }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--dim); }
td.stale, .stale { color: var(--amber); }

/* ---- login split-hero (screen 18) ---- */
.login-grid-overlay {
    position: fixed; inset: 0; pointer-events: none;
    background-image: linear-gradient(rgba(125,148,176,0.05) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(125,148,176,0.05) 1px, transparent 1px);
    background-size: 48px 48px;
    -webkit-mask-image: radial-gradient(800px 500px at 50% 40%, #000, transparent);
            mask-image: radial-gradient(800px 500px at 50% 40%, #000, transparent);
}
.login-hero {
    position: relative; display: grid; grid-template-columns: 1fr 1fr;
    width: 860px; max-width: 94vw;
    background: var(--panel); border: 1px solid rgba(125,148,176,0.14);
    border-radius: 16px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,0.55);
}
.login-left {
    position: relative; padding: 48px 40px;
    background: linear-gradient(160deg, #0e141d, #0a0e14);
    border-right: 1px solid var(--line); overflow: hidden;
}
.login-rings { position: absolute; top: -40px; right: -40px; width: 220px; height: 220px; }
.login-rings span { position: absolute; inset: 0; border: 1px solid rgba(0,229,212,0.18); border-radius: 50%; animation: cring 4s ease-out infinite; }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 32px; }
.login-brand .wm { font-size: 20px; font-weight: 700; letter-spacing: .04em; }
.login-tag { font-size: 26px; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; margin-bottom: 14px; }
.login-sub { font-size: 13.5px; line-height: 1.6; color: var(--dim); max-width: 280px; }
.login-ver { position: absolute; bottom: 28px; left: 40px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; color: var(--faintest); text-transform: uppercase; }
.login-right { padding: 48px 42px; }
.login-right h1 { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.login-hint { font-size: 13px; color: var(--dim); margin-bottom: 28px; }
.field-label { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
.field-box {
    display: flex; align-items: center; gap: 10px;
    background: var(--inset); border: 1px solid var(--line-strong);
    border-radius: 9px; padding: 0 13px; margin-bottom: 18px;
}
.field-box:focus-within { border-color: var(--ac-soft); }
.field-box .prefix { font-family: var(--mono); font-size: 13px; color: var(--faint); }
.field-box input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--text); font-family: var(--mono); font-size: 13.5px; padding: 12px 0; }
.btn-auth { width: 100%; padding: 13px; border: none; border-radius: 9px; background: var(--ac); color: var(--ac-ink); font: 600 14px var(--ui); letter-spacing: .02em; cursor: pointer; }
.btn-auth:hover { filter: brightness(1.06); }
.login-status { display: flex; align-items: center; gap: 8px; margin-top: 22px; font-size: 11.5px; color: var(--faint); }
.login-status .ok { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
/* hide the empty validation box when there are no errors */
.validation-summary-valid { display: none; }
@media (max-width: 680px) {
    .login-hero { grid-template-columns: 1fr; }
    .login-left { display: none; }
}
