/*
 * Evite stylesheet.
 * Public pages use a festive Halloween theme (tokens on :root); admin pages
 * override those tokens via body.theme-admin for a neutral, utilitarian look.
 * Components are token-driven so a future per-event theme only needs to swap
 * the :root values.
 */

/* ---- Tokens: public (default) theme ---------------------------------- */
:root {
  --max-width: 42rem;

  /* Color */
  --bg: #17111f;
  --bg-accent: #1d1528;
  --surface: #241a33;
  --surface-2: #2f2342;
  --text: #f6f0ea;
  --text-muted: #cbb8d6;
  --primary: #ff7a1a;
  --primary-hover: #ff9038;
  --on-primary: #201206;
  --link: #ffa24d;
  --link-hover: #ffc083;
  --border: #4a3a5f;
  --focus-ring: #ffcf6b;
  --error: #ff8f8f;
  --error-bg: #3a1c24;
  --success-bg: #1f2f22;
  --success-border: #3f7d55;
  --success-text: #d7f2df;
  /* Cream callout that echoes the flyer's date banner. */
  --callout-bg: #f7ecd6;
  --callout-text: #2a1e10;
  --callout-border: #caa96a;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;

  /* Shape + type */
  --radius: 0.6rem;
  --radius-sm: 0.35rem;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.35);
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

/* ---- Tokens: admin theme override ------------------------------------ */
body.theme-admin {
  --bg: #eef1f5;
  --bg-accent: #e4e8ef;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --text: #1f2733;
  --text-muted: #5b6675;
  --primary: #2158d0;
  --primary-hover: #1b48ad;
  --on-primary: #ffffff;
  --link: #1d4ed8;
  --link-hover: #1b3ea6;
  --border: #d3d9e2;
  --focus-ring: #1d4ed8;
  --error: #b42318;
  --error-bg: #fdecec;
  --success-bg: #eaf6ee;
  --success-border: #56a06f;
  --success-text: #14532d;
  --callout-bg: #f3f5f9;
  --callout-text: #1f2733;
  --callout-border: #d3d9e2;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
  --font-display: var(--font-body);
}

/* ---- Base ------------------------------------------------------------ */
* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--link);
}
a:hover {
  color: var(--link-hover);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.2;
}

/* Visible focus for keyboard users across all interactive elements. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Skip link: hidden until focused. */
.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -3rem;
  z-index: 10;
  padding: var(--space-2) var(--space-4);
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: var(--space-3);
  color: var(--on-primary);
}

/* ---- Layout ---------------------------------------------------------- */
/* No site header/brand bar (removed per Ken); the extra top padding keeps the
   first content block off the top edge. */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-5);
  flex: 1 0 auto;
}

/* Site header and footer bars were removed per Ken; the body still flexes to
   fill the viewport and .container carries the top/bottom spacing. */

/* ---- Buttons --------------------------------------------------------- */
.btn,
button,
input[type="submit"] {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  padding: var(--space-3) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--on-primary);
  text-decoration: none;
  text-align: center;
  transition: background-color 0.15s ease;
}
.btn:hover,
button:hover,
input[type="submit"]:hover {
  background: var(--primary-hover);
  color: var(--on-primary);
}

/* Secondary / low-emphasis buttons (used for copy, inline actions). */
.btn-secondary {
  background: transparent;
  color: var(--link);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--surface-2);
  color: var(--link-hover);
}

/* ---- Forms ----------------------------------------------------------- */
.field {
  margin-bottom: var(--space-4);
}
.field label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-2);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
}
.field textarea {
  resize: vertical;
}
.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-muted);
}

/* Native select arrow styling that stays legible on the dark theme. */
.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 1.1rem) 55%, calc(100% - 0.75rem) 55%;
  background-size: 0.35rem 0.35rem, 0.35rem 0.35rem;
  background-repeat: no-repeat;
  padding-right: 2.25rem;
}

.field-hint,
small.field-hint {
  display: block;
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.form-error {
  display: block;
  margin-top: var(--space-2);
  color: var(--error);
  font-size: 0.9rem;
  font-weight: 600;
}

/* Invalid controls get a red edge (no layout shift) to reinforce the error. */
.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: 0 0 0 1px var(--error);
}
.form-error-summary {
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  background: var(--error-bg);
  border: 1px solid var(--error);
  border-radius: var(--radius-sm);
}

/* ---- Adults / kids counts (side by side) ----------------------------- */
.field-counts {
  display: flex;
  gap: var(--space-4);
}
.count-field {
  flex: 1 1 0;
  min-width: 0;
}

/* Number stepper: JS wraps each count input as [-] [input] [+]. Without JS the
   native number input (with its own spinners) is used unchanged. */
.stepper {
  display: flex;
  align-items: stretch;
}
.stepper-btn {
  flex: 0 0 auto;
  width: 2.75rem;
  padding: 0;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0;
}
.stepper-btn:hover {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}
.stepper-btn:first-child {
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
}
.stepper-btn:last-child {
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}
.stepper input[type="number"] {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper input[type="number"]::-webkit-outer-spin-button,
.stepper input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ---- Checkbox / radio option rows (tappable) ------------------------- */
/* Shared by the public RSVP bringing/hide-name controls and the admin
   visibility radios; tokens differ per theme so each reads correctly. */
.bringing-group,
.visibility-field {
  border: 0;
  padding: 0;
  margin: 0 0 var(--space-4);
  min-width: 0; /* let a fieldset shrink inside flex/grid */
}
.bringing-group legend,
.visibility-field legend {
  display: block;
  padding: 0;
  margin-bottom: var(--space-2);
  font-weight: 600;
}
.bringing-option,
.visibility-option,
.hide-name-field {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.bringing-option,
.visibility-option {
  margin-bottom: var(--space-2);
}
.bringing-option:hover,
.visibility-option:hover,
.hide-name-field:hover {
  border-color: var(--primary);
}
.bringing-option:focus-within,
.visibility-option:focus-within,
.hide-name-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--focus-ring);
}
/* Selected emphasis (progressive: browsers without :has just skip it). */
.bringing-option:has(input:checked),
.visibility-option:has(input:checked),
.hide-name-field:has(input:checked) {
  border-color: var(--primary);
}
.bringing-option input,
.visibility-option input,
.hide-name-field input {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  accent-color: var(--primary);
}
/* Override the block .field label styling for the inline option labels. */
.bringing-option label,
.visibility-option label,
.hide-name-field label {
  flex: 1 1 auto;
  margin: 0;
  font-weight: 500;
  cursor: pointer;
}
.bringing-empty {
  margin: 0;
  color: var(--text-muted);
  font-style: italic;
}

/* Admin bringing-options editor: monospace makes the one-per-line list clear. */
.bringing-options-field textarea {
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
}

/* ---- Favicon picker (admin) ------------------------------------------ */
/* Compact grid of tappable swatches. The glyph comes from the data-char
   attribute via attr() so the stylesheet stays emoji-free. */
.favicon-picker,
.theme-editor {
  border: 0;
  padding: 0;
  margin: 0 0 var(--space-4);
  min-width: 0;
}
.favicon-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
  gap: var(--space-2);
}
.favicon-picker legend,
.theme-editor legend {
  display: block;
  padding: 0;
  margin-bottom: var(--space-2);
  font-weight: 600;
}
.favicon-picker legend {
  grid-column: 1 / -1;
}
.favicon-option {
  position: relative;
  min-height: 4.25rem;
  padding-top: var(--space-2);
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
/* The actual glyph, taken from the data attribute. */
.favicon-option::before {
  content: attr(data-char);
  display: block;
  font-size: 1.7rem;
  line-height: 1.1;
}
/* Radio is visually hidden but stays in the DOM (focusable, keyboard-operable). */
.favicon-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
}
/* Label covers the whole swatch so the entire card is tappable; its text sits at
   the bottom under the glyph. */
.favicon-option label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin: 0;
  padding: var(--space-1);
  font-size: 0.68rem;
  font-weight: 500;
  cursor: pointer;
}
.favicon-option:hover {
  border-color: var(--primary);
}
.favicon-option:focus-within {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}
.favicon-option:has(input:checked) {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 2px var(--primary);
}

/* ---- Theme editor (admin) ------------------------------------------- */
.theme-editor {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: var(--space-3);
}
.theme-editor legend,
.theme-editor .field-hint {
  grid-column: 1 / -1;
}
.theme-editor .field-hint {
  margin-top: 0;
}
.theme-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.theme-field label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
}
.theme-field input[type="color"] {
  width: 100%;
  height: 2.5rem;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
}
/* "Colors from the flyer" controls, shown by main.js. */
.theme-suggest {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.theme-suggest label {
  margin: 0;
  font-weight: 600;
}
.theme-suggest select {
  width: auto;
}
.theme-suggest .field-hint {
  flex-basis: 100%;
  margin: 0;
}
.theme-suggest .field-hint:empty,
.theme-suggest [hidden] {
  display: none;
}
/* Resolved hex readout, added by main.js (progressive enhancement). */
.theme-hex {
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ---- Notices --------------------------------------------------------- */
.notice {
  padding: var(--space-4);
  border-radius: var(--radius);
  margin-bottom: var(--space-5);
}
.notice p {
  margin: 0 0 var(--space-2);
}
.notice p:last-child {
  margin-bottom: 0;
}
.notice-success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
}
.notice-success a {
  color: inherit;
}

/* Edit link must stay prominent so guests do not lose it. */
.edit-link {
  display: inline-block;
  word-break: break-all;
  font-weight: 700;
  padding: var(--space-2) var(--space-3);
  background: rgba(255, 255, 255, 0.08);
  border: 1px dashed currentColor;
  border-radius: var(--radius-sm);
}

/* Copy-to-clipboard button injected by main.js (progressive enhancement). */
.copy-btn {
  margin-left: var(--space-2);
  margin-top: var(--space-2);
  padding: var(--space-1) var(--space-3);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ---- Root / landing page -------------------------------------------- */
.home-intro {
  margin-bottom: var(--space-6);
}
.home-intro h1 {
  margin: 0 0 var(--space-3);
  color: var(--primary);
  font-size: 1.9rem;
}
.home-help {
  margin: 0 0 var(--space-2);
}
.home-help-email {
  font-weight: 700;
}
.home-events h2 {
  margin: 0 0 var(--space-4);
}
.home-event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}
.home-event-link {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
}
.home-event-link:hover {
  border-color: var(--primary);
  color: var(--text);
}
.home-event-title {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--primary);
}
.home-event-date {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---- Public event page ---------------------------------------------- */
/* The per-event theme's custom properties are injected on .event-theme-scope
   (a child of <main>), but the page background is painted on <body> outside that
   scope. So on event pages we let <main> go full width with no padding and make
   the scope the full-bleed layer that paints background:var(--bg); its direct
   children hold the centered content column. This way all themed tokens (bg,
   surface, text, border, links, controls) take effect for that page only. */
body.event-page #main {
  max-width: none;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.event-theme-scope {
  flex: 1 0 auto;
  background: var(--bg);
  color: var(--text);
  padding: var(--space-6) var(--space-4) var(--space-5);
}
.event-theme-scope > .event,
.event-theme-scope > .rsvp,
.event-theme-scope > .poll-edit-col,
.event-theme-scope > .rsvp-help-footer {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

/* When a custom theme is present, derive the few non-theme tokens the event page
   uses from the themed ones so inputs, hovers and the details panel stay
   coherent with the admin's palette (color-mix lines are progressive; the plain
   fallbacks above them apply if color-mix is unsupported). */
.event-theme-scope.is-themed {
  --surface-2: var(--surface);
  --surface-2: color-mix(in srgb, var(--surface) 92%, var(--text));
  --primary-hover: var(--primary);
  --primary-hover: color-mix(in srgb, var(--primary) 85%, #000);
  --link-hover: var(--link);
  --link-hover: color-mix(in srgb, var(--link) 80%, var(--text));
}
/* Themed pages use the palette for the details panel too (the default keeps the
   cream flyer-banner callout). */
.event-theme-scope.is-themed .event-details {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.event-theme-scope.is-themed .event-details a {
  color: var(--link);
}

.event {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-5);
  margin-bottom: var(--space-6);
}
.event-flyer-wrap {
  position: relative;
  margin-bottom: var(--space-5);
  line-height: 0; /* remove inline-image gap so the wrap hugs the flyer */
}
.event-flyer-link {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
}
.event-flyer {
  display: block;
  width: 100%;
  border-radius: var(--radius);
}
/* QR overlaid on the flyer. left/top/width are set as percentages by main.js
   (CSP blocks inline style attributes); aspect-ratio keeps the box square, so
   the overlay scales correctly on resize and in print without recompute. Hidden
   until placed so it never flashes mis-positioned (and stays hidden without JS). */
.event-flyer-qr,
.flyer-qr {
  position: absolute;
  aspect-ratio: 1 / 1;
  line-height: 0;
  visibility: hidden;
}
.event-flyer-qr.is-placed,
.flyer-qr.is-placed {
  visibility: visible;
}
.event-flyer-qr svg,
.flyer-qr svg {
  display: block;
  width: 100%;
  height: 100%;
}
.event-title {
  margin: 0 0 var(--space-2);
  font-size: 1.9rem;
  color: var(--primary);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}
.event-subtitle {
  margin: 0 0 var(--space-5);
  font-size: 1.15rem;
  color: var(--text-muted);
}

.event-details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-2) var(--space-4);
  margin: 0 0 var(--space-5);
  padding: var(--space-4);
  background: var(--callout-bg);
  color: var(--callout-text);
  border: 1px solid var(--callout-border);
  border-radius: var(--radius);
}
.event-details dt {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  padding-top: 0.15rem;
}
.event-details dd {
  margin: 0;
}
.event-details a {
  color: var(--callout-text);
  font-weight: 700;
}
.event-location-name {
  font-weight: 700;
}
.map-link {
  display: inline-block;
  margin-top: var(--space-2);
}

.event-description {
  margin-bottom: var(--space-5);
  white-space: pre-line;
}

.event-actions {
  margin: 0 0 var(--space-5);
}

/* Headcount breakout: Total / Adults / Children tiles, then the guest-list
   disclosure (native <details>, so it works without JS and is keyboard- and
   screen-reader-operable by default). */
.headcount-title {
  margin: 0 0 var(--space-3);
  font-size: 1.2rem;
}
.headcount-stats {
  list-style: none;
  margin: 0 0 var(--space-4);
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}
.headcount-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-3) var(--space-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}
.headcount-total {
  border-color: var(--primary);
}
.headcount-num {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
}
.headcount-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.guest-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.guest-list summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.75rem; /* 44px touch target */
  padding: var(--space-2) var(--space-4);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.guest-list summary::-webkit-details-marker {
  display: none;
}
/* Arrow indicator: points right when closed, down when open. */
.guest-list summary::before {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  border-top: 0.35rem solid transparent;
  border-bottom: 0.35rem solid transparent;
  border-left: 0.5rem solid currentColor;
  transition: transform 0.15s ease;
}
.guest-list[open] summary::before {
  transform: rotate(90deg);
}
.guest-list[open] summary {
  border-bottom: 1px solid var(--border);
}
.guest-list-items {
  list-style: none;
  margin: 0;
  padding: 0 var(--space-4);
}
.guest {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.guest:last-child {
  border-bottom: 0;
}
.guest p {
  margin: 0;
}
.guest-name {
  font-weight: 700;
}
.guest-name-hidden {
  font-style: italic;
  color: var(--text-muted);
}
.guest-count,
.guest-bringing {
  font-size: 0.95rem;
}
.guest-bringing-label {
  color: var(--text-muted);
}
.guest-list-empty {
  margin: 0;
  color: var(--text-muted);
}

.rsvp {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-5);
}
.rsvp h2 {
  margin-top: 0;
}
.rsvp-form button[type="submit"] {
  width: 100%;
  margin-top: var(--space-2);
  font-size: 1.05rem;
}

.event-title-ref {
  margin-top: 0;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ---- Admin ----------------------------------------------------------- */
.admin-header {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}
.admin-header h1 {
  margin: 0;
}
.admin-nav {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}
.admin-breadcrumb {
  margin-top: 0;
}
.inline-form {
  display: inline;
  margin: 0;
}

.admin-login-form,
.admin-event-form {
  max-width: 32rem;
}

/* Tables */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.admin-table th,
.admin-table td {
  padding: var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.admin-table thead th {
  background: var(--bg-accent);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.admin-table tbody tr:last-child td {
  border-bottom: none;
}
.admin-table code {
  font-size: 0.9em;
}
.event-row-closed {
  color: var(--text-muted);
}
/* Name-hidden RSVP: reads as muted italic but stays legible (AA). */
.rsvp-name-hidden {
  font-style: italic;
  color: var(--text-muted);
}
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}
.row-actions form {
  margin: 0;
}
.row-actions button {
  padding: var(--space-1) var(--space-3);
  font-size: 0.85rem;
}

/* Horizontal scroll wrapper for wide tables on small screens. */
/* position: relative keeps absolutely positioned visually-hidden labels inside
   the scroll box, so they cannot widen the page. */
.table-scroll {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---- Admin RSVP list ------------------------------------------------- */
/* Wide admin pages (the RSVP list) use most of the screen, not the narrow
   reading column. */
body.admin-wide .container {
  max-width: 88rem;
}
.rsvp-admin-header h1 {
  margin: 0 0 var(--space-1);
}
.rsvp-admin-meta {
  margin: 0 0 var(--space-5);
  color: var(--text-muted);
}
.rsvp-stats {
  list-style: none;
  margin: 0 0 var(--space-5);
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--space-3);
}
.rsvp-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.rsvp-stat-primary {
  border-top: 4px solid var(--primary);
}
.rsvp-stat-num {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
}
.rsvp-stat-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rsvp-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
  max-height: 75vh;
  overflow: auto;
}
.rsvp-table-wrap:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}
.rsvp-table {
  border: 0;
  border-radius: 0;
  font-size: 0.95rem;
}
.rsvp-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
  box-shadow: inset 0 -1px 0 var(--border);
}
.rsvp-table th,
.rsvp-table td {
  padding: var(--space-3);
  vertical-align: middle;
}
.rsvp-table tbody tr:nth-child(even) {
  background: var(--bg);
}
.rsvp-table tbody tr:hover {
  background: var(--bg-accent);
}
.rsvp-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.rsvp-cell-name {
  font-weight: 600;
  min-width: 9rem;
}
.rsvp-cell-email {
  overflow-wrap: break-word;
  min-width: 11.5rem;
}
.rsvp-cell-note {
  min-width: 8rem;
  max-width: 20rem;
  white-space: pre-line;
}
/* Dates wrap to two lines ("Sep 22, 2026," / "1:27 PM") to leave room for the
   actions column without horizontal scrolling on a laptop screen. */
.rsvp-cell-date {
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.rsvp-cell-detail {
  margin: var(--space-1) 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.rsvp-row-cancelled td {
  color: var(--text-muted);
}
.rsvp-row-cancelled .rsvp-name {
  text-decoration: line-through;
}
.chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}
.chip {
  padding: 0.15rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg-accent);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-attending {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}
.badge-cancelled {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error);
}

.badge-muted {
  margin-left: var(--space-2);
  background: var(--bg-accent);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-weight: 600;
}
.badge-removed {
  background: var(--bg-accent);
  color: var(--text);
  border: 1px solid var(--text-muted);
}
.btn-small {
  padding: var(--space-2) var(--space-3);
  min-height: 2.75rem;
  font-size: 0.875rem;
}
.rsvp-cell-actions form {
  margin: 0;
}
.rsvp-cancelled-section {
  margin-top: var(--space-5);
}
.rsvp-cancelled-section summary {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-bottom: var(--space-3);
  font-weight: 700;
  cursor: pointer;
}

/* Narrow screens: each RSVP becomes a card; the cell's data-label is shown as
   its heading so nothing needs horizontal scrolling. */
@media (max-width: 48rem) {
  .rsvp-table-wrap {
    max-height: none;
    overflow: visible;
    border: 0;
    box-shadow: none;
    background: transparent;
  }
  .rsvp-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  .rsvp-table,
  .rsvp-table tbody,
  .rsvp-table tr,
  .rsvp-table td {
    display: block;
    width: 100%;
    background: transparent;
  }
  .rsvp-table tbody tr {
    margin-bottom: var(--space-4);
    padding: var(--space-2) 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  .rsvp-table tbody tr:nth-child(even),
  .rsvp-table tbody tr:hover {
    background: var(--surface);
  }
  .rsvp-table td {
    display: grid;
    grid-template-columns: 6.5rem 1fr;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    border-bottom: 0;
    min-width: 0;
    max-width: none;
    text-align: left;
  }
  .rsvp-table .num {
    text-align: left;
  }
  /* Keep badges/chips at their natural width instead of stretching. */
  .rsvp-table td > * {
    justify-self: start;
    min-width: 0;
  }
  .rsvp-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-top: 0.15rem;
  }
}

.empty-state {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.share-block {
  margin-top: var(--space-6);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.share-block h2 {
  margin-top: 0;
}
.share-url {
  word-break: break-all;
  font-weight: 600;
}
.qr-code {
  display: inline-block;
  background: #ffffff;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.qr-code svg {
  display: block;
  width: 240px;
  max-width: 100%;
  height: auto;
}

.current-flyer {
  margin-bottom: var(--space-2);
  color: var(--text-muted);
}
.flyer-thumb {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ---- Admin QR-on-flyer placer --------------------------------------- */
.qr-flyer-field {
  border: 0;
  padding: 0;
  margin: 0 0 var(--space-4);
  min-width: 0;
}
.qr-flyer-field legend {
  display: block;
  padding: 0;
  margin-bottom: var(--space-2);
  font-weight: 600;
}
.qr-onflyer-toggle,
.qr-showonpage-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.qr-onflyer-toggle input,
.qr-showonpage-toggle input {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  accent-color: var(--primary);
}
.qr-onflyer-toggle label,
.qr-showonpage-toggle label {
  margin: 0;
  font-weight: 500;
  cursor: pointer;
}
/* The placement stage: flyer preview with the draggable ghost over it. */
.qr-placer {
  position: relative;
  max-width: 22rem;
  margin-bottom: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  line-height: 0;
  touch-action: none; /* let the drag handler own touch gestures */
}
.qr-placer-flyer {
  display: block;
  width: 100%;
}
/* Ghost box: left/top/width set as percentages by main.js from data-* / drag. */
.qr-ghost {
  position: absolute;
  top: 0;
  left: 0;
  aspect-ratio: 1 / 1;
  width: 22%; /* fallback; JS overwrites from data-qr-size */
  line-height: 0;
  cursor: grab;
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.25); /* dim the rest of the flyer */
}
.qr-ghost:active {
  cursor: grabbing;
}
.qr-ghost svg {
  display: block;
  width: 100%;
  height: 100%;
}
.qr-ghost:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}
/* When placement is off, dim the stage and disable the ghost (inputs persist). */
.qr-placer.is-disabled {
  opacity: 0.5;
}
.qr-placer.is-disabled .qr-ghost {
  display: none;
}

/* ---- Flyer view (standalone, printable) ----------------------------- */
.flyer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.flyer-stage {
  position: relative;
  max-width: 48rem;
  margin: 0 auto;
  line-height: 0;
}
.flyer-full {
  display: block;
  width: 100%;
  border-radius: var(--radius);
}
body.flyer-view #main {
  max-width: 52rem;
}

/* ---- Thank-you modal ------------------------------------------------- */
/* Display is driven by .is-open (JS also toggles the [hidden] attribute); the
   base state is display:none so it never shows before JS or after close. */
.rsvp-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(0, 0, 0, 0.62);
}
.rsvp-modal-backdrop.is-open {
  display: flex;
  animation: rsvp-modal-fade 0.16s ease-out;
}
.rsvp-modal {
  width: 100%;
  max-width: 30rem;
  max-height: calc(100vh - 2 * var(--space-4));
  overflow-y: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-5);
}
.rsvp-modal-backdrop.is-open .rsvp-modal {
  animation: rsvp-modal-pop 0.18s ease-out;
}
.rsvp-modal:focus {
  outline: none; /* dialog gets programmatic focus; children show their own ring */
}
.rsvp-modal-title {
  margin: 0 0 var(--space-3);
  color: var(--primary);
  font-size: 1.4rem;
}
.rsvp-modal-body {
  margin-bottom: var(--space-5);
  overflow-wrap: anywhere; /* long edit-link URL must not overflow */
}
.rsvp-modal-body p {
  margin: 0;
}
.rsvp-modal-body p + p,
.lookup-sent-body p + p {
  margin-top: var(--space-3);
}
.rsvp-modal-body a {
  color: var(--link);
}
/* Two-button row in the lookup dialog: Cancel + OK side by side. */
.modal-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  flex-wrap: wrap;
}
.modal-actions button {
  flex: 1 1 8rem;
  min-height: 2.75rem;
}
.rsvp-modal-close {
  width: 100%;
  font-size: 1.05rem;
}
@keyframes rsvp-modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes rsvp-modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@media (min-width: 30rem) {
  .rsvp-modal-close {
    width: auto;
    min-width: 8rem;
  }
}

/* ---- Admin settings page -------------------------------------------- */
.settings-intro {
  max-width: 44rem;
  margin-bottom: var(--space-5);
}
.settings-intro p {
  margin: 0 0 var(--space-3);
}
.admin-settings-form {
  max-width: 44rem;
}
.settings-field {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin: 0 0 var(--space-5);
  background: var(--surface);
  min-width: 0;
}
.settings-field legend {
  padding: 0 var(--space-2);
  font-weight: 700;
}
.settings-field textarea {
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}
/* Reset control: a small inline checkbox row, not a full-width field label.
   Selectors are scoped to beat the generic .field label / .field input rules. */
.settings-field .settings-reset {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  font-weight: 500;
  cursor: pointer;
}
.settings-field .settings-reset input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--primary);
}
/* Placeholder chips in hints/intro read as code. */
.settings-intro code,
.settings-field code {
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 0.85em;
  padding: 0.1em 0.35em;
  background: var(--bg-accent);
  border-radius: 3px;
}

/* WYSIWYG template editor (built by main.js around textarea[data-wysiwyg]). The
   iframe height is set by main.js via CSSOM to fit its content. */
.wysiwyg {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
.wysiwyg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--bg-accent);
  border-bottom: 1px solid var(--border);
}
.wysiwyg-btn {
  min-width: 2.75rem;
  min-height: 2.75rem; /* 44px touch target */
  padding: 0 var(--space-3);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.wysiwyg-btn:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
}
.wysiwyg-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.wysiwyg-btn.is-bold {
  font-weight: 800;
}
.wysiwyg-btn.is-italic {
  font-style: italic;
  font-family: Georgia, serif;
}
.wysiwyg-btn.is-underline {
  text-decoration: underline;
}
.wysiwyg-source-toggle {
  margin-left: auto;
}
.wysiwyg-source-toggle[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.wysiwyg-source-toggle[aria-pressed="true"]:hover:not(:disabled) {
  background: var(--primary-hover);
  color: var(--on-primary);
}
.wysiwyg-frame {
  display: block;
  width: 100%;
  height: 12.5rem;
  border: 0;
  background: #fff;
}
.settings-field .wysiwyg-source {
  display: none;
  border: 0;
  border-radius: 0;
}
.wysiwyg.is-source .wysiwyg-frame {
  display: none;
}
.settings-field .wysiwyg.is-source .wysiwyg-source {
  display: block;
}

/* Screen-reader-only text (still announced, not shown). */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Returning guest: change / cancel RSVP --------------------------- */
.rsvp-change-callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 0 0 var(--space-5);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.rsvp-change-link {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
}
/* Destructive action. Fixed colors (not theme tokens) so it reads as red on any
   event palette; white on #b42318 is 6.5:1. */
.btn-danger,
button.btn-danger {
  background: #b42318;
  border-color: #b42318;
  color: #ffffff;
}
.btn-danger:hover,
button.btn-danger:hover {
  background: #8f1c13;
  color: #ffffff;
}
.rsvp-cancel {
  margin-top: var(--space-6);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid #b42318;
  border-radius: var(--radius);
}
.rsvp-cancel h2 {
  margin-top: 0;
}
.rsvp-cancel form {
  margin: 0;
}
.notice-cancelled {
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.counts-hint {
  margin: 0 0 var(--space-2);
}

/* Section headings between template groups on the admin Settings page. */
.settings-group-title {
  margin: var(--space-6) 0 var(--space-4);
  font-size: 1.25rem;
}

/* ---- Event-page help footer ----------------------------------------- */
.rsvp-help-footer {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}
.rsvp-help-footer p {
  margin: 0;
}

/* ---- Responsive ------------------------------------------------------ */
@media (min-width: 40rem) {
  .event-title {
    font-size: 2.3rem;
  }
  .rsvp-form button[type="submit"] {
    width: auto;
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

@media (max-width: 30rem) {
  .event-details {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .event-details dt {
    margin-top: var(--space-3);
  }
  .event-details dt:first-child {
    margin-top: 0;
  }
}

/* Stack the count fields only on the very narrowest phones. */
@media (max-width: 22rem) {
  .field-counts {
    flex-direction: column;
    gap: var(--space-4);
  }
}

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

/* ---- Print (flyer view) --------------------------------------------- */
@media print {
  .skip-link,
  .no-print,
  .flyer-actions {
    display: none !important;
  }
  body.flyer-view {
    background: #fff;
  }
  body.flyer-view #main {
    max-width: none;
    padding: 0;
  }
  .flyer-stage {
    max-width: 100%;
    margin: 0;
  }
  .flyer-full {
    border-radius: 0;
  }
  /* The QR overlay is positioned in percentages, so it stays aligned when the
     flyer is scaled to the page. */
  .flyer-qr {
    visibility: visible !important;
  }
}

/* ---- Date polls ------------------------------------------------------- */
/* Answer hues are mixed into the current surface so they read on the dark
   public theme, the light admin theme and custom event themes alike. The
   answer text is always shown too; color is a supplement. */
:root {
  --ans-best: #2f9e5c;
  --ans-works: #8fb83a;
  --ans-no: #d64545;
  --ans-any: #8a8fa3;
}
.ans-best { background: color-mix(in srgb, var(--ans-best) 38%, var(--surface)); }
.ans-works { background: color-mix(in srgb, var(--ans-works) 30%, var(--surface)); }
.ans-no { background: color-mix(in srgb, var(--ans-no) 32%, var(--surface)); }
.ans-any { background: color-mix(in srgb, var(--ans-any) 22%, var(--surface)); }

/* Admin slot editor */
.poll-slots .slot-rows {
  display: grid;
  gap: var(--space-3);
  margin: var(--space-3) 0;
}
.slot-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: var(--space-2);
  align-items: end;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.slot-cell label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
}
.slot-cell input {
  width: 100%;
}
.slot-remove {
  padding: var(--space-2) var(--space-3);
}
@media (max-width: 34rem) {
  .slot-row {
    grid-template-columns: 1fr 1fr;
  }
  .slot-row .slot-cell:first-of-type {
    grid-column: 1 / -1;
  }
}
.slot-calendar {
  max-width: 22rem;
  margin: var(--space-3) 0;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.slot-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.slot-cal-title {
  font-weight: 700;
}
.slot-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}
.slot-cal-dow {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}
button.slot-cal-day {
  padding: var(--space-2) 0;
  min-height: 2.5rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
}
button.slot-cal-day:hover {
  background: var(--bg-accent);
  color: var(--text);
}
button.slot-cal-day.is-chosen {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
}

/* Public month calendar: small fixed-size months side by side; suggested days
   are filled chips, the leading day is green. */
.poll-calendar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.poll-calendar-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  margin: 0 0 var(--space-3);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.poll-calendar-key .poll-key:not(:first-child) {
  margin-left: var(--space-2);
}
.poll-key {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  margin-right: var(--space-1);
  border-radius: 3px;
  vertical-align: -0.05em;
}
.poll-key-suggested {
  background: var(--primary);
}
.poll-month {
  width: 100%;
  max-width: 17rem;
  border-collapse: separate;
  border-spacing: 2px;
  table-layout: fixed;
}
.poll-month caption {
  font-weight: 700;
  text-align: left;
  padding-bottom: var(--space-1);
}
.poll-month th {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
}
.poll-day-cell {
  height: 2.1rem;
  padding: 0;
  text-align: center;
  vertical-align: middle;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.poll-day-cell.has-slots {
  background: var(--primary);
  color: var(--on-primary);
}
.poll-day-cell.is-leading {
  background: var(--ans-best);
  color: #0b1f13;
}
.poll-day-cell a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: inherit;
  text-decoration: none;
  border-radius: inherit;
}
.poll-day-cell a:hover {
  box-shadow: inset 0 0 0 2px var(--text);
}
.poll-day-num {
  font-weight: 700;
}
.poll-day-cell:not(.has-slots) .poll-day-num {
  font-weight: 400;
}
.poll-day-cell.is-today .poll-day-num {
  font-weight: 700;
  text-decoration: underline 2px;
  text-underline-offset: 3px;
}
.poll-day-cell.is-today:not(.has-slots) {
  color: var(--text);
}

/* Public "who picked what": one card per time */
.poll-results-total {
  font-weight: 400;
  font-size: 0.9rem;
}
.poll-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}
.poll-result {
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.poll-result.is-leading {
  border-color: var(--ans-best);
  box-shadow: inset 4px 0 0 var(--ans-best);
}
.poll-result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.badge-leading {
  background: var(--ans-best);
  color: #0b1f13;
}
.poll-result-count {
  margin: var(--space-1) 0 var(--space-2);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.poll-result-count strong {
  color: var(--text);
}
.poll-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: var(--space-2);
}
.poll-dot {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
}
/* Solid answer colors for the small swatches (the .ans-* tints are too faint
   at this size). */
.poll-dot.ans-best, .poll-key.ans-best { background: var(--ans-best); }
.poll-dot.ans-works, .poll-key.ans-works { background: var(--ans-works); }
.poll-dot.ans-no, .poll-key.ans-no { background: var(--ans-no); }
.poll-dot.ans-any, .poll-key.ans-any { background: var(--ans-any); }
.poll-result-who {
  display: grid;
  gap: 2px;
  margin: 0;
  font-size: 0.85rem;
}
.poll-result-who > div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: var(--space-2);
}
.poll-result-who dt {
  font-weight: 600;
  white-space: nowrap;
}
.poll-result-who dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
.poll-bringing-title {
  margin: var(--space-4) 0 var(--space-2);
  font-size: 1rem;
}
.poll-bringing {
  margin: 0;
  padding-left: var(--space-4);
  font-size: 0.9rem;
}
.poll-overview-card {
  margin-top: var(--space-5);
}
.poll-dot.ans-none, .poll-key.ans-none {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--ans-any);
}
.poll-added-by {
  display: block;
  margin: 2px 0 0;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* Guests adding their own day: free calendar days become buttons (main.js). */
.poll-day-cell.is-past {
  opacity: 0.45;
}
.poll-day-cell .poll-day-add {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px dashed transparent;
  border-radius: inherit;
  cursor: pointer;
}
.poll-day-cell .poll-day-add:hover {
  border-color: var(--primary);
  background: transparent;
  color: var(--text);
}
.poll-day-cell.is-picked {
  box-shadow: inset 0 0 0 2px var(--primary);
  color: var(--text);
}
.poll-calendar-tip {
  flex-basis: 100%;
}
.poll-add {
  margin-top: var(--space-5);
  scroll-margin-top: var(--space-4);
}
.poll-add [hidden] {
  display: none;
}
.poll-add-rows {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-2) 0;
}
.poll-add-row {
  grid-template-columns: 1.4fr 1fr 1fr;
}
@media (max-width: 34rem) {
  .poll-add-row {
    grid-template-columns: 1fr 1fr;
  }
  .poll-add-row .slot-cell:first-of-type {
    grid-column: 1 / -1;
  }
}

/* Who-picked-what grid */
.poll-grid-wrap {
  margin-top: var(--space-3);
}
.poll-grid {
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 100%;
}
.poll-grid th,
.poll-grid td {
  padding: var(--space-2);
  border: 1px solid var(--border);
  text-align: center;
  vertical-align: middle;
}
.poll-grid .poll-grid-name {
  text-align: left;
  white-space: nowrap;
}
.poll-grid-slot span {
  display: block;
  white-space: nowrap;
}
.poll-grid-time {
  font-weight: 400;
  font-size: 0.8rem;
}
.poll-grid-slot.is-leading {
  box-shadow: inset 0 -3px 0 var(--ans-best);
}
.poll-cell {
  font-weight: 600;
  white-space: nowrap;
}
.poll-cell-total {
  font-size: 0.8rem;
  white-space: nowrap;
}
.poll-cell-no {
  display: block;
  color: var(--text-muted);
}
.poll-grid-bringing {
  text-align: left;
  min-width: 8rem;
}

/* Answer form */
.poll-answers {
  border: 0;
  padding: 0;
  margin: var(--space-5) 0;
}
.poll-answers > legend {
  font-weight: 700;
  font-size: 1.1rem;
}
.poll-day {
  margin-top: var(--space-4);
  scroll-margin-top: var(--space-4);
}
.poll-day:target .poll-day-title {
  color: var(--primary);
}
.poll-day-title {
  margin: 0 0 var(--space-2);
  font-size: 1rem;
}
.poll-slot {
  margin: 0 0 var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.poll-slot.is-leading {
  border-color: var(--ans-best);
  box-shadow: inset 4px 0 0 var(--ans-best);
}
/* Floated so the time sits inside the card as its header instead of cutting
   through the top border. */
.poll-slot-time {
  float: left;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  margin: 0 0 var(--space-2);
  padding: 0;
  font-weight: 700;
}
.poll-slot-time .poll-added-by {
  flex-basis: 100%;
  margin: 0;
}
.poll-choices {
  clear: both;
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}
@media (max-width: 30rem) {
  .poll-choices {
    grid-template-columns: repeat(2, 1fr);
  }
}
/* Visually hidden but focusable radios; the label is the tap target. */
.field .poll-choice-input {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
}
.poll-choice,
.field .poll-choice {
  display: flex;
  margin: 0;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: var(--space-2);
  min-height: 2.75rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.12s, background-color 0.12s;
}
/* A small swatch ties each button to the colors in the results above. */
.poll-choice::before {
  content: "";
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--ans-color);
}
.poll-choice.ans-best { --ans-color: var(--ans-best); }
.poll-choice.ans-works { --ans-color: var(--ans-works); }
.poll-choice.ans-no { --ans-color: var(--ans-no); }
.poll-choice.ans-any { --ans-color: var(--ans-any); }
.poll-choice:hover {
  border-color: var(--ans-color);
}
.poll-choice-input:checked + .poll-choice::before {
  background: currentColor;
}
@media (prefers-reduced-motion: reduce) {
  .poll-choice {
    transition: none;
  }
}
.poll-choice-input:checked + .poll-choice.ans-best { background: var(--ans-best); border-color: var(--ans-best); color: #fff; }
.poll-choice-input:checked + .poll-choice.ans-works { background: var(--ans-works); border-color: var(--ans-works); color: #102000; }
.poll-choice-input:checked + .poll-choice.ans-no { background: var(--ans-no); border-color: var(--ans-no); color: #fff; }
.poll-choice-input:checked + .poll-choice.ans-any { background: var(--ans-any); border-color: var(--ans-any); color: #fff; }
.poll-choice-input:focus-visible + .poll-choice {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}
.poll-choice-input[aria-invalid="true"] + .poll-choice {
  border-color: var(--error);
}
.poll-slot-summary {
  margin: var(--space-2) 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Admin poll results */
.poll-tally-table th[scope="row"] {
  font-weight: 600;
}
.poll-leading th[scope="row"] {
  box-shadow: inset 4px 0 0 var(--ans-best);
}
.poll-tally-table td.is-zero {
  color: var(--text-muted);
}
.poll-convert {
  max-width: 40rem;
  margin-bottom: var(--space-5);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ans-best);
  border-radius: var(--radius);
  background: var(--surface);
}
.poll-convert h2 {
  margin-top: 0;
}
.poll-convert [hidden] {
  display: none;
}
.poll-convert select {
  width: 100%;
}
.poll-convert .slot-row {
  margin-bottom: var(--space-3);
}
.poll-chosen {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-5);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--success-border);
  border-radius: var(--radius);
  background: var(--success-bg);
}
.poll-chosen p {
  margin: 0;
}
.admin-subnav {
  margin-top: 0;
}
