@font-face {
    font-family: "Quicksand";
    src: url("../assets/Quicksand_Bold.otf") format("truetype");
}

:root {
    --bg: #0b1220;
    --panel: #0f1a2d;
    --panel-2: #12233a;
    --line: rgba(125, 211, 252, 0.16);
    --line-strong: rgba(125, 211, 252, 0.28);
    --text: #eaf6ff;
    --muted: #8fa3b8;
    --accent: #20a7e8;
    --good: #22c55e;
    --warn: #f59e0b;
    --bad: #ef4444;
    --info: #38bdf8;
}

* { box-sizing: border-box; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(32,167,232,.16), transparent 30rem),
        linear-gradient(180deg, #0c1525, var(--bg));
    color: var(--text);
    font-family: Quicksand, Arial, sans-serif;
}
.admin-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 1.4rem 0 2.5rem; }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.brand { color: white; font-size: clamp(1.35rem, 3vw, 2rem); letter-spacing: .04em; text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: .7rem; }
button { border: 0; border-radius: .85rem; background: var(--accent); color: white; font-family: inherit; padding: .72rem 1rem; cursor: pointer; box-shadow: 0 10px 28px rgba(14,165,233,.18); }
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .65; cursor: wait; }
.live-pill { display: inline-flex; align-items: center; gap: .45rem; border: 1px solid rgba(34,197,94,.28); border-radius: 999px; padding: .55rem .75rem; color: #bbf7d0; background: rgba(34,197,94,.09); font-size: .76rem; white-space: nowrap; }
.live-pill i { width: .48rem; height: .48rem; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 .22rem rgba(34,197,94,.14); }
.live-pill[data-state="loading"] { color: #bae6fd; border-color: rgba(56,189,248,.28); background: rgba(56,189,248,.08); }
.live-pill[data-state="loading"] i { background: var(--info); box-shadow: 0 0 0 .22rem rgba(56,189,248,.14); }
.live-pill[data-state="error"] { color: #fecaca; border-color: rgba(239,68,68,.3); background: rgba(239,68,68,.09); }
.live-pill[data-state="error"] i { background: var(--bad); box-shadow: 0 0 0 .22rem rgba(239,68,68,.14); }

.panel { border: 1px solid var(--line); border-radius: 1.15rem; background: rgba(15,26,45,.86); box-shadow: 0 24px 80px rgba(0,0,0,.16); padding: 1.25rem; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.eyebrow { margin: 0 0 .45rem; color: #38bdf8; letter-spacing: .16em; text-transform: uppercase; font-size: .78rem; }
h1, h2 { margin: 0; color: white; }
h1 { font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1; }
h2 { font-size: .92rem; }
.panel-meta { display: grid; gap: .25rem; justify-items: end; color: var(--muted); font-size: .75rem; text-align: right; }

.dashboard-alert {
    border: 1px solid rgba(245, 158, 11, .28);
    border-radius: .9rem;
    background: rgba(245, 158, 11, .08);
    color: #fde68a;
    font-size: .78rem;
    line-height: 1.45;
    padding: .72rem .85rem;
    margin: .75rem 0 1rem;
}

.dashboard-alert[hidden] { display: none; }

.summary-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .65rem; margin: 1rem 0 1.1rem; }
.summary-card { border: 1px solid rgba(125,211,252,.14); border-radius: .9rem; padding: .85rem; background: linear-gradient(180deg, rgba(18,35,58,.92), rgba(12,22,38,.82)); min-width: 0; }
.summary-card strong { display: block; color: white; font-size: 1.35rem; line-height: 1; overflow: hidden; text-overflow: ellipsis; }
.summary-card span { display: block; margin-top: .42rem; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; }

.dashboard-grid { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: .8rem; margin: 1rem 0 1.25rem; }
.card { border: 1px solid rgba(125,211,252,.14); border-radius: 1rem; padding: .95rem; background: rgba(6, 13, 26, .34); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.card-head span { color: var(--muted); font-size: .7rem; text-align: right; }
.trend-card { grid-row: span 2; }
.daily-trend { height: 13rem; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); align-items: end; gap: .38rem; padding-top: .5rem; }
.trend-bar { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: .45rem; min-width: 0; }
.trend-bar span { display: block; width: 100%; min-height: .35rem; border-radius: .5rem .5rem .22rem .22rem; background: linear-gradient(180deg, #5eead4, #38bdf8 55%, #0ea5e9); box-shadow: 0 0 18px rgba(14,165,233,.18); }
.trend-bar em { color: var(--muted); font-style: normal; font-size: .62rem; white-space: nowrap; }
.rank-list { display: grid; gap: .7rem; margin-top: .7rem; }
.rank-row { min-width: 0; }
.rank-top { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; font-size: .76rem; }
.rank-top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #dbeafe; }
.rank-top strong { color: white; white-space: nowrap; font-size: .72rem; }
.rank-meta { color: var(--muted); font-size: .66rem; margin: .22rem 0 .4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: .34rem; border-radius: 999px; overflow: hidden; background: rgba(125,211,252,.10); }
.bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #22c55e, #38bdf8); }
.empty-note { margin: .75rem 0 0; color: var(--muted); font-size: .78rem; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 1.25rem 0 .65rem; }
.section-head span { color: var(--muted); font-size: .72rem; }
.server-toolbar { display: grid; grid-template-columns: minmax(14rem, 1fr) auto; gap: .7rem; align-items: center; margin: 0 0 .75rem; }
.server-search input { width: 100%; min-height: 2.75rem; border: 1px solid rgba(125,211,252,.16); border-radius: .85rem; background: rgba(6,13,26,.34); color: var(--text); font-family: inherit; padding: 0 .9rem; outline: none; }
.server-search input::placeholder { color: rgba(143,163,184,.8); }
.server-search input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 .22rem rgba(56,189,248,.10); }
.state-filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.state-filter { min-height: 2.35rem; border-radius: 999px; padding: 0 .42rem 0 .7rem; background: rgba(6,13,26,.34); border: 1px solid rgba(125,211,252,.14); color: var(--muted); box-shadow: none; font-size: .7rem; display: inline-flex; align-items: center; gap: .42rem; }
.state-filter:hover { color: var(--text); border-color: var(--line-strong); }
.state-filter.active { background: rgba(32,167,232,.16); border-color: rgba(56,189,248,.38); color: white; }
.state-count { min-width: 1.35rem; padding: .16rem .38rem; border-radius: 999px; background: rgba(125,211,252,.12); color: #dbeafe; font-size: .62rem; line-height: 1; text-align: center; }
.state-filter.active .state-count { background: rgba(56,189,248,.22); color: white; }
.server-list { display: grid; gap: .55rem; }
.server-row { display: grid; grid-template-columns: minmax(12rem, 1.2fr) repeat(5, minmax(4.2rem, .45fr)) minmax(7rem, .65fr) 1rem; align-items: center; gap: .75rem; border: 1px solid rgba(125,211,252,.13); border-radius: .85rem; padding: .75rem .85rem; background: rgba(18,35,58,.58); }
.server-row:hover { border-color: var(--line-strong); background: rgba(18,35,58,.78); }
.server-main { min-width: 0; }
.server-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: white; }
.server-meta { color: var(--muted); font-size: .68rem; margin-top: .22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metric { min-width: 0; }
.metric strong { display: block; color: white; font-size: .9rem; line-height: 1; }
.metric span { display: block; color: var(--muted); font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; margin-top: .25rem; }
.cache-label { color: var(--muted); font-size: .7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.cache-dot { width: .72rem; height: .72rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.22); justify-self: end; }
.cache-dot-cached { background: var(--good); box-shadow: 0 0 0 .22rem rgba(34,197,94,.12); }
.cache-dot-uncached { background: var(--warn); box-shadow: 0 0 0 .22rem rgba(245,158,11,.12); }
.cache-dot-failed { background: var(--bad); box-shadow: 0 0 0 .22rem rgba(239,68,68,.12); }
.cache-dot-running { background: var(--info); box-shadow: 0 0 0 .22rem rgba(56,189,248,.12); }

@media (max-width: 1050px) {
    .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
    .trend-card { grid-column: 1 / -1; grid-row: auto; }
    .daily-trend { height: 10rem; }
    .server-row { grid-template-columns: 1fr 1rem; }
    .metric, .cache-label { display: none; }
    .server-toolbar { grid-template-columns: 1fr; }
    .state-filters { justify-content: flex-start; }
}
@media (max-width: 700px) {
    .admin-shell { width: min(100% - 24px, 1180px); }
    .admin-header, .panel-head, .section-head { align-items: flex-start; flex-direction: column; }
    .panel-meta { justify-items: start; text-align: left; }
    .summary-grid, .dashboard-grid { grid-template-columns: 1fr; }
    .daily-trend { height: 8rem; gap: .22rem; }
    .trend-bar em { font-size: .52rem; transform: rotate(-45deg); }
    .state-filter { flex: 1 1 auto; }
}

.empty-panel { grid-column: 1 / -1; border: 1px dashed rgba(125,211,252,.18); border-radius: .9rem; padding: 1rem; color: var(--muted); background: rgba(6,13,26,.22); }
