:root {
  --bg: #f4f4f4;
  --page: #e6e6e6;
  --ink: #111111;
  --muted: #8a8a8a;
  --line: #bdbdbd;
  --soft: #dedede;
  --radius: 18px;
  --font: "Jost", "Futura", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  min-height: 100vh;
}

h1 { font-size: 1.6rem; font-weight: 500; margin: 0; line-height: 1.2; }
h2 {
  font-size: 1rem; font-weight: 500; margin: 36px 0 14px; padding-bottom: 8px;
  border-bottom: 1px dotted var(--line);
}
a { color: var(--ink); }

main { max-width: 640px; margin: 0 auto; padding: 8px 16px 80px; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* Header: centered black pill, like the mockup */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 640px; margin: 0 auto 16px; padding: 18px 16px 14px;
  border-bottom: 1px dotted var(--ink);
}
.topbar[hidden] { display: none; }
.wordmark {
  color: var(--ink); text-decoration: none; font-weight: 700;
  font-size: 0.95rem; letter-spacing: 0.14em; text-transform: uppercase;
}
.who { display: flex; gap: 10px; align-items: center; font-size: 0.8rem; color: var(--muted); }
#whoami {
  width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--ink);
  display: inline-grid; place-items: center; color: var(--ink); font-weight: 600; font-size: 0.8rem;
  overflow: hidden;
}


/* Controls */
button, .btn {
  font: inherit; font-size: 0.9rem; cursor: pointer; border-radius: 99px;
  border: 1px dotted var(--ink); background: var(--bg); color: var(--ink);
  padding: 9px 20px; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
}
button:hover, .btn:hover { border-style: solid; }
button:focus-visible, .btn:focus-visible, input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button:disabled { opacity: 0.35; cursor: not-allowed; }
.primary { background: var(--ink); color: #fff; border: 1px solid var(--ink); font-weight: 500; }
.primary:hover { background: #333; }
.danger { color: var(--ink); }
.link { background: none; border: none; padding: 0; color: var(--muted); text-decoration: underline; font-size: inherit; }
.link:hover { color: var(--ink); }

input[type="text"], input[type="password"] {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px dotted var(--ink); border-radius: 99px; padding: 11px 18px;
}
input::placeholder { color: #b5b5b5; }
label { display: block; font-size: 0.85rem; font-weight: 500; margin: 18px 0 8px; }

.card { background: var(--bg); border: 1px dotted var(--ink); border-radius: var(--radius); padding: 18px; }

/* Login */
.login { max-width: 340px; margin: 12vh auto 0; text-align: center; }
.login .hello { font-size: 2.2rem; margin: 40px 0 6px; }
.login .wordmark { font-size: 0.8rem; }
.login form { text-align: left; margin-top: 32px; }
.login button { width: 100%; margin-top: 28px; padding: 12px; }
.error { margin: 12px 0 0; min-height: 1.5em; font-size: 0.85rem; text-align: center; }

/* Poll list */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 8px 0 20px; }
.poll-list { display: grid; gap: 10px; }
.poll-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; padding: 16px 20px; }
.poll-item:hover { border-style: solid; }
.poll-item .title { font-weight: 500; }
.pill {
  font-size: 0.72rem; padding: 3px 12px; border-radius: 99px; white-space: nowrap;
  background: var(--ink); color: #fff;
}
.pill.closed { background: transparent; color: var(--muted); border: 1px dotted var(--line); }
.empty { text-align: center; padding: 48px 20px; }

/* Group tabs */
.tabs {
  display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 24px; padding: 2px 16px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0; text-decoration: none; font-size: 0.85rem; white-space: nowrap;
  padding: 7px 18px; border-radius: 99px; border: 1px dotted var(--ink);
}
.tab:hover { border-style: solid; }
.tab[aria-current="page"] { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.tab.add { border-color: var(--line); color: var(--muted); }

/* Party size stepper */
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 40px; height: 40px; padding: 0; font-size: 1.1rem; }
.stepper output { min-width: 44px; text-align: center; font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.empty p { color: var(--muted); }

/* Calendar picker */
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.cal-head strong { font-weight: 500; }
.cal-head button { width: 34px; height: 34px; padding: 0; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { text-align: center; font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.cal button {
  aspect-ratio: 1; padding: 0; border-radius: 12px; font-variant-numeric: tabular-nums;
  border: 1px dotted var(--line);
}
.cal button:hover { border-color: var(--ink); }
.cal button.selected { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.cal button.today { border: 1px solid var(--ink); }
.cal button:disabled { border-color: transparent; opacity: 0.25; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; align-items: center; }
.quick button { padding: 6px 14px; font-size: 0.8rem; }
.chosen { margin: 14px 0 0; }

.form-actions { display: flex; gap: 10px; margin-top: 28px; }

/* Poll detail */
.back { font-size: 0.85rem; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); }
.poll-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; }

.banner {
  margin: 22px 0; padding: 14px 22px; border-radius: 99px;
  background: var(--ink); color: #fff; font-size: 0.9rem;
}
.banner strong { font-weight: 600; }
.banner .muted { color: #9a9a9a; }
.banner.empty-banner { background: var(--page); color: var(--muted); }

.dates { display: grid; gap: 10px; }
.date-row {
  display: grid; grid-template-columns: 56px 1fr; gap: 8px 16px; align-items: center;
  border: 1px dotted var(--ink); border-radius: var(--radius); padding: 14px 16px;
}
.date-row.best { border: 2px solid var(--ink); padding: 13px 15px; }
.date-badge {
  grid-row: span 3; align-self: start; text-align: center; line-height: 1.15;
  border: 1px dotted var(--ink); border-radius: 12px; padding: 6px 0;
}
.date-row.best .date-badge { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.date-badge .dow, .date-badge .mon { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; }
.date-badge .day { font-size: 1.25rem; font-weight: 600; }
.date-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.party-tag {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--ink); color: #fff; padding: 4px 12px; border-radius: 99px; white-space: nowrap;
}

.vote { display: inline-flex; gap: 6px; }
.vote button { padding: 5px 14px; font-size: 0.8rem; }
.vote button[aria-pressed="true"].yes { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.vote button[aria-pressed="true"].maybe { background: var(--soft); border: 1px solid var(--ink); }
.vote button[aria-pressed="true"].no { border: 1px solid var(--ink); text-decoration: line-through; }

/* Segmented bar: black = yes, grey = maybe */
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar {
  flex: 1; display: flex; height: 10px; border: 1px solid var(--ink); border-radius: 99px; overflow: hidden;
}
.bar span { flex: 1; border-right: 1px solid var(--ink); }
.bar span:last-child { border-right: none; }
.bar span.yes { background: var(--ink); border-right-color: #fff; }
.bar span.maybe { background: #c7c7c7; }
.tally { font-size: 0.75rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.people { display: flex; flex-wrap: wrap; gap: 5px; font-size: 0.75rem; }
.chip { padding: 1px 10px; border-radius: 99px; border: 1px solid var(--ink); }
.chip.yes { background: var(--ink); color: #fff; }
.chip.maybe { border-style: dotted; }
.chip.no { border: 1px dotted var(--line); color: var(--muted); text-decoration: line-through; }

/* Overview grid */
.grid-wrap { overflow-x: auto; border: 1px dotted var(--ink); border-radius: var(--radius); }
table.grid { border-collapse: collapse; font-size: 0.82rem; min-width: 100%; }
.grid th, .grid td { padding: 10px 12px; text-align: center; border-bottom: 1px dotted var(--line); white-space: nowrap; }
.grid th:first-child, .grid td:first-child { text-align: left; position: sticky; left: 0; background: var(--bg); }
.grid thead th { color: var(--muted); font-weight: 400; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.grid th.best { color: var(--ink); font-weight: 600; }
.grid tr:last-child td { border-bottom: none; }

.owner-actions { display: flex; gap: 10px; margin-top: 32px; flex-wrap: wrap; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 20px; border-radius: 99px; font-size: 0.85rem;
  max-width: calc(100% - 32px);
}

@media (max-width: 520px) {
  .date-row { grid-template-columns: 48px 1fr; gap: 8px 12px; padding: 12px; }
  .date-row.best { padding: 11px; }
  .vote button { padding: 5px 11px; }
}
