:root {
  --bg: #f4f5f7; --panel: #fff; --line: #e1e3e8; --text: #15171b; --mute: #646a76;
  --accent: #3b62d6; --accent-ink: #fff; --good: #1f8a5c; --warn: #9a6a00; --bad: #c62a40; --soft: #eef2fd;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e0f12; --panel: #17191e; --line: #2a2d35; --text: #eceef2; --mute: #9298a4; --accent: #7aa2ff; --accent-ink: #0b1020; --good: #5ad19a; --warn: #ffcc5c; --bad: #ff6b7a; --soft: #1c2336; }
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; color: var(--text); background: var(--bg); font: 15px/1.6 system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; margin: 0; }
.note { color: var(--mute); font-size: 13px; }
.err { color: var(--bad); font-size: 14px; min-height: 1.4em; margin: 0; }

.gate { width: min(380px, 100%); display: grid; gap: 14px; }
.gate h1 { margin: 0; font-size: 20px; }
.gate p { margin: 0; }
.qr { background: #fff; padding: 12px; border-radius: 12px; justify-self: center; line-height: 0; }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; user-select: all; }

.btn { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.small { padding: 4px 10px; min-height: 32px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--bad); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-size: 14px; }

input[type=text], input[type=email], input[type=tel], input[type=url], input[type=date], input[type=month], input[type=password], input[inputmode=numeric], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); min-height: 42px;
}
textarea { min-height: 96px; resize: vertical; }
.code { font-size: 24px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }

.shell { max-width: 1080px; margin: 0 auto; padding: 0 16px 48px; }
.bar { position: sticky; top: 0; z-index: 2; background: var(--bg); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 12px 0; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.bar b { font-size: 16px; margin-right: auto; }
.bar nav { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.bar nav a { text-decoration: none; color: var(--mute); padding: 4px 0; }
.bar nav a[aria-current=page] { color: var(--text); font-weight: 600; border-bottom: 2px solid var(--accent); }

h2 { font-size: 17px; margin: 24px 0 10px; }
h3 { font-size: 15px; margin: 0; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 24px 0 10px; }
.head h2 { margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kpi b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--mute); font-size: 12px; }

.list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.item { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.item .grow { flex: 1 1 200px; min-width: 0; }
.item a.grow { color: inherit; text-decoration: none; }
.item a.grow:hover b { text-decoration: underline; }
.item .sub { color: var(--mute); font-size: 13px; display: block; overflow-wrap: anywhere; }
.date { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--mute); min-width: 90px; }
.late { color: var(--bad); font-weight: 600; }
.empty { color: var(--mute); font-size: 14px; padding: 8px 0; }

.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--text); white-space: nowrap; }
.badge.end { opacity: .6; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
dl.fields { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px 16px; margin: 0; }
dl.fields dt { color: var(--mute); font-size: 13px; }
dl.fields dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
@media (max-width: 520px) { dl.fields { grid-template-columns: 1fr; } dl.fields dd { margin-bottom: 6px; } }

.steps { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 12px; }
.steps li { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--mute); }
.steps li.now { border-color: var(--accent); color: var(--text); font-weight: 600; background: var(--soft); }
.steps li.done { color: var(--text); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.filters input, .filters select { width: auto; flex: 1 1 160px; }

dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); padding: 0; width: min(560px, calc(100% - 24px)); max-height: calc(100% - 24px); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog form { display: grid; gap: 12px; padding: 18px; }
dialog h3 { font-size: 17px; }
.field { display: grid; gap: 4px; }
.field > span { font-size: 13px; color: var(--mute); }
.check { display: flex; gap: 8px; align-items: center; min-height: 32px; }
.check input { width: 20px; height: 20px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 10; max-width: calc(100% - 32px); }
table.audit { width: 100%; border-collapse: collapse; font-size: 13px; }
table.audit td { border-top: 1px solid var(--line); padding: 6px 4px; vertical-align: top; }
.mt { margin-top: 12px; }
