:root {
    --bg: #08111f;
    --panel: #111d2e;
    --panel-2: #15243a;
    --border: #24344d;
    --text: #edf4ff;
    --muted: #8ea0bb;
    --critical: #ff496c;
    --high: #ff8a45;
    --medium: #ffc857;
    --low: #62c6ff;
    --info: #7c8cff;
    --success: #42d392;
    --shadow: 0 18px 50px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top right, #142642 0, var(--bg) 34rem);
    color: var(--text);
}
body.modal-open { overflow: hidden; }
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 28px;
    background: rgba(8,17,31,.88);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
}
.brand, .top-actions { display: flex; align-items: center; gap: 12px; }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); margin-top: 2px; }
.brand-symbol {
    display: block;
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex: 0 0 auto;
    background: transparent;
    border: 0;
    box-shadow: none;
}
.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid rgba(66,211,146,.35);
    background: rgba(66,211,146,.08);
    border-radius: 999px;
    color: #8ef0bd;
    font-size: 13px;
}
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px rgba(66,211,146,.1); }
.live-pill.offline { color: #ff9aab; border-color: rgba(255,73,108,.35); background: rgba(255,73,108,.08); }
.live-pill.offline i { background: var(--critical); }
.live-pill.paused { color: var(--medium); border-color: rgba(255,200,87,.35); }
.dashboard { width: min(1660px, calc(100% - 36px)); margin: 18px auto 80px; }
.hero-row { display: flex; justify-content: space-between; align-items: end; margin-bottom: 20px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(24px, 3vw, 36px); letter-spacing: -.04em; }
h2 { margin-bottom: 4px; font-size: 18px; }
.muted { color: var(--muted); }
.updated { color: var(--muted); font-size: 13px; }
.dashboard-updated { margin-bottom: 10px; text-align: right; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card, .panel {
    border: 1px solid var(--border);
    background: linear-gradient(160deg, rgba(21,36,58,.95), rgba(14,25,41,.98));
    border-radius: 18px;
    box-shadow: var(--shadow);
}
.stat-card { padding: 20px; position: relative; overflow: hidden; }
.stat-card::after { content:""; position:absolute; inset:auto -30px -55px auto; width:120px; height:120px; border-radius:50%; opacity:.13; background: currentColor; }
.stat-card span, .stat-card small { display:block; color:var(--muted); }
.stat-card strong { display:block; font-size:38px; margin:8px 0 2px; }
.stat-card.critical { color:var(--critical); }
.stat-card.high { color:var(--high); }
.stat-card.medium { color:var(--medium); }
.stat-card.info { color:var(--low); }
.panel { padding: 18px; margin-bottom: 18px; }
.panel-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:15px; }
.apps-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; }
.app-card { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:12px; padding:14px; border-radius:14px; background:rgba(255,255,255,.025); border:1px solid var(--border); }
.app-card strong, .app-card small { display:block; }
.app-card small { color:var(--muted); margin-top:4px; text-transform:capitalize; }
.app-card time { color:var(--muted); font-size:12px; }
.app-card-meta { display:flex; flex-direction:column; align-items:flex-end; gap:5px; min-width:70px; }
.delivery-indicator { display:inline-flex; align-items:center; justify-content:center; min-width:28px; height:25px; }
.delivery-indicator.warning {
    color:var(--medium);
    font-size:22px;
    line-height:1;
    filter:drop-shadow(0 0 7px rgba(255,200,87,.25));
}
.delivery-indicator.count {
    padding:3px 9px;
    border:1px solid rgba(98,198,255,.32);
    border-radius:999px;
    color:#bce8ff;
    background:rgba(98,198,255,.1);
    font-size:14px;
    font-weight:850;
}
.app-status { width:11px; height:11px; border-radius:50%; background:var(--muted); }
.app-card.online .app-status { background:var(--success); box-shadow:0 0 0 5px rgba(66,211,146,.1); }
.app-card.warning .app-status { background:var(--medium); }
.app-card.offline .app-status, .app-card.disabled .app-status { background:var(--critical); }
.two-columns { display:grid; grid-template-columns:1.15fr .85fr; gap:18px; }
.alerts-list { display:grid; gap:10px; max-height:520px; overflow:auto; padding-right:4px; }
.alert-item { padding:14px; border:1px solid var(--border); border-left-width:4px; border-radius:12px; background:rgba(255,255,255,.025); }
.alert-item.critical { border-left-color:var(--critical); }
.alert-item.critical-focus { animation: critical-focus 1s ease-in-out 2; }
.alert-item.high { border-left-color:var(--high); }
.alert-item.medium { border-left-color:var(--medium); }
.alert-item.low { border-left-color:var(--low); }
.alert-top { display:flex; align-items:center; gap:9px; }
.alert-top strong { flex:1; }
.alert-item p { margin:9px 0; color:#c9d6e8; line-height:1.45; }
.alert-item small { color:var(--muted); }
.alert-actions { display:flex; gap:8px; margin-top:12px; }
.alert-actions button {
    border:1px solid var(--border); background:transparent; color:var(--muted);
    padding:6px 9px; border-radius:8px; cursor:pointer;
}
.alert-actions button:hover { color:var(--text); background:rgba(255,255,255,.05); }
.count { color:var(--muted); }
.badge { display:inline-flex; border-radius:999px; padding:4px 8px; font-size:11px; font-weight:750; border:1px solid transparent; }
.badge.critical { color:#ff91a6; background:rgba(255,73,108,.12); border-color:rgba(255,73,108,.25); }
.badge.high { color:#ffb17e; background:rgba(255,138,69,.12); border-color:rgba(255,138,69,.25); }
.badge.medium { color:#ffdb85; background:rgba(255,200,87,.12); border-color:rgba(255,200,87,.25); }
.badge.low { color:#9ddbff; background:rgba(98,198,255,.12); border-color:rgba(98,198,255,.25); }
.badge.info, .badge.debug { color:#aeb7ff; background:rgba(124,140,255,.12); border-color:rgba(124,140,255,.25); }
.distribution { display:grid; gap:14px; }
.dist-row { display:grid; grid-template-columns:minmax(130px, 1fr) 2fr 45px; align-items:center; gap:12px; }
.dist-row > span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-family:ui-monospace, SFMono-Regular, Menlo, monospace; font-size:12px; color:#c8d5e7; }
.bar-track { height:9px; border-radius:999px; background:rgba(255,255,255,.06); overflow:hidden; }
.bar { height:100%; background:linear-gradient(90deg,#48a8ff,#7857ff); border-radius:999px; }
.dist-row strong { text-align:right; }
.filters { display:grid; grid-template-columns:1fr 1fr 1.2fr 1.6fr auto auto; gap:9px; margin-bottom:14px; }
input, select {
    width:100%; border:1px solid var(--border); background:#0b1627; color:var(--text);
    padding:10px 12px; border-radius:10px; outline:none;
}
input:focus, select:focus { border-color:#558de5; box-shadow:0 0 0 3px rgba(85,141,229,.12); }
.button, button.primary {
    display:inline-flex; justify-content:center; align-items:center; border:1px solid #4e75ad;
    background:#1e58a4; color:white; padding:9px 13px; border-radius:10px; cursor:pointer;
}
.button.ghost { background:transparent; border-color:var(--border); color:#c9d6e8; }
.button:hover, button.primary:hover { filter:brightness(1.12); }
.table-wrap { overflow:auto; max-height:680px; border:1px solid var(--border); border-radius:13px; }
table { width:100%; border-collapse:collapse; font-size:13px; }
th { position:sticky; top:0; z-index:2; text-align:left; background:#132238; color:#9fb0c8; padding:11px; border-bottom:1px solid var(--border); }
td { padding:10px 11px; border-bottom:1px solid rgba(36,52,77,.68); vertical-align:top; color:#d6e1ef; }
tbody tr:hover { background:rgba(255,255,255,.025); }
code, .mono { font-family:ui-monospace, SFMono-Regular, Menlo, monospace; font-size:12px; }
.endpoint { max-width:300px; overflow-wrap:anywhere; }
.nowrap { white-space:nowrap; }
.cell-sub { display:block; color:var(--muted); margin-top:3px; }
.outcome { text-transform:capitalize; }
.outcome.success { color:var(--success); }
.outcome.failure { color:#ff899f; }
.outcome.unknown { color:var(--muted); }
.loading, .empty { padding:25px; text-align:center; color:var(--muted); }
.success-text { color:#8ef0bd; }
.login-page { display:grid; place-items:center; padding:20px; }
.login-card {
    width:min(420px,100%); padding:32px; border:1px solid var(--border);
    background:rgba(17,29,46,.94); border-radius:22px; box-shadow:var(--shadow);
}
.login-logo {
    display: block;
    width: 100%;
    height: auto;
    max-height: 150px;
    object-fit: contain;
    margin: 0 auto 18px;
    background: transparent;
    border: 0;
    box-shadow: none;
}
.login-card form { display:grid; gap:16px; margin-top:0; }
.login-card label { display:grid; gap:7px; color:#c9d6e8; }
.wide { width:100%; padding:12px; }
.notice { padding:12px; border-radius:10px; margin-top:16px; }
.notice.danger { color:#ffc0cb; background:rgba(255,73,108,.1); border:1px solid rgba(255,73,108,.25); }
.toast {
    position:fixed; right:24px; bottom:24px; padding:12px 16px; border-radius:10px;
    background:#153429; border:1px solid rgba(66,211,146,.35); box-shadow:var(--shadow);
    opacity:0; transform:translateY(10px); pointer-events:none; transition:.2s;
}
.toast.visible { opacity:1; transform:none; }
.toast.error { background:#3a1720; border-color:rgba(255,73,108,.35); }
.critical-modal[hidden] { display:none; }
.critical-modal {
    position:fixed;
    inset:0;
    z-index:1000;
    display:grid;
    place-items:center;
    padding:22px;
    background:transparent;
    backdrop-filter:none;
    animation:critical-overlay-in .18s ease-out;
}
.critical-modal-card {
    width:min(650px, 100%);
    padding:34px;
    text-align:center;
    color:#fff;
    background:linear-gradient(145deg, #b20d2d, #760016);
    border:2px solid rgba(255,255,255,.7);
    border-radius:22px;
    box-shadow:0 28px 90px rgba(39,0,7,.65);
    animation:critical-card-in .25s ease-out;
}
.critical-modal-icon {
    display:grid;
    place-items:center;
    width:76px;
    height:76px;
    margin:0 auto 14px;
    border-radius:50%;
    color:#a00020;
    background:#fff;
    font-size:52px;
    line-height:1;
    font-weight:900;
    box-shadow:0 0 0 10px rgba(255,255,255,.14);
}
.critical-modal-eyebrow {
    margin:0 0 8px;
    font-size:13px;
    font-weight:900;
    letter-spacing:.18em;
}
.critical-modal-card h2 { margin:0 0 12px; font-size:clamp(25px, 4vw, 36px); }
.critical-modal-card > p:not(.critical-modal-eyebrow) { margin:0 auto; max-width:560px; color:#ffe8ed; line-height:1.55; }
.critical-modal-meta {
    display:flex;
    justify-content:center;
    flex-wrap:wrap;
    gap:8px 18px;
    margin-top:20px;
    color:#ffd3dc;
    font-size:13px;
}
.critical-modal-actions { display:flex; justify-content:center; gap:12px; margin-top:26px; }
.critical-modal-button {
    min-width:145px;
    padding:11px 18px;
    border:1px solid #fff;
    border-radius:11px;
    color:#8c001a;
    background:#fff;
    font-weight:800;
    cursor:pointer;
}
.critical-modal-button.secondary { color:#fff; background:transparent; }
.critical-modal-button:hover { filter:brightness(1.08); }
.critical-modal-button:focus-visible { outline:3px solid #fff; outline-offset:3px; }
@keyframes critical-overlay-in { from { opacity:0; } }
@keyframes critical-card-in { from { opacity:0; transform:scale(.94) translateY(10px); } }
@keyframes critical-focus {
    50% { border-color:#ff496c; box-shadow:0 0 0 5px rgba(255,73,108,.22); }
}
@media (max-width:1100px) {
    .stats-grid, .apps-grid { grid-template-columns:repeat(2,1fr); }
    .two-columns { grid-template-columns:1fr; }
    .filters { grid-template-columns:repeat(2,1fr); }
}
@media (max-width:680px) {
    .topbar { padding:12px 14px; }
    .user-name { display:none; }
    .dashboard { width:min(100% - 20px, 1660px); margin-top:18px; }
    .hero-row { align-items:start; gap:10px; flex-direction:column; }
    .stats-grid, .apps-grid, .filters { grid-template-columns:1fr; }
    .app-card { grid-template-columns:auto 1fr; }
    .app-card-meta { grid-column:2; align-items:flex-start; }
    .critical-modal-card { padding:26px 18px; }
    .critical-modal-actions { flex-direction:column; }
    .critical-modal-button { width:100%; }
}
@media (prefers-reduced-motion:reduce) {
    .critical-modal, .critical-modal-card, .alert-item.critical-focus { animation:none; }
}
