/* ══════════════════════════════════════════════════════════════
   Server Scout — Design System & Shared Styles
   ══════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties (Dark Theme — Default) ── */
:root {
    /* Backgrounds */
    --color-bg-primary: #0f1117;
    --color-bg-secondary: #161b22;
    --color-bg-tertiary: #0d1117;
    --color-bg-hover: #1c2129;

    /* Text */
    --color-text-primary: #f0f6fc;
    --color-text-secondary: #e1e4e8;
    --color-text-tertiary: #8b949e;
    --color-text-muted: #484f58;

    /* Borders */
    --color-border-default: #21262d;
    --color-border-muted: #30363d;

    /* Accent */
    --color-accent: #58a6ff;
    --color-accent-subtle: rgba(88, 166, 255, 0.07);
    --color-accent-muted: rgba(88, 166, 255, 0.13);

    /* Status */
    --color-success: #7ee787;
    --color-warning: #d29922;
    --color-danger: #f85149;

    /* Fills */
    --fill-green: #7ee787;
    --fill-blue: #58a6ff;
    --fill-yellow: #d29922;
    --fill-purple: #bc8cff;
    --fill-red: #f85149;
    --fill-cyan: #39d2c0;
    --fill-amber: #e3b341;

    /* Buttons */
    --color-btn-primary-bg: #238636;
    --color-btn-primary-hover: #2ea043;
    --color-btn-primary-text: #fff;
    --color-btn-bg: #21262d;
    --color-btn-border: #30363d;
    --color-btn-text: #e1e4e8;

    /* Graph */
    --color-graph-bg: #0d1117;
    --color-graph-grid: #21262d;
    --color-graph-label: #484f58;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: -4px 0 20px rgba(0, 0, 0, 0.3);
    --shadow-focus: 0 0 0 3px rgba(88, 166, 255, 0.3);

    /* Overlays */
    --color-overlay: rgba(0, 0, 0, 0.6);
    --color-overlay-light: rgba(0, 0, 0, 0.3);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

    /* Text sizes */
    --text-xs: 0.65rem;
    --text-sm: 0.75rem;
    --text-base: 0.85rem;
    --text-lg: 0.95rem;
    --text-xl: 1.2rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Radii */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;
    --radius-2xl: 12px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ── Light Theme Overrides ── */
[data-theme="light"] {
    --color-bg-primary: #f6f8fa;
    --color-bg-secondary: #ffffff;
    --color-bg-tertiary: #f0f2f5;
    --color-bg-hover: #eaeef2;

    --color-text-primary: #1f2328;
    --color-text-secondary: #31363f;
    --color-text-tertiary: #656d76;
    --color-text-muted: #8b949e;

    --color-border-default: #d1d9e0;
    --color-border-muted: #d8dee4;

    --color-accent: #0969da;
    --color-accent-subtle: rgba(9, 105, 218, 0.07);
    --color-accent-muted: rgba(9, 105, 218, 0.13);

    --color-success: #1a7f37;
    --color-warning: #9a6700;
    --color-danger: #d1242f;

    --fill-green: #2da44e;
    --fill-blue: #218bff;
    --fill-yellow: #bf8700;
    --fill-purple: #8250df;
    --fill-red: #cf222e;
    --fill-cyan: #1b7c83;
    --fill-amber: #9a6700;

    --color-btn-primary-bg: #1f883d;
    --color-btn-primary-hover: #1a7f37;
    --color-btn-primary-text: #fff;
    --color-btn-bg: #f6f8fa;
    --color-btn-border: #d1d9e0;
    --color-btn-text: #31363f;

    --color-graph-bg: #f0f2f5;
    --color-graph-grid: #d1d9e0;
    --color-graph-label: #656d76;

    --shadow-sm: 0 1px 2px rgba(27, 31, 36, 0.12);
    --shadow-md: 0 4px 12px rgba(27, 31, 36, 0.12);
    --shadow-lg: -4px 0 20px rgba(27, 31, 36, 0.12);
    --shadow-focus: 0 0 0 3px rgba(9, 105, 218, 0.3);

    --color-overlay: rgba(27, 31, 36, 0.5);
    --color-overlay-light: rgba(27, 31, 36, 0.15);
}

/* ── Reset & Base ── */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    background: var(--color-bg-primary);
    color: var(--color-text-secondary);
    min-height: 100vh;
    padding: var(--space-8);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* ── Header ── */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border-default);
    flex-wrap: wrap;
    gap: var(--space-4);
}

header h1 {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--color-text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header-actions .form-group {
    margin: 0;
}

/* ── Status Badge ── */
.status-badge {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-base);
    color: var(--color-success);
    transition: color var(--transition-slow);
}

.status-badge.error { color: var(--color-danger); }
.status-badge.warning { color: var(--color-warning); }

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--color-success);
    border-radius: 50%;
    animation: pulse 2s infinite;
    transition: background var(--transition-slow);
}

.status-badge.error .status-dot { background: var(--color-danger); }
.status-badge.warning .status-dot { background: var(--color-warning); }

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

/* ── Grid (legacy) ── */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-5);
}

/* ── Card ── */
.card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    transition: border-color var(--transition-base);
}

.card:hover { border-color: color-mix(in srgb, var(--color-accent) 27%, transparent); }
.card.wide { grid-column: 1 / -1; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.card-title {
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-tertiary);
}

.card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: var(--space-1);
}

.card-sub {
    font-size: 0.8rem;
    color: var(--color-text-tertiary);
}

/* ── Progress Bar ── */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--color-border-default);
    border-radius: 3px;
    margin-top: var(--space-4);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

/* ── Fill Colors ── */
.fill-green  { background: var(--fill-green); }
.fill-blue   { background: var(--fill-blue); }
.fill-yellow { background: var(--fill-yellow); }
.fill-purple { background: var(--fill-purple); }
.fill-red    { background: var(--fill-red); }
.fill-cyan   { background: var(--fill-cyan); }
.fill-amber  { background: var(--fill-amber); }

/* ── Icon Backgrounds ── */
.icon-green  { background: color-mix(in srgb, var(--fill-green) 10%, transparent); color: var(--fill-green); }
.icon-blue   { background: color-mix(in srgb, var(--fill-blue) 10%, transparent); color: var(--fill-blue); }
.icon-yellow { background: color-mix(in srgb, var(--fill-yellow) 10%, transparent); color: var(--fill-yellow); }
.icon-purple { background: color-mix(in srgb, var(--fill-purple) 10%, transparent); color: var(--fill-purple); }
.icon-red    { background: color-mix(in srgb, var(--fill-red) 10%, transparent); color: var(--fill-red); }
.icon-cyan   { background: color-mix(in srgb, var(--fill-cyan) 10%, transparent); color: var(--fill-cyan); }
.icon-amber  { background: color-mix(in srgb, var(--fill-amber) 10%, transparent); color: var(--fill-amber); }

/* ── Detail Rows ── */
.detail-rows { margin-top: var(--space-4); }

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: var(--text-base);
    border-bottom: 1px solid var(--color-border-default);
}

.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--color-text-tertiary); }
.detail-value { color: var(--color-text-secondary); font-weight: 500; }

/* ── Graph ── */
.graph-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.graph-stats { display: flex; gap: var(--space-6); }
.graph-stat { text-align: right; }

.graph-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-tertiary);
    margin-bottom: 0.15rem;
}

.graph-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.graph-stat-value.rx { color: var(--fill-blue); }
.graph-stat-value.tx { color: var(--fill-green); }

.graph-wrap {
    position: relative;
    width: 100%;
    height: 180px;
    margin-top: var(--space-2);
}

.graph-wrap canvas {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-md);
}

.graph-legend {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
    margin-top: var(--space-3);
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot--rx { background: var(--fill-blue); }
.legend-dot--tx { background: var(--fill-green); }

/* ── Range Tabs (history graphs) ── */
.range-tabs {
    display: flex;
    gap: var(--space-1);
}

.range-tab {
    padding: var(--space-1) 0.6rem;
    font-size: 0.7rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-muted);
    background: transparent;
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all var(--transition-base);
}

.range-tab:hover { border-color: var(--color-accent); color: var(--color-accent); }
.range-tab.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

/* ══════════════════════════════════════════════════════════════
   Overview Page — Filter Toolbar & Card Grid
   ══════════════════════════════════════════════════════════════ */

/* ── Server Group ── */
.server-group {
    margin-bottom: var(--space-6);
}

.group-header {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-tertiary);
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.group-header:hover { background: var(--color-bg-hover); }

.group-count {
    font-weight: 400;
    color: var(--color-text-muted);
    font-size: 0.7rem;
    margin-left: auto;
}

/* ── Server Row (legacy table view) ── */
.server-row {
    display: grid;
    grid-template-columns: 24px 1fr repeat(4, 80px) 80px 60px;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-default);
    border-top: none;
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: var(--text-base);
}

.server-row:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.server-row:hover { background: var(--color-bg-hover); }

.server-row .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    justify-self: center;
}

/* ── Status Dots ── */
.dot.online  { background: var(--fill-green); box-shadow: 0 0 6px color-mix(in srgb, var(--fill-green) 27%, transparent); }
.dot.warning { background: var(--fill-yellow); box-shadow: 0 0 6px color-mix(in srgb, var(--fill-yellow) 27%, transparent); }
.dot.offline { background: var(--fill-red); box-shadow: 0 0 6px color-mix(in srgb, var(--fill-red) 27%, transparent); }

.server-name {
    font-weight: 500;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metric-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.metric-cell.green  { color: var(--fill-green); }
.metric-cell.yellow { color: var(--fill-yellow); }
.metric-cell.red    { color: var(--fill-red); }
.metric-cell.muted  { color: var(--color-text-muted); }

/* ── Buttons ── */
.btn {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-btn-border);
    background: var(--color-btn-bg);
    color: var(--color-btn-text);
    font-size: var(--text-base);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-sans);
}

.btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.btn:disabled { opacity: 0.5; cursor: default; pointer-events: none; }

.btn-primary {
    background: var(--color-btn-primary-bg);
    border-color: var(--color-btn-primary-bg);
    color: var(--color-btn-primary-text);
}

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

.btn-danger {
    background: transparent;
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.btn-danger:hover { background: color-mix(in srgb, var(--color-danger) 13%, transparent); }

.btn-warning {
    background: transparent;
    border-color: var(--color-warning);
    color: var(--color-warning);
}

.btn-warning:hover { background: color-mix(in srgb, var(--color-warning) 13%, transparent); }

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: var(--text-sm);
}

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--color-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

.modal h2 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-6);
    color: var(--color-text-primary);
}

/* ── Forms ── */
.form-group {
    margin-bottom: var(--space-4);
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--color-text-tertiary);
    margin-bottom: 0.35rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    font-family: var(--font-sans);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: var(--shadow-focus);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    margin-top: var(--space-6);
}

/* ── Code Block ── */
.code-block {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-success);
    word-break: break-all;
    position: relative;
    margin-top: var(--space-2);
}

.code-block .copy-btn {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    padding: var(--space-1) var(--space-2);
    font-size: 0.7rem;
    background: var(--color-btn-bg);
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-sm);
    color: var(--color-text-tertiary);
    cursor: pointer;
    font-family: var(--font-sans);
}

.code-block .copy-btn:hover { color: var(--color-accent); border-color: var(--color-accent); }

/* ── Back Link ── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: var(--text-base);
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-6);
}

.back-link:hover { color: var(--color-accent); text-decoration: none; }

/* ── Footer ── */
footer {
    margin-top: var(--space-8);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

/* ── Filter / Sort Toolbar ── */
.overview-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
    gap: var(--space-3);
}

.filter-tabs {
    display: flex;
    gap: var(--space-1);
}

.filter-tab {
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-muted);
    background: transparent;
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-sans);
}

.filter-tab:hover { border-color: var(--color-accent); color: var(--color-accent); }
.filter-tab.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

.filter-tab .badge {
    display: inline-block;
    min-width: 18px;
    padding: 0 5px;
    margin-left: 4px;
    font-size: 0.7rem;
    border-radius: var(--radius-full);
    background: var(--color-border-muted);
    color: var(--color-text-tertiary);
    text-align: center;
}

.filter-tab.active .badge { background: rgba(255, 255, 255, 0.2); color: #fff; }

.sort-controls select {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-md);
    color: var(--color-text-tertiary);
    cursor: pointer;
    font-family: var(--font-sans);
}

.sort-controls select:focus { outline: none; border-color: var(--color-accent); box-shadow: var(--shadow-focus); }

/* ── Server Card Grid ── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
}

/* ── Server Card ── */
.server-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-xl);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    overflow: hidden;
}

.server-card:hover { border-color: color-mix(in srgb, var(--color-accent) 27%, transparent); }
.server-card.expanded { border-color: color-mix(in srgb, var(--color-accent) 40%, transparent); box-shadow: 0 0 20px color-mix(in srgb, var(--color-accent) 5%, transparent); }

/* ── Card Summary (always visible) ── */
.card-summary {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    cursor: pointer;
}

.card-summary .dot { flex-shrink: 0; }

.card-summary-info {
    flex: 1;
    min-width: 0;
}

.card-summary-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-summary-uptime {
    font-size: 0.7rem;
    color: var(--color-text-tertiary);
    margin-top: 0.15rem;
}

.card-summary-meters {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    flex-shrink: 0;
}

/* ── Mini Meter ── */
.mini-meter {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 48px;
}

.mini-meter .meter-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
    letter-spacing: 0.03em;
    margin-bottom: 2px;
}

.meter-bar {
    width: 100%;
    height: 4px;
    background: var(--color-border-default);
    border-radius: 2px;
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}

.mini-meter .meter-value {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

.card-summary-load {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-tertiary);
    flex-shrink: 0;
    min-width: 32px;
    text-align: right;
}

/* ── Card Expanded ── */
.card-expanded {
    display: none;
    border-top: 1px solid var(--color-border-default);
    padding: var(--space-5);
}

.server-card.expanded .card-expanded { display: block; }

.quick-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.quick-stat {
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-2);
    text-align: center;
}

.quick-stat-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-tertiary);
    margin-bottom: 0.2rem;
}

.quick-stat-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.quick-stat-value.warn { color: var(--color-warning); }
.quick-stat-value.crit { color: var(--color-danger); }

.card-expanded-section {
    margin-top: var(--space-3);
}

.card-expanded-section h4 {
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-2);
}

.card-detail-link {
    display: block;
    text-align: center;
    margin-top: var(--space-4);
    padding: var(--space-2);
    font-size: 0.8rem;
    color: var(--color-accent);
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.card-detail-link:hover {
    border-color: var(--color-accent);
    background: var(--color-accent-subtle);
    text-decoration: none;
}

/* Card actions (expanded bottom row) */
.card-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.card-actions .card-detail-link {
    flex: 1;
    margin-top: 0;
}

/* Expanded card — mount items */
.expand-mount-item {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
    padding: 0.15rem 0;
}

.expand-mount-name {
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
}

/* Expanded card — process items */
.expand-proc-item {
    display: flex;
    gap: var(--space-2);
    font-size: var(--text-sm);
    padding: 0.1rem 0;
}

.expand-proc-name {
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
    flex: 1;
}

.expand-proc-value {
    color: var(--color-warning);
}

/* ══════════════════════════════════════════════════════════════
   Detail Page — System Banner & Category Accordion
   ══════════════════════════════════════════════════════════════ */

/* ── System Info Banner ── */
.system-banner {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-6);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-5) var(--space-6);
    margin-bottom: var(--space-6);
}

.banner-item {
    display: flex;
    flex-direction: column;
    min-width: 120px;
}

.banner-item-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-tertiary);
    margin-bottom: 0.2rem;
}

.banner-item-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-primary);
}

/* ── Summary Card Grid ── */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.summary-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-4) var(--space-5);
    cursor: pointer;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    user-select: none;
}

.summary-card:hover {
    border-color: color-mix(in srgb, var(--color-accent) 27%, transparent);
}

.summary-card.active {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 1px var(--color-accent), 0 2px 8px color-mix(in srgb, var(--color-accent) 13%, transparent);
}

.summary-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.summary-card-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.summary-card-title {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-tertiary);
}

.summary-card-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-text-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.summary-card-sub {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    margin-top: var(--space-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.summary-card-bar {
    height: 4px;
    background: var(--color-border-default);
    border-radius: 2px;
    overflow: hidden;
    margin-top: var(--space-2);
}

.summary-card-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}

/* ── Data Update Animations ── */
@keyframes value-flash {
    0% { color: var(--color-accent); text-shadow: 0 0 6px color-mix(in srgb, var(--color-accent) 35%, transparent); }
    100% { color: inherit; text-shadow: none; }
}

@keyframes row-highlight {
    0% { background-color: color-mix(in srgb, var(--color-accent) 6%, transparent); }
    100% { background-color: transparent; }
}

@keyframes card-data-pulse {
    0%, 12% {
        border-color: color-mix(in srgb, var(--color-accent) 45%, var(--color-border-default));
        box-shadow: 0 0 8px color-mix(in srgb, var(--color-accent) 10%, transparent);
    }
    100% {
        border-color: var(--color-border-default);
        box-shadow: none;
    }
}

.value-updated {
    animation: value-flash 0.7s ease-out;
}

.metric-row.row-updated {
    animation: row-highlight 0.8s ease-out;
}

.summary-card.card-data-pulse:not(.active) {
    animation: card-data-pulse 1.2s ease-out;
}

/* ── Detail Panel ── */
.detail-panel {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-3);
    transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
    padding: 0 var(--space-5);
}

.detail-panel.open {
    max-height: 2000px;
    opacity: 1;
    padding: var(--space-5);
}

.detail-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.detail-panel-header h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--color-text-primary);
}

.detail-panel-close {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-muted);
    background: transparent;
    color: var(--color-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.detail-panel-close:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* ── Category Accordion ── */
.category {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-3);
    overflow: hidden;
    transition: border-color var(--transition-base);
}

.category:hover { border-color: color-mix(in srgb, var(--color-accent) 27%, transparent); }

.category-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast);
}

.category-header:hover { background: var(--color-bg-hover); }

.category-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.category-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text-primary);
    flex-shrink: 0;
}

.category-summary {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.category-summary-value {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
}

.category-summary-bar {
    flex: 1;
    max-width: 120px;
    height: 4px;
    background: var(--color-border-default);
    border-radius: 2px;
    overflow: hidden;
}

.category-summary-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}

.category-chevron {
    width: 20px;
    height: 20px;
    color: var(--color-text-muted);
    transition: transform var(--transition-base);
    flex-shrink: 0;
}

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

.category-body {
    display: none;
    padding: 0 var(--space-5) var(--space-5);
}

.category.open .category-body { display: block; }

/* ── Primary Metric ── */
.primary-metric {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.primary-value {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--color-text-primary);
}

.primary-sub {
    font-size: 0.8rem;
    color: var(--color-text-tertiary);
}

/* ── Metric Rows ── */
.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border-default);
    font-size: var(--text-base);
}

.metric-row:last-child { border-bottom: none; }

.metric-label {
    color: var(--color-text-tertiary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ── Metric Info Tooltip ── */
.metric-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: 10px;
    line-height: 1;
    font-style: normal;
    color: var(--color-text-tertiary);
    border: 1px solid var(--color-border-muted);
    cursor: help;
    position: relative;
    flex-shrink: 0;
    transition: color var(--transition-base), border-color var(--transition-base);
}

.metric-info:hover,
.metric-info:focus {
    color: var(--color-accent);
    border-color: var(--color-accent);
    outline: none;
}

.metric-info::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-bg-tertiary, #1c2128);
    color: var(--color-text-primary, #e6edf3);
    font-size: var(--text-xs, 12px);
    font-weight: 400;
    line-height: 1.4;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-default);
    max-width: 260px;
    white-space: normal;
    text-align: left;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.metric-info::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--color-border-default);
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.metric-info:hover::after,
.metric-info:focus::after,
.metric-info:hover::before,
.metric-info:focus::before {
    opacity: 1;
}

@media (max-width: 768px) {
    .metric-info::after {
        left: 0;
        transform: none;
    }
    .metric-info::before {
        left: 7px;
        transform: none;
    }
}

.metric-value {
    color: var(--color-text-secondary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.metric-section {
    margin-top: var(--space-4);
}

/* ── Drill-down Button ── */
.drill-btn {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-muted);
    background: transparent;
    color: var(--color-text-tertiary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.drill-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.drill-btn.active { background: var(--color-accent-muted); border-color: var(--color-accent); color: var(--color-accent); }

/* ── Inline Graph Slot (drill-down) ── */
.metric-graph-slot {
    display: none;
    padding: var(--space-3) 0;
}

.metric-graph-slot.visible { display: block; }

.inline-graph-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
}

.inline-graph-header .range-tabs { gap: 0.15rem; }
.inline-graph-header .range-tab { font-size: 0.65rem; padding: 0.15rem 0.45rem; }

.inline-graph-wrap {
    height: 140px;
    position: relative;
}

.inline-graph-wrap canvas {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-sm);
}

/* ── Mount Points ── */
.mount-list { margin-top: var(--space-2); }

.mount-point {
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border-default);
}

.mount-point:last-child { border-bottom: none; }

.mount-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.mount-header-left {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.mount-name {
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
}

.mount-ro-badge {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: color-mix(in srgb, var(--color-danger) 13%, transparent);
    color: var(--color-danger);
    text-transform: uppercase;
}

.mount-detail {
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
}

.mount-bar {
    height: 4px;
    background: var(--color-border-default);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.35rem;
}

.mount-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}

/* ── Load Triple ── */
.load-triple {
    display: flex;
    gap: var(--space-6);
    margin-bottom: var(--space-3);
}

.load-item {
    text-align: center;
}

.load-item-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    color: var(--color-text-tertiary);
    margin-bottom: 0.2rem;
}

.load-item-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

/* ── Top Processes ── */
.top-proc-table {
    width: 100%;
    margin-top: var(--space-2);
}

.top-proc-header {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-tertiary);
    margin-bottom: 0.35rem;
}

.top-proc-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.35rem 0;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--color-border-default);
}

.top-proc-item:last-child { border-bottom: none; }

.proc-pid {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    min-width: 50px;
}

.proc-name {
    flex: 1;
    color: var(--color-text-secondary);
    font-weight: 500;
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.proc-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    min-width: 48px;
    text-align: right;
}

.proc-bar {
    width: 60px;
    height: 4px;
    background: var(--color-border-default);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}

.proc-bar-fill {
    height: 100%;
    border-radius: 2px;
}

/* ══════════════════════════════════════════════════════════════
   Pause Feature
   ══════════════════════════════════════════════════════════════ */

.dot.paused { background: var(--color-text-tertiary); box-shadow: 0 0 6px color-mix(in srgb, var(--color-text-tertiary) 27%, transparent); }
.server-card.paused { opacity: 0.7; }
.server-card.paused .card-summary-meters { opacity: 0.5; }

.inactive-label {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.paused-banner {
    background: color-mix(in srgb, var(--color-text-tertiary) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-text-tertiary) 27%, transparent);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-5);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-base);
    color: var(--color-text-tertiary);
}

.paused-banner-icon {
    font-size: 1.2rem;
}

.paused-banner-text {
    flex: 1;
}

/* ══════════════════════════════════════════════════════════════
   Notification Bell & Panel
   ══════════════════════════════════════════════════════════════ */

.notification-bell {
    position: relative;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-md);
    transition: background var(--transition-base);
    display: flex;
    align-items: center;
}

.notification-bell:hover { background: var(--color-btn-bg); }

.notification-bell svg {
    width: 20px;
    height: 20px;
    fill: var(--color-text-tertiary);
    transition: fill var(--transition-base);
}

.notification-bell:hover svg { fill: var(--color-text-secondary); }

.notification-count {
    position: absolute;
    top: -2px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
    background: var(--color-danger);
    border-radius: var(--radius-lg);
    text-align: center;
    line-height: 16px;
}

/* ── Notification Panel (slide-out) ── */
.notification-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: var(--color-bg-secondary);
    border-left: 1px solid var(--color-border-muted);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: right var(--transition-slow);
    box-shadow: var(--shadow-lg);
}

.notification-panel.open { right: 0; }

.notification-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border-default);
    flex-shrink: 0;
}

.notification-panel-header h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--color-text-primary);
}

.notification-panel-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.notification-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2) 0;
}

.notification-panel-empty {
    text-align: center;
    padding: var(--space-12) var(--space-4);
    color: var(--color-text-muted);
    font-size: var(--text-base);
}

/* ── Notification Item ── */
.notification-item {
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--color-border-default);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.notification-item:hover { background: var(--color-bg-hover); }
.notification-item.unread { border-left: 3px solid var(--color-accent); }
.notification-item.unread .notification-item-title { color: var(--color-text-primary); font-weight: 600; }

.notification-item-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
}

.notification-severity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.notification-severity-dot.critical { background: var(--color-danger); }
.notification-severity-dot.warning { background: var(--color-warning); }
.notification-severity-dot.info { background: var(--color-accent); }

.notification-item-title {
    font-size: 0.8rem;
    color: var(--color-text-tertiary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-item-time {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.notification-item-message {
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-panel-footer {
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--color-border-default);
    text-align: center;
    flex-shrink: 0;
}

.notification-panel-footer a {
    font-size: 0.8rem;
}

/* ── Notification Overlay ── */
.notification-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--color-overlay-light);
    z-index: 199;
}

.notification-overlay.active { display: block; }

/* ══════════════════════════════════════════════════════════════
   Active Alert Banners
   ══════════════════════════════════════════════════════════════ */

.alert-banner {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0.65rem var(--space-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-2);
    font-size: 0.8rem;
}

.alert-banner.critical {
    background: color-mix(in srgb, var(--color-danger) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-danger) 27%, transparent);
    color: var(--color-danger);
}

.alert-banner.warning {
    background: color-mix(in srgb, var(--color-warning) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-warning) 27%, transparent);
    color: var(--color-warning);
}

.alert-banner-icon { font-size: 1rem; flex-shrink: 0; }
.alert-banner-text { flex: 1; }
.alert-banner-value { font-weight: 600; font-variant-numeric: tabular-nums; }

.active-alerts-container {
    margin-bottom: var(--space-4);
}

/* ══════════════════════════════════════════════════════════════
   Notification Settings Page
   ══════════════════════════════════════════════════════════════ */

.settings-section {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.settings-section h2 {
    font-size: var(--space-4);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--color-border-default);
}

.channel-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-2);
}

.channel-card-info { flex: 1; }

.channel-card-name {
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--color-text-secondary);
}

.channel-card-type {
    font-size: 0.7rem;
    color: var(--color-text-tertiary);
}

.channel-card-actions {
    display: flex;
    gap: var(--space-2);
}

/* ── Add Channel Form ── */
.add-channel-section {
    margin-top: var(--space-4);
}

.section-subtitle {
    font-size: 0.8rem;
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-2);
}

.add-channel-form {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.add-channel-form input {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    font-family: var(--font-sans);
}

.add-channel-form input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: var(--shadow-focus);
}

.add-channel-form input[type="text"] { flex: 1; min-width: 120px; }
.add-channel-form input[type="url"] { flex: 2; min-width: 200px; }

/* ── Condition Table ── */
.table-responsive {
    overflow-x: auto;
}

.condition-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.condition-table th {
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-tertiary);
    padding: var(--space-2);
    border-bottom: 1px solid var(--color-border-default);
}

.condition-table td {
    padding: var(--space-2);
    border-bottom: 1px solid var(--color-border-default);
    color: var(--color-text-secondary);
}

.condition-table tr:hover td { background: var(--color-bg-hover); }

/* ── Toggle Switch ── */
.toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    cursor: pointer;
}

.toggle-switch input { display: none; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--color-border-muted);
    border-radius: var(--radius-xl);
    transition: background var(--transition-base);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    background: var(--color-text-tertiary);
    border-radius: 50%;
    transition: transform var(--transition-base), background var(--transition-base);
}

.toggle-switch input:checked + .toggle-slider { background: var(--color-btn-primary-bg); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); background: #fff; }

/* ── Severity Badge ── */
.severity-badge {
    display: inline-block;
    padding: 0.15rem var(--space-2);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.severity-badge.critical { background: color-mix(in srgb, var(--color-danger) 13%, transparent); color: var(--color-danger); }
.severity-badge.warning { background: color-mix(in srgb, var(--color-warning) 13%, transparent); color: var(--color-warning); }
.severity-badge.info { background: color-mix(in srgb, var(--color-accent) 13%, transparent); color: var(--color-accent); }

/* ── Scope Label ── */
.scope-label {
    color: var(--color-text-tertiary);
    font-size: var(--text-sm);
}

/* ── Admin Token Input ── */
.admin-token-input {
    width: 200px;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    font-family: var(--font-sans);
}

.admin-token-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: var(--shadow-focus);
}

/* ── Success Message ── */
.success-message {
    color: var(--color-success);
    margin-bottom: var(--space-4);
}

/* ── Load More Wrap ── */
.load-more-wrap {
    text-align: center;
    margin-top: var(--space-4);
}

/* ── Empty State Text ── */
.empty-state-text {
    color: var(--color-text-muted);
    font-size: var(--text-base);
}

/* ══════════════════════════════════════════════════════════════
   Theme Toggle
   ══════════════════════════════════════════════════════════════ */

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-btn-border);
    background: var(--color-btn-bg);
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: color var(--transition-base), border-color var(--transition-base), background var(--transition-base);
}

.theme-toggle:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

/* Dark mode default: show sun icon (switch to light) */
.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }

/* Light mode: show moon icon (switch to dark) */
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* ── Theme Transition ── */
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
    transition: background-color 300ms ease, color 300ms ease, border-color 300ms ease, box-shadow 300ms ease, fill 300ms ease !important;
}

/* ══════════════════════════════════════════════════════════════
   Utility Classes
   ══════════════════════════════════════════════════════════════ */

.hidden { display: none !important; }

.empty-state {
    text-align: center;
    padding: var(--space-8);
    color: var(--color-text-muted);
}

.empty-state-title {
    font-size: var(--text-xl);
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-2);
}

.error-page {
    padding: var(--space-8);
    color: var(--color-danger);
}

/* ── Admin Nav ── */
.admin-nav {
    display: flex;
    gap: var(--space-3);
    padding-right: var(--space-3);
    border-right: 1px solid var(--color-border-default);
}

.admin-nav a {
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
    text-decoration: none;
}

.admin-nav a:hover { color: var(--color-accent); text-decoration: none; }
.admin-nav a.active { color: var(--color-accent); }

/* ── User Menu ── */
.user-menu {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding-left: var(--space-3);
    border-left: 1px solid var(--color-border-default);
}

.user-menu-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-role {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--color-accent) 13%, transparent);
    color: var(--color-accent);
}

/* ══════════════════════════════════════════════════════════════
   Skeleton Loading
   ══════════════════════════════════════════════════════════════ */

.skeleton {
    background: var(--color-border-default);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--color-text-muted) 10%, transparent), transparent);
    animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.skeleton-text {
    height: var(--text-base);
    width: 80%;
    margin-bottom: var(--space-2);
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-xl);
}

/* ══════════════════════════════════════════════════════════════
   Focus-Visible Rings
   ══════════════════════════════════════════════════════════════ */

.btn:focus-visible,
.filter-tab:focus-visible,
.range-tab:focus-visible,
.drill-btn:focus-visible,
.theme-toggle:focus-visible,
.notification-bell:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}

.toggle-switch input:focus-visible + .toggle-slider {
    box-shadow: var(--shadow-focus);
}

.form-group input:focus-visible,
.form-group select:focus-visible,
.sort-controls select:focus-visible,
.admin-token-input:focus-visible,
.add-channel-form input:focus-visible {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: var(--shadow-focus);
}

/* ══════════════════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }

    .quick-stats-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }

    .load-triple { gap: var(--space-4); }
    .load-item-value { font-size: 1.1rem; }

    .system-banner { gap: var(--space-4); padding: var(--space-4); }
}

@media (max-width: 768px) {
    body { padding: var(--space-4); }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .server-row {
        grid-template-columns: 24px 1fr repeat(2, 70px);
        font-size: 0.8rem;
    }

    .server-row .hide-mobile { display: none; }

    .card-summary-meters { gap: 0.35rem; }
    .mini-meter { width: 40px; }

    .overview-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .system-banner {
        flex-direction: column;
        gap: var(--space-3);
    }

    .summary-grid { grid-template-columns: repeat(2, 1fr); }

    .category-summary-bar { display: none; }

    .load-triple { justify-content: center; }
    .primary-value { font-size: var(--text-2xl); }

    .notification-panel { width: 100%; right: -100%; }
    .condition-table { font-size: 0.7rem; }
    .condition-table th, .condition-table td { padding: 0.35rem; }
}

@media (max-width: 480px) {
    body { padding: var(--space-3); }

    header {
        gap: var(--space-2);
        margin-bottom: var(--space-4);
    }

    header h1 { font-size: var(--text-xl); }

    .summary-grid { grid-template-columns: 1fr; }
    .summary-card-value { font-size: var(--text-xl); }

    .header-actions {
        gap: var(--space-2);
        flex-wrap: wrap;
    }

    .filter-tabs { flex-wrap: wrap; }

    .add-channel-form {
        flex-direction: column;
    }

    .add-channel-form input[type="text"],
    .add-channel-form input[type="url"] {
        min-width: 0;
        width: 100%;
    }
}
