@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root,
[data-theme="dark"] {
    --bg: #070b10;
    --bg-elevated: #0e141c;
    --surface: #131b26;
    --surface-hover: #1a2433;
    --text: #f0f4f8;
    --muted: #8fa3bc;
    --border: #243044;
    --border-soft: #1c2838;
    --up: #22c55e;
    --up-bg: rgba(34, 197, 94, 0.12);
    --degraded: #f59e0b;
    --degraded-bg: rgba(245, 158, 11, 0.12);
    --down: #ef4444;
    --down-bg: rgba(239, 68, 68, 0.14);
    --unknown: #64748b;
    --unknown-bg: rgba(100, 116, 139, 0.12);
    --accent: #10a37f;
    --accent-dim: rgba(16, 163, 127, 0.15);
    --link: #6ee7b7;
    --link-hover: #34d399;
    --header-bg: rgba(7, 11, 16, 0.85);
    --backdrop: rgba(4, 8, 14, 0.92);
    --modal-header-bg: rgba(14, 20, 28, 0.92);
    --avatar-text: #6ee7b7;
    --admin-avatar-text: #fcd34d;
    --danger-text: #fca5a5;
    --danger-icon: #f87171;
    --danger-hover: #fecaca;
    --error-text: #fca5a5;
    --chart-grid: #243044;
    --panel-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
    --trigger-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
    --radius: 14px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

[data-theme="light"] {
    --bg: #f1f5f9;
    --bg-elevated: #ffffff;
    --surface: #ffffff;
    --surface-hover: #e8eef4;
    --text: #0f172a;
    --muted: #64748b;
    --border: #cbd5e1;
    --border-soft: #e2e8f0;
    --up: #16a34a;
    --up-bg: rgba(22, 163, 74, 0.1);
    --degraded: #d97706;
    --degraded-bg: rgba(217, 119, 6, 0.1);
    --down: #dc2626;
    --down-bg: rgba(220, 38, 38, 0.08);
    --unknown: #64748b;
    --unknown-bg: rgba(100, 116, 139, 0.1);
    --accent: #0d9488;
    --accent-dim: rgba(13, 148, 136, 0.12);
    --link: #0f766e;
    --link-hover: #0d9488;
    --header-bg: rgba(255, 255, 255, 0.92);
    --backdrop: rgba(15, 23, 42, 0.45);
    --modal-header-bg: rgba(255, 255, 255, 0.96);
    --avatar-text: #0f766e;
    --admin-avatar-text: #b45309;
    --danger-text: #b91c1c;
    --danger-icon: #dc2626;
    --danger-hover: #991b1b;
    --error-text: #b91c1c;
    --chart-grid: #e2e8f0;
    --panel-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
    --trigger-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
    --shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(16, 163, 127, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(37, 99, 235, 0.05), transparent);
    pointer-events: none;
    z-index: 0;
}

[data-theme="light"] body::before {
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(13, 148, 136, 0.07), transparent),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(59, 130, 246, 0.05), transparent);
}

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

.container { max-width: 1140px; margin: 0 auto; padding: 0 1.25rem; position: relative; z-index: 1; }

/* Header */
.site-header {
    border-bottom: 1px solid var(--border-soft);
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    overflow: visible;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 0;
}

.logo {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

nav { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-left: auto;
    min-width: 0;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex-wrap: wrap;
}

.header-nav::after {
    content: '';
    width: 1px;
    height: 1.35rem;
    background: var(--border-soft);
    margin: 0 0.35rem 0 0.5rem;
    flex-shrink: 0;
}

.header-auth {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.35rem;
}

.header-auth-link {
    color: var(--muted);
    text-decoration: none;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.header-auth-link:hover {
    color: var(--text);
    background: var(--surface);
    text-decoration: none;
}

nav a, .header-nav a, .link-btn {
    color: var(--muted);
    text-decoration: none;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

nav a:hover, .header-nav a:hover, .link-btn:hover {
    color: var(--text);
    background: var(--surface);
    text-decoration: none;
}

nav a.active, .header-nav a.active { color: var(--text); background: var(--surface); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-primary {
    background: linear-gradient(135deg, #10a37f, #0d8a6a);
    color: #04120d;
    box-shadow: 0 4px 14px rgba(16, 163, 127, 0.35);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.82rem; }

/* Status hero — Downdetector/Pulsetic style */
.status-hero {
    margin: 1.75rem 0 1.5rem;
    padding: 1.75rem 1.75rem 1.5rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: stretch;
}

.hero-status {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.hero-status .stats-bar {
    margin-top: auto;
    padding-top: 1.25rem;
}

/* Hero report prompt (opens modal — form never inline) */
.hero-report-prompt {
    display: flex;
    min-width: 0;
}

.report-prompt-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.65rem;
    padding: 1.35rem 1.4rem;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid rgba(16, 163, 127, 0.28);
    background:
        linear-gradient(145deg, rgba(16, 163, 127, 0.12) 0%, rgba(16, 163, 127, 0.03) 100%),
        var(--bg-elevated);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.report-prompt-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(16, 163, 127, 0.18);
    color: var(--link);
    margin-bottom: 0.15rem;
}

.report-prompt-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.report-prompt-text {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--muted);
}

.report-prompt-btn {
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.85rem 1.1rem;
    font-size: 0.95rem;
}

.report-prompt-meta {
    margin: 0;
    font-size: 0.78rem;
    text-align: center;
}

/* Full-screen report modal overlay */
.report-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    color: var(--text);
}

.report-modal-overlay[hidden] {
    display: none !important;
}

.report-modal-backdrop {
    position: absolute;
    inset: 0;
    background: var(--backdrop);
    backdrop-filter: blur(10px);
}

.report-modal-shell {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    width: 100%;
    background:
        radial-gradient(ellipse 70% 45% at 50% -10%, rgba(16, 163, 127, 0.14), transparent),
        var(--bg);
    animation: reportModalIn 0.24s ease-out;
}

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

.report-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border-soft);
    background: var(--modal-header-bg);
    position: sticky;
    top: 0;
    z-index: 2;
}

.report-modal-heading {
    min-width: 0;
}

.report-modal-eyebrow {
    margin: 0 0 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
}

.report-modal-header h2 {
    margin: 0;
    font-size: clamp(1.35rem, 4vw, 1.65rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.report-modal-close {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.report-modal-close:hover {
    color: var(--text);
    background: var(--surface-hover);
    border-color: var(--border);
}

.report-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.25rem 2rem;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
}

.report-modal-lead {
    margin: 0 0 1.25rem;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--muted);
}

.report-form-errors p {
    margin: 0;
}

.report-form-errors p + p {
    margin-top: 0.35rem;
}

.report-field {
    margin-bottom: 1.25rem;
    border: none;
    padding: 0;
}

.report-field label,
.report-field legend {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}

.report-categories {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.report-categories legend {
    padding: 0;
}

.report-form textarea {
    width: 100%;
    min-height: 140px;
    padding: 0.85rem 0.95rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.report-form textarea:focus {
    outline: none;
    border-color: rgba(16, 163, 127, 0.55);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.15);
}

.report-char-count {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.78rem;
    color: var(--muted);
    text-align: right;
}

.report-category-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.report-category-option {
    margin: 0;
    cursor: pointer;
}

.report-category-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.report-category-chip {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.75rem 0.85rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--muted);
    transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.12s;
}

.report-category-option input:checked + .report-category-chip {
    border-color: rgba(16, 163, 127, 0.55);
    background: rgba(16, 163, 127, 0.12);
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(16, 163, 127, 0.25);
}

.report-category-option input:focus-visible + .report-category-chip {
    outline: 2px solid rgba(16, 163, 127, 0.55);
    outline-offset: 2px;
}

.report-category-option:hover .report-category-chip {
    border-color: var(--border);
    background: var(--surface-hover);
    color: var(--text);
}

.report-category-icon {
    font-size: 1rem;
    line-height: 1;
}

.report-form-actions {
    display: flex;
    gap: 0.65rem;
    margin-top: 0.5rem;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.report-form-actions .btn {
    flex: 1;
    padding: 0.9rem 1rem;
    font-size: 0.95rem;
}

.report-form-note {
    margin: 1.15rem 0 0;
    font-size: 0.84rem;
    text-align: center;
    line-height: 1.45;
}

body.report-modal-open {
    overflow: hidden;
}

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

    .hero-report-prompt {
        order: 2;
    }

    .report-prompt-card {
        padding: 1.15rem 1.2rem;
    }
}

@media (min-width: 901px) {
    .report-modal-body {
        padding: 1.75rem 1.5rem 2.5rem;
    }
}

.report-form select,
.report-card textarea,
.report-card select,
.form-input {
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
}

.report-card label {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--muted);
}

.status-hero::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.status-hero.status-up::before { background: var(--up); }
.status-hero.status-degraded::before { background: var(--degraded); }
.status-hero.status-down::before { background: var(--down); }
.status-hero.status-unknown::before { background: var(--unknown); }

.status-hero.status-up { background: linear-gradient(135deg, var(--surface) 0%, rgba(34, 197, 94, 0.06) 100%); }
.status-hero.status-degraded { background: linear-gradient(135deg, var(--surface) 0%, rgba(245, 158, 11, 0.08) 100%); }
.status-hero.status-down { background: linear-gradient(135deg, var(--surface) 0%, rgba(239, 68, 68, 0.1) 100%); }

.status-row {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.status-indicator {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    position: relative;
}

.status-indicator::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    animation: pulse 2s ease-out infinite;
}

.status-up .status-indicator { background: var(--up-bg); color: var(--up); }
.status-up .status-indicator::after { border: 2px solid rgba(34, 197, 94, 0.3); }

.status-degraded .status-indicator { background: var(--degraded-bg); color: var(--degraded); }
.status-degraded .status-indicator::after { border: 2px solid rgba(245, 158, 11, 0.3); }

.status-down .status-indicator { background: var(--down-bg); color: var(--down); }
.status-down .status-indicator::after { border: 2px solid rgba(239, 68, 68, 0.35); }

.status-unknown .status-indicator { background: var(--unknown-bg); color: var(--unknown); }

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.35); opacity: 0; }
}

.status-dot-inner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: currentColor;
}

.status-headline h1 {
    margin: 0;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.status-headline .status-label {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0.35rem 0 0.5rem;
}

.status-up .status-label { color: var(--up); }
.status-degraded .status-label { color: var(--degraded); }
.status-down .status-label { color: var(--down); }
.status-unknown .status-label { color: var(--unknown); }

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--muted);
    margin: 0 0 0.35rem;
}

.muted { color: var(--muted); font-size: 0.92rem; }

.stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-soft);
}

.stat-chip {
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
}

.stat-chip strong {
    display: block;
    font-size: 1rem;
    color: var(--text);
    font-weight: 700;
}

/* Layout */
.layout-main {
    max-width: 100%;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 1rem;
    letter-spacing: -0.01em;
}

.section-block { margin-bottom: 2rem; }

/* Cards */
.grid.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.85rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    transition: border-color 0.15s, background 0.15s;
}

.card:hover { border-color: var(--border); background: var(--surface-hover); }

.card h2, .card h3 {
    margin: 0 0 0.65rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--muted);
}

.card-compact { padding: 0.85rem 1rem; }

.meta {
    list-style: none;
    padding: 0;
    margin: 0.65rem 0 0;
    font-size: 0.82rem;
    color: var(--muted);
}

.meta li { margin-bottom: 0.2rem; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pill-up { background: var(--up-bg); color: var(--up); }
.pill-degraded { background: var(--degraded-bg); color: var(--degraded); }
.pill-down { background: var(--down-bg); color: var(--down); }
.pill-unknown { background: var(--unknown-bg); color: var(--unknown); }

/* Components list */
.component-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.component-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.85rem;
    background: var(--bg-elevated);
    border-radius: 10px;
    font-size: 0.88rem;
    border: 1px solid var(--border-soft);
}

.component-row .name { font-weight: 500; }

/* Report form (legacy sidebar class kept for admin) */
.report-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 5rem;
}

.report-card textarea,
.report-card select,
.form-input {
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
}

.report-card label {
    display: block;
    margin-bottom: 0.85rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--muted);
}

.hp { position: absolute; left: -9999px; opacity: 0; height: 0; }

.flash {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.flash-success { background: var(--up-bg); color: var(--up); border: 1px solid rgba(34, 197, 94, 0.25); }
.flash-error { background: var(--down-bg); color: var(--error-text); border: 1px solid rgba(239, 68, 68, 0.25); }

/* Reports feed */
.report-item {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border-soft);
}

.report-item:last-child { border-bottom: 0; }

.report-item .body { font-size: 0.9rem; margin: 0.25rem 0; }

.report-item .meta-line {
    font-size: 0.78rem;
    color: var(--muted);
}

.report-item .tag {
    display: inline-block;
    background: var(--accent-dim);
    color: var(--accent);
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-right: 0.35rem;
}

/* Map */
#report-map {
    height: 320px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    background: var(--bg-elevated);
}

/* Charts */
.chart-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.chart-toolbar button {
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--muted);
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

.chart-toolbar button.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: rgba(16, 163, 127, 0.4);
}

.chart-wrap {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.charts h2 { font-size: 0.95rem; margin: 0 0 0.75rem; font-weight: 700; }

/* Incident banner */
.incident-banner {
    background: var(--degraded-bg);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

/* Auth */
.admin-auth, .auth-page {
    min-height: calc(100vh - 4rem);
    display: grid;
    place-items: center;
    padding: 2rem 0;
}

.auth-card {
    width: min(420px, 92vw);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.auth-card h1 { margin: 0 0 0.5rem; font-size: 1.5rem; }

.auth-card label { display: block; margin-bottom: 1rem; font-size: 0.85rem; font-weight: 500; color: var(--muted); }

.auth-card input[type=email],
.auth-card input[type=password],
.auth-card input[type=text] {
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
}

.auth-card button[type=submit] { width: 100%; margin-top: 0.5rem; }

.register-honeypot {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.pagination { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
.pagination a, .pagination span {
    padding: 0.4rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
}
.pagination span.current { background: var(--accent-dim); color: var(--accent); border-color: rgba(16,163,127,0.4); }

.error { color: var(--error-text); font-size: 0.85rem; margin-top: 0.25rem; }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }

.data-table th, .data-table td {
    border-bottom: 1px solid var(--border-soft);
    padding: 0.65rem 0.5rem;
    text-align: left;
    vertical-align: top;
}

.data-table th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* Footer */
.site-footer {
    border-top: 1px solid var(--border-soft);
    margin-top: 3rem;
    padding: 2rem 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links { display: flex; gap: 1.25rem; }

.footer-links a { color: var(--muted); }

main.container { padding-bottom: 2rem; }

/* Admin */
.admin-main { padding-top: 1.5rem; padding-bottom: 3rem; }

.admin-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.admin-title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    letter-spacing: -0.02em;
}

.admin-status-pill { font-size: 0.85rem; padding: 0.4rem 0.85rem; }

.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.admin-stat-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 0.85rem 1rem;
}

.admin-stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.admin-stat-card strong {
    font-size: 1.35rem;
    font-weight: 700;
}

.admin-stat-sub {
    display: block;
    font-size: 0.75rem;
    margin-top: 0.15rem;
}

.admin-link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.admin-link-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, background 0.15s, transform 0.12s;
}

.admin-link-card:hover {
    border-color: rgba(16, 163, 127, 0.4);
    background: var(--surface-hover);
    transform: translateY(-1px);
    text-decoration: none;
}

.admin-link-card strong { font-size: 0.95rem; }

.admin-link-card .muted { font-size: 0.8rem; line-height: 1.4; }

.admin-link-icon { font-size: 1.35rem; line-height: 1; margin-bottom: 0.15rem; }

.admin-link-card--action {
    padding: 0;
    border: none;
    background: none;
}

.admin-link-card--action button {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 1rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    color: inherit;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s, transform 0.12s;
}

.admin-link-card--action button:hover {
    border-color: rgba(16, 163, 127, 0.4);
    background: var(--surface-hover);
    transform: translateY(-1px);
}

.admin-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

@media (max-width: 900px) {
    .admin-two-col { grid-template-columns: 1fr; }
}

.admin-activity-feed {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 420px;
    overflow-y: auto;
}

.admin-activity-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-soft);
}

.admin-activity-item:last-child { border-bottom: 0; }

.admin-activity-msg {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.4;
}

.admin-activity-meta {
    margin: 0.2rem 0 0;
    font-size: 0.76rem;
}

.admin-live-controls {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.admin-live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--up);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
}

.admin-live-dot.polling {
    animation: livePulse 0.8s ease-out;
}

@keyframes livePulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
    100% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
}

.admin-search-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.admin-inline-form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.admin-check-inline {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
}

.admin-check-inline input {
    accent-color: var(--accent);
}

.admin-user-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

.live-source-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* User menu */
.user-menu {
    position: relative;
    flex-shrink: 0;
}

.user-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.3rem 0.65rem 0.3rem 0.3rem;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elevated) 100%);
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    max-width: 220px;
}

.user-menu-trigger:hover,
.user-menu.open .user-menu-trigger {
    border-color: rgba(16, 163, 127, 0.35);
    background: var(--surface-hover);
    box-shadow: var(--trigger-shadow);
}

.user-menu-trigger-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
    min-width: 0;
    text-align: left;
}

.user-menu-trigger-name {
    font-size: 0.86rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 130px;
}

.user-menu-trigger-role {
    font-size: 0.68rem;
    color: var(--muted);
    font-weight: 500;
}

.user-menu-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(16, 163, 127, 0.25), rgba(16, 163, 127, 0.08));
    color: var(--avatar-text);
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
    border: 1px solid rgba(16, 163, 127, 0.2);
}

.user-menu-avatar--admin {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(16, 163, 127, 0.12));
    border-color: rgba(245, 158, 11, 0.28);
    color: var(--admin-avatar-text);
}

.user-menu-avatar--lg {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 0.95rem;
    border-radius: 12px;
}

.user-menu-chevron {
    flex-shrink: 0;
    color: var(--muted);
    transition: transform 0.2s ease;
    margin-left: 0.1rem;
}

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

.user-menu-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 18rem;
    max-width: calc(100vw - 1.5rem);
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--panel-shadow);
    padding: 0.65rem;
    z-index: 1000;
}

.user-menu-panel[hidden] {
    display: none !important;
}

.user-menu.open .user-menu-panel {
    animation: userMenuIn 0.15s ease-out;
}

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

.user-menu-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.55rem 0.85rem;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 0.35rem;
}

.user-menu-profile-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.user-menu-profile-text strong {
    font-size: 0.92rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-profile-text span.user-menu-email {
    font-size: 0.76rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-role-pill {
    display: inline-flex;
    align-self: flex-start;
    margin-top: 0.2rem;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(245, 158, 11, 0.14);
    color: var(--admin-avatar-text);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.user-menu-section {
    padding: 0.25rem 0;
}

.user-menu-section + .user-menu-section {
    border-top: 1px solid var(--border-soft);
    margin-top: 0.25rem;
    padding-top: 0.45rem;
}

.user-menu-section-label {
    margin: 0 0 0.25rem;
    padding: 0 0.55rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.6rem 0.55rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.user-menu-item svg {
    flex-shrink: 0;
    color: var(--muted);
    transition: color 0.12s;
}

.user-menu-item:hover {
    background: var(--surface-hover);
    text-decoration: none;
}

.user-menu-item:hover svg {
    color: var(--accent);
}

.user-menu-footer {
    margin: 0.35rem 0 0;
    padding-top: 0.35rem;
    border-top: 1px solid var(--border-soft);
}

.user-menu-item--danger {
    color: var(--danger-text);
}

.user-menu-item--danger svg {
    color: var(--danger-icon);
}

.user-menu-item--danger:hover {
    background: var(--down-bg);
    color: var(--danger-hover);
}

/* Theme toggle (user menu) */
.theme-toggle {
    display: flex;
    gap: 0.35rem;
    padding: 0 0.55rem 0.35rem;
}

.theme-toggle-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 0.55rem;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--bg-elevated);
    color: var(--muted);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.theme-toggle-btn svg {
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.theme-toggle-btn.active {
    background: var(--accent-dim);
    border-color: rgba(16, 163, 127, 0.45);
    color: var(--accent);
}

@media (max-width: 768px) {
    .header-nav::after {
        display: none;
    }

    .header-actions {
        gap: 0.35rem;
    }

    .user-menu-trigger-text {
        display: none;
    }

    .user-menu-trigger {
        padding: 0.3rem;
        max-width: none;
    }

    .user-menu-panel {
        right: 0;
        left: auto;
    }
}

@media (max-width: 900px) {
    .header-inner {
        flex-wrap: wrap;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
}
