/* OctoBook design system
 *
 * No build step and no CDN, for three reasons that matter to this product:
 *   1. A PWA must work offline. A stylesheet fetched from a CDN does not.
 *   2. Every subscriber is white-labelled. One `--hue` token repaints the whole
 *      interface; doing that with utility classes means recompiling per tenant.
 *   3. The operator runs one language and one deploy. Adding Node to get CSS is
 *      a second toolchain to patch, and it buys nothing here.
 *
 * Mobile-first throughout: every rule is the phone rule, and media queries only
 * ever add. That ordering is what stops a desktop layout being retrofitted onto
 * a phone, which is how the predecessor ended up with content behind its header.
 */

/* ── Tokens ──────────────────────────────────────────────────────────────── */
:root {
  --hue: 175;                     /* overridden per tenant from TenantSettings */

  --brand:          oklch(55% 0.13 var(--hue));
  --brand-strong:   oklch(46% 0.14 var(--hue));
  --brand-soft:     oklch(96% 0.03 var(--hue));
  --brand-border:   oklch(88% 0.05 var(--hue));
  --on-brand:       oklch(99% 0.01 var(--hue));

  --bg:             oklch(99% 0.003 var(--hue));
  --surface:        oklch(100% 0 0);
  --surface-2:      oklch(97.5% 0.004 var(--hue));
  --ink:            oklch(23% 0.02 var(--hue));
  --ink-2:          oklch(45% 0.015 var(--hue));
  --ink-3:          oklch(52% 0.012 var(--hue));   /* 4.5:1 or better on surface, surface-2 and brand-soft */
  --line:           oklch(92% 0.006 var(--hue));
  --line-strong:    oklch(86% 0.01 var(--hue));

  --ok:             oklch(50% 0.13 150);
  --ok-soft:        oklch(96% 0.03 150);
  --warn:           oklch(72% 0.15 75);
  --warn-soft:      oklch(97% 0.04 75);
  --danger:         oklch(55% 0.19 25);
  --danger-soft:    oklch(96% 0.03 25);
  --info:           oklch(58% 0.12 250);
  --info-soft:      oklch(96% 0.03 250);

  --r-sm: 6px; --r: 10px; --r-lg: 16px; --r-full: 999px;
  --shadow-1: 0 1px 2px oklch(0% 0 0 / .05);
  --shadow-2: 0 2px 4px oklch(0% 0 0 / .04), 0 8px 20px oklch(0% 0 0 / .06);
  --shadow-3: 0 10px 40px oklch(0% 0 0 / .12);

  /* Touch targets. 44px is the smallest reliably tappable control on a phone,
     and the majority of this product's use is one-handed on a phone. */
  --tap: 44px;
  --header-h: 56px;
  --tabbar-h: 60px;

  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
          'Noto Sans', sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
  /* The second brand colour, for gradients. Exact brand colours, when a
     business sets them, override --brand and this (apps/core/theme.py). */
  --brand-accent: var(--brand-strong);
}

/* Inter, bundled (SIL OFL 1.1, static/fonts/LICENSE-Inter-OFL.txt) so that no
   page asks a font service for it and tells that service who is reading. */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.260c81a4759b.woff2") format('woff2');
}
:root[data-font='inter'] {
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --brand:        oklch(72% 0.12 var(--hue));
    --brand-strong: oklch(80% 0.12 var(--hue));
    --brand-soft:   oklch(28% 0.04 var(--hue));
    --brand-border: oklch(38% 0.05 var(--hue));
    --on-brand:     oklch(18% 0.02 var(--hue));
    --brand-accent: oklch(80% 0.12 var(--hue));
    --bg:           oklch(17% 0.012 var(--hue));
    --surface:      oklch(21% 0.014 var(--hue));
    --surface-2:    oklch(25% 0.014 var(--hue));
    --ink:          oklch(96% 0.005 var(--hue));
    --ink-2:        oklch(78% 0.01 var(--hue));
    --ink-3:        oklch(62% 0.012 var(--hue));
    --line:         oklch(30% 0.012 var(--hue));
    --line-strong:  oklch(38% 0.014 var(--hue));
    --ok-soft:      oklch(28% 0.05 150);
    --warn-soft:    oklch(30% 0.06 75);
    --danger-soft:  oklch(28% 0.06 25);
    --info-soft:    oklch(28% 0.05 250);
    --shadow-2: 0 2px 4px oklch(0% 0 0 / .3), 0 8px 20px oklch(0% 0 0 / .35);
  }
}
[data-theme='dark'] {
  --brand: oklch(72% 0.12 var(--hue)); --brand-strong: oklch(80% 0.12 var(--hue));
  --brand-soft: oklch(28% 0.04 var(--hue)); --brand-border: oklch(38% 0.05 var(--hue));
  --on-brand: oklch(18% 0.02 var(--hue)); --bg: oklch(17% 0.012 var(--hue));
  --brand-accent: oklch(80% 0.12 var(--hue));
  --surface: oklch(21% 0.014 var(--hue)); --surface-2: oklch(25% 0.014 var(--hue));
  --ink: oklch(96% 0.005 var(--hue)); --ink-2: oklch(78% 0.01 var(--hue));
  --ink-3: oklch(62% 0.012 var(--hue)); --line: oklch(30% 0.012 var(--hue));
  --line-strong: oklch(38% 0.014 var(--hue));
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 16px;               /* never smaller: iOS zooms on focus below 16 */
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-strong); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3, h4 { line-height: 1.2; font-weight: 650; letter-spacing: -0.015em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
@media (min-width: 768px) { h1 { font-size: 2rem; } h2 { font-size: 1.4rem; } }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--r-sm); }
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.wrap { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 16px; }
.wrap-narrow { max-width: 680px; }
.wrap-tight  { max-width: 460px; }
@media (min-width: 768px) { .wrap { padding-inline: 24px; } }

.stack > * + * { margin-top: var(--gap, 16px); }
.row { display: flex; gap: 12px; align-items: center; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.row-wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
/* minmax(0, 1fr), not 1fr: a 1fr track never shrinks below its content's
   min-content width, so one long name or unbroken word widened its column
   (unequal cards) or, on a phone, pushed the page sideways. */
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px)  { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px)  { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
                             .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ── App shell ───────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100dvh; }

.sidebar {
  display: none;
  width: 244px; flex-shrink: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
}
@media (min-width: 1024px) { .sidebar { display: flex; flex-direction: column; } }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* The mobile header is sticky rather than fixed, so content flows beneath it
   instead of hiding under it — the exact bug in the system this replaces. */
.appbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: var(--header-h); padding-inline: 12px;
  background: color-mix(in oklch, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
@media (min-width: 1024px) { .appbar { padding-inline: 24px; } }

.page { flex: 1; padding-block: 20px 24px; }
/* Room for the tab bar plus the home indicator on a notched phone. */
@media (max-width: 1023px) {
  .page { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px); }
}

/* ── Bottom tab bar — the phone's primary navigation ─────────────────────── */
.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 50;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: color-mix(in oklch, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 1024px) { .tabbar { display: none; } }
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; min-height: var(--tabbar-h);
  font-size: .68rem; font-weight: 550; letter-spacing: .01em;
  color: var(--ink-3); text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.tabbar a svg { width: 22px; height: 22px; stroke-width: 1.8; }
.tabbar a[aria-current='page'] { color: var(--brand-strong); }
.tabbar a[aria-current='page'] svg { stroke-width: 2.2; }

/* ── Sidebar nav ─────────────────────────────────────────────────────────── */
.nav { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  padding: 14px 12px 6px; font-size: .7rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3);
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r);
  color: var(--ink-2); text-decoration: none; font-size: .9rem; font-weight: 500;
}
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.8; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current='page'] {
  background: var(--brand-soft); color: var(--brand-strong); font-weight: 600;
}

/* ── Cards & surfaces ────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.card-pad { padding: 16px; }
@media (min-width: 768px) { .card-pad { padding: 20px; } }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { font-size: .95rem; font-weight: 650; }

.panel { background: var(--surface-2); border-radius: var(--r); padding: 14px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--r);
  font-size: .93rem; font-weight: 600; line-height: 1;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; stroke-width: 2; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-quiet { background: transparent; color: var(--ink-2); padding-inline: 10px; }
.btn-quiet:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { min-height: 34px; padding-inline: 12px; font-size: .84rem; border-radius: var(--r-sm); }
.btn-lg { min-height: 52px; font-size: 1rem; padding-inline: 26px; }
.btn-block { display: flex; width: 100%; }
.btn:disabled, .btn[aria-disabled='true'] { opacity: .5; pointer-events: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); flex-shrink: 0;
  border: 0; background: transparent; border-radius: var(--r);
  color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; stroke-width: 1.8; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.field { display: block; }
.field + .field { margin-top: 16px; }
.grid > .field + .field { margin-top: 0; }  /* side-by-side fields share a baseline */
.field > label, .label {
  display: block; margin-bottom: 6px;
  font-size: .84rem; font-weight: 600; color: var(--ink-2);
}
.input, .select, .textarea {
  display: block; width: 100%; min-height: var(--tap);
  padding: 10px 13px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r);
  font-size: 16px;               /* keeps iOS from zooming on focus */
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand) 18%, transparent);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.hint { margin-top: 5px; font-size: .8rem; color: var(--ink-3); }
.error { margin-top: 5px; font-size: .82rem; color: var(--danger); font-weight: 500; }
.field-error .input, .field-error .select, .field-error .textarea { border-color: var(--danger); }

.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 6px 0; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; accent-color: var(--brand); }
.check span { font-size: .9rem; }

/* ── Choice tiles — the booking funnel's main control ────────────────────── */
.choices { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 13px;
  width: 100%; padding: 14px; min-height: 60px;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--r); cursor: pointer; text-align: left;
  text-decoration: none; color: inherit;
  transition: border-color .12s ease, background .12s ease;
}
.choice:hover { border-color: var(--brand-border); background: var(--brand-soft); }
.choice[aria-pressed='true'], .choice.is-selected {
  border-color: var(--brand); background: var(--brand-soft);
}
/* Title above meta, and a small trailing chevron: the global `svg { max-width:
   100% }` rule otherwise lets an unsized icon grow to fill the tile. */
.choice-title { display: block; font-weight: 600; font-size: .95rem; }
.choice-meta { display: block; font-size: .82rem; color: var(--ink-3); margin-top: 1px; }
.choice > svg { width: 18px; height: 18px; flex: none; color: var(--ink-3); stroke-width: 2; }
.choice-price { font-weight: 650; font-size: .9rem; white-space: nowrap; }

/* ── Slot picker ─────────────────────────────────────────────────────────── */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.slot {
  min-height: var(--tap); padding: 8px 4px;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--r); cursor: pointer;
  font-size: .9rem; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--ink); transition: border-color .12s, background .12s;
}
.slot:hover { border-color: var(--brand); background: var(--brand-soft); }
.slot[aria-pressed='true'] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
/* A time inside the practitioner's hours that someone already has: shown, so reception can say
   so, but not choosable. Struck through as well as faded, so it reads without colour. */
.slot.is-taken, .slot.is-taken:hover {
  background: var(--surface-2); border-style: dashed; border-color: var(--line);
  color: var(--ink-3); text-decoration: line-through; cursor: not-allowed;
}
/* The course plan's times are radios dressed as slots. */
.plan-slot { display: inline-flex; align-items: center; justify-content: center; }
.plan-slot:has(input:checked) { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.plan-slot:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.slot-key { display: inline-block; width: 14px; height: 10px; vertical-align: -1px;
  border: 1.5px solid var(--line-strong); border-radius: 3px; background: var(--surface); }
.slot-key.is-taken { border-style: dashed; background: var(--surface-2); }

.daystrip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.daystrip::-webkit-scrollbar { height: 4px; }
.day {
  flex: 0 0 auto; width: 60px; padding: 9px 4px;
  /* Name, number and "n free" each on their own line. */
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 1.5px solid var(--line); border-radius: var(--r);
  background: var(--surface); cursor: pointer; text-align: center;
}
.day-name { font-size: .66rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; }
.day-num  { font-size: 1.15rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.day-free { font-size: .62rem; color: var(--ok); font-weight: 600; }
.day[aria-pressed='true'] { background: var(--brand); border-color: var(--brand); }
.day[aria-pressed='true'] .day-name,
.day[aria-pressed='true'] .day-num,
.day[aria-pressed='true'] .day-free { color: var(--on-brand); }
.day:disabled { opacity: .35; cursor: not-allowed; }
.day-full .day-free { color: var(--danger); }
.day-off { background: var(--surface-2); }
.day-off .day-free { color: var(--ink-3); }

/* ── Master calendar (templates/console/calendar.html) ──────────────────────
   Positions come from apps/scheduling/master.py as percentages of the grid's hours.
   An event takes its practitioner's colour as --c; the tint is mixed with the surface, so it
   reads in both themes. Status shows by shape too (dashed = requested, struck = no show). */
.mcal-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 8px; }
.mcal-title { font-size: 1.05rem; margin: 0 0 0 6px; font-weight: 650; }
.mcal-bar [aria-current='date'] { color: var(--brand-strong); font-weight: 650; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.seg a { padding: 6px 12px; border-radius: calc(var(--r) - 3px); font-size: .85rem; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.seg a:hover { color: var(--ink); }
.seg a[aria-current='page'] { background: var(--surface); color: var(--brand-strong); box-shadow: var(--shadow-1); }
.mcal-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.mcal-filter summary { list-style: none; cursor: pointer; }
.mcal-filter summary::-webkit-details-marker { display: none; }
.mcal-people { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.person-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1.5px solid var(--line);
  border-radius: var(--r-full); background: var(--surface); font-size: .85rem; cursor: pointer; }
.person-chip input { accent-color: var(--c); margin: 0; }
.person-chip:has(input:checked) { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.mcal-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; padding: 0; margin: 0 0 10px; font-size: .8rem; color: var(--ink-2); }
.mcal-legend li { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--brand)); flex-shrink: 0; }

.mcal-scroll { overflow-x: auto; padding: 0; }
.mcal-grid { --hour: 56px; display: grid; grid-template-columns: 52px repeat(var(--cols), minmax(128px, 1fr)); min-width: max-content; }
.mcal-grid.is-week { grid-template-columns: 52px repeat(7, minmax(112px, 1fr)); }
.mcal-corner, .mcal-head { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); }
.mcal-head { display: flex; align-items: center; gap: 6px; padding: 10px 8px; border-left: 1px solid var(--line); min-width: 0; }
.mcal-head a { display: flex; align-items: baseline; gap: 6px; color: inherit; text-decoration: none; }
.mcal-head.is-today .mcal-dnum { background: var(--brand); color: var(--on-brand); }
.mcal-name { font-weight: 650; font-size: .88rem; min-width: 0; }
.mcal-dow { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 650; }
.mcal-dnum { font-weight: 700; font-variant-numeric: tabular-nums; padding: 1px 7px; border-radius: var(--r-full); }
.mcal-gutter { display: grid; grid-auto-rows: var(--hour); }
.mcal-gutter span { font-size: .7rem; color: var(--ink-3); text-align: right; padding-right: 8px; transform: translateY(-.55em); font-variant-numeric: tabular-nums; }
.mcal-gutter span:first-child { transform: none; }
.mcal-col { position: relative; height: calc(var(--hours) * var(--hour)); border-left: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--hour) - 1px), var(--line) calc(var(--hour) - 1px) var(--hour)),
                    repeating-linear-gradient(to bottom, transparent 0 calc(var(--hour) / 2 - 1px), color-mix(in oklch, var(--line) 50%, transparent) calc(var(--hour) / 2 - 1px) calc(var(--hour) / 2)); }
.mcal-col.is-today { background-color: color-mix(in oklch, var(--brand-soft) 45%, transparent); }
.mcal-ev, .mcal-off { position: absolute; box-sizing: border-box; padding: 0 2px; }
.mcal-ev { display: flex; flex-direction: column; overflow: hidden; z-index: 1; text-decoration: none; color: var(--ink);
  background: color-mix(in srgb, var(--c) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 35%, var(--surface));
  border-left: 3px solid var(--c); border-radius: var(--r-sm); padding: 3px 6px; margin: 1px 2px;
  font-size: .74rem; line-height: 1.25; transition: box-shadow .12s, transform .12s; }
.mcal-ev:hover, .mcal-ev:focus-visible { z-index: 2; box-shadow: var(--shadow-2); overflow: visible; min-height: max-content; }
.mcal-ev-time { font-weight: 650; color: var(--ink-2); font-size: .68rem; }
.mcal-ev-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcal-ev-detail, .mcal-ev-status { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcal-ev-status { font-weight: 600; }
.mcal-ev.is-narrow { padding: 2px 4px; }
.mcal-ev.is-narrow .mcal-ev-end, .mcal-ev.is-narrow .mcal-ev-detail { display: none; }
.mcal-ev.status-requested { border-style: dashed; border-left-style: solid; }
.mcal-ev.status-completed { opacity: .72; }
.mcal-ev.status-no_show .mcal-ev-title { text-decoration: line-through; }
.mcal-ev.status-arrived, .mcal-ev.status-in_progress { box-shadow: inset 0 0 0 1.5px var(--c); }
.mcal-off { z-index: 0; border-radius: var(--r-sm); color: var(--ink-3); overflow: hidden; padding: 4px 6px;
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, color-mix(in srgb, var(--c) 10%, var(--surface-2)) 6px 12px);
  border: 1px dashed var(--line-strong); }
.mcal-now { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--danger); z-index: 2; pointer-events: none; }
.mcal-now::before { content: ''; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

.mcal-month { overflow: hidden; padding: 0; }
.mcal-mhead, .mcal-mweek { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mcal-mhead span { padding: 8px; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 650; border-bottom: 1px solid var(--line); }
.mcal-mday { min-height: 104px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mcal-mday:nth-child(7n) { border-right: 0; }
.mcal-mday.is-out { background: var(--surface-2); }
.mcal-mday.is-out .mcal-mnum { color: var(--ink-3); }
.mcal-mnum { align-self: flex-start; font-weight: 650; font-size: .85rem; font-variant-numeric: tabular-nums; color: var(--ink);
  text-decoration: none; padding: 1px 7px; border-radius: var(--r-full); }
.mcal-mnum:hover { background: var(--brand-soft); }
.mcal-mday.is-today .mcal-mnum { background: var(--brand); color: var(--on-brand); }
.mcal-chip { display: flex; align-items: center; gap: 5px; min-width: 0; padding: 2px 6px; border-radius: var(--r-sm); font-size: .72rem;
  text-decoration: none; color: var(--ink); background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.mcal-chip:hover { background: color-mix(in srgb, var(--c) 22%, var(--surface)); }
.mcal-chip.status-no_show .truncate { text-decoration: line-through; }
.mcal-more { font-size: .72rem; font-weight: 600; padding: 0 6px; }
.mcal-moff { font-size: .66rem; color: var(--ink-3); padding: 0 6px; }
.mcal-lhead { display: flex; align-items: center; gap: 8px; font-size: .95rem; margin: 0 0 6px; }
.mcal-lhead a { color: inherit; text-decoration: none; }
.mcal-litem { border-left: 3px solid var(--c); }
@media (max-width: 640px) {
  .mcal-mday { min-height: 64px; padding: 4px 2px; }
  .mcal-chip .truncate, .mcal-chip .nums { display: none; }
  .mcal-chip { padding: 3px; justify-content: center; }
  .mcal-title { font-size: .95rem; width: 100%; margin: 4px 0 0; order: 9; }
}
@media print {
  .mcal-scroll { overflow: visible; }
  .mcal-filter, .seg, .mcal-bar .icon-btn { display: none; }
}

/* ── Badges & status ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-full);
  font-size: .74rem; font-weight: 650; letter-spacing: .01em; white-space: nowrap;
}
.badge-ok     { background: var(--ok-soft);     color: var(--ok); }
.badge-warn   { background: var(--warn-soft);   color: oklch(45% 0.13 75); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info   { background: var(--info-soft);   color: var(--info); }
.badge-muted  { background: var(--surface-2);   color: var(--ink-3); }
.badge-brand  { background: var(--brand-soft);  color: var(--brand-strong); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── Avatars ─────────────────────────────────────────────────────────────── */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 50%; background: var(--brand-soft); color: var(--brand-strong);
  font-weight: 650; font-size: .85rem; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 30px; height: 30px; font-size: .72rem; }
.avatar-lg { width: 60px; height: 60px; font-size: 1.15rem; }

/* ── Lists ───────────────────────────────────────────────────────────────── */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-title { font-weight: 600; font-size: .93rem; }
.list-meta { font-size: .81rem; color: var(--ink-3); }

/* ── Tables — horizontally scrollable, never breaking the page ──────────── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .89rem; }
th {
  text-align: left; padding: 10px 14px; white-space: nowrap;
  font-size: .74rem; font-weight: 650; text-transform: uppercase;
  letter-spacing: .045em; color: var(--ink-3);
  border-bottom: 1px solid var(--line);
}
td { padding: 12px 14px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Stat tiles ──────────────────────────────────────────────────────────── */
.stat { padding: 15px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.stat-label { font-size: .76rem; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.65rem; font-weight: 700; line-height: 1.15; margin-top: 5px; font-variant-numeric: tabular-nums; }
.stat-note { font-size: .79rem; color: var(--ink-3); margin-top: 3px; }

/* ── Messages ────────────────────────────────────────────────────────────── */
.alert {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--r); font-size: .89rem;
  border: 1px solid transparent;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-info    { background: var(--info-soft);   color: var(--info);   border-color: color-mix(in oklch, var(--info) 22%, transparent); }
.alert-ok      { background: var(--ok-soft);     color: var(--ok);     border-color: color-mix(in oklch, var(--ok) 22%, transparent); }
.alert-warn    { background: var(--warn-soft);   color: oklch(42% 0.12 75); border-color: color-mix(in oklch, var(--warn) 30%, transparent); }
.alert-danger  { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in oklch, var(--danger) 22%, transparent); }

.toasts { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 16px); z-index: 90; display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 640px) { .toasts { left: auto; right: 20px; bottom: 20px; width: 340px; } }
.toast { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-3); padding: 13px 15px; font-size: .89rem; animation: toast-in .22s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ── Empty states ────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 48px 20px; }
.empty svg { width: 42px; height: 42px; color: var(--ink-3); margin: 0 auto 14px; stroke-width: 1.5; }
.empty h3 { font-size: 1rem; margin-bottom: 5px; }
.empty p { color: var(--ink-3); font-size: .89rem; max-width: 40ch; margin: 0 auto 18px; }

/* ── Sheet (mobile) / dialog (desktop) ───────────────────────────────────── */
.sheet-backdrop { position: fixed; inset: 0; background: oklch(0% 0 0 / .45); z-index: 60; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 70;
  max-height: 88dvh; overflow-y: auto;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-3);
  padding-bottom: env(safe-area-inset-bottom);
  animation: sheet-up .22s cubic-bezier(.32, .72, 0, 1);
}
@keyframes sheet-up { from { transform: translateY(100%); } }
@media (min-width: 640px) {
  .sheet {
    inset: 50% auto auto 50%; transform: translate(-50%, -50%);
    width: min(560px, calc(100vw - 40px)); border-radius: var(--r-lg);
    animation: fade .15s ease;
  }
}
.sheet-grip { width: 36px; height: 4px; background: var(--line-strong); border-radius: 2px; margin: 10px auto 4px; }
@media (min-width: 640px) { .sheet-grip { display: none; } }

/* ── Steps ───────────────────────────────────────────────────────────────── */
.steps { display: flex; gap: 6px; margin-bottom: 22px; }
.step { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.step.is-done { background: var(--brand); }

/* ── Utilities ───────────────────────────────────────────────────────────── */
.muted   { color: var(--ink-3); }
.small   { font-size: .84rem; }
.tiny    { font-size: .76rem; }
.strong  { font-weight: 650; }
.center  { text-align: center; }
.nums    { font-variant-numeric: tabular-nums; }
.mono    { font-family: var(--mono); font-size: .85em; letter-spacing: -.01em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
           clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.hr { height: 1px; background: var(--line); border: 0; margin-block: 16px; }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}.mt-4{margin-top:32px}
.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}
/* Hidden below 768px only, so on wider screens an element keeps its own
   display (a .btn stays inline-flex). `display: revert` went back to the
   browser default, which for a link is plain inline. */
@media (max-width: 767.98px) { .hide-mobile { display: none; } }
@media (min-width: 768px) { .hide-desktop { display: none; } }

/* HTMX: show progress without a spinner library */
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-indicator { opacity: 0; transition: opacity .15s; }
.htmx-request.btn { opacity: .7; pointer-events: none; }

/* ── Charts ────────────────────────────────────────────────────────────────
 * Single-series magnitude only, so there is no categorical palette and no
 * legend: the section heading names what is being measured. Colour carries
 * magnitude (one hue) or status (reserved, and always paired with a label —
 * never colour alone).
 */
.chart { display: flex; flex-direction: column; gap: 10px; }

.barrow { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; gap: 12px; align-items: center; }
.barrow-label { font-size: .86rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barrow-track { height: 22px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.barrow-fill {
  height: 100%;
  /* 4px rounded data-end, anchored flat to the baseline at the origin. */
  border-radius: 0 4px 4px 0;
  background: var(--brand);
  min-width: 3px;
  transition: width .3s ease;
}
.barrow-fill.is-ok      { background: var(--ok); }
.barrow-fill.is-warn    { background: var(--warn); }
.barrow-fill.is-danger  { background: var(--danger); }
.barrow-value { font-size: .86rem; font-weight: 650; font-variant-numeric: tabular-nums;
                color: var(--ink); min-width: 58px; text-align: right; }
.barrow-note  { grid-column: 2 / -1; font-size: .76rem; color: var(--ink-3); margin-top: -6px; }

/* Sparkline: change over time, where the shape is the point and the exact
 * values live in the table beneath. */
.spark { display: flex; align-items: flex-end; gap: 2px; height: 56px; }
.spark span {
  flex: 1; background: var(--brand-soft); border-radius: 3px 3px 0 0;
  min-height: 3px; position: relative;
}
.spark span::after {
  content: ''; position: absolute; inset-inline: 0; top: 0; height: 3px;
  background: var(--brand); border-radius: 3px 3px 0 0;
}
.spark-axis { display: flex; justify-content: space-between; font-size: .7rem;
              color: var(--ink-3); margin-top: 4px; }

/* ── Public website ─────────────────────────────────────────────────────── */
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--brand); color: var(--on-brand); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }
.site-brand { gap: 9px; text-decoration: none; color: inherit; align-items: center; }
.site-nav { display: flex; gap: 2px; }
.site-nav a { padding: 7px 11px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: .92rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); }
.site-menu { display: none; position: relative; }
.site-menu summary { list-style: none; cursor: pointer; }
.site-menu summary::-webkit-details-marker { display: none; }
.site-menu-panel { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; min-width: 200px; display: grid; box-shadow: 0 12px 30px rgb(0 0 0 / .12); z-index: 50; }
.site-menu-panel a { padding: 9px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.site-menu-panel a:hover { background: var(--surface-2); }
@media (max-width: 860px) { .site-nav { display: none; } .site-menu { display: block; } }

.crumbs { font-size: .82rem; color: var(--ink-3); padding-block: 14px 0; }
.crumbs a { color: var(--ink-3); }

.hero { background: var(--brand-soft); padding-block: 56px 48px; }
.hero h1 { font-size: clamp(1.8rem, 4.2vw, 2.6rem); line-height: 1.15; text-wrap: balance; max-width: 22ch; }
.hero .lead { font-size: 1.08rem; color: var(--ink-2); max-width: 60ch; margin-top: 14px; }
.section { padding-block: 44px; }
.section-alt { background: var(--surface-2); }
.section h2 { text-wrap: balance; }
.eyebrow { font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-strong); font-weight: 600; }

.prose { max-width: 72ch; line-height: 1.7; }
.prose h2 { font-size: 1.3rem; margin-top: 2em; scroll-margin-top: 80px; }
.prose h3 { font-size: 1.05rem; margin-top: 1.5em; }
.prose p, .prose ul, .prose ol, .prose dl, .prose table { margin-top: .8em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .35em; }
.prose dt { font-weight: 600; margin-top: .6em; }
.prose dd { margin-left: 0; color: var(--ink-2); }
.prose table { width: 100%; border-collapse: collapse; font-size: .92rem; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose code { font-size: .88em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.prose blockquote { border-left: 3px solid var(--brand); padding-left: 14px; color: var(--ink-2); }

.legal-summary { background: var(--brand-soft); border-radius: 14px; padding: 18px 22px; margin-block: 18px 8px; }
.legal-summary h2 { margin-top: 0 !important; font-size: 1.05rem !important; }
.legal-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .86rem; color: var(--ink-3); }
.legal-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; align-items: start; }
.legal-toc { position: sticky; top: 76px; font-size: .86rem; display: grid; gap: 2px; }
.legal-toc a { color: var(--ink-2); text-decoration: none; padding: 5px 8px; border-radius: 6px; }
.legal-toc a[aria-current="page"] { background: var(--surface-2); color: var(--ink); font-weight: 600; }
@media (max-width: 860px) { .legal-layout { grid-template-columns: 1fr; } .legal-toc { position: static; display: flex; flex-wrap: wrap; } }
@media print { .site-bar, .site-footer, .legal-toc, .crumbs { display: none !important; } .legal-layout { display: block; } }

.tile-link { display: block; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
.tile-link:hover { border-color: var(--brand); transform: translateY(-1px); }
.check-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.check-list li { padding-left: 26px; position: relative; }
.check-list li::before { content: ""; position: absolute; left: 2px; top: .45em; width: 12px; height: 7px; border-left: 2px solid var(--brand); border-bottom: 2px solid var(--brand); transform: rotate(-45deg); }
.faq details { border-bottom: 1px solid var(--line); padding-block: 12px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin-top: 8px; color: var(--ink-2); }

.site-footer { border-top: 1px solid var(--line); margin-top: 56px; padding-block: 36px 20px; background: var(--surface); }
.site-footer-grid { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 28px; }
.site-footer-grid a { display: block; color: var(--ink-2); text-decoration: none; font-size: .88rem; padding-block: 3px; }
.site-footer-grid a:hover { color: var(--ink); text-decoration: underline; }
.site-footer-h { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.site-footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); margin-top: 24px; padding-top: 14px; }
@media (max-width: 860px) { .site-footer-grid { grid-template-columns: 1fr 1fr; } .site-footer-grid > :first-child { grid-column: 1 / -1; } }

.consent-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface-2); display: grid; gap: 4px; }
.consent-box .check span { font-size: .88rem; line-height: 1.5; }
.site-bar .row { align-items: center; }
.site-bar .btn { margin: 0; }
@media (max-width: 860px) { .guide-toc { display: none; } }

/* A brand mark or banner in the business's two colours. */
.brand-gradient {
  background: linear-gradient(135deg, var(--brand), var(--brand-accent));
  color: var(--on-brand);
}

/* ── Practitioner profile ────────────────────────────────────────────────── */
.hero-soft {
  background: linear-gradient(135deg, var(--brand-soft),
              color-mix(in oklab, var(--brand-accent) 9%, var(--bg)));
}
/* Everything on the profile is typed by the clinic; a long unbroken word in
   a bio or headline (a URL, a drug name) wraps instead of widening the page. */
.profile-layout { display: grid; gap: 20px; padding-block: 24px 8px;
                  grid-template-columns: minmax(0, 1fr); overflow-wrap: anywhere; }
@media (min-width: 900px) {
  .profile-layout { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .profile-book { position: sticky; top: calc(var(--header-h) + 16px); }
}
.profile-head { align-items: flex-start; gap: 16px; }
.profile-avatar { width: 88px; height: 88px; font-size: 1.6rem; flex: none; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.profile-name { font-size: clamp(1.4rem, 3vw, 1.9rem); display: flex; flex-wrap: wrap;
                align-items: center; gap: 8px; }
.profile-name .badge svg { width: 14px; height: 14px; }
.profile-specialty { color: var(--brand); font-weight: 600; margin-top: 2px; }
.profile-facts { list-style: none; padding: 0; margin-top: 10px; display: grid; gap: 6px; }
.profile-facts li { display: flex; align-items: center; gap: 8px; }
.profile-facts svg { width: 16px; height: 16px; flex: none; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 6px 8px 0; overflow-x: auto; }
.tabs [role='tab'] {
  font: inherit; background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 10px 14px; min-height: var(--tap); color: var(--ink-2); cursor: pointer;
}
.tabs [role='tab'][aria-selected='true'] { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.schedule { display: grid; gap: 0; }
.schedule-row { display: flex; justify-content: space-between; gap: 12px; padding-block: 8px;
                border-bottom: 1px solid var(--line); }
.schedule-row:last-child { border-bottom: 0; }
.schedule dt { font-weight: 600; }
.schedule dd { margin: 0; text-align: right; }
