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

:root {
    --bg: #f4f5f7;
    --bg-soft: #eef0f3;
    --white: #ffffff;
    --text: #1a1d23;
    --text-secondary: #5c6370;
    --muted: #8b929e;
    --border: #e4e6eb;
    --border-soft: #eceef2;
    --green: #16a34a;
    --green-light: #22c55e;
    --green-bg: #ecfdf3;
    --green-border: #bbf7d0;
    --green-glow: rgba(34, 197, 94, 0.18);
    --yellow: #ca8a04;
    --yellow-bg: #fefce8;
    --yellow-border: #fef08a;
    --red: #dc2626;
    --red-bg: #fef2f2;
    --red-border: #fecaca;
    --blue: #2563eb;
    --blue-bg: #eff6ff;
    --blue-border: #bfdbfe;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.05);
    --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.container {
    width: min(100% - 32px, 680px);
    margin: 0 auto;
}

/* ── TOP BAR ── */
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    width: min(100% - 32px, 680px);
    margin: 0 auto;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.95rem;
}

.topbar-brand .logo {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    color: white;
}

.topbar-link {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
}

.topbar-link:hover {
    background: var(--bg-soft);
    color: var(--text);
}

/* ── HERO STATUS ── */
.hero {
    padding: 48px 0 32px;
    text-align: center;
    position: relative;
}

.hero-glow {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--green-glow), transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.hero-glow.offline {
    background: radial-gradient(circle, rgba(220, 38, 38, 0.12), transparent 70%);
}

.hero-glow.maintenance {
    background: radial-gradient(circle, rgba(202, 138, 4, 0.14), transparent 70%);
}

.hero-content {
    position: relative;
    z-index: 1;
}

.status-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: 0 auto 16px;
    font-size: 1.8rem;
    background: var(--green-bg);
    border: 2px solid var(--green-border);
}

.status-icon.offline {
    background: var(--red-bg);
    border-color: var(--red-border);
}

.status-icon.maintenance {
    background: var(--yellow-bg);
    border-color: var(--yellow-border);
}

.hero h1 {
    font-size: clamp(1.5rem, 4vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}

.hero .last-check {
    color: var(--muted);
    font-size: 0.88rem;
}

/* ── STATS ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 36px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 14px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #d0d4dc;
}

.stat-card .icon {
    font-size: 1.35rem;
    margin-bottom: 6px;
    display: block;
}

.stat-card .label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 3px;
}

.stat-card .value {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

/* Offline banner */
.offline-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 20px;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 36px;
}

.offline-card .ico { font-size: 2rem; margin-bottom: 10px; }
.offline-card h3 { font-size: 1.05rem; margin-bottom: 4px; }
.offline-card p { color: var(--muted); font-size: 0.9rem; }

/* ── SECTION ── */
.section {
    margin-bottom: 36px;
}

.section-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 12px;
}

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

.section-label a {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--green);
    padding: 4px 10px;
    border-radius: 6px;
    transition: background 0.15s;
}

.section-label a:hover {
    background: var(--green-bg);
}

/* ── STATUS BOX (like incidents) ── */
.status-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.status-box .check-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--green-bg);
    color: var(--green);
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
    font-size: 1.2rem;
    font-weight: 700;
}

.status-box h3 {
    font-size: 1rem;
    font-weight: 650;
    margin-bottom: 4px;
}

.status-box p {
    color: var(--muted);
    font-size: 0.88rem;
}

/* ── UPDATES / CARDS ── */
.updates-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.update-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.update-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #d0d4dc;
}

.update-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 650;
}

.badge.online {
    color: var(--green);
    background: var(--green-bg);
    border: 1px solid var(--green-border);
}

.badge.maintenance {
    color: var(--yellow);
    background: var(--yellow-bg);
    border: 1px solid var(--yellow-border);
}

.badge.offline {
    color: var(--red);
    background: var(--red-bg);
    border: 1px solid var(--red-border);
}

.badge.info {
    color: var(--blue);
    background: var(--blue-bg);
    border: 1px solid var(--blue-border);
}

.update-top time {
    font-size: 0.78rem;
    color: var(--muted);
    white-space: nowrap;
}

.update-card h3 {
    font-size: 0.98rem;
    font-weight: 650;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.update-card p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.6;
}

/* Empty */
.empty-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.empty-card .ico { font-size: 1.6rem; margin-bottom: 8px; opacity: 0.5; }
.empty-card h3 { font-size: 0.95rem; margin-bottom: 2px; }
.empty-card p { color: var(--muted); font-size: 0.85rem; }

/* Footer */
footer {
    padding: 24px 0 32px;
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 12px;
}

/* ── LOGIN ── */
.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    background: var(--bg);
}

.login-box {
    width: min(100%, 400px);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 32px;
    box-shadow: var(--shadow-md);
}

.login-box .ico {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.login-box h1 {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-box > p {
    text-align: center;
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 24px;
}

form { display: grid; gap: 4px; }

label {
    margin-top: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

input, textarea, select {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    background: var(--white);
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

textarea { resize: vertical; min-height: 100px; }

input:focus, textarea:focus, select:focus {
    border-color: var(--green-light);
    box-shadow: 0 0 0 3px var(--green-glow);
}

button {
    margin-top: 18px;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--green);
    color: white;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 650;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}

button:hover {
    background: #15803d;
    transform: translateY(-1px);
}

.back-link {
    display: block;
    margin-top: 18px;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.back-link:hover { color: var(--green); }

.error, .success {
    padding: 10px 13px;
    margin-bottom: 14px;
    border-radius: 8px;
    font-size: 0.88rem;
}

.error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red-border);
}

.success {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid var(--green-border);
}

/* ── ADMIN ── */
.admin-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    gap: 12px;
}

.admin-nav strong { display: block; font-size: 0.92rem; }
.admin-nav span { display: block; font-size: 0.75rem; color: var(--muted); margin-top: 1px; }

.nav-actions { display: flex; gap: 6px; }

.nav-actions a {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.82rem;
    font-weight: 550;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.nav-actions a:hover {
    color: var(--green);
    border-color: var(--green-border);
    background: var(--green-bg);
}

.admin-page {
    display: grid;
    gap: 16px;
    padding: 28px 0 48px;
}

.panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.panel > h1, .panel > h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.admin-list { display: flex; flex-direction: column; gap: 8px; }

.admin-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
}

.admin-item h3 { font-size: 0.92rem; font-weight: 600; margin: 3px 0 1px; }
.admin-item small { font-size: 0.72rem; color: var(--muted); }
.admin-item form { display: block; }

.delete-btn {
    margin: 0;
    padding: 7px 12px;
    border: 1px solid var(--red-border);
    background: transparent;
    color: var(--red);
    font-size: 0.8rem;
    font-weight: 650;
    border-radius: 7px;
}

.delete-btn:hover {
    background: var(--red-bg);
    transform: none;
}

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

/* ── MOBILE ── */
@media (max-width: 540px) {
    .stats-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stat-card {
        display: flex;
        align-items: center;
        gap: 14px;
        text-align: left;
        padding: 14px 16px;
    }

    .stat-card .icon { margin-bottom: 0; }

    .section-label { flex-wrap: wrap; }

    .admin-nav, .admin-item {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-actions { width: 100%; }
    .nav-actions a { flex: 1; text-align: center; }

    .panel, .login-box { padding: 20px; }
    .hero { padding: 36px 0 24px; }
}
