/* ===== ホスト（管理）画面 ===== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  background: #f2f5f9;
  color: #12263A;
  font-size: 14px;
  line-height: 1.6;
}
a { color: #1B3B6F; }

.topbar {
  background: #1B3B6F;
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 800; }
.topbar .right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.topbar a, .topbar button {
  color: #fff; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3);
  padding: 6px 12px; border-radius: 8px; text-decoration: none; font-size: 13px;
  cursor: pointer; font-family: inherit;
}

.container { max-width: 1080px; margin: 0 auto; padding: 20px 16px 80px; }

/* ===== 上部「投影中」バー（常時表示） ===== */
.nowbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(0,0,0,.08);
}
.nowbar.on { background: #0f2f57; color: #fff; }
.nowbar.idle { background: #e8ebf0; color: #5b6779; }
.nb-label {
  flex: 0 0 auto; font-size: 11px; font-weight: 800; letter-spacing: .06em;
  padding: 3px 10px; border-radius: 999px;
}
.nowbar.on .nb-label { background: #17a673; color: #fff; }
.nowbar.idle .nb-label { background: #b6bfcc; color: #fff; }
.nb-q {
  flex: 1 1 240px; font-size: 15px; font-weight: 800; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nowbar button {
  flex: 0 0 auto; font-family: inherit; font-size: 12px; font-weight: 700;
  padding: 7px 12px; border-radius: 8px; cursor: pointer;
}
.nowbar.on button { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.36); color: #fff; }
.nowbar.on button:hover { background: rgba(255,255,255,.28); }
.nowbar.idle button { background: #fff; border: 1px solid #cbd5e3; color: #55637a; }

.panel {
  background: #fff; border-radius: 12px; padding: 18px;
  box-shadow: 0 1px 6px rgba(18,38,58,.08); margin-bottom: 18px;
}
.panel h2 {
  font-size: 15px; margin: 0 0 14px; padding-bottom: 10px;
  border-bottom: 2px solid #eef2f7; font-weight: 800; color: #1B3B6F;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }

/* 設問カード */
.act {
  position: relative;
  border: 2px solid #e5eaf2; border-radius: 12px; padding: 16px; margin-bottom: 14px;
  background: #fff; transition: box-shadow .2s, border-color .2s, background .2s;
}
.act.open { border-color: #17a673; background: #f4fcf8; }
/* 投影中カードは全体を強調 */
.act.displaying {
  border-color: #1B3B6F;
  background: #eef4ff;
  box-shadow: 0 0 0 4px rgba(27,59,111,.16), 0 6px 18px rgba(18,38,58,.14);
}
.act.open.displaying { background: #edf7ff; }
.displaying-tag {
  position: absolute; top: -12px; left: 14px;
  background: #1B3B6F; color: #fff;
  font-size: 11px; font-weight: 800; letter-spacing: .08em;
  padding: 3px 12px; border-radius: 999px;
  box-shadow: 0 2px 6px rgba(18,38,58,.28);
}
.act-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.act-q { font-size: 15px; font-weight: 700; line-height: 1.5; }
.act-meta { font-size: 12px; color: #7a8699; margin-top: 4px; }

.chip {
  display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 10px;
  border-radius: 999px; white-space: nowrap;
}
.chip.draft { background: #e8ebf0; color: #5b6779; }
.chip.open { background: #17a673; color: #fff; }
.chip.closed { background: #ef6c00; color: #fff; }
.chip.type { background: #eef3fb; color: #1B3B6F; }

/* ===== 受付トグル / 投影ラジオ ===== */
.ctl {
  display: flex; gap: 14px; flex-wrap: wrap;
  margin: 14px 0 4px; padding: 12px 14px;
  background: #f6f8fc; border: 1px solid #e5eaf2; border-radius: 10px;
}
.ctl-block { display: flex; flex-direction: column; gap: 6px; min-width: 200px; flex: 1 1 220px; }
.ctl-label { font-size: 11px; font-weight: 800; color: #7a8699; letter-spacing: .06em; }
.ctl-note { font-size: 11px; color: #7a8699; }

/* トグルスイッチ（受付中=緑 / 停止=グレー） */
.toggle {
  display: inline-flex; align-items: center; gap: 10px;
  width: 138px; padding: 5px 12px 5px 6px;
  border-radius: 999px; border: 2px solid #cbd5e3; background: #e8ebf0;
  cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 800;
  color: #5b6779; transition: background .18s, border-color .18s, color .18s;
}
.toggle:hover { background: #dde2ea; }
.toggle .knob {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.28);
  transition: transform .18s;
}
.toggle .tg-text { flex: 1 1 auto; text-align: center; }
.toggle.on {
  background: #17a673; border-color: #17a673; color: #fff;
  flex-direction: row-reverse; padding: 5px 6px 5px 12px;
}
.toggle.on:hover { background: #139364; }

/* 投影ラジオ */
.radio {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 10px;
  border: 2px solid #cbd5e3; background: #fff;
  cursor: pointer; font-size: 13px; font-weight: 700; color: #55637a;
  transition: border-color .18s, background .18s, color .18s;
}
.radio:hover { border-color: #9fb0c9; }
.radio input { width: 18px; height: 18px; margin: 0; accent-color: #1B3B6F; cursor: pointer; }
.radio.checked { border-color: #1B3B6F; background: #1B3B6F; color: #fff; }
.radio.checked input { accent-color: #fff; }

.stats { display: flex; gap: 18px; margin: 12px 0; flex-wrap: wrap; }
.stat { background: #f6f8fc; border-radius: 8px; padding: 8px 14px; min-width: 96px; }
.stat b { display: block; font-size: 22px; font-weight: 800; color: #1B3B6F; line-height: 1.2; }
.stat span { font-size: 11px; color: #7a8699; }

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

button, .btn {
  font-family: inherit; font-size: 13px; font-weight: 700; padding: 9px 14px;
  border-radius: 8px; border: 1px solid #cbd5e3; background: #fff; color: #33415c;
  cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover { background: #f4f7fb; }
button.primary { background: #1B3B6F; border-color: #1B3B6F; color: #fff; }
button.go { background: #17a673; border-color: #17a673; color: #fff; }
button.warn { background: #ef6c00; border-color: #ef6c00; color: #fff; }
button.danger { background: #d93025; border-color: #d93025; color: #fff; }
button.active { box-shadow: inset 0 0 0 2px rgba(0,0,0,.18); }
button:disabled { opacity: .5; cursor: default; }

input[type="text"], input[type="number"], input[type="password"], textarea, select {
  font-family: inherit; font-size: 14px; padding: 9px 10px;
  border: 1px solid #cbd5e3; border-radius: 8px; width: 100%; background: #fff;
}
label.f { display: block; font-size: 12px; font-weight: 700; color: #55637a; margin: 10px 0 4px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid #eef2f7; text-align: left; vertical-align: top; }
th { background: #f6f8fc; font-size: 12px; color: #55637a; }
tr.hidden-row td { opacity: .45; text-decoration: line-through; }

.hint { font-size: 12px; color: #7a8699; margin-top: 6px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }

/* ログイン */
.login-wrap { max-width: 380px; margin: 12vh auto; padding: 0 16px; }
.login-wrap .panel { padding: 28px 24px; }
.login-wrap h1 { font-size: 18px; margin: 0 0 6px; color: #1B3B6F; }
.login-wrap p.sub { font-size: 13px; color: #7a8699; margin: 0 0 20px; }
.err-box { background: #fdecea; color: #b3261e; padding: 10px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; font-weight: 700; }

/* QRモーダル */
.modal {
  position: fixed; inset: 0; background: rgba(10,20,35,.82);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal.on { display: flex; }
.modal-inner { background: #fff; border-radius: 16px; padding: 28px; text-align: center; max-width: 92vw; max-height: 92vh; overflow: auto; }
.modal-inner svg { width: min(70vh, 78vw); height: auto; display: block; margin: 0 auto; }
.modal-inner .u { font-size: 20px; font-weight: 800; margin-top: 16px; word-break: break-all; }
.modal-inner .c { font-size: 14px; color: #7a8699; margin-top: 6px; }

.qr-box { text-align: center; }
.qr-box svg { width: 180px; height: 180px; }

#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #12263A; color: #fff; padding: 12px 22px; border-radius: 10px;
  font-size: 14px; font-weight: 700; opacity: 0; pointer-events: none;
  transition: opacity .25s; z-index: 100; max-width: 90vw;
}
#toast.on { opacity: 1; }
#toast.err { background: #b3261e; }

.opt-edit { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.opt-edit input { flex: 1 1 auto; }
.opt-edit button { flex: 0 0 auto; }
