/* SlotSheet — one stylesheet for every page. Light and dark themes, print styles. */

:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f1efe9;
  --text: #1b2230;
  --muted: #5a6273;
  --border: #dedad0;
  --accent: #0f766e;
  --accent-strong: #0b5c56;
  --accent-soft: #d8efeb;
  --on-accent: #ffffff;
  --mine: #fff4c7;
  --mine-border: #e5c96a;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --success: #1a7f37;
  --warn-soft: #fff1d6;
  --focus: #1d4ed8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 24, 32, 0.06), 0 4px 16px rgba(20, 24, 32, 0.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans Arabic", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1318;
    --surface: #171d25;
    --surface-2: #1f2731;
    --text: #e8ebf0;
    --muted: #a3acba;
    --border: #2d3743;
    --accent: #2ec4b0;
    --accent-strong: #5ad8c7;
    --accent-soft: #123a36;
    --on-accent: #06201d;
    --mine: #3a3316;
    --mine-border: #8a7424;
    --danger: #ff8a7a;
    --danger-soft: #3b1b18;
    --success: #6bd48a;
    --warn-soft: #3a2e12;
    --focus: #8ab4ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

img, svg { max-width: 100%; }

a { color: var(--accent-strong); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip-link:focus { top: 8px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 760px; }

/* ---------- header & footer ---------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}
.brand svg { width: 28px; height: 28px; flex: none; }
.site-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.site-nav a { padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.site-nav a:hover { background: var(--surface-2); }
.site-nav a.btn { color: var(--on-accent); }
@media (max-width: 520px) {
  .site-header .container { gap: 0 8px; padding-top: 6px; padding-bottom: 6px; }
  .site-nav { flex-wrap: nowrap; width: 100%; gap: 2px; overflow-x: auto; }
  .site-nav a { padding: 6px 8px; white-space: nowrap; font-size: 0.95rem; }
  .site-nav a.btn { margin-left: auto; }
}

.site-footer {
  margin-top: 64px;
  padding: 32px 0 48px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.95rem;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 12px; }
.site-footer a { color: var(--muted); }

/* ---------- typography ---------- */

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.6rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.7rem); margin-top: 1.6em; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.prose { max-width: 70ch; }
.prose li { margin-bottom: 0.4em; }

/* ---------- buttons & inputs ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--accent-strong); }
.btn { white-space: nowrap; }
.btn svg { width: 1.15em; height: 1.15em; flex: none; }
.btn.signup { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }
.btn.signup:hover { background: var(--accent); color: var(--on-accent); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--accent-strong); border-color: transparent; padding: 8px 12px; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 0.92rem; }
.btn.big { min-height: 52px; padding: 12px 24px; font-size: 1.05rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

label { display: block; font-weight: 600; margin-bottom: 4px; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.9rem; margin-top: 2px; }

input[type="text"], input[type="email"], input[type="number"], input[type="date"], input[type="time"],
input[type="password"], input[type="url"], select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
textarea { min-height: 96px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }

.field { margin-bottom: 16px; }
.field-row { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .field-row.two { grid-template-columns: 1fr 1fr; }
  .field-row.three { grid-template-columns: 1fr 1fr 1fr; }
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
  margin-bottom: 10px;
}
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--accent); }

.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- cards & layout blocks ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.stack > * + * { margin-top: 16px; }

.hero { padding: 48px 0 24px; }
.hero .btn-row { margin-top: 20px; }
.ticks { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.ticks li { display: flex; gap: 8px; align-items: center; }
.ticks svg { width: 18px; height: 18px; color: var(--success); flex: none; }

.steps { display: grid; gap: 16px; grid-template-columns: 1fr; counter-reset: step; padding: 0; list-style: none; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.steps li::before {
  counter-increment: step;
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  margin-bottom: 8px;
}

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.tile .emoji { font-size: 1.6rem; display: block; margin-bottom: 6px; }
.tile strong { display: block; margin-bottom: 4px; }
.tile span.muted { font-size: 0.92rem; }

.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.faq details + details { margin-top: 10px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details[open] summary { margin-bottom: 8px; }

.notice {
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.notice.warn { background: var(--warn-soft); border-color: var(--mine-border); }
.notice.danger { background: var(--danger-soft); border-color: var(--danger); }
.notice.success { background: var(--accent-soft); border-color: var(--accent); }
.notice h2, .notice h3 { margin-top: 0; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.full { background: var(--surface-2); color: var(--muted); }
.badge.open { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.badge.mine { background: var(--mine); border-color: var(--mine-border); color: var(--text); }

/* ---------- editor ---------- */

.slot-editor { list-style: none; margin: 0; padding: 0; }
.slot-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.slot-row-head { display: flex; gap: 8px; align-items: flex-end; }
.slot-row-head .field { flex: 1; margin: 0; }
.slot-row-head .field.needed { flex: 0 0 96px; }
.slot-row .more { margin-top: 10px; }
.slot-row .more summary { cursor: pointer; color: var(--accent-strong); font-weight: 600; font-size: 0.95rem; }
.slot-row .more .field-row { margin-top: 10px; }
.slot-tools { display: flex; gap: 2px; flex-wrap: wrap; margin-top: 8px; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  min-height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.danger:hover { color: var(--danger); }

/* ---------- sheet page ---------- */

.sheet-head { padding-top: 28px; }
.sheet-head > .notice + h1, .sheet-head > .notice + .eyebrow { margin-top: 28px; }
.sheet-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); margin-bottom: 12px; }
.sheet-meta span { display: inline-flex; align-items: center; gap: 6px; }
.sheet-meta svg { width: 18px; height: 18px; flex: none; }
.sheet-desc { white-space: pre-wrap; overflow-wrap: anywhere; }

.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

.share-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }

.date-group > h2 {
  font-size: 1.1rem;
  margin: 28px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}

.slot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.slot.is-full { background: var(--surface-2); }
.slot-top { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; }
.slot-title { font-weight: 700; font-size: 1.05rem; margin: 0; overflow-wrap: anywhere; }
.slot-time { color: var(--muted); font-size: 0.95rem; }
.slot-note { color: var(--muted); font-size: 0.95rem; margin: 4px 0 0; overflow-wrap: anywhere; }
.slot .progress { margin: 10px 0 6px; }
.slot-count { font-size: 0.9rem; color: var(--muted); }
.people { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.person {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.person.mine { background: var(--mine); outline: 1px solid var(--mine-border); }
.person .who { font-weight: 600; overflow-wrap: anywhere; }
.person .qty { color: var(--muted); font-size: 0.9rem; }
.person .pnote { flex-basis: 100%; color: var(--muted); font-size: 0.92rem; overflow-wrap: anywhere; }
.person .actions { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.slot-actions { margin-top: 12px; }

.signup-form { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }

.admin-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--accent);
  padding: 10px 0;
}
.admin-bar .container { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.admin-bar strong { color: var(--accent-strong); }

.ad-slot { margin: 24px 0; min-height: 0; text-align: center; }
.ad-slot[hidden] { display: none !important; }
.ad-label { display: block; font-size: 0.75rem; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.06em; }

.cta-card { text-align: center; }
.cta-card p { margin-left: auto; margin-right: auto; max-width: 48ch; }

.qr-box { display: grid; place-items: center; padding: 12px; background: #fff; border-radius: var(--radius-sm); }
.qr-box img, .qr-box svg { width: 220px; height: 220px; image-rendering: pixelated; }

.copy-field { display: flex; gap: 8px; }
.copy-field input { font-family: var(--mono); font-size: 0.9rem; }

dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  max-width: min(560px, calc(100vw - 32px));
  width: 100%;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
dialog::backdrop { background: rgba(10, 14, 20, 0.55); }
dialog .dialog-body { padding: 20px; }
fieldset.choices { border: 0; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 4px; accent-color: var(--accent); flex: none; }
.choice > span { display: grid; gap: 2px; }
.choice > span > span { font-weight: 400; }
dialog .dialog-foot { padding: 12px 20px 20px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.toast-region {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 480px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--text);
  color: var(--bg);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  font-weight: 600;
}
.toast.error { background: var(--danger); color: #fff; }

.loading { padding: 40px 0; color: var(--muted); }
.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

table.simple { width: 100%; border-collapse: collapse; background: var(--surface); }
table.simple th, table.simple td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
table.simple th { background: var(--surface-2); }

/* ---------- Secret Santa ---------- */
.eyebrow { margin: 0 0 4px; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }
fieldset.rules { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 16px; }
fieldset.rules legend { font-weight: 600; padding: 0 4px; }
.rule-list { list-style: none; padding: 0; margin: 4px 0 10px; display: flex; flex-direction: column; gap: 8px; }
.rule-row { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.rule-row select { width: auto; min-width: 9rem; flex: 1 1 9rem; }
.name-grid { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.name-chip {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font: inherit;
  font-weight: 700;
  text-align: center;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.name-chip:hover { background: var(--surface); }
.name-chip.taken { border-color: var(--border); background: var(--surface-2); color: var(--muted); cursor: default; font-weight: 600; }
.name-chip.taken .hint { margin: 0; font-size: 0.8rem; }
.match-card { text-align: center; }
.match-result { margin: 12px 0; }
.match-name { font-size: clamp(1.8rem, 6vw, 2.6rem); font-weight: 800; margin: 8px 0 16px; color: var(--accent-strong); overflow-wrap: anywhere; }
.match-result h3 { font-size: 1rem; margin: 0 0 6px; }
.match-result .sheet-desc { text-align: left; background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.reveal-btn { font-size: 1.15rem; }
.match-result.revealed .match-name { animation: pop 420ms ease-out; }
@keyframes pop { from { transform: scale(0.6); } 70% { transform: scale(1.08); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .match-result.revealed .match-name { animation: none; } }

.print-only { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- print: a clean paper sign-up sheet ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --text: #000; --muted: #333; --border: #999; }
  body { font-size: 12pt; }
  .site-header, .site-footer, .no-print, .admin-bar, .share-bar, .ad-slot, .slot-actions, .person .actions,
  .cta-card, .toast-region, dialog, .skip-link { display: none !important; }
  .print-only { display: block !important; }
  .slot, .card { box-shadow: none; break-inside: avoid; border-color: #999; }
  .progress { display: none; }
  .person { background: none !important; outline: none !important; padding: 2px 0; }
  .badge.mine { display: none; }
  .blank-line { display: block; border-bottom: 1px solid #555; height: 26px; margin-top: 4px; }
  a { color: #000; text-decoration: none; }
}

/* ---------- meeting polls (build 3) ---------- */

.choices-row { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .choices-row { grid-template-columns: repeat(3, 1fr); } }
fieldset.kind-options { border: 0; padding: 0; margin: 0; }
fieldset.kind-options legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.label { display: block; font-weight: 600; margin-bottom: 6px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-width: 52px; min-height: 44px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.chip.sel { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.calendar { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; background: var(--surface); max-width: 420px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-head .icon-btn { font-size: 1.4rem; line-height: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { text-align: center; font-size: 0.78rem; color: var(--muted); padding: 2px 0; }
.cal-day {
  min-height: 42px; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--surface-2);
  color: var(--text); font: inherit; cursor: pointer;
}
.cal-day:hover:not([disabled]) { border-color: var(--accent); }
.cal-day.today { border-color: var(--muted); }
.cal-day.sel { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.cal-day[disabled] { background: transparent; color: var(--muted); opacity: 0.5; cursor: default; }
details.more-options summary { cursor: pointer; color: var(--accent-strong); font-weight: 600; }

.tabs { display: flex; gap: 4px; margin-top: 20px; border-bottom: 1px solid var(--border); }
.tab {
  font: inherit; font-weight: 600; background: transparent; border: 0; border-bottom: 3px solid transparent;
  padding: 10px 14px; color: var(--muted); cursor: pointer; margin-bottom: -1px;
}
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab:hover { color: var(--text); }
.mark-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 16px; }
.save-status { margin: 0; color: var(--muted); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-strong); text-decoration: underline; cursor: pointer; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.grid-wrap { overflow-x: auto; }
.poll-grid { border-collapse: separate; border-spacing: 3px 2px; width: 100%; table-layout: fixed; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.poll-grid .corner { width: 58px; }
.poll-grid thead th { font-size: 0.8rem; font-weight: 600; text-align: center; padding: 2px 0 6px; line-height: 1.25; }
.poll-grid thead th span { display: block; }
.poll-grid thead th .dm { color: var(--muted); font-weight: 500; }
.poll-grid th.time { font-size: 0.75rem; font-weight: 500; color: var(--muted); text-align: right; padding-right: 6px; vertical-align: top; white-space: nowrap; line-height: 1; }
.poll-grid th.time .local { display: block; margin-top: 3px; font-size: 0.68rem; font-weight: 400; font-style: italic; }
.poll-grid thead th .local { margin-top: 2px; color: var(--muted); font-size: 0.68rem; font-weight: 400; font-style: italic; }
.poll-grid tr.hour td button.cell { border-top-color: var(--muted); }
.poll-grid td { padding: 0; }
.poll-grid button.cell {
  display: block; width: 100%; height: 30px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--surface-2); cursor: pointer; padding: 0;
}
@media (pointer: coarse) { .poll-grid button.cell { height: 36px; } }
.poll-grid.mark button.cell.on { background: var(--accent); border-color: var(--accent); }
.poll-grid.mark button.cell.preview-on { background: color-mix(in srgb, var(--accent) 55%, var(--surface)); border-color: var(--accent); }
.poll-grid.mark button.cell.preview-off { background: var(--surface); border-style: dashed; }
.poll-grid button.cell:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; position: relative; z-index: 1; }
/* Heat levels set a colour; the grid cells, legend swatches and day bars use it. */
.h0 { --heat: var(--surface-2); }
.h1 { --heat: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.h2 { --heat: color-mix(in srgb, var(--accent) 42%, var(--surface)); }
.h3 { --heat: color-mix(in srgb, var(--accent) 62%, var(--surface)); }
.h4 { --heat: color-mix(in srgb, var(--accent) 80%, var(--surface)); }
.h5 { --heat: var(--accent-strong); }
.poll-grid.results button.cell, .heat-legend .swatch, .day-chips .heat-bar { background: var(--heat, var(--surface-2)); }
.cell.selected { outline: 3px solid var(--text); outline-offset: 1px; position: relative; z-index: 1; }
.heat-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }
.heat-legend .swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--border); vertical-align: -2px; }
.day-chips { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.day-chips button.cell.day {
  width: 100%; min-height: 64px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.day-chips button.cell.day span { display: block; }
.day-chips button.cell.day .wd { font-weight: 700; }
.day-chips button.cell.day .dm { font-size: 0.85rem; }
.day-chips.mark button.cell.day.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.day-chips.results button.cell.day { background: var(--surface); }
.day-chips .heat-bar { width: 80%; height: 10px; border-radius: 4px; border: 1px solid var(--border); margin-top: 4px; }
.day-chips .count { font-size: 0.8rem; font-weight: 600; }
.best-times ol { margin: 0; padding-left: 1.3rem; display: grid; gap: 10px; }
.best-times li { padding-left: 4px; }
.best-times li .btn { margin-top: 6px; }
.bt-when { font-weight: 600; }
.cell-details { margin-top: 12px; }
.cell-details:focus { outline: none; }
.final-time { margin-top: 16px; }
.narrow-card { max-width: 640px; margin-left: auto; margin-right: auto; }
@media (max-width: 420px) { .site-nav a.hide-narrow { display: none; } }
