/* Home components (DS piece): every component in docs/DESIGN.md section 3, her CSS snapped to the tokens.
   Values are hers unless a comment says [derived] (DESIGN tags). No raw px except 2 to 4 px borders and rings, outlines,
   shadows and keyframe offsets (tests/test_grid_tokens.py). Hairlines (her 1 px borders) are box-shadow rings, so a
   card's 1 px edge never moves its children off the 4 px grid.

   Class index (a piece may not define these names; it builds its own screens from them):
     buttons   .btn .btn--solid .btn--ghost .btn--danger .btn--lg .btn--back .btn--next .btn--hero .btn--block
               .btn--lock .btn--lock-white .btn--lock-glass .btn--emergency .btn--dark-back .link .link--sm .link--danger
               .icon-btn .tile-btn (.tile-btn--dashed .tile-btn--brand)
     forms     .field .field-row .field__label .field__hint .field__error .input .input--check .select .select--pill
               .search .search__icon .search__input
     cards     .card .card--tint .card--lg .card__head .card__title .card__sub .card-grid .kv .kv__label .kv__value
               .kv--link .row-item .row-item--tint .row-item--line .row-item__main .row-item__title .row-item__sub
     chips     .chip .chip--ok .chip--warn .chip--alert .chip--brand .chip--person .chip--tint .banner .banner--warn
               .banner--alert .banner--brand .pill .pill--warn .offline-badge
     choosers  .seg .tabs .rtabs .rtab .rtab--dashed .navlist .navlist__item .navlist--settings
     overlays  .scrim .panel .panel--wide .panel__head .panel__body .panel__foot .panel__foot--split .dialog .dialog__title
               .dialog__text .dialog__actions .toast-host .toast .toast__action .toast__timer
     people    .avatar (.avatar--xl --lg --sm --xs --ring-bg --ring-tint) .avatar-row .swatches .swatch .swatch__mark .dot
               .kid-tile .kid-tiles
     pin pad   .pin-pad .pin-prompt .pin-dots .pin-dot .pin-dots--shake .pin-help .keypad .key .key--blank
     empty     .feature .feature__chip .feature__title .feature__sub .add-tile .empty .empty__title .empty__text
               .empty__picks .swatch-tile .photo-box .photo-box__caption .scan-hit .icon
   Also states: aria-pressed / aria-selected / aria-current / aria-disabled / aria-invalid / .is-active / .is-filled. */

/* ---------- icons (js/core/icons.js builds the svg; size comes from its width/height attributes) ---------- */
.icon { display: block; flex-shrink: 0; }

/* ---------- buttons and links (3.5) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: top; gap: var(--sp-2);
  min-height: var(--h-44); padding: 0 var(--sp-4); border-radius: var(--r-lg);
  background: var(--surface); color: var(--brand); box-shadow: var(--ring-brand);
  font-family: var(--font); font-size: var(--fs-15); line-height: var(--lh-20); font-weight: var(--fw-bold);
  text-align: center; text-decoration: none; cursor: pointer;
}
.btn--solid  { background: var(--brand); color: var(--white); box-shadow: none; }
.btn--danger { background: var(--alert); color: var(--white); box-shadow: none; }       /* [derived] delete confirmation */
.btn--ghost  { color: var(--ink); box-shadow: var(--ring-2); font-weight: var(--fw-heavy); }   /* "Retake photo" */
.btn--lg     { min-height: var(--h-52); padding: 0 var(--sp-6); font-size: var(--fs-16); line-height: var(--lh-24); font-weight: var(--fw-heavy); }
.btn--back   { color: var(--ink); box-shadow: var(--ring-2); }
.btn--next   { background: var(--brand); color: var(--white); box-shadow: none; }
.btn--hero   { min-height: var(--h-60); padding: 0 var(--sp-8); border-radius: var(--r-pill); background: var(--brand);
               color: var(--white); box-shadow: none; font-size: var(--fs-19); line-height: var(--lh-24); font-weight: var(--fw-heavy); }
.btn--block  { display: flex; width: 100%; }
.btn--lock   { min-height: var(--h-60); padding: 0 var(--sp-6); gap: var(--sp-3); border-radius: var(--r-pill); box-shadow: none;
               font-size: var(--fs-18); line-height: var(--lh-24); font-weight: var(--fw-heavy); }
.btn--lock-white { background: var(--white); color: var(--ink); }
.btn--lock-glass { background: var(--glass-16); color: var(--white); }
.btn--emergency  { min-height: var(--h-52); padding: 0 var(--sp-6); gap: var(--sp-3); border-radius: var(--r-pill);
                   background: var(--alert-tint); color: var(--alert); box-shadow: none;
                   font-size: var(--fs-16); line-height: var(--lh-24); font-weight: var(--fw-heavy); }
.btn--dark-back  { padding: 0 var(--sp-4); border-radius: var(--r-pill); background: var(--glass-12); color: var(--white);
                   box-shadow: none; font-size: var(--fs-16); line-height: var(--lh-24); font-weight: var(--fw-heavy); }

/* A text link or text button that is still a 44 px target (5.3): "Resend", "Add a project", "+ Add", Undo. */
.link {
  display: inline-flex; align-items: center; vertical-align: top; gap: var(--sp-1); min-height: var(--h-44);
  padding: 0 var(--sp-1); color: var(--brand); text-decoration: none; cursor: pointer;
  font-size: var(--fs-15); line-height: var(--lh-20); font-weight: var(--fw-heavy);
}
.link--sm     { font-size: var(--fs-14); font-weight: var(--fw-bold); }      /* card links: "View on floor plan" */
.link--danger { color: var(--alert); }                                       /* "Remove from family", "Delete" in a form footer */

.icon-btn {                                                                  /* panel close */
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: var(--h-44); height: var(--h-44); border-radius: var(--r-round); background: var(--bg); color: var(--ink);
}

/* Photo tiles at the bottom of a form: "Add photo of the can" (dashed), "Scan the label instead" (tinted) */
.tile-btn {
  display: flex; flex: 1 1 0; align-items: center; justify-content: center; gap: var(--sp-2); min-width: 0;
  min-height: var(--h-52); padding: 0 var(--sp-4); border: 2px solid transparent; border-radius: var(--r-lg); background: transparent; color: var(--ink);   /* both tiles carry a 2 px border so they split the row equally */
  font-size: var(--fs-15); line-height: var(--lh-20); font-weight: var(--fw-heavy); text-align: center;
}
.tile-btn--dashed { border-style: dashed; border-color: var(--line); }
.tile-btn--brand  { background: var(--brand-tint); color: var(--brand); }

.btn:active, .link:active, .icon-btn:active, .tile-btn:active, .key:active { filter: brightness(0.94); }      /* [derived] pressed */
.btn:disabled, .btn[aria-disabled="true"], .tile-btn[aria-disabled="true"], .tile-btn:disabled,
.link[aria-disabled="true"], .icon-btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }          /* [derived] */
@media (hover: hover) {
  .btn:hover { background: var(--brand-tint); }
  .btn--solid:hover, .btn--next:hover, .btn--hero:hover { background: var(--brand-hover); }
  .btn--danger:hover { filter: brightness(0.92); }
  .btn--ghost:hover, .btn--back:hover { background: var(--bg); }
  .btn--lock-white:hover { background: var(--lock-muted); }
  .btn--lock-glass:hover, .btn--dark-back:hover { background: var(--glass-24); }
  .btn--emergency:hover { filter: brightness(0.96); }
  .link:hover { color: var(--brand-hover); }
  .link--danger:hover { filter: brightness(0.85); }
  .icon-btn:hover { background: var(--line); }
  .tile-btn--brand:hover { filter: brightness(0.97); }
  .btn[aria-disabled="true"]:hover, .btn:disabled:hover { background: var(--surface); }
}

/* ---------- inputs (3.6) ---------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.field-row { display: flex; gap: var(--sp-4); }                       /* two fields side by side (her gap 12, 16 here: in the 520 panel two fields are then 228 wide, on the grid) */
.field-row > .field { flex: 1 1 0; }
.field__label { font-size: var(--fs-15); line-height: var(--lh-20); font-weight: var(--fw-heavy); color: var(--ink); }
.field__hint  { font-size: var(--fs-13); line-height: var(--lh-16); color: var(--muted); }
.field__error { font-size: var(--fs-13); line-height: var(--lh-16); font-weight: var(--fw-bold); color: var(--alert); }  /* [derived] */
@media (max-width: 767.98px) {
  .field-row { flex-direction: column; }                               /* phone: fields stack (4.2) */
}

.input {
  display: block; width: 100%; min-height: var(--h-48); padding: 0 var(--sp-4); border: 0; border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink); box-shadow: var(--ring);
  font-family: var(--font); font-size: var(--fs-16); line-height: var(--lh-24);
  -webkit-appearance: none; appearance: none;
}
textarea.input { min-height: var(--h-96); padding: var(--sp-3) var(--sp-4); resize: vertical; }
.input--check { box-shadow: var(--ring-warn); }                         /* scan field marked "Please check" */
.input[aria-invalid="true"] { box-shadow: var(--ring-alert); }          /* [derived] */
.input:disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }
.input[readonly] { background: var(--bg); }

/* A <select> with her chevron: <span class="select"><select class="input">..</select></span> (the arrow is a mask, no hex) */
.select { position: relative; display: block; min-width: 0; }
.select > select { padding-right: var(--sp-12); text-overflow: ellipsis; }
.select::after {
  content: ""; position: absolute; right: var(--sp-4); top: 0; bottom: 0; margin-block: auto;
  width: var(--h-12); height: var(--h-12); background: var(--muted); pointer-events: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 9l7 7 7-7' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 9l7 7 7-7' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.select--pill { display: inline-block; }                                /* the "Living room" pill in the scan banner */
.select--pill > select {
  min-height: var(--h-44); padding: 0 var(--sp-12) 0 var(--sp-3); border-radius: var(--r-md); box-shadow: none;
  font-size: var(--fs-15); line-height: var(--lh-20); font-weight: var(--fw-heavy); width: auto;
}
.select--pill::after { right: var(--sp-3); background: var(--ink); }

.search {
  display: flex; flex-grow: 1; align-items: center; gap: var(--sp-3); min-height: var(--h-48); padding: 0 var(--sp-4);
  border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--ring); min-width: 0; cursor: text;
}
.search__icon { color: var(--muted); }
.search__input {
  flex-grow: 1; min-width: 0; padding: 0; border: 0; outline: none; background: transparent; color: var(--ink);
  font-family: var(--font); font-size: var(--fs-16); line-height: var(--lh-24);
  -webkit-appearance: none; appearance: none;
}
.search__input:focus-visible { outline: none; }
.search:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }   /* her input has outline:none, so the wrapper shows it */

/* ---------- cards (3.4) ---------- */
.card {
  display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; padding: var(--sp-4) var(--sp-6);
  border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--ring);
}
.card--tint { background: var(--m-tint, var(--warn-tint)); box-shadow: none; }      /* House "Paint" card; inside .p-cN it takes the person's tint */
.card--lg   { padding: var(--sp-6); border-radius: var(--r-2xl); }                 /* setup form card, Settings sections */
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.card__title { font-size: var(--fs-20); line-height: var(--lh-28); font-weight: var(--fw-heavy); }
.card__sub   { font-size: var(--fs-15); line-height: var(--lh-20); color: var(--muted); }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gutter); align-items: start; }
@media (max-width: 767.98px) {
  .card-grid { grid-template-columns: minmax(0, 1fr); }                             /* phone: one column, gap 16 */
}

.kv { display: flex; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) 0; box-shadow: var(--ring-top); }
.kv__label { min-width: 0; font-size: var(--fs-14); line-height: var(--lh-20); font-weight: var(--fw-semibold); color: var(--muted); }
.kv__value { min-width: 0; font-size: var(--fs-15); line-height: var(--lh-20); font-weight: var(--fw-bold); text-align: right; overflow-wrap: anywhere; }  /* long values wrap */
.kv--link  { align-items: flex-start; min-height: var(--h-44); padding: var(--sp-3) 0; color: var(--ink); text-decoration: none; cursor: pointer; }   /* search result row: 12 + 20 + 12 = a 44 px target (a 24 px chip makes it 48) */

.row-item {                                                                  /* member row, event row, Settings row */
  display: flex; align-items: center; gap: var(--sp-3); min-width: 0; padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg); background: var(--surface);
}
.row-item--tint { background: var(--m-tint, var(--bg)); }
.row-item--line { gap: var(--sp-4); padding: var(--sp-3) 0; border-radius: 0; background: transparent; box-shadow: var(--ring-top); }
.row-item__main  { flex: 1 1 0; min-width: 0; }
.row-item__title { font-size: var(--fs-16); line-height: var(--lh-24); font-weight: var(--fw-heavy); }
.row-item__sub   { font-size: var(--fs-13); line-height: var(--lh-20); color: var(--muted); }   /* 24 + 20 = 44: the same height as the avatar beside it */
.row-item--line > .btn, .row-item--line > .link { min-height: var(--h-48); }                  /* centred in the 48 px row */
.row-item--line .row-item__title { font-size: var(--fs-17); line-height: var(--lh-28); }    /* 28 + 20 = 48: the 48 px avatar's height */
.row-item--line .row-item__sub   { font-size: var(--fs-14); line-height: var(--lh-20); }

/* ---------- chips, banner, pill, offline badge (3.7, 3.2, 3.14) ---------- */
.chip {
  display: inline-flex; align-items: center; vertical-align: top; gap: var(--sp-1); flex-shrink: 0;
  height: var(--h-24); padding: 0 var(--sp-2); border-radius: var(--r-md); white-space: nowrap;
  background: var(--bg); color: var(--muted);
  font-size: var(--fs-12); line-height: var(--lh-16); font-weight: var(--fw-heavy);
}
.chip--ok     { background: var(--ok-tint); color: var(--ok); }                   /* "Found" */
.chip--warn   { background: var(--warn-tint); color: var(--warn); }               /* "Please check" */
.chip--alert  { background: var(--alert-tint); color: var(--alert); }             /* "Emergency access" */
.chip--brand  { background: var(--brand-tint); color: var(--brand); }
.chip--person { background: var(--m-tint, var(--bg)); color: var(--m-accent, var(--ink)); }
.chip--tint   { background: var(--t-bg, var(--bg)); color: var(--t-fg, var(--ink)); }

.banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-lg);
  background: var(--ok-tint); color: var(--ink);
  font-size: var(--fs-15); line-height: var(--lh-20); font-weight: var(--fw-heavy);
}
.banner--warn  { background: var(--warn-tint); }
.banner--alert { background: var(--alert-tint); }
.banner--brand { background: var(--brand-tint); }

.pill {                                                                      /* top-bar pill, "[Temp] · [Conditions]" style */
  display: inline-flex; align-items: center; vertical-align: top; gap: var(--sp-2); min-height: var(--h-44); padding: 0 var(--sp-4);
  border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--ring);
  font-size: var(--fs-16); line-height: var(--lh-24); font-weight: var(--fw-bold);
}
.pill--warn { background: var(--warn-tint); color: var(--warn); box-shadow: none; }
.offline-badge {
  display: inline-flex; align-items: center; vertical-align: top; gap: var(--sp-2); min-height: var(--h-44); padding: 0 var(--sp-4);
  border-radius: var(--r-pill); background: var(--warn-tint); color: var(--warn);
  font-size: var(--fs-16); line-height: var(--lh-24); font-weight: var(--fw-bold);
}
@media (max-width: 767.98px) {
  .offline-badge { min-height: var(--h-32); padding: 0 var(--sp-3); font-size: var(--fs-14); line-height: var(--lh-20); }  /* phone: 32 high, right of the date */
}

/* ---------- segmented control, section tabs, record tabs, nav lists (3.7) ---------- */
/* The trough's ring is 1 px and its padding 4 (her 1 + 3), so the trough is 4 + 44 + 4 = 52 high like hers. */
.seg, .tabs {
  display: inline-flex; flex-wrap: wrap; align-self: flex-start; padding: var(--sp-1); border-radius: var(--r-pill);
  background: var(--bg); box-shadow: var(--ring);
}
.tabs { background: var(--surface); }
.seg > button, .tabs > a, .tabs > button {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--h-44); padding: 0 var(--sp-4);
  border-radius: var(--r-pill); background: transparent; color: var(--ink); text-decoration: none; cursor: pointer;
  font-family: var(--font); font-size: var(--fs-14); line-height: var(--lh-20); font-weight: var(--fw-heavy);
}
.tabs > a, .tabs > button { font-size: var(--fs-15); }
.seg > button[aria-pressed="true"], .tabs > [aria-current="page"], .tabs > [aria-selected="true"] { background: var(--ink); color: var(--white); }
@media (hover: hover) {
  .seg > button:not([aria-pressed="true"]):hover, .tabs > :not([aria-current="page"], [aria-selected="true"]):hover { background: var(--line); }
}

.rtabs { display: flex; flex-wrap: wrap; gap: var(--sp-2); }                  /* record-type tabs, quick picks */
.rtab {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--h-44); padding: 0 var(--sp-4);
  border-radius: var(--r-pill); background: var(--surface); color: var(--ink); box-shadow: var(--ring); cursor: pointer;
  font-family: var(--font); font-size: var(--fs-14); line-height: var(--lh-20); font-weight: var(--fw-heavy); text-decoration: none;
}
.rtab[aria-selected="true"], .rtab[aria-pressed="true"] { background: var(--brand-tint); color: var(--brand); box-shadow: var(--ring-brand-1); }
.rtab--dashed { background: transparent; color: var(--brand); box-shadow: none; border: 2px dashed var(--line); }

/* Room list (House) and Settings sub-nav: one list component, two sizes */
.navlist {
  display: flex; flex-direction: column; gap: var(--sp-1); width: var(--w-side); flex-shrink: 0; padding: var(--sp-3);
  border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--ring);
}
.navlist__item {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-height: var(--h-44); padding: 0 var(--sp-4);
  border-radius: var(--r-md); background: transparent; color: var(--ink); text-decoration: none; cursor: pointer;
  font-family: var(--font); font-size: var(--fs-15); line-height: var(--lh-20); font-weight: var(--fw-semibold); text-align: left;
}
.navlist__item[aria-current="page"], .navlist__item[aria-selected="true"], .navlist__item.is-active {
  background: var(--ok-tint); color: var(--ok); font-weight: var(--fw-heavy);            /* teal, not the brand blue of the rail */
}
.navlist--settings { padding: var(--sp-2); border-radius: var(--r-2xl); }
.navlist--settings .navlist__item { min-height: var(--h-48); font-size: var(--fs-16); line-height: var(--lh-24); font-weight: var(--fw-bold); }
.navlist--settings .navlist__item[aria-current="page"], .navlist--settings .navlist__item[aria-selected="true"],
.navlist--settings .navlist__item.is-active { background: var(--brand-tint); color: var(--brand); font-weight: var(--fw-heavy); }
@media (hover: hover) {
  .navlist__item:not([aria-current="page"], [aria-selected="true"], .is-active):hover { background: var(--bg); }
}
@media (max-width: 767.98px) {
  .navlist { width: 100%; }                                                           /* phone: a list of 48 px rows */
  .navlist__item { min-height: var(--h-48); }
}

/* ---------- side panel, bottom sheet, dialog (3.8, 3.12) ---------- */
.scrim { position: fixed; inset: 0; z-index: var(--z-panel); background: var(--scrim); }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: calc(var(--z-panel) + 1);
  display: flex; flex-direction: column; gap: var(--sp-4); width: var(--w-panel); max-width: 100%;
  padding: var(--sp-6); padding-bottom: calc(var(--sp-6) + var(--safe-bottom)); background: var(--surface); box-shadow: var(--panel-shadow);
}
.panel--wide { width: var(--w-panel-wide); }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }   /* h2 24/800 + close */
.panel__head > h2 { line-height: var(--lh-28); }                                       /* 28 in the 44 px close button's row: centred on the grid */
.panel__body { display: flex; flex: 1 1 auto; flex-direction: column; gap: var(--sp-4); min-height: 0; overflow-y: auto; }
.panel__foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-3); }
.panel__foot--split { justify-content: space-between; }                              /* "Delete" text button left, Cancel + Save right */
@media (max-width: 767.98px) {
  /* [derived] phone: a full-width bottom sheet 16 px from the top with the same header and footer */
  .panel { top: calc(var(--sp-4) + var(--safe-top)); left: 0; width: 100%; border-radius: var(--r-2xl) var(--r-2xl) 0 0; box-shadow: var(--sheet-shadow); }
}

/* Centred confirmation dialog. The left and top are rounded down to the 4 px grid (1180 wide is not an even 8). */
.dialog {
  position: fixed; z-index: var(--z-dialog); display: flex; flex-direction: column; gap: var(--sp-4);
  top: var(--sp-20); left: var(--sp-4); width: var(--w-dialog); max-width: calc(100% - var(--sp-8));
  padding: var(--sp-6); border-radius: var(--r-2xl); background: var(--surface); box-shadow: var(--dialog-shadow);
  top: round(down, 20%, var(--h-4)); left: round(down, calc(50% - var(--w-dialog) / 2), var(--h-4));
}
.dialog__title { font-size: var(--fs-24); line-height: var(--lh-32); font-weight: var(--fw-heavy); }
.dialog__text  { color: var(--muted); }
.dialog__actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-3); }
@media (max-width: 767.98px) {
  .dialog { width: calc(100% - var(--sp-8)); left: var(--sp-4); }
}

/* ---------- toast and undo bar (3.12) ---------- */
.toast-host {
  position: fixed; left: 0; right: 0; bottom: calc(var(--sp-6) + var(--safe-bottom)); z-index: var(--z-toast);
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); pointer-events: none;
}
@media (max-width: 767.98px) {
  .toast-host { bottom: calc(var(--tabbar-h) + var(--sp-4) + var(--safe-bottom)); }
}
.toast {
  position: relative; display: flex; align-items: center; gap: var(--sp-4); max-width: calc(100% - var(--sp-8)); min-height: var(--h-52);
  padding: 0 var(--sp-4) 0 var(--sp-6); border-radius: var(--r-lg); overflow: hidden; pointer-events: auto;
  background: var(--ink); color: var(--white); font-size: var(--fs-16); line-height: var(--lh-20); font-weight: var(--fw-bold);   /* 20 in 52: 16 above and below */
}
.toast__action {                                                             /* "Undo": a text button, 44 high */
  display: inline-flex; align-items: center; min-height: var(--h-44); padding: 0 var(--sp-2); flex-shrink: 0; cursor: pointer;
  color: var(--brand-tint); font-size: var(--fs-16); line-height: var(--lh-24); font-weight: var(--fw-heavy);
}
.toast__timer {                                                              /* 4 px bar along the bottom edge that empties over --toast-ms */
  position: absolute; left: 0; bottom: 0; width: 100%; height: var(--h-4); background: var(--brand-tint);
  transform-origin: left center; animation: ds-countdown var(--toast-ms, 10s) linear forwards;
}
@keyframes ds-countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- avatars, swatches, colour dot, kid tiles (3.9) ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden;
  width: var(--h-44); height: var(--h-44); border: 3px solid var(--surface); border-radius: var(--r-round);
  background: var(--m-tint, var(--bg)); color: var(--m-accent, var(--ink));
  font-size: var(--fs-14); line-height: var(--lh-20); font-weight: var(--fw-heavy);
}
.avatar--xl { width: var(--h-120); height: var(--h-120); font-size: var(--fs-40); line-height: var(--lh-48); }   /* kid sign-in */
.avatar--lg { width: var(--h-48); height: var(--h-48); font-size: var(--fs-16); line-height: var(--lh-24); }     /* Settings rows */
.avatar--sm { width: var(--h-40); height: var(--h-40); font-size: var(--fs-13); line-height: var(--lh-16); }     /* phone rows */
.avatar--xs { width: var(--h-32); height: var(--h-32); font-size: var(--fs-13); line-height: var(--lh-16); }     /* phone header (her 34) */
.avatar--ring-bg   { border-color: var(--bg); }                                       /* phone header */
.avatar--ring-tint { border-color: var(--m-tint, var(--bg)); }                        /* on white rows the ring equals the tint: invisible */
.avatar img { width: 100%; height: 100%; object-fit: cover; }                         /* [derived] photo avatar */
.avatar-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1); }

.swatches { display: flex; flex-wrap: wrap; gap: var(--sp-3); }                       /* her 8 colours; gap 10 -> 12 */
.swatch {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: var(--h-44); height: var(--h-44); border: 0; border-radius: var(--r-round); background: var(--m-accent, var(--ink)); color: var(--white); cursor: pointer;
}
.swatch[aria-pressed="true"] { border: 4px solid var(--ink); }
.swatch__mark { display: none; }                                                      /* [derived] a check so selection is not colour-only */
.swatch[aria-pressed="true"] .swatch__mark, .swatch[aria-disabled="true"] .swatch__mark { display: block; }
.swatch[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }                 /* [derived] colour already taken */
.dot { flex-shrink: 0; width: var(--h-24); height: var(--h-24); border-radius: var(--r-round); background: var(--m-accent, var(--ink)); }

.kid-tiles { display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.kid-tile {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); padding: var(--sp-6); border-radius: var(--r-3xl);
  background: transparent; color: var(--white); font-family: inherit; cursor: pointer;
  font-size: var(--fs-22); line-height: var(--lh-28); font-weight: var(--fw-heavy);
}
.kid-tile[aria-pressed="true"] { background: var(--glass-14); box-shadow: inset 0 0 0 3px var(--white); }
.kid-tile .avatar { border-color: var(--m-tint, var(--bg)); }

/* ---------- PIN pad (3.10), white on the dark lock background ---------- */
.pin-pad { display: flex; flex-direction: column; align-items: center; gap: var(--sp-6); color: var(--white); }
.pin-prompt { font-size: var(--fs-20); line-height: var(--lh-28); font-weight: var(--fw-heavy); text-align: center; }
.pin-dots { display: flex; justify-content: center; gap: var(--sp-4); }
.pin-dot { width: var(--h-20); height: var(--h-20); border: 2px solid var(--white); border-radius: var(--r-round); background: transparent; }
.pin-dot.is-filled { background: var(--white); }
.pin-dots--shake { animation: ds-shake var(--dur-shake) ease-in-out; }                  /* [derived] wrong PIN */
@keyframes ds-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-10px); } 40% { transform: translateX(10px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }
.pin-help { min-height: var(--h-20); font-size: var(--fs-14); line-height: var(--lh-20); color: var(--lock-muted); text-align: center; }
.keypad { display: grid; grid-template-columns: repeat(3, var(--h-84)); gap: var(--sp-4); justify-content: center; }
.key {
  display: flex; align-items: center; justify-content: center; width: var(--h-84); height: var(--h-84);
  border: 0; border-radius: var(--r-round); background: var(--glass-16); color: var(--white); cursor: pointer;
  font-family: var(--font); font-size: var(--fs-32); line-height: var(--lh-40); font-weight: var(--fw-bold);
}
.key--blank { visibility: hidden; pointer-events: none; }
.key:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }
@media (hover: hover) {
  .key:not(:disabled):hover { background: var(--glass-24); }
}

/* ---------- empty-state and "get started" cards (3.11) ---------- */
.feature { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; }
.feature__chip {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: var(--h-48); height: var(--h-48);
  border-radius: var(--r-lg); background: var(--t-bg, var(--brand-tint)); color: var(--t-fg, var(--brand));
}
.feature__title { font-size: var(--fs-17); line-height: var(--lh-24); font-weight: var(--fw-heavy); }
.feature__sub   { font-size: var(--fs-15); line-height: var(--lh-24); color: var(--muted); }   /* 24 + 24 = 48: the chip's height */
.add-tile {                                                                  /* dashed "+ Add another person" */
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: var(--h-52); padding: 0 var(--sp-4);
  border: 2px dashed var(--line); border-radius: var(--r-lg); background: transparent; color: var(--brand); cursor: pointer;
  font-family: var(--font); font-size: var(--fs-15); line-height: var(--lh-20); font-weight: var(--fw-heavy); text-decoration: none;
}
.empty { align-items: center; text-align: center; }                          /* with .card: House empty state */
.empty__title { font-size: var(--fs-20); line-height: var(--lh-28); font-weight: var(--fw-heavy); }
.empty__text  { font-size: var(--fs-15); line-height: var(--lh-20); color: var(--muted); }
.empty__picks { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2); }

/* ---------- paint swatch, scan photo box (4.3, 4.5) ---------- */
.swatch-tile { flex-shrink: 0; width: var(--h-72); height: var(--h-72); border-radius: var(--r-lg); background: var(--swatch, var(--swatch-blank)); box-shadow: var(--ring); }
.photo-box {                                                                 /* the scanned photo (real: an <img> inside, object-fit cover) */
  position: relative; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: var(--sp-2);
  height: var(--h-420); overflow: hidden; border-radius: var(--r-xl); background: var(--photo-bg); color: var(--lock-muted);
}
.photo-box > img { width: 100%; height: 100%; object-fit: cover; }
.photo-box__caption { font-size: var(--fs-14); line-height: var(--lh-20); color: var(--lock-muted); }
.scan-hit { position: absolute; border: 3px solid var(--scan-box); border-radius: var(--r-sm); }   /* only when the scan returns text positions; left/top/size set from JS */

/* Dark screens: the focus ring turns white (also in base.css via .on-dark) */
.on-dark .btn:focus-visible, .on-dark .key:focus-visible, .on-dark .kid-tile:focus-visible { outline-color: var(--white); }
