/* ==========================================================================
   theme.css — the panel's single source of truth for color, typography and
   shared components.

   DARK ONLY. There is no light theme and no light/dark toggle: every value
   below is authored for a dark surface, and nothing here reads the OS
   `prefers-color-scheme` preference.

   Colors are declared exactly once, in :root, and everything else consumes
   them through var(). Never hardcode a color in a template again — if a value
   is missing here, add a token rather than inlining a literal.

   Accent policy (strict):
     - --color-primary (blue) is the ONE accent: gauges, progress bars, primary
       buttons, active nav, links, focus rings, sortable-column highlights.
     - --color-warning (amber) is reserved for genuine warning states only —
       a gauge past its warning threshold, a "this restarts the service" note.
       It must never be a default accent.
     - --color-success / --color-error carry online-healthy / offline-failed.
     - --color-purple marks special states (here: the WireGuard protocol badge).
   ========================================================================== */

:root {
    /* Tell form controls, scrollbars and the like that this is a dark UI. */
    color-scheme: dark;

    /* ── SURFACES ──────────────────────────────────────────────────────── */
    --bg-page: #1a1b1f;
    --bg-card: #23252b;
    /* Raised surfaces derived from the card color: inputs, hovers, wells. */
    --bg-elevated: #2a2d34;
    --bg-sunken: #151619;
    --bg-sidebar: #151619;
    --bg-topbar: #17181c;

    /* ── ACCENTS ───────────────────────────────────────────────────────── */
    --color-primary: #1677ff;
    --color-primary-hover: #4096ff;
    --color-primary-active: #0958d9;
    --color-success: #52c41a;
    --color-error: #ff4d4f;
    --color-warning: #faad14;
    --color-purple: #722ed1;

    /* Translucent accent washes. Percentages match the reference's selected /
       hover states so submenus, pills and tints stay consistent. */
    --primary-selected: color-mix(in srgb, var(--color-primary) 20%, transparent);
    --primary-hover: color-mix(in srgb, var(--color-primary) 10%, transparent);
    --primary-soft: color-mix(in srgb, var(--color-primary) 12%, transparent);
    --primary-faint: color-mix(in srgb, var(--color-primary) 6%, transparent);
    --primary-ring: color-mix(in srgb, var(--color-primary) 30%, transparent);
    --success-soft: color-mix(in srgb, var(--color-success) 14%, transparent);
    --error-soft: color-mix(in srgb, var(--color-error) 14%, transparent);
    --warning-soft: color-mix(in srgb, var(--color-warning) 14%, transparent);
    --purple-soft: color-mix(in srgb, var(--color-purple) 18%, transparent);

    /* ── TEXT ──────────────────────────────────────────────────────────── */
    --text: rgba(255, 255, 255, 0.88);
    --text-secondary: rgba(255, 255, 255, 0.65);
    --text-tertiary: rgba(255, 255, 255, 0.45);

    /* ── BORDERS ───────────────────────────────────────────────────────── */
    --border: rgba(255, 255, 255, 0.12);
    --border-secondary: rgba(255, 255, 255, 0.08);

    /* ── TYPOGRAPHY ────────────────────────────────────────────────────── */
    --font-sans: "IBM Plex Sans", -apple-system, system-ui, "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, monospace;
    --font-brand: "IBM Plex Mono", ui-monospace, monospace;

    /* Scale. 14px is the hard floor for body copy and 12px for captions —
       nothing in any template may go below these. */
    --fs-caption: 12px;
    /* smallest permitted size, captions/labels only */
    --fs-body: 14px;
    /* body-copy floor */
    --fs-sm: 13px;
    /* compact controls (buttons, pills) — still >= caption floor */
    --fs-md: 15px;
    --fs-heading: 15px;
    /* card titles */
    --fs-lg: 17px;
    /* prominent values inside rows */
    --fs-stat: 20px;
    /* secondary stat values */
    --fs-title: 22px;
    /* page/entity titles */
    --fs-hero: 30px;
    /* the big headline numbers (28-34px band) */
    --fs-hero-lg: 34px;
    --fs-label: 12px;
    /* uppercase kickers / section labels */

    --lh-body: 1.5;
    --lh-tight: 1.25;
    --ls-label: 0.06em;

    /* ── SHAPE / MOTION ────────────────────────────────────────────────── */
    --card-radius: 12px;
    --radius-ctl: 8px;
    --radius-pill: 999px;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), inset 0 1px rgba(255, 255, 255, 0.03);
    --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.5), inset 0 1px rgba(255, 255, 255, 0.04);
    --card-transition: transform .2s, box-shadow .25s, border-color .2s;

    /* ── LAYOUT ────────────────────────────────────────────────────────── */
    --sidebar-width: 220px;
    --topbar-h: 56px;
    --content-pad: 24px;

    /* ── SPACING ───────────────────────────────────────────────────────── */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;

    /* ── COMPATIBILITY ALIASES ─────────────────────────────────────────────
       Older rule names still used by page-specific CSS, remapped onto the
       palette above. They exist so no template can accidentally resurrect the
       retired gold accent: --accent now IS the primary blue. */
    --bg: var(--bg-page);
    --surface: var(--bg-card);
    --surface-solid: var(--bg-card);
    --surface2: var(--bg-elevated);
    --surface3: var(--bg-elevated);
    --border2: var(--border);
    --accent: var(--color-primary);
    --accent-glow: var(--primary-ring);
    --accent-dim: var(--primary-faint);
    --green: var(--color-success);
    --green-dim: var(--success-soft);
    --green-glow: color-mix(in srgb, var(--color-success) 30%, transparent);
    --danger: var(--color-error);
    --danger-dim: var(--error-soft);
    --amber: var(--color-warning);
    --amber-dim: var(--warning-soft);
    --warn: var(--color-warning);
    --warn-dim: var(--warning-soft);
    --text-dim: var(--text-secondary);
    --text-muted: var(--text-tertiary);
    --ring-track: rgba(255, 255, 255, 0.10);
    /* Traffic direction: download takes the primary accent, upload stays
       neutral. Neither is ever amber. */
    --recv-color: var(--color-primary);
    --sent-color: var(--text-secondary);
    --glass-blur: blur(12px);
}

/* Optional deeper variant. Opt in with <html data-theme="ultra-dark">.
   This is NOT a light theme — it only pushes the surfaces darker. */
:root[data-theme="ultra-dark"] {
    --bg-page: #000;
    --bg-card: #101013;
    --bg-elevated: #17171b;
    --bg-sunken: #000;
    --bg-sidebar: #000;
    --bg-topbar: #0a0a0c;
}

/* ── RESET ─────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    /* Safety net: never let a descendant produce a horizontal scrollbar.
       clip (not hidden) avoids creating a scroll container, so position:sticky
       on the topbar keeps working. */
    overflow-x: clip;
}

body {
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: var(--fs-md);
    line-height: var(--lh-body);
    background: var(--bg-page);
    color: var(--text);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Numbers must never jitter as they tick. */
body {
    font-variant-numeric: tabular-nums;
}

a {
    color: var(--color-primary);
}

/* ── AMBIENT BACKGROUND ────────────────────────────────────────────────── */
.bg-ambient::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 0%, rgba(255, 255, 255, 0.02) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(0, 0, 0, 0.3) 0%, transparent 65%);
    pointer-events: none;
}

.bg-ambient::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
}

/* ── SIDEBAR ───────────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-secondary);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    padding: 18px 16px;
    border-bottom: 1px solid var(--border-secondary);
    user-select: none;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-family: var(--font-brand);
    font-size: var(--fs-sm);
    font-weight: 500;
    letter-spacing: 0.12em;
    color: var(--text);
    text-transform: uppercase;
}

.sidebar-nav {
    list-style: none;
    padding: var(--sp-2) 0;
    flex: 1;
}

/* Nav rows: <a> for leaves, <button> for the expandable parent. Both are
   styled identically so the submenu parent reads as a normal nav item. */
.sidebar-nav a,
.sidebar-nav .nav-parent {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-sans);
    font-size: var(--fs-body);
    font-weight: 500;
    line-height: var(--lh-body);
    background: transparent;
    border: none;
    border-left: 2px solid transparent;
    text-align: left;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.sidebar-nav a:hover,
.sidebar-nav .nav-parent:hover {
    color: var(--text);
    background: var(--primary-hover);
}

.sidebar-nav a.active,
.sidebar-nav .nav-parent.active {
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    background: var(--primary-selected);
}

.sidebar-nav a svg,
.sidebar-nav .nav-parent svg {
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.sidebar-nav a:hover svg,
.sidebar-nav a.active svg,
.sidebar-nav .nav-parent:hover svg,
.sidebar-nav .nav-parent.active svg {
    opacity: 1;
}

/* ── SIDEBAR SUBMENU (Panel Settings) ──────────────────────────────────────
   The parent is a button, so clicking it expands instead of navigating. The
   panel collapses with a grid 1fr->0fr transition, which animates smoothly
   without any JS height measurement. */
.nav-chevron {
    margin-left: auto;
    display: flex;
    color: var(--text-tertiary);
    transition: transform 0.25s ease;
}

.nav-group.open .nav-chevron {
    transform: rotate(180deg);
}

.nav-sub {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.25s ease;
}

.nav-group.open .nav-sub {
    grid-template-rows: 1fr;
}

.nav-sub>ul {
    list-style: none;
    min-height: 0;
    overflow: hidden;
}

.sidebar-nav .nav-sub a {
    /* Indent to line up with the parent's label, past its icon. */
    padding: 8px 16px 8px 42px;
    font-size: var(--fs-sm);
    font-weight: 400;
    color: var(--text-secondary);
    border-left: 2px solid transparent;
    border-radius: 0;
}

.sidebar-nav .nav-sub a:hover {
    background: var(--primary-hover);
    color: var(--text);
}

.sidebar-nav .nav-sub a.active {
    background: var(--primary-selected);
    color: var(--color-primary);
    font-weight: 500;
    border-left-color: var(--color-primary);
}

.sidebar-bottom {
    border-top: 1px solid var(--border-secondary);
    padding: var(--sp-2) 0;
    flex-shrink: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 199;
}

.sidebar-overlay.visible {
    display: block;
}

/* ── CONTENT SHELL ─────────────────────────────────────────────────────── */
.content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--topbar-h);
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border-secondary);
    display: flex;
    align-items: center;
    padding: 0 var(--sp-5);
    gap: var(--sp-3);
    flex-shrink: 0;
}

.topbar-title {
    font-family: var(--font-sans);
    font-size: var(--fs-heading);
    font-weight: 600;
    color: var(--text);
}

.hamburger {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-ctl);
    line-height: 0;
    transition: color 0.15s, background 0.15s;
}

.hamburger:hover {
    color: var(--text);
    background: var(--bg-elevated);
}

.page-area {
    flex: 1;
    padding: var(--content-pad);
    width: 100%;
}

/* ── CARD ──────────────────────────────────────────────────────────────── */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-secondary);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-card);
    transition: var(--card-transition);
}

.glass-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-card-hover);
}

/* Severity outlines. These are the only places a card may glow amber, and
   they are driven by a threshold crossing, never by default styling. */
.glass-card.severity-warn {
    border-color: color-mix(in srgb, var(--color-warning) 45%, transparent) !important;
    box-shadow: 0 0 20px color-mix(in srgb, var(--color-warning) 10%, transparent) !important;
}

.glass-card.severity-critical {
    border-color: color-mix(in srgb, var(--color-error) 50%, transparent) !important;
    box-shadow: 0 0 20px color-mix(in srgb, var(--color-error) 12%, transparent) !important;
}

.card-title {
    font-family: var(--font-sans);
    font-size: var(--fs-heading);
    font-weight: 600;
    color: var(--text);
    padding-bottom: var(--sp-3);
    margin-bottom: var(--sp-4);
    border-bottom: 1px solid var(--border-secondary);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

/* Uppercase kicker/section label. */
.kicker {
    font-family: var(--font-sans);
    font-size: var(--fs-label);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--ls-label);
    color: var(--text-tertiary);
}

/* ── STATUS DOTS / ONLINE INDICATOR ────────────────────────────────────── */
.status-dot,
.live-dot,
.sidebar-brand-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.live-dot,
.sidebar-brand-dot,
.status-dot.online {
    background: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
    animation: livepulse 1.1s ease-in-out infinite;
}

.status-dot.offline {
    background: var(--text-tertiary);
    box-shadow: none;
    animation: none;
}

@keyframes livepulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.35;
    }
}

/* ── BADGES ────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: var(--fs-caption);
    font-weight: 500;
    width: fit-content;
}

.badge.online {
    background: var(--success-soft);
    color: var(--color-success);
    border: 1px solid color-mix(in srgb, var(--color-success) 30%, transparent);
}

.badge.offline {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-tertiary);
    border: 1px solid var(--border-secondary);
}

/* Protocol badges: which system a client is connected through right now.
   Informational, so they use primary and purple rather than status colors. */
.badge.proto {
    padding: 2px 8px;
    font-size: var(--fs-caption);
    font-weight: 600;
    letter-spacing: 0.04em;
}

.badge.proto.ovpn {
    background: var(--primary-soft);
    color: var(--color-primary);
    border: 1px solid color-mix(in srgb, var(--color-primary) 30%, transparent);
}

.badge.proto.wg {
    background: var(--purple-soft);
    color: #b37feb;
    border: 1px solid color-mix(in srgb, var(--color-purple) 45%, transparent);
}

/* ── PROGRESS / RATIO BARS ─────────────────────────────────────────────────
   Default fill is primary. Amber and red appear only via the modifier
   classes, which JS applies on a threshold crossing. */
.ratio-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin-top: var(--sp-3);
}

.ratio-bar-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: var(--radius-pill);
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s;
}

.ratio-bar-fill.is-success {
    background: var(--color-success);
}

.ratio-bar-fill.is-warn {
    background: var(--color-warning);
}

.ratio-bar-fill.is-critical {
    background: var(--color-error);
}

.ratio-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: var(--fs-caption);
    color: var(--text-tertiary);
    margin-top: 6px;
}

/* ── BUTTONS ───────────────────────────────────────────────────────────── */
.btn-primary {
    background: var(--color-primary);
    border: none;
    color: #fff;
    padding: 11px 24px;
    font-family: var(--font-sans);
    font-size: var(--fs-body);
    font-weight: 600;
    border-radius: var(--radius-ctl);
    cursor: pointer;
    transition: background 0.18s, box-shadow 0.18s, transform 0.15s;
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 4px 16px color-mix(in srgb, var(--color-primary) 32%, transparent);
    transform: translateY(-1px);
}

.btn-primary:active {
    background: var(--color-primary-active);
    transform: translateY(0);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-ctl);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: var(--fs-sm);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.18s, border-color 0.18s, background 0.18s;
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--border);
    background: color-mix(in srgb, var(--color-primary) 8%, var(--bg-elevated));
}

/* ── FILTER TABS ───────────────────────────────────────────────────────── */
.filter-group {
    display: flex;
    background: var(--bg-sunken);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-ctl);
    padding: 4px;
    gap: 2px;
    flex-wrap: wrap;
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 7px 16px;
    font-family: var(--font-sans);
    font-size: var(--fs-sm);
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.18s, background 0.18s;
    white-space: nowrap;
}

.filter-btn:hover {
    color: var(--text);
    background: var(--primary-hover);
}

.filter-btn.active {
    background: var(--color-primary);
    color: #fff;
}

/* ── INPUTS ────────────────────────────────────────────────────────────── */
.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-tertiary);
    pointer-events: none;
    display: flex;
    transition: color 0.2s;
}

.search-input,
.field-input {
    background: var(--bg-elevated);
    border: 1px solid var(--border-secondary);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    border-radius: var(--radius-ctl);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.search-input {
    padding: 9px 12px 9px 36px;
    width: 220px;
}

.field-input {
    width: 100%;
    padding: 10px 14px;
}

.search-input:focus,
.field-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.search-wrap:focus-within .search-icon {
    color: var(--color-primary);
}

.search-input::placeholder,
.field-input::placeholder {
    color: var(--text-tertiary);
}

.eye-btn {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    padding: 5px;
    border-radius: 5px;
    transition: color 0.15s, background 0.15s;
}

.eye-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

/* ── TABLES ────────────────────────────────────────────────────────────── */
.table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border-secondary);
    border-radius: var(--card-radius);
    overflow: hidden;
    overflow-x: auto;
    transition: border-color 0.25s;
}

.table-wrap:hover {
    border-color: var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 460px;
}

thead th {
    padding: 14px 22px;
    text-align: left;
    font-family: var(--font-sans);
    font-size: var(--fs-label);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--ls-label);
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-secondary);
    background: var(--bg-sunken);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s, background 0.15s;
}

thead th:hover {
    color: var(--text-secondary);
}

thead th.sorted {
    color: var(--color-primary);
}

.sort-arrow {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin-left: 5px;
    gap: 1px;
    vertical-align: middle;
    opacity: 0.35;
    transition: opacity 0.15s;
}

.sort-arrow .arr-up,
.sort-arrow .arr-dn {
    width: 0;
    height: 0;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    transition: border-color 0.2s;
}

.sort-arrow .arr-up {
    border-bottom: 4px solid currentColor;
}

.sort-arrow .arr-dn {
    border-top: 4px solid currentColor;
}

thead th.sorted .sort-arrow {
    opacity: 1;
}

thead th.sorted.asc .sort-arrow .arr-dn,
thead th.sorted.desc .sort-arrow .arr-up {
    opacity: 0.2;
}

thead th:hover .sort-arrow {
    opacity: 0.6;
}

tbody tr {
    border-bottom: 1px solid var(--border-secondary);
    border-left: 2px solid transparent;
    transition: background 0.12s;
}

tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--primary-hover);
}

tbody tr.row-online {
    border-left-color: var(--color-success);
}

td {
    padding: 15px 22px;
    font-size: var(--fs-body);
    white-space: nowrap;
    vertical-align: middle;
}

/* ── EMPTY STATE / SKELETON ────────────────────────────────────────────── */
.empty-state {
    padding: 56px 20px;
    text-align: center;
    color: var(--text-tertiary);
}

.empty-state h3 {
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: var(--fs-body);
}

.skeleton {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.04) 25%,
            rgba(255, 255, 255, 0.09) 50%,
            rgba(255, 255, 255, 0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.6s infinite;
}

@keyframes shimmer {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -200% 0;
    }
}

/* ── TOAST ─────────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: var(--success-soft);
    border: 1px solid color-mix(in srgb, var(--color-success) 35%, transparent);
    color: var(--color-success);
    padding: 9px 18px;
    border-radius: var(--radius-pill);
    font-size: var(--fs-body);
    font-family: var(--font-sans);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 9999;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── LIVE BADGE ────────────────────────────────────────────────────────── */
.live-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-pill);
    padding: 5px 14px;
    white-space: nowrap;
}

/* ── SHARED ANIMATIONS ─────────────────────────────────────────────────── */
@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes rowIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ── SCROLLBAR ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* ── NUMERIC TYPE ──────────────────────────────────────────────────────────
   Monospaced, tabular figures for everything that counts, so values don't
   shift width as they update. */
.info-row-value,
.stat-row-value,
.gauge-center-value,
.clients-total,
.clients-side-value,
.kv-value,
.copyable,
.hero-ip,
.count,
.count-pill,
.badge,
.time-cell,
.rel-time,
.ip-text,
.total-text,
.recv-text,
.sent-text,
.traffic-total,
.service-status-text,
.val-up,
.val-down,
.live-badge,
.pager-info,
code,
kbd {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1, "zero" 1;
}

/* ── RESPONSIVE ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --content-pad: 8px;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.6);
    }

    .content {
        margin-left: 0;
    }

    .hamburger {
        display: flex;
    }

    .search-input,
    .search-input:focus {
        width: 100%;
    }

    .search-wrap {
        flex: 1;
    }

    td,
    thead th {
        padding-left: 14px;
        padding-right: 14px;
    }
}

/* ── REDUCED MOTION ────────────────────────────────────────────────────────
   Covers the blinking online dot, the submenu chevron, card entrances and
   every other transition in one place. */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

    .live-dot,
    .sidebar-brand-dot,
    .status-dot.online {
        animation: none !important;
        opacity: 1;
    }
}
