/*
  Prototype stylesheet.

  Every colour, size, space and radius comes from a token in :root, and the
  tokens match the table in docs/DESIGN.md. Components copy the NHS design
  system's patterns (nhsuk-frontend, MIT licence) with our own colours and font.

  Screens use these classes. Inline styles are only for data, such as where a
  result sits on its range bar.
*/

/* ---------- Tokens ---------- */

:root {
  /* Colour */
  --color-text: #1d2a33;
  --color-text-secondary: #4a5d6b;
  --color-page: #f2f5f4;
  --color-surface: #ffffff;
  --color-surface-muted: #e9eeef;
  --color-border: #d5dcdf;
  --color-control-off: #b4bec4;
  --color-primary: #0b6b45;
  --color-primary-shadow: #064a2f;
  --color-link: #1a5fb4;
  --color-link-hover: #123f78;
  --color-focus: #ffd43b;
  --color-high-text: #6b3d00;
  --color-high-bg: #fdecd5;
  --color-normal-text: #0a5233;
  --color-normal-bg: #dcefe4;
  --color-info-bg: #e1ecf8;
  --color-warning-bg: #fff4c2;
  --color-allergy-text: #8f1d14;
  --color-allergy-bg: #fbe0dd;
  --color-danger: #c4261a;
  --color-danger-shadow: #8f1d14;

  /* Illustration only: photographed paper, camera view, pill outlines */
  --illustration-paper: #fbf6e9;
  --illustration-paper-edge: #e0d6bd;
  --illustration-ink: #23305e;
  --illustration-outline: #8a969e;
  --illustration-camera: #2f3b44;

  /* Type */
  --font-family: 'Atkinson Hyperlegible', system-ui, sans-serif;
  --font-handwriting: 'Caveat', cursive;
  --size-small: 16px;   --line-small: 24px;
  --size-body: 18px;    --line-body: 28px;
  --size-h3: 19px;      --line-h3: 26px;
  --size-h2: 22px;      --line-h2: 28px;
  --size-h1: 28px;      --line-h1: 34px;
  --size-display: 36px; --line-display: 44px;

  /* Space */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;

  /* Shape */
  --radius: 8px;
  --radius-tag: 4px;
  --radius-bubble: 16px;
  --radius-round: 999px;
  --border: 1px solid var(--color-border);
  --border-control: 2px solid var(--color-text-secondary);
  --button-shadow: 0 4px 0 var(--color-primary-shadow);

  /* Size */
  --tap: 48px;
  --bar-height: 56px;
  --control-size: 40px;
  --icon: 24px;
  --icon-small: 20px;
  --dot: 12px;
  --screen-width: 390px;
  --screen-height: 844px;
  --switch-width: 52px;
  --switch-height: 32px;
  --time-column: 72px;
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }
body { margin: 0; }

.screen {
  width: var(--screen-width);
  height: var(--screen-height);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-page);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: var(--size-body);
  line-height: var(--line-body);
}

.screen h1 { margin: 0; font-size: var(--size-h1); line-height: var(--line-h1); }
.screen h2 { margin: 0; font-size: var(--size-h2); line-height: var(--line-h2); }
.screen h3 { margin: 0; font-size: var(--size-h3); line-height: var(--line-h3); }
.screen p { margin: 0; }

a { color: var(--color-link); }
a:hover { color: var(--color-link-hover); }

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

/* Text */
.caption,
.meta { color: var(--color-text-secondary); font-size: var(--size-small); line-height: var(--line-small); }
.hint { color: var(--color-text-secondary); }
.small { font-size: var(--size-small); line-height: var(--line-small); }
.strong { font-weight: 700; }
.brand { color: var(--color-primary); font-size: var(--size-small); line-height: var(--line-small); font-weight: 700; }
.display { font-size: var(--size-display); line-height: var(--line-display); font-weight: 700; }
.share-code { font-variant-numeric: tabular-nums; letter-spacing: var(--space-1); }

/* ---------- Layout ---------- */

/* Top bars: app name and Help, or a task title and Close */
.app-bar,
.title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: var(--bar-height);
  padding: 0 var(--space-2) 0 var(--space-3);
  background: var(--color-surface);
  border-bottom: var(--border);
}
.app-bar__link { display: flex; align-items: center; min-height: var(--tap); padding: 0 var(--space-2); font-size: var(--size-small); }

/* Top bar with a back link */
.back-bar {
  display: flex;
  align-items: center;
  min-height: var(--bar-height);
  padding: 0 var(--space-2);
  background: var(--color-surface);
  border-bottom: var(--border);
}
.back-link { display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--tap); padding: 0 var(--space-2); }
.back-link svg { width: var(--icon-small); height: var(--icon-small); }

.screen .title-bar h1 { font-size: var(--size-h2); line-height: var(--line-h2); }

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-text);
  cursor: pointer;
}
.icon-button svg { width: var(--icon); height: var(--icon); }

/* Scrolling page body */
.content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3);
}
.content--roomy { gap: var(--space-4); padding: var(--space-4) var(--space-3); }

/* Bar pinned under the content */
.footer-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--color-surface);
  border-top: var(--border);
}

.stack { display: flex; flex-direction: column; gap: var(--space-2); }
.row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }

/* Bottom tab bar */
.tab-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: var(--space-1) 0 var(--space-2);
  background: var(--color-surface);
  border-top: var(--border);
}
.tab-bar a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: var(--bar-height);
  color: var(--color-text-secondary);
  font-size: var(--size-small);
  line-height: var(--line-small);
  text-decoration: none;
}
.tab-bar a[aria-current="page"] { color: var(--color-primary); font-weight: 700; }
.tab-bar svg { width: var(--icon); height: var(--icon); }
/* Unread dot on the icon's top-right corner */
.tab-bar .dot { position: absolute; top: var(--space-1); left: calc(50% + var(--icon) / 2 - var(--space-1)); }

/* Shown on every screen while a carer uses someone else's record */
.acting-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-link);
  color: var(--color-surface);
}
.acting-bar__button {
  flex: none;
  min-height: var(--tap);
  padding: 0 var(--space-3);
  border: 2px solid var(--color-surface);
  border-radius: var(--radius);
  background: none;
  color: var(--color-surface);
  font-family: inherit;
  font-size: var(--size-small);
  font-weight: 700;
  cursor: pointer;
}

/* ---------- Cards ---------- */

.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius);
}

/* A row inside a card, under a line */
.card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: var(--bar-height);
  padding-top: var(--space-2);
  border-top: var(--border);
}
.card--centred { align-items: center; text-align: center; }

/* Label and value pairs */
.details-list { display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-3); margin: 0; }
.details-list dt { color: var(--color-text-secondary); }
.details-list dd { margin: 0; }

/* A result row tinted because it's outside the normal range */
.disclosure__body > .tinted-row { margin: 0 calc(-1 * var(--space-3)); padding: var(--space-2) var(--space-3); background: var(--color-high-bg); }

/* A card of rows split by lines */
.card-list {
  margin: 0;
  padding: 0 var(--space-3);
  list-style: none;
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius);
}
.card-list > * { padding: var(--space-3) 0; }
.card-list > * + * { border-top: var(--border); }
.card-list__heading { padding-bottom: 0; }
.card-list__heading + * { border-top: 0; }
/* The list has --space-3 padding; this keeps a row's chevron --space-4 from the edge, like .card-link */
.card-list .chevron { margin-right: calc(var(--space-4) - var(--space-3)); }

/* A whole card that links somewhere, with a chevron kept clear of the edge */
.link-list { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.card-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--bar-height);
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-3);
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius);
  color: var(--color-text);
  text-decoration: none;
}
.card-link__title { color: var(--color-link); font-size: var(--size-h3); line-height: var(--line-h3); font-weight: 700; }
.card-link__meta { display: block; color: var(--color-text-secondary); font-size: var(--size-small); line-height: var(--line-small); font-weight: 400; }
.card-link__body { flex: 1; display: flex; flex-direction: column; }
.card-link:hover .card-link__title { color: var(--color-link-hover); text-decoration: underline; }
.chevron { flex: none; width: var(--icon-small); height: var(--icon-small); color: var(--color-link); }

/* Expanding section */
.disclosure { background: var(--color-surface); border: var(--border); border-radius: var(--radius); }
.disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--bar-height);
  padding: 0 var(--space-4) 0 var(--space-3);
  font-size: var(--size-h3);
  line-height: var(--line-h3);
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure[open] summary .chevron { transform: rotate(180deg); }
.disclosure__body { padding: 0 var(--space-3) var(--space-3); }
.disclosure__body > * { padding: var(--space-2) 0; }
.disclosure__body > * + * { border-top: var(--border); }

/* ---------- Labels ---------- */

.tag {
  display: inline-block;
  padding: 0 var(--space-2);
  border-radius: var(--radius-tag);
  font-size: var(--size-small);
  line-height: var(--line-small);
  font-weight: 700;
}
.tag--high { background: var(--color-high-bg); color: var(--color-high-text); }
.tag--normal { background: var(--color-normal-bg); color: var(--color-normal-text); }
.tag--info { background: var(--color-info-bg); color: var(--color-text); }
.tag--allergy { background: var(--color-allergy-bg); color: var(--color-allergy-text); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-2);
  border-radius: var(--radius-round);
  background: var(--color-link);
  color: var(--color-surface);
  font-size: var(--size-small);
  line-height: var(--line-small);
  font-weight: 700;
}
.dot { display: inline-block; flex: none; width: var(--dot); height: var(--dot); border-radius: var(--radius-round); background: var(--color-link); }

.status-text--done { color: var(--color-normal-text); font-weight: 700; }
.status-text--muted { color: var(--color-text-secondary); font-weight: 700; }

/* ---------- Messages on the page ---------- */

.callout { padding: var(--space-3); border-radius: var(--radius); }
.callout--info { background: var(--color-info-bg); }
.callout--warning { background: var(--color-warning-bg); }
.callout--success { background: var(--color-normal-bg); color: var(--color-normal-text); font-weight: 700; }

/* Green confirmation panel */
.panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-3);
  border-radius: var(--radius);
  background: var(--color-primary);
  color: var(--color-surface);
}
.panel__title { font-size: var(--size-h1); line-height: var(--line-h1); font-weight: 700; }

/* Red emergency card: header bar and body */
.emergency { overflow: hidden; background: var(--color-surface); border: var(--border); border-radius: var(--radius); }
.screen .emergency h2 { padding: var(--space-2) var(--space-3); background: var(--color-danger); color: var(--color-surface); }
.emergency__body { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3); }

/* ---------- Buttons ---------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  min-height: var(--tap);
  padding: var(--space-2) var(--space-3);
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--color-primary);
  box-shadow: var(--button-shadow);
  color: var(--color-surface);
  font-family: inherit;
  font-size: var(--size-h3);
  line-height: var(--line-h3);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { color: var(--color-surface); }
.btn svg { width: var(--icon-small); height: var(--icon-small); }
.btn--secondary { background: var(--color-surface); border-color: var(--color-primary); box-shadow: none; color: var(--color-primary); }
.btn--secondary:hover { color: var(--color-primary); }
.btn--neutral { background: var(--color-surface); border-color: var(--color-text-secondary); box-shadow: none; color: var(--color-text); }
.btn--done { background: var(--color-normal-bg); box-shadow: none; color: var(--color-normal-text); }
.btn--danger { background: var(--color-danger); box-shadow: 0 4px 0 var(--color-danger-shadow); }
.btn--inline { width: auto; align-self: flex-start; }
.btn:disabled { background: var(--color-border); border-color: transparent; box-shadow: none; color: var(--color-text-secondary); cursor: not-allowed; }

.btn-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }

/* Looks like a link, does something on this page */
.link-button {
  align-self: flex-start;
  min-height: var(--tap);
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-link);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* A link on its own line, centred */
.link-block { display: flex; align-items: center; justify-content: center; min-height: var(--tap); }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: var(--space-1); }
.label { font-size: var(--size-h3); line-height: var(--line-h3); font-weight: 700; }
.fieldset { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; border: 0; }
.fieldset legend { padding: 0; margin-bottom: var(--space-1); font-size: var(--size-h3); line-height: var(--line-h3); font-weight: 700; }

.input,
.select,
.textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 0 var(--space-2);
  border: var(--border-control);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--size-body);
}
.textarea { padding: var(--space-2); min-height: calc(var(--tap) * 2); resize: vertical; }
.input--code { font-size: var(--size-h2); letter-spacing: var(--space-1); }
.input--day { width: 4em; }
.input--year { width: 6em; }

.input-group { display: flex; gap: var(--space-2); }
.input-group__prefix {
  display: flex;
  align-items: center;
  flex: none;
  padding: 0 var(--space-2);
  border: var(--border-control);
  border-radius: var(--radius);
  background: var(--color-page);
}

.date-input { display: flex; gap: var(--space-3); }

/* Radios and checkboxes: large targets, NHS style */
.radio,
.checkbox { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap); cursor: pointer; }
.radio input,
.checkbox input {
  position: relative;
  flex: none;
  width: var(--control-size);
  height: var(--control-size);
  margin: 0;
  appearance: none;
  border: 2px solid var(--color-text);
  background: var(--color-surface);
}
.radio input { border-radius: var(--radius-round); }
.radio input:checked::after {
  content: "";
  position: absolute;
  inset: var(--space-2);
  border-radius: var(--radius-round);
  background: var(--color-text);
}
.checkbox input { border-radius: var(--radius-tag); }
.checkbox input:checked::after {
  /* The tick: two borders of a box, turned 45 degrees */
  content: "";
  position: absolute;
  left: 12px;
  top: 4px;
  width: 10px;
  height: 20px;
  border: solid var(--color-text);
  border-width: 0 4px 4px 0;
  transform: rotate(45deg);
}
.option__hint { display: block; color: var(--color-text-secondary); font-size: var(--size-small); line-height: var(--line-small); }

/* Extra question shown when an option is picked */
.reveal { padding-left: calc(var(--control-size) + var(--space-3)); }

/* On/off switch */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); cursor: pointer; }
.switch {
  position: relative;
  flex: none;
  width: var(--switch-width);
  height: var(--switch-height);
  margin: 0;
  appearance: none;
  border-radius: var(--radius-round);
  background: var(--color-control-off);
  cursor: pointer;
}
.switch::after {
  content: "";
  position: absolute;
  top: var(--space-1);
  left: var(--space-1);
  width: calc(var(--switch-height) - 2 * var(--space-1));
  height: calc(var(--switch-height) - 2 * var(--space-1));
  border-radius: var(--radius-round);
  background: var(--color-surface);
  transition: left 0.15s;
}
.switch:checked { background: var(--color-primary); }
.switch:checked::after { left: calc(var(--switch-width) - var(--switch-height) + var(--space-1)); }

/* ---------- Lists ---------- */

.tick-list { display: flex; flex-direction: column; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.tick-list li { display: flex; gap: var(--space-2); }
.tick-list svg { flex: none; width: var(--icon); height: var(--icon); margin-top: calc((var(--line-body) - var(--icon)) / 2); color: var(--color-primary); }

/* ---------- Chat ---------- */

.chat { display: flex; flex-direction: column; gap: var(--space-2); }
.bubble { max-width: 85%; padding: var(--space-2) var(--space-3); border-radius: var(--radius-bubble); }
.bubble--them { align-self: flex-start; background: var(--color-surface); border: var(--border); border-bottom-left-radius: var(--radius-tag); }
.bubble--me { align-self: flex-end; background: var(--color-info-bg); border-bottom-right-radius: var(--radius-tag); }
.bubble .tag { display: block; margin-top: var(--space-2); }
.chat-sample { padding: var(--space-3); border-radius: var(--radius); background: var(--color-page); }

.chip {
  min-height: var(--tap);
  padding: var(--space-2) var(--space-3);
  border: 2px solid var(--color-link);
  border-radius: var(--radius-round);
  background: var(--color-surface);
  color: var(--color-link);
  font-family: inherit;
  font-size: var(--size-body);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

/* ---------- Health record pieces ---------- */

/* Pinned patient summary in the provider app */
.patient-banner { padding: var(--space-2) var(--space-3); background: var(--color-surface-muted); border-bottom: var(--border); }
.patient-banner__name { font-size: var(--size-h2); line-height: var(--line-h2); font-weight: 700; }

/* Bar showing the lab's normal range and where the result falls */
.range { --marker-size: 28px; position: relative; height: var(--control-size); }
.range__track,
.range__normal { position: absolute; top: calc((var(--control-size) - var(--dot)) / 2); height: var(--dot); border-radius: var(--radius-round); }
.range__track { left: 0; right: 0; background: var(--color-border); }
.range__normal { background: var(--color-primary); }
.range__marker {
  position: absolute;
  top: calc((var(--control-size) - var(--marker-size)) / 2);
  width: var(--marker-size);
  height: var(--marker-size);
  margin-left: calc(var(--marker-size) / -2);   /* centre the marker on its value */
  border: 3px solid var(--color-surface);
  border-radius: var(--radius-round);
  background: var(--color-high-text);
}

/* Trend chart */
.chart { display: block; width: 100%; height: auto; }
.chart__normal { fill: var(--color-normal-bg); }
.chart__line { fill: none; stroke: var(--color-text); stroke-width: 2.5; }
.chart__point { fill: var(--color-text); }
.chart__point--latest { fill: var(--color-high-text); }
.chart__label { fill: var(--color-text-secondary); font-size: var(--size-small); font-family: var(--font-family); }
.chart__label--latest { fill: var(--color-text); font-weight: 700; }
.chart__label--normal { fill: var(--color-normal-text); }

/* Medicine with its pill picture */
.medicine { display: flex; align-items: center; gap: var(--space-3); }
.pill-picture { flex: none; width: var(--space-6); height: var(--space-6); fill: var(--color-surface); stroke: var(--illustration-outline); stroke-width: 2; }

/* Appointment and queue rows: time, then details */
.timed-row { display: grid; grid-template-columns: var(--time-column) 1fr auto; align-items: center; gap: var(--space-2); color: var(--color-text); text-decoration: none; }

/* QR code */
.qr { width: 200px; height: 200px; color: var(--color-text); }
.card--centred .btn--inline { align-self: center; }

/* Text size preview: scales everything inside it */
.text-preview--large { zoom: 1.25; }
.text-preview--extra-large { zoom: 1.5; }

/* ---------- Provider app: photographing and checking a note ----------
   Sizes in this section draw the demo's camera, paper and QR code to fit
   the phone screen. They're pictures, not part of the type or space scale. */

.camera {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 360px;
  flex: none;
  padding-bottom: var(--space-5);   /* room for the caption under the paper */
  border-radius: var(--radius);
  background: var(--color-text);
}
.camera__frame { position: absolute; inset: var(--space-3) var(--space-6) var(--space-5); border: 3px solid var(--color-focus); border-radius: var(--radius); }
.camera__caption { position: absolute; left: 0; right: 0; bottom: var(--space-2); color: var(--color-surface); font-size: var(--size-small); text-align: center; }

/* A paper note, drawn for the demo */
.paper {
  width: 230px;
  height: 280px;
  padding: var(--space-3);
  background: var(--illustration-paper);
  color: var(--illustration-ink);
  font-family: var(--font-handwriting);
  font-size: 20px;
  line-height: 26px;
  transform: rotate(-2deg);
}

.shutter {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 76px;
  height: 76px;
  border: 5px solid var(--color-primary);
  border-radius: var(--radius-round);
  background: var(--color-surface);
  cursor: pointer;
}
.shutter span { width: 52px; height: 52px; border-radius: var(--radius-round); background: var(--color-primary); }

.thumbs { display: flex; gap: var(--space-2); }
.thumb {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 64px;
  height: 84px;
  padding-bottom: var(--space-1);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius);
  background: var(--illustration-paper);
  font-size: var(--size-small);
  font-weight: 700;
}

/* Words the draft isn't sure about */
.flag {
  display: inline;
  margin: 0;
  padding: 0 var(--space-1);
  border: 0;
  border-radius: var(--radius-tag);
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
}
.flag--open { background: var(--color-warning-bg); box-shadow: inset 0 -2px 0 var(--color-high-text); }
.flag--current { background: var(--color-focus); box-shadow: inset 0 -3px 0 var(--color-text); }
.flag--done { padding: 0; background: none; cursor: default; }

/* The piece of the photo a flagged word came from */
.crop { padding: var(--space-2) var(--space-3); border: 1px solid var(--illustration-paper-edge); border-radius: var(--radius-tag); background: var(--illustration-paper); }
.crop__text { color: var(--illustration-ink); font-family: var(--font-handwriting); font-size: 30px; line-height: 34px; }

.check-panel { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3); border: 2px solid var(--color-text); border-radius: var(--radius); background: var(--color-surface); }

/* A photo the provider has added, such as a registration certificate */
.photo-thumb { flex: none; width: 56px; height: 40px; border: 1px solid var(--illustration-paper-edge); border-radius: var(--radius-tag); background: var(--illustration-paper); }

/* Camera view when scanning a patient's QR code */
.viewfinder { display: flex; align-items: center; justify-content: center; flex: none; height: 400px; background: var(--illustration-camera); }
.viewfinder__frame { position: relative; display: flex; align-items: center; justify-content: center; width: 240px; height: 240px; }
.viewfinder__corner { position: absolute; width: 36px; height: 36px; border: 0 solid var(--color-surface); }
.viewfinder__corner--tl { top: 0; left: 0; border-top-width: 5px; border-left-width: 5px; border-top-left-radius: var(--radius); }
.viewfinder__corner--tr { top: 0; right: 0; border-top-width: 5px; border-right-width: 5px; border-top-right-radius: var(--radius); }
.viewfinder__corner--bl { bottom: 0; left: 0; border-bottom-width: 5px; border-left-width: 5px; border-bottom-left-radius: var(--radius); }
.viewfinder__corner--br { bottom: 0; right: 0; border-bottom-width: 5px; border-right-width: 5px; border-bottom-right-radius: var(--radius); }
.viewfinder__code { padding: var(--space-3); border-radius: var(--radius-tag); background: var(--color-surface); transform: rotate(-4deg); }
.viewfinder__code svg { display: block; width: 168px; height: 168px; }

/* ---------- Focus (last, so it wins over component colours) ---------- */

:is(a, button, summary):focus-visible {
  outline: none;
  background-color: var(--color-focus);
  color: var(--color-text);
  box-shadow: 0 4px 0 var(--color-text);
}
:is(input, select, textarea):focus-visible {
  outline: 4px solid var(--color-focus);
  outline-offset: 0;
  box-shadow: inset 0 0 0 2px var(--color-text);
}
