:root {
    --bg: #0f172a;
    --bg-card: #020617;
    --border: #1e293b;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --accent-up: #22c55e;
    --accent-down: #ef4444;
    --accent-unknown: #f97316;
    --brand: #38bdf8;
    --radius: 14px;
    --shadow: 0 18px 45px rgba(15,23,42,.75);
    --font: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
}

body.status, body.admin, body.auth-page {
    background: radial-gradient(circle at top left, #1e293b, #020617 55%);
    color: var(--text);
}

/* Topbar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(16px);
    background: linear-gradient(to bottom, rgba(15,23,42,.95), rgba(15,23,42,.7));
    border-bottom: 1px solid rgba(148,163,184,.18);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px;
}

.topbar .brand {
    font-weight: 600;
    letter-spacing: .03em;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--brand);
}

.topbar .subtitle {
    color: var(--muted);
    font-size: 0.9rem;
}

.topbar nav a {
    color: var(--muted);
    font-size: 0.9rem;
    margin-left: 16px;
    text-decoration: none;
}
.topbar nav a:hover {
    color: var(--text);
}

/* Layout */

.container {
    max-width: 1120px;
    margin: 24px auto 40px;
    padding: 0 16px;
}

.card {
    background: radial-gradient(circle at top left, rgba(56,189,248,.12), rgba(15,23,42,1));
    border-radius: var(--radius);
    border: 1px solid rgba(148,163,184,.22);
    box-shadow: var(--shadow);
    padding: 18px 20px 20px;
    margin-bottom: 22px;
}

.card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 10px;
}

.card-header h2 {
    margin: 0;
    font-size: 1.05rem;
}

/* Monitor cards */

.monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.monitor-card {
    background: rgba(15,23,42,.95);
    border-radius: var(--radius);
    border: 1px solid rgba(148,163,184,.22);
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.monitor-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.monitor-name {
    font-weight: 600;
    font-size: 0.98rem;
}

.monitor-target {
    font-size: 0.8rem;
    color: var(--muted);
    word-break: break-all;
}

.monitor-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
    font-size: 0.78rem;
}

.monitor-meta .label {
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
}

.monitor-meta .value {
    font-weight: 500;
}

/* badges */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: .05em;
}

.badge-up {
    background: rgba(34,197,94,.1);
    color: var(--accent-up);
    border: 1px solid rgba(34,197,94,.4);
}
.badge-down {
    background: rgba(239,68,68,.12);
    color: var(--accent-down);
    border: 1px solid rgba(239,68,68,.4);
}
.badge-unknown {
    background: rgba(249,115,22,.12);
    color: var(--accent-unknown);
    border: 1px solid rgba(249,115,22,.4);
}

/* uptime bar */

.uptime-bar {
    display: flex;
    gap: 2px;
    margin-top: 4px;
}

.uptime-block {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    opacity: 0.65;
}
.uptime-block.up {
    background: linear-gradient(to bottom, #22c55e, #16a34a);
}
.uptime-block.down {
    background: linear-gradient(to bottom, #ef4444, #b91c1c);
}

/* message */

.monitor-message {
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--muted);
}

/* Dot */

.dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    box-shadow: 0 0 12px rgba(34,197,94,.9);
}
.dot-up {
    background: #22c55e;
}

/* Admin page */

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

.table th,
.table td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(30,64,175,.5);
}

.table th {
    text-align: left;
    color: var(--muted);
    font-weight: 500;
}

.table a {
    color: var(--brand);
    text-decoration: none;
    font-size: 0.78rem;
}
.table a:hover {
    text-decoration: underline;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 16px;
}

.grid-form label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 3px;
    color: var(--muted);
}

.grid-form input,
.grid-form select {
    width: 100%;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(148,163,184,.4);
    background: rgba(15,23,42,.9);
    color: var(--text);
    font-size: 0.82rem;
}

.grid-form button {
    padding: 8px 14px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(to right, #38bdf8, #22c55e);
    color: #0b1120;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
}

.grid-form button:hover {
    filter: brightness(1.08);
}

.full-width {
    grid-column: 1 / -1;
}

.options-info {
    font-size: 0.78rem;
    color: var(--muted);
}

/* Auth page */

.auth-page {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
}

.auth-box {
    background: rgba(15,23,42,.96);
    border-radius: var(--radius);
    border: 1px solid rgba(148,163,184,.25);
    padding: 24px 26px;
    width: 320px;
    box-shadow: var(--shadow);
}

.auth-box h1 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.auth-box label {
    display: block;
    font-size: 0.82rem;
    margin-bottom: 4px;
    color: var(--muted);
}

.auth-box input {
    width: 100%;
    padding: 7px 9px;
    border-radius: 8px;
    border: 1px solid rgba(148,163,184,.4);
    background: #020617;
    color: var(--text);
    margin-bottom: 10px;
}

.auth-box button {
    width: 100%;
    padding: 8px 10px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(to right, #38bdf8, #22c55e);
    color: #020617;
    font-weight: 600;
    cursor: pointer;
}

/* alerts */

.alert {
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.78rem;
    margin-bottom: 10px;
}
.alert-error {
    background: rgba(239,68,68,.1);
    color: #fecaca;
    border: 1px solid rgba(239,68,68,.4);
}

/* small */

@media (max-width: 640px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 12px 16px;
    }
}
