/* The Runners of Rome design system: the one stylesheet every page on the new base
   (templates/app_base.html) loads, and the design lab with it. The Notturna look,
   from the posters of a London run club that Stefano brought as reference and made the
   look of the app on 18/11/2026 (it was a theme of the lab's Home that day): black, one
   red-orange (#F4401E) and white. Surfaces are told apart by tone, not by outlines: the
   ground #0A0A0A, plates a step up (#141414) with a soft drop shadow, sheets and dialogs
   a step higher (--ap-raised), figures and fields sunk in near-black wells. Square
   corners everywhere; circles only for dots, faces and the check-in ring.
   Type: page titles and run titles in a narrow serif in capitals (Instrument Serif,
   standing in for the poster's own face, which is not on Google Fonts); figures and
   times in a tight black grotesque, Inter Tight 800 ("5K", "7PM"); everything else
   (text, labels, forms, tables, data) in Inter Tight. Grey keys and one red key per
   screen, with black text: red on black is 5.3:1, white on that red would miss AA.
   Red is also the colour of section titles, the focus ring, the selection, errors and
   confirmations. Increase Contrast brings the outlines back (after the tokens).
   It replaced the flat neutral greys and Jost of 10/11/2026.
   Prefix ap-, scoped on body.ap. Living style guide: /design-lab/sistema/.

   A page adds one stylesheet of its own, with its own prefix, for its layout only. A
   piece two pages need belongs here: add it in a delimited block at the END of this
   file (see the last blocks), and show it on /design-lab/sistema/. Never reorder or
   reformat the rules above a block that is not yours.
   Moved from design_lab/static/design_lab/base.css (#78). */

/* Tokens. The fonts come from Google Fonts in app_base.html (Instrument Serif roman
   and italic; Inter Tight 500, 700 and 800). Inks on the ground: #F5F3F0 17.9:1,
   --ap-ink-2 10.2:1, --ap-ink-3 5.8:1 (4.6:1 on a key). The accent, as text: 5.3:1 on
   the ground, 4.9:1 on a plate, 4.5:1 on --ap-raised (#1C1C1C, a hair under the
   theme's #1D1D1D, which left red text at 4.49:1 in sheets). */
.ap {
  --ap-sans: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ap-serif: "Instrument Serif", "Times New Roman", serif;
  --ap-bg: #0A0A0A;
  --ap-plate: #141414;
  --ap-raised: #1C1C1C;
  /* The edge Increase Contrast draws round plates, wells and keys (below). */
  --ap-plate-edge: rgba(245, 243, 240, 0.12);
  --ap-ink: #F5F3F0;
  --ap-ink-2: #BDBAB5;
  --ap-underline: rgba(189, 186, 181, 0.45);
  --ap-ink-3: #8E8B86;
  --ap-line: rgba(245, 243, 240, 0.12);
  --ap-well: #050505;
  --ap-well-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.8);
  --ap-key: #232323;
  --ap-key-hover: #2E2E2E;
  --ap-key-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  --ap-relief: 0 1px 2px rgba(0, 0, 0, 0.6), 0 18px 40px -14px rgba(0, 0, 0, 0.9);
  --ap-accent: #F4401E;
  --ap-accent-hi: #FF5A3A;
  --ap-accent-down: #D93312;
  --ap-accent-ink: #0A0A0A;
  --ap-error: var(--ap-accent);
  --ap-ok: var(--ap-accent);
  margin: 0;
  min-height: 100vh;
  background: var(--ap-bg);
  color: var(--ap-ink);
  font: 500 1rem/1.5 var(--ap-sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Increase Contrast (iOS, macOS), also the 6am-in-the-sun case: the second and third
   inks and the lines step up, and plates, wells and keys get a visible edge instead of
   the tones and shadows above. */
@media (prefers-contrast: more) {
  .ap {
    --ap-ink-2: #D9D6D1;
    --ap-ink-3: #ADAAA5;
    --ap-line: #4A4A4A;
    --ap-plate-edge: rgba(245, 243, 240, 0.3);
    --ap-well-shadow: inset 0 0 0 1px var(--ap-plate-edge);
    --ap-key-shadow: inset 0 0 0 1px var(--ap-plate-edge);
    --ap-relief: inset 0 0 0 1px var(--ap-plate-edge);
  }
}

/* Scrollbars in the house style: thin, a key-grey thumb on the ground, on the page and
   on every scrolling box (sheets, lists). color-scheme dark makes the native parts dark
   too where the browser draws its own (iOS overlays, form controls). The page's own
   scrollbar belongs to the root element, hence :root:has(). */
:root:has(> body.ap) {
  color-scheme: dark;
  scrollbar-color: #444444 var(--ap-bg, #0A0A0A);
  background: #0A0A0A;
}

.ap,
.ap * {
  scrollbar-width: thin;
  scrollbar-color: #444444 transparent;
}

.ap *,
.ap *::before,
.ap *::after {
  box-sizing: border-box;
}

.ap :where(h1, h2, h3, p, ul, ol, dl, dd, fieldset, figure) {
  margin: 0;
}

.ap :where(ul, ol) {
  padding: 0;
  list-style: none;
}

.ap fieldset {
  min-width: 0;
  padding: 0;
  border: 0;
}

/* Links take their colour from where they sit. :where() keeps this at the lowest
   specificity, so a component (the lead key, the lab strip) always wins. */
:where(.ap) a {
  color: inherit;
}

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

.ap ::selection {
  background: var(--ap-accent);
  color: var(--ap-accent-ink);
}

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

/* ---------------------------------------------------------------------------
   Page: one column, 16px gutters on a phone; forms stay narrow everywhere. */

.ap-page {
  width: 100%;
  max-width: 30rem;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.ap-page--wide {
  max-width: 44rem;
}

/* The melted logo, as wide as the plate under it (Stefano likes logos big); it links
   home. */
.ap-mark {
  display: block;
  width: 100%;
  margin: 12px auto 28px;
}

.ap-mark img {
  display: block;
  width: 100%;
  height: auto;
}

.ap-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  margin-bottom: 20px;
}

.ap-bar__logo img {
  display: block;
  width: 168px;
  height: auto;
}

/* ---------------------------------------------------------------------------
   Type roles (18/11/2026): page titles (.ap-title, every page's h1, and the question
   of a dialog) and run titles in the serif in capitals; figures in Inter Tight 800,
   tight; labels and section titles 700 in capitals, barely spaced; keys 800 in
   capitals; text 500 (the lightest weight loaded). The serif is narrow and light: it
   reads only big, as on the posters, so it runs a size up with closed line heights. */

.ap-title {
  font: 400 clamp(2rem, 7.5vw, 2.625rem)/0.95 var(--ap-serif);
  letter-spacing: -0.01em;
  text-transform: uppercase;
  text-wrap: balance;
}

.ap-lede {
  margin-top: 8px;
  color: var(--ap-ink-2);
  font-size: 1rem;
  line-height: 1.45;
}

.ap-label {
  color: var(--ap-ink-2);
  font: 700 0.75rem/1.3 var(--ap-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Figures: the tight black grotesque of "5K / 7PM", proportional. */
.ap-fig {
  font-family: var(--ap-sans);
  font-weight: 800;
  font-variant-numeric: normal;
  letter-spacing: -0.04em;
}

.ap-run-title {
  font: 400 clamp(1.75rem, 7vw, 2.25rem)/1 var(--ap-serif);
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

/* A pace group's colour, as on the home's plate. */
.ap-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ap-tone, transparent);
}

.ap-dot--black { --ap-tone: #000; box-shadow: inset 0 0 0 1.5px #6B6B6B; }
.ap-dot--red { --ap-tone: #E8312A; }
.ap-dot--magenta { --ap-tone: #D4119C; }
.ap-dot--orange { --ap-tone: #FF8A1F; }
.ap-dot--blue { --ap-tone: #1F63FF; }
.ap-dot--white { --ap-tone: #FFF; }

/* ---------------------------------------------------------------------------
   Plate: the raised panel that holds a form or a block of facts, a tone above the
   ground with a soft shadow under it. */

.ap-plate {
  padding: 20px 18px;
  border-radius: 0;
  background: var(--ap-plate);
  box-shadow: var(--ap-relief);
}

.ap-plate + .ap-plate {
  margin-top: 16px;
}

.ap-plate__head {
  margin-bottom: 20px;
}

/* Section titles in red, like the poster's small print (SIN RUN CLUB, EST.). */
.ap-section-title {
  margin: 0 0 14px;
  color: var(--ap-accent);
  font: 700 0.75rem/1.3 var(--ap-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------------------
   Fields: label above, the input in a recessed well, help and error under it.
   Inputs are 17px so iOS never zooms on focus. */

.ap-fields {
  display: grid;
  gap: 18px;
}

.ap-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.ap-field__label {
  color: var(--ap-ink-2);
  font: 700 0.75rem/1.3 var(--ap-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.ap-field__label .ap-opt {
  color: var(--ap-ink-3);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.ap-input,
.ap-select {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 0;
  border-radius: 0;
  background: var(--ap-well);
  box-shadow: var(--ap-well-shadow);
  color: var(--ap-ink);
  font: 400 1.0625rem/1.3 var(--ap-sans);
  appearance: none;
}

.ap-input::placeholder {
  color: var(--ap-ink-3);
  opacity: 1;
}

.ap-input:focus,
.ap-select:focus {
  outline: 2px solid var(--ap-accent);
  outline-offset: 0;
}

.ap-select {
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%23BDBAB5' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
  cursor: pointer;
}

/* Nothing chosen yet: the placeholder option reads as a placeholder, and turns to ink as
   soon as an answer is picked. */
.ap-select:invalid,
.ap-select:has(option[value=""]:checked),
.ap-select.is-empty:not(:has(option:checked:not([value=""]))) {
  color: var(--ap-ink-3);
}

.ap-select option {
  background: var(--ap-plate);
  color: var(--ap-ink);
}

.ap-help {
  color: var(--ap-ink-2);
  font-size: 0.875rem;
  line-height: 1.4;
}

.ap-field.has-error .ap-input,
.ap-field.has-error .ap-select {
  box-shadow: var(--ap-well-shadow), 0 0 0 1.5px var(--ap-error);
}

.ap-error {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--ap-error);
  font-size: 0.875rem;
  line-height: 1.4;
}

.ap-error svg {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* A message for the whole form (wrong credentials, saved): a strip on the plate. */
.ap-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 0;
  background: var(--ap-well);
  box-shadow: var(--ap-well-shadow);
  font-size: 0.9375rem;
  line-height: 1.4;
}

.ap-note svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ap-note--error {
  color: var(--ap-error);
}

.ap-note--ok {
  color: var(--ap-ok);
}

.ap-note p {
  color: var(--ap-ink);
}

/* Two fields side by side from 30rem up (first and last name, sizes). */
.ap-pair {
  display: grid;
  gap: 18px;
}

@media (min-width: 30rem) {
  .ap-pair {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
}

/* Check: a small square well; ticked, it turns bone. Red is kept for the screen's one
   key. */
.ap-check {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
}

.ap-check input {
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
  border-radius: 0;
  background: var(--ap-well);
  box-shadow: var(--ap-well-shadow);
  appearance: none;
  cursor: pointer;
}

.ap-check input:checked {
  background: var(--ap-ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5 6.5 11.5 12.5 4.5' fill='none' stroke='%230B0A09' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
  box-shadow: none;
}

/* An Instagram handle: the @ sits in the well, before what you type. */
.ap-handle {
  position: relative;
}

.ap-handle__at {
  position: absolute;
  top: 50%;
  left: 16px;
  color: var(--ap-ink-3);
  font-size: 1.0625rem;
  transform: translateY(-52%);
  pointer-events: none;
}

.ap-handle .ap-input {
  padding-left: 34px;
}

/* A smaller check, under a field ("I don't use Instagram"). */
.ap-check--small {
  min-height: 36px;
  color: var(--ap-ink-2);
  font-size: 0.9375rem;
}

.ap-check--small input {
  width: 20px;
  height: 20px;
  border-radius: 0;
}

.ap-check--small input:checked {
  background-size: 14px;
}

/* Switch: an on/off that acts at once (a preference, a view). Off, a grey knob on a
   key-toned track (a well would vanish on the black ground); on, bone with a dark knob.
   Red is kept for the screen's one key. */
.ap-switch {
  position: relative;
  flex: none;
  width: 52px;
  height: 32px;
  margin: 0;
  border-radius: 0;
  background: var(--ap-key);
  box-shadow: var(--ap-key-shadow);
  appearance: none;
  cursor: pointer;
}

.ap-switch::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 0;
  background: var(--ap-ink-2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* On: the accent, so on and off read apart at a glance (Stefano, 18/11/2026). */
.ap-switch:checked {
  background: var(--ap-accent);
  box-shadow: none;
}

.ap-switch:checked::after {
  left: 24px;
  background: var(--ap-accent-ink);
}

@media (prefers-reduced-motion: no-preference) {
  .ap-switch::after {
    transition: left 0.15s ease;
  }
}

/* Choice: a set of options as keys in a row of wells; the chosen one lights up.
   Radios underneath, so it reads and behaves as a radio group. */
.ap-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ap-choice {
  position: relative;
}

.ap-choice input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.ap-choice span {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 0;
  background: var(--ap-well);
  box-shadow: var(--ap-well-shadow);
  color: var(--ap-ink-2);
  font-size: 1rem;
}

.ap-choice input:checked + span {
  background: var(--ap-ink);
  box-shadow: none;
  color: var(--ap-bg);
  font-weight: 500;
}

.ap-choice input:focus-visible + span {
  outline: 2px solid var(--ap-accent);
  outline-offset: 2px;
}

/* Long options (survey answers) stack as full-width rows. */
.ap-choices--rows {
  display: grid;
}

.ap-choices--rows .ap-choice span {
  min-height: 52px;
  padding: 12px 16px;
  border-radius: 0;
  line-height: 1.3;
}

/* ---------------------------------------------------------------------------
   Keys: square grey keys in capitals, 800; the lead key is the single red one on the
   screen, with black text. */

.ap-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 0;
  background: var(--ap-key);
  box-shadow: var(--ap-key-shadow);
  color: var(--ap-ink);
  font: 800 0.875rem/1 var(--ap-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.ap-key:hover {
  background: var(--ap-key-hover);
}

.ap-key svg {
  flex: none;
  width: 18px;
  height: 18px;
}

.ap-key--lead {
  justify-content: space-between;
  width: 100%;
  min-height: 56px;
  border-radius: 0;
  background: var(--ap-accent);
  box-shadow: none;
  color: var(--ap-accent-ink);
  font-size: 1rem;
}

.ap-key--lead:hover {
  background: var(--ap-accent-hi);
}

.ap-key--lead:active {
  background: var(--ap-accent-down);
}

.ap-key--lead svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ap-key--wide {
  width: 100%;
}

.ap-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.ap-actions {
  margin-top: 24px;
}

/* A quiet text link: underlined, never a key. */
.ap-textlink {
  color: var(--ap-ink-2);
  font-size: 0.9375rem;
  text-decoration: underline;
  text-decoration-color: var(--ap-underline);
  text-underline-offset: 3px;
}

.ap-textlink:hover {
  color: var(--ap-ink);
}

.ap-textlink--strong {
  color: var(--ap-ink);
  font-weight: 500;
}

/* A line with a word in the middle, between two ways of doing the same thing. */
.ap .ap-divider {
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 22px 0;
}

.ap-divider::before,
.ap-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ap-line);
}

/* Under the plate, on the ground. */
.ap-after {
  display: grid;
  gap: 12px;
  justify-items: center;
  margin-top: 24px;
  color: var(--ap-ink-2);
  font-size: 0.9375rem;
  text-align: center;
}

/* Keys sink 2px under the finger (Stefano, 18/11/2026), and their shadow goes: a
   physical key. The close key and the segmented links too. */
@media (prefers-reduced-motion: no-preference) {
  .ap-key,
  .ap-sheet__x,
  .ap-seg__item {
    transition: background-color 0.15s ease, box-shadow 0.08s ease, translate 0.08s ease;
  }

  .ap-key:active:not([disabled]),
  .ap-sheet__x:active,
  .ap-seg__item:active {
    box-shadow: none;
    translate: 0 2px;
  }
}

@media (min-width: 48rem) {
  .ap-page {
    padding-top: 56px;
  }

  .ap-plate {
    padding: 28px;
  }
}

/* ---- added for #78: sheets and dialogs ---- */
/* A modal is a native <dialog>, opened with showModal() by site/js/ror-dialog.js
   (data-dialog-open="id" on the key that opens it, data-dialog-close inside it); Esc
   and a click on the backdrop close it. Two frames:
   - .ap-sheet, for a form or a list: .ap-sheet__head (what it is about, then the close
     key .ap-sheet__x), .ap-sheet__body that scrolls, .ap-sheet__foot with the keys;
   - .ap-dialog, for one short question: .ap-dialog__icon, an .ap-title, an .ap-lede,
     .ap-dialog__keys.
   On a phone both rise from the bottom with their keys in reach; from 48rem they sit in
   the middle. The design lab draws the same frames as plain divs, open, on a fake
   backdrop: the rules below hold for both. */

.ap-sheet {
  position: fixed;
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  width: auto;
  max-width: none;
  height: auto;
  max-height: calc(100dvh - 24px);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--ap-raised);
  box-shadow: var(--ap-relief);
  color: var(--ap-ink);
}

/* The grabber: it says the sheet can go. */
.ap-sheet::before {
  content: "";
  align-self: center;
  width: 40px;
  height: 5px;
  margin-top: 8px;
  border-radius: 0;
  background: var(--ap-line);
}

.ap-sheet__head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 18px 16px;
  border-bottom: 1px solid var(--ap-line);
}

.ap-sheet__head > * {
  min-width: 0;
}

.ap-sheet__x {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -6px -8px 0 auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ap-ink-2);
  cursor: pointer;
}

.ap-sheet__x:hover {
  background: var(--ap-key);
  color: var(--ap-ink);
}

.ap-sheet__x svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.ap-sheet__body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
}

.ap-sheet__foot {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--ap-line);
}

.ap-sheet__foot .ap-key {
  min-height: 56px;
}

.ap-dialog {
  position: fixed;
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  gap: 10px;
  width: auto;
  max-width: none;
  height: auto;
  max-height: calc(100dvh - 24px);
  margin: 0;
  padding: 24px 20px calc(20px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 0;
  background: var(--ap-raised);
  box-shadow: var(--ap-relief);
  color: var(--ap-ink);
}

.ap-dialog__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 6px;
  border-radius: 0;
  background: var(--ap-well);
  box-shadow: var(--ap-well-shadow);
  color: var(--ap-accent);
}

.ap-dialog__icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ap-dialog .ap-lede {
  margin-top: 0;
  color: var(--ap-ink);
}

.ap-dialog__keys {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

/* A warning inside a form or a sheet ("High demand"): red text, never a key. */
.ap-note--warn {
  color: var(--ap-accent);
}

/* The native element: hidden while closed (the frames above set a display), scrolling
   inside itself if it is taller than the screen (the browser makes a modal a scroll box;
   a sheet scrolls its body), the page behind dimmed and blurred, and held still while a
   modal is open. */
dialog.ap-sheet:not([open]),
dialog.ap-dialog:not([open]) {
  display: none;
}

dialog.ap-sheet,
dialog.ap-dialog {
  overscroll-behavior: contain;
}

.ap-sheet::backdrop,
.ap-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
}

:root:has(dialog.ap-sheet[open], dialog.ap-dialog[open]) {
  overflow: hidden;
}

/* Opening and closing (Stefano, 18/11/2026): on a phone the frame slides up from the
   bottom edge and back down; from 48rem it rises a little into the middle and fades.
   The backdrop fades with it. ror-dialog.js adds .is-closing and closes the dialog when
   the slide-down ends. `translate` composes with the centring `transform` from 48rem.
   Reduce Motion: no movement. */
@media (prefers-reduced-motion: no-preference) {
  dialog.ap-sheet[open],
  dialog.ap-dialog[open] {
    animation: ap-sheet-in 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  dialog.ap-sheet[open]::backdrop,
  dialog.ap-dialog[open]::backdrop {
    animation: ap-backdrop-in 320ms ease-out;
  }

  dialog.ap-sheet.is-closing,
  dialog.ap-dialog.is-closing {
    animation: ap-sheet-out 220ms cubic-bezier(0.4, 0, 1, 1) forwards;
  }

  dialog.ap-sheet.is-closing::backdrop,
  dialog.ap-dialog.is-closing::backdrop {
    animation: ap-backdrop-out 220ms ease-in forwards;
  }
}

@keyframes ap-sheet-in {
  from { translate: 0 100%; }
}

@keyframes ap-sheet-out {
  to { translate: 0 100%; }
}

@keyframes ap-backdrop-in {
  from { opacity: 0; }
}

@keyframes ap-backdrop-out {
  to { opacity: 0; }
}

@media (min-width: 48rem) {
  @keyframes ap-sheet-in {
    from { opacity: 0; translate: 0 32px; }
  }

  @keyframes ap-sheet-out {
    to { opacity: 0; translate: 0 32px; }
  }
}

@media (min-width: 48rem) {
  .ap-sheet {
    top: 50%;
    right: auto;
    bottom: auto;
    left: 50%;
    width: min(32rem, calc(100vw - 48px));
    max-height: calc(100vh - 96px);
    border-radius: 0;
    transform: translate(-50%, -50%);
  }

  .ap-sheet::before {
    display: none;
  }

  .ap-sheet__head {
    padding-top: 20px;
  }

  .ap-dialog {
    top: 50%;
    right: auto;
    bottom: auto;
    left: 50%;
    width: min(28rem, calc(100vw - 48px));
    max-height: calc(100vh - 96px);
    padding: 28px;
    border-radius: 0;
    transform: translate(-50%, -50%);
  }
}

/* ---- added for #78: messages (app_base.html); the consent banner that followed left on 20/11/2026 (#70) ---- */
/* Django messages (_messages.html): a floating notice at the bottom of the screen, over
   the page, where the thumb is (Stefano, 18/11/2026). White with black type for a
   confirmation, red-orange for an error or a warning; a close key on each. Over the
   cookie banner when both are there. Motion in "Motion" below and in motion.js. */
.ap-messages {
  position: fixed;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 12px;
  z-index: 30;
  display: grid;
  gap: 8px;
  max-width: 30rem;
  margin: 0 auto;
  pointer-events: none;
}

.ap-messages .ap-note {
  align-items: center;
  margin: 0;
  padding: 6px 6px 6px 16px;
  background: var(--ap-ink);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  color: var(--ap-accent-ink);
  font: 700 0.9375rem/1.35 var(--ap-sans);
  pointer-events: auto;
}

.ap-messages .ap-note--error,
.ap-messages .ap-note--warn {
  background: var(--ap-accent);
}

.ap-messages .ap-note p {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 0;
  color: inherit;
}

.ap-messages .ap-note a {
  color: inherit;
  text-decoration: underline;
}

.ap-note__x {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.ap-note__x:hover {
  background: rgba(10, 10, 10, 0.08);
}

.ap-note__x:focus-visible {
  outline: 2px solid var(--ap-accent-ink);
  outline-offset: -4px;
}

.ap-messages .ap-note .ap-note__x svg {
  width: 18px;
  height: 18px;
  margin: 0;
  stroke-width: 2.2;
}

/* ---- added for #77: page head of the pages without a mockup (templates/_page_head.html) ---- */
.ap-head {
  margin-bottom: 24px;
}

/* The melted logo: as wide as the column, up to 640px, like the home's (on a wide
   staff page it would otherwise stand taller than the screen's first fold). */
.ap-head__logo {
  display: block;
  width: 100%;
  max-width: 640px;
  margin: 8px 0 24px;
}

.ap-head__logo img {
  display: block;
  width: 100%;
  height: auto;
}

/* ---- App bar: every signed-in page but the home (_app_bar.html, 18/11/2026). The
   small melted logo on the left, linking home; the account menu on the right, as on
   the home (avatar, name, Edit profile, Admin, Runner mode, Logout). */
.ap-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  margin: 4px 0 28px;
}

.ap-bar__logo {
  display: block;
  flex: none;
  line-height: 0;
}

.ap-bar__logo img {
  display: block;
  width: auto;
  height: 36px;
}

.ap-menu {
  position: relative;
  z-index: 20;
}

.ap-menu summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  list-style: none;
  font: 700 14px/1 var(--ap-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
}

.ap-menu summary::-webkit-details-marker {
  display: none;
}

.ap-menu summary:focus-visible {
  outline: 2px solid var(--ap-accent);
  outline-offset: 2px;
}

.ap-menu__chev {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--ap-ink-2);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ap-menu[open] .ap-menu__chev {
  transform: rotate(180deg);
}

/* On a phone the name is hidden from sight, not from VoiceOver. */
@media (max-width: 479px) {
  .ap-menu__name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

.ap-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--ap-raised);
  color: var(--ap-ink);
  font: 800 12px/1 var(--ap-sans);
}

.ap-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ap-menu__list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--ap-key);
  box-shadow: var(--ap-key-shadow), 0 14px 34px rgba(0, 0, 0, 0.6);
}

.ap-menu__list a,
.ap-menu__list button {
  display: block;
  width: 100%;
  padding: 13px 14px;
  border: 0;
  background: none;
  color: var(--ap-ink);
  font: 500 15px/1.2 var(--ap-sans);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.ap-menu__list a:hover,
.ap-menu__list button:hover {
  background: var(--ap-key-hover);
}

.ap-menu__list form {
  margin: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .ap-menu__chev {
    transition: transform 0.15s ease;
  }
}

/* ---- added for #90: tables, chips, textarea and file fields, switch row, segmented links ---- */
/* A table that scrolls inside its own box, so a wide one never widens the page. */
.ap-scroll {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.35;
}

.ap-table th {
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--ap-line);
  color: var(--ap-ink-2);
  font: 700 0.75rem/1.3 var(--ap-sans);
  letter-spacing: 0.02em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.ap-table td {
  padding: 12px;
  border-bottom: 1px solid var(--ap-line);
  vertical-align: middle;
}

.ap-table tbody tr:last-child td {
  border-bottom: 0;
}

.ap-table .ap-num {
  text-align: right;
  white-space: nowrap;
}

.ap-table th:first-child,
.ap-table td:first-child {
  padding-left: 0;
}

.ap-table th:last-child,
.ap-table td:last-child {
  padding-right: 0;
}

.ap-table .ap-name {
  font-weight: 700;
}

/* A small static tag: a count, a status. Tones follow the notes: ok and error (both
   red), bone. */
.ap-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 0;
  background: var(--ap-well);
  box-shadow: var(--ap-well-shadow);
  color: var(--ap-ink-2);
  font: 700 0.75rem/1 var(--ap-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ap-chip--ok {
  color: var(--ap-ok);
}

.ap-chip--error {
  color: var(--ap-error);
}

.ap-chip--bone {
  background: var(--ap-ink);
  box-shadow: none;
  color: var(--ap-bg);
}

/* A text area and a file input take the look of a field. */
textarea.ap-input {
  min-height: 96px;
  resize: vertical;
}

.ap-file {
  padding: 8px 12px;
  color: var(--ap-ink-2);
  font-size: 1rem;
}

.ap-file::file-selector-button {
  min-height: 34px;
  margin-right: 12px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: var(--ap-key);
  box-shadow: var(--ap-key-shadow);
  color: var(--ap-ink);
  font: 800 0.75rem/1 var(--ap-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
}

/* A switch with its words beside it. */
.ap-switchrow {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  color: var(--ap-ink-2);
  font-size: 0.9375rem;
  cursor: pointer;
}

.ap-switchrow input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* A row of links or buttons where one is the current: the choice stays a choice, in
   the same wells as .ap-choice, but for links (a period, a view). */
.ap-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ap-seg__item {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 0;
  background: var(--ap-well);
  box-shadow: var(--ap-well-shadow);
  color: var(--ap-ink-2);
  font: 700 0.8125rem/1 var(--ap-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

.ap-seg__item:hover {
  color: var(--ap-ink);
}

.ap-seg__item[aria-current="true"],
.ap-seg__item[aria-selected="true"],
.ap-seg__item[aria-pressed="true"] {
  background: var(--ap-ink);
  box-shadow: none;
  color: var(--ap-bg);
}

/* ---- added for #92: figure tiles, meters, chart box ---- */
/* A figure with its label: the number in the figure role (800, tight), the label in
   the label role. */
.ap-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 12px;
}

.ap-stat {
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 0;
  background: var(--ap-well);
  box-shadow: var(--ap-well-shadow);
}

.ap-stat__value {
  font: 800 2rem/1 var(--ap-sans);
  letter-spacing: -0.04em;
}

.ap-stat__label {
  color: var(--ap-ink-2);
  font: 700 0.6875rem/1.3 var(--ap-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* A share as a bar in a well; the fill is bone, red stays the screen's one key. */
.ap-meter {
  display: block;
  width: 100%;
  min-width: 80px;
  height: 8px;
  overflow: hidden;
  border-radius: 0;
  background: var(--ap-well);
  box-shadow: var(--ap-well-shadow);
}

.ap-meter > span {
  display: block;
  height: 100%;
  border-radius: 0;
  background: var(--ap-ink);
}

/* The box a chart is drawn in: Chart.js needs a sized parent to follow the page width. */
.ap-chart {
  position: relative;
  width: 100%;
  height: 260px;
}

.ap-chart--pie {
  height: 280px;
}

/* ---- added for #89: long text (.ap-prose), for the legal pages ---- */
/* A readable column of running text: 40rem measure, h2 as a 700 title, links underlined,
   and .ap-prose__table for a table that turns into one card per row on a phone (each td
   carries data-label). Put it in .ap-page--prose (44rem, the table's width). */
.ap-page--prose {
  max-width: 44rem;
}

.ap-prose-lede {
  max-width: 40rem;
  margin: -8px 0 32px;
}

.ap-prose {
  color: var(--ap-ink-2);
  font-size: 1rem;
  line-height: 1.7;
}

.ap-prose > p,
.ap-prose > ul,
.ap-prose > ol {
  max-width: 40rem;
}

.ap-prose p,
.ap-prose ul,
.ap-prose ol {
  margin: 0 0 1em;
}

.ap-prose h2 {
  margin: 2.25em 0 0.6em;
  color: var(--ap-ink);
  font: 700 1.25rem/1.25 var(--ap-sans);
  letter-spacing: -0.005em;
  text-wrap: balance;
  scroll-margin-top: 16px;
}

.ap-prose h2:first-child {
  margin-top: 0;
}

.ap-prose strong {
  color: var(--ap-ink);
  font-weight: 700;
}

.ap-prose ul,
.ap-prose ol {
  padding-left: 1.25rem;
  list-style: revert;
}

.ap-prose li + li {
  margin-top: 0.4em;
}

.ap-prose a {
  color: var(--ap-ink);
  text-decoration: underline;
  text-decoration-color: var(--ap-underline);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.ap-prose a:hover {
  text-decoration-color: currentColor;
}

.ap-prose__table {
  margin: 14px 0 22px;
}

.ap-prose__table table {
  width: 100%;
  border-collapse: collapse;
}

.ap-prose__table th,
.ap-prose__table td {
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--ap-line);
  font-size: 0.9375rem;
  line-height: 1.55;
  text-align: left;
  vertical-align: top;
}

.ap-prose__table th {
  color: var(--ap-ink-2);
  font: 700 0.75rem/1.3 var(--ap-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.ap-prose__table td:first-child {
  color: var(--ap-ink);
}

@media (max-width: 47.9375rem) {
  .ap-prose__table thead {
    display: none;
  }

  .ap-prose__table tr {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--ap-line);
  }

  .ap-prose__table td {
    display: block;
    padding: 3px 0;
    border-bottom: 0;
  }

  .ap-prose__table td::before {
    content: attr(data-label);
    display: block;
    color: var(--ap-ink-3);
    font: 700 0.6875rem/1.3 var(--ap-sans);
    letter-spacing: 0.02em;
    text-transform: uppercase;
  }
}

/* ---- added for #93: staff mail pages (on top of the #90 and #92 pieces) ---- */
/* A page for wide tables of numbers: wider than --wide, still one column. */
.ap-page--full {
  max-width: 72rem;
}

/* An input and its key on one line, wrapping on a phone (a date and "Schedule"). */
.ap-keys .ap-input {
  flex: 1 1 14rem;
  width: auto;
}

/* .ap-seg links to the views of one page carry aria-current="page"; a count beside a
   label is quieter. */
.ap-seg__item[aria-current="page"] {
  background: var(--ap-ink);
  box-shadow: none;
  color: var(--ap-bg);
}

.ap-seg__count {
  margin-left: 8px;
  color: var(--ap-ink-3);
  font-weight: 500;
}

.ap-seg__item[aria-current="page"] .ap-seg__count {
  color: inherit;
  opacity: 0.7;
}

/* A line under a figure tile's value (a percentage, "4 definitive"). */
.ap-stat__sub {
  color: var(--ap-ink-2);
  font-size: 0.875rem;
  line-height: 1.35;
}

/* A link inside a table cell reads as one. */
.ap-table a {
  text-decoration: underline;
  text-decoration-color: var(--ap-underline);
  text-underline-offset: 3px;
}

/* Rows: a list of links on a plate, one per line, each with a line of detail. */
.ap-rows li + li {
  border-top: 1px solid var(--ap-line);
}

.ap-rows a,
.ap-rows__item {
  display: grid;
  gap: 2px;
  padding: 12px 0;
  text-decoration: none;
}

.ap-rows li:first-child > * {
  padding-top: 0;
}

.ap-rows li:last-child > * {
  padding-bottom: 0;
}

.ap-rows a:hover b {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ap-rows b {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.ap-rows small {
  color: var(--ap-ink-2);
  font-size: 0.875rem;
}

.ap-rows a[aria-current="page"] {
  color: var(--ap-ink);
  font-weight: 800;
}

/* Source text, as written (Markdown, the plain-text version of an email). */
.ap-pre {
  margin: 0;
  padding: 16px 18px;
  border-radius: 0;
  background: var(--ap-well);
  box-shadow: var(--ap-well-shadow);
  color: var(--ap-ink);
  font: 400 0.8125rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---- added for #85: check-in list (staff check-in, public event check-in) ---- */
/* A list of people to check in at the start, phone in one hand: a sticky filter, a
   bar per group in its own colour (sticky under the filter), rows with IN under the
   thumb on the right, the ones already in folded under the group, and a Compact view
   switch. Markup: main.ap-ci > .ap-ci-filter, .ap-ci-tools, section.ap-ci-group >
   h2.ap-ci-group__head--<tone> + .ap-plate.ap-ci-group__plate > ul.ap-ci-rows >
   li.ap-ci-row. From the design lab's check-in (schermate/checkin.css). */

.ap-ci [hidden] {
  display: none !important;
}

/* Long lists take 8px gutters on a phone: the room goes to the names. */
@media (max-width: 47.99rem) {
  .ap-page--list {
    padding-right: 8px;
    padding-left: 8px;
  }
}

.ap-ci-search > svg,
.ap-ci-search__clear svg,
.ap-ci-in svg,
.ap-ci-group__all svg,
.ap-ci-row__crown {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Only the filter stays at the top while the list scrolls, on the ground's colour so
   nothing shows through, and no shadow. */
.ap-ci-filter {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -16px;
  padding: 10px 16px;
  background: var(--ap-bg);
}

@media (max-width: 47.99rem) {
  .ap-page--list .ap-ci-filter {
    margin: 0 -8px;
    padding: 10px 8px;
  }
}

.ap-ci-tools {
  display: grid;
  gap: 10px;
  margin-bottom: 8px;
  padding-top: 2px;
}

/* A search field with its icon in the well, and a clear key on the right. */
.ap-ci-search {
  position: relative;
}

.ap-ci-search > svg {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 20px;
  height: 20px;
  color: var(--ap-ink-3);
  pointer-events: none;
}

.ap-ci-search .ap-input {
  padding-left: 46px;
}

.ap-ci-search:has(.ap-ci-search__clear) .ap-input {
  padding-right: 52px;
}

.ap-ci-search__clear {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ap-ink-2);
  cursor: pointer;
}

.ap-ci-search__clear svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.ap-ci-opts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ap-ci-shown {
  color: var(--ap-ink-2);
  font-size: 0.875rem;
}

.ap-ci-compact {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ap-ink-2);
  font-size: 0.9375rem;
  cursor: pointer;
}

/* A group: a bar in its own colour with its name, pace and how many of its people are
   in; it stays at the top, under the filter, while its group scrolls. */
.ap-ci-group {
  margin-top: 18px;
}

.ap-ci-group__head {
  position: sticky;
  top: var(--ap-ci-filter-h, 72px);
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 8px;
  padding: 10px 14px;
  border-radius: 0;
  background: var(--ap-ci-tone, var(--ap-key-hover));
  color: var(--ap-ci-tone-ink, #fff);
  font: 800 0.8125rem/1.3 var(--ap-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.ap-ci-group__head--black { --ap-ci-tone: #000; box-shadow: inset 0 0 0 1px #444444; }
.ap-ci-group__head--red { --ap-ci-tone: #E8312A; --ap-ci-tone-ink: #0A0A0A; }
.ap-ci-group__head--magenta { --ap-ci-tone: #D4119C; }
.ap-ci-group__head--orange { --ap-ci-tone: #FF8A1F; --ap-ci-tone-ink: #1A0B02; }
.ap-ci-group__head--blue { --ap-ci-tone: #1F63FF; }
.ap-ci-group__head--white { --ap-ci-tone: #FFF; --ap-ci-tone-ink: #0A0A0A; }
.ap-ci-group__head--others { --ap-ci-tone: var(--ap-key-hover); --ap-ci-tone-ink: var(--ap-ink); }

.ap-ci-group__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ap-ci-group__pace,
.ap-ci-group__count {
  flex: none;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  opacity: 0.85;
}

.ap-ci-group__count {
  margin-left: auto;
}

.ap-ci-group__plate {
  padding: 2px 12px;
}

.ap-ci-rows {
  display: grid;
}

/* A person: picture, name with crown, check-ins and Manual; IN on the right. */
.ap-ci-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 68px;
  padding: 10px 0;
  border-top: 1px solid var(--ap-line);
}

.ap-ci-row--nopic {
  grid-template-columns: minmax(0, 1fr) auto;
}

.ap-ci-rows > .ap-ci-row:first-child {
  border-top: 0;
}

.ap-ci-row.is-collapsing {
  overflow: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  .ap-ci-row.is-collapsing {
    transition: max-height 0.6s ease, opacity 0.5s ease, padding 0.6s ease;
  }

  /* A check-in made on this phone flashes its row once (checkin.html, flashRow): a red
     wash out to the plate's edges, gone in 600ms. No rule on the left edge: never a
     side bar (Stefano, 18/11/2026). */
  .ap-ci-row.is-flash {
    animation: ap-ci-flash 600ms ease-out;
  }
}

.ap-ci-row {
  --ap-ci-bleed: 12px;
}

@media (min-width: 48rem) {
  .ap-ci-row {
    --ap-ci-bleed: 20px;
  }
}

@keyframes ap-ci-flash {
  from {
    background-color: rgba(244, 64, 30, 0.22);
    box-shadow:
      calc(-1 * var(--ap-ci-bleed)) 0 0 rgba(244, 64, 30, 0.22),
      var(--ap-ci-bleed) 0 0 rgba(244, 64, 30, 0.22);
  }
}

.ap-ci-row__pic {
  display: block;
  width: 40px;
  height: 40px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background: var(--ap-well);
  object-fit: cover;
}

.ap-ci-row__pic img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

button.ap-ci-row__pic {
  cursor: zoom-in;
}

.ap-ci-row__pic--initials {
  display: grid;
  place-items: center;
  box-shadow: var(--ap-well-shadow);
  color: var(--ap-ink-2);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.ap-ci-row__who {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ap-ci-row__name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.25;
}

.ap-ci-row__text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ap-ci-row__crown {
  align-self: center;
  width: 17px;
  height: 17px;
  color: #E9C46A;
}

.ap-ci-row__count {
  color: var(--ap-ink-2);
  font-size: 0.875rem;
}

.ap-ci-row__manual {
  padding: 2px 7px;
  border-radius: 0;
  background: var(--ap-well);
  box-shadow: var(--ap-well-shadow);
  color: var(--ap-ink-2);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ap-ci-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 10px;
  min-width: 0;
  color: var(--ap-ink-2);
  font-size: 0.875rem;
}

.ap-ci-row__meta > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ap-ci-row__meta a {
  color: var(--ap-ink-2);
}

.ap-ci-row.is-inactive {
  opacity: 0.5;
}

.ap-ci-row__inactive {
  color: var(--ap-ink-3);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* IN: a big square grey key under the thumb. In: a bone key with a tick. Waiting: a
   ring closing in 3 seconds, and Undo. The ring is the screen's only red. */
.ap-ci-in {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 72px;
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 0;
  background: var(--ap-key);
  box-shadow: var(--ap-key-shadow);
  color: var(--ap-ink);
  font: 800 0.875rem/1 var(--ap-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
}

.ap-ci-in:disabled {
  cursor: default;
  opacity: 0.6;
}

.ap-ci-in svg {
  width: 18px;
  height: 18px;
}

.ap-ci-in.is-in {
  background: var(--ap-ink);
  box-shadow: none;
  color: var(--ap-bg);
}

.ap-ci-in.is-in svg {
  stroke-width: 2.4;
}

.ap-ci-in.is-pending {
  background: var(--ap-well);
  box-shadow: var(--ap-well-shadow), inset 0 0 0 1.5px var(--ap-accent);
  color: var(--ap-accent);
}

/* The ring closes in the 3 seconds before the check-in is saved (where the browser
   can animate a registered custom property; elsewhere it stands at two thirds). */
@property --ap-ci-ring {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 66%;
}

.ap-ci-in__ring {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: conic-gradient(var(--ap-accent) 0 var(--ap-ci-ring, 66%), rgba(244, 64, 30, 0.2) 0);
  -webkit-mask: radial-gradient(circle, transparent 5px, #000 5.5px);
  mask: radial-gradient(circle, transparent 5px, #000 5.5px);
}

@media (prefers-reduced-motion: no-preference) {
  .ap-ci-in.is-pending .ap-ci-in__ring {
    animation: ap-ci-ring 3s linear forwards;
  }
}

@keyframes ap-ci-ring {
  from { --ap-ci-ring: 0%; }
  to { --ap-ci-ring: 100%; }
}

.ap-ci-row.is-pending .ap-ci-row__name::after {
  content: "Saving…";
  color: var(--ap-accent);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.ap-ci-group__all {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  color: var(--ap-ink-2);
}

.ap-ci-group__all svg {
  width: 18px;
  height: 18px;
}

/* Who is already in, folded under the group. */
.ap-ci-done {
  border-top: 1px solid var(--ap-line);
}

.ap-ci-done summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  color: var(--ap-ink-2);
  font: 700 0.75rem/1 var(--ap-sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  list-style: none;
  cursor: pointer;
}

.ap-ci-done summary::-webkit-details-marker {
  display: none;
}

.ap-ci-done summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin: -3px 0 0 auto;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg);
}

.ap-ci-done[open] summary::after {
  margin-top: 4px;
  transform: rotate(-135deg);
}

.ap-ci-done summary .ap-fig {
  color: var(--ap-ink);
  font-size: 0.875rem;
  letter-spacing: 0;
}

.ap-ci-done .ap-ci-row:first-child {
  border-top: 1px solid var(--ap-line);
}

.ap-ci-empty {
  margin-top: 24px;
  color: var(--ap-ink-2);
  text-align: center;
}

/* Compact view: a list to scan fast. No photos, 44px rows, name and count on one line,
   a short IN, tighter groups. 44px stays the floor: the row is the thumb's target. On
   while the switch inside .ap-ci-compact is checked. */
.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-group {
  margin-top: 12px;
}

.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-group__head {
  margin-bottom: 6px;
  padding: 8px 12px;
  font-size: 0.75rem;
}

.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-group__plate {
  padding: 0 12px;
  border-radius: 0;
}

.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-row {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  min-height: 44px;
  padding: 2px 0;
}

.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-row__pic {
  display: none;
}

.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-row__who {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-row__name {
  flex-wrap: nowrap;
  min-width: 0;
  overflow: hidden;
  font-size: 0.9375rem;
  white-space: nowrap;
}

.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-row__text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-row__crown {
  flex: none;
  width: 14px;
  height: 14px;
}

.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-row__manual {
  padding: 1px 5px;
  font-size: 0.625rem;
}

/* The name keeps its room; long sizes give way first. */
.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-row__meta {
  display: block;
  flex: 0 100 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-row__meta > * + * {
  margin-left: 8px;
}

.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-row__name {
  flex: 0 0 auto;
  max-width: 75%;
}

.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-in {
  gap: 6px;
  min-width: 60px;
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.75rem;
}

.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-in svg {
  width: 14px;
  height: 14px;
}

.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-in__ring {
  width: 14px;
  height: 14px;
  -webkit-mask: radial-gradient(circle, transparent 4px, #000 4.5px);
  mask: radial-gradient(circle, transparent 4px, #000 4.5px);
}

.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-row.is-pending .ap-ci-row__name::after {
  display: none;
}

.ap-ci:has(.ap-ci-compact input:checked) .ap-ci-done summary {
  min-height: 40px;
  font-size: 0.6875rem;
}

@media (min-width: 48rem) {
  .ap-ci-group__plate {
    padding: 4px 20px;
  }
}

/* A photo opened full size from a row: an .ap-dialog holding the image. */
.ap-photo img {
  display: block;
  width: 100%;
  max-height: 70dvh;
  border-radius: 0;
  object-fit: contain;
}

/* ---- Odometer (18/11/2026): a figure whose digits roll up into place on load
   (odometer.js, data-odo). Each digit is a column the width of its own digit (the
   sizer, kept in the flow for width and baseline) with a strip of digits that slides
   up. clip-path, not overflow, cuts the strip above and below: overflow would move the
   column's baseline and clip the wider digits passing through a narrow column. The
   home's countdown on the ticket uses the same columns (home.js, .hm-ticket__count). */
.ap-odo__face {
  white-space: nowrap;
  user-select: none;
}

.ap-odo__col {
  position: relative;
  display: inline-block;
  clip-path: inset(0 -0.25em);
}

.ap-odo__sizer {
  visibility: hidden;
}

.ap-odo__strip {
  position: absolute;
  top: 0;
  right: -0.25em;
  left: -0.25em;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(0);
  transition: transform 1.9s cubic-bezier(0.16, 0.84, 0.2, 1);
  will-change: transform;
}

.ap-odo__strip > span {
  display: block;
}

/* ---------------------------------------------------------------------------
   Motion (Stefano, 18/11/2026). What moves by itself; the sheets' slide is with the
   sheets, the keys' press with the keys, the cards' rise in home.css. Script:
   site/js/motion.js. All of it off with Reduce Motion. */

@media (prefers-reduced-motion: no-preference) {
  /* Messages rise in from the bottom edge; they slide back down when they go. */
  .ap-messages .ap-note {
    animation: ap-note-in 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }

  .ap-messages .ap-note + .ap-note {
    animation-delay: 80ms;
  }

  .ap-messages .ap-note.is-leaving {
    animation: ap-note-out 320ms cubic-bezier(0.4, 0, 1, 1) forwards;
  }
}

@keyframes ap-note-in {
  from { opacity: 0; translate: 0 calc(100% + 24px); }
}

@keyframes ap-note-out {
  to { opacity: 0; translate: 0 calc(100% + 24px); }
}
