:root {
  --bg: #fafafa; --surface: #ffffff; --fg: #111113; --muted: #62626b; --line: #e3e3e8; --hover: #f3f3f6;
  --accent: #1f4fd8; --accent-fg: #ffffff; --accent-soft: #eaf0ff;
  --mono: ui-monospace, "SF Mono", Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0e; --surface: #131316; --fg: #ececef; --muted: #9b9ba5; --line: #26262c; --hover: #1a1a1f;
    --accent: #7ba3ff; --accent-fg: #0a1020; --accent-soft: #16203a;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0c0e; --surface: #131316; --fg: #ececef; --muted: #9b9ba5; --line: #26262c; --hover: #1a1a1f;
  --accent: #7ba3ff; --accent-fg: #0a1020; --accent-soft: #16203a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 22px; line-height: 1.25; }
h2 { font-size: 15px; letter-spacing: -0.01em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.form-top { margin-top: 24px; }
.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.bar { border-bottom: 1px solid var(--line); background: var(--surface); }
.bar-in { max-width: 960px; margin: 0 auto; padding: 0 20px; height: 48px; display: flex; align-items: center; gap: 20px; }
.brand { font-weight: 600; letter-spacing: -0.01em; color: var(--fg); text-decoration: none; margin-right: auto; }
.bar a:not(.brand) { color: var(--muted); text-decoration: none; font-size: 14px; }
.bar a:not(.brand):hover, .bar a[aria-current] { color: var(--fg); }

main { max-width: 960px; margin: 0 auto; padding: 32px 20px 64px; }
main.narrow, main.doc { max-width: 960px; }
main.narrow > *, main.doc > * { max-width: 680px; }
main.narrow > .foot { max-width: 680px; }
.lead { color: var(--muted); margin-top: 6px; max-width: 56ch; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }

label, .lab { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; }
input[type=text], input[type=search], input[type=password] {
  width: 100%; min-width: 0; height: 36px; padding: 0 12px; font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
input::placeholder { color: var(--muted); opacity: .7; }
input[aria-invalid="true"] { border-color: var(--fg); }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }
.field-err { display: flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 500; margin-top: 6px; }
.field-row { display: flex; gap: 8px; }
.stack { display: grid; gap: 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  font: inherit; font-weight: 500; color: var(--fg); background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; cursor: pointer; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--hover); }
.btn.primary { color: var(--accent-fg); background: var(--accent); border-color: var(--accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 16px; }

.status { display: flex; gap: 10px; align-items: flex-start; }
.status .icon { width: 18px; height: 18px; margin-top: 2px; }
.status strong { display: block; font-weight: 600; }
.status.ok .icon { color: var(--accent); }

.result { margin-top: 24px; }
.result .panel-body { display: grid; gap: 16px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.facts dd.mono { font-weight: 400; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.skel { display: grid; gap: 10px; }
.skel i { display: block; height: 14px; border-radius: 4px; background: var(--hover); animation: pulse 1.2s ease-in-out infinite; }
.skel i:nth-child(1) { width: 40%; } .skel i:nth-child(2) { width: 80%; } .skel i:nth-child(3) { width: 65%; }
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .skel i { animation: none; } }

.empty { padding: 32px 16px; text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.empty strong { color: var(--fg); font-weight: 600; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 24px 0 20px; }
.tab { height: 38px; padding: 0 12px; font: inherit; color: var(--muted); background: none; border: 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { color: var(--fg); font-weight: 500; border-bottom-color: var(--accent); }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-fg); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; }
.tabs .spacer { margin-left: auto; display: flex; gap: 4px; align-items: center; }

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.search { position: relative; flex: 1; max-width: 320px; }
.search .icon { position: absolute; left: 10px; top: 10px; color: var(--muted); }
.search input { padding-left: 32px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-weight: 500; font-size: 12px; color: var(--muted); text-transform: none; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl td.end, .tbl th.end { text-align: right; white-space: nowrap; }
.tbl td.id { font-family: var(--mono); white-space: nowrap; }
.tag { display: inline-block; padding: 0 6px; border: 1px solid var(--line); border-radius: 4px; font-size: 12px; color: var(--muted); }

.form-grid { display: grid; grid-template-columns: 140px 1fr auto; gap: 12px; align-items: start; }
.form-grid .btn { margin-top: 23px; }

dialog { max-width: 420px; width: calc(100% - 32px); padding: 20px; color: var(--fg); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog h2 { margin-bottom: 6px; }
dialog .actions { justify-content: flex-end; margin-top: 20px; }

.toast { position: fixed; right: 20px; bottom: 20px; max-width: 360px; display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; background: var(--fg); color: var(--bg); border-radius: 6px; font-size: 14px; }

.foot { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; display: grid; gap: 6px; max-width: 680px; }

.doc h1 { margin-bottom: 4px; }
input.mono { font-family: var(--mono); letter-spacing: .04em; }
.doc h2 { margin: 28px 0 8px; }
.doc ul { padding-left: 20px; margin: 8px 0; }
.doc li { margin: 4px 0; }
.doc p { margin: 8px 0; }

@media (max-width: 640px) {
  main { padding-top: 24px; }
  .field-row, .form-grid { grid-template-columns: 1fr; flex-direction: column; }
  .form-grid .btn { margin-top: 0; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 10px; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { padding: 10px 16px; border-bottom: 1px solid var(--line); }
  .tbl tbody tr:last-child { border-bottom: 0; }
  .tbl td { border: 0; padding: 2px 0; }
  .tbl td.end { text-align: left; padding-top: 8px; }
  .search { max-width: none; }
}
.narrow-box { max-width: 480px; }
.pending-note { margin-bottom: 12px; max-width: 70ch; }
.notice { margin-top: 16px; padding: 10px 14px; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 6px; font-size: 14px; display: grid; gap: 6px; }
.notice p { display: flex; gap: 8px; align-items: flex-start; }
.notice .icon { margin-top: 3px; color: var(--accent); }
