:root {
  --bg: #fbfbfa; --fg: #1c1c1a; --muted: #6b6b66;
  --line: #e2e1dc; --panel: #fff;
  --accent: #1a6d4a; --danger: #b3261e; --danger-bg: #fdf0ef;
}
* { box-sizing: border-box; }
/* display を持つクラスより hidden 属性を優先させる */
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.6 -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
}
header {
  display: flex; align-items: baseline; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--panel);
}
header h1 { font-size: 17px; margin: 0; letter-spacing: .02em; }
header .sub { font-size: 12px; color: var(--muted); }
header .spacer { flex: 1; }
main { padding: 20px; max-width: 1200px; margin: 0 auto; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px; margin-bottom: 18px;
}
.start { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.start .qr { width: 190px; height: 190px; flex: none; }
.start .qr svg { width: 100%; height: 100%; display: block; }
.start .how { flex: 1; min-width: 260px; }
.start ol { margin: 0 0 10px; padding-left: 1.3em; }
.start ol li + li { margin-top: 6px; }
/* 手順の中の補足。ぶら下げないと本文と同じ大きさで行内に続いてしまう。 */
.start ol .sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.code { font: 600 26px/1.2 ui-monospace, monospace; letter-spacing: .18em; }

button {
  font: inherit; padding: 7px 13px; border: 1px solid var(--line);
  background: var(--panel); border-radius: 7px; cursor: pointer;
}
button:hover { border-color: #c9c8c2; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }

.bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.bar .group { display: flex; gap: 6px; align-items: center; }
.bar .label { font-size: 12px; color: var(--muted); margin-right: 2px; }
.bar select, .bar input {
  font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line);
  background: var(--panel); border-radius: 7px;
}
.bar input { width: 11ch; }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { border-bottom: 1px solid var(--line); padding: 7px 9px; text-align: left; white-space: nowrap; }
th { background: #f4f3f0; font-weight: 600; font-size: 13px; cursor: grab; user-select: none; }
th.drag { opacity: .4; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td[contenteditable]:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: #fff; }
tr.ng { background: var(--danger-bg); }
.thumb { width: 44px; height: 32px; object-fit: cover; border-radius: 3px; border: 1px solid var(--line); cursor: zoom-in; }
.badge { font-size: 11px; padding: 2px 6px; border-radius: 4px; }
.badge.ok { background: #e7f3ec; color: var(--accent); }
.badge.ng { background: #fbe3e1; color: var(--danger); }
/* 照合していない。緑にも赤にも寄せない ── 判断していないことが伝わる色にする。 */
.badge.pending { background: #eee; color: var(--muted); }
.issues { font-size: 12px; color: var(--danger); white-space: normal; }
.cellcopy { visibility: hidden; margin-left: 6px; font-size: 11px; padding: 1px 5px; }
td:hover .cellcopy { visibility: visible; }

.scope { margin: 0 0 10px; font-size: 12px; color: var(--muted); }

/* 合言葉。数字の6桁コードと見分けが付くよう、太く大きめに出す。 */
.word { font-size: 15px; letter-spacing: .04em; color: var(--fg); }
.word-line { margin: 8px 0 10px; }
.panel.linked { display: flex; align-items: center; gap: 14px; }
.panel.linked > div { flex: 1; }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
footer { padding: 22px 20px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); margin-top: 28px; }
footer p { margin: 4px 0; }
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #1c1c1a; color: #fff; padding: 9px 16px; border-radius: 8px;
  font-size: 14px; opacity: 0; transition: opacity .18s; pointer-events: none;
}
#toast.on { opacity: 1; }
dialog { border: none; border-radius: 10px; padding: 0; max-width: 92vw; }
dialog img { max-width: 88vw; max-height: 84vh; display: block; }

/* 規約ページ（/terms・/privacy）。読ませる文章なので、表の画面より幅を狭くする。 */
.legal { max-width: 720px; }
.legal h2 { font-size: 15px; margin: 26px 0 8px; }
.legal h2:first-of-type { margin-top: 6px; }
.legal p, .legal li { font-size: 13px; line-height: 1.85; margin: 6px 0; }
.legal ul { padding-left: 1.2em; }
.legal dt { font-size: 13px; font-weight: 600; margin-top: 12px; }
.legal dd { font-size: 13px; line-height: 1.85; margin: 4px 0 0 0; color: var(--muted); }
.legal .updated { color: var(--muted); font-size: 12px; }
.legal a { color: var(--accent); }

/* 6桁コードは押した人にだけ出す（→ public/app.js の askCode）。 */
.fallback { margin-top: 14px; }
.link {
  background: none; border: none; padding: 0;
  color: var(--muted); font-size: 12px; text-decoration: underline; cursor: pointer;
}
.link:hover { color: var(--accent); }
.codebox { margin-top: 8px; }
