:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #16181d; --muted: #646b78; --line: #e3e6eb;
  --accent: #5b5bf0; --accent-ink: #ffffff; --ok: #138a52; --warn: #b26a00; --bad: #c62f2f;
  --ok-bg: #e5f5ec; --warn-bg: #fff3dc; --bad-bg: #fde8e8; --chip: #eef0f4;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --panel: #171a21; --text: #e8eaef; --muted: #9aa1ad; --line: #272b35;
    --accent: #8b8bff; --accent-ink: #0f1115; --ok: #4ad295; --warn: #f0b24a; --bad: #ff7a7a;
    --ok-bg: #12301f; --warn-bg: #33270f; --bad-bg: #3a1717; --chip: #222631; --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 0 0 .5rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
small, .muted { color: var(--muted); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
pre { background: var(--chip); padding: .75rem; border-radius: 8px; overflow: auto; white-space: pre-wrap; word-break: break-word; max-height: 480px; }

.top { position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--line); }
.top .in { max-width: 1180px; margin: 0 auto; padding: .6rem 16px; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.brand { font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.nav a { padding: .35rem .65rem; border-radius: 8px; color: var(--muted); font-weight: 500; white-space: nowrap; }
@media (max-width: 700px) {
  .top .in { gap: .4rem; }
  .brand { order: 1; flex: 1; }
  .top form { order: 2; }
  .nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: .2rem; }
}
.nav a.on, .nav a:hover { background: var(--chip); color: var(--text); text-decoration: none; }
.badge { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 999px; background: var(--bad); color: #fff; font-size: .75rem; font-weight: 700; text-align: center; }

main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 0; }
section { margin-top: 18px; }
.stat .v { font-size: 1.6rem; font-weight: 750; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: .82rem; }

.flash { padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--bad-bg); color: var(--bad); }

.pill { display: inline-block; padding: .05rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--chip); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }

.btn, button { appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: .5rem .9rem; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover, button:hover { border-color: var(--muted); text-decoration: none; }
.btn.primary, button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger, button.danger { color: var(--bad); border-color: var(--bad); }
.btn.sm, button.sm { padding: .25rem .6rem; font-size: .85rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline { display: inline; }

label { display: block; font-weight: 600; font-size: .88rem; margin: .7rem 0 .25rem; }
label .muted { font-weight: 400; }
input[type=text], input[type=password], input[type=number], input[type=time], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--text); font: inherit;
}
textarea { min-height: 90px; }
textarea.code { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; min-height: 420px; }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 500; margin: .5rem 0; }
.check input { width: 18px; height: 18px; }
.fields { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: .6rem; padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.checklist li:last-child { border-bottom: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: .45rem; flex: none; background: var(--bad); }
.dot.ok { background: var(--ok); }
.dot.opt { background: var(--line); border: 1px solid var(--muted); }

.qitem { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 16px; }
.qitem video { width: 100%; border-radius: 10px; background: #000; aspect-ratio: 9/16; }
.thumbs { display: flex; gap: 8px; margin-top: 8px; }
.thumbs a img { width: 100%; max-width: 160px; border-radius: 6px; border: 1px solid var(--line); }
@media (max-width: 700px) { .qitem { grid-template-columns: 1fr; } .qitem video { max-height: 70vh; } }

.chart { position: relative; height: 260px; }
.events { list-style: none; padding: 0; margin: 0; font-size: .86rem; }
.events li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.events li:last-child { border: 0; }
.lv-warn { color: var(--warn); } .lv-error { color: var(--bad); }
.secret { font-family: ui-monospace, Menlo, monospace; color: var(--muted); }
.center { max-width: 420px; margin: 8vh auto; }
details summary { cursor: pointer; font-weight: 600; }
td b { white-space: nowrap; }

.manual { margin-top: 1rem; padding: 12px; border: 1px dashed var(--line); border-radius: 10px; }
.claude-box { background: var(--chip); border-radius: 10px; padding: 12px; margin-top: .6rem; }
