:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --ink: #17181a;
  --muted: #666a70;
  --line: #e2e2de;
  --accent: #1d4ed8;
  --accent-ink: #ffffff;
  --good-bg: #e7f5ec; --good: #17663a;
  --bad-bg: #fde8e8; --bad: #a51d1d;
  --soft: #efefec;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214;
    --card: #1a1b1e;
    --ink: #ececec;
    --muted: #9a9ea5;
    --line: #2c2e33;
    --accent: #6d9bff;
    --accent-ink: #0b1020;
    --good-bg: #12301f; --good: #7fd6a2;
    --bad-bg: #3a1616; --bad: #ff9a9a;
    --soft: #23252a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; }
.muted, .hint, .note { color: var(--muted); }
.hint { font-size: 12px; margin: 4px 0 12px; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--card);
}
.brand { display: flex; align-items: center; gap: 12px; }
.mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px;
  background: var(--ink); color: var(--bg); font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.brand-name { font-weight: 650; font-size: 15px; }
.brand-sub, .who { color: var(--muted); font-size: 12px; }

main { max-width: 1280px; margin: 0 auto; padding: 20px 16px 48px; }

.gate { max-width: 460px; margin: 12vh auto 0; text-align: center; }
.gate h1 { font-size: 22px; margin: 0 0 8px; }
.gate p { color: var(--muted); margin: 0 0 20px; overflow-wrap: anywhere; }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.bar .note { margin: 0; }
.bar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 7px 12px; border-radius: 8px; font: inherit; font-weight: 550; cursor: pointer;
  text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, .seg button:focus-visible, .link:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }
.link:hover { color: var(--ink); }

.notice, .error {
  display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
  border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 12px; margin-bottom: 16px;
}
.error { border-color: var(--bad); color: var(--bad); }
/* The class's display would otherwise beat the hidden attribute. */
[hidden] { display: none !important; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 720px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.tile-label { color: var(--muted); font-size: 12px; }
.tile-value { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
input {
  font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%;
}
#search { max-width: 320px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button {
  appearance: none; font: inherit; cursor: pointer; padding: 6px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
.seg button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.empty { border: 1px solid var(--line); border-radius: 10px; padding: 32px; text-align: center; color: var(--muted); background: var(--card); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
table { width: 100%; min-width: 1040px; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 550; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--soft); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.sub { color: var(--muted); font-size: 12px; margin-top: 3px; overflow-wrap: anywhere; }
.name { font-weight: 600; }
.warn { color: var(--bad); }
.cell-actions { display: flex; flex-direction: column; gap: 6px; }
.cell-actions .btn { padding: 5px 10px; font-size: 13px; white-space: nowrap; }

.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

dialog {
  border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink);
  padding: 22px; width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto;
}
dialog::backdrop { background: rgba(0, 0, 0, .5); }
dialog h2 { margin: 0 0 6px; font-size: 18px; overflow-wrap: anywhere; }
dialog p.muted { margin: 0 0 16px; }
dialog label { display: block; font-weight: 550; margin: 12px 0 5px; }
dialog label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin-top: 16px; }
dialog label.check input { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .two { grid-template-columns: 1fr; } }
.row { display: flex; gap: 8px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.form-error { color: var(--bad); margin: 12px 0 0; }
.secret { border: 1px solid var(--line); background: var(--soft); border-radius: 8px; padding: 12px; overflow-wrap: anywhere; user-select: all; }
