@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 {
    --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);
    --radius: 14px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

* { 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;
}

a { color: #6ee7b7; text-decoration: none; }
a: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: rgba(7, 11, 16, 0.85);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.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; }

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, .link-btn:hover {
    color: var(--text);
    background: var(--surface);
    text-decoration: none;
}

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: 2rem 2rem 1.75rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.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-split {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.25rem;
    align-items: start;
}

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

.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 */
.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: #fca5a5; 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; }

.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: #fca5a5; 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; }
