:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #14171c; --muted: #667085; --line: #e4e7ec;
  --accent: #1f5eff; --accent-ink: #fff; --ok: #12805c; --warn: #b54708; --bad: #c01048;
  --soft-ok: #e7f6ef; --soft-warn: #fef3e6; --soft-bad: #fdecf1; --soft-accent: #eaf0ff;
  --radius: 10px; --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: #0f1729; color: #c9d3e6; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.brand { color: #fff; font-weight: 700; font-size: 16px; margin: 0 8px 22px; }
.brand small { display: block; font-weight: 400; color: #8a97b1; font-size: 12px; }
.side a { display: flex; justify-content: space-between; color: #c9d3e6; padding: 8px 10px; border-radius: 8px; margin-bottom: 2px; }
.side a:hover { background: #1b2640; text-decoration: none; }
.side a.on { background: #24345a; color: #fff; }
.side .count { background: var(--accent); color: #fff; border-radius: 99px; padding: 0 7px; font-size: 12px; }
.side .foot { position: absolute; bottom: 18px; left: 24px; font-size: 12px; }
.side .foot a { display: inline; padding: 0; color: #8a97b1; }
main { padding: 28px 32px 60px; max-width: 1280px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; overflow-x: auto; }
td form { display: inline; }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12.5px; }
.kpi .d { color: var(--muted); font-size: 12px; margin-top: 2px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: #fafbfc; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: #eef1f5; color: #344054; white-space: nowrap; }
.b-ok { background: var(--soft-ok); color: var(--ok); }
.b-warn { background: var(--soft-warn); color: var(--warn); }
.b-bad { background: var(--soft-bad); color: var(--bad); }
.b-accent { background: var(--soft-accent); color: var(--accent); }
.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 12px; border-radius: 8px; font: inherit; cursor: pointer; }
.btn:hover { background: #f2f4f7; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(.95); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 3px 9px; font-size: 13px; }
input, select, textarea { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
textarea { width: 100%; min-height: 90px; resize: vertical; }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 10px 0 4px; }
.inline { display: inline; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pre { white-space: pre-wrap; font-family: inherit; margin: 0; }
.msg { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.msg.in { background: #f3faf6; border-color: #cfe9dc; }
.msg.out { background: #f7f9ff; }
.msg .meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.alert.warn { background: var(--soft-warn); color: var(--warn); }
.alert.ok { background: var(--soft-ok); color: var(--ok); }
.switch { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: #98a2b3; }
.dot.on { background: var(--ok); }
.dot.off { background: var(--bad); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; }
.tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.bar { height: 8px; background: #eef1f5; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.login { max-width: 360px; margin: 12vh auto; }
.center-page { max-width: 520px; margin: 14vh auto; text-align: center; }
@media (max-width: 1150px) {
  .g2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side .foot { position: static; margin-top: 10px; }
  main { padding: 18px 16px; }
  .g4, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  table { display: block; overflow-x: auto; }
}
