/* Canopyd Ops Console — design tokens + shell.
   Palette follows GitHub's Primer dark/light themes: a #0d1117 canvas with #161b22
   panels and SOLID borders (alpha hairlines vanish on non-OLED panels), system UI
   font, sentence-case labels, small radii, no glows. Brand accent is a muted teal. */

:root {
    /* surfaces */
    --bg:       #0d1117;   /* app canvas               */
    --panel:    #161b22;   /* cards / panels           */
    --inset:    #0d1117;   /* inputs / modal footers   */
    --code:     #010409;   /* terminal / code inset    */
    --side-bg:  #010409;   /* sidebar + marketing footer */

    /* text ramp */
    --text:     #e6edf3;
    --text-2:   #d1d7e0;
    --muted:    #b1bac4;
    --dim:      #9198a1;
    --faint:    #848d97;
    --faintest: #6e7681;

    /* borders — opaque, like Primer */
    --line:        #30363d;
    --line-strong: #3d444d;
    --line-soft:   #21262d;

    /* accent (teal) — --ac for glyphs/charts, --ac-fill for solid buttons */
    --ac:      #3cbfae;
    --ac-fill: #1a7f72;
    --ac-fill-hover: #1f8f81;
    --ac-dim:  rgba(60,191,174,0.12);
    --ac-soft: rgba(60,191,174,0.40);
    --ac-ink:  #ffffff;    /* text on accent fill */

    /* status (Primer) */
    --green:    #3fb950;
    --amber:    #d29922;
    --amber-text: var(--amber);
    --red:      #f85149;
    --red-text: #ff7b72;
    --purple:   #a371f7;

    /* status tints — Primer "subtle" fills + "muted" borders (banners, pills, badges) */
    --green-bg:      rgba(46,160,67,0.15);
    --green-border:  rgba(46,160,67,0.40);
    --amber-bg:      rgba(187,128,9,0.15);
    --amber-border:  rgba(187,128,9,0.40);
    --red-bg:        rgba(248,81,73,0.10);
    --red-border:    rgba(248,81,73,0.40);
    --purple-bg:     rgba(171,125,248,0.15);
    --purple-border: rgba(171,125,248,0.40);

    /* fonts — GitHub's system stacks */
    --ui:   -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    --radius: 6px;

    /* ---- themed surfaces --------------------------------------------------- *
     * Semantic tokens for the handful of surfaces that were hardcoded dark.
     * These are the only things the light theme has to flip beyond the ramp
     * above, so a single [data-theme="light"] block below covers the whole app. */
    --hover:      #1c2128;                 /* tile / row / card hover fill        */
    --raise:      rgba(110,118,129,0.10);  /* faint lift (badges, banner icons)   */
    --neutral:    rgba(110,118,129,0.40);  /* counters, gauge tracks, bar tracks  */
    --topbar-bg:  var(--bg);               /* console topbar                      */
    --head-bg:    transparent;             /* box + table header strips          */
    --overlay:    rgba(1,4,9,0.80);        /* modal scrim                         */
    --backdrop:   rgba(1,4,9,0.60);        /* mobile off-canvas nav scrim         */
    --empty-bg:   var(--bg);               /* empty-state panels                  */
    --mk-nav-bg:  var(--side-bg);          /* marketing sticky nav                */
    --login-grad: var(--bg);               /* login hero panel                    */
    --shadow-md:  0 8px 24px rgba(1,4,9,0.75);
    --shadow-lg:  0 12px 28px rgba(1,4,9,0.85);
    --shadow-xl:  0 12px 48px rgba(1,4,9,0.9);
    --ac-text:    var(--ac);               /* accent used AS TEXT — deepened in
                                              light mode for readable contrast    */

    /* ---- 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);
}

/* ============================================================= *
 *  LIGHT THEME  ("white mode")
 *  Activated by <html data-theme="light"> (server-rendered from the
 *  per-user preference cookie; toggled live by wwwroot/js/theme.js).
 *  Primer light: #f6f8fa page shared with the chrome (sidebar, topbar) so
 *  the white cards stand out; #f6f8fa box/table header strips and
 *  secondary buttons; soft pastel status fills.
 * ============================================================= */
:root[data-theme="light"] {
    --bg:       #f6f8fa;
    --panel:    #ffffff;
    --inset:    #ffffff;
    --code:     #f6f8fa;
    --side-bg:  #f6f8fa;

    --text:     #1f2328;
    --text-2:   #31363c;
    --muted:    #424a53;
    --dim:      #59636e;
    --faint:    #656d76;
    --faintest: #818b98;

    --line:        #d1d9e0;
    --line-strong: #d1d9e0;
    --line-soft:   #e8ecf0;

    --ac:      #1a8577;
    --ac-fill: #1a7f72;
    --ac-fill-hover: #177266;
    --ac-dim:  #e0f5f1;
    --ac-soft: rgba(26,133,119,0.40);
    --ac-ink:  #ffffff;
    --ac-text: #0f6e63;

    --green:    #1a7f37;
    --amber:    #bf8700;   /* glyphs, bars, gauges, big numbers */
    --amber-text: #9a6700;   /* small amber text on white */
    --red:      #cf222e;
    --red-text: #d1242f;
    --purple:   #8250df;

    --green-bg:      #eef8f1;
    --green-border:  #bfe3cb;
    --amber-bg:      #fdf5e8;
    --amber-border:  #f0d6a6;
    --red-bg:        #fdf1f0;
    --red-border:    #f3c7c4;
    --purple-bg:     #f6f1fe;
    --purple-border: #dccdfb;

    --hover:      #f6f8fa;
    --raise:      rgba(129,139,152,0.12);
    --neutral:    rgba(129,139,152,0.25);
    --topbar-bg:  #f6f8fa;
    --head-bg:    #f6f8fa;
    --overlay:    rgba(31,35,40,0.50);
    --backdrop:   rgba(31,35,40,0.30);
    --empty-bg:   #ffffff;
    --login-grad: #ffffff;
    --shadow-md:  0 8px 24px rgba(66,74,83,0.12);
    --shadow-lg:  0 12px 28px rgba(66,74,83,0.15);
    --shadow-xl:  0 12px 48px rgba(66,74,83,0.20);
}

/* Secondary controls take Primer's default-button look in light mode (grey fill, hairline
   shadow) so they read as buttons rather than empty white boxes. Dark keeps its own. */
:root[data-theme="light"] :is(.theme-toggle, .icon-btn, .btn-ghost-icon, .btn--ghost, .btn-cancel,
    .modal-close, .nav-toggle, .mk-btn--ghost, .mk-nav-toggle, .site-chip:not(.active), .hf-pill:not(.active)) {
    background: #f6f8fa; border-color: #d1d9e0; box-shadow: 0 1px 0 rgba(31,35,40,0.04);
}
:root[data-theme="light"] :is(.theme-toggle, .icon-btn, .btn-ghost-icon, .btn--ghost, .btn-cancel,
    .modal-close, .nav-toggle, .mk-btn--ghost, .mk-nav-toggle, .site-chip:not(.active), .hf-pill:not(.active)):hover {
    background: #eff2f5;
}
:root[data-theme="light"] :is(.btn, .btn-accent, .btn-auth, .mk-btn--primary):not(.btn--ghost):not(.btn-danger) {
    box-shadow: 0 1px 0 rgba(31,35,40,0.1);
}

/* Per-rule fixes for the handful of near-white / pale text colours that were
   hardcoded (not tokenised) and would vanish on a white background. */
:root[data-theme="light"] .badge--info   { color: var(--purple); }
:root[data-theme="light"] .badge--ok     { color: var(--green); }
:root[data-theme="light"] .dot--online   { color: var(--green); }
* { 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); 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-text); font-weight: 600; }

::selection { background: var(--ac-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--neutral); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(110,118,129,0.30); }
::-webkit-scrollbar-track { background: transparent; }

@keyframes cpulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

@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(--side-bg);
    border-right: 1px solid var(--line);
    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-size: 12px; font-weight: 600; color: var(--faint); padding: 0 12px 8px;
}
.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: 6px;
    background: transparent; color: var(--dim);
    font: 500 13.5px var(--ui); cursor: pointer;
    transition: background .15s, color .15s;
}
.nav-item:hover { color: var(--text); background: var(--raise); text-decoration: none; }
.nav-item.active {
    color: var(--text); font-weight: 600; background: var(--raise);
    border-left-color: var(--ac); border-radius: 0 6px 6px 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: var(--red-bg); 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: var(--neutral); color: var(--faint);
    font-weight: 500; letter-spacing: .04em;
}

.persona {
    display: flex; align-items: center; gap: 11px;
    padding: 11px; border-radius: 6px;
    background: var(--panel); border: 1px solid var(--line);
}
.avatar {
    width: 34px; height: 34px; flex: none; border-radius: 50%;
    background: var(--ac-fill);
    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-size: 12px; color: var(--dim); }
.icon-btn {
    flex: none; width: 28px; height: 28px; border-radius: 6px;
    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: var(--faintest); text-decoration: none; }

/* ---- theme toggle (console topbar · marketing nav · login float) ---- */
.theme-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; flex: none;
    border: 1px solid var(--line-strong); border-radius: 6px;
    background: var(--panel); color: var(--dim); cursor: pointer;
    transition: color .15s, border-color .15s, background .15s;
}
.theme-toggle:hover { color: var(--ac-text); border-color: var(--ac-soft); }
.theme-toggle svg { width: 16px; height: 16px; display: block; }
/* Show the icon for the theme you'd switch TO: sun while dark, moon while light. */
.theme-toggle .ico-moon { display: none; }
:root[data-theme="light"] .theme-toggle .ico-sun  { display: none; }
:root[data-theme="light"] .theme-toggle .ico-moon { display: block; }
/* Floated toggle for the unauthenticated login/bare pages (no topbar to sit in). */
.theme-float { position: fixed; top: 18px; right: 18px; z-index: 70; }

/* ---- 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: 6px;
              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: var(--faintest); }

@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: var(--shadow-lg); }
    .app-shell.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: var(--backdrop); }
}

.topbar { border-bottom: 1px solid var(--line); background: var(--topbar-bg); }
.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-size: 12px; color: var(--faint); }
.topbar-spacer { flex: 1; }

.tb-pill {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 13px; border-radius: 6px;
    background: var(--panel); border: 1px solid var(--line-strong);
    font-size: 12px; color: var(--dim);
}
.tb-pill .spin { animation: cspin 8s linear infinite; }
.tb-pill .accent { color: var(--ac-text); }
.tb-clock {
    font-family: var(--mono); font-size: 13px; color: var(--text);
    letter-spacing: .04em; padding: 7px 12px; border-radius: 6px;
    background: var(--panel); border: 1px solid var(--line-strong);
}
.tb-fail {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 13px; border-radius: 6px;
    background: var(--red-bg); border: 1px solid var(--red-border);
    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-size: 12px; font-weight: 600; color: var(--faint); margin-right: 3px; }
.site-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 12px; border-radius: 6px;
    background: var(--panel); border: 1px solid var(--line-strong);
    color: var(--text-2); font-size: 12.5px; cursor: pointer;
}
.site-chip:hover { border-color: var(--faintest); text-decoration: none; }
.site-chip.active { background: var(--ac-dim); border-color: var(--ac-soft); color: var(--ac-text); }
.site-chip .count {
    font-family: var(--mono); font-size: 11.5px; padding: 1px 6px; border-radius: 5px;
    background: var(--neutral); color: var(--dim);
}
.site-chip.active .count { background: var(--ac-fill); 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; }
/* A button placed straight into the page column would otherwise stretch to its full width. */
.content-pad > .btn { align-self: flex-start; }

/* unauthenticated (login) centering */
.bare-main { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }

/* ============================================================= *
 *  CARDS / SECTIONS
 * ============================================================= */
.card { border-radius: 6px; 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: 16px; font-weight: 600; color: var(--text); }
.section-head .rule { flex: 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: 6px; border: 1px solid var(--line); background: var(--panel);
    padding: 18px; display: flex; flex-direction: column; align-items: center;
}
.card-label {
    font-size: 13px; font-weight: 600; color: var(--muted); 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: 11px; color: var(--faint); }
.gauge-sub { font-size: 11.5px; color: var(--faint); }

/* Hover/focus explainer on gauge labels — what the dial measures and what to check when it's off. */
/* Row-flex the label so its text and the round info badge sit centred on each other, instead of
   nudging the badge with a font-metric-specific vertical-align that left it sitting ~2px low. */
.gauge-card .card-label { display: flex; align-items: center; }
.info-tip {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 14px; height: 14px; margin-left: 5px;
    border: 1px solid var(--line-strong); border-radius: 50%;
    font-family: var(--mono); font-size: 10px; letter-spacing: 0; text-transform: none; color: var(--faint);
    cursor: help; user-select: none;
}
.info-tip:hover, .info-tip:focus-visible { color: var(--ac-text); border-color: var(--ac-soft); outline: none; }
.tip-pop {
    position: absolute; top: calc(100% + 8px); left: -6px; z-index: 40;
    width: 250px; padding: 10px 12px; display: none;
    background: var(--panel); border: 1px solid var(--line-strong); border-radius: 6px;
    box-shadow: var(--shadow-md);
    font-family: var(--ui); font-size: 12px; line-height: 1.55;
    letter-spacing: normal; text-transform: none; white-space: normal;
}
.info-tip:hover .tip-pop, .info-tip:focus .tip-pop, .info-tip:focus-within .tip-pop { display: block; }
.tip-pop .tip-what  { display: block; color: var(--muted); }
.tip-pop .tip-check { display: block; margin-top: 7px; color: var(--dim); }
.tip-pop .tip-check::before {
    content: "What to check"; display: block;
    font-weight: 600; color: var(--text-2); margin-bottom: 2px;
}

.fleet-load {
    flex: 3 1 320px; min-width: 300px;
    border-radius: 6px; 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-text); }
.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: 6px; 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: var(--faintest); background: var(--hover); 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: 11px; color: var(--faint); margin: -6px 0 10px; line-height: 1.5; }
.tile-sub-line { 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); }
.ind--amber { background: var(--amber); }
.ind--red   { background: var(--red); }
.ind--cyan  { background: var(--ac); }
.ind--dim   { background: var(--faint); }
.svc-pill {
    flex: none; font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 5px;
    background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border);
}
.svc-pill--bad { background: var(--amber-bg); color: var(--amber-text); border-color: var(--amber-border); }
.metric-row { display: flex; justify-content: space-between; margin-bottom: 3px; }
.metric-row .k { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.metric-row .v { font-family: var(--mono); font-size: 11px; }
.bar { height: 4px; border-radius: 2px; background: var(--neutral); overflow: hidden; margin-bottom: 8px; }
.bar:last-child { margin-bottom: 0; }
.bar > span { display: block; height: 100%; }

.tile-stale { margin-top: 10px; font-size: 11.5px; color: var(--amber-text);
              background: var(--amber-bg); border: 1px solid var(--amber-border);
              border-radius: 6px; padding: 6px 9px; }
.tile-offline { margin-top: 10px; font-size: 11.5px; color: var(--red-text); font-weight: 600;
              background: var(--red-bg); border: 1px solid var(--red-border);
              border-radius: 6px; padding: 6px 9px; }

.empty {
    border: 1px dashed rgba(110,118,129,0.22); border-radius: 6px;
    background: var(--empty-bg); 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-size: 13px; 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: 6px; border: 1px solid var(--line); background: var(--panel); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 9px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--head-bg); }
.panel-head .h { font-size: 14px; font-weight: 600; color: var(--text); }
.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: 11.5px; color: var(--faint); }
.panel-empty { padding: 22px 16px; text-align: center; font-size: 13px; color: var(--faint); line-height: 1.6; }
.panel-row .right { font-family: var(--mono); font-size: 11px; color: var(--dim); white-space: nowrap; }
/* A panel that IS the incident (flagged services down) — red edge so it reads as an alert, not a list. */
.panel--alert { border-color: color-mix(in srgb, var(--red) 45%, transparent); }

.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-size: 12px; color: var(--faint); line-height: 1.6; }
.failed-block { padding: 12px 16px; border-top: 1px solid var(--line); background: var(--red-bg); }
.failed-block .h { font-size: 12px; font-weight: 600; color: var(--red-text); margin-bottom: 9px; }
.failed-row { padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.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: 11.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-size: 13px; color: var(--dim); }
.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: 6px; 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: var(--raise); }
.banner--red { background: var(--red-bg); border: 1px solid var(--red-border); color: var(--red-text); }
.banner--red .banner-icon { color: var(--red); }
.banner--amber { background: var(--amber-bg); border: 1px solid var(--amber-border); color: var(--amber-text); }
.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: 6px; 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; display: block; }

/* Hover overlay for the CPU/Memory charts. The plot wraps the fixed-height svg so the cursor line,
   value dot and tooltip can be pixel-positioned over it; all three are pointer-transparent so the
   plot keeps receiving the pointer. Positioned live by the chart-hover script in Detail.cshtml. */
.chart-plot { position: relative; touch-action: none; }
.chart-cursor {
    position: absolute; top: 0; height: 70px; width: 1px;
    background: var(--line-strong); pointer-events: none; transform: translateX(-0.5px);
}
.chart-dot {
    position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px;
    border-radius: 50%; background: var(--ac); box-shadow: 0 0 0 2px var(--panel);
    pointer-events: none;
}
.chart-tip {
    position: absolute; top: -2px; transform: translateY(-100%);
    display: flex; align-items: baseline; gap: 6px; white-space: nowrap;
    padding: 3px 8px; border-radius: 6px;
    background: var(--panel); border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-md); pointer-events: none; z-index: 2;
}
.chart-tip[hidden] { display: none; }
.chart-tip .chart-tip-v { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--text); }
.chart-tip .chart-tip-t { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }

.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
   service list follows below it. */
@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; }
}

/* Machine inventory (server detail — System information cards). A label/value pair rather than the
   two-line .panel-row: these are attributes of one machine, so the label has to stay readable beside
   the value instead of shrinking into a subtitle. The value column takes the slack and wraps, since
   BIOS strings and adapter lists are long and unpredictable. */
.spec-row { display: flex; align-items: baseline; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--line-soft); }
.spec-row:last-child { border-bottom: none; }
.spec-k { flex: 0 0 40%; max-width: 150px; font-size: 11.5px; color: var(--dim); }
.spec-v { flex: 1; min-width: 0; font-family: var(--mono); font-size: 11.5px; color: var(--text); word-break: break-word; }
.spec-note { color: var(--faint); }

/* 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: 6px; 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: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ac); }
.hf-tab .b { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; background: var(--neutral); color: var(--dim); }

.hf-counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: 12px; }
.hf-counter { border-radius: 6px; border: 1px solid var(--line); background: var(--panel); padding: 15px 16px; }
.hf-counter .lbl { font-size: 12px; 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: 6px; background: var(--panel); border: 1px solid var(--line-strong); color: var(--text-2); font-size: 12.5px; cursor: pointer; }
.hf-pill:hover { border-color: var(--faintest); text-decoration: none; }
.hf-pill.active { background: var(--ac-dim); border-color: var(--ac-soft); color: var(--ac-text); }
.hf-pill .c { font-family: var(--mono); font-size: 11.5px; padding: 1px 6px; border-radius: 5px; background: var(--neutral); color: var(--dim); }
.hf-pill.active .c { background: var(--ac-fill); color: var(--ac-ink); }

.hf-rowhead, .hf-row { display: grid; align-items: center; padding: 12px 16px; }
.hf-rowhead { border-bottom: 1px solid var(--line); background: var(--head-bg); }
.hf-rowhead span { font-size: 12px; font-weight: 600; color: var(--dim); }
.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: var(--hover); 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: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.state-badge { justify-self: start; font-size: 11.5px; font-weight: 600; border-radius: 5px; padding: 3px 9px; background: var(--raise); 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-text); }
.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: 6px; border: 1px solid var(--line); background: var(--panel); padding: 16px 18px; }
.stat-card .lbl { font-size: 12px; 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; }
/* Users directory drops the Company column for non-platform-admin viewers. */
.dir-head--no-company, .dir-row--no-company { grid-template-columns: 2fr 1.4fr 0.7fr; }
.dir-head { padding: 11px 18px; border-bottom: 1px solid var(--line); background: var(--head-bg); }
.dir-head span { font-size: 12px; font-weight: 600; color: var(--dim); }
.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: 6px; display: flex; align-items: center; justify-content: center; color: var(--ac-ink); font-weight: 700; font-size: 12px; }
.role-badge { font-size: 11.5px; padding: 2px 9px; border-radius: 6px; border: 1px solid transparent; white-space: nowrap; }
.role-badge--admin  { color: var(--ac-text); background: var(--ac-dim); border-color: var(--ac-soft); }
.role-badge--op     { color: var(--amber-text); background: var(--amber-bg); border-color: var(--amber-border); }
.role-badge--viewer { color: var(--dim); background: rgba(110,118,129,0.08); border-color: rgba(110,118,129,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(60,191,174,0.03); }
.toolbar-search { display: flex; align-items: center; gap: 9px; background: var(--inset); border: 1px solid var(--line-strong); border-radius: 6px; 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: 11.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); background: var(--head-bg); }
.net-head span { font-size: 12px; font-weight: 600; color: var(--dim); }
.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: var(--overlay);
                 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: 12px; box-shadow: var(--shadow-xl); overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--line); background: var(--head-bg); }
.modal-head .h { font-size: 15px; font-weight: 600; }
.modal-close { margin-left: auto; width: 30px; height: 30px; border-radius: 6px; 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: 6px; 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: 6px;
               padding: 11px 13px; font-size: 13.5px; color: var(--text); outline: none; font-family: var(--mono); }
.modal-input:focus { border-color: var(--ac); box-shadow: 0 0 0 1px var(--ac); }
.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: 11.5px; color: var(--green); background: var(--green-bg);
              border: 1px solid var(--green-border); border-radius: 5px; padding: 2px 8px; }
.pill-admin { font-size: 11px; color: var(--ac-text); border: 1px solid var(--ac-soft);
              border-radius: 5px; padding: 2px 7px; }
.pill-count { font-size: 11.5px; color: var(--faint); }

.btn-accent {
    font: 600 12.5px var(--ui); color: var(--ac-ink);
    background: var(--ac-fill); border: none; border-radius: 6px; padding: 9px 15px; cursor: pointer;
}
.btn-accent:hover { background: var(--ac-fill-hover); text-decoration: none; }
.btn-accent--sm { font-size: 11px; padding: 5px 12px; }
.btn-link {
    font-size: 12px; color: var(--ac-text);
    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-text);
    background: var(--ac-dim); border: 1px solid var(--ac-soft);
    border-radius: 6px; padding: 5px 12px; cursor: pointer;
}
.btn-soft:hover { background: var(--ac-soft); text-decoration: none; }
.btn-ghost-icon {
    flex: none; width: 28px; height: 28px; border-radius: 6px;
    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: 6px; margin-bottom: 16px; font-size: 12.5px; line-height: 1.4; }
.alert-error { background: var(--red-bg); border: 1px solid var(--red-border); color: var(--red-text); }
.alert-info { background: var(--ac-dim); border: 1px solid var(--ac-soft); color: var(--ac-text); }
.alert-token { background: var(--amber-bg); border: 1px solid var(--amber-border); border-radius: 6px; 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; }

/* Copy-paste command blocks (agent install / uninstall helpers). .cmd-block preserves newlines and
   scrolls sideways on narrow screens so the page body never scrolls horizontally. */
.cmd-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 13px 0 3px; }
.cmd-head:first-of-type { margin-top: 6px; }
.cmd-head span { color: var(--dim); font-size: 12px; }
.cmd-block { display: block; margin: 0; padding: 9px 11px; background: var(--code); border: 1px solid var(--line);
             border-radius: 6px; color: var(--text); font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
             white-space: pre; overflow-x: auto; }

/* ============================================================= *
 *  ADD SERVER  (Servers/Add — numbered steps + live install checklist)
 * ============================================================= */
.install-intro { max-width: 720px; margin: 0 0 22px; }
.install-steps { list-style: none; margin: 0; padding: 0; max-width: 860px; }
.install-step { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 16px; padding-bottom: 28px; }
/* the rail joining one step's number to the next */
.install-step:not(:last-child)::before { content: ""; position: absolute; left: 16.5px; top: 40px; bottom: 6px; width: 1px; background: var(--line-strong); }
.install-step__num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--faint);
    border: 1px solid var(--line-strong); background: var(--panel); }
.install-step.is-current .install-step__num { color: var(--ac-text); border-color: var(--ac-soft); background: var(--ac-dim); }
.install-step.is-done .install-step__num { color: var(--green); border-color: var(--green-border); }
.install-step__title { font-size: 16px; font-weight: 600; color: var(--text); margin: 7px 0 10px; }
.install-step:not(.is-current):not(.is-done) .install-step__title { color: var(--faint); }
.install-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.install-lead { margin: 0 0 4px; font-size: 13px; color: var(--text-2); }
.install-note { margin: 10px 0 0; font-size: 12.5px; }
.install-summary { font-size: 14px; }
.install-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btn.is-disabled { opacity: .45; pointer-events: none; }

.install-live { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px; }
.ick-list { list-style: none; margin: 0; padding: 0; }
.ick { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.ick:last-child { border-bottom: 0; }
.ick__icon { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.ick__icon svg { display: block; width: 18px; height: 18px; }
.ick__title { font-size: 13.5px; color: var(--text); }
.ick__detail { font-size: 12px; color: var(--dim); margin-top: 2px; overflow-wrap: anywhere; }
.ick--done    .ick__icon { color: var(--green); }
.ick--active  .ick__icon { color: var(--ac); }
.ick--failed  .ick__icon { color: var(--red); }
.ick--failed  .ick__detail { color: var(--red-text); }
.ick--pending .ick__icon { color: var(--faintest); }
.ick--pending .ick__title { color: var(--faint); }
.ick__spin { animation: cspin 0.9s linear infinite; }
@media (prefers-reduced-motion: reduce) { .ick__spin { animation: none; } }
.install-hint { margin: 4px 0 12px; }
.install-retry { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
    padding: 10px 0 12px; border-top: 1px solid var(--line-soft); font-size: 12.5px; }

/* ============================================================= *
 *  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: 16px; font-weight: 600; margin: 22px 0 10px; color: var(--text); }

.badge { display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: 999px;
         font-size: 12px; font-weight: 600; text-align: center;
         background: rgba(110,118,129,0.1); color: var(--dim); border: 1px solid var(--line); }
.badge-hidden { display: none; }
.badge--info   { background: var(--purple-bg); color: var(--purple); border-color: transparent; }
.badge--ok     { background: var(--green-bg);  color: var(--green); border-color: transparent; }
.badge--danger { background: var(--red-bg);  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 { background: var(--head-bg); color: var(--dim); font-weight: 600; font-size: 12px; }
.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: 11.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: var(--purple-border); }
.dot--online   { color: var(--green); border-color: var(--green-border); }
.dot--offline  { color: var(--red-text); border-color: var(--red-border); }

.btn { display: inline-block; padding: 9px 14px; border-radius: 6px; cursor: pointer;
       background: var(--ac-fill); color: var(--ac-ink); border: 1px solid transparent;
       font-size: 13px; font-weight: 600; line-height: 1; font-family: var(--ui); }
.btn:hover { background: var(--ac-fill-hover); 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: var(--raise); }
.btn-primary { background: var(--ac-fill); color: var(--ac-ink); }
.btn-danger  { color: var(--red-text); border-color: var(--red-border); }
.btn-danger:hover { background: var(--red-bg); }

.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: 6px;
    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"],
.stack-form select, .inline-form select {
    padding: 9px 11px; border-radius: 6px; background: var(--inset);
    border: 1px solid var(--line-strong); color: var(--text); font-family: var(--mono); }
.stack-form select, .inline-form select { cursor: pointer; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--dim); }
td.stale, .stale { color: var(--amber-text); }
td.offline, .offline { color: var(--red-text); font-weight: 600; }

/* ---- login split-hero (screen 18) ---- */
.login-hero {
    position: relative; display: grid; grid-template-columns: 1fr 1fr;
    width: 860px; max-width: 94vw;
    background: var(--panel); border: 1px solid var(--neutral);
    border-radius: 6px; overflow: hidden; box-shadow: var(--shadow-lg);
}
.login-left {
    position: relative; padding: 48px 40px;
    background: var(--login-grad);
    border-right: 1px solid var(--line); overflow: hidden;
}
.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-size: 12px; color: var(--faint); }
.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: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.field-box {
    display: flex; align-items: center; gap: 10px;
    background: var(--inset); border: 1px solid var(--line-strong);
    border-radius: 6px; padding: 0 13px; margin-bottom: 18px;
}
.field-box:focus-within { border-color: var(--ac); box-shadow: 0 0 0 1px var(--ac); }
.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(--ui); font-size: 14px; padding: 12px 0; }
/* Show/hide password toggle; aria-pressed carries the state so the icon swap needs no extra class. */
.field-reveal {
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    margin-right: -6px; padding: 6px; background: none; border: none; border-radius: 6px;
    color: var(--faint); cursor: pointer;
}
.field-reveal:hover { color: var(--dim); }
.field-reveal:focus-visible { outline: 2px solid var(--ac-soft); outline-offset: 0; }
.field-reveal .eye-off,
.field-reveal[aria-pressed="true"] .eye { display: none; }
.field-reveal[aria-pressed="true"] .eye-off { display: block; }
/* Edge draws its own reveal button on password inputs — suppress it so there aren't two eyes. */
.field-box input::-ms-reveal { display: none; }
.btn-auth { width: 100%; padding: 13px; border: none; border-radius: 6px; background: var(--ac-fill); color: var(--ac-ink); font: 600 14px var(--ui); cursor: pointer; }
.btn-auth:hover { background: var(--ac-fill-hover); }
.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; }
}

/* ---- two-factor: verify / enrol / recovery codes ---- */
/* Enrolment carries a QR plus a form, so it needs more width than the 860px sign-in split. */
.login-hero-wide { width: 940px; }
/* Recovery codes have no branding panel to pair with — collapse to the single right-hand column. */
.login-hero-single { grid-template-columns: 1fr; width: 620px; }

.login-alt { margin-top: 18px; font-size: 12.5px; color: var(--dim); }
.login-alt a { color: var(--ac-text); text-decoration: none; }
.login-alt a:hover { text-decoration: underline; }

/* Six digits read as three-plus-three; spacing them out makes a transcription slip visible. */
.field-box.mfa-code input { letter-spacing: .38em; font-size: 16px; text-align: center; padding: 13px 0; }
.field-box.mfa-code input::placeholder { letter-spacing: .38em; color: var(--faintest); }

.enrol-steps { margin: 20px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.7; color: var(--dim); max-width: 300px; }
.enrol-steps li { margin-bottom: 7px; }

/* The QR is emitted with currentColor modules on a transparent ground, so it inverts with the theme.
   The white pad underneath is not decoration: scanners need a light quiet-zone to lock on, and in dark
   mode the panel behind it is near-black. */
.enrol-qr {
    display: flex; align-items: center; justify-content: center;
    width: 172px; height: 172px; margin-bottom: 18px; padding: 10px;
    background: #fff; color: #000; border-radius: 6px;
}
.enrol-qr svg { width: 100%; height: 100%; display: block; }

.enrol-manual { margin-bottom: 22px; }
.enrol-key {
    display: inline-block; padding: 7px 10px; background: var(--inset);
    border: 1px solid var(--line-strong); border-radius: 6px;
    font-family: var(--mono); font-size: 13px; letter-spacing: .08em;
    color: var(--text); user-select: all; word-break: break-all;
}

.alert-warn { background: var(--amber-bg); border: 1px solid var(--amber-border); color: var(--text); }

.recovery-codes {
    list-style: none; margin: 0 0 22px; padding: 16px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 9px 16px;
    background: var(--inset); border: 1px solid var(--line-strong); border-radius: 6px;
}
.recovery-codes code { font-family: var(--mono); font-size: 13px; color: var(--text); letter-spacing: .06em; user-select: all; }
.recovery-actions { display: flex; align-items: center; gap: 10px; }
.recovery-actions .btn { text-decoration: none; }

@media (max-width: 680px) {
    .login-hero-wide, .login-hero-single { width: auto; }
    .recovery-codes { grid-template-columns: 1fr; }
}

/* ============================================================= *
 *  NOTIFICATIONS — bell dropdown + subscription grid
 * ============================================================= */
.bell-wrap { position: relative; display: inline-flex; }
.bell-btn { position: relative; }
.bell-badge {
    position: absolute; top: -5px; right: -5px; min-width: 15px; height: 15px;
    padding: 0 4px; border-radius: 999px; background: var(--red); color: #fff;
    font-family: var(--mono); font-size: 10px; font-weight: 700; line-height: 15px;
    text-align: center; box-shadow: 0 0 0 2px var(--panel);
}
.bell-badge.is-hidden { display: none; }

.bell-panel {
    position: absolute; top: 38px; right: 0; width: 340px; max-width: 84vw;
    max-height: 68vh; overflow-y: auto; z-index: 60;
    background: var(--panel); border: 1px solid var(--line-strong); border-radius: 6px;
    box-shadow: var(--shadow-md);
}
.bell-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--head-bg); }
.bell-head .h { font-size: 14px; font-weight: 600; color: var(--text); }
.bell-head .spacer { margin-left: auto; }
.bell-link { background: none; border: none; cursor: pointer; color: var(--ac-text); font-size: 12px; font-family: var(--ui); }
.bell-link:hover { filter: brightness(1.15); }
.bell-loading, .bell-empty { padding: 26px 16px; text-align: center; font-size: 13px; color: var(--faint); }

.bell-item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); }
.bell-item:last-of-type { border-bottom: none; }
.bell-body { flex: 1; min-width: 0; }
.bell-title { font-size: 12.5px; color: var(--text); font-weight: 600; }
.bell-msg { font-size: 11.5px; color: var(--dim); line-height: 1.45; margin-top: 2px; }
.bell-time { font-family: var(--mono); font-size: 11px; color: var(--faint); margin-top: 4px; }
.bell-x { flex: none; align-self: flex-start; width: 20px; height: 20px; border: none; background: none;
          color: var(--faint); cursor: pointer; border-radius: 5px; font-size: 11px; }
.bell-x:hover { color: var(--text); background: var(--inset); }
.bell-foot { display: block; padding: 11px 14px; text-align: center; font-size: 12px; color: var(--dim); border-top: 1px solid var(--line-soft); }
.bell-foot:hover { color: var(--ac-text); text-decoration: none; }

/* Subscription grid — alert rows with Email / In-site channel toggles. */
.sub-grid-head {
    display: grid; grid-template-columns: 1fr 66px 66px; gap: 8px; align-items: center;
    padding: 9px 16px; border-bottom: 1px solid var(--line); background: var(--head-bg);
    font-size: 12px; font-weight: 600; color: var(--dim);
}
.sub-grid-head .ch, .sub-row .ch { text-align: center; justify-content: center; }
.sub-row {
    display: grid; grid-template-columns: 1fr 66px 66px; gap: 8px; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid var(--line-soft);
}
.sub-row:last-child { border-bottom: none; }
.sub-row .l2 { color: var(--faint); line-height: 1.5; margin-top: 2px; }
.sub-row .ch { display: flex; }
