:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9dee8;
  --primary: #1f7a68;
  --primary-ink: #ffffff;
  --accent: #e8f3ef;
  --danger: #b42318;
  --warning: #b54708;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: inherit; }
main { max-width: 1100px; margin: 0 auto; padding: 36px 20px 72px; }
.topbar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.brand { font-weight: 800; text-decoration: none; }
nav { display: flex; align-items: center; gap: 16px; }
nav a, .link-button { color: var(--muted); text-decoration: none; font: inherit; }
.inline { display: inline; }
.link-button { border: 0; background: transparent; cursor: pointer; padding: 0; }
.language-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}
.language-form label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font: inherit;
  font-weight: 400;
}
.language-label {
  color: var(--muted);
  font: inherit;
  font-weight: 400;
}
.language-form select {
  width: auto;
  min-height: 34px;
  padding: 5px 8px;
  color: var(--muted);
  font: inherit;
  font-weight: 400;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hero { text-align: center; padding: 72px 0 56px; }
.pill {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 22px;
}
h1 { font-size: clamp(2rem, 6vw, 4rem); line-height: 1.05; margin: 0 0 16px; letter-spacing: 0; }
h1 span { color: var(--primary); }
h2 { margin: 0 0 14px; font-size: 1.1rem; }
h3 { margin: 0 0 10px; font-size: .95rem; }
p { margin: 0 0 18px; }
.hero p { max-width: 640px; margin: 0 auto 28px; color: var(--muted); font-size: 1.1rem; }
.features, .cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.features article, .panel, .poll-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}
.features p, .muted { color: var(--muted); }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid var(--line);
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
}
.button.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.button.secondary { background: var(--panel); color: var(--text); }
.button.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.button.small { min-height: 32px; padding: 6px 12px; font-size: 0.85rem; }
.button.wide { width: 100%; }
.page-heading { margin-bottom: 24px; }
.page-heading h1 { font-size: clamp(2rem, 4vw, 3rem); }
.page-heading p { color: var(--muted); }
.split { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.form-grid, .stack { display: grid; gap: 18px; }
.compact { gap: 10px; }
.narrow { max-width: 480px; margin: 48px auto; }
.setup { margin-top: 24px; }
.auth-dialog {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #f9fafb;
}
.auth-dialog p:last-child { margin-bottom: 0; }
label { display: grid; gap: 6px; font-weight: 700; color: #344054; }
hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
input, select, textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  font: inherit;
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; }
select.invalid { border-color: var(--danger); }
input[readonly] { background: #f1f3f7; }
.input-with-check { display: flex; gap: 8px; align-items: center; }
.input-with-check input { flex: 1; }
.check-label { display: flex; align-items: center; }
.check-label input { width: 16px; min-height: 16px; margin: 0; }
label.checkbox-only { display: flex; align-items: center; margin-left: -8px; }
.two { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.participant-row + .participant-row { margin-top: 12px; }
.csv-upload { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.csv-upload p { margin-bottom: 8px; }
.panel-title-row { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 12px; }
.checkbox { display: flex; grid-template-columns: none; align-items: center; gap: 8px; font-weight: 600; }
.checkbox input { width: auto; min-height: auto; }
.slot-grid { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.slot-day { min-width: 142px; }
.slot-day h3 { text-align: center; }
.slot-option {
  display: block;
  position: relative;
  margin-bottom: 7px;
  font-weight: 700;
}
.slot-option input { position: absolute; opacity: 0; pointer-events: none; }
.slot-option span, .availability {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  font-size: .84rem;
}
.slot-option input:checked + span, .availability.all {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}
.availability.some { background: var(--accent); border-color: #9bcbbb; }
.availability.none { background: #f1f3f7; color: var(--muted); }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.plain-list li { display: grid; gap: 8px; }
.date-management { display: grid; gap: 16px; }
.date-management-list { display: grid; gap: 8px; }
.date-management-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
}
.badge {
  display: inline-flex;
  width: max-content;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: .75rem;
  font-weight: 700;
  background: var(--accent);
  color: var(--primary);
}
.badge.danger { background: #fee4e2; color: var(--danger); }
.poll-list { display: grid; gap: 12px; }
.poll-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  text-decoration: none;
}
.poll-row small { display: block; color: var(--muted); margin-top: 4px; }
.poll-row em { color: var(--muted); font-style: normal; white-space: nowrap; }
.empty { text-align: center; }
.flash {
  max-width: 1100px;
  margin: 0 auto 18px;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.flash.success { border-color: #7bc4a8; color: #05603a; }
.flash.error { border-color: #fda29b; color: var(--danger); }

@media (max-width: 760px) {
  .topbar, .split, .poll-row { align-items: stretch; flex-direction: column; }
  nav { flex-wrap: wrap; }
  .features, .cards, .two, .three { grid-template-columns: 1fr; }
  main { padding-top: 20px; }
  .hero { padding-top: 36px; }
}

/* Date Selection Tabs and Layout */
.date-selector-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  background: transparent;
  padding: 0;
  border-radius: 0;
  border: 0;
}
.date-tab {
  flex: 1;
  min-width: 0;
  text-align: center;
  min-height: 39px;
  padding: 8px 18px;
  cursor: pointer;
  font-weight: 700;
  border-radius: 4px;
  font-size: 1rem;
  transition: all 0.2s ease;
  user-select: none;
  background: var(--primary);
  color: var(--primary-ink);
  border: 1px solid var(--primary);
  white-space: nowrap;
}
.date-tab.active {
  background: #35a487;
  border-color: #35a487;
  color: var(--primary-ink);
  box-shadow: none;
}
.date-tab:hover:not(.active) {
  color: var(--primary-ink);
  background: #1b6f5f;
  border-color: #1b6f5f;
}
.button.date-action {
  min-height: 39px;
  padding: 8px 18px;
  border-radius: 4px;
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 1rem;
  box-shadow: none;
}
.button.date-action:hover {
  background: #1b6f5f;
  border-color: #1b6f5f;
}
.button.date-action.small {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 0.85rem;
}
.add-more-participants {
  margin-top: 10px;
}

.date-panel {
  display: none;
  animation: fadeIn 0.2s ease;
}
.date-panel[hidden] {
  display: none;
}
.date-panel.active {
  display: grid;
  gap: 14px;
}
.date-picker-row {
  align-items: end;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Date preview list */
.selected-dates-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.selected-dates-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 14px;
  row-gap: 10px;
  margin-top: 10px;
  min-height: 48px;
  padding: 10px;
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: 8px;
  align-items: center;
}
.selected-dates-list-empty-msg {
  color: var(--muted);
  font-style: italic;
  font-size: 0.9rem;
  display: block;
  width: 100%;
  text-align: center;
  padding: 8px 0;
}
.date-range-row {
  display: grid;
  gap: 8px;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  box-shadow: none;
  animation: scaleIn 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.date-range-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 600;
}
.date-range-title > div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
.date-range-title span {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.date-range-title small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.date-range-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  padding: 0;
}
.icon-btn.success {
  border-color: #7bc4a8;
  color: #05603a;
}
.icon-btn.danger {
  border-color: #fda29b;
  color: var(--danger);
}
.icon-btn:hover {
  transform: translateY(-1px);
}
.date-range-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.date-range-controls label {
  font-size: 0.75rem;
  gap: 3px;
}
.date-range-controls select {
  min-height: 34px;
  padding: 5px 7px;
  font-size: 0.85rem;
}
.field-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.78rem;
}
.date-range-row .remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  transition: all 0.15s ease;
}
.date-range-row .remove-btn img {
  display: block;
  width: 15px;
  height: 15px;
}
.date-range-row .remove-btn:hover {
  transform: translateY(-1px);
}

/* Weekday Selector Grid */
.weekday-title {
  margin-bottom: 6px;
}
.weekday-selector {
  display: flex;
  flex-wrap: nowrap;
  gap: 22px;
  margin: 6px 0;
  width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
  align-items: center;
}
.weekday-checkbox {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}
.weekday-checkbox input {
  position: static;
  opacity: 1;
  pointer-events: auto;
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
}
.weekday-checkbox span {
  display: inline;
  min-height: 0;
  border: 0;
  border-radius: 0;
  font: inherit;
  background: transparent;
  color: var(--text);
  transition: none;
  text-align: left;
}

@media (max-width: 600px) {
  .date-selector-tabs {
    flex-wrap: wrap;
  }
  .date-tab {
    flex: 1 1 calc(50% - 6px);
    white-space: normal;
  }
  .weekday-selector {
    flex-wrap: wrap;
    overflow-x: visible;
  }
  .weekday-checkbox {
    flex: 0 0 auto;
  }
  .selected-dates-list {
    grid-template-columns: 1fr;
    column-gap: 0;
  }
}

@media (max-width: 420px) {
  .selected-dates-list {
    grid-template-columns: 1fr;
  }
}
