@font-face { font-family: 'Inter Variable'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/fonts/inter-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter Variable'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/fonts/inter-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Space Grotesk Variable'; font-style: normal; font-display: swap; font-weight: 300 700; src: url(/fonts/space-grotesk-latin-wght-normal.woff2) format('woff2'); }

:root {
  --bg: #050912;
  --top: #0a1226;
  --ink: #e9effc;
  --muted: #8e9bb9;
  --line: rgba(160, 190, 255, 0.12);
  --line-strong: rgba(160, 190, 255, 0.24);
  --accent: #5ee0ff;
  --accent-rgb: 94, 224, 255;
  --accent-2: #4d8dff;
  --good: #6fe3a5;
  --warn: #ffc857;
  --bad: #ff8585;
  --side: #0a1a3c;
  --field: rgba(3, 10, 26, 0.55);
  --panel: rgba(13, 34, 76, 0.42);
  --display: 'Space Grotesk Variable', 'Inter Variable', sans-serif;
  --sans: 'Inter Variable', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; color: var(--ink); font: 400 14.5px/1.55 var(--sans); background: linear-gradient(180deg, var(--top) 0, var(--bg) 420px) no-repeat, var(--bg); min-height: 100vh; }
h1, h2, h3 { font-family: var(--display); margin: 0; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); font-weight: 700; letter-spacing: -0.03em; }
h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.8rem; }
h2.gap { margin-top: 1.4rem; }
p { margin: 0.3rem 0 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
small { font-size: 0.8rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn, .ghost { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.55rem 1.1rem; border-radius: 999px; font: 600 0.85rem var(--sans); border: 1px solid var(--line-strong); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background 0.15s, border-color 0.15s; }
.btn { background: var(--ink); border-color: var(--ink); color: #06122a; }
.btn:hover { background: var(--accent); border-color: var(--accent); }
.ghost { background: transparent; color: var(--ink); }
.ghost:hover { border-color: var(--accent); }
.small { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.big { padding: 0.8rem 1.6rem; font-size: 0.95rem; margin-top: 1.4rem; }
.danger { color: var(--bad); border-color: rgba(255, 133, 133, 0.45); }
button:disabled { opacity: 0.6; cursor: progress; }

.card { border-radius: 20px; border: 1px solid var(--line-strong); background: var(--panel); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 14px 40px rgba(0, 0, 10, 0.22); }
.pad { padding: 1.3rem 1.4rem; }

.brand { display: flex; align-items: center; gap: 0.55rem; padding: 4px 10px 20px; }
.brand .mark { flex: none; }
.brand b { font: 700 1.3rem/1 var(--display); letter-spacing: -0.03em; }
.brand small { margin-left: 0.2rem; padding-left: 0.8rem; border-left: 1px solid var(--line-strong); color: var(--muted); font: 500 0.85rem var(--display); }

.login-wrap { padding: 0 16px; }
.login { max-width: 28rem; margin: max(4rem, calc(50vh - 14rem)) auto 0; padding: 2.4rem 2rem; text-align: center; }
.login .brand { justify-content: center; padding-bottom: 1.2rem; }
.login h1 { margin-bottom: 0.5rem; }

.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0.75rem; display: flex; flex-direction: column; height: calc(100vh - 1.5rem); margin: 0.75rem 0 0.75rem 0.75rem; padding: 14px 12px; border: 1px solid var(--line-strong); border-radius: 24px; background: color-mix(in srgb, var(--side) 62%, transparent); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { padding: 0.55rem 0.9rem; border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 500; }
.nav a:hover { background: rgba(160, 190, 255, 0.08); }
.nav a[aria-current='page'] { background: rgba(var(--accent-rgb), 0.12); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.3); }
.side-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.85rem; overflow: hidden; }
.side-foot span { overflow: hidden; text-overflow: ellipsis; }

.main { padding: 2rem clamp(16px, 3vw, 2.5rem) 4rem; max-width: 1200px; width: 100%; }
.main > section { display: flex; flex-direction: column; gap: 1.1rem; }
.head.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.stat { padding: 1.1rem 1.3rem; display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.stat span { color: var(--muted); font-size: 0.8rem; font-weight: 500; }
.stat b { font: 700 1.8rem/1.2 var(--display); letter-spacing: -0.02em; }
.stat b.live { color: var(--good); }
.stat small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: stretch; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1.2rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.45rem; vertical-align: 1px; background: var(--muted); }
.dot.ok { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

.toplist { margin: 0; padding: 0; list-style: none; counter-reset: top; display: flex; flex-direction: column; gap: 0.55rem; }
.toplist li { counter-increment: top; display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; align-items: center; gap: 0.6rem; }
.toplist li::before { content: counter(top); color: var(--muted); font: 600 0.85rem var(--display); }
.toplist .bar { grid-column: 2 / 4; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: -0.25rem; }
.toplist .bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.toplist .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toplist .val { color: var(--muted); font-variant-numeric: tabular-nums; }

.note { padding: 0.8rem 1rem; border-radius: 14px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.03); margin: 0; }
.note.bad { border-color: rgba(255, 133, 133, 0.45); color: var(--bad); }
.note.warn { border-color: rgba(255, 200, 87, 0.45); color: var(--warn); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font: 600 12px var(--display); color: var(--muted); letter-spacing: 0.02em; padding: 0.85rem 1rem; border-bottom: 1px solid var(--line-strong); }
.table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .resp { max-width: 32rem; overflow-wrap: anywhere; color: var(--muted); }
.table .actions-cell { text-align: right; white-space: nowrap; }
.table.compact td, .table.compact th { padding: 0.5rem 0.6rem; }
.table code, .chips code { font-family: ui-monospace, monospace; font-size: 0.85em; color: var(--accent); }
.tag { display: inline-block; background: rgba(var(--accent-rgb), 0.12); color: var(--accent); border-radius: 999px; padding: 0 8px; font-size: 0.78rem; margin: 0.15rem 0.2rem 0 0; }
td > .tag:not(:first-child) { margin-left: 0.5rem; }
button.ghost:disabled { opacity: 0.35; cursor: default; }
.tag.off { background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.empty { padding: 1.4rem; margin: 0; text-align: center; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.7rem; }
.chips span { border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.25rem 0.75rem; font-size: 0.82rem; color: var(--muted); }

.list { display: flex; flex-direction: column; gap: 0.7rem; }
.item { display: flex; align-items: center; gap: 1rem; padding: 0.95rem 1.2rem; }
.item .grow { flex: 1; min-width: 0; }
.item .grow p { overflow-wrap: anywhere; color: var(--muted); }

.toolbar { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; }
.toolbar .input { flex: 1; min-width: 12rem; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); font: 500 0.82rem var(--sans); padding: 0.4rem 0.85rem; border-radius: 999px; cursor: pointer; }
.seg button[aria-pressed='true'] { background: var(--ink); color: #06122a; }
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; }

.form { display: flex; flex-direction: column; gap: 0.9rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field legend { font-size: 0.82rem; color: var(--muted); font-weight: 500; padding: 0; }
.input, .field input:not([type='checkbox']):not([type='file']), .field select, .field textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--field); color: var(--ink); font: inherit; padding: 0.62rem 0.9rem; }
.field input[type='file'] { color: var(--muted); font: inherit; }
.field textarea { resize: vertical; min-height: 5rem; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.15); }
.input.short, .field input.short:not([type='checkbox']):not([type='file']) { width: 6rem; flex: none; }
.stack { display: flex; flex-direction: column; gap: 1rem; max-width: 46rem; }
.inline { display: flex; gap: 0.7rem; align-items: flex-end; flex-wrap: wrap; }
.inline > .field { flex: 1; min-width: 9rem; }
.inline > .input { flex: 1; min-width: 10rem; }
.check { display: flex; align-items: center; gap: 0.55rem; cursor: pointer; }
.check input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem 1rem; margin-top: 0.3rem; }
.prefixed { display: flex; align-items: stretch; }
.prefixed i { font-style: normal; display: flex; align-items: center; padding: 0 0.8rem; border: 1px solid var(--line-strong); border-right: 0; border-radius: 14px 0 0 14px; color: var(--muted); background: var(--field); }
.prefixed input { border-radius: 0 14px 14px 0 !important; }
.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.4rem; }
ul.plain { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.4rem; color: var(--muted); }

.dialog { width: min(34rem, calc(100vw - 32px)); padding: 1.5rem; color: var(--ink); background: #0b1630; }
.dialog::backdrop { background: rgba(2, 6, 16, 0.7); }

.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: #10203f; border: 1px solid var(--line-strong); border-radius: 16px; padding: 0.7rem 1.2rem; box-shadow: 0 12px 40px rgba(0, 0, 8, 0.5); z-index: 10; max-width: calc(100vw - 32px); }
.toast.bad { color: var(--bad); }

@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .side { position: static; height: auto; margin: 0.75rem 16px 0; border-radius: 20px; }
  .brand { padding-bottom: 10px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a { white-space: nowrap; }
  .side-foot { margin-top: 10px; }
  .main { padding: 1.4rem 16px 3rem; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .table.resp-hide th:nth-child(n+4), .table.resp-hide td:nth-child(n+4) { display: none; }
  #cmd-table th:nth-child(3), #cmd-table td:nth-child(3), #cmd-table th:nth-child(4), #cmd-table td:nth-child(4), #cmd-table th:nth-child(5), #cmd-table td:nth-child(5) { display: none; }
  #v-table th:nth-child(5), #v-table td:nth-child(5), #v-table th:nth-child(6), #v-table td:nth-child(6) { display: none; }
  .table td, .table th { padding: 0.65rem 0.7rem; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .checks { grid-template-columns: minmax(0, 1fr); }
  .seg { overflow-x: auto; max-width: 100%; }
}
.grid2 > .form > .btn:last-child { margin-top: auto; }
.field input[type='file']::file-selector-button { margin-right: 0.8rem; padding: 0.45rem 1rem; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink); font: 600 0.82rem var(--sans); cursor: pointer; }
.field input[type='file']::file-selector-button:hover { border-color: var(--accent); }
