/* ── board ────────────────────────────────────────────────────────────────── */

.poll-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-bottom: 22px; }
.poll-filter { display: grid; gap: 6px; }
.poll-filter > span { color: var(--muted); font-size: var(--text-label); font-weight: 700; letter-spacing: var(--tracking-label); text-transform: uppercase; }
.poll-filter input[type="search"] {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper-raised);
  color: var(--ink);
  font-size: var(--text-body);
}
.poll-filter input[type="search"]:focus { border-color: var(--blue); outline: none; }
.poll-search { flex: 1 1 260px; }
.poll-search input { width: 100%; }
.poll-toolbar .button.filled { margin-left: auto; }

.poll-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--panel-gap); }
.poll-board-empty { grid-column: 1 / -1; margin: 0; padding: 46px 0; color: var(--muted); text-align: center; font: 400 17px/1.4 var(--serif); }

.poll-card {
  display: block;
  width: 100%;
  padding: 20px 18px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper-raised);
  box-shadow: 0 9px 28px rgba(34, 31, 25, .045);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.poll-card:hover, .poll-card:focus-visible { transform: translateY(-2px); box-shadow: 0 14px 26px rgba(34, 31, 25, .1); outline: none; }
.poll-card-eyebrow { margin: 0 0 7px; color: var(--muted); font-size: var(--text-label); font-weight: 700; letter-spacing: var(--tracking-label); text-transform: uppercase; }
.poll-card h3 { margin: 0 0 6px; font: 400 21px/1.15 var(--serif); letter-spacing: -.015em; }
.poll-card-description { margin: 0; color: var(--muted); font-size: var(--text-reading); line-height: 1.45; }
.poll-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--text-meta); }

/* ── editor page ──────────────────────────────────────────────────────────── */

.poll-editor-page { padding-top: 6px; }
/* .button sets its own display, which otherwise beats the native [hidden]
   rule at equal specificity — same fix as notebook.css's guard. */
.poll-editor-page [hidden] { display: none; }
.poll-back {
  margin-bottom: 18px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--text-body);
}
.poll-back:hover { color: var(--blue); }
.poll-editor-form { display: grid; gap: 18px; }
.poll-editor-questions { display: grid; gap: 16px; }
.poll-editor-error { min-height: 18px; margin: 0; color: var(--red); font-size: var(--text-control); }
.poll-editor-spacer { flex: 1; }

.poll-question-block { display: grid; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 3px; background: var(--paper); }
.poll-question-head { display: flex; align-items: flex-end; gap: 10px; }
.poll-question-type-field { width: 220px; }
.poll-question-hint { margin: 0; color: var(--muted); font-size: var(--text-meta); }
.poll-option-list, .poll-group-list { display: grid; gap: 8px; }
.poll-option-row, .poll-group-row { display: flex; align-items: center; gap: 6px; }

/* A clearly-boxed field, distinct from the page's own title/description
   fields (which keep the app-wide underline look) — this editor is a dense
   stack of same-looking rows, and an underline alone read as flat here. */
.poll-editor-page .field input,
.poll-editor-page .field select,
.poll-editor-page .field textarea,
.poll-line-input {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper-raised);
}
.poll-editor-page .field input:focus,
.poll-editor-page .field select:focus,
.poll-editor-page .field textarea:focus,
.poll-line-input:focus {
  border-color: var(--blue);
}
.poll-line-input { flex: 1; color: var(--ink); font-size: var(--text-body); }

.poll-availability-mode { margin-bottom: 16px; }
/* Both boxes are sized to their own content (a calendar/weekday row has a
   natural width; a time field doesn't want to be 800px wide) and sit side
   by side — not stretched across a grid track wider than either needs,
   which left a dead gap between the calendar and the time fields and blew
   the weekday row's cells out into thin rectangles. */
.poll-availability-layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 28px; }
.poll-availability-picker { flex: 0 0 auto; width: min(320px, 100%); }
.poll-availability-time { flex: 0 0 auto; width: min(200px, 100%); display: grid; gap: 14px; }
.poll-calendar { width: 100%; }
.poll-weekday-picker { display: flex; gap: 6px; }
.poll-weekday-picker .poll-calendar-cell { flex: 1; aspect-ratio: 1; height: auto; }
.poll-calendar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.poll-calendar-label { font-weight: 600; font-size: var(--text-body); }
.poll-calendar-weekdays, .poll-calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.poll-calendar-weekdays { margin-bottom: 4px; }
.poll-calendar-weekdays span { color: var(--muted); font-size: var(--text-meta); text-align: center; }
.poll-calendar-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper-raised);
  color: var(--ink);
  cursor: pointer;
  font-size: var(--text-body);
}
.poll-calendar-cell.is-empty { visibility: hidden; }
.poll-calendar-cell:hover:not(:disabled) { border-color: var(--blue); }
.poll-calendar-cell.is-selected { border-color: var(--blue); background: var(--blue); color: white; }
.poll-calendar-cell:disabled { color: var(--muted); cursor: default; opacity: .35; }

/* ── poll sheet (voting / results) ───────────────────────────────────────── */

.poll-dialog { width: min(var(--dialog-lg), calc(100% - 16px)); }
.poll-sheet { position: relative; max-height: min(1040px, calc(100dvh - 16px)); overflow-y: auto; padding: 34px 34px 30px; background: var(--paper-raised); }
.poll-dialog-close { position: absolute; top: 12px; right: 12px; }
.poll-sheet-eyebrow { margin: 0; color: var(--muted); font-size: var(--text-label); font-weight: 700; letter-spacing: var(--tracking-label); text-transform: uppercase; }
.poll-sheet-head h2 { margin: 4px 0 6px; font: 400 34px/1.03 var(--serif); letter-spacing: -.02em; }
.poll-sheet-description { margin: 0 0 6px; color: var(--ink); font-size: var(--text-reading); }
.poll-sheet-byline { margin: 0; color: var(--muted); font-size: var(--text-body); }
.poll-sheet-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.poll-sheet-actions .button.is-danger { margin-left: auto; }
.poll-results-hidden { margin: 0; color: var(--muted); font-size: var(--text-body); }

/* ── results view (swapped into the same .poll-sheet, see detail.js) ────────── */

.poll-sheet .poll-back { margin: 0 0 14px; }
.poll-results-scroll { margin-top: 4px; }
/* .list-table is built for single-line, clipped file-list rows — a poll
   answer is free text that should be readable in full, not ellipsized. */
.poll-results-scroll .list-table { table-layout: auto; }
.poll-results-scroll .list-table th { white-space: normal; }
.poll-results-scroll .list-table td { overflow: visible; padding: 9px 14px 9px 0; white-space: normal; text-overflow: clip; vertical-align: top; }

.poll-questions-view { display: grid; gap: 26px; margin-top: 26px; }
.poll-question-card { display: grid; gap: 8px; }
.poll-question-number { margin: 0; color: var(--muted); font-size: var(--text-label); font-weight: 700; letter-spacing: var(--tracking-label); text-transform: uppercase; }
.poll-question-prompt { margin: 0; font: 400 22px/1.2 var(--serif); letter-spacing: -.01em; }
.poll-empty { margin: 0; color: var(--muted); font-size: var(--text-body); }

.poll-text-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  resize: vertical;
}
.poll-text-input:focus { border-color: var(--blue); outline: none; }

.poll-choice-options { display: grid; gap: 8px; }
.poll-choice-row { display: flex; align-items: center; gap: 8px; }
.poll-choice-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-size: var(--text-body);
  text-align: left;
  transition: border-color .12s, background .12s;
}
.poll-choice-toggle:hover { border-color: var(--blue); }
.poll-choice-toggle.is-voted { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 8%, var(--paper)); }
.poll-choice-shape { flex: none; width: 15px; height: 15px; border: 1px solid var(--muted); border-radius: 50%; }
.poll-choice-toggle.is-voted .poll-choice-shape { border-color: var(--blue); background: var(--blue); }
.poll-choice-label { flex: 1; }
.poll-choice-count { color: var(--muted); font-size: var(--text-meta); }
.poll-delete-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--text-meta);
  text-decoration: underline;
}
.poll-delete-button:hover { color: var(--red); }

.poll-suggestion-form { display: flex; gap: 6px; }
.poll-suggestion-input {
  flex: 1;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font-size: var(--text-body);
}
.poll-add-button { flex: none; width: 34px; min-height: 34px; border: 1px solid var(--line); border-radius: 2px; background: var(--paper-raised); cursor: pointer; font-size: 16px; }
.poll-add-button:hover { border-color: var(--blue); color: var(--blue); }

.poll-columns-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.poll-column { display: grid; gap: 8px; align-content: start; padding: 12px; border: 1px solid var(--line); border-radius: 3px; background: var(--paper); }
.poll-column-head h4 { margin: 0; font: 600 var(--text-body)/1.2 var(--sans); }
.poll-suggestions { display: grid; gap: 8px; }
.poll-suggestion { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 2px; background: var(--paper-raised); }
.poll-suggestion-label { font-size: var(--text-body); }
.poll-suggestion-author-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--text-meta); }
.poll-vote-button { flex: none; display: flex; align-items: center; gap: 4px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-raised); color: var(--ink); cursor: pointer; font-size: var(--text-meta); }
.poll-vote-button:hover { border-color: var(--blue); }
.poll-vote-button.is-voted { border-color: var(--blue); color: var(--blue); }

/* ── availability grid (When2Meet-style) ─────────────────────────────────── */

.poll-availability-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.poll-grid-wrap { margin-top: 14px; overflow-x: auto; }
.poll-grid { border-collapse: collapse; border-spacing: 0; }
.poll-grid th { padding: 3px 8px; color: var(--muted); font-size: var(--text-meta); font-weight: 600; white-space: nowrap; }
.poll-grid tbody th { text-align: right; }
/* A time label marks the boundary line above its row (the 09:00 label sits
   over the 09:00–09:15 cell, not centered inside it) — top-aligned and
   nudged up so the text itself sits astride that line. */
.poll-grid-time { vertical-align: top; line-height: 1; transform: translateY(-.5em); }
.poll-grid-end-row td { height: 0; }
/* A faint shared hairline (not a real border on every side — border-collapse
   turns this into one line per boundary) keeps same-color neighbors from
   fusing into an unreadable blob without reintroducing a heavy grid. */
.poll-grid-cell {
  width: 52px;
  height: 15px;
  border: 1px solid color-mix(in srgb, var(--ink) 7%, transparent);
  background: var(--paper);
  cursor: pointer;
  user-select: none;
}
/* Only this voter's own pick, while voting — everyone else's shows up in
   "View results" (.poll-grid-readonly below), never here. */
.poll-grid-cell[data-voted="true"] { background: var(--green); }

/* ── read-only results grid (same shape, totals shown) ───────────────────── */

.poll-results-grid { margin-bottom: 26px; }
.poll-results-grid-title { margin: 0 0 8px; font: 400 18px/1.2 var(--serif); letter-spacing: -.01em; }
/* --heat (0–1) is this slot's popularity relative to the question's busiest
   slot — there is no invitee list to normalize against. Results-only: the
   voting grid above never reveals anyone else's picks. */
.poll-grid-readonly .poll-grid-cell { height: 22px; text-align: center; cursor: default; background: color-mix(in srgb, var(--green) calc(var(--heat, 0) * 85%), var(--paper)); }
.poll-grid-readonly .poll-grid-cell span { color: var(--ink); font-size: 10px; }
.poll-grid-readonly .poll-grid-cell.is-dark span { color: white; }

@media (max-width: 700px) {
  .poll-sheet { padding: 26px 18px 22px; }
  .poll-board { grid-template-columns: 1fr; }
  .poll-availability-time { width: 100%; grid-template-columns: 1fr 1fr; }
}
