/* The app. Colors and type follow DESIGN.md (shared with the landing page): warm paper, green for
   actions and "yes", amber for "if needed", blue for the picked date, Instrument Serif for big headlines. */
@font-face {
  font-family: 'Instrument Serif';
  src: url('/fonts/instrument-serif-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-2: #f2eee6;
  --border: #e4dfd4;
  --text: #16181a;
  --muted: #55585c;
  --accent: #0b7a5c;
  --accent-ink: #ffffff;
  --accent-soft: #dcefe6;
  --yes: #0b7a5c;
  --yes-ink: #ffffff;
  --yes-soft: #dcefe6;
  --maybe: #e0a12e;
  --maybe-ink: #241a04;
  --maybe-soft: #faefd8;
  --no-bg: #55585c;
  --no-ink: #ffffff;
  --no: #b42318;
  --no-soft: #fbe6e2;
  --danger: #b42318;
  --cell-empty: #ece8df;
  --cell-line: #8f8a80;
  --heat: 11, 122, 92;
  --final: #4a63d9;
  --final-ink: #ffffff;
  --radius: 14px;
  --radius-lg: 20px;
  --lift: 0 1px 2px rgb(22 24 26 / 0.06), 0 8px 24px -12px rgb(22 24 26 / 0.18);
  --serif: 'Instrument Serif', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --display: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1112;
    --surface: #171a1c;
    --surface-2: #1f2326;
    --border: #2a2e31;
    --text: #f1eee8;
    --muted: #a6a9ad;
    --accent: #2fc497;
    --accent-ink: #06140f;
    --accent-soft: #163a2f;
    --yes: #2fc497;
    --yes-ink: #06140f;
    --yes-soft: #163a2f;
    --maybe: #e9b14a;
    --maybe-ink: #241a04;
    --maybe-soft: #3a2f16;
    --no-bg: #c9c6bf;
    --no-ink: #0f1112;
    --no: #ff8577;
    --no-soft: #3a1f1c;
    --danger: #ff8577;
    --cell-empty: #23272a;
    --cell-line: #6e7378;
    --heat: 47, 196, 151;
    --final: #7c95ff;
    --final-ink: #0f1112;
    --lift: none;
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
}
/* clear of the sticky tabs and Save bar */
html {
  scroll-padding: 72px 0 96px;
}
body {
  background: var(--bg);
  color: var(--text);
  font:
    16px/1.5 system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-wrap: break-word;
  -webkit-text-size-adjust: 100%;
}
button {
  -webkit-tap-highlight-color: transparent;
  font: inherit;
  color: inherit;
}
main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px 16px 64px;
}
h1,
h2,
h3 {
  font-family: var(--display);
  line-height: 1.15;
  margin: 0 0 8px;
  text-wrap: balance;
}
h1 {
  font-family: var(--serif);
  font-size: clamp(2.3rem, 7vw, 3.2rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 1.25rem;
  font-weight: 750;
}
h3 {
  font-size: 1rem;
  font-weight: 700;
}
p {
  margin: 0 0 8px;
}
a {
  color: var(--accent);
}
:focus-visible,
/* these draw outlines of their own */
.tabs [role='tab']:focus-visible,
.seg button:focus-visible,
button.final:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.muted {
  color: var(--muted);
}
.small,
.hint {
  font-size: 0.875rem;
}
.hint {
  color: var(--muted);
  margin: 6px 0 0;
}
.lede {
  font-size: 1.125rem;
  color: var(--muted);
  max-width: 60ch;
}
.grow {
  flex: 1;
  min-width: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.error {
  color: var(--danger);
  font-size: 0.875rem;
}
.error:empty {
  display: none;
}
.dirty {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.875rem;
}
.ok {
  color: var(--yes);
  font-weight: 600;
}
.empty {
  text-align: center;
  padding: 48px 16px;
}

/* ---------- top bar and footer ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 14px 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--text);
  text-decoration: none;
  min-height: 44px;
}
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
  padding: 24px 16px 32px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition:
    transform 0.08s,
    background 0.15s;
}
.btn:hover {
  background: var(--surface-2);
}
.btn:active {
  transform: scale(0.98);
}
.btn:disabled {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--muted);
  cursor: default;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  background: var(--accent);
  filter: brightness(1.08);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-sm {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.9rem;
}
.btn-lg {
  min-height: 52px;
  padding: 12px 26px;
  font-size: 1.05rem;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}
.link-btn {
  background: none;
  border: 0;
  padding: 4px 0;
  min-height: 44px;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* A link that looks like these buttons sits on the same line as them. */
a.link-btn {
  display: inline-flex;
  align-items: center;
}
.hint .link-btn,
.hint a {
  min-height: 0;
  padding: 0;
}
.danger {
  color: var(--danger);
}
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Pills: quick selects and toggles. Pressed pills fill with the accent. */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
}
.pill:hover {
  border-color: var(--accent);
}
.pill[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.pill-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.pill:disabled {
  opacity: 0.5;
}
.quick {
  margin-top: 12px;
}

/* Segmented control */
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  max-width: 480px;
  padding: 4px;
  gap: 4px;
  border-radius: 999px;
  background: var(--surface-2);
}
.seg button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  min-height: 40px;
  padding: 6px 10px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.seg [aria-checked='true'],
.seg [aria-pressed='true'] {
  background: var(--surface);
  box-shadow: var(--lift);
  outline: 1.5px solid var(--accent);
}
.seg button:disabled {
  opacity: 0.5;
}

/* ---------- forms ---------- */
label {
  display: block;
  font-weight: 650;
  margin: 0 0 6px;
}
input[type='text'],
input[type='email'],
input[type='url'],
input[type='number'],
input[type='time'],
input[type='date'],
textarea,
select {
  width: 100%;
  font: inherit;
  font-size: 16px; /* no zoom on focus in iOS */
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  min-height: 46px;
}
textarea {
  min-height: 80px;
  resize: vertical;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
::placeholder {
  color: var(--muted);
  opacity: 0.8;
}
/* Placeholders make way as soon as you start typing in a field; its label stays. */
:focus::placeholder {
  color: transparent;
}
.check {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 500;
  margin-top: 8px;
}
.stack,
.stack-sm {
  display: grid;
  gap: 16px;
}
.stack-sm {
  gap: 12px;
}
.inline-field {
  margin-top: 16px;
}
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.stepper input {
  width: 72px;
  text-align: center;
  font-family: var(--display);
  font-weight: 700;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0;
  cursor: pointer;
  min-height: 44px;
}
.switch input {
  appearance: none;
  width: 42px;
  height: 26px;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  flex: none;
}
.switch input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.switch input:checked {
  background: var(--accent);
}
.switch input:checked::after {
  transform: translateX(16px);
}
details.reveal summary,
details.tz-line summary,
details.organizer summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}
details summary::-webkit-details-marker {
  display: none;
}
details.reveal summary::before,
details.tz-line summary::before,
details.organizer summary::before {
  content: '+';
  font-family: var(--display);
  font-weight: 800;
}
details.reveal[open] summary::before,
details.tz-line[open] summary::before,
details.organizer[open] summary::before {
  content: '−';
}

/* ---------- sheets ---------- */
.sheet {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}
.sheet > h2 {
  margin-bottom: 14px;
}
.sheet > * + div,
.sheet > * + details {
  margin-top: 14px;
}
.sheet-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.sheet-head h2 {
  margin: 0;
}
.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.emoji-tile {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  background: var(--accent-soft);
}
.emoji-tile.big {
  width: 72px;
  height: 72px;
  font-size: 2.4rem;
  border-radius: 22px;
}
/* The poll's own picture (poll-image.js), in place of its emoji. */
.emoji-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
/* ---------- avatars ---------- */
.av {
  --size: 32px;
  width: var(--size);
  height: var(--size);
  flex: none;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: calc(var(--size) * 0.36);
  letter-spacing: -0.02em;
  font-weight: 750;
  font-family: var(--display);
  color: #fff;
  background: oklch(46% 0.13 var(--h, 280));
  border: 2px solid var(--surface);
}
.av-sm {
  --size: 28px;
}
.av-xs {
  --size: 22px;
  border-width: 1.5px;
}
.av-more {
  background: var(--surface-2);
  color: var(--text);
}
.stack-av {
  display: inline-flex;
}
.stack-av .av + .av {
  margin-left: -6px;
}

/* ---------- poll page ---------- */
.poll {
  max-width: 1080px;
  margin: 0 auto;
}
.poll-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 12px 0 20px;
}
.poll-head h1 {
  margin-bottom: 6px;
}
.poll-head-text {
  overflow-wrap: anywhere;
}
.poll-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}
.host,
.answered {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.where,
.note {
  margin: 10px 0 0;
}
.note {
  white-space: pre-wrap;
  max-width: 65ch;
}
.poll-share {
  grid-column: 1 / -1;
}
.poll-share .btn {
  width: 100%;
}
@media (min-width: 700px) {
  .poll-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .poll-share {
    grid-column: auto;
  }
}

/* Tabs on phones; side by side on wide screens */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-2);
  margin-bottom: 16px;
  position: sticky;
  top: 8px;
  z-index: 4;
}
.tabs [role='tab'] {
  flex: 1;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}
.tabs [aria-selected='true'] {
  background: var(--surface);
  box-shadow: var(--lift);
  outline: 1.5px solid var(--accent);
}
.count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.8rem;
  margin-left: 4px;
}
.count:empty {
  display: none;
}
.panel:not(.active) {
  display: none;
}
@media (min-width: 1000px) {
  .tabs {
    display: none;
  }
  .panels {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 20px;
    align-items: start;
  }
  .panel:not(.active) {
    display: block;
  }
}
.panel-title {
  margin-bottom: 14px;
}
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin: 14px 0;
}
.quick-actions .pill {
  padding: 8px 12px;
  font-size: 0.95rem;
}
.quick-actions .pill-quiet {
  padding: 8px 6px;
}

/* Rows to answer: date block, what, tally, vote */
.rows {
  display: grid;
  gap: 8px;
  container-type: inline-size;
}
.row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 4px 12px;
  align-items: center;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1.5px solid transparent;
}
.row.same-day {
  margin-top: -4px;
}
.row[data-v='2'] {
  background: var(--yes-soft);
  border-color: var(--yes);
}
.row[data-v='1'] {
  background: var(--maybe-soft);
  border-color: var(--maybe);
}
/* An explicit "no" is red, so it never looks like a row that hasn't been answered yet. */
.row[data-v='0'] {
  background: var(--no-soft);
  border-color: var(--no);
}
.row.final {
  outline: 2.5px solid var(--final);
}
.date-block {
  grid-row: span 2;
  display: grid;
  justify-items: center;
  line-height: 1.05;
  font-family: var(--display);
}
.date-block b {
  font-size: 1.55rem;
  font-weight: 800;
}
.date-block small {
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--muted);
}
.row-when {
  font-family: var(--display);
  font-weight: 750;
  font-size: 1.05rem;
}
.row-note {
  font-size: 0.875rem;
  color: var(--muted);
}
.row-tally {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 0;
}
.row-tally:empty {
  display: none;
}
.vote {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 6px;
}
.vote button {
  min-height: 44px;
  padding: 0 6px;
  white-space: nowrap;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.vote .v-yes[aria-checked='true'] {
  background: var(--yes);
  border-color: var(--yes);
  color: var(--yes-ink);
}
.vote .v-maybe[aria-checked='true'] {
  background: var(--maybe);
  border-color: var(--maybe);
  color: var(--maybe-ink);
}
.vote .v-no[aria-checked='true'] {
  background: var(--no);
  border-color: var(--no);
  color: var(--surface);
}
@container (max-width: 420px) {
  .vote [aria-hidden='true'] {
    display: none;
  }
}
/* Rows lay out by their own width: buttons beside the time when there's room, below it otherwise. */
@container (min-width: 600px) {
  .row {
    grid-template-columns: 52px minmax(0, 1fr) auto;
  }
  .vote {
    grid-column: 3;
    grid-row: 1 / span 2;
    margin-top: 0;
    width: 300px;
  }
}
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--final);
  color: var(--final-ink);
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: middle;
}
.mine-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.save-bar {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 16px -20px -20px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1.5px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Best options */
.best-hero {
  border-radius: var(--radius-lg);
  padding: 20px;
  background: var(--accent-soft);
}
.best-hero.final {
  outline: 2.5px solid var(--final);
}
.best-when {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.7rem, 5vw, 2.1rem);
  line-height: 1.2;
  margin-bottom: 10px;
}
.best-who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.best-who.small {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 4px;
}
.sub {
  margin: 20px 0 6px;
  color: var(--muted);
  font-size: 0.95rem;
}
ol.best {
  list-style: none;
  margin: 0;
  padding: 0;
}
ol.best li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1.5px solid var(--border);
}
ol.best .when {
  font-weight: 700;
}
.empty-state {
  text-align: center;
  padding: 8px 0;
}
.empty-state p {
  max-width: 40ch;
  margin: 12px auto;
  color: var(--muted);
}
.venn-art {
  display: inline-flex;
  height: 56px;
}
.venn-art i {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2.5px dashed var(--border);
}
.venn-art i + i {
  margin-left: -20px;
}

/* Everyone */
.people,
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 4px;
  min-height: 32px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.9rem;
  font-weight: 600;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.chip.person {
  cursor: pointer;
  min-height: 44px;
  padding-right: 14px;
  border: 1.5px solid transparent;
}
.chip.person:has([aria-pressed='true']) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
/* The name is its own button, with the remove button beside it. */
.chip.person .person-btn {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  color: inherit;
  font-size: inherit;
  min-height: 36px;
  min-width: 0;
  text-align: left;
}
.badge-final {
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}
.chip button {
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--muted);
  min-width: 28px;
  min-height: 28px;
  padding: 0;
}
.chip.yes {
  background: var(--yes-soft);
}
.chip.maybe {
  background: var(--maybe-soft);
}
.chip.no {
  opacity: 0.7;
}
.matrix-scroll {
  position: relative; /* keeps screen-reader-only labels inside the scroll box */
  overflow-x: auto;
  margin: 0 -20px;
  padding: 0 20px 4px;
  /* fades at the edge: there's more */
  mask-image: linear-gradient(to left, transparent, #000 20px);
}
.matrix-scroll:focus-visible {
  mask-image: none;
}
.matrix {
  border-collapse: separate;
  border-spacing: 3px;
  font-size: 0.9rem;
}
.matrix th {
  font-weight: 600;
  text-align: center;
  padding: 4px 6px;
  white-space: nowrap;
}
.matrix thead th {
  font-size: 0.8rem;
  vertical-align: bottom;
}
.matrix thead span {
  display: block;
}
.m-day {
  color: var(--muted);
}
.m-date {
  font-family: var(--display);
  font-weight: 750;
  font-size: 0.95rem;
}
.m-time {
  color: var(--muted);
}
.matrix tbody th,
.matrix tfoot th {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
}
.matrix tbody th {
  display: flex;
  align-items: center;
  gap: 8px;
}
.matrix td {
  min-width: 44px;
  height: 36px;
  text-align: center;
  border-radius: 8px;
  font-weight: 800;
}
.m-yes {
  background: var(--yes);
  color: var(--yes-ink);
}
.m-maybe {
  background: var(--maybe);
  color: var(--maybe-ink);
}
.m-no {
  background: var(--no-soft);
  color: var(--no);
}
.matrix thead th.top,
.matrix tfoot td.top {
  color: var(--yes);
}
.matrix .final {
  outline: 2px solid var(--final);
  outline-offset: -2px;
}
.matrix tr.focus th {
  color: var(--accent);
}

/* Hours grid (paint and heatmap) */
.brush {
  margin-bottom: 4px;
}
.brush button {
  white-space: nowrap;
  padding: 6px 8px;
}
.swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  display: inline-block;
}
.swatch-yes {
  background: var(--yes);
}
.swatch-maybe {
  background: var(--maybe);
}
.swatch-no {
  background: var(--cell-empty);
  border: 1px solid var(--cell-line);
}
.grid-scroll {
  position: relative;
  overflow-x: auto;
  margin: 8px -4px 0;
  padding: 0 4px 4px;
}
.grid {
  display: grid;
  gap: 2px;
  user-select: none;
  -webkit-user-select: none;
  width: max-content;
  min-width: 100%;
}
/* A mouse drags across cells to paint. On touch screens a swipe scrolls and a tap marks one time. */
.grid:not(.readonly) .cell {
  touch-action: none;
}
@media (pointer: coarse) {
  .grid:not(.readonly),
  .grid:not(.readonly) .cell {
    touch-action: pan-y;
  }
}
.grid .day-label {
  font-size: 0.75rem;
  text-align: center;
  line-height: 1.2;
  padding-bottom: 4px;
}
.grid .day-fill {
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.75rem;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.grid .day-fill:hover {
  background: var(--surface-2);
}
.grid .day-label b {
  display: block;
  font-family: var(--display);
  font-size: 0.85rem;
}
.grid .time-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: right;
  padding-right: 6px;
  line-height: 1;
  transform: translateY(-4px);
  white-space: nowrap;
}
.cell {
  height: 20px;
  min-width: 38px;
  border-radius: 5px;
  background: var(--cell-empty);
  border: 1px solid var(--cell-line);
  cursor: pointer;
}
.cell.hour {
  box-shadow: inset 0 1px 0 rgba(127, 127, 127, 0.25);
}
.cell.void,
.cell.yes,
.cell.maybe {
  border-color: transparent;
}
.cell.void {
  background: transparent;
  cursor: default;
}
.cell.yes {
  background: var(--yes);
}
.cell.maybe {
  background: var(--maybe);
}
.cell.final {
  outline: 2px solid var(--final);
  outline-offset: -2px;
}
.cell.active {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}
.cell:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 10px;
}
.heat-scale {
  display: inline-flex;
  gap: 2px;
  vertical-align: middle;
}
.heat-scale span {
  width: 14px;
  height: 10px;
  border-radius: 3px;
}
.hover-info {
  margin-top: 12px;
  min-height: 48px;
}

/* The picked date: one small celebration */
.banner-final {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  margin-bottom: 16px;
  background: var(--yes);
  color: var(--yes-ink);
}
.banner-final > * {
  position: relative;
  z-index: 1;
}
.banner-final h2 {
  font-family: var(--serif);
  font-size: clamp(2rem, 6vw, 2.8rem);
  font-weight: 400;
  margin: 0;
}
.banner-final .kicker {
  font-weight: 700;
  margin: 0 0 4px;
}
.banner-final .link-btn {
  color: inherit;
}
.final-more {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0 20px;
  margin-top: 8px;
}
/* The organizer's one big next step once the date is set: telling everyone. */
.final-tell {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.final-tell .btn {
  width: 100%;
  background: var(--surface);
  color: var(--accent);
  border-color: transparent;
}
.final-tell .btn:hover {
  background: var(--surface-2);
}
.final-extras summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.final-extras summary::after {
  content: ' ▾';
  white-space: pre;
}
.final-extras[open] summary::after {
  content: ' ▴';
}
.final-extras-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 20px;
}
.poll-share[hidden] {
  display: none;
}
.banner-final::before,
.banner-final::after {
  content: '';
  position: absolute;
  right: -30px;
  top: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  pointer-events: none;
}
.banner-final::after {
  right: 60px;
  top: 10px;
  background: rgba(255, 255, 255, 0.1);
}
.celebrate::before,
.celebrate::after {
  animation: venn-pop 0.9s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.celebrate::after {
  animation-delay: 0.12s;
}
.celebrate h2 {
  animation: rise 0.5s ease-out both;
}
@keyframes venn-pop {
  from {
    transform: scale(0.2);
    opacity: 0;
  }
}
@keyframes rise {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}
details.organizer {
  border-radius: var(--radius-lg);
  padding: 8px 20px 16px;
  margin-bottom: 16px;
  background: var(--accent-soft);
}
details.organizer summary {
  color: var(--text);
  font-weight: 500;
  display: block;
  padding: 10px 0 2px;
}
details.organizer summary::before {
  margin-right: 6px;
}
details.organizer summary b {
  font-weight: 750;
}
.tz-line {
  margin-top: 8px;
  color: var(--muted);
}
.tz-line summary {
  font-size: 0.9rem;
}
.tz-line select {
  max-width: 360px;
}

/* AI */
.ai-panel,
.ai-card {
  border-radius: var(--radius);
  padding: 14px;
  margin: 0 0 14px;
  background: var(--accent-soft);
}
.ai-rec {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}
#privacy-box h3 {
  margin: 24px 0 4px;
}
.email-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
  display: grid;
  gap: 6px;
}
.email-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  overflow-wrap: anywhere;
}
.secret-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  font-size: 0.875rem;
}
.secret-row code {
  word-break: break-all;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  z-index: 20;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
  max-width: calc(100vw - 32px);
  width: max-content;
  text-align: center;
}
#toast:empty {
  padding: 0;
}

@media (max-width: 520px) {
  .sheet {
    padding: 18px 16px;
  }
  .occasions {
    margin: 0 -16px;
    padding: 2px 16px 4px;
  }
  .matrix-scroll {
    margin: 0 -16px;
    padding: 0 16px 4px;
  }
  .matrix tbody th {
    max-width: 104px;
  }
  .matrix tbody th > :last-child {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .save-bar {
    margin: 16px -16px -18px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .ai-row {
    flex-direction: column;
    align-items: stretch;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- calendar picker: week / day / month ---------- */
.tv-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 12px;
}
.tv-views {
  min-width: 220px;
}
.tv-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tv-label {
  font-weight: 650;
  min-width: 110px;
  text-align: center;
}
.tv-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -4px 12px;
  padding: 2px 4px;
}
.tv-chip {
  position: relative; /* keeps its screen-reader-only text inside the strip */
  flex: 1 0 44px;
  min-height: 56px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  line-height: 1.1;
}
.tv-chip small {
  font-size: 0.75rem;
  color: var(--muted);
}
.tv-chip b {
  font-size: 1.05rem;
}
.tv-chip i {
  font-style: normal;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
}
.tv-chip[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.tv-chip[aria-pressed='true'] small,
.tv-chip[aria-pressed='true'] i {
  color: inherit;
}
.tv-chip:disabled {
  opacity: 0.4;
}

.tg {
  --row: 24px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.tg-head,
.tg-body {
  display: grid;
  grid-template-columns: 52px repeat(var(--cols), minmax(0, 1fr));
}
.tg-head {
  border-bottom: 1.5px solid var(--border);
  background: var(--surface-2);
}
.tg-day {
  text-align: center;
  font: inherit;
  font-size: 0.8rem;
  padding: 6px 2px;
  line-height: 1.2;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  min-width: 0;
}
/* A day at the top of the week opens it on its own. */
.tg-day:hover {
  color: var(--accent);
  text-decoration: underline;
}
.tg-day b {
  display: block;
  font-size: 0.85rem;
}
.tg-scroll {
  max-height: 460px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.tg-times,
.tg-col {
  position: relative;
  height: calc(var(--rows) * var(--row));
}
.tg-times span {
  position: absolute;
  right: 8px;
  transform: translateY(-50%);
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}
.tg-times span:first-child {
  transform: none;
}
.tg-col {
  border-left: 1px solid var(--border);
  /* a line every hour, a fainter one every half hour */
  background-image:
    linear-gradient(to bottom, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--border) 45%, transparent) 1px, transparent 1px);
  background-size:
    100% calc(var(--row) * 2),
    100% var(--row);
}
.tg-draw {
  cursor: crosshair;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.tg-block,
.tg-busy {
  position: absolute;
  left: 3px;
  right: 3px;
  box-sizing: border-box;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 3px 6px;
  overflow: hidden;
  text-align: left;
}
.tg-block {
  border: 1.5px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 0;
}
/* "Available" or "If needed", under the time */
.tg-block small {
  font-weight: 600;
  font-size: 0.7rem;
  opacity: 0.95;
}
.tg-block span {
  overflow: hidden;
  overflow-wrap: anywhere;
}
.tg-ghost {
  background: var(--accent-soft);
  color: var(--text);
  border-style: dashed;
  pointer-events: none;
}
.tg-busy {
  background: repeating-linear-gradient(
    -45deg,
    var(--surface-2),
    var(--surface-2) 6px,
    var(--cell-empty) 6px,
    var(--cell-empty) 12px
  );
  color: var(--muted);
  font-weight: 600;
  right: 40%;
}
/* Guests: options coloured by their answer */
.tg-block.ans-none {
  background: var(--surface);
  color: var(--text);
  border-style: dashed;
}
.tg-block.ans-2 {
  background: var(--yes);
  border-color: var(--yes);
  color: var(--yes-ink);
}
.tg-block.ans-1 {
  background: var(--maybe);
  border-color: var(--maybe);
  color: var(--maybe-ink);
}
.tg-block.ans-0 {
  background: var(--no-soft);
  border-color: var(--no);
  color: var(--no);
  text-decoration: line-through;
}
.cal-day.marked small {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
}
.cal-day[aria-current='date'] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.cal-day.marked {
  display: grid;
  place-content: center;
}
.pill.part small {
  font-weight: 500;
}
.opt-list:not(:empty) {
  margin-top: 16px;
}
.opt-list h3 {
  margin-bottom: 8px;
}
.opt-list .chip {
  padding: 4px 4px 4px 12px;
}
@media (max-width: 520px) {
  .tg {
    --row: 28px;
  }
  .tg-head,
  .tg-body {
    grid-template-columns: 52px repeat(var(--cols), minmax(0, 1fr));
  }
  .tv-views {
    width: 100%;
  }
}

/* Guests: list or calendar */
.mine-view {
  margin: 0 0 14px;
}
/* Parts of the day: a button per part, tap to cycle free → if needed → clear */
.parts-row {
  align-items: start;
}
.parts-row .date-block {
  grid-row: auto;
}
.part-votes {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}
.part-vote {
  display: grid;
  justify-items: start;
  gap: 1px;
  min-height: 64px;
  padding: 8px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  line-height: 1.2;
}
.part-vote small {
  font-size: 0.78rem;
  color: var(--muted);
}
.pv-state {
  font-size: 0.78rem;
  font-weight: 700;
  min-height: 1em;
  white-space: nowrap;
}
/* Three across on a 375px phone: "Afternoon" and "✓ Available" still fit. */
.part-vote b {
  font-size: min(1rem, 4vw);
}
.part-vote[data-v='2'] {
  background: var(--yes);
  border-color: var(--yes);
  color: var(--yes-ink);
}
.part-vote[data-v='1'] {
  background: var(--maybe);
  border-color: var(--maybe);
  color: var(--maybe-ink);
}
.part-vote[data-v='no'] {
  background: var(--no);
  border-color: var(--no);
  color: var(--surface);
}
.part-vote[data-v='2'] small,
.part-vote[data-v='1'] small,
.part-vote[data-v='no'] small {
  color: inherit;
}
.part-vote.final {
  outline: 2.5px solid var(--final);
}
.heat-table {
  border-collapse: separate;
  border-spacing: 4px;
  width: 100%;
}
.heat-table th {
  font-size: 0.85rem;
  font-weight: 650;
  text-align: left;
  white-space: nowrap;
}
.heat-table thead th {
  text-align: center;
  color: var(--muted);
}
.heat-btn {
  width: 100%;
  min-height: 44px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: rgba(var(--heat), calc(0.08 + 0.5 * var(--a)));
  font-weight: 800;
  cursor: pointer;
}
.heat-btn.active {
  border-color: var(--text);
}
/* Available, if needed and unavailable, in proportion, under each count. */
.heat-bar {
  display: flex;
  gap: 2px;
  height: 6px;
  margin: 4px 6px 0;
  border-radius: 3px;
  overflow: hidden;
}
.heat-bar i,
.legend .sw {
  background: var(--yes);
}
.heat-bar .m,
.legend .sw-m {
  background: var(--maybe);
}
.heat-bar .n,
.legend .sw-n {
  background: var(--no);
}
.legend .sw {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin: 0 4px 0 6px;
  vertical-align: -1px;
}
.legend .sw:first-child {
  margin-left: 0;
}
.heat-btn.final {
  outline: 2.5px solid var(--final);
}

/* ---------- guests: what I've picked, and calendar coming soon ---------- */
.my-picks {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
}
.my-picks p {
  margin: 0 0 8px;
}
.my-picks p:last-child {
  margin: 0;
}
/* Not ready to save yet (no name, or nothing picked): an outline, so it reads as not done. */
#save[data-ready='false'] {
  background: var(--surface);
  color: var(--accent);
}
/* "All day": one tap marks every part of the day */
.parts-row .row-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
}
.all-day {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
}
.ad-mark {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--cell-line);
  font-size: 0.8rem;
  line-height: 1;
}
.all-day[data-v='2'] {
  background: var(--yes);
  border-color: var(--yes);
  color: var(--yes-ink);
}
.all-day[data-v='1'] {
  background: var(--maybe);
  border-color: var(--maybe);
  color: var(--maybe-ink);
}
.all-day[data-v='no'] {
  background: var(--no);
  border-color: var(--no);
  color: var(--surface);
}
.all-day[data-v='2'] .ad-mark,
.all-day[data-v='1'] .ad-mark,
.all-day[data-v='no'] .ad-mark {
  border-color: currentColor;
}
.all-day[data-v='some'] {
  border-color: var(--accent);
  border-style: dashed;
}
.best-hero .names,
.best .names {
  margin: 6px 0 0;
  font-weight: 600;
}
.best .names {
  font-size: 0.9rem;
}
.grow-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.grow-card p {
  margin: 0;
  flex: 1 1 240px;
}

/* ---------- notifications: email first, then custom ---------- */
.notify-way {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin: 0;
  min-width: 0;
}
.notify-way legend,
.notify-way > summary {
  font-weight: 750;
  padding: 0 4px;
}
.notify-way > summary {
  cursor: pointer;
  min-height: 32px;
}
.notify-way.custom[open] > summary {
  margin-bottom: 12px;
}
.dev {
  margin-top: 12px;
}
.dev summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--accent);
  min-height: 32px;
}

/* Touch: 44px tap targets */
@media (pointer: coarse) {
  .btn-sm,
  .seg button,
  .footer a,
  .notify-way > summary,
  .dev summary {
    min-height: 44px;
  }
  .footer a {
    display: inline-flex;
    align-items: center;
  }
  .chip button:not(.chip-flip) {
    min-width: 44px;
    min-height: 44px;
    margin: -4px;
  }
  .cell {
    height: 32px;
  }
}
pre.code {
  overflow-x: auto;
  max-width: 100%;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 0.8rem;
  line-height: 1.45;
}

/* ---------- top bar: start a new poll ---------- */
.btn-new {
  border-color: var(--accent);
  color: var(--accent);
}
.hview-h {
  margin: 0 0 6px;
  font-weight: 650;
}
.hview {
  margin-bottom: 4px;
}
#quick-hours > .hint {
  margin: 4px 0 2px;
}
.quick-votes {
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}
.part-vote[data-v='some'] {
  border-style: dashed;
  border-color: var(--accent);
}

/* Blocks on the week: drag an edge to change the length; "if needed" options are amber. */
.tg-handle {
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  cursor: ns-resize;
  touch-action: none;
}
.tg-handle::after {
  content: '';
  position: absolute;
  top: 4px;
  left: calc(50% - 9px);
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.55;
}
.tg-top {
  top: -2px;
}
.tg-bottom {
  bottom: -2px;
}
/* The × to remove a block: on hover (mouse), always on touch screens. */
.tg-x-box {
  position: absolute;
  pointer-events: none;
  z-index: 3;
}
.tg-x {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.12s;
}
.tg-block:hover + .tg-x-box .tg-x,
.tg-x:hover,
.tg-x:focus-visible {
  opacity: 1;
}
.tg-x:hover {
  background: var(--no);
  border-color: var(--no);
  color: #fff;
}
.tg-block.opt:hover {
  filter: brightness(0.92);
}
@media (hover: none) {
  .tg-x {
    opacity: 1;
  }
}
.chip button:hover {
  color: var(--no);
}
.tg-block.opt-maybe {
  background: var(--maybe);
  border-color: var(--maybe);
  color: var(--maybe-ink);
}
.pick-brush {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

/* "Submit your answer?": who it's from and what it says, before it goes in */
.submit-check {
  width: min(420px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  box-sizing: border-box;
  padding: 24px;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.3);
}
.submit-check::backdrop {
  background: rgb(0 0 0 / 0.45);
}
.submit-check h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}
.submit-check p {
  margin: 0 0 12px;
}
.sc-picks .chips {
  margin-bottom: 4px;
}
.sc-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.sc-actions .btn {
  min-height: 48px;
  width: 100%;
}
