:root {
  --bg: #0b0f17; --panel: #121826; --panel2: #182033; --line: #243049;
  --text: #e6ebf5; --muted: #8a96b0; --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444;
  --c1: #38bdf8; --c2: #a78bfa; --c3: #22c55e; --c4: #f59e0b; --c5: #f472b6; --c6: #2dd4bf; --c7: #fb7185; --c8: #facc15;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 8px; padding: 8px 14px; background: var(--c1); color: #04111d; font-weight: 600; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
button.ghost:hover { background: var(--panel2); }
button.sm { padding: 3px 9px; font-size: 12px; }
button.danger { color: var(--bad); }
input, select { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 1.2em; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.login-card label.check, label.check { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.live { background: var(--ok); box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 2s infinite; }
.dot.down { background: var(--bad); }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

/* layout */
main { max-width: 1400px; margin: 0 auto; padding: 16px 20px 40px; }
.top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-bottom: 12px; }
.meta { color: var(--muted); font-size: 13px; flex: 1; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.badge { font-size: 12px; padding: 3px 9px; border-radius: 99px; }
.badge.warn { background: rgba(245,158,11,.15); color: var(--warn); border: 1px solid rgba(245,158,11,.35); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; color: var(--muted); border-radius: 0; border-bottom: 2px solid transparent; font-weight: 500; }
.tabs button.active { color: var(--text); border-bottom-color: var(--c1); }
.tab { display: none; } .tab.active { display: block; }
.grid { display: grid; gap: 14px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.two { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.card.wide { margin-top: 14px; overflow-x: auto; }
.card header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; gap: 8px; }
.card h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.card footer { margin-top: 8px; font-size: 12.5px; }
.big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.big.small { font-size: 15px; }
canvas { width: 100%; display: block; }
.bar { height: 6px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; width: 0; background: var(--c1); transition: width .5s, background .5s; }
.cores { display: flex; gap: 4px; margin-top: 8px; }
.cores span { flex: 1; height: 22px; background: var(--panel2); border-radius: 4px; position: relative; overflow: hidden; font-size: 10px; text-align: center; line-height: 22px; color: var(--muted); }
.cores span i { position: absolute; left: 0; bottom: 0; width: 100%; background: rgba(56,189,248,.35); }
.cores span b { position: relative; font-weight: 500; }
.ring-wrap { position: relative; width: 120px; margin: 4px auto; }
.ring { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--panel2); stroke-width: 3.2; }
.ring-fg { fill: none; stroke: var(--c2); stroke-width: 3.2; stroke-linecap: round; transition: stroke-dasharray .6s; }
.ring-text { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-size: 12px; color: var(--muted); }
.mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; max-height: 190px; overflow: auto; }
.mini li { display: flex; justify-content: space-between; gap: 8px; }
.mini li span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.state { display: inline-flex; align-items: center; gap: 6px; }
.state::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.state.running::before { background: var(--ok); }
.state.exited::before, .state.dead::before { background: var(--bad); }
.state.restarting::before, .state.unhealthy::before { background: var(--warn); }
.stack { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: var(--panel2); }
.stack i { height: 100%; transition: width .5s; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.legend span::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; background: var(--c); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 8px; border-bottom: 1px solid rgba(36,48,73,.5); vertical-align: middle; white-space: nowrap; }
.tbl td.num { font-variant-numeric: tabular-nums; }
.tbl .membar { width: 110px; display: inline-block; vertical-align: middle; margin: 0 6px 0 0; }
.tbl .acts { display: flex; gap: 4px; justify-content: flex-end; }
.tbl tr:hover td { background: rgba(24,32,51,.5); }

/* logs */
.logbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.logbar input[type=search] { flex: 1; min-width: 160px; }
.logs { background: #070a10; border: 1px solid var(--line); border-radius: 10px; padding: 12px; height: calc(100vh - 230px); min-height: 360px; overflow: auto; margin: 0; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; }
.logs .ts { color: #56627d; }
.logs .e { color: #fca5a5; }
.logs .w { color: #fcd34d; }
.logs mark { background: rgba(250,204,21,.35); color: inherit; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--panel2); border: 1px solid var(--line); padding: 10px 14px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
@media (max-width: 600px) { main { padding: 12px; } .meta { flex-basis: 100%; order: 3; } }
