/* ==========================================================================
   ARXD Control — design system
   Derived from the ARXD UI reference: deep navy surfaces, a single blue
   accent, high information density, thin borders, no decorative gradient noise.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
    /* Surfaces — dark (default) */
    --bg:            #04091a;
    --bg-alt:        #060d20;
    --surface:       #0a1428;
    --surface-2:     #0c1830;
    --surface-3:     #101f3d;
    --surface-hover: #0e1b36;
    --overlay:       rgba(3, 7, 18, .72);

    /* Lines */
    --border:        #16243f;
    --border-soft:   #111d33;
    --border-strong: #22375c;

    /* Text */
    --text:          #e9effa;
    --text-muted:    #93a6c8;
    --text-dim:      #6b7d9e;
    --text-invert:   #06101f;

    /* Accent */
    --primary:       #2563eb;
    --primary-hover: #1d4ed8;
    --primary-active:#1a43be;
    --primary-soft:  rgba(37, 99, 235, .14);
    --primary-line:  rgba(37, 99, 235, .38);
    --primary-fg:    #ffffff;
    --accent:        #5b9bff;
    --accent-soft:   rgba(91, 155, 255, .13);

    /* Semantic */
    --ok:        #22c55e;
    --ok-soft:   rgba(34, 197, 94, .13);
    --ok-line:   rgba(34, 197, 94, .35);
    --warn:      #f59e0b;
    --warn-soft: rgba(245, 158, 11, .13);
    --warn-line: rgba(245, 158, 11, .35);
    --bad:       #ef4444;
    --bad-soft:  rgba(239, 68, 68, .13);
    --bad-line:  rgba(239, 68, 68, .35);
    --info:      #38bdf8;
    --info-soft: rgba(56, 189, 248, .13);
    --info-line: rgba(56, 189, 248, .35);

    /* Type */
    --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-display: "Poppins", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    /* Geometry */
    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-pill: 999px;

    /* Elevation */
    --shadow-sm: 0 1px 2px rgba(2, 5, 14, .5);
    --shadow:    0 8px 26px -12px rgba(2, 5, 14, .8);
    --shadow-lg: 0 24px 60px -24px rgba(2, 5, 14, .95);
    --ring:      0 0 0 3px rgba(37, 99, 235, .28);

    /* Layout */
    --sidebar-w: 246px;
    --topbar-h:  60px;
    --container: 1240px;

    --transition: 140ms cubic-bezier(.4, 0, .2, 1);

    color-scheme: dark;
}

/* Light surfaces — the marketing pages render in both modes. */
[data-theme="light"] {
    --bg:            #ffffff;
    --bg-alt:        #f6f8fc;
    --surface:       #ffffff;
    --surface-2:     #f7f9fd;
    --surface-3:     #eef3fa;
    --surface-hover: #f1f5fb;
    --overlay:       rgba(12, 26, 53, .45);

    --border:        #e2e8f2;
    --border-soft:   #edf1f8;
    --border-strong: #cdd8ea;

    --text:          #0b1830;
    --text-muted:    #56678a;
    --text-dim:      #7b8aab;
    --text-invert:   #ffffff;

    --primary-soft:  rgba(37, 99, 235, .08);
    --primary-line:  rgba(37, 99, 235, .28);
    --accent:        #2563eb;

    --ok-soft:   rgba(22, 163, 74, .1);
    --warn-soft: rgba(217, 119, 6, .1);
    --bad-soft:  rgba(220, 38, 38, .1);
    --info-soft: rgba(2, 132, 199, .1);

    --shadow-sm: 0 1px 2px rgba(15, 30, 60, .06);
    --shadow:    0 8px 24px -14px rgba(15, 30, 60, .22);
    --shadow-lg: 0 26px 60px -28px rgba(15, 30, 60, .3);

    color-scheme: light;
}

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */

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

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -.02em;
    line-height: 1.2;
    color: var(--text);
}

h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; }

p { margin: 0 0 14px; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary); }

img, svg { max-width: 100%; display: block; }

ul, ol { margin: 0; padding-left: 20px; }

hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }

code, kbd, pre, samp { font-family: var(--font-mono); font-size: 12.5px; }

code {
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1px 5px;
    color: var(--accent);
}

pre {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    overflow: auto;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.6;
}

::selection { background: var(--primary); color: #fff; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Scrollbars — visible enough to grab, quiet enough to ignore. */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: #2f4a75; background-clip: content-box; }

/* --------------------------------------------------------------------------
   3. Utilities
   -------------------------------------------------------------------------- */

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 880px; }
.container-wide { max-width: 1520px; }

.stack > * + * { margin-top: var(--stack-gap, 16px); }
.row { display: flex; align-items: center; gap: 10px; }
/* An icon leading a row of text must keep its size rather than be squeezed by
   the flexible text beside it. Sized by Icons::svg(), not by a rule here, so a
   row can carry icons of different sizes. */
.row > svg, .strip > svg { flex: none; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.spacer { flex: 1; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid-sidebar-left { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }

.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.strong { font-weight: 600; }
.mono { font-family: var(--font-mono); }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uppercase { text-transform: uppercase; letter-spacing: .07em; font-size: 11px; font-weight: 600; }
.hidden { display: none !important; }
.full { width: 100%; }

.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-bad { color: var(--bad); }
.text-info { color: var(--info); }
.text-primary { color: var(--accent); }

.mt-0 { margin-top: 0; }  .mt-1 { margin-top: 6px; }  .mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; } .mt-4 { margin-top: 26px; } .mt-5 { margin-top: 38px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; } .mb-4 { margin-bottom: 26px; } .mb-5 { margin-bottom: 38px; }

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

/* --------------------------------------------------------------------------
   4. Typography blocks
   -------------------------------------------------------------------------- */

.eyebrow {
    font-size: 11.5px; font-weight: 600; letter-spacing: .1em;
    text-transform: uppercase; color: var(--accent);
}

.page-title { font-size: 24px; letter-spacing: -.025em; }
.page-subtitle { color: var(--text-muted); margin-top: 6px; font-size: 14px; }

.section-title { font-size: 18px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-heading p { color: var(--text-muted); font-size: 13.5px; margin: 5px 0 0; }

.section { padding: 72px 0; }
.section-tight { padding: 48px 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.hero-title { font-size: 46px; line-height: 1.1; letter-spacing: -.035em; }
.hero-lead { font-size: 16px; color: var(--text-muted); max-width: 56ch; }

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */

.btn {
    --btn-bg: var(--surface-3);
    --btn-fg: var(--text);
    --btn-border: var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    color: var(--btn-fg);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 550;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
    --btn-bg: var(--primary);
    --btn-fg: var(--primary-fg);
    --btn-border: var(--primary);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .09) inset, var(--shadow-sm);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }

.btn-ghost { --btn-bg: transparent; --btn-border: transparent; color: var(--text-muted); }
.btn-ghost:hover { --btn-bg: var(--surface-2); --btn-border: var(--border); color: var(--text); }

.btn-outline { --btn-bg: transparent; --btn-border: var(--border-strong); }
.btn-outline:hover { --btn-bg: var(--primary-soft); --btn-border: var(--primary-line); color: var(--accent); }

.btn-danger { --btn-bg: var(--bad-soft); --btn-fg: var(--bad); --btn-border: var(--bad-line); }
.btn-danger:hover { --btn-bg: var(--bad); --btn-fg: #fff; --btn-border: var(--bad); color: #fff; }

.btn-ok { --btn-bg: var(--ok-soft); --btn-fg: var(--ok); --btn-border: var(--ok-line); }
.btn-ok:hover { --btn-bg: var(--ok); --btn-fg: #04210f; --btn-border: var(--ok); color: #04210f; }

.btn-warn { --btn-bg: var(--warn-soft); --btn-fg: var(--warn); --btn-border: var(--warn-line); }
.btn-warn:hover { --btn-bg: var(--warn); --btn-fg: #241703; --btn-border: var(--warn); color: #241703; }

.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-xs { padding: 4px 9px; font-size: 11.5px; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 22px; font-size: 14.5px; border-radius: var(--radius); }
.btn-icon { padding: 8px; width: 34px; height: 34px; }
.btn-icon.btn-sm { padding: 6px; width: 28px; height: 28px; }
.btn-block { width: 100%; }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }

/* --------------------------------------------------------------------------
   6. Surfaces
   -------------------------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.card-pad { padding: 20px; }
.card-pad-sm { padding: 14px 16px; }
.card-pad-lg { padding: 28px; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
}
.card-header h2, .card-header h3 { font-size: 15px; }
.card-header .muted { font-size: 12.5px; margin-top: 3px; }
.card-body { padding: 20px; }
.card-body-flush { padding: 0; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.card-link { display: block; color: inherit; transition: border-color var(--transition), transform var(--transition); }
.card-link:hover { border-color: var(--border-strong); color: inherit; transform: translateY(-1px); }

.panel { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.panel-flush { padding: 0; overflow: hidden; }

.divider { height: 1px; background: var(--border); border: 0; margin: 16px 0; }

/* --------------------------------------------------------------------------
   7. Badges, pills, dots
   -------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-strong);
    background: var(--surface-3);
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.badge-ok    { background: var(--ok-soft);   border-color: var(--ok-line);   color: var(--ok); }
.badge-warn  { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.badge-bad   { background: var(--bad-soft);  border-color: var(--bad-line);  color: var(--bad); }
.badge-info  { background: var(--info-soft); border-color: var(--info-line); color: var(--info); }
.badge-primary { background: var(--primary-soft); border-color: var(--primary-line); color: var(--accent); }
.badge-neutral { background: var(--surface-3); border-color: var(--border); color: var(--text-muted); }

.badge-lg { padding: 5px 12px; font-size: 12.5px; }
.badge-solid { border-color: transparent; }
.badge-solid.badge-ok { background: var(--ok); color: #04210f; }
.badge-solid.badge-bad { background: var(--bad); color: #fff; }
.badge-solid.badge-warn { background: var(--warn); color: #241703; }
.badge-solid.badge-info { background: var(--info); color: #04212e; }

/* Status dot — the "Online" indicator from the device list. */
.dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--text-dim);
    flex: none;
}
.dot-ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot-warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot-bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.dot-info { background: var(--info); box-shadow: 0 0 0 3px var(--info-soft); }
.dot-lg { width: 9px; height: 9px; }

.status-inline { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 550; }
.status-inline.tone-ok { color: var(--ok); }
.status-inline.tone-warn { color: var(--warn); }
.status-inline.tone-bad { color: var(--bad); }
.status-inline.tone-info { color: var(--info); }
.status-inline.tone-neutral { color: var(--text-muted); }

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}
.chip-active { background: var(--primary-soft); border-color: var(--primary-line); color: var(--accent); font-weight: 600; }

/* --------------------------------------------------------------------------
   8. Avatars
   -------------------------------------------------------------------------- */

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--primary-soft);
    border: 1px solid var(--primary-line);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    flex: none;
    user-select: none;
}
.avatar-sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar-lg { width: 44px; height: 44px; font-size: 15px; }
.avatar-xl { width: 60px; height: 60px; font-size: 20px; }

.avatar-blue   { background: rgba(37,99,235,.16);  border-color: rgba(37,99,235,.4);  color: #7fb0ff; }
.avatar-teal   { background: rgba(20,184,166,.16); border-color: rgba(20,184,166,.4); color: #5eead4; }
.avatar-violet { background: rgba(139,92,246,.16); border-color: rgba(139,92,246,.4); color: #c4b5fd; }
.avatar-amber  { background: rgba(245,158,11,.16); border-color: rgba(245,158,11,.4); color: #fcd34d; }
.avatar-rose   { background: rgba(244,63,94,.16);  border-color: rgba(244,63,94,.4);  color: #fda4af; }
.avatar-slate  { background: rgba(148,163,184,.14); border-color: rgba(148,163,184,.32); color: #cbd5e1; }

.avatar-group { display: flex; }
.avatar-group .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }
.avatar-group .avatar:first-child { margin-left: 0; }

.identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.identity-text { min-width: 0; }
.identity-name { font-weight: 600; font-size: 13.5px; color: var(--text); }
.identity-meta { font-size: 12px; color: var(--text-dim); }

/* --------------------------------------------------------------------------
   9. Stat cards
   -------------------------------------------------------------------------- */

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-label { font-size: 12.5px; color: var(--text-muted); font-weight: 550; }
.stat-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -.03em;
    line-height: 1.1;
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.stat-unit { font-size: 13px; font-weight: 500; color: var(--text-muted); font-family: var(--font-sans); }
.stat-delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.stat-foot { font-size: 12px; color: var(--text-dim); }
.stat-icon {
    width: 30px; height: 30px; border-radius: 8px;
    display: grid; place-items: center;
    background: var(--primary-soft); color: var(--accent);
    flex: none;
}
.stat-icon svg { width: 16px; height: 16px; }

.stat-bar { height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.stat-bar span { display: block; height: 100%; background: var(--primary); border-radius: 2px; }
.stat-bar.tone-ok span { background: var(--ok); }
.stat-bar.tone-warn span { background: var(--warn); }
.stat-bar.tone-bad span { background: var(--bad); }

/* --------------------------------------------------------------------------
   10. Progress & meters
   -------------------------------------------------------------------------- */

/* `display: block` on the track is load-bearing: `.meter` is emitted as a
   <span>, and height/overflow do not apply to an inline box, which would make
   the whole bar disappear. */
.meter { display: block; height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width 240ms ease; }
.meter.tone-ok > span { background: var(--ok); }
.meter.tone-warn > span { background: var(--warn); }
.meter.tone-bad > span { background: var(--bad); }
.meter-lg { height: 9px; }
.meter-sm { height: 4px; }

.metric-row { display: grid; grid-template-columns: 108px 1fr 56px; align-items: center; gap: 12px; }
.metric-value { text-align: right; font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 600; }

/* --------------------------------------------------------------------------
   11. Tables
   -------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left;
    padding: 11px 16px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-dim);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
    color: var(--text);
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .cell-tight { padding: 8px 12px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table-row-link { cursor: pointer; }
.table-empty { padding: 44px 20px; text-align: center; color: var(--text-muted); }

.table-caption {
    padding: 12px 16px;
    font-size: 12px;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

.table-compact th { padding: 8px 12px; }
.table-compact td { padding: 9px 12px; font-size: 13px; }

/* --------------------------------------------------------------------------
   12. Forms
   -------------------------------------------------------------------------- */

.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.label .req { color: var(--bad); margin-left: 2px; }

.hint { font-size: 12px; color: var(--text-dim); margin-top: 5px; }

.input, .select, .textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    line-height: 1.4;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    appearance: none;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
    background: var(--bg);
}
.input::placeholder, .textarea::placeholder { color: var(--text-dim); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: .6; cursor: not-allowed; }

.input-sm { padding: 6px 10px; font-size: 12.5px; }
.textarea { min-height: 110px; resize: vertical; }
.textarea-lg { min-height: 190px; }

.select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2393a6c8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    padding-right: 32px;
}

.input-error { border-color: var(--bad) !important; }
.input-error:focus { box-shadow: 0 0 0 3px var(--bad-soft); }
.field-error { color: var(--bad); font-size: 12.5px; margin-top: 5px; display: flex; align-items: center; gap: 5px; }

.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .btn { border-radius: 0 var(--radius) var(--radius) 0; margin-left: -1px; }

.input-inline { display: flex; align-items: center; gap: 10px; }
.input-inline .input { flex: 1; }

/* Search field with a leading glyph. */
.search { position: relative; }
.search .input { padding-left: 34px; }
.search svg {
    position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
    width: 15px; height: 15px; color: var(--text-dim); pointer-events: none;
}

/* Checkbox / radio */
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13.5px; }
.check + .check { margin-top: 10px; }
.check input[type="checkbox"], .check input[type="radio"] {
    appearance: none;
    width: 17px; height: 17px;
    margin: 1px 0 0;
    border: 1px solid var(--border-strong);
    background: var(--bg-alt);
    border-radius: 4px;
    cursor: pointer;
    flex: none;
    position: relative;
    transition: background var(--transition), border-color var(--transition);
}
.check input[type="radio"] { border-radius: 50%; }
.check input:checked { background: var(--primary); border-color: var(--primary); }
.check input:checked::after {
    content: "";
    position: absolute;
    left: 5px; top: 1.5px;
    width: 5px; height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.check input[type="radio"]:checked::after {
    left: 5px; top: 5px; width: 5px; height: 5px;
    border: 0; border-radius: 50%; background: #fff; transform: none;
}
.check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check-text { line-height: 1.4; }
.check-text .hint { margin-top: 2px; }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
    width: 38px; height: 21px;
    border-radius: 999px;
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    position: relative;
    transition: background var(--transition), border-color var(--transition);
    flex: none;
}
.switch-track::after {
    content: "";
    position: absolute;
    top: 2px; left: 2px;
    width: 15px; height: 15px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform var(--transition), background var(--transition);
}
.switch input:checked + .switch-track { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(17px); background: #fff; }
.switch input:focus-visible + .switch-track { box-shadow: var(--ring); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid-3 .span-3 { grid-column: span 3; }

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.filters .input, .filters .select { width: auto; min-width: 150px; }
.filters .search { flex: 1; min-width: 220px; max-width: 380px; }

/* --------------------------------------------------------------------------
   13. Alerts & toasts
   -------------------------------------------------------------------------- */

.alert {
    display: flex;
    gap: 12px;
    padding: 13px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-size: 13.5px;
    align-items: flex-start;
}
.alert svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-weight: 600; margin-bottom: 2px; }
.alert-success { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.alert-error   { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.alert-warning { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.alert-info    { background: var(--info-soft); border-color: var(--info-line); color: var(--info); }

.toast-region {
    position: fixed;
    top: 16px; right: 16px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-lg);
    font-size: 13.5px;
    animation: toast-in 200ms ease both;
}
.toast-out { animation: toast-out 160ms ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(14px); } }
.toast-close { background: none; border: 0; color: var(--text-dim); cursor: pointer; padding: 0 2px; font-size: 16px; line-height: 1; }
.toast-close:hover { color: var(--text); }

/* --------------------------------------------------------------------------
   14. Tabs & segmented controls
   -------------------------------------------------------------------------- */

.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: 10px 14px;
    font-size: 13.5px;
    font-weight: 550;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color var(--transition), border-color var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--primary); }
.tab-count {
    display: inline-block; margin-left: 6px;
    padding: 1px 6px; border-radius: 999px;
    background: var(--surface-3); font-size: 11px; font-weight: 600;
}
.tab.active .tab-count { background: var(--primary-soft); color: var(--accent); }

.segmented {
    display: inline-flex;
    padding: 3px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    gap: 2px;
}
.segmented a, .segmented button {
    padding: 6px 13px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 550;
    color: var(--text-muted);
    border: 0;
    background: none;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}
.segmented a:hover, .segmented button:hover { color: var(--text); }
.segmented .active { background: var(--primary); color: #fff; }

/* --------------------------------------------------------------------------
   15. Dropdown menus
   -------------------------------------------------------------------------- */

.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 200px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 5px;
    z-index: 60;
    display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--text);
    background: none;
    border: 0;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition);
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-hover); color: var(--text); }
.dropdown-menu svg { width: 15px; height: 15px; color: var(--text-dim); flex: none; }
.dropdown-menu .danger { color: var(--bad); }
.dropdown-menu .danger svg { color: var(--bad); }
.dropdown-divider { height: 1px; background: var(--border); margin: 5px 0; }
.dropdown-label { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); }

/* --------------------------------------------------------------------------
   16. Marketing chrome
   -------------------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.site-header-inner {
    display: flex;
    align-items: center;
    gap: 26px;
    height: var(--topbar-h);
}

.brand { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: .01em; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-arxd { color: var(--text); }
.brand-dot { color: var(--accent); }

.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a {
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
    transition: color var(--transition), background var(--transition);
    position: relative;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a.active { color: var(--text); }
.site-nav a.active::after {
    content: "";
    position: absolute;
    left: 12px; right: 12px; bottom: -1px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); padding: 6px; cursor: pointer; }

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-alt);
    padding: 52px 0 26px;
    margin-top: auto;
}
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 34px; }
.footer-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin-bottom: 12px; }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.footer-links a { font-size: 13.5px; color: var(--text-muted); }
.footer-links a:hover { color: var(--accent); }
.footer-bottom {
    margin-top: 38px; padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
    font-size: 12.5px; color: var(--text-dim);
}

/* Hero */
.hero {
    position: relative;
    padding: 68px 0 72px;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(1100px 460px at 78% -12%, rgba(37, 99, 235, .2), transparent 62%),
        radial-gradient(700px 340px at 8% 108%, rgba(37, 99, 235, .1), transparent 66%),
        var(--bg);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 52px; align-items: center; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

.hero-visual { position: relative; }
.hero-visual img, .hero-visual svg { width: 100%; height: auto; border-radius: var(--radius-xl); }

.page-hero {
    padding: 56px 0 40px;
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(900px 320px at 82% -30%, rgba(37, 99, 235, .16), transparent 64%),
        var(--bg);
}

/* Feature tiles (the 4×2 icon grid under the hero) */
.feature-tile {
    padding: 22px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    transition: border-color var(--transition), background var(--transition), transform var(--transition);
}
.feature-tile:hover { border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-2px); }
.feature-tile h3 { font-size: 14.5px; margin-bottom: 6px; }
.feature-tile p { font-size: 13px; color: var(--text-muted); margin: 0; }
.feature-icon {
    width: 34px; height: 34px;
    border-radius: 9px;
    display: grid; place-items: center;
    background: var(--primary-soft);
    border: 1px solid var(--primary-line);
    color: var(--accent);
    margin-bottom: 14px;
}
.feature-icon svg { width: 17px; height: 17px; }

/* Borderless variant used in the reference's second hero row */
.feature-tile-plain { border-color: transparent; background: transparent; padding: 18px 14px; }
.feature-tile-plain:hover { background: transparent; border-color: transparent; transform: none; }

.stats-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    overflow: hidden;
}
.stats-strip > div {
    padding: 22px 18px;
    text-align: center;
    border-right: 1px solid var(--border);
}
.stats-strip > div:last-child { border-right: 0; }
.stats-strip .value { font-family: var(--font-display); font-size: 25px; font-weight: 600; letter-spacing: -.03em; }
.stats-strip .label { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

/* Pricing */
.price-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 26px 22px;
    display: flex;
    flex-direction: column;
    position: relative;
}
.price-card.featured { border-color: var(--primary-line); box-shadow: 0 0 0 1px var(--primary-line), var(--shadow-lg); }
.price-badge {
    position: absolute; top: -11px; left: 22px;
    background: var(--primary); color: #fff;
    font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
    padding: 3px 10px; border-radius: 999px;
}
.price-name { font-size: 15px; font-weight: 600; }
.price-amount { font-family: var(--font-display); font-size: 38px; font-weight: 600; letter-spacing: -.04em; margin: 12px 0 2px; display: flex; align-items: baseline; gap: 4px; }
.price-amount .period { font-size: 13px; font-weight: 500; color: var(--text-muted); font-family: var(--font-sans); }
.price-desc { font-size: 13px; color: var(--text-muted); min-height: 38px; }
.price-features { list-style: none; padding: 0; margin: 18px 0 22px; display: grid; gap: 10px; flex: 1; }
.price-features li { display: flex; gap: 9px; font-size: 13px; color: var(--text-muted); align-items: flex-start; }
.price-features svg { width: 15px; height: 15px; color: var(--ok); flex: none; margin-top: 2px; }

/* Industry tiles */
.industry-tile {
    padding: 20px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    transition: border-color var(--transition), transform var(--transition);
}
.industry-tile:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.industry-tile h3 { font-size: 14.5px; margin: 12px 0 6px; }
.industry-tile p { font-size: 12.5px; color: var(--text-muted); margin: 0; }
.industry-icon { width: 30px; height: 30px; color: var(--accent); }
.industry-icon svg { width: 22px; height: 22px; }

/* Service cards */
.service-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
    transition: border-color var(--transition), transform var(--transition), background var(--transition);
}
.service-card:hover { border-color: var(--primary-line); transform: translateY(-2px); background: var(--surface-2); }
.service-card h3 { font-size: 16px; margin: 14px 0 8px; }
.service-card p { font-size: 13px; color: var(--text-muted); flex: 1; }
.service-more { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; }
.service-more svg { width: 13px; height: 13px; transition: transform var(--transition); }
.service-card:hover .service-more svg { transform: translateX(3px); }

.cta-band {
    border: 1px solid var(--primary-line);
    border-radius: var(--radius-xl);
    background:
        radial-gradient(600px 240px at 88% 0%, rgba(37, 99, 235, .22), transparent 68%),
        var(--surface);
    padding: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 26px;
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   17. Application shell
   -------------------------------------------------------------------------- */

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

.sidebar {
    width: var(--sidebar-w);
    flex: none;
    background: var(--bg-alt);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 30;
}
.sidebar-head {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    flex: none;
}
.sidebar-nav { padding: 12px 10px; flex: 1; }
.sidebar-section { margin-bottom: 18px; }
.sidebar-label {
    padding: 0 10px 7px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 2px;
    transition: background var(--transition), color var(--transition);
    position: relative;
}
.sidebar-link:hover { background: var(--surface-2); color: var(--text); }
.sidebar-link.active { background: var(--primary-soft); color: var(--accent); font-weight: 600; }
.sidebar-link.active::before {
    content: "";
    position: absolute;
    left: -10px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 17px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}
.sidebar-link svg { width: 16px; height: 16px; flex: none; opacity: .9; }
.sidebar-link .count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text-muted);
}
.sidebar-link.active .count { background: var(--primary); color: #fff; }
.sidebar-link .count-alert { background: var(--bad); color: #fff; }

.sidebar-foot { padding: 12px 10px; border-top: 1px solid var(--border); flex: none; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius);
    transition: background var(--transition);
    color: var(--text);
    width: 100%;
    border: 0;
    background: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}
.sidebar-user:hover { background: var(--surface-2); color: var(--text); }

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

.topbar {
    height: var(--topbar-h);
    flex: none;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 22px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.crumbs { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-dim); min-width: 0; }
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: .5; }
.crumbs .current { color: var(--text); font-weight: 550; }

.topbar-search { position: relative; width: min(420px, 40vw); }
.topbar-search .input { padding-left: 34px; background: var(--surface-2); }

.icon-btn {
    position: relative;
    display: grid; place-items: center;
    width: 34px; height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .dot-badge {
    position: absolute; top: 5px; right: 5px;
    min-width: 15px; height: 15px; padding: 0 3px;
    border-radius: 999px;
    background: var(--bad); color: #fff;
    font-size: 9.5px; font-weight: 700;
    display: grid; place-items: center;
    border: 2px solid var(--bg);
}

.page { padding: 24px 22px 44px; flex: 1; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.breadcrumb-bar { margin-bottom: 14px; }

/* --------------------------------------------------------------------------
   18. Domain components
   -------------------------------------------------------------------------- */

/* Device / asset list row */
.entity-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.entity-icon {
    width: 30px; height: 30px;
    border-radius: 7px;
    display: grid; place-items: center;
    background: var(--surface-3);
    border: 1px solid var(--border);
    flex: none;
    color: var(--text-muted);
}
.entity-icon svg { width: 15px; height: 15px; }
.entity-title { font-weight: 600; font-size: 13.5px; color: var(--text); }
.entity-meta { font-size: 12px; color: var(--text-dim); }

.os-mark {
    width: 26px; height: 26px;
    border-radius: 6px;
    display: grid; place-items: center;
    background: var(--surface-3);
    border: 1px solid var(--border);
    flex: none;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}
.os-windows { color: #60a5fa; }
.os-ubuntu  { color: #fb923c; }
.os-debian  { color: #f472b6; }
.os-redhat  { color: #f87171; }
.os-centos  { color: #a78bfa; }
.os-fedora  { color: #38bdf8; }
.os-suse    { color: #4ade80; }
.os-arch    { color: #67e8f9; }
.os-amazon  { color: #fbbf24; }
.os-linux   { color: #94a3b8; }
.os-apple   { color: #cbd5e1; }

/* Health ring */
.health-ring { display: inline-grid; place-items: center; position: relative; }
.health-ring svg { transform: rotate(-90deg); }
.health-ring .track { stroke: var(--surface-3); }
.health-ring .value { stroke: var(--ok); stroke-linecap: round; transition: stroke-dashoffset 400ms ease; }
.health-ring.tone-warn .value { stroke: var(--warn); }
.health-ring.tone-bad .value { stroke: var(--bad); }
.health-ring.tone-neutral .value { stroke: var(--text-dim); }
.health-ring-text {
    position: absolute;
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -.03em;
}

/* Sparkline */
.spark { display: block; width: 100%; height: 34px; overflow: hidden; }
.spark .line { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spark .area { fill: currentColor; opacity: .12; stroke: none; }
.spark.tone-ok { color: var(--ok); }
.spark.tone-warn { color: var(--warn); }
.spark.tone-bad { color: var(--bad); }
.spark.tone-neutral { color: var(--text-dim); }

/* Ticket thread */
.thread { display: grid; gap: 18px; }
.thread-item { display: grid; grid-template-columns: 34px 1fr; gap: 13px; }
.thread-body {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.thread-item-staff .thread-body { background: var(--surface); border-color: var(--border-strong); }
.thread-item-internal .thread-body { background: var(--warn-soft); border-color: var(--warn-line); }
.thread-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; flex-wrap: wrap; }
.thread-author { font-weight: 600; font-size: 13.5px; }
.thread-time { font-size: 12px; color: var(--text-dim); margin-left: auto; }
.thread-text { font-size: 13.5px; color: var(--text-muted); white-space: pre-wrap; word-break: break-word; }
.thread-item-staff .thread-text { color: var(--text); }

/* Timeline */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
    content: "";
    position: absolute;
    left: 5px; top: 6px; bottom: 6px;
    width: 1px;
    background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
    content: "";
    position: absolute;
    left: -21px; top: 5px;
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 2px solid var(--border-strong);
}
.timeline-item.tone-ok::before { background: var(--ok); border-color: var(--ok-line); }
.timeline-item.tone-warn::before { background: var(--warn); border-color: var(--warn-line); }
.timeline-item.tone-bad::before { background: var(--bad); border-color: var(--bad-line); }
.timeline-item.tone-info::before { background: var(--info); border-color: var(--info-line); }
.timeline-title { font-size: 13.5px; font-weight: 550; }
.timeline-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* Quick actions list (portal sidebar) */
.quick-list { display: grid; gap: 4px; }
.quick-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 13.5px;
    color: var(--text);
    transition: background var(--transition), border-color var(--transition);
}
.quick-item:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.quick-item svg { width: 16px; height: 16px; color: var(--accent); flex: none; }

/* Key/value list */
.kv { display: grid; gap: 0; }
.kv-row {
    display: grid;
    grid-template-columns: minmax(120px, 38%) 1fr;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13.5px;
}
.kv-row:last-child { border-bottom: 0; }
.kv-key { color: var(--text-dim); }
.kv-value { color: var(--text); word-break: break-word; }

/* Empty state */
.empty { text-align: center; padding: 46px 22px; }
.empty-icon {
    width: 46px; height: 46px;
    margin: 0 auto 14px;
    border-radius: 12px;
    display: grid; place-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
}
.empty-icon svg { width: 21px; height: 21px; }
.empty h3 { font-size: 15px; margin-bottom: 6px; }
.empty p { font-size: 13.5px; color: var(--text-muted); max-width: 44ch; margin: 0 auto 18px; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 5px; justify-content: center; padding: 16px 0 4px; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 32px; height: 32px;
    padding: 0 9px;
    display: grid; place-items: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-size: 13px;
    color: var(--text-muted);
}
.pagination a:hover { border-color: var(--border-strong); color: var(--text); }
.pagination .active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pagination .disabled { opacity: .45; pointer-events: none; }
.pagination .gap { border: 0; background: none; }

/* Command console */
.console {
    background: #030812;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.65;
    color: #b7c8e6;
    max-height: 420px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.console-line { display: block; }
.console-prompt { color: var(--ok); }
.console-error { color: #fca5a5; }

/* Banner / notice strip */
.strip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    border: 1px solid var(--primary-line);
    font-size: 13.5px;
    color: var(--accent);
}
.strip svg { width: 16px; height: 16px; flex: none; }

/* Enrollment token display */
.token-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-alt);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--accent);
    overflow-x: auto;
    white-space: nowrap;
}

/* Two-factor enrollment QR code.
   Always dark modules on a light ground, even in the dark theme: most scanners
   assume that polarity and read an inverted code as noise. */
.qr-figure {
    display: inline-block;
    max-width: 100%;
    padding: 12px;
    background: #ffffff;
    border-radius: 10px;
    line-height: 0;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .3);
}
.qr-figure svg { display: block; margin: 0 auto; }

/* Auth split layout */
.auth-shell { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 44px 24px; }
.auth-form-wrap { width: 100%; max-width: 396px; }
.auth-aside {
    position: relative;
    background:
        radial-gradient(760px 460px at 60% 8%, rgba(37, 99, 235, .3), transparent 64%),
        radial-gradient(600px 420px at 12% 92%, rgba(37, 99, 235, .16), transparent 66%),
        #050c1d;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 56px 48px;
    overflow: hidden;
}
.auth-aside h2 { font-size: 26px; margin-bottom: 14px; }
.auth-aside p { color: #a9bcdd; font-size: 14.5px; max-width: 44ch; }
.auth-aside .auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; }
.auth-aside .auth-points li { display: flex; gap: 11px; font-size: 14px; color: #c3d2ec; align-items: flex-start; }
.auth-aside .auth-points svg { width: 17px; height: 17px; color: #5b9bff; flex: none; margin-top: 2px; }

.auth-mark { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 26px; text-align: center; }
.auth-mark .brand { font-size: 27px; }
.auth-title { font-size: 21px; }
.auth-sub { color: var(--text-muted); font-size: 13.5px; margin-top: 5px; }

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-dim); font-size: 11.5px; font-weight: 600; letter-spacing: .08em; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.oauth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.oauth-btn { justify-content: center; }

/* --------------------------------------------------------------------------
   19. Responsive
   -------------------------------------------------------------------------- */

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 29;
    backdrop-filter: blur(2px);
}

@media (max-width: 1200px) {
    .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-sidebar { grid-template-columns: minmax(0, 1fr); }
    .grid-sidebar-left { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1080px) {
    .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 38px; }
    .hero-visual { order: -1; max-width: 460px; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-strip { grid-template-columns: repeat(2, 1fr); }
    .stats-strip > div:nth-child(2) { border-right: 0; }
    .stats-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
}

@media (max-width: 900px) {
    .nav-toggle { display: inline-flex; }
    .sidebar {
        position: fixed;
        left: 0; top: 0;
        transform: translateX(-100%);
        transition: transform 200ms ease;
        box-shadow: var(--shadow-lg);
    }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .sidebar-backdrop { display: block; }
    .site-nav {
        display: none;
        position: absolute;
        top: var(--topbar-h); left: 0; right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 10px 16px 18px;
        background: var(--bg-alt);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
    }
    body.nav-open .site-nav { display: flex; }
    .site-nav a { padding: 11px 10px; font-size: 14.5px; }
    .site-nav a.active::after { display: none; }
    .header-actions .btn:not(.btn-primary) { display: none; }
    .hero-title { font-size: 34px; }
    .page { padding: 18px 16px 40px; }
    .topbar { padding: 0 16px; }
    .container { padding: 0 16px; }
    .section { padding: 52px 0; }
    .card-pad-lg { padding: 20px; }
    .grid-sidebar, .grid-sidebar-left { grid-template-columns: minmax(0, 1fr); }
    .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .form-grid .span-2, .form-grid-3 .span-3 { grid-column: span 1; }
    .topbar-search { display: none; }
}

@media (max-width: 640px) {
    .grid-2, .grid-3, .grid-4, .grid-5, .grid-auto { grid-template-columns: minmax(0, 1fr); }
    .footer-grid { grid-template-columns: 1fr; }
    .hero { padding: 44px 0 48px; }
    .hero-title { font-size: 29px; }
    .page-title { font-size: 20px; }
    .stat-value { font-size: 24px; }
    .stats-strip { grid-template-columns: 1fr; }
    .stats-strip > div { border-right: 0; border-bottom: 1px solid var(--border); }
    .stats-strip > div:last-child { border-bottom: 0; }
    .cta-band { padding: 24px; }
    .table th, .table td { padding: 10px 12px; }
    .modal-card { max-height: 92vh; }
    .thread-item { grid-template-columns: 1fr; gap: 8px; }
    .thread-item .avatar { display: none; }
    .kv-row { grid-template-columns: 1fr; gap: 2px; }
    .filters { flex-direction: column; align-items: stretch; }
    .filters .input, .filters .select, .filters .search { width: 100%; max-width: none; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1; }
}

/* --------------------------------------------------------------------------
   20. Motion & print
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

@media print {
    .sidebar, .topbar, .site-header, .site-footer, .page-actions, .toast-region { display: none !important; }
    body { background: #fff; color: #000; }
    .card { border-color: #ccc; break-inside: avoid; }
}

/* --------------------------------------------------------------------------
   21. Modal
   -------------------------------------------------------------------------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 16px 16px;
    background: var(--overlay);
    backdrop-filter: blur(3px);
    overflow-y: auto;
}
.modal.open { display: flex; }
.modal-card {
    width: 100%;
    max-width: 560px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: modal-in 160ms cubic-bezier(.2, .9, .3, 1) both;
}
.modal-card-lg { max-width: 780px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(-12px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.modal-close { background: none; border: 0; color: var(--text-dim); font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 4px; }
.modal-close:hover { color: var(--text); }
