:root {
  --bg: #f6f7f9; --panel: #fff; --text: #1d2330; --muted: #6b7385; --line: #e3e6ec;
  --accent: #1f6feb; --accent-soft: #e8f0fe; --ok: #1a7f37; --ok-soft: #e6f4ea;
  --warn: #9a6700; --warn-soft: #fff4d6; --bad: #c62828; --bad-soft: #fdecea;
  --radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; color: var(--text);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b; --panel: #1b1f27; --text: #e6e9ef; --muted: #98a0b0; --line: #2c323d;
    --accent: #5b9cff; --accent-soft: #1d2a42; --ok: #4cc26b; --ok-soft: #173023;
    --warn: #e0b341; --warn-soft: #33290f; --bad: #ff6b6b; --bad-soft: #3a1d1d;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header {
  display: flex; align-items: center; gap: 16px; padding: 8px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
  flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 16px; }
nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
nav a { padding: 6px 10px; border-radius: 6px; color: var(--text); }
nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
nav a:hover { text-decoration: none; background: var(--bg); }
.who { color: var(--muted); font-size: 13px; white-space: nowrap; }
main { padding: 16px; max-width: 1300px; margin: 0 auto; }
h1 { font-size: 20px; margin: 4px 0 14px; }
h2 { font-size: 16px; margin: 18px 0 8px; }
h3 { font-size: 14px; margin: 12px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card h3 { margin-top: 0; }
.big { font-size: 28px; font-weight: 700; }
.stat { display: flex; gap: 18px; }
.stat div span { display: block; font-size: 12px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--bg); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--accent-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
input, select, textarea, button {
  font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 9px;
}
textarea { width: 100%; min-height: 120px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=number] { width: 90px; }
button { cursor: pointer; background: var(--bg); }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.danger { color: var(--bad); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
button:disabled { opacity: .5; cursor: not-allowed; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label.inline { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 14px; }
.form { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.form .wide { grid-column: 1 / -1; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pos { color: var(--ok); } .neg { color: var(--bad); }
.note { background: var(--warn-soft); color: var(--warn); padding: 8px 12px; border-radius: 6px; margin: 8px 0; }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 20; overflow-y: auto; }
.modal-box { background: var(--panel); border-radius: 10px; padding: 18px; width: min(720px, 100%); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 30; max-width: 90vw; }
.toast.err { background: var(--bad); color: #fff; }
.login { max-width: 380px; margin: 60px auto; }
.login .card { display: grid; gap: 12px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
@media (max-width: 700px) {
  main { padding: 10px; }
  header { gap: 8px; }
  nav a { padding: 5px 7px; }
}
