/* ========================================================
   EOLM Design System
   ======================================================== */

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

/* --- Custom Properties: Light Theme --- */
:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --color-bg: #f1f5f9;
    --color-surface: #ffffff;
    --color-surface-hover: #f8fafc;
    --color-text: #0f172a;
    --color-text-secondary: #475569;
    --color-text-muted: #94a3b8;
    --color-border: #e2e8f0;
    --color-input-bg: #ffffff;
    --color-input-border: #cbd5e1;
    --color-topbar-bg: #0f172a;
    --color-topbar-text: #ffffff;
    --color-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --color-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08);
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-success: #16a34a;
    --color-success-bg: #f0fdf4;
    --color-success-text: #166534;
    --color-danger: #dc2626;
    --color-danger-bg: #fef2f2;
    --color-danger-text: #991b1b;
    --color-warning: #d97706;
    --color-warning-bg: #fffbeb;
    --color-warning-text: #92400e;
    --color-neutral-bg: #f1f5f9;
    --color-neutral-text: #475569;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --radius-pill: 999px;
}

/* --- Custom Properties: Dark Theme --- */
[data-theme="dark"] {
    --color-bg: #0f172a;
    --color-surface: #1e293b;
    --color-surface-hover: #334155;
    --color-text: #f1f5f9;
    --color-text-secondary: #94a3b8;
    --color-text-muted: #64748b;
    --color-border: #334155;
    --color-input-bg: #1e293b;
    --color-input-border: #475569;
    --color-topbar-bg: #020617;
    --color-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --color-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.3);
    --color-success-bg: #052e16;
    --color-success-text: #4ade80;
    --color-danger-bg: #450a0a;
    --color-danger-text: #fca5a5;
    --color-warning-bg: #451a03;
    --color-warning-text: #fcd34d;
    --color-neutral-bg: #334155;
    --color-neutral-text: #94a3b8;
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* --- Typography --- */
h1 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 8px;
}

h2 {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 16px;
    color: var(--color-text);
}

h3 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 12px;
}

p {
    margin-bottom: 6px;
}

/* ========== TOPBAR ========== */
.topbar {
    background: var(--color-topbar-bg);
    height: 64px;
    position: relative;
    z-index: 100;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.topbar-inner {
    max-width: 1160px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.topbar-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

[data-theme="dark"] .topbar-logo,
[data-theme="dark"] .main-logo {
    /* Keeps the exact original colors but adds a subtle soft white glow so the dark blue shape doesn't vanish into the dark background */
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.45));
}

.topbar-brand-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-topbar-text);
    letter-spacing: -0.02em;
}

.topbar-menu {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 8px;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 16px;
    padding-left: 16px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.topbar-link {
    color: var(--color-topbar-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    opacity: 0.7;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    transition: opacity 0.15s ease, background-color 0.15s ease;
    white-space: nowrap;
}

.topbar-link:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

.topbar-link.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.topbar-user {
    font-size: 0.8125rem;
    color: var(--color-topbar-text);
    opacity: 0.55;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.topbar-logout {
    opacity: 0.6;
}

/* Logout form styled as inline element — button pretends to be a link */
.topbar-logout-form {
    display: inline;
    margin: 0;
    padding: 0;
}

button.topbar-logout {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

/* --- Theme Toggle --- */
.theme-toggle {
    background: none;
    border: none;
    color: var(--color-topbar-text);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.theme-toggle:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
}

/* Light mode: show moon. Dark mode: show sun. */
.theme-icon-sun {
    display: none;
}

.theme-icon-moon {
    display: block;
}

[data-theme="dark"] .theme-icon-sun {
    display: block;
}

[data-theme="dark"] .theme-icon-moon {
    display: none;
}

/* --- Hamburger (mobile only) --- */
.topbar-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    margin-left: auto;
}

.topbar-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--color-topbar-text);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.topbar-hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.topbar-hamburger.active span:nth-child(2) {
    opacity: 0;
}

.topbar-hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ========== SECTION NAV ========== */
.sectionbar {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.04), rgba(15, 23, 42, 0));
    border-bottom: 1px solid var(--color-border);
}

.sectionbar-inner {
    max-width: 1160px;
    margin: 0 auto;
    padding: 18px 20px 16px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.sectionbar-context {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sectionbar-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.sectionbar-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
}

.sectionbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sectionbar-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    color: var(--color-text-secondary);
    background: transparent;
    font-weight: 600;
    font-size: 0.875rem;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.sectionbar-link:hover {
    text-decoration: none;
    color: var(--color-text);
    background: rgba(37, 99, 235, 0.08);
}

.sectionbar-link.active {
    color: #ffffff;
    background: var(--color-topbar-bg);
    box-shadow: var(--color-shadow);
}

/* ========== LAYOUT ========== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 20px;
}

/* ========== CARDS ========== */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--color-shadow);
    margin-bottom: 24px;
}

.card-highlight {
    border-left: 4px solid var(--color-success);
}

.page-header h1 {
    margin-bottom: 12px;
}

.page-kicker {
    margin-bottom: 10px;
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.page-lead {
    max-width: 70ch;
    color: var(--color-text-secondary);
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 18px;
}

.page-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
}

.anchor-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.anchor-link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    background: var(--color-bg);
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
}

.anchor-link:hover {
    text-decoration: none;
    color: var(--color-text);
    background: rgba(37, 99, 235, 0.08);
}

.section-marker {
    scroll-margin-top: 112px;
}

.meta p {
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 4px;
}

.meta strong {
    color: var(--color-text);
}

/* ========== FORMS ========== */
.form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-family: var(--font-sans);
    background: var(--color-input-bg);
    color: var(--color-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input[readonly] {
    background: var(--color-bg);
    cursor: default;
}

textarea {
    resize: vertical;
    font-family: 'Courier New', Courier, monospace;
}

.form-text {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    line-height: 1.4;
}

.btn:hover {
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--color-topbar-bg);
    color: #ffffff;
}

.btn-primary:hover {
    background: #1e293b;
}

[data-theme="dark"] .btn-primary {
    background: #334155;
}

[data-theme="dark"] .btn-primary:hover {
    background: #475569;
}

.btn-danger {
    background: var(--color-danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-success {
    background: var(--color-success);
    color: #ffffff;
}

.btn-success:hover {
    background: #15803d;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
}

.btn-block {
    width: 100%;
}

/* Legacy button fallback (unstyled buttons in forms default to primary) */
button:not(.btn):not(.theme-toggle):not(.topbar-hamburger) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    background: var(--color-topbar-bg);
    color: #ffffff;
    transition: background-color 0.15s ease;
}

/* ========== TABLES ========== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 4px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead th {
    text-align: left;
    padding: 10px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
    color: var(--color-text);
}

.data-table tbody tr:hover {
    background: var(--color-surface-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table form {
    margin: 0;
    display: inline;
}

/* ========== BADGES ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.6;
}

.badge-success {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

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

.badge-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.badge-neutral {
    background: var(--color-neutral-bg);
    color: var(--color-neutral-text);
}

/* ========== FLASH MESSAGES ========== */
.flash-container {
    margin-bottom: 20px;
}

.flash {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-danger);
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
    font-size: 0.9375rem;
    margin-bottom: 10px;
}

.flash-success {
    border-left-color: var(--color-success);
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

/* ========== ALERTS (inline) ========== */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    border-left: 4px solid;
    margin-bottom: 20px;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.alert-danger {
    border-color: var(--color-danger);
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
    font-weight: 600;
}

/* ========== HERO (Index Page) ========== */
.hero {
    position: relative;
    min-height: calc(100vh - 64px);
}

/* Logo anchor: always centered, never moves */
.hero-logo-anchor {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Flash area: positioned at a fixed pixel offset BELOW the logo center.
   Completely outside .hero-logo-anchor so it never shifts the logo. */
.hero-flash {
    position: absolute;
    top: calc(50% + 148px);
    /* ~logo half-height(100) + tagline(30) + gap(18) */
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 360px;
    text-align: center;
    pointer-events: none;
}

/* Auto-dismiss: stays visible for 2.5s then fades out over 1.5s */
.flash-autodismiss {
    animation: flash-fade 4s ease forwards;
    pointer-events: none;
}

@keyframes flash-fade {
    0% {
        opacity: 1;
    }

    62% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.hero-tagline {
    font-size: 1rem;
    color: var(--color-text-muted);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 12px;
}


/* ========== AUTH PAGE (Login, Invite) ========== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 64px);
    padding: 40px 20px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    text-align: center;
}

.auth-card .form {
    text-align: left;
}

.auth-subtitle {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: 24px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.auth-card .meta {
    text-align: left;
    margin-bottom: 16px;
}

/* ========== LOGO ========== */
.logo-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(42vw, 200px);
    height: min(42vw, 200px);
    margin: 0 auto;
}

.logo-wrapper.small {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
}

.main-logo {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
    position: relative;
    z-index: 5;
}

/* Ripple pseudo-elements (only for animated) */
.logo-wrapper.animated::before,
.logo-wrapper.animated::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("/logo.svg");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 1;
    opacity: 0;
    pointer-events: none;
}

/* Animation classes — index page only */
.logo-wrapper.animated .main-logo {
    animation: logo-breathe 8s infinite ease-in-out;
}

.logo-wrapper.animated::before {
    animation: logo-ripple 12s infinite ease-out;
}

.logo-wrapper.animated::after {
    animation: logo-ripple 12s infinite ease-out 6s;
}

@keyframes logo-breathe {

    0%,
    100% {
        transform: translateY(0) scale(1);
        filter: drop-shadow(0 0 0 rgba(37, 99, 235, 0));
    }

    50% {
        transform: translateY(-6px) scale(1.03);
        filter: drop-shadow(0 0 24px rgba(37, 99, 235, 0.15));
    }
}

@keyframes logo-ripple {

    0%,
    5% {
        transform: scale(1);
        opacity: 0;
    }

    5.5% {
        transform: scale(1.02);
        opacity: 0.45;
        filter: blur(0);
    }

    40% {
        transform: scale(4.5);
        opacity: 0;
        filter: blur(50px);
    }

    100% {
        opacity: 0;
    }
}

/* ========== PEER CREATED PAGE ========== */
.qr-container {
    text-align: center;
    margin: 20px 0;
}

.qr-container img {
    max-width: 280px;
    height: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
    background: #ffffff;
    margin: 0 auto;
}

.config-textarea {
    width: 100%;
    height: 200px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8125rem;
    padding: 12px;
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    color: var(--color-text);
    resize: vertical;
}

/* ========== UTILITIES ========== */
.text-center {
    text-align: center;
}

.mt-lg {
    margin-top: 24px;
}

.mb-0 {
    margin-bottom: 0;
}

/* --- Spacing tokens --- */
:root {
    --space-1: 4px;   --space-2: 8px;   --space-3: 12px;
    --space-4: 16px;  --space-5: 20px;  --space-6: 24px;
    --space-8: 32px;  --space-12: 48px;
}

/* --- Layout utilities (layout + spacing only — no component logic) --- */
.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap     { flex-wrap: wrap; }
.gap-2         { gap: var(--space-2); }
.gap-3         { gap: var(--space-3); }
.gap-4         { gap: var(--space-4); }
.mt-2          { margin-top: var(--space-2); }
.mt-3          { margin-top: var(--space-3); }
.shrink-0      { flex-shrink: 0; }
.text-sm       { font-size: 0.875rem; }
.text-muted    { color: var(--color-text-secondary); }
.font-600      { font-weight: 600; }
.max-w-sm      { max-width: 480px; }
.hidden        { display: none !important; }

/* --- Page title (replaces .card.page-header antipattern) --- */
.page-title {
    padding: var(--space-6) 0 var(--space-5);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-5);
}

.page-title h1 {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: var(--space-1);
}

.page-title .lead {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin: 0;
}

/* --- Section header (title + actions on one row) --- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.section-header h2 {
    margin: 0;
}

/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* --- Intranet bar --- */
.intranet-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
}

.intranet-bar-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.intranet-bar-label {
    font-weight: 600;
    font-size: 0.9375rem;
}

.intranet-bar-url {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

/* --- Status dot (live indicator) --- */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-dot.online  { background: var(--color-success); }
.status-dot.offline { background: var(--color-text-muted); }
.status-dot.warning { background: var(--color-warning); }

/* --- Badge extensions --- */
.badge-enabled  { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-disabled { background: var(--color-neutral-bg); color: var(--color-neutral-text); }

/* --- Handshake status (replaces inline style.color in JS) --- */
.hs-recent { color: var(--color-success); }
.hs-stale  { color: var(--color-warning); }

/* ========== SUBNET ADMIN PAGE ========== */
.subnet-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.stat-box {
    flex: 1;
    min-width: 120px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    text-align: center;
}

.stat-box .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    color: var(--color-text);
}

.stat-box .stat-label {
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    margin-top: var(--space-1);
}

.stat-value.stat-green  { color: var(--color-success); }
.stat-value.stat-red    { color: var(--color-danger); }
.stat-value.stat-yellow { color: var(--color-warning); }

.pools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.pool-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    border: 1px solid var(--color-border);
    transition: transform 0.1s ease, border-color 0.15s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.pool-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-primary);
    text-decoration: none;
}

.pool-card h3 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--color-text);
}

.pool-card .cidr {
    font-family: 'Courier New', Courier, monospace;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.pool-progress {
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: var(--space-2);
}

.pool-progress-bar {
    height: 100%;
    background: var(--color-success);
    transition: width 0.3s ease;
}

.pool-progress-bar.high { background: var(--color-warning); }
.pool-progress-bar.full { background: var(--color-danger); }

.pool-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

/* Subnet detail page */
.detail-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: var(--space-5);
}

.detail-stat {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-4);
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.detail-stat strong { color: var(--color-text); font-weight: 600; }

tr.row-allocated {
    background: rgba(220, 38, 38, 0.04);
    cursor: pointer;
}

tr.row-allocated:hover {
    background: rgba(220, 38, 38, 0.10);
}

tr.row-free {
    background: rgba(22, 163, 74, 0.03);
}

/* ========== RESPONSIVE: Tablet ========== */
@media (max-width: 768px) {
    .topbar-menu {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--color-topbar-bg);
        flex-direction: column;
        padding: 12px 20px 20px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        gap: 4px;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
        z-index: 99;
    }

    .topbar-menu.open {
        display: flex;
    }

    .topbar-hamburger {
        display: flex;
    }

    .topbar-nav {
        flex-direction: column;
        margin-left: 0;
        width: 100%;
        gap: 2px;
    }

    .topbar-link {
        width: 100%;
        padding: 10px 12px;
    }

    .topbar-actions {
        flex-direction: column;
        align-items: flex-start;
        margin-left: 0;
        width: 100%;
        gap: 8px;
        padding-top: 8px;
        padding-left: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        border-left: none;
    }

    .sectionbar-inner {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px;
    }

    .sectionbar-nav {
        width: 100%;
        gap: 6px;
    }

    .sectionbar-link {
        width: 100%;
        justify-content: flex-start;
    }

    .page-meta-row {
        gap: 8px 16px;
    }

    .topbar-user {
        max-width: 100%;
        padding: 4px 12px;
    }

    .container {
        padding: 20px 16px;
    }

    .card {
        padding: 20px 16px;
    }

    .data-table {
        font-size: 0.8125rem;
    }

    .data-table thead th {
        padding: 8px 12px;
    }

    .data-table tbody td {
        padding: 10px 12px;
    }

    h1 {
        font-size: 1.25rem;
    }
}

/* ========== RESPONSIVE: Small Phone ========== */
@media (max-width: 480px) {
    .logo-wrapper {
        width: min(55vw, 180px);
        height: min(55vw, 180px);
    }

    .hero-tagline {
        font-size: 0.875rem;
    }

    .btn {
        padding: 10px 14px;
    }

    .btn-sm {
        padding: 6px 10px;
    }

    .card {
        padding: 16px 14px;
    }
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {

    .logo-wrapper.animated .main-logo,
    .logo-wrapper.animated::before,
    .logo-wrapper.animated::after {
        animation: none !important;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
    }
}
