/* ── Reset & base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f5f4f2;
  --surface:   #ffffff;
  --border:    #e2e0dc;
  --text:      #2c2c2c;
  --muted:     #6b6b6b;
  --accent:    #65a30d;   /* lime-600 */
  --accent-h:  #4d7c0f;   /* lime-700 */
  --yes-bg:    #dcfce7;
  --yes-text:  #166534;
  --no-bg:     #fef9c3;
  --no-text:   #854d0e;
  --radius:    8px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem;
}

.site-logo {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .4rem;
}

.site-logo-icon {
  display: block;
  flex-shrink: 0;
}

/* ── Layout ───────────────────────────────────── */
main {
  max-width: 720px;
  margin: 2rem auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Card ─────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
}

.card h1 { font-size: 1.5rem; margin-bottom: .25rem; }
.card h2 { font-size: 1.15rem; margin-bottom: 1rem; }

.subtitle {
  color: var(--muted);
  margin-bottom: 1.5rem;
  font-size: .95rem;
}

/* ── Forms ────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: 1.25rem;
}

label {
  font-weight: 500;
  font-size: .9rem;
}

input[type="text"],
input[type="datetime-local"] {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .75rem;
  font-size: .95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color .15s;
  width: 100%;
}

input[type="text"]:focus,
input[type="datetime-local"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(101,163,13,.15);
}

/* ── Slot rows ────────────────────────────────── */
#slots-container {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-bottom: .75rem;
}

.slot-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: .5rem;
  align-items: center;
}

/* ── Buttons ──────────────────────────────────── */
.btn-primary, .btn-secondary {
  border: none;
  border-radius: var(--radius);
  padding: .55rem 1.1rem;
  font-size: .9rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-h); }

.btn-secondary {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); color: var(--text); }

.add-slot-btn { margin-top: .25rem; }

/* ── Checkboxes ───────────────────────────────── */
.slot-checkboxes {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
  font-size: .95rem;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color .15s, background .15s;
}

.checkbox-label:hover {
  border-color: var(--accent);
  background: #f0f9df;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 1rem;
  height: 1rem;
}

/* ── Availability table ───────────────────────── */
.availability-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  margin-bottom: 1rem;
}

.availability-table th,
.availability-table td {
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  text-align: center;
}

.availability-table th {
  background: var(--bg);
  font-weight: 600;
}

.availability-table .participant-name {
  text-align: left;
  font-weight: 500;
}

.edit-btn {
  font-size: .72rem;
  padding: .15rem .45rem;
  margin-left: .5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  vertical-align: middle;
}
.edit-btn:hover { background: var(--border); color: var(--text); }

.availability-table td.yes {
  background: var(--yes-bg);
  color: var(--yes-text);
  font-weight: 600;
}

.availability-table td.no {
  background: var(--no-bg);
  color: var(--no-text);
}

.totals-label {
  text-align: left;
  font-weight: 700;
}

.total-count {
  font-weight: 700;
  font-size: 1rem;
}

/* ── Calendar ─────────────────────────────────── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: .25rem;
}

.cal-month { min-width: 0; }

.cal-month-title {
  font-size: .82rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: .4rem;
  letter-spacing: .01em;
}

.cal-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  font-size: .78rem;
}

.cal-dow {
  font-weight: 600;
  font-size: .68rem;
  color: var(--muted);
  aspect-ratio: auto;
  padding-bottom: .3rem;
}

.cal-day {
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 50%;
  font-family: inherit;
  color: var(--text);
  transition: background .1s, color .1s;
}
button.cal-day:hover:not(:disabled) { background: var(--border); }
.cal-day.past { color: var(--border); cursor: default; }
.cal-day.today { font-weight: 700; box-shadow: inset 0 0 0 2px var(--accent); }
.cal-day.selected { background: var(--accent); color: #fff; font-weight: 600; }
.cal-day.selected:hover { background: var(--accent-h); }

.label-optional { font-weight: 400; color: var(--muted); font-size: .85em; }
.field-hint { font-size: .82rem; color: var(--muted); margin-top: .3rem; }
.field-error { font-size: .82rem; color: #b91c1c; margin-top: .3rem; }

@media (max-width: 540px) {
  .calendar-grid { grid-template-columns: 1fr; }
}

/* ── Empty state ──────────────────────────────── */
.empty-state {
  color: var(--muted);
  font-style: italic;
  margin-bottom: 1rem;
}

/* ── Responsive ───────────────────────────────── */
@media (max-width: 600px) {
  .slot-row {
    grid-template-columns: 1fr 1fr;
  }
  .slot-row input[type="text"] {
    grid-column: 1 / -1;
  }
}
