:root {
  --blue: #1e3a8a; --blue-2: #2748a8; --blue-soft: #e8edfa; --saffron: #f4a62a; --saffron-soft: #fff3df;
  --ink: #111827; --muted: #5b6475; --line: #e1e6ef; --bg: #f4f6fb; --card: #fff;
  --ok: #166534; --ok-bg: #e7f6ec; --bad: #9f1239; --bad-bg: #fdecef; --wait: #7c4a03; --wait-bg: #fff3df;
  --grey-bg: #eef1f6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --blue-soft: #1d2747; --saffron-soft: #3a2a10; --ink: #e8ebf3; --muted: #a3acc0; --line: #2a3350;
    --bg: #0e1323; --card: #161d33; --ok: #86efac; --ok-bg: #12301f; --bad: #fda4af; --bad-bg: #3a1621;
    --wait: #fcd34d; --wait-bg: #3a2a10; --grey-bg: #222b45;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; }
[hidden] { display: none !important; }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--grey-bg); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
.top { background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; gap: 10px; align-items: center; }
.mark { background: var(--saffron); color: #1e3a8a; font-weight: 800; border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.name { font-weight: 700; }
.tag { font-size: 12px; opacity: .85; }
.right { display: flex; gap: 8px; align-items: center; }
.top .btn.ghost { color: #fff; border-color: rgba(255,255,255,.4); }
.badge { background: rgba(255,255,255,.14); border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.strip { height: 4px; background: var(--saffron); }
.tabs { display: flex; gap: 2px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 12px 14px; font: inherit;
  color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--ink); font-weight: 700; border-bottom-color: var(--saffron); }
main { max-width: 1180px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.card h2 { font-size: 16px; margin: 0 0 10px; }
.narrow { max-width: 380px; margin: 48px auto; }
.login h1 { margin-top: 0; font-size: 22px; }
label { display: block; font-weight: 600; margin: 10px 0 4px; font-size: 14px; }
label > span { display: block; margin-bottom: 4px; }
a { color: var(--blue-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) a { color: #9db4ff; } }
input, select, textarea { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink); }
textarea { resize: vertical; }
input[type="checkbox"] { width: auto; }
.btn { font: inherit; border-radius: 8px; padding: 8px 14px; cursor: pointer; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-weight: 600; }
.btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.saf { background: var(--saffron); color: #1e2a4a; border-color: var(--saffron); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tile .n { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--muted); font-size: 13px; }
.tile.hl { border-left: 5px solid var(--saffron); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; background: var(--grey-bg); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.wait { background: var(--wait-bg); color: var(--wait); }
.chip.blue { background: var(--blue-soft); color: var(--ink); }
.filter { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 4px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.filter.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.table-wrap { overflow-x: auto; }
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; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--blue-soft); }
.mini { font-size: 12px; color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.error { background: var(--bad-bg); color: var(--bad); padding: 8px 10px; border-radius: 8px; font-weight: 600; }
.notice { background: var(--saffron-soft); border-left: 4px solid var(--saffron); padding: 10px 12px; border-radius: 8px; margin-bottom: 16px; }
.secret { background: var(--grey-bg); border-radius: 8px; padding: 10px; margin: 6px 0 12px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0 6px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--saffron); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.bubble { background: var(--grey-bg); border-radius: 10px; padding: 8px 10px; margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.in { background: var(--blue-soft); }
.modal-back { position: fixed; inset: 0; background: rgba(10, 15, 30, .55); display: flex; align-items: flex-start;
  justify-content: center; padding: 24px 12px; overflow-y: auto; z-index: 10; }
.modal { background: var(--card); border-radius: 14px; width: min(760px, 100%); border: 1px solid var(--line); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); gap: 10px; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 16px; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--card);
  padding: 10px 16px; border-radius: 10px; z-index: 20; max-width: calc(100% - 32px); }
.count { font-size: 12px; color: var(--muted); margin-top: 4px; }
.count.warn { color: var(--bad); font-weight: 700; }
@media (max-width: 640px) {
  main { padding: 12px; }
  th:nth-child(4), td:nth-child(4) { display: none; }
}
