:root {
    --bg-rail: #0B1120;
    --bg-rail-card: #131C31;
    --bg-rail-hover: rgba(255, 255, 255, 0.06);
    --rail-border: rgba(148, 163, 184, 0.14);
    --rail-text: #94A3B8;
    --rail-text-active: #FFFFFF;
    --bg-shell: #0B1120;
    --bg-canvas: #F3F5F9;
    --bg-surface: #FFFFFF;
    --bg-elevated: #FFFFFF;
    --bg-subtle: #F6F8FB;
    --bg-hover: #EDF1F7;
    --border-color: #DCE2EC;
    --border-strong: #C2CCD9;
    --text-primary: #0B1220;
    --text-secondary: #334155;
    --text-muted: #5C6B82;
    --brand-primary: #2563EB;
    --brand-primary-hover: #1D4ED8;
    --brand-primary-soft: rgba(37, 99, 235, 0.10);
    --brand-ring: rgba(37, 99, 235, 0.24);
    --status-ok: #0F766E;
    --status-ok-bg: rgba(15, 118, 110, 0.10);
    --status-warn: #B45309;
    --status-warn-bg: rgba(180, 83, 9, 0.11);
    --status-danger: #BE123C;
    --status-danger-bg: rgba(190, 18, 60, 0.10);
    --status-info: #1D4ED8;
    --status-info-bg: rgba(29, 78, 216, 0.10);
    --glider-bg: #FFFFFF;
    --glider-shadow: 0 1px 3px rgba(15, 23, 42, 0.10), 0 1px 2px rgba(15, 23, 42, 0.05);
    --card-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shell-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.35);
    --modal-shadow: 0 28px 64px -16px rgba(15, 23, 42, 0.32), 0 0 0 1px rgba(15, 23, 42, 0.08);
}

html.dark {
    --bg-rail: #070A12;
    --bg-rail-card: #0F1524;
    --bg-rail-hover: rgba(255, 255, 255, 0.06);
    --rail-border: rgba(148, 163, 184, 0.12);
    --rail-text: #8B9BB4;
    --rail-text-active: #F8FAFC;
    --bg-shell: #070A12;
    --bg-canvas: #0D1117;
    --bg-surface: #131922;
    --bg-elevated: #1A2230;
    --bg-subtle: #171E29;
    --bg-hover: #1E2736;
    --border-color: #242E3F;
    --border-strong: #334155;
    --text-primary: #F1F5F9;
    --text-secondary: #B8C4D4;
    --text-muted: #7C8BA1;
    --brand-primary: #3B82F6;
    --brand-primary-hover: #60A5FA;
    --brand-primary-soft: rgba(59, 130, 246, 0.16);
    --brand-ring: rgba(59, 130, 246, 0.28);
    --status-ok: #2DD4BF;
    --status-ok-bg: rgba(45, 212, 191, 0.13);
    --status-warn: #FBBF24;
    --status-warn-bg: rgba(251, 191, 36, 0.13);
    --status-danger: #FB7185;
    --status-danger-bg: rgba(251, 113, 133, 0.15);
    --status-info: #60A5FA;
    --status-info-bg: rgba(96, 165, 250, 0.15);
    --glider-bg: #1F2837;
    --glider-shadow: 0 2px 6px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shell-shadow: 0 20px 48px -16px rgba(0, 0, 0, 0.72);
    --modal-shadow: 0 32px 72px -16px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-shell);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    margin: 0;
}

h1, h2, h3, .font-display {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    letter-spacing: -0.02em;
}

.font-mono, .font-mono-num {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-variant-numeric: tabular-nums;
}

.sv-shell-frame {
    background: var(--bg-canvas);
    border: 1px solid var(--rail-border);
    box-shadow: var(--shell-shadow);
}

.sv-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.sv-card-interactive:hover {
    border-color: var(--border-strong);
    box-shadow: 0 8px 20px -10px rgba(15, 23, 42, 0.14);
}

.sv-card-hero {
    background: linear-gradient(135deg, #0B1120 0%, #15223B 62%, #172B4D 100%);
    color: #F8FAFC;
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 12px;
    box-shadow: 0 10px 26px -12px rgba(11, 17, 32, 0.55);
}

.sv-subtle {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: 9px;
}

.sv-topbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
}

.sv-sidebar {
    background: var(--bg-rail);
    color: #F8FAFC;
    transition: width 0.24s cubic-bezier(0.22, 1, 0.36, 1), transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.sv-sidebar.collapsed { width: 70px; }
.sv-sidebar.collapsed .sv-hide-collapsed { display: none; }
.sv-sidebar.collapsed .sv-nav-btn { justify-content: center; padding-left: 0; padding-right: 0; }
.sv-sidebar.collapsed .sv-ws-btn { justify-content: center; padding: 8px; }

.sv-rail-card {
    background: var(--bg-rail-card);
    border: 1px solid var(--rail-border);
    border-radius: 10px;
    color: #F8FAFC;
}

.sv-rail-card:hover { border-color: rgba(59, 130, 246, 0.45); }

.sv-nav-wrap { position: relative; }

.sv-nav-glider {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.26) 0%, rgba(37, 99, 235, 0.11) 100%);
    border: 1px solid rgba(59, 130, 246, 0.36);
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), height 0.22s ease, opacity 0.18s ease;
}

.sv-nav-glider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: #60A5FA;
}

.sv-nav-btn {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 11px;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--rail-text);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: color 0.16s ease, background 0.16s ease;
    text-align: left;
}

.sv-nav-btn:hover:not(.active) {
    color: #E2E8F0;
    background: var(--bg-rail-hover);
}

.sv-nav-btn.active {
    color: var(--rail-text-active);
    font-weight: 600;
}

.sv-nav-btn.active svg { color: #60A5FA; }

.sv-rail-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.14);
    color: #CBD5E1;
}

.sv-nav-btn.active .sv-rail-badge {
    background: rgba(59, 130, 246, 0.32);
    color: #DBEAFE;
}

.sv-seg-track {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 3px;
    border-radius: 9px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
}

.sv-seg-glider {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 0;
    border-radius: 7px;
    background: var(--glider-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--glider-shadow);
    pointer-events: none;
    z-index: 0;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), width 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.sv-seg-btn {
    position: relative;
    z-index: 1;
    padding: 5px 11px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.18s ease;
}

.sv-seg-btn:hover { color: var(--text-primary); }
.sv-seg-btn.active { color: var(--text-primary); font-weight: 600; }

.sv-btn-primary {
    background: linear-gradient(180deg, #2563EB 0%, #1D4ED8 100%);
    color: #FFFFFF;
    border: 1px solid rgba(29, 78, 216, 0.85);
    box-shadow: 0 1px 2px rgba(29, 78, 216, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.14s ease, transform 0.08s ease;
}
.sv-btn-primary:hover { filter: brightness(1.07); }

.sv-btn-outline {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease;
}
.sv-btn-outline:hover { background: var(--bg-subtle); border-color: var(--border-strong); }

.sv-btn-danger {
    background: var(--status-danger-bg);
    color: var(--status-danger);
    border: 1px solid rgba(190, 18, 60, 0.28);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}
.sv-btn-danger:hover { background: var(--status-danger); color: #FFFFFF; }

.sv-input {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 7px 11px;
    font-size: 12.5px;
    outline: none;
    transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.sv-input:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 3px var(--brand-ring); }

.sv-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 34px;
    height: 19px;
    border-radius: 999px;
    background: var(--border-strong);
    cursor: pointer;
    flex-shrink: 0;
}
.sv-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.sv-switch-knob {
    position: absolute; left: 2px; top: 2px; width: 15px; height: 15px;
    border-radius: 999px; background: #FFFFFF;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.sv-switch input:checked ~ .sv-switch-track { background: var(--brand-primary); }
.sv-switch input:checked ~ .sv-switch-knob { transform: translateX(15px); }
.sv-switch-track { position: absolute; inset: 0; border-radius: 999px; transition: background 0.2s ease; }

.sv-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 600; line-height: 1.45; white-space: nowrap;
}
.sv-badge-ok { background: var(--status-ok-bg); color: var(--status-ok); }
.sv-badge-warn { background: var(--status-warn-bg); color: var(--status-warn); }
.sv-badge-danger { background: var(--status-danger-bg); color: var(--status-danger); }
.sv-badge-info { background: var(--status-info-bg); color: var(--status-info); }
.sv-badge-neutral { background: var(--bg-subtle); color: var(--text-secondary); border: 1px solid var(--border-color); }

.sv-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sv-table th {
    text-align: left; padding: 9px 12px; font-size: 10.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted);
    background: var(--bg-subtle); border-bottom: 1px solid var(--border-color); white-space: nowrap;
}
.sv-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.sv-table tbody tr:last-child td { border-bottom: none; }
.sv-table tbody tr { transition: background 0.12s ease; }
.sv-table tbody tr:hover { background: var(--bg-hover); }
.sv-row-selected { background: var(--brand-primary-soft) !important; }

.sv-login-stage {
    background-color: #F3F5F9;
    background-image:
        radial-gradient(ellipse 75% 48% at 50% -8%, rgba(37, 99, 235, 0.13), transparent 65%),
        radial-gradient(rgba(15, 23, 42, 0.09) 1px, transparent 1px);
    background-size: 100% 100%, 24px 24px;
}
html.dark .sv-login-stage {
    background-color: #090C12;
    background-image:
        radial-gradient(ellipse 75% 48% at 50% -8%, rgba(59, 130, 246, 0.18), transparent 65%),
        radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
}

.sv-drawer-backdrop {
    position: fixed; inset: 0; background: rgba(9, 12, 18, 0.5); backdrop-filter: blur(3px);
    z-index: 80; opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.sv-drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.sv-drawer {
    position: fixed; top: 10px; right: 10px; bottom: 10px; width: calc(100% - 20px); max-width: 540px;
    background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 14px;
    box-shadow: var(--modal-shadow); z-index: 85; transform: translateX(calc(100% + 24px));
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1); display: flex; flex-direction: column; overflow: hidden;
}
.sv-drawer.open { transform: translateX(0); }

.sv-kbd {
    font-family: 'JetBrains Mono', monospace; font-size: 10px; padding: 1px 5px;
    border-radius: 5px; background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-muted);
}

.sv-code-block {
    background: #0B1120; color: #E2E8F0; border: 1px solid #1E293B; border-radius: 9px;
    padding: 11px 13px; font-family: 'JetBrains Mono', monospace; font-size: 11.5px; line-height: 1.55; overflow-x: auto;
}

.sv-heat-cell { width: 100%; aspect-ratio: 1; border-radius: 3px; transition: transform 0.12s ease; }
.sv-heat-cell:hover { transform: scale(1.25); }

@keyframes svPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.sv-dot-live { animation: svPulse 2.2s ease-in-out infinite; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
