/* ============================================================================
   Travel Ops — components. Every repeated shape in the app, once.
   ============================================================================
   Depends on tokens.css and nothing else. A screen stylesheet may position
   these; it may not restyle them. If a screen needs a variant, the variant
   belongs here with a name, because the second screen that wants it will
   otherwise invent a slightly different one.                                 */

/* ---------------------------------------------------------------- buttons */
.btn {
  --btn-bg: var(--surface-card);
  --btn-fg: var(--text);
  --btn-line: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-3);
  min-height: var(--tap);
  padding: 0 var(--space-5);
  border: 1px solid var(--btn-line);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: 600 var(--text-base)/1 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-sunken); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5; cursor: not-allowed; transform: none;
}

.btn.primary {
  --btn-bg: var(--primary-bg); --btn-fg: var(--primary-fg); --btn-line: var(--primary-bg);
}
.btn.primary:hover { filter: brightness(1.15); }
.btn.danger {
  --btn-bg: var(--red-bg); --btn-fg: var(--red-fg); --btn-line: var(--red-line);
}
.btn.danger:hover { --btn-bg: var(--red-line); }
/* "quiet" is the secondary button; "ghost" has no box until you touch it. */
.btn.quiet { --btn-bg: transparent; --btn-line: var(--border); }
.btn.ghost { --btn-bg: transparent; --btn-line: transparent; font-weight: 500; }
.btn.ghost:hover { --btn-bg: var(--surface-sunken); }
.btn.sm { min-height: 34px; padding: 0 var(--space-4); font-size: var(--text-md); }
.btn.lg { min-height: 52px; padding: 0 var(--space-6); font-size: var(--text-lg); }
.btn.block { display: flex; width: 100%; }

/* A button that looks like a link, for destructive-but-minor actions inside
   forms. It is still a <button>, because a link that changes data is a lie. */
.linkish {
  background: none; border: 0; padding: 0; color: var(--brand);
  font: inherit; cursor: pointer; text-decoration: underline;
  min-height: var(--tap);
}

/* ------------------------------------------------------------------ inputs */
.field { display: block; margin-bottom: var(--space-5); }
label { display: block; font-size: var(--text-md); font-weight: 600; margin-bottom: var(--space-2); }
/* A label for something that is not a form control — the card-name preview
   sits under one, and a <label> with no `for` is a label pointing at nothing. */
.label { display: block; font-size: var(--text-md); font-weight: 600; margin-bottom: var(--space-2); }

input:not([type]),
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=tel], input[type=url], input[type=number], input[type=date],
input[type=time], input[type=datetime-local], input[type=month], select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-card);
  color: var(--text);
  /* 16px exactly: anything smaller and iOS zooms the page on focus. */
  font: var(--text-base)/1.4 var(--font);
  -webkit-appearance: none;
  appearance: none;
}
textarea { min-height: 96px; resize: vertical; }
select {
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: var(--space-7);
}
/* A placeholder is a hint, never data. Colour alone did not carry that: an
   uppercase "AI" in the carrier box read as a carrier code that was already
   there, and the owner's report of a flight that would not save began with
   exactly that kind of doubt. Italic as well as lighter, so the difference
   survives a bright screen and a monochrome one. */
input::placeholder, textarea::placeholder {
  color: var(--text-subtle);
  font-style: italic;
  opacity: 0.85;
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-sunken); color: var(--text-subtle); cursor: not-allowed;
}
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--red-fg);
}
/* The error sits under the field it belongs to, not in a list at the top —
   a person fixing a form should not have to hold a list in their head. */
/* The message for one field, under the box it belongs to. `.fielderror` was
   the name in the design system and no template ever used it; this is the same
   rule under the name the forms actually carry. */
.fieldproblem {
  display: block;
  color: var(--red-fg); font-size: var(--text-md); margin-top: var(--space-2);
}
.fieldhint { color: var(--text-subtle); font-size: var(--text-md); margin: var(--space-2) 0 0; }

.chk, .radio {
  display: flex; gap: var(--space-3); align-items: flex-start;
  min-height: var(--tap); padding: var(--space-2) 0;
  font-weight: 400; cursor: pointer;
}
.chk input, .radio input { width: 20px; height: 20px; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--primary-bg); }

/* ------------------------------------------------------------------- cards */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.ok-card { background: var(--green-bg); border-color: var(--green-line); color: var(--green-fg); }
.card.error-card { background: var(--red-bg); border-color: var(--red-line); color: var(--red-fg); }
.card.warn { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber-fg); }
/* A plain button on a coloured card needs the card's own surface to read
   against — but :not(.primary), or the primary button loses its accent
   background and keeps its white text, which is white on white. That is what
   hid "Email statements to everyone overdue" and the duplicate-client
   "Open <name>" button entirely. */
.card.warn .btn:not(.primary),
.card.error-card .btn:not(.primary),
.card.ok-card .btn:not(.primary) { background: var(--surface-card); }

.cardhead {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4);
}

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 2px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 600;
  text-transform: capitalize; white-space: nowrap;
}
.badge-grey  { background: var(--grey-bg);  color: var(--grey-fg); }
.badge-blue  { background: var(--blue-bg);  color: var(--blue-fg); }
.badge-green { background: var(--green-bg); color: var(--green-fg); }
.badge-amber { background: var(--amber-bg); color: var(--amber-fg); }
.badge-red   { background: var(--red-bg);   color: var(--red-fg); }

.tag {
  display: inline-block; background: var(--grey-bg); color: var(--grey-fg);
  border-radius: var(--radius-full); padding: 1px var(--space-3);
  font-size: var(--text-xs); white-space: nowrap;
}
.tag.live { background: var(--green-bg); color: var(--green-fg); font-weight: 700; }
.tag.off { background: var(--red-bg); color: var(--red-fg); }

/* -------------------------------------------------------------------- tabs */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: 0 0 var(--space-4); }
/* 40px, and 44 on a touch screen. A filter chip is a secondary control and a
   dense row of 44px pills on a desktop reads as a toolbar rather than a
   filter — but a finger does not care what it reads as. */
.chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 40px; padding: 0 var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius-full);
  background: var(--surface-card); color: var(--text);
  font-size: var(--text-md); text-decoration: none; cursor: pointer;
}
.chip:hover { border-color: var(--border-strong); }
.chip.on { background: var(--primary-bg); color: var(--primary-fg); border-color: var(--primary-bg); }
.chip b { font-weight: 700; opacity: 0.75; }
.chip:disabled { opacity: 0.45; cursor: not-allowed; }
@media (pointer: coarse) {
  .chip { min-height: var(--tap); }
}

.subtabs {
  display: flex; gap: var(--space-2); overflow-x: auto; margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border); scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtab {
  flex: 0 0 auto; padding: var(--space-3) var(--space-4);
  color: var(--text-muted); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent; text-transform: capitalize;
  min-height: var(--tap); display: inline-flex; align-items: center;
}
.subtab.on { color: var(--text); border-bottom-color: var(--primary-bg); font-weight: 600; }

/* ------------------------------------------------------------------ tables */
.scroller { overflow-x: auto; -webkit-overflow-scrolling: touch; min-width: 0; max-width: 100%;
  /* The containing block for anything absolutely positioned inside — a
     visually-hidden header label escaped a scrolled table and widened the
     whole page to 750px at 375 (rate sheets, batch 1). */
  position: relative; }
.priced { display: grid; gap: var(--space-4); margin-top: var(--space-4); }
table.data { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
table.data th, table.data td {
  text-align: left; padding: var(--space-3); border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data th { color: var(--text-subtle); font-weight: 600; white-space: nowrap; }
table.data td.right, table.data th.right { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.warnrow { background: var(--amber-bg); }

/* --------------------------------------------------------------- empty state */
.empty {
  background: var(--surface-card); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg); padding: var(--space-7) var(--space-5);
  text-align: center; color: var(--text-muted);
}
.empty p { margin: 0 0 var(--space-5); }

/* ------------------------------------------------------------------ toasts */
.toasts {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--space-5));
  z-index: 60; display: grid; gap: var(--space-3); width: min(92vw, 460px);
  pointer-events: none;
}
@media (min-width: 860px) { .toasts { bottom: var(--space-6); } }
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: var(--space-3);
  background: var(--surface-inverse); color: var(--text-on-inverse);
  padding: var(--space-4) var(--space-5); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: var(--text-md);
  animation: toast-in var(--base) var(--ease);
}
.toast.ok { background: var(--green-fg); color: #fff; }
.toast.bad { background: var(--red-fg); color: #fff; }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; font-size: var(--text-lg); line-height: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* -------------------------------------------------------- sheets and modals
   A sheet comes up from the bottom on a phone and sits centred on a desktop.
   It is for CONFIRMING and CHOOSING. Data entry stays on the page or on its own
   screen (UI_SPEC §1), because a form in a box you can dismiss is a form people
   lose work in. */
dialog.sheet {
  border: 0; padding: 0; background: transparent;
  width: 100%; max-width: 100%; max-height: 100%;
  margin: auto auto 0; /* bottom on phone */
}
dialog.sheet::backdrop { background: rgb(15 23 42 / 0.45); }
.sheetbody {
  background: var(--surface-card); color: var(--text);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-5) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  animation: sheet-up var(--base) var(--ease);
}
.sheetgrab {
  width: 36px; height: 4px; border-radius: var(--radius-full);
  background: var(--border-strong); margin: 0 auto var(--space-4);
}
.sheetactions { display: grid; gap: var(--space-3); margin-top: var(--space-5); }
@keyframes sheet-up { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 720px) {
  dialog.sheet { max-width: 460px; margin: auto; }
  .sheetbody { border-radius: var(--radius-lg); animation-name: toast-in; }
  .sheetgrab { display: none; }
  .sheetactions { grid-auto-flow: column; justify-content: end; }
}

/* ------------------------------------------------------- skeleton loaders
   Shown while something is fetched, shaped like the thing that is coming, so
   the page does not jump when it arrives. */
.skeleton {
  background: linear-gradient(90deg, var(--surface-sunken) 25%, var(--border) 37%, var(--surface-sunken) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
  color: transparent !important;
}
.skeleton-line { height: 12px; margin: var(--space-3) 0; }
.skeleton-line.short { width: 40%; }
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* ------------------------------------------------------------------- focus
   Visible, on everything, in one place. A keyboard user has to be able to see
   where they are without hunting. */
:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------------------------------------------------------------- utilities */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* Shown only to a keyboard: the first thing tab reaches on every page. */
.skiplink {
  position: absolute; left: var(--space-4); top: -60px; z-index: 100;
  min-height: var(--tap); display: inline-flex; align-items: center;
  background: var(--surface-card); color: var(--text);
  padding: var(--space-3) var(--space-5); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); transition: top var(--fast) var(--ease);
}
.skiplink:focus { top: var(--space-4); }

.icon { width: 20px; height: 20px; flex: 0 0 auto; display: inline-block; vertical-align: -4px; }
.icon-sm { width: 16px; height: 16px; vertical-align: -3px; }
.icon-lg { width: 24px; height: 24px; vertical-align: -5px; }

/* ------------------------------------------------------------ suggestions
   The autocomplete list. It is positioned by the field it belongs to, so the
   field's wrapper is what establishes the containing block — the list must not
   escape a card and float over the page. */
.form .field, label + input, label + textarea { position: relative; }
.suggestions {
  list-style: none; margin: 2px 0 0; padding: var(--space-2);
  position: absolute; z-index: 40; left: 0; right: 0;
  background: var(--surface-card); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-height: 280px; overflow-y: auto;
}
.suggestion {
  display: grid; gap: 1px; padding: var(--space-3);
  border-radius: var(--radius-sm); cursor: pointer; min-height: var(--tap);
}
.suggestion:hover, .suggestion.on { background: var(--brand-soft); }
.sglabel { font-weight: 600; }
.sgdetail { font-size: var(--text-md); color: var(--text-subtle); }
/* A field the paste filled is marked, so "check them" has something to look at. */
input.filled, textarea.filled { border-color: var(--green-fg); background: var(--green-bg); }

/* A <summary> IS a control — it opens and closes the thing under it — so it
   takes the same minimum as a button. Today's section headers and the
   bookings filter disclosure were all 33px, which is a miss on a phone and
   the kind of target that gets pressed twice.

   Applied at the element rather than per component, because every future
   <details> gets it too; the ones that are deliberately inline (the user
   menu, Mark paid) opt out below. */
summary { cursor: pointer; }
details > summary {
  min-height: var(--tap);
  display: flex; align-items: center; gap: var(--space-2);
  /* `display: flex` removes the browser's own disclosure triangle, and a
     summary with no marker reads as a heading — people do not press it. The
     chevron is drawn back, on the right where it does not fight the text, and
     it turns when the section opens so the state is visible without reading. */
  list-style: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::after {
  content: ""; margin-left: auto; flex: none;
  width: 8px; height: 8px; border: 2px solid currentColor;
  border-left: 0; border-top: 0; opacity: 0.55;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--fast) var(--ease);
}
details[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
/* The three that are a line of text inside a row, not a section header: a
   44px box around them would push the row apart for no gain, and they carry
   their own affordance already. */
.usermenu > summary, .markpaid > summary, .retleg > summary { min-height: 0; }
.usermenu > summary::after, .markpaid > summary::after { content: none; }

/* A field whose value is always written in capitals — a PNR, an airport code,
   a GSTIN. It was `style="text-transform:uppercase"` on fifteen inputs, which
   is the one-off this design system exists to remove. The transform is
   DISPLAY only: the value posts exactly as typed and the server upper-cases
   what it stores, so nothing depends on the stylesheet being loaded. */
input.upper, textarea.upper { text-transform: uppercase; }
/* ...but not the hint inside it. `text-transform` applies to the placeholder
   too, so "e.g. AI" was rendering as "E.G. AI" — shouting, and looking more
   like a value than ever. The rule is about what someone TYPES. */
input.upper::placeholder, textarea.upper::placeholder { text-transform: none; }

/* ------------------------------------------------------------- problems
   A rejected form says three things: how many problems there are, where each
   one is, and what is wrong with this box. The summary is the first, the link
   is the second, the message beside the field is the third — and the field
   itself is marked so the eye finds it without reading anything. */
.card.problems ul { margin: var(--space-3) 0 0; padding-left: var(--space-5); }
.card.problems li + li { margin-top: var(--space-2); }
.card.problems a { color: inherit; text-decoration: underline; }
/* It is focused on arrival so a screen reader announces the count; the ring
   is what makes that visible to everyone else. */
.card.problems:focus-visible { outline: 3px solid var(--red-fg); outline-offset: 2px; }

/* Never colour alone: the border thickens and the message sits beside it, so
   the mark survives a monochrome screen and colour blindness both. */
input.invalid, select.invalid, textarea.invalid, fieldset.invalid {
  border-color: var(--red-fg);
  border-width: 2px;
  background: var(--red-bg);
}
fieldset.invalid { background: transparent; }

/* The browser's own `[hidden] { display: none }` is the weakest rule there is:
   any class that sets `display` beats it. So `button.hidden = true` on a
   `.btn` (display: inline-flex) hid nothing — "Fix to match" sat under an
   empty schedule on every new booking, and the same trap applies to every
   Remove button the row code hides. One rule, once, rather than a `.btn[hidden]`
   for each component that will ever set the attribute. */
[hidden] { display: none !important; }

/* Two forms side by side on a wide screen, stacked on a phone. Not `.two`:
   that one is `.form .two`, i.e. a grid INSIDE a form, and a wrapper holding
   two forms matches nothing. */
.splitforms { display: grid; grid-template-columns: 1fr; gap: var(--space-4); }
@media (min-width: 760px) { .splitforms { grid-template-columns: 1fr 1fr; gap: var(--space-6); } }

/* ------------------------------------------------------------- the capture card
   Two columns on a desktop: what arrived on the left, what it would do on the
   right. One column on a phone, ORIGINAL SECOND — on 375px the proposal is what
   is being decided, and making someone scroll past a PDF to reach the Approve
   button is how a queue stops getting cleared. */
.capture .capturehead { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); }
.capture .capturehead h2 { margin: 0; }
.capture .matchline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: var(--space-3) 0; }
.capture .matchline.weak { color: var(--amber-fg); }
.capture .capturebody { display: grid; grid-template-columns: 1fr; gap: var(--space-5); margin-top: var(--space-4); }
.capture .original { order: 2; min-width: 0; }
.capture .proposal { order: 1; min-width: 0; }
@media (min-width: 900px) {
  .capture .capturebody { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .capture .original { order: 1; }
  .capture .proposal { order: 2; }
}
.capture h3 { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: .04em; color: var(--text-subtle); }
.capture .original img,
.capture .original object { width: 100%; max-height: 420px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-sunken); }
.capture .rawtext { white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto;
  font-size: 12px; background: var(--surface-sunken); padding: 10px; border-radius: 8px; }
.capture .actionline { font-weight: 600; }
.capture table.changes { width: 100%; }
.capture table.changes td { vertical-align: top; }
.capture table.changes input { width: 100%; }
.capture tr.check td:first-child { border-left: 3px solid var(--amber-fg); padding-left: 8px; }
.capture input.flagged { border-color: var(--amber-fg); background: var(--amber-bg); }
.capture .pax li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.capture .warnings li { color: var(--amber-fg); }
.capture .rejectform { display: flex; gap: 8px; margin-top: var(--space-4); }
.capture .rejectform input { flex: 1 1 auto; min-width: 0; }
.btn.big { padding: 12px 20px; font-size: var(--text-md); }

/* On a phone the queue comes FIRST. The numbers and the upload box are useful
   on a desktop where they cost nothing; on 375px they are 1,300px of scrolling
   in front of the thing somebody opened the screen to do. Same page, same
   markup, different order. */
@media (max-width: 899px) {
  .capturescreen { display: flex; flex-direction: column; }
  .capturequeue { order: 1; }
  .capturetools { order: 2; }
}

/* The wait between two legs of one ticket, shown between them rather than as a
   number somebody has to work out from two clocks in different countries. */
.layover { margin: 4px 0 4px 12px; padding-left: 10px; border-left: 2px dashed var(--border-strong);
  color: var(--text-subtle); font-size: var(--text-sm); }

/* A leg of a transport line. The legend carries its number and the way to
   remove it, pushed apart so "Leg 1 remove" does not read as one phrase. */
.segrow { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 0 0 var(--space-4); }
.segrow > legend { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4);
  width: 100%; padding: 0 4px; font-weight: 600; }
.segments > [data-add] { margin-top: 4px; }

/* ------------------------------------------------- the message gallery
   Every template, rendered and checked. Two columns on a desktop: what it
   looks like, and what it says plus what the checks found. */
.mailcard .mailbody { display: grid; grid-template-columns: 1fr; gap: var(--space-5); margin-top: var(--space-4); }
@media (min-width: 900px) { .mailcard .mailbody { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.mailcard h3 { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: .04em; color: var(--text-subtle); }
.mailpreview.tall { width: 100%; height: 460px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.mailcard .preview { max-height: 300px; overflow: auto; white-space: pre-wrap; font-size: 12px;
  background: var(--surface-sunken); padding: 10px; border-radius: 8px; }
.score { font-weight: 700; font-size: var(--text-lg); }
.score.ok { color: var(--green-fg); }
.score.bad { color: var(--amber-fg); }
.checks li { padding-left: 22px; position: relative; }
.checks li::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.checks li.pass::before { content: '✓'; color: var(--green-fg); }
.checks li.warn::before { content: '!'; color: var(--amber-fg); }
.checks li.fail::before { content: '✗'; color: var(--red-fg); }
.checks li span { display: block; }
code.wrap { word-break: break-all; }

/* Two-step sign-in: the QR, the one-time recovery codes, and the code box. */
.qrwrap { background: #fff; display: inline-block; padding: 8px; border: 1px solid var(--border); border-radius: 10px; }
.qrwrap svg { display: block; width: 200px; height: 200px; }
ul.codes { list-style: none; padding: 0; margin: var(--space-4) 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
ul.codes code { font-size: var(--text-md); letter-spacing: .06em; }
input.bigcode { font-size: 22px; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; }

/* Which agency you are in, when you work in more than one.

   The colour is the agency's own, set in Settings, and it is the whole point:
   two brands that look identical are two brands somebody will mix up. The
   strip sits above the top bar so it is in the same place on every screen and
   survives scrolling to the top. */
.agencystrip {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--agency-colour, #334155);
  /* Black or white, whichever can be read on the colour the owner chose. */
  color: var(--agency-ink, #fff);
  font-size: var(--text-md);
  /* A dark agency colour and white text is the normal case; the border keeps
     a pale one from vanishing into the page behind it. */
  border-bottom: 1px solid rgb(0 0 0 / 0.25);
}
.agencynow { font-weight: 600; letter-spacing: 0.01em; }
.agencyswitch { display: flex; align-items: center; gap: var(--space-2); margin: 0; }
.agencyswitch select {
  min-height: 32px; padding: 2px var(--space-3);
  background: rgb(127 127 127 / 0.18); color: var(--agency-ink, #fff);
  border: 1px solid currentColor; border-radius: var(--radius-sm);
  font: inherit;
}
/* The closed select inherits white-on-colour; the OPEN list is drawn by the
   operating system against its own background, so its options need a colour
   that works there instead. */
.agencyswitch select option { color: var(--text); background: var(--surface); }
.agencyswitch select:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }

@media (max-width: 640px) {
  /* The role in brackets is the first thing to go: on a phone the name is
     what identifies the agency and the rest is detail. */
  .agencystrip { padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }
  .agencyswitch select { max-width: 48vw; }
}

/* The group screen. Every figure is a button that switches agency, so it has
   to read as a figure and behave as a control: `.linkish` already does that
   (a link that changes data is a lie), and the form around it must not add a
   line break between the number and the row it is in. */
.figform { display: inline; margin: 0; }
.figform .linkish { min-height: var(--tap); font-variant-numeric: tabular-nums; }

/* Which agency a column belongs to, in its own colour — the same colour as
   the strip you land on after clicking into it. */
.agencydot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--agency-colour, #334155); margin-right: var(--space-2);
  vertical-align: baseline;
}
.agencyboth {
  color: var(--agency-ink, #fff); text-decoration: underline; font-size: var(--text-sm);
  padding: 0 var(--space-2); min-height: var(--tap);
  display: inline-flex; align-items: center;
}

/* Client intake review (/intake/:id). The "who is this" choices are whole
   rows to tap, and a differing field's keep/take pair stacks on a phone. */
.intakepick { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-2) 0;
  min-height: var(--tap); font-weight: 400; }
.intakepick input { margin-top: 4px; width: 20px; height: 20px; flex-shrink: 0; }
.intakechoice { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); }
.intakechoice label { display: flex; gap: var(--space-2); align-items: center; min-height: var(--tap); font-weight: 400; white-space: nowrap; }
.intakechoice input { width: 20px; height: 20px; }
/* ------------------------------------------------------ lead capture (0034)
   One collapsible box per form and per rule on Settings → Lead capture: seven
   rules and a few forms open at once is a page nobody can find anything on. */
.leadbox { border: 1px solid var(--border); border-radius: 10px; padding: 0 var(--space-4); margin: var(--space-3) 0; min-width: 0; }
.leadbox > summary { cursor: pointer; min-height: var(--tap); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.leadbox[open] { padding-bottom: var(--space-4); }
.codefield { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--text-sm); word-break: break-all; }
