/* ============================================================
   Design tokens
   ============================================================ */
:root {
  --page: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --surface-strong: #eef3f8;
  --ink: #172033;
  --muted: #647184;
  --muted-strong: #475569;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  --brand: #2563eb;
  --brand-ink: #1d4ed8;
  --brand-soft: #eff6ff;
  --accent: #0f766e;
  --accent-soft: #ecfdf5;
  --amber: #d97706;
  --amber-soft: #fffbeb;

  --ok: #15803d;
  --ok-soft: #ecfdf3;
  --warn: #b45309;
  --err: #dc2626;
  --err-soft: #fef2f2;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 16px 42px -28px rgba(15, 23, 42, 0.35), 0 1px 2px rgba(15, 23, 42, 0.05);
  --ring: 0 0 0 3px rgba(37, 99, 235, 0.18);
  --transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background:
    linear-gradient(180deg, #ffffff 0, var(--page) 320px),
    var(--page);
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   Header
   ============================================================ */
header.site {
  position: relative;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
}

header.site::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--accent), var(--amber));
}

.site-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 24px 30px;
}

header.site h1 {
  margin: 2px 0 4px;
  font-size: 1.8rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0;
}

header.site p {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: 0.96rem;
}

.staff-page .site-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.booking-page .site-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.staff-page header.site h1 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  color: var(--brand-ink);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

/* ============================================================
   Layout
   ============================================================ */
main {
  max-width: 1120px;
  margin: 0 auto 64px;
  padding: 24px;
}

.booking-main {
  display: grid;
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 18px;
}

.booking-card {
  display: grid;
  gap: 22px;
}

.flow-head,
.row-between,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.plain-title,
h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: 0;
}

h4 { font-weight: 700; }

.m0 { margin: 0; }

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.is-loading { color: var(--muted); }
.status-pill.is-ready {
  background: var(--accent-soft);
  border-color: #b7ead8;
  color: var(--accent);
}
.status-pill.is-empty {
  background: var(--amber-soft);
  border-color: #fde68a;
  color: var(--warn);
}

.tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.tab,
.toggle,
.week-chip {
  min-height: 34px;
  background: transparent;
  color: var(--muted-strong);
  border-color: transparent;
  box-shadow: none;
}

.tab:hover,
.toggle:hover,
.week-chip:hover {
  background: #fff;
  color: var(--brand-ink);
  transform: none;
}

.tab.active,
.toggle.active,
.week-chip.active {
  background: #fff;
  color: var(--brand-ink);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.calendar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 12px 0 14px;
}

.view-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.week-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.week-row {
  flex-wrap: wrap;
}

.upcoming-toggle {
  margin: 12px 0 8px;
}

/* ============================================================
   Inputs
   ============================================================ */
label,
.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted-strong);
  font-size: 0.84rem;
  font-weight: 750;
}

.field { margin: 0; }

.card > .field {
  margin: 16px 0;
}

#login-card {
  max-width: 440px;
}

#booking-notice.notice,
#manage-notice.notice,
#login-notice.notice,
#grid-notice.notice,
#upcoming-notice.notice {
  margin: 12px 0;
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

input::placeholder { color: #98a2b3; }

input:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23647184' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   Buttons
   ============================================================ */
button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.28);
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition), opacity var(--transition);
}

button:hover {
  background: var(--brand-ink);
  transform: translateY(-1px);
}

button:active { transform: translateY(0); }
button:focus-visible { outline: none; box-shadow: var(--ring); }
button:disabled { opacity: 0.48; cursor: not-allowed; transform: none; box-shadow: none; }

button.primary-action {
  justify-self: start;
  min-width: 190px;
}

button.secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

button.secondary:hover {
  background: var(--surface-soft);
  color: var(--brand-ink);
  border-color: var(--brand);
}

button.danger {
  background: var(--err);
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.25);
}

button.danger:hover { background: #b91c1c; }

button.small {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 0.82rem;
}

/* ============================================================
   Calendar toolbar
   ============================================================ */
.calendar-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(360px, 1.35fr);
  gap: 18px;
  align-items: start;
}

.booking-page .calendar-toolbar {
  grid-template-columns: minmax(260px, 520px);
}

.booking-page .selection-summary {
  padding: 12px 0 0;
  border-left: 0;
  border-top: 3px solid var(--line);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.segmented label {
  display: grid;
  gap: 2px;
  min-height: 64px;
  margin: 0;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.segmented label:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  font-size: 0.9rem;
  font-weight: 800;
}

.segmented small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.segmented label:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.segmented label:has(input:checked) small { color: var(--brand-ink); }

.date-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(92px, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.date-option {
  display: grid;
  grid-template-rows: auto auto auto auto;
  align-items: center;
  justify-items: center;
  min-height: 102px;
  min-width: 92px;
  padding: 10px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  box-shadow: none;
  text-align: center;
}

.date-option:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--ink);
}

.date-option.is-selected {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 18px -14px rgba(37, 99, 235, 0.85);
}

.date-weekday,
.date-month,
.date-range {
  color: currentColor;
  opacity: 0.76;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.date-number {
  font-size: 1.45rem;
  line-height: 1;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.date-range {
  opacity: 0.7;
  font-size: 0.68rem;
  text-transform: none;
}

.empty-date-strip {
  min-height: 102px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 700;
}

/* ============================================================
   Public booking calendar
   ============================================================ */
.calendar-section {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.section-head .muted {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.booking-step-title {
  margin: 0;
  color: var(--brand-ink);
  font-size: 1.15rem;
  font-weight: 850;
  text-align: center;
}

.booking-step-title:empty {
  display: none;
}

.daypanels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.daypanel {
  min-width: 0;
  background: #fff;
}

.daypanel-head {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.day-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted-strong);
  background: #fff;
  font-size: 0.72rem;
  font-weight: 850;
}

.day-title {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.day-title strong {
  font-size: 0.96rem;
  text-transform: capitalize;
}

.day-title span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.timeopts {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.timeopt {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  margin: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.timeopt:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  transform: translateY(-1px);
}

.timeopt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.time-dot {
  width: 10px;
  height: 10px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
}

.time-copy {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.time-window {
  font-size: 0.92rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.time-session {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.timeopt .rem {
  justify-self: end;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted-strong);
  font-size: 0.7rem;
  font-weight: 850;
  white-space: nowrap;
}

.timeopt:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.timeopt:has(input:checked) .time-dot {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 2px #fff;
}

.timeopt:has(input:checked) .time-session,
.timeopt:has(input:checked) .rem {
  color: var(--accent);
}

/* Calendar-style public booking flow */
.booking-calendars {
  display: grid;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.booking-week {
  min-width: 720px;
}

.booking-week-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  min-width: 150px;
  margin: 0;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-ink);
  font-size: 0.82rem;
  font-weight: 850;
}

.week-nav-btn {
  width: 38px;
  min-width: 38px;
  padding-inline: 0;
}

.booking-cal-grid {
  --slot-h: 52px;
  display: grid;
  grid-template-columns: 92px repeat(5, minmax(104px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.booking-cal-corner,
.booking-cal-head,
.booking-time-label {
  background: var(--surface-soft);
}

.booking-cal-corner {
  min-height: 50px;
}

.booking-cal-head {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 6px 4px;
  line-height: 1.2;
}

.booking-time-label {
  height: var(--slot-h);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.booking-slot {
  width: 100%;
  height: var(--slot-h);
  min-height: var(--slot-h);
  margin: 0;
  padding: 4px 6px;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 850;
  overflow: hidden;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  text-align: center;
  line-height: 1.1;
}

button.booking-slot:hover {
  transform: none;
}

.booking-slot.empty {
  background: #fff;
  color: var(--muted);
}

.booking-slot.disabled {
  background: #f7f9fc;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px #e8eef6;
}

button.booking-slot:disabled {
  opacity: 1;
  cursor: not-allowed;
  box-shadow: inset 0 0 0 1px #e8eef6;
}

.booking-slot.available {
  background: #fff;
  color: var(--ok);
  box-shadow: inset 0 0 0 1px #86efac;
}

.booking-slot.available:hover {
  background: var(--ok-soft);
  box-shadow: inset 0 0 0 1px var(--ok);
}

.booking-slot.selected {
  background: var(--accent);
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.booking-slot.selected:hover {
  background: #0d665f;
}

.slot-time,
.slot-action {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-time {
  color: currentColor;
  font-size: 0.76rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.slot-action {
  font-size: 0.64rem;
  font-weight: 800;
  opacity: 0.74;
}

.booking-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 750;
  text-align: center;
}

.checkout-grid {
  display: grid;
  grid-template-columns: minmax(260px, 520px);
  gap: 18px;
  align-items: end;
}

.selection-summary {
  min-height: 88px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px 0 0 16px;
  border-left: 3px solid var(--line);
}

.summary-title {
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.summary-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.summary-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.summary-day {
  min-width: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-time {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.summary-time.is-empty {
  color: var(--muted);
  font-weight: 750;
}

.summary-reset {
  justify-self: start;
  margin-top: 2px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.42);
}

.modal-panel {
  position: relative;
  width: min(620px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 24px 80px -36px rgba(15, 23, 42, 0.55);
}

.modal-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--muted-strong);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  font-size: 1rem;
  line-height: 1;
}

.modal-x:hover {
  background: var(--surface-soft);
  color: var(--ink);
  border-color: var(--brand);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.manage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.forgot-code {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.forgot-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.replace-code-field {
  margin-top: 16px;
}

/* ============================================================
   Notices
   ============================================================ */
.notice {
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  margin: 0;
  font-size: 0.9rem;
  font-weight: 650;
}

.notice.ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: #bbf7d0;
}

.notice.err {
  background: var(--err-soft);
  color: var(--err);
  border-color: #fecaca;
}

.notice.info {
  background: var(--brand-soft);
  color: var(--brand-ink);
  border-color: #bfdbfe;
}

.hidden { display: none !important; }

/* ============================================================
   Confirmation code + appointment lists
   ============================================================ */
.code-box {
  display: block;
  width: 100%;
  margin: 12px 0 4px;
  padding: 18px;
  border: 1px dashed #86efac;
  border-radius: var(--radius);
  background: var(--ok-soft);
  color: var(--ok);
  text-align: center;
  font-size: 1.8rem;
  font-weight: 850;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  box-shadow: none;
}

.code-box:hover {
  background: #dcfce7;
  border-color: var(--ok);
  color: var(--ok);
  transform: none;
}

.code-box:active {
  transform: none;
}

.code-intro {
  margin: 14px 0 0;
  text-align: center;
}

.code-hint {
  margin: 6px 0 0;
  text-align: center;
}

ul.appt-list {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  padding: 0;
  list-style: none;
}

ul.appt-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  font-size: 0.9rem;
  font-weight: 650;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: capitalize;
}

.tag.morning {
  background: var(--amber-soft);
  color: #92400e;
}

.tag.afternoon {
  background: var(--brand-soft);
  color: var(--brand-ink);
}

/* ============================================================
   Tables (staff upcoming)
   ============================================================ */
.scroll-x,
.gridwrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.86rem;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

thead th {
  background: var(--surface-soft);
  color: var(--muted);
  border-bottom: 1px solid var(--line-strong);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

thead th:first-child { border-top-left-radius: var(--radius-sm); }
thead th:last-child { border-top-right-radius: var(--radius-sm); }

tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--surface-soft); }

td input[type="text"] {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 0.82rem;
}

td input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

/* ============================================================
   Staff weekly calendar
   ============================================================ */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 12px 0 16px;
  color: var(--muted);
  font-size: 0.8rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.swatch {
  width: 16px;
  height: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  flex: none;
}

.swatch.open { background: #fff; border-style: dashed; }
.swatch.mine { background: var(--accent-soft); border-color: #99f6e4; }
.swatch.other { background: var(--surface-strong); }

.cal {
  min-width: 720px;
  margin-bottom: 20px;
}

.cal-title {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin: 0 0 8px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-ink);
  font-size: 0.82rem;
  font-weight: 850;
}

.cal-grid {
  --cell-h: 40px;
  display: grid;
  grid-template-columns: 94px repeat(5, minmax(104px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  align-items: stretch;
}

.cal-corner {
  min-height: 50px;
  background: var(--surface-soft);
}

.cal-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 6px 4px;
  background: var(--surface-soft);
  color: var(--ink);
  line-height: 1.2;
}

.cal-wd {
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: capitalize;
}

.cal-dm {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cal-sep {
  grid-column: 1 / -1;
  padding: 8px 10px;
  background: #fff;
  color: var(--muted-strong);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.cal-timelabel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: var(--cell-h);
  padding-right: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cal-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--cell-h);
  min-height: var(--cell-h);
  margin: 0;
  padding: 0 5px;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

button.cal-cell {
  cursor: pointer;
}

button.cal-cell:hover {
  transform: none;
}

.cal-cell.empty {
  background: #fff;
  color: transparent;
}

.cal-cell.open {
  background: #fff;
  color: #94a3b8;
  box-shadow: inset 0 0 0 1px #d8e0eb;
}

.cal-cell.open:hover {
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.cal-cell.mine {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px #99f6e4;
}

.cal-cell.mine:hover {
  background: #dffaf1;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.cal-cell.other {
  background: var(--surface-strong);
  color: var(--muted-strong);
  font-size: 0.7rem;
  font-weight: 750;
}

.owner-cell {
  --owner-color: var(--accent);
  justify-content: space-between;
  gap: 6px;
  padding: 0 8px 0 10px;
  background: color-mix(in srgb, var(--owner-color) 13%, white);
  color: var(--ink);
  box-shadow:
    inset 4px 0 0 var(--owner-color),
    inset 0 0 0 1px color-mix(in srgb, var(--owner-color) 30%, #d8e0eb);
}

.cal-cell.owner-cell {
  font-size: 0.78rem;
  font-weight: 850;
}

button.cal-cell.owner-cell:hover {
  background: color-mix(in srgb, var(--owner-color) 18%, white);
  box-shadow:
    inset 4px 0 0 var(--owner-color),
    inset 0 0 0 1px color-mix(in srgb, var(--owner-color) 48%, #d8e0eb);
}

.owner-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.owner-count {
  min-width: 34px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  padding: 0 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--owner-color) 14%, white);
  color: var(--owner-color);
  font-size: 0.72rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.owner-tag {
  --owner-color: var(--accent);
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 140px;
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--owner-color) 13%, white);
  color: var(--owner-color);
  font-size: 0.74rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upcoming-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin: 12px 0 8px;
}

.upcoming-tools .compact-field {
  flex: 1 1 150px;
  min-width: 130px;
}

.upcoming-tools .code-search-field {
  flex: 1 1 190px;
}

.upcoming-export {
  margin-left: auto;
}

.compact-field label {
  margin-bottom: 5px;
  font-size: 0.76rem;
}

.compact-field select,
.compact-field input {
  min-height: 36px;
  padding-top: 7px;
  padding-bottom: 7px;
  font-size: 0.84rem;
}

.participant-row td {
  vertical-align: top;
}

.participant-person {
  min-width: 150px;
}

.participant-slot-cell {
  min-width: 240px;
}

.participant-slot-cell {
  display: grid;
  gap: 8px;
}

.participant-slot-meta {
  display: grid;
  gap: 5px;
}

.participant-slot-meta strong {
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 750;
}

.participant-slot-cell input[type="text"] {
  width: 100%;
}

.compensation-select {
  min-height: 34px;
  min-width: 120px;
  font-size: 0.82rem;
}

.compensation-select:disabled {
  opacity: 0.6;
}

.inline-field {
  display: grid;
  gap: 4px;
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 750;
}

/* ============================================================
   Misc helpers
   ============================================================ */
.muted {
  color: var(--muted);
  font-size: 0.86rem;
}

p.muted { margin-top: 8px; }

strong { font-weight: 850; }

@media (max-width: 860px) {
  main { padding: 18px; }

  .calendar-toolbar,
  .checkout-grid {
    grid-template-columns: 1fr;
  }

  .selection-summary {
    padding: 12px 0 0;
    border-left: 0;
    border-top: 3px solid var(--line);
  }
}

@media (max-width: 680px) {
  .site-inner { padding: 20px 18px 24px; }
  header.site h1 { font-size: 1.45rem; }
  .booking-page .site-inner,
  .staff-page .site-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-actions {
    justify-content: flex-start;
  }
  main { padding: 16px; }
  .card { padding: 18px; }

  .flow-head,
  .section-head,
  .row-between {
    align-items: flex-start;
    flex-direction: column;
  }

  .upcoming-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .upcoming-export {
    margin-left: 0;
  }

  .status-pill { align-self: flex-start; }

  .daypanels {
    display: grid;
    grid-template-columns: 1fr;
  }

  .date-strip {
    grid-auto-columns: minmax(88px, 44%);
  }

  button.primary-action {
    width: 100%;
  }

  ul.appt-list li {
    align-items: flex-start;
    flex-direction: column;
  }

  .modal {
    padding: 12px;
  }

  .modal-panel {
    padding: 18px;
  }

  .manage-grid,
  .forgot-row {
    grid-template-columns: 1fr;
  }
}

/* ---- admin: user management ---- */
.admin-add-user {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin: 10px 0 14px;
}

.admin-add-user .compact-field {
  flex: 1 1 180px;
  min-width: 140px;
}

.admin-sep {
  border: none;
  border-top: 1px solid var(--border, #e5e7eb);
  margin: 26px 0 18px;
}

#users-table td {
  vertical-align: middle;
}

/* ---- staff: forgotten-code notifications ---- */
.notifications-card {
  border-left: 4px solid var(--accent, #2563eb);
}

.notification-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notification-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent, #2563eb) 6%, white);
}

.notification-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
}

.notification-email {
  font-weight: 700;
  word-break: break-all;
}

.notification-code {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.notification-meta {
  font-size: 0.78rem;
  margin-top: 2px;
}
