:root {
  color-scheme: light dark;
  --bg: #eef1f5; --card: #ffffff; --text: #151a20; --muted: #566273; --line: #d5dae2; --line-strong: #8d98a8;
  --head-bg: #e6eaf1;
  --accent: #1f56d8; --accent-text: #ffffff;
  --yes: #17703a; --yes-bg: #d3f0dc;
  --no: #a12020; --no-bg: #f8d9d9;
  --mid: #7a4f00; --mid-bg: #fbe9b7;
  --chosen: #17703a; --chosen-text: #ffffff;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 6px 18px rgba(20, 30, 50, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e12; --card: #171a20; --text: #f0f2f5; --muted: #a2acb9; --line: #2c323d; --line-strong: #5b6678;
    --head-bg: #20252e;
    --accent: #6a9bff; --accent-text: #0a0c10;
    --yes: #86e8a6; --yes-bg: #17361f;
    --no: #ffa3a3; --no-bg: #3d1d1d;
    --mid: #ffd887; --mid-bg: #3a2e10;
    --chosen: #86e8a6; --chosen-text: #08100b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
.top { padding: 0.75rem 1rem; max-width: 56rem; margin: 0 auto; }
.brand { color: var(--muted); text-decoration: none; font-weight: 700; letter-spacing: 0.02em; }
main { max-width: 56rem; margin: 0 auto; padding: 0 1rem 4rem; }
h1 { font-size: 1.8rem; line-height: 1.2; margin: 0.5rem 0; font-weight: 800; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
p { margin: 0.4rem 0; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* page header of a poll: clearly the title, then the description */
.poll-head { padding: 0.5rem 0 0.25rem; }
.eyebrow { margin: 0.5rem 0 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.poll-head h1 { font-size: 2.1rem; margin: 0.1rem 0 0.4rem; overflow-wrap: anywhere; }
.poll-head .desc { font-size: 1.05rem; color: var(--muted); white-space: pre-wrap; }
@media (min-width: 40rem) { h1 { font-size: 2.1rem; } .poll-head h1 { font-size: 2.8rem; } }
.share-inline { margin: 0.9rem 0 0.25rem; }
.share-inline label { display: block; margin-bottom: 0.3rem; }

/* cards: a tinted header strip names each block */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin: 1.1rem 0; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin: -1rem -1rem 1rem; padding: 0.7rem 1rem; background: var(--head-bg); border-bottom: 1px solid var(--line); border-radius: 11px 11px 0 0; }
.card-head h2 { margin: 0; font-size: 1.15rem; }
.card-head .count { color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.desc { white-space: pre-wrap; }

label, legend { font-weight: 700; font-size: 0.95rem; }
input[type=text], input[type=date], input[type=time], textarea, select {
  width: 100%; font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 0.55rem 0.7rem;
}
textarea { min-height: 4.5rem; resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible,
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.field { margin: 0.9rem 0; }
.field > label { display: block; margin-bottom: 0.3rem; }
.row { display: flex; gap: 0.5rem; align-items: center; margin: 0.4rem 0; flex-wrap: wrap; }
.row > * { flex: 1 1 8rem; min-width: 0; }
.row > .fixed { flex: 0 0 auto; }

button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--text); padding: 0.55rem 0.9rem;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--no); border-color: var(--no); }
button.link { border: 0; background: none; padding: 0.2rem 0.4rem; color: var(--accent); }
button:disabled { opacity: 0.55; cursor: default; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }

.notice { border-radius: 8px; padding: 0.6rem 0.8rem; margin: 0.75rem 0; background: var(--mid-bg); color: var(--mid); font-weight: 700; }
.notice.error { background: var(--no-bg); color: var(--no); }
.notice.ok { background: var(--yes-bg); color: var(--yes); }

.copy { display: flex; gap: 0.5rem; }
.copy input { flex: 1; }

/* results: one row per person, one column per date */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-strong); border-radius: 10px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; }
th, td { padding: 0.6rem 0.7rem; text-align: center; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); white-space: nowrap; }
th.who { text-align: left; border-left: 0; position: sticky; left: 0; z-index: 1; background: var(--card); min-width: 7.5rem; box-shadow: 1px 0 0 var(--line-strong); }
tbody tr:last-child > * { border-bottom: 0; }

thead th { background: var(--head-bg); border-bottom: 2px solid var(--line-strong); vertical-align: top; font-weight: 400; min-width: 5rem; padding: 0.55rem 0.4rem; }
thead th.who { background: var(--head-bg); color: var(--muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; vertical-align: bottom; }
.datecol span { display: block; }
.wd { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.day { font-size: 1.75rem; font-weight: 800; line-height: 1.1; }
.mon { font-size: 0.85rem; color: var(--muted); }
.time { margin-top: 0.3rem; font-size: 0.8rem; font-weight: 700; background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 0 0.5rem; width: fit-content; margin-inline: auto; }

tbody th.who { display: table-cell; font-weight: 700; font-size: 1rem; }
tbody th.who > * { vertical-align: middle; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 1.8rem; height: 1.8rem; margin-right: 0.5rem; border-radius: 50%; background: var(--head-bg); border: 1px solid var(--line-strong); font-size: 0.85rem; font-weight: 800; }
.name { margin-right: 0.25rem; }

td.a-yes { background: var(--yes-bg); color: var(--yes); font-weight: 700; }
td.a-no { background: var(--no-bg); color: var(--no); font-weight: 600; }
td.a-mid { background: var(--mid-bg); color: var(--mid); font-weight: 700; }
td.a-none { color: var(--muted); }

tfoot th, tfoot td { background: var(--head-bg); border-top: 2px solid var(--line-strong); border-bottom: 0; }
tfoot th.who { color: var(--muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.total .n { font-size: 1.35rem; font-weight: 800; }
.total small { color: var(--muted); }
.tag { display: block; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }

.legend { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin: 0.8rem 0 0; padding: 0; }
.chip { border-radius: 99px; padding: 0.15rem 0.7rem; font-size: 0.85rem; font-weight: 700; }
.chip small { font-weight: 500; }
.chip.yes { background: var(--yes-bg); color: var(--yes); }
.chip.no { background: var(--no-bg); color: var(--no); }
.chip.mid { background: var(--mid-bg); color: var(--mid); }
.empty { text-align: center; padding: 1.2rem 0.5rem; border: 2px dashed var(--line-strong); border-radius: 10px; }
.empty-title { font-size: 1.1rem; font-weight: 700; margin: 0; }

/* answer form */
fieldset { border: 0; margin: 1rem 0; padding: 0; }
legend { margin-bottom: 0.35rem; padding: 0; font-size: 1.05rem; }
.segs { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.seg { position: relative; flex: 1 1 5rem; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: 0.55rem 0.6rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); font-weight: 700; }
.seg input:checked + span { border-width: 2px; padding: calc(0.55rem - 1px) calc(0.6rem - 1px); }
.seg.yes input:checked + span { background: var(--yes-bg); color: var(--yes); border-color: var(--yes); }
.seg.no input:checked + span { background: var(--no-bg); color: var(--no); border-color: var(--no); }
.seg.mid input:checked + span { background: var(--mid-bg); color: var(--mid); border-color: var(--mid); }
.admin { border-color: var(--accent); }
.admin .card-head { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.admin .card-head .count { color: inherit; }

.scroll-hint { display: none; margin: 0.5rem 0 0; font-size: 0.85rem; color: var(--muted); text-align: center; }
@media (max-width: 40rem) {
  .scroll-hint { display: block; }
  th.who { min-width: 5.6rem; }
  thead th { min-width: 4.4rem; }
  th, td { padding: 0.55rem 0.45rem; }
  .avatar { display: none; }
}

/* date ranking: winner = thick border around its whole column, second place = thin border, the rest greyed out */
.c1 { --col: var(--accent); }
.c1.chosen { --col: var(--chosen); }
.c2 { --col: var(--accent); }
td.c1, th.c1 { box-shadow: inset 4px 0 0 var(--col), inset -4px 0 0 var(--col); }
thead th.c1 { box-shadow: inset 4px 0 0 var(--col), inset -4px 0 0 var(--col), inset 0 4px 0 var(--col); }
tfoot td.c1 { box-shadow: inset 4px 0 0 var(--col), inset -4px 0 0 var(--col), inset 0 -4px 0 var(--col); }
td.c2, th.c2 { box-shadow: inset 2px 0 0 var(--col), inset -2px 0 0 var(--col); }
thead th.c2 { box-shadow: inset 2px 0 0 var(--col), inset -2px 0 0 var(--col), inset 0 2px 0 var(--col); }
tfoot td.c2 { box-shadow: inset 2px 0 0 var(--col), inset -2px 0 0 var(--col), inset 0 -2px 0 var(--col); }
.cx { filter: grayscale(1); opacity: 0.6; }
.c1 .day, .c1 .tag { color: var(--col); }
.c2 .tag { color: var(--muted); }

/* admin: manage dates, checkbox rows, "still open" flag */
.date-list { list-style: none; margin: 0 0 0.6rem; padding: 0; }
.date-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.3rem 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.date-row:last-child { border-bottom: 0; }
.field.check { display: flex; align-items: center; gap: 0.6rem; }
.field.check input { width: 1.2rem; height: 1.2rem; flex: 0 0 auto; accent-color: var(--accent); }
.field.check label { margin: 0; font-weight: 600; }
.badge-open { display: inline-block; margin-left: 0.4rem; padding: 0 0.55rem; border-radius: 99px; background: var(--accent); color: var(--accent-text); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; vertical-align: middle; }

/* location line under the title */
.where { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem; margin: 0.6rem 0 0; font-size: 1.1rem; }
.where-label { font-size: 0.75rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.where a { font-size: 0.95rem; font-weight: 600; color: var(--accent); }
