/* public/css/app.css */
/* The shell, the components and the screens. */
/* The token values live in tokens.css. */

/* --- the plate font --- */
@font-face {
  font-family: "PlateNL";
  src: url("/fonts/plate.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0030-0039, U+0041-005A, U+002D;
}

/* --- base --- */
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font: var(--fw-regular) var(--fs-300)/var(--lh-base) var(--font-ui);
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

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

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
img, svg { display: block; }
button { font: inherit; color: inherit; }
/* the display rules above beat the UA rule. restore the hidden attribute. */
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- the shell --- */
.shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
}
/* a wide child must not stretch the grid past the viewport */
.shell > * { min-width: 0; }

.appbar {
  position: sticky;
  top: 0;
  z-index: var(--z-appbar);
  height: calc(var(--h-appbar) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  padding-inline: max(var(--sp-4), env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: color-mix(in srgb, var(--c-navy) 92%, transparent);
  color: var(--c-on-brand);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--c-navy-dark);
}

.appbar__title {
  font: var(--fw-bold) var(--fs-400)/var(--lh-tight) var(--font-ui);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.appbar__title--center { text-align: center; }

/* every control in the app bar sits on the navy fill */
.appbar .iconbtn { color: var(--c-on-brand); }
.appbar .iconbtn:active { background: rgba(255, 255, 255, .16); }

.appbar__mark {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
  text-decoration: none;
}

.appbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  margin-left: auto;
}

.content {
  width: min(100%, var(--w-content));
  margin-inline: auto;
  padding: var(--sp-4);
  padding-bottom: var(--sp-10);
}

.tabbar,
.actionbar {
  position: sticky;
  bottom: 0;
  z-index: var(--z-action);
  padding-bottom: env(safe-area-inset-bottom);
  padding-inline: max(var(--sp-3), env(safe-area-inset-left));
  background: color-mix(in srgb, var(--c-surface) 92%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-top: 1px solid var(--c-line-soft);
}

/* --- the tab bar --- */
.tabbar {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  min-height: var(--h-tabbar);
}

.tabbar__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 56px;
  min-height: 56px;
  padding: var(--sp-1) var(--sp-2);
  color: var(--c-text-3);
  text-decoration: none;
  font: var(--fw-medium) var(--fs-100)/1.2 var(--font-ui);
}
.tabbar__item svg { width: 24px; height: 24px; }
.tabbar__item[aria-current="page"] { color: var(--c-navy-light); }

.tabbar__badge {
  position: absolute;
  top: 4px;
  left: calc(50% + 6px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-full);
  background: var(--c-ignition);
  color: var(--c-on-brand);
  font: var(--fw-bold) 11px/18px var(--font-ui);
  text-align: center;
}

/* --- the action bar --- */
.actionbar {
  display: flex;
  align-items: center;
  min-height: var(--h-action);
  padding-block: var(--sp-2);
  box-shadow: var(--sh-3);
}
/* the action content stays inside the content width. the background stays
   across the whole available application width. */
.actionbar__content {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  max-width: var(--w-content);
  margin-inline: auto;
}
.actionbar .btn--primary,
.actionbar .btn--send { flex: 1; min-height: 52px; }

.actionbar__price {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  min-height: 52px;
  padding: 0 var(--sp-4);
  border: 0;
  border-radius: var(--r-md);
  background: var(--c-sunken);
  color: var(--c-text);
  font: var(--fw-black) var(--fs-400)/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  white-space: nowrap;
}

/* --- the icon button --- */
.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-min);
  height: var(--tap-min);
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--c-text);
  cursor: pointer;
  text-decoration: none;
}
.iconbtn svg { width: 24px; height: 24px; }
.iconbtn:active { background: var(--c-sunken); }

/* --- the plate --- */
.plate {
  display: inline-flex;
  align-items: stretch;
  height: 36px;
  border: 2px solid var(--c-ink-hi);
  border-radius: var(--r-sm);
  background: var(--c-plate);
  overflow: hidden;
  user-select: all;          /* the owner can copy the kenteken */
}
.plate__band {
  display: grid;
  place-items: end center;
  width: 16px;
  padding-bottom: 3px;
  background: var(--c-plate-band);
  color: var(--c-on-brand);
  font: var(--fw-bold) 9px/1 var(--font-ui);
  letter-spacing: 0.02em;
}
.plate__code {
  display: grid;
  place-items: center;
  padding-inline: var(--sp-2);
  color: var(--c-ink-hi);
  font: var(--fw-bold) 20px/1 var(--font-plate);
  letter-spacing: var(--ls-plate);
  text-transform: uppercase;
  white-space: nowrap;
}
.plate--sm { height: 28px; }
.plate--sm .plate__code { font-size: 16px; }
.plate--lg { height: 48px; border-width: 3px; }
.plate--lg .plate__code { font-size: 28px; padding-inline: var(--sp-3); }
.plate__code--empty { color: var(--c-text-3); }

/* --- the status pill --- */
.pill {
  display: inline-block;
  padding: 3px var(--sp-2);
  border-radius: var(--r-full);
  font: var(--fw-bold) var(--fs-100)/1.4 var(--font-ui);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
}
.pill--new  { background: var(--c-new-bg);   color: var(--c-new-ink); }
.pill--ready{ background: var(--c-ready-bg); color: var(--c-ready-ink); }
.pill--sent { background: var(--c-sent-bg);  color: var(--c-sent-ink); }
.pill--done { background: var(--c-done-bg);  color: var(--c-done-ink); }

/* --- the lead card --- */
.card {
  position: relative;
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-4);
  padding-left: calc(var(--sp-4) + 3px);
  margin-bottom: var(--sp-3);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  box-shadow: var(--sh-1);
  transition: transform var(--dur-1) var(--ease-out),
              background-color var(--dur-1) var(--ease-out);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: var(--r-lg) 0 0 var(--r-lg);
  background: var(--card-accent, transparent);
}
.card[data-status="new"]        { --card-accent: var(--c-new); }
.card[data-status="ready"]      { --card-accent: var(--c-ready); }
.card[data-status="offer_sent"] { --card-accent: var(--c-sent); }
.card[data-status="completed"]  { --card-accent: var(--c-done); }
.card:active { transform: scale(.985); background: var(--c-sunken); }

.card__link {
  display: grid;
  gap: var(--sp-2);
  text-decoration: none;
}
/* the stretched link makes the whole card the tap target */
.card__link::after {
  content: "";
  position: absolute;
  inset: 0;
}
.card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}
.card__meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}
.card__age {
  color: var(--c-text-3);
  font-size: var(--fs-200);
  white-space: nowrap;
}
.card__name {
  font: var(--fw-bold) var(--fs-400)/var(--lh-snug) var(--font-ui);
  overflow-wrap: anywhere;
}
.card__sub {
  color: var(--c-text-3);
  font-size: var(--fs-200);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* the inline action sits above the stretched link */
.card__action {
  position: relative;
  z-index: 1;
  min-height: 48px;
}
.card--enter { animation: card-in var(--dur-2) var(--ease-out); }
@keyframes card-in { from { opacity: 0; } to { opacity: 1; } }

/* --- the button --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap-min);
  padding: 0 var(--sp-5);
  border: 0;
  border-radius: var(--r-md);
  font: var(--fw-bold) var(--fs-300)/1 var(--font-ui);
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--dur-1) var(--ease-out),
              background-color var(--dur-1) var(--ease-out);
}
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--c-ignition); color: var(--c-on-brand); }
.btn--primary:active { background: var(--c-ignition-press); }
.btn--send    { background: var(--c-whatsapp); color: var(--c-on-brand); }
.btn--send:active { background: var(--c-whatsapp-press); }
.btn--quiet   { background: transparent; color: var(--c-text);
                box-shadow: inset 0 0 0 1px var(--c-line); }
.btn--ghost   { background: transparent; color: var(--c-text-2); }
.btn--danger  { background: transparent; color: var(--c-danger);
                box-shadow: inset 0 0 0 1px var(--c-danger); }
.btn--block   { width: 100%; }
.btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn[data-loading="true"]  { pointer-events: none; }

.btn__spinner {
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: var(--r-full);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }

/* --- the filter chips --- */
.chips {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding: var(--sp-1) 0 var(--sp-3);
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  min-height: 44px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-full);
  background: var(--c-surface);
  color: var(--c-text-2);
  box-shadow: inset 0 0 0 1px var(--c-line);
  font: var(--fw-medium) var(--fs-200)/1 var(--font-ui);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  border: 0;
}
.chip[aria-pressed="true"] {
  background: var(--c-text);
  color: var(--c-surface);
  box-shadow: none;
}
.chip__count {
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
}

/* --- the sheet --- */
.sheet {
  width: 100%;
  max-width: var(--w-content);
  max-height: 85dvh;
  margin: auto auto 0;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom);
  border: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: var(--sh-3);
  display: flex;
  flex-direction: column;
}
/* a closed dialog stays hidden */
.sheet:not([open]) { display: none; }
.sheet::backdrop { background: var(--c-scrim); }
.sheet[open] { animation: sheet-in var(--dur-3) var(--ease-out); }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
.sheet__grabber {
  width: 36px; height: 4px; margin: var(--sp-3) auto;
  border-radius: var(--r-full); background: var(--c-line);
  flex: none;
}
.sheet__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-4);
  flex: none;
}
.sheet__title {
  flex: 1;
  font: var(--fw-bold) var(--fs-400)/var(--lh-tight) var(--font-ui);
}
.sheet__subtitle {
  padding: var(--sp-1) var(--sp-4) var(--sp-3);
  color: var(--c-text-3);
  font: var(--fw-regular) var(--fs-200)/var(--lh-snug) var(--font-mono);
  flex: none;
  overflow-wrap: anywhere;
}
.sheet__body {
  overflow-y: auto;
  min-height: 0;
}
.sheet__foot {
  padding: var(--sp-3) var(--sp-4);
  display: grid;
  gap: var(--sp-2);
  flex: none;
}

/* one engine row in the picker */
.engine {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: 60px;
  padding: var(--sp-2) var(--sp-4);
  border: 0;
  border-top: 1px solid var(--c-line-soft);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.engine:active { background: var(--c-sunken); }
.engine__radio {
  flex: none;
  width: 22px; height: 22px;
  border: 2px solid var(--c-line);
  border-radius: var(--r-full);
}
/* the badge marks the best match. the filled radio marks the choice of the
   owner. the two are not the same, because a weak match preselects nothing. */
.engine--selected .engine__radio {
  border-color: var(--c-ignition);
  background: radial-gradient(circle, var(--c-ignition) 0 6px, transparent 7px);
}
/* the sheet says why it cannot preselect a row */
.sheet__hint {
  padding: var(--sp-2) var(--sp-4);
  color: var(--c-text-3);
  font-size: var(--fs-200);
}
.engine__main { flex: 1; min-width: 0; }
.engine__name {
  font: var(--fw-medium) var(--fs-300)/var(--lh-snug) var(--font-ui);
}
.engine__sub {
  color: var(--c-text-3);
  font-size: var(--fs-200);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.engine__tag {
  flex: none;
  padding: 3px var(--sp-2);
  border-radius: var(--r-full);
  background: var(--c-ignition);
  color: var(--c-ink-hi);
  font: var(--fw-bold) var(--fs-100)/1.4 var(--font-ui);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
}

/* --- the error and the empty block inside the sheet --- */
.sheet__state {
  padding: var(--sp-6) var(--sp-4);
  display: grid;
  gap: var(--sp-3);
  justify-items: start;
}
.sheet__error {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--c-danger-bg);
  color: var(--c-danger);
  font-size: var(--fs-200);
}

/* --- the skeleton --- */
.skel {
  background: var(--c-sunken);
  border-radius: var(--r-sm);
  animation: skel-pulse 1.2s var(--ease-standard) infinite;
}
@keyframes skel-pulse { 0%,100% { opacity: 1 } 50% { opacity: .55 } }
.skel-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 60px;
  padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--c-line-soft);
}
.skel-row .skel { height: 18px; }
.skel__dot { width: 22px; flex: none; }
.skel__line { width: 55%; }
.skel__line--short { width: 35%; }

/* --- the price stepper --- */
.stepper { display: flex; align-items: center; gap: var(--sp-3); justify-content: center; }
.stepper__btn {
  flex: none;
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  background: var(--c-sunken); color: var(--c-text);
  border: 0; font-size: 22px; font-weight: var(--fw-bold);
  cursor: pointer;
}
.stepper__btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.stepper__value {
  flex: 1;
  min-width: 120px; min-height: 48px; text-align: center;
  font: var(--fw-black) var(--fs-600)/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  background: transparent; border: 0; color: var(--c-text);
}
.stepper__presets {
  display: flex;
  justify-content: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.preset {
  min-height: 44px;
  padding: 0 var(--sp-4);
  border: 0;
  border-radius: var(--r-full);
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: inset 0 0 0 1px var(--c-line);
  font: var(--fw-bold) var(--fs-300)/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.preset[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--c-ignition); }

/* --- the power delta strip --- */
.delta {
  display: grid;
  gap: var(--sp-1);
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  box-shadow: var(--sh-1);
}
.delta__row {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  font-variant-numeric: tabular-nums;
}
.delta__pre, .delta__post, .delta__gain { white-space: nowrap; }
.delta__pre {
  font: var(--fw-bold) var(--fs-400)/var(--lh-tight) var(--font-ui);
}
.delta__arrow { color: var(--c-text-3); font-size: var(--fs-500); }
.delta__post {
  font: var(--fw-black) var(--fs-400)/var(--lh-tight) var(--font-ui);
  color: var(--c-ignition);
}
/* the number is the value. it gets 36 px. the unit stays small. */
.delta__num { font-size: var(--fs-700); }
.delta__gain {
  margin-left: auto;
  font: var(--fw-black) var(--fs-500)/var(--lh-tight) var(--font-ui);
  color: var(--c-ignition);
}
.delta__pre--unknown { color: var(--c-text-3); }

/* --- the quote preview card --- */
.quote {
  border-radius: var(--r-lg);
  background: var(--c-surface);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
.quote__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--c-line-soft);
}
.quote__label {
  font: var(--fw-bold) var(--fs-100)/1.4 var(--font-ui);
  letter-spacing: var(--ls-caps);
  color: var(--c-text-3);
}
.quote__body {
  max-height: 40dvh;
  overflow-y: auto;
  padding: var(--sp-4);
}
.quote__text {
  margin: 0;
  font: var(--fw-regular) var(--fs-300)/var(--lh-base) var(--font-ui);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* --- the toast --- */
.toast {
  position: fixed;
  left: var(--sp-4);
  right: var(--sp-4);
  bottom: calc(var(--h-action) + var(--sp-3) + env(safe-area-inset-bottom));
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  max-width: var(--w-content);
  margin-inline: auto;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--c-text);
  color: var(--c-surface);
  font-size: var(--fs-300);
  box-shadow: var(--sh-2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--dur-2) var(--ease-out),
              transform var(--dur-2) var(--ease-out);
  pointer-events: none;
}
.toast--show { opacity: 1; transform: none; pointer-events: auto; }
.toast--error { background: var(--c-danger); color: #FFFFFF; }
.toast__action {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: inherit;
  font: var(--fw-bold) var(--fs-300)/1 var(--font-ui);
  text-decoration: underline;
  cursor: pointer;
  min-height: 44px;
  padding: 0 var(--sp-2);
}

/* --- the empty state --- */
.empty {
  display: grid;
  gap: var(--sp-2);
  justify-items: start;
  padding: var(--sp-8) var(--sp-4);
}
.empty__title { font: var(--fw-bold) var(--fs-400)/var(--lh-snug) var(--font-ui); }
.empty__help { color: var(--c-text-2); }
.empty .btn { margin-top: var(--sp-2); }

/* --- the pull-to-refresh indicator --- */
.ptr {
  position: fixed;
  top: calc(var(--h-appbar) + env(safe-area-inset-top) + var(--sp-2));
  left: 50%;
  z-index: var(--z-appbar);
  width: 28px; height: 28px;
  margin-left: -14px;
  border: 3px solid var(--c-line);
  border-top-color: var(--c-ignition);
  border-radius: var(--r-full);
  opacity: 0;
  pointer-events: none;
}
.ptr--spin { animation: spin .7s linear infinite; opacity: 1; }

/* --- the overflow menu --- */
.menu { position: relative; }
.menu__summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-min);
  height: var(--tap-min);
  border-radius: var(--r-md);
  cursor: pointer;
}
.menu__summary::-webkit-details-marker { display: none; }
.menu__summary:active { background: var(--c-sunken); }
.menu__list {
  position: absolute;
  top: calc(100% + var(--sp-1));
  right: 0;
  z-index: var(--z-scrim);
  min-width: 220px;
  padding: var(--sp-1);
  border-radius: var(--r-md);
  background: var(--c-surface);
  box-shadow: var(--sh-2);
}
.menu__item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 0 var(--sp-4);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  font: var(--fw-medium) var(--fs-300)/1 var(--font-ui);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu__item:active { background: var(--c-sunken); }
.menu__item--danger { color: var(--c-danger); }

/* --- the text field --- */
.field { display: grid; gap: var(--sp-1); margin-bottom: var(--sp-4); }
.field__label { font: var(--fw-medium) var(--fs-200)/1.4 var(--font-ui); color: var(--c-text-2); }
.field__input,
.field__select,
.field__textarea {
  width: 100%;
  min-height: 48px;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-surface);
  color: var(--c-text);
  font: var(--fw-regular) var(--fs-300)/var(--lh-base) var(--font-ui);
}
.field__textarea { min-height: 96px; resize: vertical; }
.field__input[aria-invalid="true"] { border-color: var(--c-danger); }
.field__error { color: var(--c-danger); font-size: var(--fs-200); }

/* --- the section label --- */
.section {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-6) 0 var(--sp-3);
  color: var(--c-text-3);
  font: var(--fw-bold) var(--fs-100)/1.4 var(--font-ui);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
}
.section::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--c-line-soft);
}
.section:first-child { margin-top: 0; }

/* --- the login screen --- */
.login {
  display: grid;
  align-content: center;
  gap: var(--sp-6);
  min-height: calc(100dvh - var(--sp-4) - var(--sp-10));
}
.login__brand { display: grid; justify-items: center; gap: var(--sp-3); }
/* the name holds the client logo, so the text style is not needed */
.login__name {
  font-size: 0;
  line-height: 0;
}
.login__error {
  display: none;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--c-danger-bg);
  color: var(--c-danger);
  font-size: var(--fs-200);
}
.login__error--show { display: block; }

/* --- the detail screen blocks --- */
.detail__top {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.detail__name { font: var(--fw-bold) var(--fs-500)/var(--lh-tight) var(--font-ui); overflow-wrap: anywhere; }
.detail__line {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--c-text-2);
  overflow-wrap: anywhere;
}
.detail__line a { color: inherit; }
/* the phone link is a tap target */
.detail__line a[href^="tel:"] {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
}
.setrow__help a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
}
.kv { color: var(--c-text-3); font-size: var(--fs-200); }
.mono { font-family: var(--font-mono); font-size: var(--fs-200); overflow-wrap: anywhere; }
.text-3 { color: var(--c-text-3); }

/* --- the branch card --- */
.branchcard {
  display: grid;
  gap: var(--sp-1);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  box-shadow: var(--sh-1);
}
.branchcard__name { font: var(--fw-bold) var(--fs-400)/var(--lh-snug) var(--font-ui); }
.branchcard__notes { color: var(--c-text-2); font-size: var(--fs-200); white-space: pre-line; }
.branchcard__actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-2); }

/* --- the segmented control --- */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--r-full);
  background: var(--c-sunken);
}
.segmented__btn {
  min-height: 44px;
  padding: 0 var(--sp-4);
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--c-text-2);
  font: var(--fw-medium) var(--fs-200)/1 var(--font-ui);
  cursor: pointer;
}
.segmented__btn[aria-pressed="true"] {
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: var(--sh-1);
}

/* --- the settings rows --- */
.setrow { display: grid; gap: var(--sp-1); padding: var(--sp-3) 0; }
.setrow__title { font: var(--fw-medium) var(--fs-300)/var(--lh-snug) var(--font-ui); }
.setrow__help { color: var(--c-text-2); font-size: var(--fs-200); }
.setrow__status { color: var(--c-text-3); font-size: var(--fs-200); }
.setrow .btn, .setrow .segmented { margin-top: var(--sp-2); justify-self: start; }

/* --- the fallback link under the send button --- */
.wafallback {
  display: none;
  margin-top: var(--sp-3);
  text-align: center;
}
.wafallback--show { display: block; }

/* --- the client logo ---
   the logo file is a JPG with a white box. it sits on a white chip, so it
   looks correct in the light theme and in the dark theme. */
.brandmark {
  display: inline-flex;
  align-items: center;
  padding: var(--sp-2);
  border-radius: var(--r-md);
  background: #FFFFFF;
}
.brandmark img {
  display: block;
  height: 28px;
  width: auto;
}

/* the rail brand is hidden on a phone. the desktop breakpoint shows it. */
.tabbar__brand { display: none; }

/* --- the desktop breakpoint --- */
@media (min-width: 900px) {
  .shell {
    grid-template-columns: var(--w-rail) 1fr;
    grid-template-areas:
      "rail appbar"
      "rail content"
      "rail action";
  }
  .appbar { grid-area: appbar; }
  .content { grid-area: content; width: min(100%, var(--w-content)); }
  .actionbar { grid-area: action; }
  .tabbar {
    grid-area: rail;
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--w-rail);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: var(--sp-1);
    padding-top: calc(var(--sp-4) + env(safe-area-inset-top));
    border-right: 1px solid var(--c-line-soft);
    border-top: 0;
  }
  .tabbar__item {
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--sp-3);
    padding: 0 var(--sp-4);
    font-size: var(--fs-200);
  }
  .tabbar__badge { position: static; margin-left: auto; }

  /* the rail carries the client logo at the top */
  .tabbar__brand {
    display: flex;
    align-items: center;
    padding: 0 var(--sp-4);
    margin-bottom: var(--sp-4);
  }
  .tabbar__brand .brandmark img { height: 32px; }

  /* the branch notes become a second column on the task screens */
  .withaside {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: var(--sp-6);
    align-items: start;
  }
  .btn:hover { filter: brightness(1.04); }
  .iconbtn:hover, .menu__item:hover, .engine:hover { background: var(--c-sunken); }
}

/* --- the update bar --- */
/* app.js removes the hidden attribute when a new service worker waits */
.updatebar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  background: var(--c-ready-bg);
  color: var(--c-text);
  font-size: var(--fs-200);
}
.updatebar[hidden] { display: none; }
.updatebar .btn { min-height: 36px; padding: 0 var(--sp-3); }

/* --- the enable-notifications card on the inbox --- */
.pushcard {
  background: var(--c-surface);
  border: 1px solid var(--c-line-soft);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  display: grid;
  gap: var(--sp-2);
}
.pushcard__title { font: var(--fw-medium) var(--fs-300)/var(--lh-snug) var(--font-ui); }
.pushcard__body { color: var(--c-text-2); font-size: var(--fs-200); }
.pushcard__actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-1); }

/* --- the info card on the settings screen --- */
/* the blocked state and the iOS install state use this card */
.pushinfo {
  background: var(--c-sunken);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  margin-top: var(--sp-2);
  display: grid;
  gap: var(--sp-1);
}
.pushinfo__title { font-weight: var(--fw-bold); font-size: var(--fs-200); }
.pushinfo__line { color: var(--c-text-2); font-size: var(--fs-200); }

/* --- the device list on the settings screen --- */
.devlist { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: grid; gap: var(--sp-2); }
.dev {
  background: var(--c-surface);
  border: 1px solid var(--c-line-soft);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  display: grid;
  gap: var(--sp-1);
}
.dev--empty { color: var(--c-text-2); font-size: var(--fs-200); }
.dev__row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.dev__label { font: var(--fw-medium) var(--fs-300)/var(--lh-snug) var(--font-ui); }
.dev__btn { min-height: 36px; padding: 0 var(--sp-2); justify-self: start; }
.dev__switch {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-200);
  color: var(--c-text-2);
}
.dev__switch input { width: 20px; height: 20px; accent-color: var(--c-navy-light); }
.dev__meta { color: var(--c-text-3); font-size: var(--fs-200); }
