/* 受付システム共通スタイル（スマホ縦・立ったまま片手操作が前提） */
:root {
  --bg: #111418;
  --panel: #1c2128;
  --text: #f2f4f7;
  --muted: #9aa4b2;
  --line: #2d3540;
  --primary: #1a73e8;
  --green: #12a150;
  --yellow: #f5c518;
  --red: #d93025;
  --orange: #ff8a00;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif; }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; }
h1 { font-size: 22px; margin: 8px 0 16px; }
h2 { font-size: 20px; margin: 0 0 12px; }
label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 14px; }
.page { padding: 20px 16px 40px; max-width: 560px; margin: 0 auto; }
.note { color: var(--muted); font-size: 14px; }
.err { color: #ff7b72; min-height: 1.2em; font-weight: 600; }
.row { display: flex; gap: 10px; margin-top: 14px; }
.row > * { flex: 1; }

.inp { width: 100%; font-size: 18px; padding: 14px; border-radius: 12px; border: 1px solid var(--line);
  background: #0b0e11; color: var(--text); }
textarea.inp { resize: vertical; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 12px 14px;
  font-size: 16px; font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: .45; }
.btn.big { width: 100%; padding: 18px; font-size: 19px; margin-top: 12px; }
.btn.huge { width: 100%; padding: 28px; font-size: 28px; margin-top: 20px; border-radius: 20px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.small { padding: 8px 12px; font-size: 14px; }

.lane-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.lane-btn { font-size: 30px; padding: 16px 0; }
.lane-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; }

.progress { height: 12px; background: var(--line); border-radius: 8px; overflow: hidden; }
.progress .fill { height: 100%; width: 0; background: var(--green); transition: width .3s; }
.big-text { font-size: 22px; font-weight: 700; }
.ready-box { text-align: center; background: #0f2a1b; border: 2px solid var(--green); border-radius: 20px; padding: 24px 12px; margin: 20px 0 12px; }
.ready-box .check { font-size: 56px; color: var(--green); line-height: 1; }
.test-banner { background: var(--orange); color: #000; font-weight: 800; text-align: center; padding: 10px; border-radius: 10px; }

/* メイン画面 */
.main { position: fixed; inset: 0; display: flex; flex-direction: column; }
.status { display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 6px) 10px 6px;
  background: #000; font-size: 13px; white-space: nowrap; overflow: hidden; }
.lane-badge { background: var(--primary); border: 0; color: #fff; border-radius: 10px; padding: 6px 10px; font-weight: 800; font-size: 16px; }
.test-badge { background: var(--orange); color: #000; font-weight: 800; border-radius: 8px; padding: 4px 8px; }
.pending, .sync { color: var(--muted); }
.pending.warn { color: #000; background: var(--yellow); border-radius: 6px; padding: 2px 6px; font-weight: 700; }
.sync.warn { color: #ff7b72; }
.dot { width: 12px; height: 12px; border-radius: 50%; margin-left: auto; flex: none; }
.dot.on { background: var(--green); }
.dot.off { background: var(--red); box-shadow: 0 0 0 3px rgba(217, 48, 37, .35); }
body.is-test .main { box-shadow: inset 0 0 0 6px var(--orange); }

.cam { position: relative; flex: 1; background: #000; overflow: hidden; }
.cam video { width: 100%; height: 100%; object-fit: cover; }
.cam video.mirror { transform: scaleX(-1); }
.cam .frame { position: absolute; left: 50%; top: 50%; width: 62vmin; height: 62vmin; transform: translate(-50%, -50%);
  border: 4px solid rgba(255, 255, 255, .85); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .25); pointer-events: none; }
.cam-msg { display: none; position: absolute; inset: 0; background: rgba(0, 0, 0, .85); padding: 24px; text-align: center; overflow: auto; }
.cam-msg.show { display: block; }
.cam-msg strong { display: block; font-size: 20px; margin: 20px 0 10px; color: var(--yellow); }
.counter { text-align: center; padding: 6px; background: #000; color: var(--muted); font-size: 14px; }
.foot-bar { display: flex; gap: 8px; padding: 8px 8px calc(env(safe-area-inset-bottom) + 8px); background: #000; }
.btn.foot { flex: 1; padding: 14px 4px; font-size: 15px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 72px; }
.btn.foot .ic { font-size: 24px; }

/* 結果（画面全体の色） */
.result { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px; gap: 10px; animation: pop .12s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: .6; } to { transform: none; opacity: 1; } }
.result.green { background: var(--green); color: #fff; }
.result.yellow { background: var(--yellow); color: #111; }
.result.red { background: var(--red); color: #fff; }
.result .avatar { border: 5px solid rgba(255, 255, 255, .9); }
.r-name { font-size: 34px; font-weight: 900; line-height: 1.2; word-break: break-all; }
.r-welcome { font-size: 28px; font-weight: 800; }
.r-meta { font-size: 18px; opacity: .9; }
.r-title { font-size: 34px; font-weight: 900; }
.r-sub { font-size: 21px; font-weight: 700; }
.r-foot { margin-top: 16px; font-size: 22px; font-weight: 900; background: rgba(0, 0, 0, .8); color: #fff; padding: 12px 18px; border-radius: 14px; }
.result .btn.big { max-width: 420px; }
.result.yellow .btn { color: #111; background: #fff; }
.result.yellow .btn.primary { background: #111; color: #fff; }

/* アイコン */
.avatar { border-radius: 50%; overflow: hidden; flex: none; background: #333; display: flex; align-items: center; justify-content: center; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar .initial { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; }

/* 名前検索（下から出るシート） */
.sheet { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; }
.sheet-head { display: flex; gap: 8px; padding: calc(env(safe-area-inset-top) + 10px) 10px 10px; border-bottom: 1px solid var(--line); }
.sheet-head .inp { flex: 1; }
.results { flex: 1; overflow: auto; padding: 6px 10px 40px; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); cursor: pointer; }
.person:active { background: var(--panel); }
.p-text { flex: 1; min-width: 0; }
.p-name { font-size: 18px; font-weight: 700; word-break: break-all; }
.p-meta { font-size: 13px; color: var(--muted); }
.tag { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.tag.yellow { background: var(--yellow); color: #111; }
.tag.gray { background: #555; color: #fff; }
.tag.green { background: var(--green); color: #fff; }
.tag.red { background: var(--red); color: #fff; }

/* ダイアログ */
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--panel); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 22px 16px calc(env(safe-area-inset-bottom) + 18px); max-height: 92vh; overflow: auto; }
.modal p { font-size: 17px; }
.modal-btns { display: flex; gap: 10px; }
.modal-btns .btn { flex: 1; }
.confirm-person { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 8px 0 12px; }
.chk { display: flex; align-items: center; gap: 10px; font-size: 18px; color: var(--text); margin: 14px 0; }
.chk input { width: 26px; height: 26px; }
.form .inp { margin-bottom: 10px; }
.toast { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); z-index: 70; background: #000; color: #fff;
  border: 1px solid var(--line); padding: 12px 18px; border-radius: 12px; font-weight: 700; max-width: 90vw; text-align: center; }

/* ダッシュボード・管理 */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 12px 0; }
.card h2 { font-size: 17px; color: var(--muted); }
.kpi { font-size: 44px; font-weight: 900; line-height: 1.1; }
.kpi small { font-size: 18px; color: var(--muted); font-weight: 600; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 90px; }
.bars .bar { flex: 1; background: var(--primary); border-radius: 6px 6px 0 0; position: relative; min-height: 2px; }
.bars .bar span { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: 12px; }
.bar-labels { display: flex; gap: 6px; font-size: 11px; color: var(--muted); }
.bar-labels span { flex: 1; text-align: center; }
table.t { width: 100%; border-collapse: collapse; font-size: 15px; }
table.t td, table.t th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.t .num { text-align: right; font-variant-numeric: tabular-nums; }
.bad { color: #ff7b72; font-weight: 700; }
.ok { color: #57d98c; font-weight: 700; }
.notice { border-left: 5px solid var(--yellow); padding: 8px 10px; margin: 8px 0; background: #26231a; border-radius: 8px; }
@media (min-width: 900px) {
  .dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; max-width: 1100px; margin: 0 auto; }
  .page.wide { max-width: 1100px; }
}
.update-btn { position: fixed; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top) + 44px); z-index: 45;
  background: var(--yellow); color: #111; border: 0; font-weight: 800; }
