:root {
    --bg: #0f172a;
    --panel: #ffffff;
    --text: #172033;
    --muted: #667085;
    --line: #dce3ef;
    --green: #16a34a;
    --amber: #f59e0b;
    --red: #dc2626;
    --blue: #2563eb;
    --shadow: 0 24px 80px rgba(15, 23, 42, .14);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: #f5f7fb;
}

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

.public-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, .25), transparent 34rem),
        radial-gradient(circle at bottom right, rgba(22, 163, 74, .18), transparent 34rem),
        var(--bg);
}

.status-page,
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px;
}

.status-card {
    width: min(760px, 100%);
    padding: 44px;
    border-radius: 34px;
    background: rgba(255, 255, 255, .94);
    box-shadow: var(--shadow);
    text-align: center;
    overflow: hidden;
    position: relative;
}

.status-card::before {
    content: "";
    position: absolute;
    inset: -40%;
    background: conic-gradient(from 180deg, transparent, rgba(37, 99, 235, .2), transparent, rgba(22, 163, 74, .18), transparent);
    animation: rotateGlow 9s linear infinite;
    z-index: 0;
}

.status-card > * { position: relative; z-index: 1; }

@keyframes rotateGlow {
    to { transform: rotate(360deg); }
}

.status-orb {
    width: 148px;
    height: 148px;
    border-radius: 999px;
    margin: 0 auto 28px;
    position: relative;
    display: grid;
    place-items: center;
}

.status-orb span {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    border: 2px solid currentColor;
    opacity: .24;
    animation: pulseRing 2.2s ease-out infinite;
}

.status-orb span:nth-child(2) { animation-delay: .55s; }

.status-orb strong {
    width: 72px;
    height: 72px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 50px currentColor;
    animation: breathe 1.8s ease-in-out infinite alternate;
}

.status-running .status-orb { color: var(--green); }
.status-issues .status-orb { color: var(--amber); }
.status-down .status-orb { color: var(--red); }

@keyframes pulseRing {
    from { transform: scale(.65); opacity: .34; }
    to { transform: scale(1.35); opacity: 0; }
}

@keyframes breathe {
    from { transform: scale(.9); opacity: .82; }
    to { transform: scale(1.04); opacity: 1; }
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .14em;
    font-weight: 800;
    font-size: 12px;
}

h1, h2 {
    margin: 0 0 16px;
    line-height: 1.05;
}

h1 { font-size: clamp(36px, 5vw, 64px); }
h2 { font-size: 22px; }

.status-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 16px;
    border-radius: 999px;
    background: #eef4ff;
    font-weight: 800;
}

.status-copy {
    max-width: 560px;
    margin: 18px auto;
    color: var(--muted);
    line-height: 1.7;
}

.status-checks {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 28px 0;
}

.status-checks div,
.metric,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, .06);
}

.status-checks div { padding: 16px; }
.status-checks dt { color: var(--muted); text-transform: capitalize; }
.status-checks dd { margin: 8px 0 0; font-weight: 800; }
.ok { color: var(--green); }
.bad { color: var(--red); }

.status-notes {
    margin: 0 auto 20px;
    padding: 0;
    max-width: 480px;
    list-style: none;
    color: var(--amber);
    font-weight: 700;
}

.status-time { color: var(--muted); font-size: 14px; }
.status-login { display: inline-flex; margin-top: 12px; font-weight: 800; }

.login-panel {
    width: min(420px, 100%);
    padding: 32px;
}

.admin-body {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #111827;
    color: #fff;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand {
    color: #fff;
    font-size: 20px;
    font-weight: 900;
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar nav a,
.logout-form button {
    color: rgba(255,255,255,.85);
    background: rgba(255,255,255,.06);
    border: 0;
    border-radius: 14px;
    padding: 12px 14px;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.sidebar nav a:hover,
.logout-form button:hover {
    background: rgba(255,255,255,.12);
    text-decoration: none;
}

.logout-form { margin-top: auto; }

.admin-main {
    padding: 34px;
    overflow-x: auto;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric {
    padding: 22px;
}

.metric span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.metric strong {
    font-size: 34px;
}

.panel {
    padding: 24px;
    margin-bottom: 24px;
}

.split {
    display: grid;
    grid-template-columns: minmax(320px, .65fr) minmax(0, 1.35fr);
    gap: 24px;
    align-items: start;
}

.stack {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 7px;
    font-weight: 800;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    font: inherit;
}

textarea {
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

button,
.button-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: 0;
    border-radius: 14px;
    padding: 12px 16px;
    background: var(--blue);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

button:hover,
.button-link:hover { text-decoration: none; filter: brightness(.95); }

.inline-check {
    display: flex;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
}
.inline-check input { width: auto; }

.alert {
    padding: 16px 18px;
    border-radius: 18px;
    margin-bottom: 18px;
    font-weight: 700;
}

.alert code {
    display: block;
    margin-top: 10px;
    padding: 12px;
    background: rgba(255,255,255,.65);
    border-radius: 12px;
    overflow-wrap: anywhere;
}

.alert.success { background: #dcfce7; color: #166534; }
.alert.error { background: #fee2e2; color: #991b1b; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 13px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
th { color: var(--muted); font-size: 13px; }

.badge,
.health-pill {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 12px;
    text-transform: uppercase;
}

.badge.sent,
.health-pill.running { background: #dcfce7; color: #166534; }
.badge.queued,
.health-pill.issues { background: #fef3c7; color: #92400e; }
.badge.failed,
.health-pill.down { background: #fee2e2; color: #991b1b; }

.filter-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-links a {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 800;
}

.detail-list {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 12px;
}
.detail-list dt { color: var(--muted); font-weight: 800; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }

.timeline {
    display: grid;
    gap: 14px;
    padding-left: 20px;
}

.timeline time {
    display: block;
    color: var(--muted);
    margin: 3px 0;
}

pre {
    white-space: pre-wrap;
    word-break: break-word;
    background: #0f172a;
    color: #e5e7eb;
    padding: 14px;
    border-radius: 14px;
}

.message-preview {
    width: 100%;
    min-height: 420px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
}

@media (max-width: 960px) {
    .admin-body { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .metric-grid,
    .split,
    .status-checks { grid-template-columns: 1fr; }
}
