/* ============================================================
   redb.Tsak.Web — Design Tokens & Theme System
   CSS custom properties for consistent theming across all components.
   ============================================================ */

/* --- Light Theme (default) --- */
:root {
    /* Typography */
    --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', Consolas, monospace;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.875rem;
    --font-size-lg: 1rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
    --line-height: 1.5;

    /* 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;

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

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Layout */
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 60px;
    --topbar-height: 52px;

    /* --- Color Palette: Light --- */
    --bg-app: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f8fafc;
    --bg-surface-active: #f1f5f9;
    --bg-inset: #f8fafc;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-inverse: #ffffff;

    --border-default: #e2e8f0;
    --border-strong: #cbd5e1;

    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: #dbeafe;
    --accent-text: #1e40af;

    /* Sidebar */
    --sidebar-bg: #ffffff;
    --sidebar-text: #64748b;
    --sidebar-text-hover: #334155;
    --sidebar-text-active: #0f172a;
    --sidebar-active-bg: rgba(59, 130, 246, 0.08);
    --sidebar-active-border: #3b82f6;
    --sidebar-divider: #e2e8f0;
    --sidebar-group-text: #94a3b8;
    --sidebar-brand-text: #0f172a;

    /* Status */
    --status-online: #22c55e;
    --status-online-bg: #f0fdf4;
    --status-warning: #f59e0b;
    --status-warning-bg: #fffbeb;
    --status-error: #ef4444;
    --status-error-bg: #fef2f2;
    --status-info: #3b82f6;
    --status-info-bg: #eff6ff;
    --status-offline: #94a3b8;
    --status-offline-bg: #f1f5f9;

    /* Interactive */
    --btn-primary-bg: #3b82f6;
    --btn-primary-hover: #2563eb;
    --btn-primary-text: #ffffff;
    --btn-secondary-bg: #f1f5f9;
    --btn-secondary-hover: #e2e8f0;
    --btn-secondary-text: #334155;
    --btn-danger-bg: #ef4444;
    --btn-danger-hover: #dc2626;
    --btn-danger-text: #ffffff;
    --btn-ghost-hover: #f1f5f9;

    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --input-focus-border: #3b82f6;
    --input-focus-ring: rgba(59, 130, 246, 0.25);

    /* Scrollbar */
    --scrollbar-track: transparent;
    --scrollbar-thumb: #cbd5e1;
    --scrollbar-thumb-hover: #94a3b8;
}

/* --- Dark Theme --- */
[data-theme="dark"] {
    --bg-app: #0c1222;
    --bg-surface: #1e293b;
    --bg-surface-hover: #263548;
    --bg-surface-active: #334155;
    --bg-inset: #0f172a;

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-inverse: #0f172a;

    --border-default: #334155;
    --border-strong: #475569;

    --accent: #60a5fa;
    --accent-hover: #3b82f6;
    --accent-light: rgba(96, 165, 250, 0.15);
    --accent-text: #93c5fd;

    --sidebar-bg: #0a0f1a;
    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #e2e8f0;
    --sidebar-text-active: #ffffff;
    --sidebar-active-bg: rgba(59, 130, 246, 0.15);
    --sidebar-active-border: #3b82f6;
    --sidebar-divider: #1e293b;
    --sidebar-group-text: #64748b;
    --sidebar-brand-text: #f1f5f9;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);

    --status-online-bg: rgba(34, 197, 94, 0.15);
    --status-warning-bg: rgba(245, 158, 11, 0.15);
    --status-error-bg: rgba(239, 68, 68, 0.15);
    --status-info-bg: rgba(59, 130, 246, 0.15);
    --status-offline-bg: rgba(148, 163, 184, 0.1);

    --btn-secondary-bg: #334155;
    --btn-secondary-hover: #475569;
    --btn-secondary-text: #e2e8f0;
    --btn-ghost-hover: #334155;

    --input-bg: #0f172a;
    --input-border: #475569;

    --scrollbar-thumb: #475569;
    --scrollbar-thumb-hover: #64748b;
}

/* ============================================================
   Base Styles
   ============================================================ */

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

html, body {
    height: 100%;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    color: var(--text-primary);
    background: var(--bg-app);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Focus */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Links */
a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
}

/* Code */
code, pre {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
}

code {
    background: var(--bg-inset);
    padding: 0.125em 0.375em;
    border-radius: var(--radius-sm);
    color: var(--accent-text);
}

pre {
    background: var(--bg-inset);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    overflow-x: auto;
    border: 1px solid var(--border-default);
}

/* Tables base */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: var(--space-3) var(--space-4);
    border-bottom: 2px solid var(--border-default);
}

/* A column header that sorts its table when clicked */
th.grid-sortable {
    cursor: pointer;
    user-select: none;
}

th.grid-sortable:hover {
    color: var(--text-primary);
}

td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-default);
    vertical-align: middle;
}

tr:hover td {
    background: var(--bg-surface-hover);
}

/* ============================================================
   Utility Classes
   ============================================================ */

.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-3xl { font-size: var(--font-size-3xl); }

.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mono { font-family: var(--font-mono); }

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    line-height: 1.5;
}

.badge-online { background: var(--status-online-bg); color: var(--status-online); }
.badge-warning { background: var(--status-warning-bg); color: var(--status-warning); }
.badge-error { background: var(--status-error-bg); color: var(--status-error); }
.badge-info { background: var(--status-info-bg); color: var(--status-info); }
.badge-offline { background: var(--status-offline-bg); color: var(--status-offline); }

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    line-height: 1.5;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--btn-primary-hover);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--btn-secondary-hover);
}

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

.btn-danger:hover:not(:disabled) {
    background: var(--btn-danger-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--btn-ghost-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
}

.btn-icon {
    padding: var(--space-2);
    width: 36px;
    height: 36px;
}

.btn-group {
    display: inline-flex;
    gap: 1px;
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.btn-group .btn:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow-sm);
}

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

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

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

/* Monitoring charts layout — JS sets height via fitToViewport */
.monitoring-charts {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    overflow: hidden;
}

/* Chart cards */
.card-chart {
    overflow: hidden;
    padding: var(--space-2) var(--space-3);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.card-chart .card-header {
    margin-bottom: var(--space-1);
    flex-shrink: 0;
}

.chart-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0 var(--space-2) var(--space-2);
}

.chart-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.chart-container canvas {
    position: absolute;
    top: 0;
    left: 0;
}

.grid-charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: 1fr;
    gap: var(--space-4);
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

@media (max-width: 768px) {
    .grid-charts {
        grid-template-columns: 1fr;
    }
}

/* Inputs */
.input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    line-height: 1.5;
}

.input:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px var(--input-focus-ring);
    outline: none;
}

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

/* Page layout helpers */
.page-header {
    margin-bottom: var(--space-6);
}

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

.page-description {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

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

/* Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-default);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12) var(--space-8);
    color: var(--text-tertiary);
    text-align: center;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

/* One line of the node overview's "needs attention" list */
.attention-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
}

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

/* Toast container */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

/* ============================================================
   Shell Layout
   ============================================================ */

.shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

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

.shell-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
}

/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    border-right: 1px solid var(--sidebar-divider);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    height: var(--topbar-height);
    color: var(--sidebar-brand-text);
    border-bottom: 1px solid var(--sidebar-divider);
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: var(--font-size-lg);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-version {
    margin-left: auto;
    font-size: var(--font-size-xs);
    color: var(--sidebar-brand-text);
    opacity: 0.55;
    text-decoration: none;
}

.sidebar-version:hover {
    opacity: 1;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-3) 0;
}

.sidebar-group {
    padding: var(--space-2) 0;
}

.sidebar-group-label {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-group-text);
    padding: var(--space-2) var(--space-5) var(--space-1);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-5);
    color: var(--sidebar-text);
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    margin: 1px 0;
}

.sidebar-link:hover {
    color: var(--sidebar-text-hover);
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-link.active {
    color: var(--sidebar-text-active);
    background: var(--sidebar-active-bg);
    border-left-color: var(--sidebar-active-border);
}

.sidebar-link svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link.active svg {
    opacity: 1;
}

/* ============================================================
   Top Bar
   ============================================================ */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    padding: 0 var(--space-6);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
}

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

.topbar-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.topbar-cluster {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    padding-right: var(--space-3);
    border-right: 1px solid var(--border-default);
}

/* ============================================================
   Login / Auth
   ============================================================ */

.login-backdrop {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-app);
}

.login-card {
    width: 400px;
    padding: 40px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
}

.login-brand svg {
    color: var(--accent);
}

.login-brand-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.login-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 6px 0;
    color: var(--text-primary);
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: var(--font-size-sm);
}

.login-error {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    margin-bottom: 20px;
    background: var(--status-error-bg);
    color: var(--status-error);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
}

/* Floating label field */
.float-field {
    position: relative;
    margin-bottom: 20px;
}

.float-field input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    background: var(--input-bg);
    color: var(--text-primary);
    outline: none;
    box-sizing: border-box;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.float-field label {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--font-size-base);
    color: var(--text-tertiary);
    background: var(--input-bg);
    padding: 0 4px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    pointer-events: none;
}

.float-field input:focus + label,
.float-field input:not(:placeholder-shown) + label {
    top: 0;
    transform: translateY(-50%);
    font-size: var(--font-size-xs);
    color: var(--accent);
}

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

.login-actions {
    margin-top: 24px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: var(--font-size-base);
}

/* ============================================================
   Toast Notifications
   ============================================================ */

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-md);
    min-width: 280px;
    max-width: 420px;
    animation: toast-in 0.2s ease;
}

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

.toast-success { border-left: 3px solid var(--status-online); }
.toast-error { border-left: 3px solid var(--status-error); }
.toast-warning { border-left: 3px solid var(--status-warning); }
.toast-info { border-left: 3px solid var(--status-info); }

.toast-success svg { color: var(--status-online); }
.toast-error svg { color: var(--status-error); }
.toast-warning svg { color: var(--status-warning); }
.toast-info svg { color: var(--status-info); }

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 2px;
    border-radius: var(--radius-sm);
    display: flex;
}

.toast-close:hover {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

/* ============================================================
   Confirm Dialog
   ============================================================ */

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fade-in 0.15s ease;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.confirm-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 90%;
}

.confirm-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    color: var(--status-warning);
}

.confirm-message {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-5);
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
}

/* ============================================================
   Grid
   ============================================================ */

.grid-row-clickable {
    cursor: pointer;
}

.grid-row-clickable:hover {
    background: var(--bg-surface-hover);
}

.grid-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    margin-top: var(--space-2);
}

/* ============================================================
   Tabs
   ============================================================ */

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-default);
    margin-bottom: var(--space-4);
}

.tab {
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab:hover {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

.tab-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Node detail page */
.node-detail {
}

.tab-content {
    min-height: 200px;
}

/* ============================================================
   Error Boundary
   ============================================================ */

.error-boundary {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    text-align: center;
    color: var(--status-error);
}

.error-boundary h2 {
    margin-bottom: var(--space-2);
}

.error-boundary pre {
    margin-top: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    max-width: 600px;
    overflow-x: auto;
    text-align: left;
    color: var(--text-secondary);
}

/* ============================================================
   Modal (endpoint detail, etc.)
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    animation: fade-in 0.15s ease;
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin: 0;
    font-size: var(--font-size-base);
    font-weight: 600;
}

.modal-body {
    padding: var(--space-4) var(--space-5);
}
