/* timeheat — "Crisp" direction: flat, technical, rose on warm stone. */
:root {
  --bg: #e7e5df;
  --card: #ffffff;
  --card-bd: #e7e5e4;
  --ink: #1c1917;
  --muted: #78716c;
  --faint: #a8a29e;
  --hair: #f0eeec;
  --field-bd: #e7e5e4;
  --pick-green: #1f8a5b; /* design-system success green */
  --rose: #e11d48;
  /* JetBrains Mono — only for literal machine values (hex codes,
     time-zone codes, spec/debug annotations); never times or labels */
  --mono: 'JetBrains Mono', monospace;
  /* derived from --rose so a per-poll brand color re-tints everything */
  --rose-ink: color-mix(in srgb, var(--rose), #000 28%);
  --rose-bg: color-mix(in srgb, var(--rose) 8%, #fff);
  --rose-bd: color-mix(in srgb, var(--rose) 24%, #fff);
  /* brand-independent tokens — global so non-branded pages (dashboard, auth,
     settings) also get status colors, heat neutrals and card elevation */
  --ok-fg: #1f8a5b;
  --ok-bg: #e7f5ed;
  --danger: #b91c1c;
  --heat-empty: #f1efed;
  --heat-strong: #1c1917;
  --heat-muted: #b9b3ad;
  --axis-hour: #44403c;
  --axis-sub: #cdc8c3;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
/* re-resolve the derived tints against a per-poll --rose override */
.branded {
  --rose-ink: color-mix(in srgb, var(--rose), #000 28%);
  --rose-bg: color-mix(in srgb, var(--rose) 8%, #fff);
  --rose-bd: color-mix(in srgb, var(--rose) 24%, #fff);
}
[data-theme="dark"] {
  --bg: #0f0d0c;
  --card: #1a1715;
  --card-bd: #2a2522;
  --ink: #f5f3f1;
  --muted: #9a928b;
  --faint: #8c837b; /* raised for WCAG AA on the dark card (was #6b635c) */
  --hair: #272320;
  --field-bd: #2a2522;
  --heat-empty: #272320;
  --heat-strong: #f5f3f1;
  --heat-muted: #6b635c;
  --axis-hour: #9a928b;
  --axis-sub: #8c837b; /* half-hour labels: AA-legible on dark (was #574e48) */
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Archivo', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { letter-spacing: -0.02em; margin: 0; }

/* ---------- layout ---------- */
.wrap { max-width: 680px; margin: 0 auto; padding: 28px 20px 80px; }
.wrap.narrow { max-width: 420px; }
.wrap.wide { max-width: min(96vw, 1100px); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--card-bd);
  background: var(--card);
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 18px; height: 18px; background: var(--rose); display: inline-block; }
.brand-logo { height: 18px; width: auto; max-width: 120px; display: inline-block; object-fit: contain; }
.brand-word {
  font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
}
.topnav { display: flex; align-items: center; gap: 10px; }
.topnav-name { font-size: 12px; font-weight: 500; color: var(--muted); }

/* topbar icon button (theme toggle) */
.iconbtn {
  width: 32px; height: 32px; border: 1px solid var(--field-bd); border-radius: 3px;
  background: var(--card); color: var(--muted); font-size: 15px; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.iconbtn:hover { color: var(--ink); }

.credits-chip {
  font-size: 11px; font-weight: 600; color: var(--rose-ink); background: var(--rose-bg);
  border: 1px solid var(--rose-bd); border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}
.credit-note {
  font-size: 12.5px; color: var(--muted); background: var(--bg);
  border-left: 3px solid var(--field-bd); padding: 9px 12px; border-radius: 0 3px 3px 0;
  margin-bottom: 16px;
}
.credit-note.warn {
  color: var(--rose-ink); background: var(--rose-bg); border-left-color: var(--rose);
}

/* user dropdown (details/summary) */
.usermenu { position: relative; }
.usermenu > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 7px;
  padding: 4px 6px; border-radius: 3px;
}
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu > summary:hover { background: var(--hair); }
.usermenu .caret { font-size: 10px; color: var(--faint); }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 168px; z-index: 40;
  background: var(--card); border: 1px solid var(--card-bd); border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12); padding: 5px; display: flex; flex-direction: column;
}
.menu-status {
  display: flex; flex-direction: column; gap: 1px;
  padding: 7px 11px 9px; margin-bottom: 4px; border-bottom: 1px solid var(--hair);
}
.menu-user { font-size: 13px; font-weight: 600; color: var(--ink); }
.menu-credits { font-size: 11.5px; color: var(--muted); }
.menu-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  font: inherit; font-size: 13px; color: var(--ink); padding: 9px 11px; border-radius: 3px; cursor: pointer;
}
.menu-item:hover { background: var(--hair); }
.menu-item.danger { color: var(--danger); }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: #fde4e8; color: var(--rose-ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}

/* ---------- card ---------- */
.card {
  background: var(--card); border: 1px solid var(--card-bd); border-radius: 4px;
  box-shadow: var(--shadow); padding: 28px;
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.eyebrow {
  font-size: 11px; font-weight: 500; letter-spacing: 0.05em; color: var(--faint);
  text-transform: uppercase;
}
.subtle { color: var(--faint); font-size: 12.5px; margin: 4px 0 0; }
.muted { color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--field-bd); background: var(--card); color: var(--ink);
  border-radius: 3px; padding: 11px 14px; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; text-align: center; white-space: nowrap; transition: filter .12s, background .12s;
}
.btn:hover { filter: brightness(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn-primary { background: var(--rose); border-color: var(--rose); color: #fff; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--card); }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-block { display: flex; width: 100%; }
.btn-danger { color: var(--danger); }
.btn-row { display: flex; gap: 8px; margin-top: 20px; }
.btn-row .btn { flex: 1; }
.linkbtn {
  background: none; border: none; color: var(--muted); font: inherit; font-size: 12px;
  cursor: pointer; padding: 0;
}
.linkbtn:hover { color: var(--ink); }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.label {
  display: block; font-size: 10px; font-weight: 600; letter-spacing: 0.1em;
  color: var(--faint); text-transform: uppercase; margin-bottom: 6px;
}
.input, select.input {
  width: 100%; border: 1px solid var(--field-bd); border-radius: 3px;
  padding: 11px 13px; font: inherit; font-size: 14px; color: var(--ink);
  background: var(--card); appearance: none;
}
.input:focus { outline: none; border-color: var(--ink); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.grow0 { flex: none; }

/* number stepper (duration) */
.stepper { display: flex; align-items: center; gap: 4px; border: 1px solid var(--field-bd); border-radius: 3px; padding: 3px 5px; }
.stepper .step-btn {
  width: 26px; height: 30px; flex: none; border: none; background: var(--hair); color: var(--ink);
  border-radius: 3px; font-size: 17px; line-height: 1; cursor: pointer;
}
.stepper .step-btn:hover { background: var(--field-bd); }
.stepper .step-in {
  width: 34px; border: none; background: none; font: inherit; font-size: 14px; color: var(--ink);
  text-align: right; -moz-appearance: textfield; padding: 0;
}
.stepper .step-in::-webkit-outer-spin-button,
.stepper .step-in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper .step-u { font-size: 12px; color: var(--faint); margin-right: 2px; }

/* segmented toggle */
.seg { display: flex; border: 1px solid var(--field-bd); border-radius: 3px; overflow: hidden; }
.seg button {
  flex: 1; border: none; background: var(--card); color: var(--muted);
  padding: 10px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--field-bd); }
.seg button.on { background: var(--ink); color: var(--card); font-weight: 600; }
.seg.rose button.on { background: var(--rose); color: #fff; }
.seg button:disabled { opacity: 0.6; cursor: not-allowed; }
.seg button.locked { background: var(--hair); }

/* checkbox row */
.check {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  border-top: 1px solid var(--hair); padding-top: 16px; margin: 4px 0 4px;
}
.check input { display: none; }
.check .box {
  width: 18px; height: 18px; border-radius: 3px; border: 1px solid var(--field-bd);
  display: inline-flex; align-items: center; justify-content: center;
  color: transparent; font-size: 12px; font-weight: 700;
}
.check input:checked + .box { background: var(--ink); border-color: var(--ink); color: #fff; }
.check .txt { font-size: 13px; font-weight: 500; }

/* toggle switch */
.switch { display: inline-flex; align-items: center; cursor: pointer; }
.switch input { display: none; }
.switch .track {
  width: 36px; height: 20px; border-radius: 999px; background: var(--field-bd);
  position: relative; transition: background .15s;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: left .15s;
}
.switch input:checked + .track { background: var(--rose); }
.switch input:checked + .track::after { left: 18px; }

/* ---------- pills / badges ---------- */
.badge {
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: 3px; padding: 4px 9px;
}
.badge-open { color: var(--ok-fg); background: var(--ok-bg); }
.badge-closed { color: var(--muted); background: var(--hair); }
.pill {
  font-size: 12px; font-weight: 600; color: var(--rose-ink); background: var(--rose-bg);
  border-radius: 999px; padding: 4px 11px;
}
.error {
  background: var(--rose-bg); border-left: 3px solid var(--rose); color: var(--rose-ink);
  font-size: 12.5px; padding: 10px 12px; margin-bottom: 16px; border-radius: 0 3px 3px 0;
}
.note {
  display: flex; gap: 8px; background: var(--bg); border-left: 3px solid var(--field-bd);
  padding: 10px 12px; font-size: 11.5px; line-height: 1.5; color: var(--muted);
  margin-top: 18px;
}

/* ---------- auth ---------- */
.authwrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.tabs { display: flex; border-bottom: 1px solid var(--hair); margin-bottom: 22px; }
.tabs a {
  flex: 1; text-align: center; padding-bottom: 11px; margin-bottom: -1px;
  font-size: 13px; font-weight: 500; color: var(--faint);
}
.tabs a.on { color: var(--ink); font-weight: 600; border-bottom: 2px solid var(--rose); }

/* ---------- dashboard ---------- */
.poll {
  border: 1px solid var(--hair); border-radius: 4px; padding: 15px 16px; margin-bottom: 10px;
  display: block;
}
.poll:hover { border-color: var(--card-bd); }
.poll-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.poll-name { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.poll-sub { font-size: 12px; color: var(--faint); }
.poll-meta { display: flex; align-items: center; gap: 10px; margin-top: 9px; font-size: 11.5px; }
.role-owner { color: var(--rose-ink); font-weight: 600; }
.role-part { color: var(--faint); font-weight: 600; }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-title { font-size: 14px; font-weight: 600; }
.cal-nav {
  width: 30px; height: 30px; border: 1px solid var(--field-bd); border-radius: 3px;
  display: grid; place-items: center; cursor: pointer; background: var(--card); color: var(--ink);
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-dow { text-align: center; font-size: 10px; font-weight: 600; color: var(--faint); }
.cal-day {
  height: 38px; border: 1px solid var(--field-bd); border-radius: 3px;
  display: grid; place-items: center; font-size: 13px; cursor: pointer;
  background: var(--card); color: var(--ink); user-select: none;
}
.cal-day.blank { border-color: transparent; background: transparent; cursor: default; }
.cal-day.sel { background: var(--rose); border-color: var(--rose); color: #fff; font-weight: 600; }
/* clearer past/selectable distinction: past = muted fill + faint text */
.cal-day.past { background: var(--hair); color: var(--axis-sub); border-color: transparent; cursor: not-allowed; }

/* ---------- hours editor ---------- */
/* hours step: two side-by-side containers (editor | grid), grid collapsible.
   The grid pane sticks to the top of the viewport while the left column of
   date cards scrolls, so the multi-day heatmap stays visible for painting. */
.hours-layout { display: flex; gap: 0; align-items: flex-start; }
.hours-pane { border: 1px solid var(--card-bd); border-radius: 8px; background: var(--card); }
.hours-left { flex: 0 0 322px; min-width: 0; padding: 14px; }
.hours-right {
  flex: 1 1 auto; min-width: 0; margin-left: 12px; padding: 10px 12px;
  position: sticky; top: 16px; align-self: flex-start;
}
.hours-layout.grid-collapsed .hours-right { display: none; }
@media (max-width: 720px) {
  .hours-layout { flex-direction: column; align-items: stretch; }
  .hours-left { flex: 1 1 auto; width: 100%; }
  /* on mobile the grid drops below the editor, so sticking to viewport top would
     leave a big blank gap while the user scrolls the editor above it */
  .hours-right { position: static; }
}

/* the chunky horizontal scroll strip that surrounds the day grid, drawn top +
   bottom of the scroller so the user can pan the heatmap from either edge */
.dg-scroller { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.dg-scroller::-webkit-scrollbar { display: none; }
.dg-navrow {
  display: flex; align-items: stretch; gap: 6px; height: 24px; margin: 6px 0;
  user-select: none;
}
.dg-navrow[hidden] { display: none; }
.dg-nav {
  flex: 0 0 34px; border: 1px solid var(--card-bd); background: var(--card);
  color: var(--ink); border-radius: 4px; font-size: 14px; font-weight: 700;
  line-height: 1; display: grid; place-items: center; cursor: pointer;
}
.dg-nav:hover:not(:disabled) { background: var(--hair); }
.dg-nav:disabled { opacity: 0.35; cursor: default; }
.dg-track {
  flex: 1 1 auto; position: relative; border: 1px solid var(--card-bd);
  background: var(--hair); border-radius: 4px; cursor: pointer;
}
.dg-thumb {
  position: absolute; top: 2px; bottom: 2px; left: 0; min-width: 24px;
  background: var(--ink); border-radius: 3px; opacity: 0.55;
}
.dg-track:hover .dg-thumb { opacity: 0.75; }

/* the X on a date card / editing card so a picked date can be removed inline */
.day-x {
  border: none; background: transparent; color: var(--faint); cursor: pointer;
  font-size: 16px; line-height: 1; width: 22px; height: 22px; border-radius: 3px;
  display: grid; place-items: center; flex: none; padding: 0;
}
.day-x:hover { color: var(--danger); background: var(--hair); }
.day-row { position: relative; padding-left: 32px; }
.day-row .day-x { position: absolute; top: 4px; left: 4px; }
.day-edit-head .day-x { margin-right: 8px; }

/* the "orejita" — a little ear sticking out of the left container's edge.
   Sticks to the top with the grid pane so the collapse toggle stays reachable
   while the user scrolls the date-card column on the left */
.orejita {
  flex: none; align-self: flex-start; margin: 22px 0 0 -1px;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  background: var(--card); border: 1px solid var(--card-bd); border-left: none;
  border-radius: 0 9px 9px 0; padding: 8px 9px; cursor: pointer;
  font-size: 11px; font-weight: 600; color: var(--muted);
  box-shadow: 3px 1px 5px rgba(0, 0, 0, 0.06);
  position: sticky; top: 38px;
}
@media (max-width: 720px) { .orejita { position: static; } }
.orejita:hover { color: var(--ink); }
.orejita .chev {
  display: inline-grid; place-items: center; width: 16px; height: 16px;
  border: 1px solid var(--card-bd); border-radius: 3px; font-size: 12px; line-height: 1;
}

/* the grid: container fills, but day columns keep a fixed, consistent width */
.dg { display: grid; gap: 2px; align-content: start; justify-content: start; width: 100%; }
.dg-corner { }
.dg-dh { text-align: center; align-self: end; padding-bottom: 3px; }
.dg-dh .dow { font-size: 9px; font-weight: 600; letter-spacing: .06em; color: var(--faint); }
.dg-dh .day { font-size: 11px; font-weight: 600; color: var(--muted); }
.dg-time { font-size: 9px; color: var(--axis-sub); text-align: right; padding-right: 7px; align-self: center; line-height: 1; }
.dg-time.hour { color: var(--axis-hour); font-weight: 700; }
.dg-cell { border: 1px solid var(--field-bd); border-radius: 2px; background: var(--card); cursor: pointer; min-height: 0; }
.dg-cell.hour { border-top-color: var(--axis-sub); }
.dg-cell.on { background: var(--rose); border-color: var(--rose); }
.dg-cell.past { background: var(--hair); border-color: transparent; cursor: not-allowed; opacity: .55; }

.day-edit { border: 1px solid var(--ink); border-radius: 4px; padding: 16px; margin-bottom: 12px; }
.day-edit-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.editing-tag { font-size: 11px; font-weight: 600; color: var(--rose); letter-spacing: 0.04em; text-transform: uppercase; }
.range-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 9px; }
.range-row select { flex: 1; }
.range-row .to { font-size: 12px; color: var(--faint); padding: 0 5px; }
/* time-input style variants inside the range editor */
.ti-stepper { flex: 1; min-width: 84px; display: flex; align-items: center; justify-content: space-between; gap: 2px; border: 1px solid var(--field-bd); border-radius: 3px; padding: 2px; }
.ti-stepper .ti-step { width: 22px; height: 28px; flex: none; border: none; background: var(--hair); border-radius: 3px; font-size: 16px; line-height: 1; cursor: pointer; color: var(--ink); }
.ti-stepper .ti-step:hover { background: var(--field-bd); }
.ti-stepper .ti-val { font-size: 13px; font-weight: 600; white-space: nowrap; }
.ti-slider { flex: 1 1 100%; display: flex; align-items: center; gap: 8px; }
.ti-slider .ti-slabel { width: 64px; flex: none; font-size: 12px; font-weight: 600; }
.ti-slider input[type="range"] { flex: 1; min-width: 0; accent-color: var(--rose); }
.ti-chips { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 4px; max-height: 116px; overflow: auto; border: 1px solid var(--field-bd); border-radius: 3px; padding: 5px; }
.ti-chip { border: 1px solid var(--field-bd); background: var(--card); border-radius: 999px; padding: 3px 8px; font: inherit; font-size: 11px; cursor: pointer; color: var(--ink); }
.ti-chip:hover { background: var(--hair); }
.ti-chip.on { background: var(--rose); border-color: var(--rose); color: #fff; }
/* navbar time-style chooser */
.ts-summary { font-size: 12px; font-weight: 600; color: var(--muted); }
.menu-item.on { color: var(--rose-ink); font-weight: 700; }
.range-x {
  width: 28px; height: 34px; flex: none; border: 1px solid var(--field-bd); border-radius: 3px;
  display: grid; place-items: center; color: var(--faint); cursor: pointer; background: var(--card);
}
.add-range {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px dashed var(--field-bd); border-radius: 3px; padding: 9px; margin-bottom: 16px;
  color: var(--rose); font-size: 12.5px; font-weight: 600; cursor: pointer; background: none; width: 100%;
}
.apply-row { display: flex; gap: 8px; }
.apply-row .btn { flex: 1; border-color: var(--ink); font-size: 12px; padding: 9px; }
.day-row {
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid var(--hair); border-radius: 3px; padding: 11px 13px; margin-bottom: 7px; cursor: pointer;
}
.day-row:hover { border-color: var(--card-bd); }
.day-row .dl { display: flex; align-items: baseline; gap: 9px; }
.day-row .dow { font-size: 13px; font-weight: 600; width: 30px; }
.day-row .dt { font-size: 12px; color: var(--faint); }
.chips { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.chip { font-size: 11px; font-weight: 600; color: var(--rose-ink); background: var(--rose-bg); border-radius: 3px; padding: 3px 8px; }
.notset { font-size: 12px; font-weight: 500; color: var(--axis-sub); font-style: italic; }

/* ---------- grid (results + entry) ---------- */
.grid-dates { display: flex; margin-bottom: 5px; }
.grid-dates .gutter { width: 46px; flex: none; }
.grid-dates .dh { flex: 1; text-align: center; }
.grid-dates .dh .dow { font-size: 9px; font-weight: 600; letter-spacing: 0.06em; color: var(--faint); }
.grid-dates .dh .day { font-size: 10px; font-weight: 600; color: var(--muted); }
/* "All free" chip under each column header on the reply grid so a wide-open day
   can be tapped once instead of painted slot by slot */
.grid-dates .dh .free-all-btn {
  display: block; margin: 3px auto 0; padding: 2px 6px; font-size: 9.5px;
  font-weight: 600; border: 1px solid var(--rose-bd); background: var(--card);
  color: var(--rose-ink); border-radius: 999px; cursor: pointer; line-height: 1;
  letter-spacing: 0.03em;
}
.grid-dates .dh .free-all-btn:hover { background: var(--rose-bg); }
.grow { display: flex; align-items: center; }
.grow .tlabel { width: 46px; flex: none; text-align: right; padding-right: 9px; font-size: 10px; }
.grow .tlabel.hour { font-weight: 700; color: var(--axis-hour); }
.grow .tlabel.sub { font-weight: 500; color: var(--axis-sub); }
.grow .cells { flex: 1; display: flex; gap: 2px; }
/* a bold dashed break, full width, where the time axis skips hours */
.grid-gap { margin: 8px 0; border-top: 2px dashed var(--faint); }
.cell {
  flex: 1; height: 28px; border-radius: 2px; display: grid; place-items: center;
  font-size: 10px; font-weight: 600; box-sizing: border-box; border: 1px solid transparent;
}
.cell.empty { background: var(--heat-empty); }
/* inset shadow (not a thicker border) so full cells keep the exact column width */
.cell.full { box-shadow: inset 0 0 0 2px var(--heat-strong); }
/* slots outside the polled hours: muted so the grid stays readable */
.cell.inactive { background: var(--heat-empty); }
/* entry grid cells */
.grid.entry .cells { gap: 3px; }
.grid.entry .cell { height: 26px; cursor: pointer; border: 1px solid var(--field-bd); background: #f7f5f3; }
.grid.entry .cell.inactive {
  cursor: default; border-color: transparent;
  background: repeating-linear-gradient(45deg, var(--hair) 0 5px, var(--card) 5px 10px);
}
.grid.entry .cell.free { background: var(--rose); border-color: var(--rose); }
.grid.entry .cell.if_need_be {
  border-color: var(--rose-bd);
  background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--rose), transparent 40%) 0 3px, var(--rose-bg) 3px 6px);
}
/* "everyone free only" filter */
.grid.only-all .cell:not(.full):not(.inactive) {
  background: var(--heat-empty) !important; color: transparent !important; border-color: transparent !important;
}
.only-all-note { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }
.only-all-note[hidden] { display: none; }

/* "mine" markers on the results heatmap: a small pick-green triangle in the
   top-right corner distinguishes the current respondent's own votes from the
   aggregate rose heat, so I can spot what I said inside the crowd tally.  */
.cell[data-mine] { position: relative; }
.cell[data-mine]::after {
  content: ""; position: absolute; top: 0; right: 0;
  width: 0; height: 0; border-top: 7px solid var(--pick-green); border-left: 7px solid transparent;
}
.cell[data-mine="if_need_be"]::after {
  border-top-color: color-mix(in srgb, var(--pick-green), #fff 30%);
}
/* dates-only bars: a solid pick-green baseline stripe under my day */
.bar-col[data-mine] .bar-fill-wrap { border-bottom: 3px solid var(--pick-green); border-radius: 3px 3px 0 0; }
.bar-col[data-mine="if_need_be"] .bar-fill-wrap { border-bottom-style: dashed; }

.sw.mine {
  border: 1px solid var(--field-bd); background: var(--card); position: relative;
}
.sw.mine::after {
  content: ""; position: absolute; top: 0; right: 0;
  width: 0; height: 0; border-top: 7px solid var(--pick-green); border-left: 7px solid transparent;
}

/* inline "close & pick a time" mode */
.pick-bar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
  background: var(--bg); border: 1px solid var(--card-bd);
  border-left: 3px solid var(--pick-green); border-radius: 8px; padding: 12px 14px;
}
.pick-bar[hidden] { display: none; }
.pick-bar .spacer { flex: 1; }
.pick-bar-title { font-size: 13px; font-weight: 600; }
.pick-bar-readout { font-size: 12px; color: var(--muted); margin-top: 1px; }
.pick-bar-readout.set { color: var(--pick-green); font-weight: 600; }

/* while picking, fade everything but the heatmap + the pick bar */
#results.picking #owner-controls,
#results.picking .resp-wrap,
#results.picking #bottom-cta { display: none !important; }

/* ---------- results header: a sticky band that pins on scroll ---------- */
.rhead {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  position: sticky; top: 0; z-index: 8; background: var(--card);
  margin: -28px -28px 0; padding: 18px 28px 12px; border-bottom: 1px solid var(--card-bd);
}
.rhead-id { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; min-width: 0; }
.rtitle { font-size: 21px; line-height: 1.15; }
.status {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted);
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.status-open { color: var(--ok-fg); }
.status-open .dot { background: var(--ok-fg); }
/* the transparent "OPEN" status sits on the dark card, where the base green
   only reaches 4.1:1 — brighten it there to clear WCAG AA */
[data-theme="dark"] .status-open { color: #34a86f; }
[data-theme="dark"] .status-open .dot { background: #34a86f; }
.rhead-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.rsub { font-size: 12.5px; color: var(--muted); margin-top: 12px; margin-bottom: 16px; }

/* icon action buttons (share / edit / delete) with a hover tooltip */
.rhead-actions .iconbtn { color: var(--muted); }
.rhead-actions .iconbtn:hover { color: var(--ink); background: var(--hair); }
.rhead-actions .iconbtn.danger:hover { color: var(--danger); border-color: var(--danger); }
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 7px); left: 50%;
  transform: translateX(-50%); white-space: nowrap; z-index: 60; pointer-events: none;
  background: var(--ink); color: var(--card); font-size: 11px; font-weight: 500;
  padding: 4px 8px; border-radius: 5px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

/* the 15-minute "does the meeting fit here?" grid shown while picking */
#pick-grid { position: relative; }
#pick-grid .cell[data-day] { cursor: pointer; }
#pick-grid .cell[data-day]:hover { outline: 2px solid var(--pick-green); outline-offset: -2px; }
/* a start where the meeting would run past the polled hours */
#pick-grid .cell.no-room {
  background: repeating-linear-gradient(45deg, var(--hair) 0 4px, transparent 4px 8px);
  cursor: not-allowed;
}

/* the selected span is drawn as a green border, not a fill */
.pick-overlay {
  position: absolute; pointer-events: none; z-index: 6;
  border: 2px solid var(--pick-green); border-radius: 4px;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.16);
}
/* when the meeting ends mid-slot, the cut edge is dashed instead of solid */
.pick-overlay.partial { border-bottom-style: dashed; }

.bars.picking .bar-col { cursor: pointer; }
.bars .bar-col.pick .bar-fill-wrap { outline: 2px solid var(--pick-green); outline-offset: 2px; border-radius: 4px; }

/* hover roster — who can make a given meeting time */
.roster-pop {
  position: fixed; z-index: 50; pointer-events: none; max-width: 230px;
  background: var(--card); border: 1px solid var(--card-bd); border-radius: 9px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16); padding: 10px 12px; font-size: 12px;
}
.roster-pop[hidden] { display: none; }
.roster-pop .rt { font-weight: 600; margin-bottom: 7px; }
.roster-pop .rg { display: flex; align-items: center; gap: 6px; font-weight: 600; margin-top: 7px; }
.roster-pop .rn { color: var(--muted); margin-top: 1px; line-height: 1.4; }
.roster-pop .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.roster-pop .dot.ok { background: var(--pick-green); }
.roster-pop .dot.maybe { background: color-mix(in srgb, var(--rose), #fff 30%); }
.roster-pop .dot.no { background: var(--faint); }

/* ---------- heat legend ---------- */
.legend { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.scale { display: flex; align-items: center; gap: 7px; }
.scale .ramp { display: flex; }
.scale .ramp i { width: 18px; height: 12px; display: block; }
.scale span { font-size: 10px; font-weight: 500; color: var(--faint); }
.legend-keys { display: flex; align-items: center; gap: 16px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--hair); }
.legend-keys .k { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
.legend-keys .sw { width: 14px; height: 12px; border-radius: 2px; box-sizing: border-box; }
.sw.free { background: var(--rose); }
.sw.maybe { background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--rose), transparent 45%) 0 2px, transparent 2px 5px), color-mix(in srgb, var(--rose), transparent 50%); }
.sw.all { border: 2px solid var(--heat-strong); background: var(--rose); }
.sw.busy { border: 1px solid var(--field-bd); background: #f7f5f3; }

/* ---------- best / share ---------- */
.best { display: flex; align-items: center; gap: 10px; border-left: 3px solid var(--rose); background: var(--bg); padding: 9px 13px; margin-bottom: 18px; }
.best .tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--rose); }
.best .val { font-size: 13px; font-weight: 500; }
.share-cta {
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
  background: var(--rose-bg); border: 1px solid var(--rose-bd); border-radius: 4px; padding: 12px 14px;
}
.share-cta-text { flex: 1; min-width: 0; }
.share-cta-title { font-size: 12px; font-weight: 700; color: var(--rose-ink); margin-bottom: 2px; }
.share-cta-url { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-cta .btn { flex: none; }
[data-theme="dark"] .share-cta { background: #231e1b; border-color: #3a2a2d; }
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.filterbar { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--hair); border-radius: 3px; padding: 9px 12px; margin-bottom: 14px; }
.filterbar.on { border-color: var(--ink); }
.filterbar span { font-size: 12.5px; font-weight: 500; }

/* ---------- respondents ---------- */
.resp-wrap { margin-top: 16px; }
.resp-list { display: flex; flex-wrap: wrap; gap: 7px; }
.resp { display: flex; align-items: center; gap: 6px; border: 1px solid var(--hair); border-radius: 999px; padding: 3px 10px 3px 3px; }
.resp .av { width: 20px; height: 20px; border-radius: 50%; background: var(--rose-bg); color: var(--rose-ink); display: grid; place-items: center; font-size: 10px; font-weight: 700; }
.resp .nm { font-size: 11.5px; font-weight: 500; }

/* ---------- dates-only bars ---------- */
.bars { display: flex; gap: 8px; align-items: flex-end; height: 200px; margin-bottom: 14px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-fill-wrap { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.bar-fill {
  width: 100%; border-radius: 3px 3px 0 0; min-height: 26px; box-sizing: border-box;
  display: flex; align-items: flex-start; justify-content: center; padding-top: 5px;
  font-size: 12px; font-weight: 700; color: #fff; border: 1px solid var(--field-bd);
}
.bar-fill.full { box-shadow: inset 0 0 0 2px var(--heat-strong); }
.bar-lab { margin-top: 8px; text-align: center; }
.bar-lab .dow { font-size: 9px; font-weight: 600; letter-spacing: 0.06em; color: var(--faint); }
.bar-lab .day { font-size: 10px; font-weight: 600; color: var(--muted); }

/* dates-only reply: every month with a poll date, stacked, no navigation.
   Poll dates are `.pickable` and cycle-click through free / if-need-be / busy;
   non-poll dates stay visible but muted so the calendar reads as real dates. */
.mcal-list { display: flex; flex-direction: column; gap: 20px; }
.mcal-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; letter-spacing: 0.04em; text-transform: uppercase; }
.cal-day.disabled { color: var(--faint); background: transparent; border-color: var(--hair); cursor: default; }
.cal-day.pickable { border-color: var(--field-bd); font-weight: 600; }
.cal-day.pickable.free { background: var(--rose); border-color: var(--rose); color: #fff; }
.cal-day.pickable.if_need_be {
  border-color: var(--rose-bd); color: var(--rose-ink);
  background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--rose), transparent 60%) 0 3px, var(--rose-bg) 3px 6px);
}

/* ---------- empty / closed ---------- */
.empty-box { border: 1px dashed var(--field-bd); border-radius: 4px; padding: 34px 24px; text-align: center; }
.empty-bars { display: flex; justify-content: center; gap: 4px; margin-bottom: 16px; }
.empty-bars i { width: 14px; height: 42px; border-radius: 2px; background: var(--heat-empty); display: block; }
.empty-box h3 { font-size: 15px; margin-bottom: 6px; }
.empty-box p { font-size: 12.5px; color: var(--faint); max-width: 300px; margin: 0 auto 18px; }
.final { background: var(--ink); border-radius: 4px; padding: 16px 18px; margin-bottom: 14px; }
.final .tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: #fb7185; margin-bottom: 5px; }
.final .pick { font-size: 16px; font-weight: 600; color: #fff; }
.final .sub { font-size: 12px; color: #9a928b; margin-top: 3px; }

/* ---------- steps ---------- */
.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps .s { flex: 1; height: 3px; border-radius: 999px; background: var(--hair); }
.steps .s.on { background: var(--rose); }
.step { display: none; }
.step.on { display: block; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--card); padding: 10px 16px; border-radius: 4px;
  font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; }

/* drag-to-paint hints only make sense with a mouse; hide on touch */
.hint-desk { display: none; }
@media (hover: hover) and (pointer: fine) { .hint-desk { display: inline; } }

/* ============================ mobile ============================ */
@media (max-width: 600px) {
  /* tighter shell + cards so content isn't squeezed by double padding */
  .wrap { padding: 16px 13px 64px; }
  .card { padding: 18px 16px; }
  .authwrap { padding: 16px; min-height: 92vh; align-items: start; padding-top: 48px; }

  /* top bar: keep the essentials, drop the long bits */
  .topbar { padding: 11px 14px; }
  .topnav { gap: 8px; }
  .topnav-name { display: none; }
  .credits-chip { display: none; }
  /* the time-input style chooser is a desktop power feature */
  #timestyle-menu { display: none; }
  .topnav .ts-summary, .usermenu > summary { white-space: nowrap; }

  /* headings step down a notch */
  h1 { font-size: 26px; }
  .rtitle { font-size: 19px; }

  /* results header: let the action row wrap under the title */
  .rhead { flex-wrap: wrap; }
  .rhead .rhead-actions { width: 100%; }
  /* the sticky header eats less when it spans the card edges */
  .rhead { margin: -18px -16px 0; padding: 14px 16px 10px; }

  /* heatmap: a touch denser so 3–5 day columns fit */
  .grid-dates .gutter, .grow .tlabel { width: 38px; }
  .grow .cells { gap: 1px; }

  /* dates-only bars a bit shorter */
  .bars { height: 168px; }

  /* the close picker bar stacks its actions */
  .pick-bar { flex-wrap: wrap; }
  .pick-bar .spacer { display: none; }
  .pick-bar-text { flex: 1 1 100%; margin-bottom: 8px; }

  /* share box: stack the copy button under the url */
  .share-cta { flex-direction: column; align-items: stretch; gap: 10px; }
}

/* very small phones: avoid horizontal scroll on the heatmap */
@media (max-width: 380px) {
  .grid-dates .gutter, .grow .tlabel { width: 32px; }
  .card { padding: 16px 13px; }
}

/* ---------- billing modal ---------- */
.modal {
  border: none; padding: 0; background: transparent; color: var(--ink);
  width: calc(100% - 32px); max-width: 440px; border-radius: 10px;
}
.modal::backdrop { background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(2px); }
.modal-card {
  background: var(--card); border: 1px solid var(--card-bd); border-radius: 10px;
  padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 18px; }
.modal-x { background: none; border: none; color: var(--faint); font-size: 15px; line-height: 1; padding: 4px; cursor: pointer; }
.modal-x:hover { color: var(--ink); }
.modal-sub { font-size: 13px; color: var(--muted); margin: 4px 0 18px; }
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.plan { position: relative; display: flex; flex-direction: column; border: 1px solid var(--card-bd); border-radius: 8px; padding: 16px; }
.plan-featured { border-color: var(--ink); }
.plan-ribbon {
  position: absolute; top: 0; right: 0; background: var(--rose); color: #fff;
  font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 0 8px 0 6px;
}
.plan-tag { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.plan-price { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.plan-price span { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.plan-desc { font-size: 12px; line-height: 1.5; color: var(--muted); margin: 6px 0 14px; flex: 1; }
.plan .btn { margin-top: auto; }
.billing-cta { display: block; text-align: center; font-size: 13px; font-weight: 600; color: var(--rose-ink); padding: 6px; }
.billing-cta:hover { color: var(--rose); }
@media (max-width: 420px) { .plan-grid { grid-template-columns: 1fr; } }
