:root {
  --bg: #0b0c10;
  --bg-elev: #12141a;
  --bg-elev-2: #171a21;
  --bg-hover: #1c2028;
  --line: #262a33;
  --line-soft: #1c1f26;
  --text: #eceef2;
  --text-dim: #9aa1ad;
  --text-faint: #6a717c;
  --accent: #e8eaee;
  --accent-dim: rgba(255, 255, 255, 0.08);
  --accent-line: rgba(255, 255, 255, 0.16);
  --gray-line: #9aa3b2;
  --ok: #7dcea0;
  --warn: #d4b56a;
  --bad: #d98989;
  --bad-dim: rgba(217, 137, 137, 0.12);
  --r: 6px;
  --r-lg: 8px;
  --font: Onest, ui-sans-serif, system-ui, "Segoe UI", sans-serif;
}

@font-face { font-family: Onest; src: url("/static/fonts/onest-latin-500.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Onest; src: url("/static/fonts/onest-latin-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Onest; src: url("/static/fonts/onest-latin-700.woff2") format("woff2"); font-weight: 650; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Onest; src: url("/static/fonts/onest-latin-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Onest; src: url("/static/fonts/onest-cyrillic-500.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0471, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Onest; src: url("/static/fonts/onest-cyrillic-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0471, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Onest; src: url("/static/fonts/onest-cyrillic-700.woff2") format("woff2"); font-weight: 650; font-style: normal; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0471, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Onest; src: url("/static/fonts/onest-cyrillic-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0471, U+0490-0491, U+04B0-04B1, U+2116; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.45;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; color: inherit; }
a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 360px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px 24px 24px;
}
.logo {
  display: block;
  height: 32px;
  width: auto;
  max-width: 180px;
}
.logo-lg { height: 42px; max-width: 221px; margin-bottom: 18px; }
.login-card p { margin: 0 0 20px; color: var(--text-dim); font-size: 13px; }
.login-card label { display: block; color: var(--text-faint); font-size: 12px; margin-bottom: 8px; }
.err { color: var(--bad); font-size: 12.5px; min-height: 18px; margin-top: 8px; }

.app { min-height: 100%; display: grid; grid-template-columns: 228px 1fr; }
.side {
  border-right: 1px solid var(--line-soft);
  padding: 20px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 4px 8px 18px; }
.brand span { display: block; color: var(--text-faint); font-size: 11.5px; }
.nav-btn svg {
  width: 16px; height: 16px; margin-right: 10px; flex: 0 0 16px;
  fill: currentColor; opacity: .72;
}
.nav-btn.active svg { opacity: 1; }
.nav-btn, .nav-link {
  display: flex; align-items: center;
  width: 100%; height: 38px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  text-align: left;
  padding: 0 12px;
  border-radius: var(--r);
  cursor: pointer;
  font-size: 13.5px; font-weight: 500;
}
.nav-btn:hover, .nav-link:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav-btn.active { background: var(--accent-dim); color: var(--text); border-color: var(--accent-line); }
.nav-link { color: var(--text-faint); margin-top: 8px; }
.side-foot { margin-top: auto; padding: 12px 8px 4px; color: var(--text-faint); font-size: 11.5px; border-top: 1px solid var(--line-soft); }
.main { padding: 24px 28px 36px; min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.top h2 { margin: 0; font-size: 17px; font-weight: 650; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.inp {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0 12px;
  height: 38px;
  outline: none;
  font-size: 13.5px;
}
.inp:focus { border-color: var(--accent-line); }
.inp.search { width: 240px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 38px; padding: 0 14px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  color: var(--text);
  cursor: pointer;
  font-size: 13.5px; font-weight: 550;
}
.btn:hover { background: var(--bg-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #111214; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: rgba(217,137,137,.3); background: transparent; }
.btn.danger:hover { background: var(--bad-dim); }
.btn.wide { width: 100%; margin-top: 14px; height: 42px; }
.btn.tiny { height: 32px; padding: 0 10px; font-size: 12.5px; }

.cards { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 10px; }
.cards.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 16px;
}
.card .k { color: var(--text-dim); font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.card .v { margin-top: 6px; font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.card .v.sm { font-size: 16px; }
.card .s { margin-top: 4px; color: var(--text-faint); font-size: 12px; }
.spark { width: 100%; height: 36px; display: block; margin-top: 10px; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 99px; background: var(--text-faint); margin-right: 6px; }
.dot.on { background: var(--ok); }
.dot.off { background: var(--bad); }

.charts { display: grid; grid-template-columns: 1.45fr 1fr; gap: 10px; margin-bottom: 10px; }
.chart-box { min-height: 260px; position: relative; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.chart-head h3, .table-wrap h3, .card > h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--text-dim); }
.chart-head h3 { margin: 0; }
.legend { font-size: 12px; color: var(--text-dim); }
canvas { width: 100%; display: block; }
#c-net, #c-conn { height: 200px; }
.chart-foot { margin-top: 10px; color: var(--text-faint); font-size: 12px; display: flex; gap: 16px; flex-wrap: wrap; }

.tip {
  position: absolute; z-index: 5; pointer-events: none;
  min-width: 168px;
  background: #171a21;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 8px 10px;
  font-size: 12px;
  box-shadow: 0 10px 28px rgba(0,0,0,.4);
}
.tip .t { color: var(--text-faint); font-size: 11px; margin-bottom: 6px; }
.tip .row { display: flex; justify-content: space-between; gap: 16px; margin: 3px 0; }
.tip b { font-weight: 600; font-variant-numeric: tabular-nums; }
.tip .who { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line-soft); color: var(--text-dim); }
.sw { display: inline-block; width: 7px; height: 7px; border-radius: 99px; margin-right: 6px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line-soft); font-size: 13px; white-space: nowrap; }
th { color: var(--text-faint); font-weight: 550; font-size: 11.5px; }
tbody tr:hover { background: var(--bg-hover); }
td.num, th.num { font-variant-numeric: tabular-nums; }
.bar { height: 4px; background: #1c222b; border-radius: 99px; overflow: hidden; width: 88px; display: inline-block; vertical-align: middle; margin-right: 8px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar.warn > i { background: var(--warn); }
.bar.bad > i { background: var(--bad); }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 4px; background: var(--bg-elev-2); border: 1px solid var(--line); color: var(--text-dim); font-size: 11.5px; }
.pill.ok { color: var(--ok); border-color: rgba(125,206,160,.25); }
.pill.bad { color: var(--bad); border-color: rgba(217,137,137,.25); }
.actions { display: flex; gap: 6px; }
.section-note { color: var(--text-faint); font-size: 12.5px; margin: -4px 0 12px; }
.issue-list { display: grid; gap: 8px; }
.issue {
  display: grid; grid-template-columns: 8px minmax(140px, .7fr) minmax(180px, 1fr) auto;
  align-items: center; gap: 12px; padding: 13px 15px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.issue-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.issue.bad .issue-dot { background: var(--bad); }
.issue-title { font-weight: 650; }
.issue-detail { color: var(--text-dim); }
.issue-user { color: var(--text-faint); text-align: right; }
.issue-empty { padding: 28px; text-align: center; color: var(--text-dim); }
.event-badge { display: inline-flex; min-width: 64px; justify-content: center; }
.event-text.bad { color: var(--bad); }
.event-text.warn { color: var(--warn); }

.modal { position: fixed; inset: 0; background: rgba(6,7,10,.62); display: grid; place-items: center; z-index: 20; padding: 16px; }
.sheet { width: 480px; max-width: 100%; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.sheet h3 { margin: 0 0 16px; font-size: 16px; font-weight: 650; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field span { color: var(--text-faint); font-size: 12px; }
.field .inp { width: 100%; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.logs { margin: 0; max-height: 420px; overflow: auto; font-size: 12px; line-height: 1.5; color: var(--text-dim); white-space: pre-wrap; font-family: ui-monospace, "Cascadia Mono", monospace; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; z-index: 40; font-size: 13px; }

@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .cards, .cards.three, .charts { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .issue { grid-template-columns: 8px 1fr; }
  .issue-detail, .issue-user { grid-column: 2; text-align: left; }
}
