:root {
  color-scheme: light;
  --border: #ccc;
  --muted: #666;
  --accent: #2563eb;
  --ok-bg: #dcfce7;
  --ok-fg: #166534;
  --best-bg: #fef9c3;
  --yes-bg: #dcfce7;
  --yes-fg: #166534;
  --no-bg: #fee2e2;
  --no-fg: #b91c1c;
  --maybe-bg: #fef3c7;
  --maybe-fg: #92400e;
}

* {
  box-sizing: border-box;
}

html {
  background: #fff;
}

body {
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  margin: 0;
  line-height: 1.5;
  background: #fff;
  color: #111;
}

.site-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.site-header a {
  font-weight: 700;
  text-decoration: none;
  color: inherit;
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 480px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-weight: 600;
}

input,
textarea,
select {
  font: inherit;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: #111;
}

button {
  font: inherit;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  width: fit-content;
}

button.remove-slot {
  background: transparent;
  color: #b91c1c;
  border-color: #b91c1c;
}

.slot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.slot-row > input {
  flex: 1 1 auto;
  min-width: 0;
}

.slot-checklist {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.slot-checklist label {
  flex-direction: row;
  align-items: center;
  font-weight: normal;
}

.slot-row-response {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.slot-time-label {
  font-weight: 600;
}

.slot-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.slot-options .option {
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  font-weight: normal;
}

#multi-select-limits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

#multi-select-limits label {
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  font-weight: normal;
}

#multi-select-limits input {
  width: 5rem;
}

.rank-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.rank-label {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.rank-label input[type="number"] {
  width: 3.5rem;
}

.rank-comment-label {
  flex-direction: column;
  align-items: stretch;
  font-weight: normal;
  gap: 0.25rem;
}

.rank-comment-label textarea {
  max-width: 100%;
}

.maybe-note {
  max-width: 100%;
}

.maybe-explanation {
  font-size: 0.9em;
}

.link-button {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  width: auto;
}

.error {
  color: #b91c1c;
}

.notice {
  color: #166534;
  background: var(--ok-bg);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  display: inline-block;
}

.muted {
  color: var(--muted);
  font-size: 0.9em;
}

.poll-list,
.invitee-list {
  list-style: none;
  padding: 0;
}

.poll-list li,
.invitee-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.poll-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.delete-poll-form {
  margin-left: auto;
}

.badge {
  font-size: 0.8em;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: #e5e7eb;
}

.badge-ok {
  background: var(--ok-bg);
  color: var(--ok-fg);
}

.badge-muted {
  background: #f3f4f6;
  color: var(--muted);
}

.results-table {
  border-collapse: collapse;
  width: 100%;
  overflow-x: auto;
  display: block;
}

.results-table th,
.results-table td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  text-align: center;
}

.results-table th:first-child,
.results-table td:first-child {
  text-align: left;
  min-width: 10rem;
}

.results-table th.slot-time {
  min-width: 9rem;
}

.slot-date-part,
.slot-time-part {
  display: block;
}

.slot-time-part {
  color: var(--muted);
  font-size: 0.85em;
}

.results-table .best-col,
.results-table tr.best-choice {
  background: var(--best-bg);
  font-weight: 700;
}

.results-table tr.summary-row td {
  font-weight: 700;
}

.results-table td.cell-yes {
  background: var(--yes-bg);
  color: var(--yes-fg);
}

.results-table td.cell-no {
  background: var(--no-bg);
  color: var(--no-fg);
}

.results-table td.cell-maybe {
  background: var(--maybe-bg);
  color: var(--maybe-fg);
}

.site-header a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.site-logo {
  display: block;
}

.site-footer {
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9em;
}

.site-footer a {
  color: inherit;
}

.version {
  color: var(--muted);
  font-size: 0.85em;
  margin-bottom: 0.25rem;
}

.change-banner {
  border: 1px solid var(--border);
  background: var(--maybe-bg);
  color: var(--maybe-fg);
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  max-width: 480px;
}

.change-banner ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.slot-manage-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  max-width: 480px;
}

.slot-manage-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.delete-slot-form {
  display: inline;
}

.danger-link {
  color: #b91c1c;
}

.danger-button {
  background: #b91c1c;
  border-color: #b91c1c;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.button-row form {
  margin: 0;
}

.scroll-hint {
  display: none;
}

@media (max-width: 600px) {
  .container {
    padding: 1rem;
  }

  /* Comfortable ~44px touch targets, matching platform tap-target
     guidance. Radio/checkbox controls are excluded — their own box stays
     small, but the label wrapping them (below) gets the same treatment,
     since clicking anywhere in the label already activates the control. */
  button,
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  select {
    min-height: 2.75rem;
  }

  .slot-checklist label,
  .slot-options .option,
  #multi-select-limits label {
    min-height: 2.75rem;
  }

  /* .results-table already scrolls horizontally via overflow-x:auto, but
     the native scrollbar alone isn't an obvious enough cue on a phone. */
  .scroll-hint {
    display: block;
    margin-bottom: 0.35rem;
  }
}

.admin-nav {
  color: var(--muted);
  font-size: 0.9em;
  margin-bottom: 0;
}
