/* 感謝セミナー スタンプラリー — デザインカンプ準拠のデザインシステム
   参照: 参加者3画面 / メーカー端末4画面 / 管理コンソール（サイドナビ＋カード） */
:root {
  --navy:      #1b3a6b;   /* 主色。サイドバー・見出し・主ボタン */
  --navy-700:  #12294d;   /* サイドバーの地色 */
  --navy-300:  #41597a;
  --navy-050:  #eef3fa;   /* 淡い面 */
  --red:       #e2333c;   /* アクセント。スタンプ枠・強調・危険操作 */
  --red-050:   #fde8e9;
  --bg:        #f3f6fb;   /* アプリ背景 */
  --panel:     #f4f8fc;
  --line:      #dbe5f2;
  --line-2:    #cfdcec;   /* ウィンドウ枠 */
  --ink:       #16233a;
  --muted:     #6b7a8d;
  --muted-2:   #8497ad;
  --ok:        #0f8f5f;
  --ok-050:    #e6f6ee;
  --warn:      #b26a00;
  --warn-050:  #fdf3e0;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;
  --shadow: 0 8px 24px rgba(18, 49, 95, .08);
}
/* ===== 空のイメージの背景（参加者アプリ／メーカー端末で共通） =====
   上ほど青く、下は地平線の光でかすむ実際の空の見え方に合わせ、
   白いかたまりを重ねて積雲に見せる（画像を使わないので読み込みゼロ）。 */
body.sky {
  background: linear-gradient(180deg, #a9d3f2 0%, #c8e2f7 38%, #e6f0fa 72%, #f3f6fb 100%);
  background-attachment: fixed;
}
/* 雲はデザイン原本と同じ3層（スマホ290×600基準の比率を維持） */
body.sky::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background-image:
    radial-gradient(20.7% 4.3% at 22% 16%, rgba(255,255,255,.95), rgba(255,255,255,0) 70%),
    radial-gradient(31.0% 5.7% at 74% 26%, rgba(255,255,255,.85), rgba(255,255,255,0) 70%),
    radial-gradient(24.1% 4.7% at 45% 52%, rgba(255,255,255,.60), rgba(255,255,255,0) 70%);
  background-repeat: no-repeat;
}
/* 空の写真に差し替える場合: static/bg.jpg を置いて body に has-photo を足す */
body.sky.has-photo { background: url("/static/bg.jpg") center/cover no-repeat fixed, #cfe0f7; }
body.sky.has-photo::before {
  background: linear-gradient(180deg, rgba(9,26,55,.05) 0%, rgba(9,26,55,.18) 55%, rgba(9,26,55,.42) 100%);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--navy); }
h1, h2, h3 { margin: 0; }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px 48px; }
.wrap.wide { max-width: 1240px; }
.hidden { display: none !important; }
.center { text-align: center; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 180px; }
.muted { color: var(--muted); font-size: 12.5px; line-height: 1.75; }

/* ---------- ヘッダー（メーカー端末・アンケート等） ---------- */
header.bar {
  background: var(--navy);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
header.bar h1 { font-size: 16px; font-weight: 800; letter-spacing: .02em; }
header.bar .sub { font-size: 11.5px; opacity: .8; margin-top: 2px; }
header.bar .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------- カード ---------- */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  margin-top: 14px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 14.5px; color: var(--navy); font-weight: 800; margin-bottom: 10px; }
.card h3 { font-size: 12px; color: var(--muted); font-weight: 700; margin: 16px 0 6px; }

/* ---------- フォーム ---------- */
label.f { display: block; font-size: 11.5px; color: var(--muted); margin: 8px 0 4px; font-weight: 600; }
input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(18, 49, 95, .15);
  border-color: var(--navy);
}
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--navy); }
input[type=file] { padding: 8px; background: #fff; }

/* ---------- ボタン ---------- */
button {
  font: inherit;
  font-weight: 700;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  border-radius: var(--r-md);
  padding: 11px 18px;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
button:hover { background: var(--navy-700); }
button.ghost { background: #fff; color: var(--navy); border-color: var(--line); }
button.ghost:hover { background: var(--navy-050); }
button.danger { background: var(--red); border-color: var(--red); }
button.danger:hover { background: #c01e30; }
button.big { width: 100%; padding: 16px; font-size: 16px; border-radius: 14px; }
button.tiny { padding: 6px 11px; font-size: 12px; border-radius: 8px; font-weight: 600; }
button:disabled { opacity: .45; cursor: not-allowed; }

/* セグメント切替（一覧／名札） */
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { background: #fff; color: var(--navy); border: 0; border-radius: 0; padding: 8px 18px; font-size: 13px; }
.seg button.on { background: var(--navy); color: #fff; }

/* 旧タブ（未使用だが互換のため） */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.tabs button { background: #fff; color: var(--navy); border: 1px solid var(--line); border-radius: 999px; padding: 7px 15px; font-size: 13px; }
.tabs button.on { background: var(--navy); color: #fff; }

/* ---------- 表 ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 10px; text-align: left; white-space: nowrap; }
th {
  background: #fff; color: var(--muted); font-size: 11px; font-weight: 700;
  letter-spacing: .04em; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1;
}
td { border-bottom: 1px solid #eef3fa; }
tbody tr:hover td, tr:hover td { background: #f7fafe; }
.scroll { overflow: auto; max-height: 64vh; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; }

/* ---------- ピル ---------- */
.pill {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px;
  border-radius: 999px; background: var(--navy-050); color: var(--navy);
}
.pill.ok   { background: var(--ok-050);   color: var(--ok); }
.pill.ng   { background: var(--red-050);  color: var(--red); }
.pill.wait { background: var(--warn-050); color: var(--warn); }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.kpi.hi { border: 2px solid var(--navy); }
.kpi .k { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 30px; font-weight: 800; color: var(--navy); line-height: 1.15; margin-top: 4px; }
.kpi .v small { font-size: 12px; color: var(--red); font-weight: 700; margin-left: 6px; }

/* ---------- メッセージ ---------- */
.msg { padding: 11px 14px; border-radius: var(--r-md); font-size: 13px; margin-top: 10px; }
.msg.ok   { background: var(--ok-050);   color: #0b6b47; }
.msg.err  { background: var(--red-050);  color: #96101f; }
.msg.info { background: var(--navy-050); color: var(--navy); }

/* ---------- スタンプ（アンケート等で使用） ---------- */
.stamps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stamp {
  aspect-ratio: 1/1; border-radius: 50%; border: 2px dashed #b9cbe8; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 6px; text-align: center;
}
.stamp .ic { font-size: 26px; line-height: 1; filter: grayscale(1); opacity: .3; }
.stamp .nm { font-size: 9.5px; color: var(--muted); line-height: 1.3; }
.stamp.got { border: 3px solid var(--red); }
.stamp.got .ic { filter: none; opacity: 1; }
.stamp.got .nm { color: var(--navy); font-weight: 700; }
.stamp img.ic { width: 34px; height: 34px; object-fit: contain; }

.gauge { height: 8px; background: #d7e3f4; border-radius: 999px; overflow: hidden; }
.gauge > div { height: 100%; background: var(--navy); width: 0; transition: width .4s; }

#reader { width: 100%; border-radius: var(--r-md); background: #000; aspect-ratio: 3/4; object-fit: cover; }

/* ===== 事務局コンソール: 白いページの上に角丸のウィンドウ（カンプ） ===== */
body.console { background: #fff; padding: 14px; }
.shell {
  display: flex; align-items: stretch; min-height: calc(100vh - 28px);
  background: linear-gradient(180deg, #dceafa 0%, #eef4fb 26%, #f3f6fb 100%);
  border: 1.5px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 16px 44px rgba(27, 58, 107, .10);
}
.side {
  width: 208px; flex: 0 0 208px; background: var(--navy-700); color: #fff;
  padding: 18px 14px; display: flex; flex-direction: column;
  border-radius: 14px 0 0 14px;
  /* スクロールしてもナビは常に見えるように固定（.shell に overflow を付けない） */
  position: sticky; top: 14px; align-self: flex-start;
  height: calc(100vh - 28px); overflow-y: auto;
}
@media (max-width: 760px) {
  body.console { padding: 0; }
  .shell { border-radius: 0; border: 0; min-height: 100vh; box-shadow: none; }
  .side { border-radius: 0; top: 0; height: 100vh; }
  .badge-grid { grid-template-columns: 1fr; }
}
.side .badge-live {
  display: inline-block; font: 700 9.5px ui-monospace, Menlo, monospace;
  background: #5b86c9; color: #12294d;
  border-radius: 999px; padding: 3px 10px; margin-bottom: 10px; align-self: flex-start;
}
.side .ttl {
  font-size: 16px; font-weight: 800; letter-spacing: .01em; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.side .ev { font: 9.5px/1.6 ui-monospace, Menlo, monospace; color: #8fb2e6; margin: 4px 0 18px; }
.side nav { display: flex; flex-direction: column; gap: 3px; }
.side nav button {
  background: transparent; border: 0; color: #a9c3e6; text-align: left;
  height: 34px; padding: 0 11px; border-radius: 10px; font-size: 12.5px; font-weight: 600;
  display: flex; align-items: center; gap: 9px; width: 100%;
}
.side nav button:hover { background: rgba(255,255,255,.08); }
.side nav button.on { background: rgba(255,255,255,.14); color: #fff; font-weight: 700; }
.side nav button .dot { width: 15px; height: 15px; border-radius: 4px;
                        border: 1.5px solid #7e93b5; flex: 0 0 15px; }
.side nav button.on .dot { border-radius: 999px; border-color: #fff; }
.side .sec { margin-top: 18px; }
.side .sec select { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.25); color: #fff; font-size: 12px; }
.side .sec select option { color: var(--ink); }
.side .foot { margin-top: auto; padding-top: 18px; display: flex; align-items: center; gap: 10px; font-size: 12px; }
.side .foot .av { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.22); flex: 0 0 32px; }
.side .foot small { display: block; color: #8fb2e6; font-size: 10px; }
.side .foot button { background: transparent; border-color: rgba(255,255,255,.3); color: #fff; margin-left: auto; }

.main { flex: 1 1 auto; min-width: 0; padding: 0 24px 64px; }
.main > section > .card:first-child { margin-top: 0; }
.topbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
/* 画面上部のツールバー（切替・検索・印刷）はスクロールしても固定 */
.main > section > .topbar:first-child {
  position: sticky; top: 14px; z-index: 6; background: #edf3fb;
  padding: 16px 0 12px; box-shadow: 0 8px 12px -10px rgba(18, 49, 95, .35);
}
@media (max-width: 760px) { .main > section > .topbar:first-child { top: 0; } }
.main > section > *:first-child:not(.topbar) { margin-top: 20px; }
.topbar .grow { flex: 1 1 260px; }
.page-h { font-size: 18px; font-weight: 800; color: var(--navy); margin-bottom: 12px; }

/* 2ペイン（左に一覧・右に詳細） */
.two-pane { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(320px, 1fr); gap: 18px; margin-top: 18px; }
@media (max-width: 900px) { .two-pane { grid-template-columns: 1fr; } }
.pane { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
        box-shadow: var(--shadow); overflow: hidden; align-self: start; }
.pane > table { width: 100%; }
.pane-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px;
          border-bottom: 1px solid var(--line); font-size: 16px; }
.pane-h b { color: var(--navy); font-size: 16px; }
.pane-b { padding: 16px 18px 18px; }
.pane-b h3 { margin: 18px 0 8px; }
.kv { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #eef3fa; font-size: 13px; }
.kv span { color: var(--muted); }
.kv b { margin-left: auto; font-weight: 700; text-align: right; }
tr.pick { cursor: pointer; }
tr.pick.on td { background: var(--navy-050); }
tr.pick.on td:first-child { box-shadow: inset 3px 0 0 var(--navy); }
button.tiny.danger { background: #fff; color: var(--red); border-color: #f3c9ce; }
button.tiny.danger:hover { background: var(--red-050); }

/* 一覧の見出し行（「名札 312枚 ・ A4に10面付け…」） */
.listhead { display: flex; align-items: baseline; gap: 12px; margin: 18px 2px 10px; }
.listhead b { font-size: 15px; color: var(--ink); font-weight: 800; }

/* 名札ビュー（カンプ準拠：2列・淡い青のカード・下辺に赤いライン） */
/* カンプ通り2列。狭い画面では1列に落とす */
.badge-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 860px) { .badge-grid { grid-template-columns: 1fr; } }
/* 画面上も印刷と同じ名刺サイズの比率（91:55）で見せる */
/* 画面上の名札カードは印刷（91×55mm）と同じ比率・同じ寸法比で描く。
   cqw = カード幅の1% なので、91mm を 100cqw に見立てて mm から換算している。 */
.badge-card {
  container-type: inline-size;
  /* デザイン原本 8a: 上が青く下は白。雲を2つ重ねる */
  background-image:
    radial-gradient(19.2% 11.8% at 22% 14%, rgba(255,255,255,.95), rgba(255,255,255,0) 70%),
    radial-gradient(24.7% 13.6% at 74% 24%, rgba(255,255,255,.80), rgba(255,255,255,0) 70%),
    linear-gradient(180deg, #a9d3f2 0%, #d3e6f8 46%, #fff 100%);
  background-repeat: no-repeat;
  border-radius: 0; padding: 3.3cqw 0 3.3cqw 3.85cqw;   /* 名刺は角丸なし（四角） */
  position: relative; overflow: hidden;
  aspect-ratio: 91 / 55; max-width: 470px;
  display: flex; gap: 5.5cqw; align-items: stretch; cursor: pointer;
  box-shadow: 0 6px 18px rgba(18, 49, 95, .10);
}
.badge-card::after {           /* 下辺の赤い帯 1.5mm */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1.65cqw;
  background: var(--red);
}
.badge-card:hover { box-shadow: 0 10px 26px rgba(27, 58, 107, .18); }
.badge-card.sel { outline: 3px solid var(--navy); outline-offset: 1px; }
.badge-card .info { display: flex; flex-direction: column; gap: 1.65cqw; min-width: 0; flex: 1 1 auto; }
.badge-card .co { font-size: 5.23cqw; font-weight: 700; color: var(--navy); line-height: 1.25;
                  overflow-wrap: anywhere; }
.badge-card .de { font-size: 3.29cqw; color: var(--muted); margin-top: -.7cqw; }
.badge-card .nm { font-size: 8.14cqw; font-weight: 700; color: var(--ink); margin-top: .66cqw;
                  line-height: 1.15; white-space: nowrap; }   /* 氏名は必ず1行 */
.badge-card .nm.n7  { font-size: 6.98cqw; }
.badge-card .nm.n9  { font-size: 5.81cqw; }
.badge-card .nm.n11 { font-size: 4.84cqw; }
.badge-card .co.c10 { font-size: 4.46cqw; }
.badge-card .co.c14 { font-size: 3.68cqw; line-height: 1.3; }
.badge-card .co.c18 { font-size: 3.29cqw; line-height: 1.3; }
.badge-card .id { font-size: 3.68cqw; font-weight: 600; font-family: ui-monospace, Menlo, monospace;
                  color: var(--muted); margin-top: auto; letter-spacing: .04em; }
.badge-card .qrwrap { width: 40.7cqw; flex: none; display: flex; align-items: center;
                      justify-content: center; padding: 2.75cqw 2.75cqw 3.3cqw 1.1cqw; }
.badge-card .qr { width: 36.3cqw; aspect-ratio: 1/1; border: .82cqw solid var(--navy);
                  border-radius: 3.3cqw; background: #fff; padding: 1.1cqw; box-sizing: border-box; }
.badge-card .qr img { width: 100%; height: 100%; display: block; }
.badge-card input[type=checkbox] {
  position: absolute; right: 12px; top: 12px; width: 17px; height: 17px; opacity: .5;
}
.badge-card input[type=checkbox]:checked, .badge-card:hover input[type=checkbox] { opacity: 1; }

/* モーダル */
.modal-bg { position: fixed; inset: 0; background: rgba(13, 37, 71, .5); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 60; }
.modal-bg.on { display: flex; }
.modal { background: #fff; border-radius: var(--r-lg); width: min(470px, 100%); max-height: 88vh;
         overflow: auto; box-shadow: 0 24px 60px rgba(13,37,71,.3); }
/* ヘッダー（タイトル＋×）／本文 */
.modal .mh { display: flex; align-items: center; gap: 10px; padding: 16px 20px;
             border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.modal .mh b { font-size: 15px; font-weight: 800; }
.modal .mb { padding: 18px 20px 20px; }
.modal h3 { font-size: 20px; font-weight: 800; }
.modal .x { margin-left: auto; border: 0; background: #eef3fa; color: var(--muted);
            border-radius: 50%; width: 30px; height: 30px; padding: 0; font-size: 15px; }
.modal .x:hover { background: #e2eaf5; }
/* 個人情報のメーカー提供ボックス */
.consent-box { display: flex; align-items: center; gap: 12px; background: var(--navy-050);
               border-radius: 12px; padding: 13px 15px; margin: 14px 0 4px; }
.consent-box .t { font-size: 12.5px; font-weight: 700; color: var(--navy); }
.consent-box .s { font-size: 11px; color: var(--muted); margin-top: 3px; }
.consent-box .b { margin-left: auto; }
.consent-box .b .pill { font-size: 12px; padding: 5px 14px; }
/* スタンプの丸（5個・4個で折り返す） */
.dots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 16px 0 6px; }
.dots span {
  aspect-ratio: 1/1; border-radius: 50%; border: 2px solid #dbe6f5; color: #b6c5da;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
}
.dots span.got { border: 2.5px solid var(--red); color: var(--red); }
/* 押印履歴 */
.log-list { margin-top: 6px; }
.log-list .r { display: flex; gap: 16px; padding: 7px 0; font-size: 13px; }
.log-list .r .tm { color: var(--muted); width: 46px; flex: 0 0 46px; }
