:root {
  --accent: #4b4e2f;
  --accent-dark: #383a22;
  --cream: #f3ead3;
  --surface: #fffdf7;
  --charcoal: #232016;
  --text: #2c2c2c;
  --muted: #6a6a6a;
  --border: #e5dcc4;
  --radius: 14px;
  --success: #4f6b43;
  --error: #a14b42;
  --font-body: 'Lato', system-ui, -apple-system, sans-serif;
  --font-display: 'Playfair Display', 'Georgia', serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--cream);
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 32px;
  background: var(--charcoal);
  color: var(--cream);
}

header img { height: 56px; flex-shrink: 0; }

.brand-text { display: flex; flex-direction: column; }
header h1 {
  font-family: var(--font-display);
  font-size: 40px;
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.1;
  color: var(--cream);
}
header #siteTagline {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  line-height: 1;
  margin: 6px 0 0;
  color: #cdbf8f;
}

main {
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

main h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2px;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

main > section { margin-bottom: 36px; }

/* A step the customer hasn't reached yet - visible so they can see what's
   coming, but greyed out and inert until the step before it is done. */
.section-disabled {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.2s;
}

main h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  margin: 20px 0 10px;
}
.card h3:not(:first-of-type) {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.collapsible-heading { display: flex; justify-content: space-between; align-items: center; }
.hide-btn { padding: 4px 12px; font-size: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 12px rgba(35, 32, 22, 0.06);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.tab {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 600;
}
.tab:hover { border-color: var(--accent); background: rgba(75, 78, 47, 0.06); }
.tab.active { background: var(--accent); color: var(--cream); border-color: var(--accent); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
}

.service {
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.service:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(35, 32, 22, 0.1); }
.service.selected { border-color: var(--accent); background: #f3f1e6; }
.service h3 { margin: 0 0 6px; font-weight: 700; }
.service .price { color: var(--accent); font-weight: 700; }

select, input, button, textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

select[multiple] { border-radius: 8px; }

textarea {
  display: block;
  width: 100%;
  border-radius: var(--radius);
  resize: vertical;
  margin: 14px 0;
}

.promo-input {
  max-width: 220px;
}

input[type="checkbox"], input[type="radio"] {
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 4px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

button {
  background: var(--accent);
  color: var(--cream);
  border: none;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 10px 20px;
  transition: background 0.15s, opacity 0.15s;
}
button:hover { background: var(--accent-dark); }
button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
button.secondary:hover { background: rgba(75, 78, 47, 0.08); }

button.btn-loading { opacity: 0.6; cursor: progress; }
button.btn-success, button.secondary.btn-success { background: var(--success) !important; color: var(--cream) !important; border-color: var(--success) !important; }
button.btn-error, button.secondary.btn-error { background: var(--error) !important; color: var(--cream) !important; border-color: var(--error) !important; }

.slots {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.slot {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
}
.slot:hover { border-color: var(--accent); background: #f3f1e6; }
.slot.selected { border-color: var(--accent); background: #f3f1e6; font-weight: 700; }
.slot.taken { color: var(--muted); background: #ece6d6; cursor: not-allowed; border-color: var(--border); }

#confirmationDetails { line-height: 1.7; margin: 0 0 16px; }

.booking-summary {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--cream);
}
.summary-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.summary-total {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 8px;
  font-weight: 700;
  color: var(--accent);
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#bookingCalHeading {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 4px;
}
#bookingCalNav { margin: 16px 0 20px; }
#bookingCalList { margin-top: 4px; }
.cal-day-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.cal-day-row:last-child { border-bottom: none; }
.cal-day-header {
  flex: 0 0 70px;
  font-weight: 700;
  color: var(--accent);
  font-size: 13px;
  line-height: 1.4;
}
.cal-day-list { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.cal-booking {
  position: relative;
  flex: 0 1 220px;
  min-width: 160px;
  padding: 6px 22px 6px 8px;
  border-radius: 8px;
  border-left: 4px solid var(--accent);
  background: rgba(75, 78, 47, 0.08);
  font-size: 13px;
  line-height: 1.4;
}
.cal-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(35, 32, 22, 0.15);
  color: var(--text);
  font-size: 11px;
  line-height: 16px;
  cursor: pointer;
}
.cal-delete-btn:hover { background: var(--error); color: var(--cream); }
.cal-day-empty { color: var(--muted); font-size: 13px; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
tr:last-child td { border-bottom: none; }
th { background: var(--cream); font-weight: 700; }

#rosterTable { margin-top: 14px; }
.roster-cell.free { color: var(--muted); }
.roster-cell.booked { background: rgba(75, 78, 47, 0.08); font-weight: 600; border-left: 4px solid var(--accent); }
.roster-cell.off { color: var(--muted); background: var(--border); }
.roster-row-now td:first-child { color: var(--accent); font-weight: 700; position: relative; }
.roster-row-now td:first-child::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
}

.roster-stats {
  font-size: 14px;
  margin-top: 10px;
  color: var(--text);
}

.roster-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 10px 0 6px;
  font-size: 13px;
}
.legend-item { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 2px solid;
  display: inline-block;
}

#availWeeklyRow, #availSlotGrid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 20px;
}
#availWeeklyRow label, #availSlotGrid label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
#availWeeklyRow label:hover, #availSlotGrid label:hover { border-color: var(--accent); }
#availWeeklyRow label:has(input:checked), #availSlotGrid label:has(input:checked) {
  border-color: var(--accent);
  background: rgba(75, 78, 47, 0.08);
  font-weight: 600;
}

#employeeList { margin: 14px 0 20px; }
.staff-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.staff-list-row:last-child { border-bottom: none; }
/* The name/login text varies in length per row - let it grow/shrink instead
   of space-between, so "Manage login"/"Remove" always sit flush together at
   the right edge and line up in a clean column down the list. */
.staff-list-row > span:first-child { flex: 1; min-width: 0; }

#availWeekTable { margin: 14px 0 18px; }
#availWeekTable th, #availWeekTable td { text-align: center; padding: 12px 8px; }
#availWeekTable th:first-child, #availWeekTable td:first-child { text-align: left; }

#abServiceSections { margin-bottom: 20px; }
.ab-service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px 16px;
  margin-bottom: 8px;
}
.ab-service-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.ab-service-item:hover { border-color: var(--accent); }
.ab-service-item:has(input:checked) {
  border-color: var(--accent);
  background: rgba(75, 78, 47, 0.08);
}
.ab-service-item span:nth-child(2) { flex: 1; }

.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#availStaffLabel { font-weight: 600; font-size: 14px; color: var(--text); }
.login-row input { flex: 1 1 200px; min-width: 0; }

@media (max-width: 520px) {
  header { padding: 16px 20px; flex-wrap: wrap; row-gap: 10px; }
  header img { height: 40px; }
  header h1 { font-size: 28px; }
  header #siteTagline { font-size: 10px; letter-spacing: 2px; }
  main { padding: 24px 16px 48px; }
  .card { padding: 16px; }

  /* Stack inputs/selects full-width instead of squeezing several onto one line. */
  .row > input, .row > select, .row > textarea { flex: 1 1 100%; min-width: 0; }
  .promo-input { max-width: none; }

  /* Buttons already wrap via .row, but give them room to breathe when stacked. */
  button { padding: 10px 16px; }

  .ab-service-grid { grid-template-columns: 1fr; }

  /* Stack the date above its bookings instead of beside them, for max width. */
  .cal-day-row { flex-direction: column; gap: 4px; }
  .cal-day-header { flex: none; }
}
