/* ==========================================================================
   National Meeting Q&A — I.B.C.
   Brand colors live here. To match the logo exactly, change --brand / --accent.
   ========================================================================== */
:root {
  --brand: #0067ac;        /* I.B.C. logo blue */
  --brand-strong: #004f86;
  --brand-soft: #e6f0f8;
  --accent: #b81137;       /* I.B.C. logo red — used sparingly for rules and highlights */

  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #111827;
  --muted: #4b5563;
  --line: #e3e7ee;
  --ok: #166534;
  --ok-bg: #ecfdf3;
  --err: #9a3412;
  --err-bg: #fff4ed;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
a:hover { color: var(--brand-strong); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Brand header ---------- */
.topbar {
  background: var(--surface);
  border-top: 4px solid var(--brand);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); }
.brand picture { display: block; }
.brand-logo { height: 56px; width: auto; display: block; }
.brand-wordmark {
  font-weight: 800; font-size: 1.35rem; letter-spacing: .04em; color: var(--brand);
}
.brand-divider { width: 1px; height: 28px; background: var(--line); }
.brand-event { display: flex; flex-direction: column; line-height: 1.2; }
.brand-event strong { font-size: .95rem; font-weight: 700; }
.brand-event span { font-size: .8rem; color: var(--muted); font-weight: 500; }

/* ---------- Layout ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 32px 20px 64px; }
.container.narrow { max-width: 600px; }

.hero {
  background: var(--brand);
  color: #fff;
  padding: 32px 20px 72px;
}
.hero-inner { max-width: 600px; margin: 0 auto; }
.eyebrow {
  display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: #ffffff; opacity: .85; margin-bottom: 8px;
}
.hero h1 { margin: 0 0 6px; font-size: 1.75rem; line-height: 1.2; font-weight: 700; }
.hero p { margin: 0; color: #eef5fb; }
.hero { border-bottom: 4px solid var(--accent); }
.overlap { margin-top: -48px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 1.6rem; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px;
}
.card h2 { margin: 0 0 4px; font-size: 1.1rem; font-weight: 700; }
.card .card-sub { margin: 0 0 16px; color: var(--muted); font-size: .9rem; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
input[type=text], input[type=password], textarea {
  width: 100%; padding: 12px 14px; font: inherit; color: var(--text);
  border: 1px solid #cdd4df; border-radius: 8px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 103, 172, .18); }
textarea { min-height: 150px; resize: vertical; }
.hint { color: var(--muted); font-size: .8rem; margin-top: 6px; display: flex; justify-content: space-between; gap: 8px; }

.check { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 0 0 16px; cursor: pointer; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }

/* ---------- Buttons ---------- */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; font: inherit; font-weight: 600; font-size: .95rem;
  border: 1px solid var(--brand); background: var(--brand); color: #fff;
  border-radius: 8px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover, button:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.btn.secondary, button.secondary { background: #fff; color: var(--brand); border-color: #cdd4df; }
.btn.secondary:hover, button.secondary:hover { background: var(--brand-soft); color: var(--brand-strong); border-color: var(--brand); }
.btn.danger, button.danger { background: #fff; color: var(--accent); border-color: #e7b3c0; }
.btn.danger:hover, button.danger:hover { background: #fdecef; color: #8f0d2b; border-color: var(--accent); }
.btn.block, button.block { width: 100%; }
.btn.sm, button.sm { min-height: 36px; padding: 0 14px; font-size: .85rem; }
button:disabled { opacity: .55; cursor: default; }
.btn svg, button svg { width: 18px; height: 18px; flex: none; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Link button joined to a copy button */
.btn-group { display: inline-flex; }
.btn-group > :first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-group > :last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.btn-group > :hover { position: relative; z-index: 1; }
.icon-btn { padding: 0 10px; gap: 6px; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.copied, .icon-btn.copied:hover { color: var(--ok); border-color: var(--ok); background: var(--ok-bg); position: relative; z-index: 1; }

/* ---------- Messages ---------- */
.msg { padding: 12px 14px; border-radius: 8px; margin-top: 14px; font-size: .9rem; }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.err { background: var(--err-bg); color: var(--err); }

.success { text-align: center; padding: 16px 8px 8px; }
.success-icon {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 16px;
  background: var(--ok-bg); color: var(--ok); display: grid; place-items: center;
}
.success-icon svg { width: 32px; height: 32px; }
.success h2 { font-size: 1.3rem; margin: 0 0 6px; }
.success p { color: var(--muted); margin: 0 0 20px; }

.footer-note { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 24px; }

/* ---------- Landing page ---------- */
.session-list { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.session-list:empty { display: none; }
.session-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 64px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px;
  text-decoration: none; color: var(--text); background: #fff;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.session-link:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--text); }
.session-text { display: flex; flex-direction: column; min-width: 0; }
.session-text strong { font-weight: 600; overflow-wrap: anywhere; }
.session-text span { color: var(--muted); font-size: .88rem; }
.session-arrow { width: 22px; height: 22px; flex: none; color: var(--brand); }
.session-row { display: flex; gap: 10px; align-items: stretch; }
.session-row .session-link { flex: 1; min-width: 0; }
.qr-btn, .qr-btn:hover {
  flex: none; width: 64px; min-height: 64px; padding: 6px; border-radius: 10px;
  background: #fff; border: 1px solid var(--line); color: var(--brand);
}
.qr-btn:hover { border-color: var(--brand); background: var(--brand-soft); }
.qr-btn img { width: 48px; height: 48px; display: block; image-rendering: pixelated; }

.qr-dialog {
  border: 0; border-radius: var(--radius); padding: 28px 24px 20px; width: min(420px, calc(100vw - 32px));
  text-align: center; box-shadow: 0 20px 60px rgba(16, 24, 40, .3); color: var(--text);
}
.qr-dialog::backdrop { background: rgba(8, 23, 46, .6); }
.qr-dialog h2 { margin: 0 0 4px; font-size: 1.25rem; }
.qr-dialog .card-sub { margin: 0 0 12px; }
.qr-large { width: min(300px, 100%); height: auto; aspect-ratio: 1; image-rendering: pixelated; display: block; margin: 8px auto; }
.qr-hint { margin: 8px 0 4px; font-weight: 600; }
.qr-url { margin: 0 0 16px; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }

.steps { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.steps li { display: flex; gap: 16px; align-items: flex-start; }
.steps li div { display: flex; flex-direction: column; gap: 4px; padding-top: 4px; }
.steps li strong { font-weight: 600; line-height: 1.3; }
.steps li span:not(.step-num) { color: var(--muted); font-size: .9rem; line-height: 1.45; }
.step-num {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 700; font-size: .9rem;
  display: grid; place-items: center;
}

/* ---------- Badges / stats ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand);
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.muted { background: #eef0f3; color: var(--muted); }
.badge.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat .label { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-size: 1.9rem; font-weight: 700; color: var(--brand); line-height: 1.2; margin-top: 4px; }

.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) {
  .grid3, .stats { grid-template-columns: 1fr; }
  .brand-divider, .brand-event span { display: none; }
  .brand-logo { height: 40px; }
}

/* ---------- Admin table ---------- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: #f8fafc; }
tr:last-child td { border-bottom: 0; }
.qr-link { display: inline-block; border-radius: 8px; border: 1px solid var(--line); padding: 4px; background: #fff; }
.qr-link:hover { border-color: var(--brand); }
.qr { width: 84px; height: 84px; image-rendering: pixelated; display: block; }
.session-title { font-weight: 600; min-width: 200px; }
.session-meta { color: var(--muted); font-size: .82rem; }
.code-chip { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .8rem; background: #f1f4f8; padding: 2px 6px; border-radius: 4px; }
.table-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
}
.table-head h2 { margin: 0; font-size: 1.05rem; }
.table-head .check { margin: 0; font-size: .9rem; }
tr.inactive .session-title, tr.inactive td:nth-child(3) { color: var(--muted); }
tr.inactive .qr { opacity: .55; }
tr.editing td { background: var(--brand-soft); }
.cell-stack { display: flex; flex-direction: column; gap: 8px; min-width: 240px; }
input.cell-input { padding: 9px 12px; }

/* ==========================================================================
   Projector QR page (present.html): pure white, QR as large as the screen allows
   ========================================================================== */
body.present { background: #fff; }
.present-tools { position: fixed; top: 16px; right: 16px; display: flex; gap: 8px; z-index: 2; }
.present-wrap {
  height: 100vh; height: 100dvh; box-sizing: border-box; padding: 3vh 4vw; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.4vh; text-align: center;
}
.present-logo { height: clamp(36px, 6vh, 84px); width: auto; }
.present-title { margin: 0; font-size: clamp(26px, 5.2vh, 76px); line-height: 1.1; font-weight: 800; color: var(--brand); }
.present-presenter { margin: 0; font-size: clamp(16px, 2.6vh, 36px); color: var(--muted); font-weight: 500; }
/* The QR fills all the height left after the text, so it's as large as possible without scrolling.
   Black on white, crisp edges, built-in quiet zone. */
.present-qr {
  flex: 1 1 0; min-height: 120px; width: auto; max-width: 92vw; aspect-ratio: 1;
  object-fit: contain; image-rendering: pixelated; display: block;
}
.present-cta { margin: 0; font-size: clamp(20px, 3.8vh, 54px); font-weight: 700; color: var(--text); }
.present-url { margin: 0; font-size: clamp(14px, 2.3vh, 32px); color: var(--muted); font-weight: 500; }
.present-note { margin: 0; font-size: clamp(14px, 2.2vh, 30px); color: var(--accent); font-weight: 600; }

/* ==========================================================================
   Presenter screen — dark, high-contrast "stage" theme for confidence monitors
   ========================================================================== */
body.stage { background: #08172e; color: #f3f6fb; }
.stage .topbar { background: #0b1f3d; border-top-color: var(--accent); border-bottom-color: #1b3359; }
.stage .brand { color: #f3f6fb; }
.stage .brand-logo-chip { background: #fff; border-radius: 8px; padding: 6px 10px; display: flex; align-items: center; }
.stage .brand-logo { height: 44px; }
.stage .brand-divider { background: #24406b; }
.stage .brand-event span { color: #a9b8d0; }

.stage-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.stage-head h1 { margin: 0; font-size: 2rem; font-weight: 700; line-height: 1.2; }
.stage-head .presenter-name { color: #a9b8d0; margin-top: 4px; font-size: 1.05rem; }

.live { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; color: #a9b8d0; }
.live::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #64748b; }
.live.on { color: #86efac; }
.live.on::before { background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .2); }

/* Presenter screen: shown while live updates are down (polling keeps the list current). */
.offline-banner { background: #92400e; color: #fff; text-align: center; font-weight: 600; font-size: 1.05rem; padding: 12px 16px; }
.offline-banner[hidden] { display: none; }

.tabs { display: inline-flex; background: #0f2547; border: 1px solid #1b3359; border-radius: 10px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.stage .tabs button {
  background: transparent; border: 0; color: #c3cee0; min-height: 40px; padding: 0 16px; font-size: .95rem;
}
.stage .tabs button:hover { background: #17325c; color: #fff; }
.stage .tabs button[aria-pressed=true] { background: #fff; color: var(--brand); }
.tabs .count { font-variant-numeric: tabular-nums; opacity: .8; }

.q {
  background: #0f2547; border: 1px solid #1b3359; border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 14px;
  display: grid; grid-template-columns: auto 1fr; gap: 6px 18px;
}
.q.new { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.q.answered { opacity: .55; }
.avatar {
  grid-row: span 2; width: 48px; height: 48px; border-radius: 50%;
  background: #1d3c6b; color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 1rem;
}
.q .text { font-size: 1.6rem; line-height: 1.4; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: #fff; }
.q .meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.q .who { color: #a9b8d0; font-size: 1rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.q .who strong { color: #e6ecf5; font-weight: 600; }
.stage .badge { background: #1d3c6b; color: #dbe5f3; }
.stage .badge.new { background: var(--accent); color: #fff; }
.stage .badge.ok { background: #14532d; color: #bbf7d0; }
.stage button { background: #fff; color: var(--brand); border-color: #fff; }
.stage button:hover { background: #e3eaf5; border-color: #e3eaf5; color: var(--brand-strong); }
.stage button.secondary { background: transparent; color: #dbe5f3; border-color: #36547f; }
.stage button.secondary:hover { background: #17325c; color: #fff; }
.empty-state { text-align: center; color: #a9b8d0; padding: 64px 20px; border: 1px dashed #24406b; border-radius: var(--radius); font-size: 1.1rem; }

.stage .card { background: #0f2547; border-color: #1b3359; box-shadow: none; color: #f3f6fb; }
.stage .card .card-sub { color: #a9b8d0; }
.stage input[type=password] { background: #08172e; border-color: #36547f; color: #fff; }
.stage .msg.err { background: #3b1d12; color: #fdba8c; }
