.clinic-shell { width: min(100% - var(--gutter) * 2, 960px); margin-inline: auto; }
/* §7a: "Two brand colors (primary, accent) applied to buttons, header bar, and
   the client-facing share-link page." The colours were collected, checked
   against WCAG AA, stored and served as two custom properties -- and no rule
   anywhere read them, so every clinic's pages rendered in the default palette.
   Branding was collected and never applied.

   Used as a surface with a white label and as a line, never as text: the check
   the form runs is white-against-the-colour, which is the same ratio in both
   themes only while the colour carries white on top of it. Every rule falls
   back to what the page looked like before, so a clinic that sets no colours
   sees no change. */
.clinic-shell .btn {
  --btn-bg: var(--clinic-brand, var(--ink));
  --btn-fg: var(--clinic-brand-ink, var(--paper));
}
/* The quiet button is an outline, so the brand goes on its edge rather than
   behind a label it would then have to fight. */
.clinic-shell .btn--quiet { border-color: var(--clinic-brand, var(--hairline-2)); }

/* The consumer page calls this `skiplink` and styles it there; the clinic shell
   spells it `skip-link`, so nothing matched and "Skip to content" sat visible at
   the top of every clinic page. Same shape as the consumer rule: parked above
   the viewport, brought down on keyboard focus. */
.skip-link {
  position: fixed; top: 0; left: 0; z-index: 300;
  padding: 0.75rem 1.1rem; border-radius: 0 0 var(--r-ctl) 0;
  background: var(--ink); color: var(--paper);
  font-size: var(--step--1); font-weight: 600; text-decoration: none;
  transform: translateY(-110%); transition: transform var(--dur-ui) var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(0); }
.clinic-nav, .clinic-actions, .clinic-heading { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.clinic-nav { padding-block: 1.5rem; border-bottom: 1px solid var(--clinic-brand, var(--hairline)); }
.clinic-wordmark { font-family: var(--serif); font-size: var(--step-1); color: var(--ink); text-decoration: none; }
/* A clinic uploads whatever it has. Nothing constrained this until the image
   started loading at all -- the file was 404ing, so what the header measured
   was a broken-image box, and a 400x1600 upload then filled half the screen the
   moment it was served. Boxed and contained: the clinic chooses the mark, the
   shell keeps the header a header. */
.clinic-logo { display: block; max-height: 2.25rem; max-width: 12rem; width: auto; height: auto; object-fit: contain; }
.clinic-main { display: grid; gap: 1.5rem; padding-block: 3rem 6rem; overflow-wrap: anywhere; }
.clinic-main h1 { font-size: var(--step-3); font-weight: 500; }
.clinic-main h2 { font-size: var(--step-2); font-weight: 500; }
.clinic-main p { max-width: 65ch; }
.clinic-main header p { margin-block: .75rem; }
.clinic-form { display: grid; gap: 1.2rem; width: min(100%, 36rem); }
.clinic-field { display: grid; gap: .4rem; min-width: 0; }
.clinic-field label { font-weight: 600; }
.clinic-field input, .clinic-field select { width: 100%; min-height: 3rem; padding: .65rem .85rem; border: 1px solid var(--ink-3); border-radius: var(--r-ctl); background: var(--card); color: var(--ink); font: inherit; }
.clinic-field input[type="checkbox"] { width: 1.5rem; min-height: 1.5rem; accent-color: var(--sage); }
.clinic-field:has(input[type="checkbox"]):not(:has(input[type="file"])) { grid-template-columns: 1.5rem 1fr; align-items: center; }
.clinic-field:has(input[type="checkbox"]):not(:has(input[type="file"])) input { grid-column: 1; grid-row: 1; }
.clinic-field:has(input[type="checkbox"]):not(:has(input[type="file"])) label { grid-column: 2; min-height: 44px; display: flex; align-items: center; }
.clinic-field:has(input[type="checkbox"]):not(:has(input[type="file"])) .clinic-errors { grid-column: 1 / -1; }
.clinic-form .btn { justify-self: start; }
.clinic-shell .btn { padding-inline: 1.35rem; min-height: 44px; }
.clinic-shell a:not(.btn) { text-underline-offset: .2em; }
.clinic-muted { color: var(--ink-3); font-size: var(--step--1); }
.clinic-errors { color: var(--rose); }
.clinic-errors ul { padding-left: 1.2rem; }
.clinic-records { list-style: none; padding: 0; }
.clinic-records li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; padding-block: 1rem; border-bottom: 1px solid var(--hairline); }
.clinic-records a { padding-block: .5rem; }
.clinic-details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.clinic-details dt { color: var(--ink-3); font-size: var(--step--1); }
.clinic-details dd { margin: .4rem 0 0; }
.clinic-section { display: grid; gap: 1rem; padding-top: 1.5rem; border-top: 1px solid var(--hairline); }
.clinic-consent { max-width: 65ch; padding: 1.5rem; background: var(--paper-sunk); border-radius: var(--r-ctl); }
.clinic-consent p { margin-top: .75rem; }
@media (max-width: 600px) {
  .clinic-details { grid-template-columns: minmax(0, 1fr); }
  .clinic-main { padding-top: 2rem; }
  .clinic-heading { align-items: flex-start; }
}

@media (pointer: coarse) {
  .clinic-shell a { display: inline-flex; align-items: center; min-height: 44px; }
  /* The capture page borrows the consumer stylesheet, where this exact rule is
     written for a coarse pointer and then lost: a later `.pick select` of equal
     specificity puts it back to 2.6rem, so the dropdowns measure 41.6px on a
     phone. Restated here, scoped to the clinic, rather than reordering a
     stylesheet the consumer product is also running. Worth telling Karen: the
     consumer capture page has the same 2.4px shortfall. */
  .clinic-main .pick select { min-height: 44px; }
}

/* The code carries its own black and white in the SVG rather than taking them
   from the theme: a phone camera reads dark-on-light far more reliably than the
   inverse, and a dark-mode desktop would otherwise hand it an inverted code. */
.clinic-qr { justify-items: center; }
.clinic-qr svg { width: min(18rem, 70vw); height: auto; border-radius: var(--r-ctl); }
.clinic-pair-client { font-size: var(--step-2); }

/* §7 F2's sections. Five owner-only pages existed before this and were reachable
   only by typing the address, which in practice meant they were not shipped. */
.clinic-sections { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.35rem; list-style: none; margin: 0; padding: 0; }
.clinic-sections a { color: var(--ink-2); text-decoration: none; padding-block: .35rem; border-bottom: 2px solid transparent; }
.clinic-sections a:hover { color: var(--ink); }
.clinic-sections a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--clinic-accent, var(--ink)); }

/* The capture page borrows the consumer capture steps. Two of their rules are
   written for a page this is not: the step is a two-column grid with a numbered
   rail down the left, which put the safety questions in a 15rem gutter with an
   empty half-page beside them, and the note is capped at 34ch to sit in that
   rail. The clinic shell is one column, so the steps take the shape the
   consumer page itself falls back to on a phone. */
.clinic-main .step { grid-template-columns: minmax(0, 1fr); }
.clinic-main .step__note { max-width: none; }
/* And the rail stops sticking. Pinned, it works beside its column; stacked
   above it, it stays put while the upload rows scroll underneath and the step
   number is drawn over the first two of them. */
.clinic-main .step__rail { position: static; }

/* F12: a wide table scrolls inside itself. The page never scrolls sideways --
   on a phone that reads as the layout being broken rather than as more columns.
   Measured at 390px rather than assumed: the team page ran 433px wide, the plan
   page 318px and the import page 56px, because two tables were never wrapped
   and a CSV sample cannot wrap without misrepresenting the file. */
.clinic-scroll { overflow-x: auto; }
/* `min-width: 0` as well as the scroll: `.clinic-main` and `.clinic-section` are
   grids, and a grid item's automatic minimum size is its content, so a long CSV
   sample stretched the whole page instead of scrolling inside its own box. The
   form fields above carry the same line for the same reason. */
.clinic-main pre { overflow-x: auto; min-width: 0; }
.clinic-table { width: 100%; border-collapse: collapse; text-align: left; }
.clinic-table th, .clinic-table td { padding: .75rem 1.25rem .75rem 0; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.clinic-table th { color: var(--ink-3); font-size: var(--step--1); font-weight: 500; }
/* Identifiers are the one column worth wrapping: kept on one line they push a
   table that otherwise fits into sideways scrolling on a full-size screen. */
.clinic-table .clinic-token { white-space: normal; overflow-wrap: anywhere; }
.clinic-records .clinic-muted { flex-basis: 100%; }

@media (max-width: 600px) {
  /* Scroll the sections rather than stacking them into three rows and pushing
     the page's own heading below the fold. */
  .clinic-sections { flex-wrap: nowrap; overflow-x: auto; width: 100%; }
}

/* Two visits, side by side. Stacks on a phone rather than shrinking both to
   half a narrow screen, where neither is legible. */
.compare-row { display: grid; gap: .75rem; }
.compare-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.compare-media { width: 100%; height: auto; border-radius: var(--r-ctl); background: var(--paper-sunk); }
@media (max-width: 700px) {
  .compare-pair { grid-template-columns: minmax(0, 1fr); }
}

/* The frame beside the decision to withhold it. Small enough that a visit's
   worth of them still fits a table row, big enough to tell one view from
   another -- which is the whole reason it is here rather than a label. */
.clinic-thumb {
  display: block;
  width: 100%;
  max-width: 9rem;
  height: auto;
  border-radius: var(--r-ctl);
  background: var(--paper-sunk);
  margin-bottom: .35rem;
}

/* The brand on the page itself: links, the two heading levels, and a light tint
   of the paper. The server sends --clinic-text only when the brand reads at AA
   on the light paper, and tints --clinic-page only as far as that still holds.
   Both are light-theme colours, so after dark they are dropped and the default
   palette returns. `:where` keeps the link rule at zero specificity, so the
   menu, the buttons and every other styled link keep their own colours. */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --clinic-text: initial;
    --clinic-page: initial;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --clinic-text: initial;
    --clinic-page: initial;
  }
}
body { background: var(--clinic-page, var(--paper)); }
:where(.clinic-shell) a { color: var(--clinic-text, var(--sage-ink)); }
.clinic-main h1, .clinic-main h2 { color: var(--clinic-text, var(--ink)); }

/* A logo field: the logo itself, a way to remove it, and a full-width file
   picker. The checkbox layout above is for a field that is only a checkbox. */
.clinic-field--file .clinic-logo-preview { max-height: 4rem; max-width: 16rem; object-fit: contain; justify-self: start; border: 1px solid var(--hairline); border-radius: var(--r-ctl); padding: .35rem; background: var(--card); }
.clinic-field--file .clinic-check { display: flex; align-items: center; gap: .5rem; font-weight: 400; min-height: 44px; }
.clinic-field--file .clinic-check input { width: 1.25rem; min-height: 1.25rem; }
.clinic-field--file input[type="file"] { min-height: 0; padding: .6rem; }
