/* ─── MOE Notify — Premium Dark UI ──────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Fira+Code:wght@400;500&display=swap');

/* ─── Design Tokens ──────────────────────────────────────────────────────── */
:root {
    --bg:              #060a12;
    --bg-2:            #0b1120;
    --bg-panel:        rgba(255,255,255,0.035);
    --bg-panel-hover:  rgba(255,255,255,0.06);
    --bg-input:        rgba(255,255,255,0.05);
    --glass-border:    rgba(255,255,255,0.08);
    --glass-border-h:  rgba(255,255,255,0.14);
    --divider:         rgba(255,255,255,0.06);

    --text:            #e8edf7;
    --text-2:          #a0aec0;
    --text-3:          #5a6a82;

    --primary:         #6366f1;
    --primary-h:       #4f51d4;
    --primary-glow:    rgba(99,102,241,0.35);
    --primary-subtle:  rgba(99,102,241,0.12);

    --ok:              #10b981;
    --ok-glow:         rgba(16,185,129,0.3);
    --ok-subtle:       rgba(16,185,129,0.1);

    --warn:            #f59e0b;
    --warn-glow:       rgba(245,158,11,0.3);
    --warn-subtle:     rgba(245,158,11,0.1);

    --error:           #ef4444;
    --error-glow:      rgba(239,68,68,0.35);
    --error-subtle:    rgba(239,68,68,0.1);

    --critical:        #dc2626;
    --critical-glow:   rgba(220,38,38,0.45);

    --emergency:       #ff1a1a;
    --emergency-glow:  rgba(255,26,26,0.6);

    --info:            #38bdf8;
    --info-subtle:     rgba(56,189,248,0.1);

    --radius-sm:       6px;
    --radius:          10px;
    --radius-lg:       14px;
    --radius-xl:       20px;

    --sidebar-w:       256px;
    --topbar-h:        60px;

    --shadow-sm:       0 2px 8px rgba(0,0,0,0.4);
    --shadow:          0 4px 24px rgba(0,0,0,0.5);
    --shadow-lg:       0 8px 40px rgba(0,0,0,0.6);

    --transition:      150ms cubic-bezier(.4,0,.2,1);
    --transition-slow: 250ms cubic-bezier(.4,0,.2,1);
}

/* ─── Light Mode Tokens ──────────────────────────────────────────────────── */
[data-theme="light"] {
    --bg:              #f0f4f8;
    --bg-2:            #e4eaf3;
    --bg-panel:        rgba(255,255,255,0.85);
    --bg-panel-hover:  rgba(255,255,255,0.98);
    --bg-input:        rgba(0,0,0,0.04);
    --glass-border:    rgba(0,0,0,0.09);
    --glass-border-h:  rgba(0,0,0,0.16);
    --divider:         rgba(0,0,0,0.07);

    --text:            #0f172a;
    --text-2:          #475569;
    --text-3:          #94a3b8;

    --primary-glow:    rgba(99,102,241,0.2);
    --primary-subtle:  rgba(99,102,241,0.1);

    --ok-glow:         rgba(16,185,129,0.2);
    --ok-subtle:       rgba(16,185,129,0.08);

    --warn-glow:       rgba(245,158,11,0.2);
    --warn-subtle:     rgba(245,158,11,0.08);

    --error-glow:      rgba(239,68,68,0.2);
    --error-subtle:    rgba(239,68,68,0.08);

    --info-subtle:     rgba(56,189,248,0.08);

    --shadow-sm:       0 1px 4px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.05);
    --shadow:          0 2px 16px rgba(0,0,0,0.1), 0 4px 24px rgba(0,0,0,0.06);
    --shadow-lg:       0 4px 32px rgba(0,0,0,0.12), 0 8px 40px rgba(0,0,0,0.08);
}

[data-theme="light"] body {
    background-image:
        radial-gradient(ellipse 80% 60% at 50% -20%, rgba(99,102,241,0.05) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 100% 80%, rgba(139,92,246,0.03) 0%, transparent 50%);
}

[data-theme="light"] .sidebar {
    background: rgba(255,255,255,0.95);
    border-right-color: var(--glass-border);
}
[data-theme="light"] .sidebar-nav a {
    color: var(--text-2);
}
[data-theme="light"] .sidebar-nav a:hover {
    background: rgba(99,102,241,0.08);
    color: var(--primary);
}
[data-theme="light"] .sidebar-nav a.active {
    background: rgba(99,102,241,0.1);
    color: var(--primary);
}
[data-theme="light"] .sidebar-nav a.active svg { color: var(--primary); }
[data-theme="light"] .sidebar-section-label { color: var(--text-3); }
[data-theme="light"] .sidebar-logout { color: var(--text-2); }
[data-theme="light"] .sidebar-logout:hover { background: rgba(239,68,68,0.08); color: var(--error); }

[data-theme="light"] .topbar {
    background: rgba(255,255,255,0.9);
    border-bottom-color: var(--glass-border);
}
[data-theme="light"] .topbar h2 { color: var(--text); }
[data-theme="light"] .topbar-clock { color: var(--text-3); }
[data-theme="light"] .topbar-status { color: var(--text-2); }

[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

[data-theme="light"] .metric-card,
[data-theme="light"] .sysinfo-card,
[data-theme="light"] .stat-card {
    background: rgba(255,255,255,0.9);
}

[data-theme="light"] .net-stat {
    background: rgba(0,0,0,0.03);
}

[data-theme="light"] .code-block {
    background: rgba(0,0,0,0.04);
    border-color: var(--glass-border);
    color: var(--text);
}

[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select,
[data-theme="light"] .form-group textarea,
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="number"],
[data-theme="light"] select,
[data-theme="light"] textarea {
    background: rgba(0,0,0,0.04);
    border-color: var(--glass-border);
    color: var(--text);
}

[data-theme="light"] .btn {
    background: rgba(0,0,0,0.05);
    color: var(--text-2);
    border-color: var(--glass-border);
}
[data-theme="light"] .btn:hover {
    background: rgba(0,0,0,0.09);
    color: var(--text);
}
[data-theme="light"] .btn-ghost {
    background: transparent;
}
[data-theme="light"] .btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: transparent;
}
[data-theme="light"] .btn-primary:hover {
    background: var(--primary-h);
    color: #fff;
}

[data-theme="light"] table thead tr {
    background: rgba(0,0,0,0.04);
}
[data-theme="light"] tbody tr:hover {
    background: rgba(0,0,0,0.03);
}
[data-theme="light"] td, [data-theme="light"] th {
    border-bottom-color: var(--divider);
    color: var(--text);
}
[data-theme="light"] .muted { color: var(--text-3); }

[data-theme="light"] .modal-card {
    background: #fff;
    border-color: var(--glass-border);
}
[data-theme="light"] .modal-backdrop {
    background: rgba(0,0,0,0.3);
}

[data-theme="light"] .kbd {
    background: rgba(0,0,0,0.07);
    border-color: rgba(0,0,0,0.15);
    color: var(--text);
}

/* Theme toggle button */
.theme-toggle {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--bg-panel);
    color: var(--text-2);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}
.theme-toggle:hover {
    background: var(--bg-panel-hover);
    color: var(--text);
    border-color: var(--glass-border-h);
}
.theme-toggle svg { width: 15px; height: 15px; }

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
    background-image:
        radial-gradient(ellipse 80% 60% at 50% -20%, rgba(99,102,241,0.07) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 100% 80%, rgba(139,92,246,0.04) 0%, transparent 50%);
    background-attachment: fixed;
}

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

code, pre { font-family: 'Fira Code', 'Cascadia Code', monospace; }

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ─── App Shell ──────────────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100dvh; }

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: rgba(6,10,18,0.95);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 18px;
    border-bottom: 1px solid var(--divider);
}

.sidebar-logo {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 14px var(--primary-glow);
}

.sidebar-logo svg { width: 16px; height: 16px; color: #fff; }

.sidebar-brand-text {
    display: flex; flex-direction: column; gap: 1px;
}
.sidebar-brand-text strong {
    font-size: 13px; font-weight: 700;
    letter-spacing: .02em;
    color: var(--text);
}
.sidebar-brand-text small {
    font-size: 10px; color: var(--text-3);
    letter-spacing: .05em; text-transform: uppercase;
}

.sidebar-nav {
    display: flex; flex-direction: column;
    gap: 2px;
    padding: 16px 12px;
    flex: 1;
}

.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 13px; font-weight: 500;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    position: relative;
    letter-spacing: .01em;
}

.sidebar-nav a svg {
    width: 16px; height: 16px; flex-shrink: 0;
    transition: color var(--transition);
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text);
    text-decoration: none;
}

.sidebar-nav a.active {
    background: var(--primary-subtle);
    color: #818cf8;
}
.sidebar-nav a.active svg { color: #818cf8; }

.sidebar-nav a.active::before {
    content: '';
    position: absolute; left: 0; top: 20%; bottom: 20%;
    width: 3px; border-radius: 0 3px 3px 0;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

.sidebar-nav-badge {
    margin-left: auto;
    background: var(--error);
    color: #fff;
    font-size: 10px; font-weight: 700;
    padding: 1px 6px;
    border-radius: 99px;
    min-width: 18px;
    text-align: center;
    animation: pulseBadge 2s ease infinite;
}

@keyframes pulseBadge {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
    50% { box-shadow: 0 0 0 4px rgba(239,68,68,0); }
}

.sidebar-section-label {
    font-size: 10px; font-weight: 600; letter-spacing: .1em;
    text-transform: uppercase; color: var(--text-3);
    padding: 8px 12px 4px;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--divider);
}

.sidebar-logout {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 9px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-3);
    font-size: 13px; font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    font-family: inherit;
}
.sidebar-logout svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-logout:hover { background: rgba(239,68,68,0.1); color: var(--error); }

/* ─── App Main ───────────────────────────────────────────────────────────── */
.app-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ─── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    padding: 0 28px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(6,10,18,0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

.topbar h2 {
    font-size: 15px; font-weight: 600;
    letter-spacing: -.01em;
    color: var(--text);
}

.topbar-breadcrumb {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--text-3);
}
.topbar-breadcrumb svg { width: 14px; height: 14px; }

.topbar-meta {
    display: flex; align-items: center; gap: 16px;
}

.topbar-status {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--text-2);
}

.status-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 6px var(--ok-glow);
    animation: statusPulse 3s ease infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .6; }
}

.topbar-clock {
    font-size: 12px; color: var(--text-3);
    font-variant-numeric: tabular-nums;
    font-family: 'Fira Code', monospace;
}

.topbar-user {
    display: flex; align-items: center; gap: 7px;
    font-size: 12px; color: var(--text-2);
}
.topbar-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}

/* ─── Content ────────────────────────────────────────────────────────────── */
.app-content {
    padding: 24px 28px 48px;
    max-width: 1400px;
}

/* ─── Panel / Card ───────────────────────────────────────────────────────── */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: border-color var(--transition);
}

.panel:hover { border-color: var(--glass-border-h); }

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.panel h3 {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--text-2);
    margin-bottom: 0;
}

.panel h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    margin: 14px 0 8px;
}

/* ─── Stats Grid ─────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-panel);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition), transform var(--transition-slow), box-shadow var(--transition-slow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: default;
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, transparent 60%);
    pointer-events: none;
}

.stat-card:hover {
    border-color: var(--glass-border-h);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-card.stat-ok { border-color: rgba(16,185,129,.2); }
.stat-card.stat-ok:hover { border-color: rgba(16,185,129,.4); box-shadow: 0 4px 20px var(--ok-glow); }

.stat-card.stat-warn { border-color: rgba(245,158,11,.2); }
.stat-card.stat-warn:hover { border-color: rgba(245,158,11,.4); box-shadow: 0 4px 20px var(--warn-glow); }

.stat-card.stat-error { border-color: rgba(239,68,68,.25); }
.stat-card.stat-error:hover { border-color: rgba(239,68,68,.5); box-shadow: 0 4px 20px var(--error-glow); }

.stat-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}
.stat-icon svg { width: 18px; height: 18px; }
.stat-icon-ok { background: var(--ok-subtle); color: var(--ok); }
.stat-icon-warn { background: var(--warn-subtle); color: var(--warn); }
.stat-icon-error { background: var(--error-subtle); color: var(--error); }
.stat-icon-primary { background: var(--primary-subtle); color: var(--primary); }
.stat-icon-info { background: var(--info-subtle); color: var(--info); }

.stat-label {
    display: block;
    font-size: 11px; font-weight: 600;
    letter-spacing: .06em; text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 28px; font-weight: 700;
    letter-spacing: -.03em;
    color: var(--text);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.stat-card.stat-warn .stat-value { color: var(--warn); }
.stat-card.stat-error .stat-value { color: var(--error); }
.stat-card.stat-ok .stat-value { color: var(--ok); }

.stat-trend {
    margin-top: 8px;
    font-size: 11px; color: var(--text-3);
}

/* ─── Alert Banner ───────────────────────────────────────────────────────── */
.alert-banner {
    background: rgba(245,158,11,.08);
    border: 1px solid rgba(245,158,11,.25);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--warn);
    animation: slideDown .3s ease;
}

.alert-banner svg { width: 16px; height: 16px; flex-shrink: 0; }
.alert-banner a { color: var(--warn); font-weight: 600; text-decoration: underline; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--glass-border-h);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.06);
    color: var(--text);
    font-size: 13px; font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.18);
    text-decoration: none;
    transform: translateY(-1px);
}

.btn:active { transform: translateY(0); }

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn svg { width: 14px; height: 14px; }

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 0 0 var(--primary-glow);
}
.btn-primary:hover {
    background: var(--primary-h);
    border-color: var(--primary-h);
    box-shadow: 0 4px 14px var(--primary-glow);
    color: #fff;
}

.btn-danger {
    background: rgba(239,68,68,0.1);
    border-color: rgba(239,68,68,0.3);
    color: var(--error);
}
.btn-danger:hover {
    background: var(--error);
    border-color: var(--error);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-2);
}
.btn-ghost:hover { background: rgba(255,255,255,0.06); border-color: var(--glass-border); color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-sm svg { width: 12px; height: 12px; }

.btn-block { width: 100%; }

.btn:disabled {
    opacity: .4;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
}

.btn.loading { position: relative; color: transparent; }
.btn.loading::after {
    content: '';
    position: absolute;
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px; font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase;
    line-height: 1.6;
    white-space: nowrap;
}

.badge-info     { background: rgba(56,189,248,.12); color: #38bdf8; border: 1px solid rgba(56,189,248,.2); }
.badge-warning  { background: rgba(245,158,11,.12); color: #fbbf24; border: 1px solid rgba(245,158,11,.2); }
.badge-error    { background: rgba(239,68,68,.12); color: #f87171; border: 1px solid rgba(239,68,68,.2); }
.badge-critical { background: rgba(220,38,38,.15); color: #fc8181; border: 1px solid rgba(220,38,38,.3); animation: badgePulse 2s ease infinite; }
.badge-emergency {
    background: rgba(255,26,26,.2);
    color: #fff;
    border: 1px solid rgba(255,26,26,.5);
    animation: emergencyPulse 1.2s ease infinite;
    box-shadow: 0 0 12px var(--emergency-glow);
}
.badge-ok     { background: rgba(16,185,129,.12); color: #34d399; border: 1px solid rgba(16,185,129,.2); }
.badge-warn   { background: rgba(245,158,11,.12); color: #fbbf24; border: 1px solid rgba(245,158,11,.2); }
.badge-muted  { background: rgba(255,255,255,.06); color: var(--text-3); border: 1px solid var(--glass-border); }
.badge-default { background: rgba(255,255,255,.06); color: var(--text-2); border: 1px solid var(--glass-border); }

@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.4); }
    50%       { box-shadow: 0 0 0 4px rgba(220,38,38,0); }
}
@keyframes emergencyPulse {
    0%, 100% { box-shadow: 0 0 8px var(--emergency-glow), 0 0 0 0 rgba(255,26,26,.5); }
    50%       { box-shadow: 0 0 16px var(--emergency-glow), 0 0 0 6px rgba(255,26,26,0); }
}

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    padding: 8px 12px;
    text-align: left;
    font-size: 10px; font-weight: 700;
    letter-spacing: .07em; text-transform: uppercase;
    color: var(--text-3);
    border-bottom: 1px solid var(--divider);
    white-space: nowrap;
}

td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--divider);
    color: var(--text-2);
    vertical-align: middle;
}

td:first-child { color: var(--text); }

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

tr { transition: background var(--transition); }

tbody tr:hover td {
    background: rgba(255,255,255,0.025);
    color: var(--text);
}
tbody tr:hover td:first-child { color: var(--text); }

.empty {
    text-align: center;
    color: var(--text-3);
    padding: 48px 12px !important;
    font-size: 13px;
}

/* ─── Filter Bar ─────────────────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: var(--bg-panel);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
}

/* ─── Forms ──────────────────────────────────────────────────────────────── */
select,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
textarea {
    background: var(--bg-input);
    border: 1px solid var(--glass-border-h);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    width: 100%;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    outline: none;
    -webkit-appearance: none;
}

select {
    width: auto;
    min-width: 140px;
    cursor: pointer;
    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='%235a6a82' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

select:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
textarea:focus {
    border-color: rgba(99,102,241,.5);
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
    background: rgba(99,102,241,0.04);
}

select option { background: #0b1120; color: var(--text); }

label { display: block; margin-bottom: 12px; }
label > span {
    display: block;
    margin-bottom: 5px;
    color: var(--text-2);
    font-size: 12px; font-weight: 500;
    letter-spacing: .02em;
}
label small { display: block; margin-top: 4px; font-size: 11px; color: var(--text-3); }

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 13px; color: var(--text-2);
    font-weight: 400;
}
.checkbox-inline input {
    width: 15px; height: 15px;
    border: 1px solid var(--glass-border-h);
    border-radius: 3px;
    accent-color: var(--primary);
    cursor: pointer;
}
.checkbox-inline input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ─── Utility ────────────────────────────────────────────────────────────── */
.muted    { color: var(--text-3); }
.text-ok  { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-error { color: var(--error); }
.text-2   { color: var(--text-2); }

/* ─── Detail Grid ────────────────────────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 20px;
}
@media (max-width: 960px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-list {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 8px 12px;
    margin-bottom: 16px;
    font-size: 13px;
}
.detail-list dt { color: var(--text-3); font-size: 12px; font-weight: 500; padding-top: 2px; }
.detail-list dd { word-break: break-word; color: var(--text); }

/* ─── Code Block ─────────────────────────────────────────────────────────── */
.code-block, .code-input {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.7;
    overflow-x: auto;
    white-space: pre-wrap;
    color: #a5b4fc;
    width: 100%;
}
.code-input { color: var(--text); height: auto; }
.code-input:focus { border-color: rgba(99,102,241,.5); box-shadow: 0 0 0 3px rgba(99,102,241,.12); }

/* ─── Timeline ───────────────────────────────────────────────────────────── */
.timeline { list-style: none; position: relative; }
.timeline::before {
    content: '';
    position: absolute;
    left: 7px; top: 4px; bottom: 4px;
    width: 1px;
    background: var(--divider);
}

.timeline li {
    padding: 7px 0 7px 24px;
    position: relative;
    font-size: 13px;
    border-bottom: none;
}

.timeline li::before {
    content: '';
    position: absolute;
    left: 3px; top: 14px;
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--bg-2);
    border: 2px solid var(--glass-border-h);
}

.timeline li:last-child::before { border-color: var(--primary); background: var(--primary-subtle); }

.timeline li strong { color: var(--text); font-weight: 500; font-size: 12px; }
.timeline li .muted { font-size: 11px; display: block; margin-top: 2px; }

/* ─── Carrier List ───────────────────────────────────────────────────────── */
.carrier-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.carrier-row {
    display: flex; align-items: center;
    justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    padding: 12px 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
}
.carrier-test-form { margin: 0; }

/* ─── Register Service Box ───────────────────────────────────────────────── */
.register-service-box {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--divider);
}

/* ─── Form Grid ──────────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

/* ─── Action Cells ───────────────────────────────────────────────────────── */
.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.action-cell { white-space: nowrap; }
.inline-form { display: inline-flex; gap: 4px; }

/* ─── Auth ───────────────────────────────────────────────────────────────── */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 1rem;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 70% 50% at 50% -10%, rgba(99,102,241,0.12) 0%, transparent 70%),
        radial-gradient(ellipse 40% 30% at 80% 90%, rgba(139,92,246,0.06) 0%, transparent 50%);
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 36px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    animation: fadeUp .4s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

[data-theme="light"] .auth-body {
    background-image:
        radial-gradient(ellipse 70% 50% at 50% -10%, rgba(99,102,241,0.07) 0%, transparent 70%),
        radial-gradient(ellipse 40% 30% at 80% 90%, rgba(139,92,246,0.04) 0%, transparent 50%);
}
[data-theme="light"] .auth-card {
    background: rgba(255,255,255,0.92);
}

.auth-brand { text-align: center; margin-bottom: 28px; }

.auth-logo {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px;
    box-shadow: 0 0 30px var(--primary-glow);
}
.auth-logo svg { width: 26px; height: 26px; color: #fff; }

.auth-brand h1 {
    font-size: 20px; font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: 4px;
}
.auth-brand p { font-size: 13px; color: var(--text-3); }

.auth-form label > span { color: var(--text-2); font-size: 13px; }

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal {
    position: fixed; inset: 0;
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.modal[hidden] { display: none; }

.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn .2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
    position: relative;
    background: #0d1525;
    border: 1px solid var(--glass-border-h);
    border-radius: var(--radius-xl);
    padding: 24px;
    width: 100%; max-width: 460px;
    max-height: 90dvh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn .25s cubic-bezier(.4,0,.2,1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(.96) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-card h3 {
    font-size: 15px; font-weight: 700;
    margin-bottom: 18px;
    color: var(--text);
}

.modal-wide { max-width: 580px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ─── Toast ──────────────────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 24px; right: 24px;
    z-index: 9999;
    display: flex; flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: #0d1525;
    border: 1px solid var(--glass-border-h);
    border-radius: var(--radius);
    padding: 12px 16px;
    min-width: 260px; max-width: 380px;
    box-shadow: var(--shadow-lg);
    animation: toastIn .25s cubic-bezier(.4,0,.2,1);
    pointer-events: auto;
    font-size: 13px;
    display: flex; align-items: center; gap: 10px;
    color: var(--text);
}

.toast::before {
    content: '';
    width: 6px; height: 6px; border-radius: 50%;
    flex-shrink: 0;
}

.toast-success { border-left: 3px solid var(--ok); }
.toast-success::before { background: var(--ok); box-shadow: 0 0 6px var(--ok-glow); }

.toast-error { border-left: 3px solid var(--error); }
.toast-error::before { background: var(--error); box-shadow: 0 0 6px var(--error-glow); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ─── Keyboard Shortcut Hint ─────────────────────────────────────────────── */
.kbd {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 1px 5px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    color: var(--text-3);
    line-height: 1.5;
}

/* ─── Config hints ───────────────────────────────────────────────────────── */
.config-hints {
    font-size: 11px;
    line-height: 1.7;
    padding: 8px 10px;
    background: rgba(0,0,0,0.3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    color: var(--text-3);
    margin-top: 6px;
    font-family: 'Fira Code', monospace;
}

/* ─── Token Result Box ───────────────────────────────────────────────────── */
#token-result {
    margin: 12px 0;
    padding: 12px;
    background: rgba(16,185,129,0.06);
    border: 1px solid rgba(16,185,129,0.25);
    border-radius: var(--radius-sm);
}
#token-result p { color: var(--ok); font-size: 12px; margin-bottom: 6px; }

/* ─── Copy Button ────────────────────────────────────────────────────────── */
.copy-wrap { position: relative; }
.copy-btn {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    color: var(--text-3);
    font-size: 11px;
    padding: 3px 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}
.copy-btn:hover { background: rgba(255,255,255,0.14); color: var(--text); }
.copy-btn.copied { color: var(--ok); border-color: rgba(16,185,129,.3); }

/* ─── Help Modal ─────────────────────────────────────────────────────────── */
.shortcuts-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 16px;
    font-size: 13px;
    color: var(--text-2);
}
.shortcuts-grid dt { display: flex; gap: 4px; align-items: center; }

/* ─── 404 Page ───────────────────────────────────────────────────────────── */
.error-page {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; min-height: 60vh;
    text-align: center; gap: 12px;
}
.error-page h1 { font-size: 64px; font-weight: 800; letter-spacing: -.04em; color: var(--text-3); }
.error-page p { color: var(--text-2); }

/* ─── Dashboard: Metrics Grid ───────────────────────────────────────────── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
@media (max-width: 1200px) { .metrics-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .metrics-grid { grid-template-columns: 1fr; } }

.metric-card {
    background: var(--bg-panel);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 18px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: border-color var(--transition);
    position: relative;
    overflow: hidden;
}
.metric-card::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 60%);
    pointer-events: none;
}
.metric-card:hover { border-color: var(--glass-border-h); }

.metric-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px;
}
.metric-label {
    font-size: 11px; font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase;
    color: var(--text-3);
}

/* Gauge */
.gauge-wrap { position: relative; display: flex; align-items: center; justify-content: center; margin: 4px 0 10px; }
.gauge { width: 100%; max-width: 120px; }
.gauge-value {
    position: absolute; bottom: 4px;
    font-size: 18px; font-weight: 700;
    font-family: 'Fira Code', monospace;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* Progress bars */
.progress-big-wrap { margin: 6px 0 10px; }
.progress-big {
    height: 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 6px;
}
.progress-fill {
    height: 100%; border-radius: 99px;
    transition: width .6s cubic-bezier(.4,0,.2,1), background .3s ease;
    box-shadow: 0 0 6px currentColor;
}
.progress-labels {
    display: flex; justify-content: space-between;
    font-size: 12px; font-variant-numeric: tabular-nums;
    color: var(--text-2);
}

.progress-sm {
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 99px;
    overflow: hidden;
    margin-top: 5px;
}

/* Metric sub rows */
.metric-sub-row {
    display: flex; flex-wrap: wrap; gap: 12px;
    font-size: 11px; color: var(--text-3);
}
.metric-sub { display: flex; align-items: center; gap: 4px; }
.metric-sub strong { color: var(--text-2); font-variant-numeric: tabular-nums; }

/* Disk entries */
.disk-entry { margin-bottom: 8px; }
.disk-label-row { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 3px; }

/* Network stats */
.net-stat-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    margin: 8px 0 10px;
}
.net-stat {
    display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
    padding: 10px; border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
}
.net-stat strong {
    font-size: 14px; font-weight: 700;
    font-family: 'Fira Code', monospace;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.net-speed {
    font-size: 11px; color: var(--text-3);
    font-family: 'Fira Code', monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

/* ─── Dashboard: System Info Grid ────────────────────────────────────────── */
.sysinfo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
@media (max-width: 1200px) { .sysinfo-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .sysinfo-grid { grid-template-columns: 1fr; } }

.sysinfo-card {
    padding: 16px 18px !important;
    margin-bottom: 0 !important;
}

.sys-dl {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 5px 8px;
    font-size: 12px;
}
.sys-dl dt { color: var(--text-3); }
.sys-dl dd { color: var(--text-2); font-family: 'Fira Code', monospace; font-size: 11px; }

/* ─── Watchdog Summary ───────────────────────────────────────────────────── */
.wdog-sum-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 12px 0 8px;
}
.wdog-sum-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
}
.wdog-sum-item strong { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wdog-sum-item span   { font-size: 9px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.wdog-ok   strong { color: var(--ok); }
.wdog-warn strong { color: var(--warn); }
.wdog-err  strong { color: var(--error); }
.wdog-unk  strong { color: var(--text-3); }

/* ─── Heartbeat Bar ──────────────────────────────────────────────────────── */
.hb-bar-wrap { display: flex; align-items: center; gap: 8px; }
.hb-bar {
    flex: 1; height: 6px; border-radius: 99px;
    background: rgba(255,255,255,0.06);
    overflow: hidden;
    position: relative;
}
.hb-bar.hb-bar-red { background: var(--error); animation: badgePulse 2s ease infinite; }
.hb-fill { height: 100%; border-radius: 99px; transition: width .5s ease; }
.hb-fill-ok   { background: var(--ok); }
.hb-fill-warn { background: var(--warn); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-slow);
    }
    .sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .app-content { padding: 16px 16px 32px; }
    .topbar { padding: 0 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .filter-bar { padding: 10px; }
}

/* ─── Reduced Motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
