/* Celeste Booking design system.
   Mobile-first, no component library. Brand comes from the --brand-* variables the layout emits per clinic
   (see BrandPalette); every fallback below is the Celeste theme, so the sheet also works without them. */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light dark;

  /* Brand (light) */
  --primary: var(--brand-primary, #083556);
  --on-primary: var(--brand-on-primary, #ffffff);
  --primary-text: var(--brand-primary-text, #083556);
  --accent: var(--brand-accent, #10ac84);
  --on-accent: var(--brand-on-accent, #0b1f2e);
  --radius: var(--brand-radius, 14px);
  --font: var(--brand-font, "Inter", "Segoe UI Variable Text", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
  --font-heading: var(--brand-font-heading, var(--font));

  /* Neutrals (keep --surface and --ink in sync with BrandPalette.LightSurface / DarkInk) */
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eaeff4;
  --ink: #0b1f2e;
  --ink-2: #4a5b6a;
  --line: #d6dee6;
  --line-strong: #7d8c9a;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --notice-soft: #fff5d9;
  --notice-ink: #5c4300;

  /* Derived */
  --primary-soft: color-mix(in oklch, var(--primary) 9%, var(--surface));
  --primary-hover: color-mix(in oklch, var(--primary) 86%, black);
  --focus: color-mix(in oklch, var(--primary-text) 70%, var(--accent));

  /* Shape, space, type */
  --radius-sm: min(var(--radius), 10px);
  --radius-pill: 999px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --tap: 48px;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --shadow-1: 0 1px 2px rgb(11 31 46 / 0.04), 0 8px 24px -12px rgb(11 31 46 / 0.16);
  --shadow-3: 0 2px 4px rgb(11 31 46 / 0.05), 0 22px 44px -18px rgb(11 31 46 / 0.30);

  /* Celeste identity: the blue-to-mint gradient of its mark. Used where the page has no clinic colours. */
  --celeste-blue: #133eb1;
  --celeste-sky: #379adc;
  --celeste-mint: #66de9c;
  --shadow-2: 0 -2px 12px rgb(11 31 46 / 0.10);
  --content: 1040px;
  --tabbar-h: 0px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: var(--brand-primary-dark, #466880);
    --on-primary: var(--brand-on-primary-dark, #ffffff);
    --primary-text: var(--brand-primary-text-dark, #6b869a);
    --accent: var(--brand-accent-dark, #10ac84);
    --on-accent: var(--brand-on-accent-dark, #0b1f2e);

    /* --surface matches BrandPalette.DarkSurface */
    --bg: #0a1119;
    --surface: #0f1822;
    --surface-2: #1a2633;
    --ink: #e9eef3;
    --ink-2: #a8b6c3;
    --line: #2a3848;
    --line-strong: #6f7f8e;
    --danger: #ff8a80;
    --danger-soft: #3a1512;
    --notice-soft: #33290a;
    --notice-ink: #ffe08a;
    --primary-hover: color-mix(in oklch, var(--primary) 86%, white);
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-3: 0 2px 4px rgb(0 0 0 / 0.4), 0 22px 44px -18px rgb(0 0 0 / 0.7);
    --shadow-2: 0 -2px 12px rgb(0 0 0 / 0.5);
  }

  /* Initials on the soft brand tint need the full ink to stay readable on dark. */
  .avatar:not(.avatar-accent) { color: var(--ink); }
}

/* The bottom tab bar exists when the site runs installed, as an app. */
@media (display-mode: standalone) {
  :root { --tabbar-h: 60px; }
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  line-height: 1.2;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
p { margin: 0; }
a { color: var(--primary-text); }
img, svg { max-width: 100%; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -100px;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--space-2); }

/* Places the script sends the focus to (the heading of a new step, the main area): a reading position for
   screen readers, not a control, so no ring is drawn around them. */
[tabindex="-1"]:focus { outline: none; }

/* The hidden attribute always wins: a class that sets display (.btn, .card…) must not bring the element back. */
[hidden] { display: none !important; }

.muted { color: var(--ink-2); }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-2); }
.icon { width: 1.25em; height: 1.25em; flex: none; }

/* ---------- 3. Page frame ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--primary);
  color: var(--on-primary);
}

.app-header-inner {
  max-width: var(--content);
  margin: 0 auto;
  min-height: 56px;
  padding: var(--space-1) var(--space-4);
  padding-left: max(var(--space-4), env(safe-area-inset-left));
  padding-right: max(var(--space-4), env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  min-height: var(--tap);
  color: inherit;
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-lg);
}
.brand-icon { width: 36px; height: 36px; border-radius: 10px; flex: none; }
/* The clinic's own logo. Drawn for coloured backgrounds it sits straight on the header; otherwise on a light plate. */
.brand-logo { height: 36px; width: auto; max-width: min(200px, 46vw); object-fit: contain; flex: none; }
.brand-logo.is-plated { background: #ffffff; padding: 4px 8px; border-radius: 8px; height: 40px; }
.header-nav { display: flex; }
.header-link[aria-current="page"] { background: color-mix(in srgb, var(--on-primary) 18%, transparent); }
.cover { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--radius); }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-spacer { flex: 1; }

.app-main {
  flex: 1;
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
  padding-left: max(var(--space-4), env(safe-area-inset-left));
  padding-right: max(var(--space-4), env(safe-area-inset-right));
}

.app-footer {
  padding: var(--space-5) var(--space-4);
  /* Room for whatever is fixed to the bottom of the screen. */
  padding-bottom: calc(var(--space-5) + var(--tabbar-h) + var(--sheet-h, 0px) + env(safe-area-inset-bottom));
  text-align: center;
  color: var(--ink-2);
  font-size: var(--text-sm);
}
.app-footer a { color: inherit; }

/* Language menu: a <details>, so it works without script. */
.lang { position: relative; }
.lang > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--tap);
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-weight: 600;
  font-size: var(--text-sm);
}
.lang > summary::-webkit-details-marker { display: none; }
.lang > summary:hover { background: color-mix(in srgb, var(--on-primary) 14%, transparent); }
.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-1));
  min-width: 170px;
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgb(11 31 46 / 0.18);
}
.lang-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: calc(var(--radius-sm) - 2px);
  color: inherit;
  text-decoration: none;
}
.lang-menu a:hover { background: var(--surface-2); }
.lang-menu a[aria-current="true"] { font-weight: 700; color: var(--primary-text); }

/* ---------- 4. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0 var(--space-5);
  border: 1.5px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { border-color: var(--line-strong); background: var(--surface); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { color: var(--primary-text); padding: 0 var(--space-3); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 44px; padding: 0 var(--space-4); font-size: var(--text-sm); }
.btn[aria-disabled="true"], .btn:disabled {
  background: var(--surface-2);
  border-color: transparent;
  color: var(--ink-2);
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- 5. Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
}

.card-list { display: grid; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }

/* A card that is one big link: the whole surface is the tap target. */
.card-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 72px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.card-link:hover { border-color: var(--primary-text); background: var(--primary-soft); }
.card-link[aria-current="true"] { border-color: var(--primary-text); box-shadow: inset 0 0 0 1px var(--primary-text); background: var(--primary-soft); }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.card-title { font-weight: 650; overflow-wrap: anywhere; }
.card-meta { color: var(--ink-2); font-size: var(--text-sm); }
.card-aside { flex: none; font-weight: 650; text-align: right; white-space: nowrap; }
.card-chevron { flex: none; color: var(--ink-2); }

.avatar {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-weight: 700;
}
.avatar-accent { background: var(--accent); color: var(--on-accent); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.75rem;
  font-weight: 700;
}

/* ---------- 6. Alerts ---------- */
.alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius);
  background: var(--notice-soft);
  color: var(--notice-ink);
}
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert a { color: inherit; font-weight: 650; }

/* ---------- 7. Search ---------- */
.search { display: flex; gap: var(--space-2); }
.field {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 var(--space-4);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.field::placeholder { color: var(--ink-2); opacity: 1; }

/* ---------- 7b. Forms ---------- */
.form { display: flex; flex-direction: column; gap: var(--space-4); }
.form-inline { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
.form-field { display: flex; flex-direction: column; gap: var(--space-1); }
.form-field label { font-weight: 650; font-size: var(--text-sm); }
.input {
  width: 100%;
  min-height: var(--tap);
  padding: 0 var(--space-3);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: var(--text-sm); }
.field-error:empty { display: none; }
/* One field for the whole code: the phone can fill it in from the SMS, and screen readers get one label. */
.code-input { font-size: 1.5rem; font-weight: 700; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--primary-text); flex: none; }
/* Bot trap: out of sight and out of the tab order, but not display:none (bots skip those). */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.actions { display: flex; flex-direction: column; gap: var(--space-3); }
.narrow { max-width: 480px; margin-inline: auto; width: 100%; }
.header-link { display: grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 50%; color: inherit; }
.header-link:hover { background: color-mix(in srgb, var(--on-primary) 14%, transparent); }
.header-link .icon { width: 24px; height: 24px; }
.btn:disabled { opacity: 0.7; }

/* ---------- 7c. Appointments and account ---------- */
.appointment { display: flex; flex-direction: column; gap: var(--space-3); }
.appointment-when { font-weight: 700; font-size: var(--text-lg); font-family: var(--font-heading); }
.appointment-lines { display: flex; flex-direction: column; gap: 2px; color: var(--ink-2); }
.appointment-lines strong { color: var(--ink); font-weight: 650; }
.appointment-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.appointment-actions .btn { flex: 1 1 140px; }
.btn-danger { border-color: var(--danger); color: var(--danger); background: var(--surface); }
.btn-danger:hover { background: var(--danger-soft); }
.state { display: inline-flex; align-items: center; padding: 2px var(--space-2); border-radius: var(--radius-pill); background: var(--surface-2); color: var(--ink-2); font-size: 0.75rem; font-weight: 700; }
/* Choices on one line that wrap (professionals when changing an appointment). */
.chips.chips-inline { display: flex; flex-wrap: wrap; }
.chips.chips-inline .chip { padding: 0 var(--space-4); white-space: nowrap; }
.options { display: flex; flex-direction: column; margin: 0; padding: 0; border: 0; }
.options legend { padding: 0; font-weight: 650; margin-bottom: var(--space-1); }
.sheet form { flex: none; }
.link-list { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }

/* ---------- 8. Hero (front page and clinic home) ---------- */
.hero {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5) 0 var(--space-5);
}
.hero p { color: var(--ink-2); font-size: var(--text-lg); max-width: 56ch; }

/* ---------- 9. Wizard ---------- */
.wizard { display: grid; gap: var(--space-5); }
.wizard-main { min-width: 0; display: flex; flex-direction: column; gap: var(--space-5); }

.progress { display: flex; align-items: center; gap: var(--space-2); color: var(--ink-2); font-size: var(--text-sm); }
.progress-dots { display: flex; gap: 6px; }
.progress-dots i { width: 22px; height: 6px; border-radius: 3px; background: var(--line); }
.progress-dots i.is-done { background: var(--accent); }
.progress-dots i.is-current { background: var(--primary-text); }

/* Steps already answered, each with a way back. */
.answers { margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.answer { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4); min-height: 56px; }
.answer + .answer { border-top: 1px solid var(--line); }
.answer-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.answer-label { color: var(--ink-2); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.answer-value { font-weight: 650; overflow-wrap: anywhere; }

.step-head { display: flex; flex-direction: column; gap: var(--space-1); }
.step-head p { color: var(--ink-2); }

/* Day strip: two weeks, swipeable. */
.days-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.days-month { font-weight: 650; text-transform: capitalize; }
.days {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 60px;
  gap: var(--space-2);
  margin: 0 calc(-1 * var(--space-4));
  padding: var(--space-1) var(--space-4) var(--space-3);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--space-4);
  scrollbar-width: none; /* swiped on touch; the Earlier/Later links and the desktop grid cover the rest */
  list-style: none;
}
.days > li { scroll-snap-align: start; }
.day {
  position: relative; /* keeps its screen-reader-only text inside the scrolling strip, so it cannot widen the page */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 72px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}
.day-week { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-2); }
.day-num { font-size: var(--text-lg); font-weight: 700; line-height: 1; }
.day-month { font-size: 0.6875rem; color: var(--ink-2); }
a.day:hover { border-color: var(--primary-text); }
.day[aria-current="date"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.day[aria-current="date"] .day-week, .day[aria-current="date"] .day-month { color: inherit; }
.day[aria-disabled="true"] { background: transparent; border-style: dashed; color: var(--ink-2); }
.day[aria-disabled="true"] .day-num { font-weight: 500; text-decoration: line-through; }

/* Time chips */
.slot-group { display: flex; flex-direction: column; gap: var(--space-2); }
.slot-group h3 { font-size: var(--text-sm); color: var(--ink-2); font-family: var(--font); font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.chip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  transition: background-color 0.12s, border-color 0.12s;
}
.chip:hover { border-color: var(--primary-text); background: var(--primary-soft); }
.chip[aria-current="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* ---------- 10. Summary sheet ----------
   Phone: fixed to the bottom, above the tab bar. Desktop: a sticky card in the right column. */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--tabbar-h);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: var(--shadow-2);
}
@media (display-mode: standalone) {
  .sheet { padding-bottom: var(--space-3); }
}
.sheet-title { display: none; }
.sheet-summary { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sheet-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-line-strong { font-weight: 700; }
.sheet-line-muted { color: var(--ink-2); font-size: var(--text-sm); }
.sheet-details { display: none; }
.sheet .btn { flex: none; }
/* The confirmation shows its summary in the page on phones; the side card is for wide screens only. */
.sheet-static { display: none; }
body:has(.sheet:not(.sheet-static)) { --sheet-h: 76px; }

/* ---------- 11. Tab bar (installed app) ---------- */
.tabbar { display: none; }
@media (display-mode: standalone) {
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 16;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
}
/* The design-system page shows the bar in the page flow, whatever the display mode. */
.tabbar.is-demo { position: static; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; height: 60px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--ink-2);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}
.tab .icon { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--primary-text); }

/* ---------- 11b. Install hint ----------
   A quiet bar, never a pop-up: shown only where the site can be installed and until the patient says "not now". */
.install-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  width: calc(100% - 2 * var(--space-4));
  max-width: calc(var(--content) - 2 * var(--space-4));
  margin: 0 auto var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.install-hint[hidden] { display: none; }
.install-hint img { border-radius: 10px; flex: none; }
.install-hint p { flex: 1 1 200px; font-size: var(--text-sm); }
@media (display-mode: standalone) { .install-hint { display: none; } }

/* ---------- 12. Skeleton ---------- */
.skeleton {
  display: block;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
.skeleton-title { height: 32px; width: 60%; }
.skeleton-card { height: 72px; border-radius: var(--radius); }
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* ---------- 13. Desktop ---------- */
@media (min-width: 900px) {
  h1 { font-size: 2.125rem; }
  .app-main { padding-top: var(--space-6); }
  .hero { padding: var(--space-6) 0; }
  .card-list.is-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .wizard { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; gap: var(--space-6); }
  /* Room for the whole fortnight: two weeks, one under the other. */
  .days { margin: 0; padding-inline: 0; grid-auto-flow: row; grid-template-columns: repeat(7, minmax(0, 1fr)); overflow: visible; }

  .sheet {
    position: sticky;
    top: 88px;
    bottom: auto;
    z-index: 1;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
    padding: var(--space-5);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
  }
  .sheet-title { display: block; font-size: var(--text-lg); }
  .sheet-summary { display: none; }
  .sheet-details { display: grid; gap: var(--space-3); margin: 0; }
  .sheet-details div { display: flex; flex-direction: column; }
  .sheet-details dt { color: var(--ink-2); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
  .sheet-details dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
  .sheet-details dd.is-empty { color: var(--ink-2); font-weight: 400; }
  .sheet .btn { width: 100%; }
  .sheet-static { display: flex; }
  .actions { flex-direction: row; flex-wrap: wrap; }
  body:has(.sheet) { --sheet-h: 0px; }
}

/* ---------- 14. Motion ---------- */
@view-transition { navigation: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  @view-transition { navigation: none; }
}

/* ---------- 15. Look ----------
   The finish on top of the structure above: depth, the brand glow behind the page, the Celeste gradient where the
   clinic brings no colours of its own, and motion on the things one can tap. */
body {
  background:
    radial-gradient(900px 420px at 0% -8%, color-mix(in srgb, var(--primary-text) 13%, transparent), transparent 62%),
    radial-gradient(760px 380px at 100% -4%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 58%),
    var(--bg);
  background-attachment: fixed;
}

h1, h2, h3 { font-weight: 750; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.75rem, 3.2vw + 0.9rem, 2.5rem); }

/* Header */
.app-header { box-shadow: 0 10px 28px -16px rgb(11 31 46 / 0.55); }
.app-header::after {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), color-mix(in oklch, var(--accent) 35%, var(--primary)));
}
.app-header.is-celeste { background: linear-gradient(100deg, #083556 0%, #0c3a8f 58%, var(--celeste-blue) 100%); }
.app-header.is-celeste::after { background: linear-gradient(90deg, var(--celeste-blue), var(--celeste-sky) 45%, var(--celeste-mint)); }
.brand { letter-spacing: -0.01em; }

/* Footer */
.powered { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; text-decoration: none; font-weight: 600; }
.powered:hover span { text-decoration: underline; }

/* Buttons */
.btn-primary {
  background: linear-gradient(180deg, color-mix(in oklch, var(--primary) 90%, white), var(--primary));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18), 0 10px 20px -12px color-mix(in srgb, var(--primary) 85%, transparent);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn[aria-disabled="true"], .btn:disabled { box-shadow: none; }

/* Fields */
.input { border-radius: 12px; }
.field:focus-visible, .input:focus-visible {
  outline: none;
  border-color: var(--primary-text);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-text) 24%, transparent);
}

/* Cards */
.card { border-color: color-mix(in srgb, var(--line) 75%, transparent); border-radius: calc(var(--radius) + 4px); }
.card-link { transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s; }
.card-link:hover {
  transform: translateY(-2px);
  background: var(--surface);
  border-color: color-mix(in oklch, var(--primary-text) 45%, var(--line));
  box-shadow: var(--shadow-3);
}
.card-chevron { transition: transform 0.18s, color 0.18s; }
.card-link:hover .card-chevron { transform: translateX(3px); color: var(--primary-text); }
.avatar { width: 48px; height: 48px; border-radius: 14px; }
.answers { border-color: color-mix(in srgb, var(--line) 75%, transparent); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-1); }
.alert { border-radius: calc(var(--radius) + 2px); }

/* Front page: the Celeste panel */
.hero-brand {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding: var(--space-6) var(--space-5);
  border-radius: 28px;
  color: #ffffff;
  background:
    radial-gradient(260px 180px at 100% 100%, rgb(102 222 156 / 0.45), transparent 70%),
    linear-gradient(125deg, #072a63 0%, var(--celeste-blue) 55%, #1a63c9 100%);
  box-shadow: 0 32px 60px -34px rgb(19 62 177 / 0.65);
}
.hero-brand::before {
  content: "";
  position: absolute;
  z-index: -1;
  right: -36px;
  top: -28px;
  width: 280px;
  height: 232px;
  background: url("celeste-mark-white.svg") no-repeat center / contain;
  opacity: 0.1;
  transform: rotate(-8deg);
}
.hero-brand h1 { font-size: clamp(2rem, 4.4vw + 0.9rem, 3.25rem); line-height: 1.08; max-width: 17ch; }
.hero.hero-brand p { color: rgb(255 255 255 / 0.9); }
.hero-brand .search {
  margin-top: var(--space-3);
  max-width: 580px;
  padding: 6px;
  background: var(--surface);
  border-radius: var(--radius-pill);
  box-shadow: 0 16px 32px -14px rgb(3 20 60 / 0.65);
}
.hero-brand .search:focus-within { outline: 3px solid #ffffff; outline-offset: 2px; }
.hero-brand .field, .hero-brand .field:focus-visible { border-color: transparent; background: transparent; box-shadow: none; outline: none; }

/* Wizard */
.day-picker { display: flex; flex-direction: column; gap: var(--space-5); }
/* Another day is loading: the days stay, the times wait. */
.day-picker > :not(:first-child) { transition: opacity 0.15s; }
.day-picker[aria-busy="true"] > :not(:first-child) { opacity: 0.4; pointer-events: none; }
.progress-dots i { width: 28px; }
.progress-dots i.is-done { background: linear-gradient(90deg, var(--accent), color-mix(in oklch, var(--accent) 60%, var(--primary-text))); }
.day { height: 76px; border-radius: 16px; transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s; }
a.day:hover { transform: translateY(-1px); }
.chip { border-radius: 14px; box-shadow: 0 1px 2px rgb(11 31 46 / 0.04); transition: transform 0.12s, background-color 0.12s, border-color 0.12s, box-shadow 0.12s; }
.chip:hover { transform: translateY(-1px); }
.day[aria-current="date"], .chip[aria-current="true"] { box-shadow: 0 12px 22px -12px color-mix(in srgb, var(--primary) 90%, transparent); }

/* What is fixed to the bottom of a phone floats over the page. */
@media (max-width: 899.98px) {
  .sheet {
    border-top: 0;
    border-radius: 22px 22px 0 0;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    -webkit-backdrop-filter: saturate(1.5) blur(16px);
    backdrop-filter: saturate(1.5) blur(16px);
    box-shadow: 0 -14px 34px -14px rgb(11 31 46 / 0.3);
  }
  .sheet.sheet-static { display: none; }
}
@media (display-mode: standalone) {
  .tabbar {
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.5) blur(16px);
    backdrop-filter: saturate(1.5) blur(16px);
  }
  /* The tab bar grows by the home-indicator area of the phone: the sheet sits on top of all of it. */
  .sheet { border-radius: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
}

@media (min-width: 900px) {
  .hero-brand { padding: var(--space-7) var(--space-7); }
  .hero-brand::before { right: 24px; top: 8px; width: 380px; height: 316px; opacity: 0.12; }
  .sheet { border-radius: calc(var(--radius) + 4px); border-color: color-mix(in srgb, var(--line) 75%, transparent); }
}
