/* ══════════════════════════════════════════════════════════════════════════
   BOLO — Red Rocks Safety
   Brand layer: ~/claude-knowledge/3-Resources/design-dna/red-rocks/tokens.css
   Only the tokens this app actually uses are inlined below (portable, offline).
   Brand red #EE4224 sampled from ground truth (RRCIcon.png, 74.8% @ a=255).
   ══════════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;   /* iOS date wheel + caret would otherwise be a white flashbang */

  /* brand constants */
  --red:        #EE4224;   /* [PSD-sampled] THE brand red. Alert signal only. */
  --red-dim:    #8E2716;
  --cream:      #FFFCE6;
  --near-white: #FAFCFC;
  --gold:       #C9B98F;
  --ground:     #121111;
  --ink:        #1C1813;
  --paper:      #ECE3CF;

  /* app surfaces derived off the ground */
  --s1: #1A1817;
  --s2: #232120;
  --s3: #2E2B29;
  --hair: rgba(255,252,230,.13);
  --mute: rgba(255,252,230,.62);   /* was .52 -> 7.4:1 */
  --mute2: rgba(255,252,230,.50);  /* was .34 = 2.95:1, unreadable in a dim room */

  --display: Helvetica, "Helvetica Neue", Arial, sans-serif;
  --accent: Georgia, "Times New Roman", serif;  /* Tiempos stand-in — Tiempos is licensed, not web-embeddable */

  --tab-h: calc(62px + env(safe-area-inset-bottom));
  --mast-h: calc(52px + env(safe-area-inset-top));

  /* ── THE SCALE. Nothing in this file may use a value that is not on it. ──
     Before this, the app had ten control heights (25/30/32/36/40/42/46/47/49px),
     four of them under the iOS 44px touch minimum. That inconsistency is the
     single loudest "homemade" signal a UI can send. */
  --r:       6px;   /* surfaces: rows, cards, tiles, sheets, gallery slides */
  --r-ctl:   4px;   /* controls + badges: buttons, inputs, chips, thumbs, pills */
  --ctl:    46px;   /* every regular control */
  --ctl-sm: 40px;   /* every compact control */
  --tap:    44px;   /* minimum touch target */
  --edge: rgba(255,252,230,.34);  /* INTERACTIVE borders. --hair stays separators. */
  --in:  .18s cubic-bezier(.2,.8,.25,1);
  --out: .12s ease-in;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--ground);
  color: var(--cream);
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
/* Long-press on an <a> pops Safari's link-preview card; on a photo it offers
   "Save Image" — on a confidential safety photo. Selection is left ON for the
   narrative, case number and field values so a captain can still copy them. */
.row, .row__thumb, .tab, .btn, .chip, .gate__tab, .back, .lockup, .lockup__mark,
.lvl, .addphoto, .photo, .photo img, .photo__x, .photo__tag,
.gal__track img, .viewer__track img, .viewer__x {
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none;
}
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ══ MASTHEAD ══════════════════════════════════════════════════════════ */
.mast {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  height: var(--mast-h); padding: env(safe-area-inset-top) 16px 0;
  background: rgba(18,17,17,.92);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--hair);
}
.lockup { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; }
.lockup__mark { width: 22px; height: 22px; border-radius: 3px; display: block; }
.lockup__wm { font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.lockup__wm b { font-weight: 700; }
.lockup__wm i { font-style: normal; font-weight: 300; opacity: .62; }
.mast__div { width: 1px; height: 16px; background: var(--hair); }
.mast__title {
  font-weight: 700; font-size: 13px; letter-spacing: .18em; text-transform: uppercase;
}
.mast__sync {
  margin-left: auto; font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 7px; border: 1px solid var(--hair); border-radius: var(--r-ctl); color: var(--mute2);
}
.mast__sync[data-state="syncing"] { color: var(--gold); border-color: rgba(201,185,143,.4); }
.mast__sync[data-state="drive"] { color: var(--gold); border-color: rgba(201,185,143,.4); }

/* ══ LAYOUT ════════════════════════════════════════════════════════════ */
main { padding-bottom: calc(var(--tab-h) + 24px); min-height: 60vh; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* ══ TAB BAR ═══════════════════════════════════════════════════════════ */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; gap: 10px; align-items: center;
  height: var(--tab-h); padding: 0 16px env(safe-area-inset-bottom);
  background: rgba(18,17,17,.94);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--hair);
}
.tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--ctl); border-radius: var(--r-ctl); text-decoration: none; color: var(--mute);
  font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid var(--edge);
}
.tab svg { width: 17px; height: 17px; }
.tab[aria-current="page"] { color: var(--cream); background: var(--s2); }
/* equal widths — a lopsided pair reads as an accident, not a hierarchy */
.tab--cta { background: var(--red); border-color: var(--red); color: var(--ground); }
.tab--cta[aria-current="page"] { background: var(--red); color: var(--ground); }

/* ══ SEARCH + FILTERS ══════════════════════════════════════════════════ */
.toolbar { padding: 14px 16px 4px; max-width: 720px; margin: 0 auto; }
.search {
  display: flex; align-items: center; gap: 9px;
  background: var(--s1); border: 1px solid var(--edge); border-radius: var(--r-ctl); padding: 0 12px;
}
.search svg { width: 16px; height: 16px; color: var(--mute2); flex: none; }
.search input {
  flex: 1; background: none; border: 0; outline: 0; height: 44px; font-size: 16px;
}
.search input::placeholder { color: rgba(255,252,230,.46); }
.chips { display: flex; gap: 7px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; height: var(--ctl-sm); padding: 0 12px;
  border-radius: var(--r-ctl); cursor: pointer;
  background: none; border: 1px solid var(--edge); color: var(--mute);
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.chip[aria-pressed="true"] { background: var(--cream); border-color: var(--cream); color: var(--ground); }
.count { padding: 6px 16px 10px; max-width: 720px; margin: 0 auto;
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute2); }

/* ══ LIST ══════════════════════════════════════════════════════════════ */
.list { max-width: 720px; margin: 0 auto; padding: 0 16px; display: grid; gap: 9px; }
.row {
  display: grid; grid-template-columns: 74px 1fr; gap: 13px;
  background: var(--s1); border: 1px solid var(--hair); border-radius: var(--r);
  padding: 12px 12px 12px 15px; text-decoration: none; color: inherit; align-items: stretch;
  position: relative; overflow: hidden;
}
.row::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--lvl, transparent);
}
/* opacity:.45 dropped body text to 2.05:1 — unreadable when searching old records */
.row--archived { background: none; }
.row--archived .row__name { color: rgba(255,252,230,.68); }
.row--archived img.row__thumb { filter: grayscale(1); }
.row__thumb {
  width: 74px; height: 92px; border-radius: var(--r-ctl); object-fit: cover; background: var(--s3); display: block;
}
.row__thumb--empty { display: grid; place-items: center; color: var(--mute2); font-size: 10px;
  letter-spacing: .1em; text-transform: uppercase; }
.row__body { min-width: 0; display: flex; flex-direction: column; }
.row__name {
  font-weight: 700; font-size: 17px; letter-spacing: -.02em; text-transform: uppercase;
  line-height: 1.12; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row__meta { font-size: 12px; color: var(--mute); margin-top: 3px; }
.row__desc {
  font-size: 13px; color: var(--mute); margin-top: 7px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.row__foot { margin-top: auto; padding-top: 8px; }

/* ══ LEVEL BADGE ═══════════════════════════════════════════════════════ */
.lvl {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase;
  padding: 3px 7px; border-radius: var(--r-ctl); border: 1px solid currentColor; white-space: nowrap;
}
.lvl--trespassed { background: var(--red); border-color: var(--red); color: var(--ground); }
.lvl--approach   { color: var(--red); border-color: var(--red); }
.lvl--monitor    { color: var(--gold); border-color: rgba(201,185,143,.55); }
.lvl--archived   { color: var(--mute); border-color: var(--hair); }

/* ══ DETAIL (the output) ═══════════════════════════════════════════════ */
.detail { max-width: 720px; margin: 0 auto; }
.back {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 8px 4px 0; padding: 0 12px; min-height: var(--tap);   /* was 25px tall */
  background: none; border: 0; border-radius: var(--r-ctl); cursor: pointer; color: var(--mute);
  font-size: 12.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.back svg { width: 15px; height: 15px; }

.alertbar {
  margin: 8px 16px 0; padding: 12px; border-radius: var(--r); border: 1px solid transparent;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.alertbar svg { width: 18px; height: 18px; flex: none; }
.alertbar--trespassed { background: var(--red); color: var(--ground); }
.alertbar--approach { background: rgba(238,66,36,.14); color: var(--red); border: 1px solid var(--red); }
.alertbar--monitor { background: rgba(201,185,143,.11); color: var(--gold); border: 1px solid rgba(201,185,143,.45); }
.alertbar--archived { background: var(--s2); color: var(--mute); border: 1px solid var(--hair); }
.alertbar small { display: block; font-weight: 400; letter-spacing: 0; text-transform: none;
  font-size: 12px; margin-top: 2px; }

/* critical strip — case # / key detail, pulled out of the field list so they
   land before anything else. Head-of-safety ask: make it impossible to miss. */
.crit { margin: 10px 16px 0; display: grid; gap: 7px; }
.crit__item {
  position: relative; padding: 12px 12px 12px 20px; border-radius: var(--r);
  background: rgba(238,66,36,.09); border: 1px solid rgba(238,66,36,.34);
}
.crit__item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; background: var(--red); border-radius: var(--r) 0 0 var(--r); }
.crit__label { display: block; font-size: 10px; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; color: var(--red); }
.crit__val { display: block; font-size: 16px; font-weight: 700; margin-top: 2px; line-height: 1.3; }
.crit__val.big { font-size: 24px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

/* ══ GALLERY — native scroll-snap, thumb-swipeable, no library ══════════ */
.gal { margin: 14px 0 0; position: relative; }
.gal__track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; gap: 10px;
  padding: 0 16px; scroll-padding: 0 16px;
}
.gal__track::-webkit-scrollbar { display: none; }
.gal__track img {
  flex: 0 0 calc(100% - 32px); scroll-snap-align: center; aspect-ratio: 4/5;
  object-fit: cover; border-radius: var(--r); background: var(--s2); cursor: zoom-in; display: block;
  min-width: 0;   /* flex items default to min-width:auto = the img's INTRINSIC width,
                     which overrides the basis and blows the slide out to 1200px */
}
.gal__bar { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; }
.gal__dots { display: flex; gap: 6px; }
.gal__dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,252,230,.28); transition: background .18s; }
.gal__dots i[data-on] { background: var(--cream); }
.gal__count { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--mute2);
  font-variant-numeric: tabular-nums; }
.gal__hint { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute2); }

/* fullscreen viewer */
.viewer { position: fixed; inset: 0; z-index: 100; background: #0A0909;
  display: flex; flex-direction: column; }
.viewer__track { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; align-items: center; }
.viewer__track::-webkit-scrollbar { display: none; }
.viewer__track img { flex: 0 0 100%; scroll-snap-align: center; max-height: 100%;
  object-fit: contain; width: 100%; min-width: 0; }   /* same min-width:auto trap as .gal__track */
.viewer__bar { display: flex; align-items: center; justify-content: space-between;
  padding: env(safe-area-inset-top) 16px 0; height: calc(52px + env(safe-area-inset-top)); }
.viewer__x { background: none; border: 0; color: var(--cream); padding: 8px; cursor: pointer; }
.viewer__x svg { width: 22px; height: 22px; }
.viewer__n { font-size: 11px; letter-spacing: .12em; color: var(--mute); font-variant-numeric: tabular-nums; }
.viewer__foot { padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); text-align: center;
  font-size: 12px; color: var(--mute2); }

/* ══ VITALS — the fast identifiers, as tiles instead of table rows ══════ */
.vitals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 16px 0; }
.vital { background: var(--s1); border: 1px solid var(--hair); border-radius: var(--r); padding: 12px; }
.vital dt { font-size: 9.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--mute2); }
.vital dd { margin: 4px 0 0; font-size: 15px; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }

/* stacked long-text blocks (features, vehicle, additional) */
.blocks { margin: 18px 16px 0; display: grid; gap: 16px; }
.block dt { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--mute2); margin-bottom: 5px; }
.block dd { margin: 0; font-size: 15px; line-height: 1.5; }

.incident { margin: 20px 16px 0; padding: 12px; background: var(--s1);
  border: 1px solid var(--hair); border-radius: var(--r); display: flex; flex-wrap: wrap; gap: 4px 18px; }
.incident div { min-width: 0; }
.incident dt { font-size: 9.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--mute2); }
.incident dd { margin: 2px 0 0; font-size: 14px; }

.namebar { margin: 18px 16px 0; }
.namebar h1 {
  margin: 0; font-size: clamp(28px, 8vw, 40px); font-weight: 700;
  letter-spacing: -.04em; text-transform: uppercase; line-height: .95;
}
.namebar p { margin: 6px 0 0; font-size: 13px; color: var(--mute); }

.narr { margin: 24px 16px 0; }
.narr h2 {
  font-family: var(--accent); font-style: italic; font-weight: 400;
  font-size: 19px; margin: 0 0 10px; color: var(--gold); letter-spacing: .005em;
}
.narr p { margin: 0 0 12px; font-size: 15.5px; line-height: 1.62; white-space: pre-wrap; }

.actions { margin: 26px 16px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.actions .btn--wide { grid-column: 1 / -1; }
.meta-foot { margin: 22px 16px 0; padding-top: 14px; border-top: 1px solid var(--hair);
  font-size: 11.5px; color: var(--mute2); line-height: 1.6; }

/* ══ BUTTONS ═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--ctl); padding: 0 16px; border-radius: var(--r-ctl); cursor: pointer; text-decoration: none;
  background: var(--s2); border: 1px solid var(--edge); color: var(--cream);
  font-size: 12.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--red); border-color: var(--red); color: var(--ground); }
.btn--ghost { background: none; }
.btn--danger { color: var(--red); border-color: rgba(238,66,36,.45); background: none; }
.btn:disabled { opacity: .45; }

/* ══ FORM ══════════════════════════════════════════════════════════════ */
.form { max-width: 720px; margin: 0 auto; padding: 4px 16px 0; }
.form h1 {
  font-size: 26px; font-weight: 700; letter-spacing: -.03em; text-transform: uppercase;
  margin: 14px 0 4px;
}
.form__sub { color: var(--mute); font-size: 13.5px; margin: 0 0 22px; }

fieldset { border: 0; padding: 0; margin: 0 0 26px; }
legend {
  font-family: var(--accent); font-style: italic; font-size: 17px; color: var(--gold);
  padding: 0 0 10px; margin-bottom: 12px; border-bottom: 1px solid var(--hair); width: 100%;
}
.f { margin-bottom: 15px; }
.f > label, .f > .lbl {
  display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .11em;
  text-transform: uppercase; color: var(--mute2); margin-bottom: 6px;
}
.f label .req { color: var(--red); }
.f input[type=text], .f input[type=date], .f select, .f textarea {
  width: 100%; background: var(--s1); border: 1px solid var(--edge); border-radius: var(--r-ctl);
  padding: 0 13px; outline: 0; font-size: 16px; /* 16px prevents iOS zoom-on-focus */
  line-height: 1.2; height: var(--ctl);
}
/* textarea must RE-state both, or it inherits the fixed control height */
.f textarea { height: auto; min-height: 160px; resize: vertical; padding: 12px 13px; line-height: 1.55; }
.f input::placeholder, .f textarea::placeholder { color: rgba(255,252,230,.46); opacity: 1; }
.f input:focus, .f select:focus, .f textarea:focus { border-color: var(--gold); background: var(--s2); }
.f .hint { font-size: 12px; color: var(--mute2); margin-top: 6px; line-height: 1.45; }

/* Grid items default to min-width:auto — for a replaced element like an iOS date
   input, that resolves to its INTRINSIC width, which is wider than half a phone
   screen. The field then overflows its column and slides under the next one.
   min-width:0 lets the column actually constrain it. */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 > * { min-width: 0; }
.f input, .f select, .f textarea { min-width: 0; max-width: 100%; }

/* iOS renders date inputs at a fixed intrinsic size and ignores width unless the
   default appearance is dropped. Without this the field stays oversized. */
.f input[type=date] {
  -webkit-appearance: none; appearance: none;
  min-height: 46px; line-height: 1.2;
}
/* long labels must wrap inside a half-width column instead of forcing it wider */
.f > label, .f > .lbl { overflow-wrap: anywhere; }

/* level picker */
.levels { display: grid; gap: 8px; }
.levels label {
  display: flex; align-items: flex-start; gap: 11px; padding: 12px 13px; cursor: pointer;
  background: var(--s1); border: 1px solid var(--edge); border-radius: var(--r-ctl);
}
.levels input { margin: 2px 0 0; accent-color: var(--red); width: 17px; height: 17px; flex: none; }
.levels b { display: block; font-size: 13px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.levels span { display: block; font-size: 12.5px; color: var(--mute); margin-top: 2px; line-height: 1.4; }
.levels label:has(input:checked) { border-color: var(--gold); background: var(--s2); }
.levels label:has(input[value="trespassed"]:checked),
.levels label:has(input[value="approach"]:checked) { border-color: var(--red); }

/* photo dropzone */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 9px; }
.photo { position: relative; aspect-ratio: 4/5; border-radius: 4px; overflow: hidden;
  border: 1px solid var(--hair); background: var(--s2); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo__x {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(18,17,17,.82); border: 1px solid var(--hair); color: var(--cream);
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.photo__x svg { width: 13px; height: 13px; }
.photo__tag { position: absolute; left: 4px; bottom: 4px; background: rgba(18,17,17,.82);
  font-size: 9px; letter-spacing: .1em; text-transform: uppercase; padding: 2px 5px; border-radius: 2px;
  color: var(--mute); }
.addphoto {
  aspect-ratio: 4/5; display: grid; place-items: center; gap: 5px; cursor: pointer;
  background: none; border: 1px dashed var(--edge); border-radius: var(--r-ctl); color: var(--mute);
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; text-align: center;
}
.addphoto svg { width: 21px; height: 21px; }

/* While the form is open the tab bar is hidden (see body.form-open), so this sits
   flush at the bottom instead of stacking a second row of buttons under it. */
.formbar {
  position: sticky; bottom: 0; z-index: 40; margin: 0 -16px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(18,17,17,.95); border-top: 1px solid var(--hair);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  display: grid; grid-template-columns: 1fr 1fr; gap: 9px;
}
.formbar .btn { width: 100%; }

/* Two competing button rows (Cancel/File over Log/New BOLO) is four choices at the
   moment the user has exactly two. Hide the nav while filling the form. */
body.form-open .tabbar { display: none; }
body.form-open main { padding-bottom: 0; }
.err { color: var(--red); font-size: 13px; margin: 0 0 10px; }

/* ══ EMPTY / MISC ══════════════════════════════════════════════════════ */
.empty { max-width: 460px; margin: 60px auto; padding: 0 24px; text-align: center; color: var(--mute); }
/* :not(.btn svg) matters — a .btn inside an empty state would otherwise inherit
   the 40px illustration size and render a giant plus next to 12px text. */
.empty > svg { width: 40px; height: 40px; color: var(--mute2); margin-bottom: 14px; }
.empty .btn svg { width: 16px; height: 16px; margin-bottom: 0; }
.empty h2 { font-size: 17px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--cream); margin: 0 0 7px; }
.empty p { font-size: 14px; margin: 0 0 20px; line-height: 1.55; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + 16px); transform: translateX(-50%);
  background: var(--cream); color: var(--ground); padding: 11px 18px; border-radius: 4px; z-index: 90;
  font-size: 13px; font-weight: 700; letter-spacing: .05em; box-shadow: 0 8px 30px rgba(0,0,0,.5);
  animation: pop .22s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } }

.sheet-bg { position: fixed; inset: 0; background: rgba(10,9,9,.72); z-index: 80;
  display: grid; place-items: center; padding: 20px; }
.sheet { background: var(--s1); border: 1px solid var(--hair); border-radius: 6px;
  max-width: 380px; width: 100%; padding: 22px; }
.sheet h3 { margin: 0 0 8px; font-size: 16px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.sheet p { margin: 0 0 20px; font-size: 14px; color: var(--mute); line-height: 1.55; }
.sheet__row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

@media (min-width: 560px) {
  .actions { grid-template-columns: repeat(4, 1fr); }
  .actions .btn--wide { grid-column: auto; }
}

/* ══ GATE — join / claim / request ═════════════════════════════════════ */
body.gated .tabbar, body.gated .mast,
html.gated-boot .tabbar, html.gated-boot .mast { display: none; }
.gate { max-width: 420px; margin: 0 auto; padding: calc(34px + env(safe-area-inset-top)) 22px 60px; }
.gate__mark { display: flex; align-items: center; gap: 10px; }
.gate__mark img { width: 30px; height: 30px; border-radius: 4px; }
.gate__wm { font-size: 13px; letter-spacing: .11em; text-transform: uppercase; }
.gate__wm b { font-weight: 700; }
.gate__wm i { font-style: normal; font-weight: 300; opacity: .6; }
.gate__h1 { font-size: 48px; font-weight: 700; letter-spacing: -.04em; margin: 26px 0 0; }
.gate__sub { color: var(--mute); font-size: 14px; margin: 6px 0 26px; }
.gate__tabs { display: flex; gap: 6px; margin-bottom: 22px; }
.gate__tab { flex: 1; display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--ctl-sm); padding: 0 4px; border-radius: var(--r-ctl); cursor: pointer;
  background: none; border: 1px solid var(--edge); color: var(--mute);
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.gate__tab[aria-selected="true"] { background: var(--cream); border-color: var(--cream); color: var(--ground); }
.gate__done { text-align: center; padding: 24px 0; font-size: 17px; font-weight: 700; }
.gate__done span { display: block; margin-top: 10px; font-size: 14px; font-weight: 400;
  color: var(--mute); line-height: 1.6; }
.gate__foot { margin-top: 34px; text-align: center; font-size: 11px; color: var(--mute2); }
.btn--full { width: 100%; }

/* ══ ROSTER ════════════════════════════════════════════════════════════ */
.rsec { margin: 26px 16px 0; }
.rsec__h { font-family: var(--accent); font-style: italic; font-weight: 400; font-size: 18px;
  color: var(--gold); margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--hair); }
.rrow { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--hair); }
.rrow__body { flex: 1; min-width: 0; }
.rrow__body b { display: block; font-size: 15px; font-weight: 700; }
.rrow__body span { display: block; font-size: 12.5px; color: var(--mute); margin-top: 2px; }
.rrow__meta { font-size: 11.5px !important; color: var(--mute2) !important; }
.rrow__acts { display: flex; gap: 6px; flex: none; }
.btn--sm { height: var(--ctl-sm); padding: 0 12px; font-size: 11px; letter-spacing: .1em; }
/* Selector must out-rank `.rrow__body span` (0,1,1), which sets display:block and
   would otherwise stretch this badge across the whole row. A bare `.you` (0,1,0)
   loses that fight, so scope it. */
.rrow__body .you { display: inline-block; width: auto; margin-top: 0;
  font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold);
  border: 1px solid rgba(201,185,143,.45); padding: 1px 5px; border-radius: 2px; margin-left: 6px; }

/* photo placeholder while its bytes are fetched from Drive */
.gal__ph { flex: 0 0 calc(100% - 32px); min-width: 0; aspect-ratio: 4/5; border-radius: var(--r);
  background: var(--s2); border: 1px solid var(--hair); display: grid; place-items: center;
  scroll-snap-align: center; }
.gal__ph span { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute2); }
.mast__sync[data-state="offline"] { color: var(--red); border-color: rgba(238,66,36,.4); }
.mast__sync[data-state="pending"] { color: var(--gold); border-color: rgba(201,185,143,.4); }

/* ══ PRINT ═════════════════════════════════════════════════════════════
   Printing is meant to go through Share (the paper-mode card in card.js).
   This is only a safety net for someone who hits ⌘P on the detail screen. */
@media print {
  .mast, .tabbar, .actions, .back, .toolbar, .count, .gal__bar, .viewer { display: none !important; }
  body { background: #fff; color: #000; }
  main { padding: 0; }
  .vital, .crit__item, .incident { border-color: #bbb; background: none; }
  .vital dt, .block dt, .incident dt, .narr h2 { color: #444; }
  .gal__track { overflow: visible; }
  .gal__track img:not(:first-child) { display: none; }
}

/* list footer — roster / sign out / refresh */
.listfoot { max-width: 720px; margin: 26px auto 0; padding: 18px 16px 0;
  border-top: 1px solid var(--hair); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }


/* ══ PRESS FEEDBACK ════════════════════════════════════════════════════════
   `-webkit-tap-highlight-color: transparent` at the top of this file kills iOS's
   own grey flash, and nothing replaced it — so until now NOTHING in the app
   acknowledged a touch. renderDetail() also awaits IndexedDB before painting, so
   tapping a row produced no feedback at all for the round-trip, and volunteers
   tapped again. Three of the six auditors independently called this the number
   one reason the app read as a web page rather than an app. */
.btn, .tab, .chip, .gate__tab, .back, .row, .lockup,
.levels label, .addphoto, .photo__x, .viewer__x, .gal__track img {
  transition: transform var(--out), background-color var(--out), opacity var(--out);
}
.btn:not(:disabled):active, .tab:active, .gate__tab:active, .back:active,
.lockup:active, .addphoto:active, .photo__x:active, .viewer__x:active {
  transform: scale(.96); opacity: .78;
}
.row:active { background: var(--s2); transform: scale(.985); }
.levels label:has(input):active { background: var(--s3); }
/* the :not() guard is load-bearing: a bare .chip:active ties the selected-chip
   rule and wins on source order, leaving #121111 on #2A2926 = 1.3:1, invisible */
.chip:not([aria-pressed="true"]):active { background: rgba(255,252,230,.10); }
.chip[aria-pressed="true"]:active { background: #E8E4CF; border-color: #E8E4CF; }
.gal__track img:active { opacity: .82; }   /* opacity only — a transform fights scroll-snap */

/* keyboard + assistive focus, which had no visible state at all */
.btn:focus-visible, .tab:focus-visible, .chip:focus-visible, .gate__tab:focus-visible,
.back:focus-visible, .row:focus-visible, .levels label:focus-within, .addphoto:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}

/* overlays used to teleport into existence */
.viewer   { animation: fadein var(--in); }
.sheet-bg { animation: fadein var(--in); }
/* deliberately no opacity here — .sheet is a child of the already-fading scrim,
   and stacking both makes the dialog visibly lag its own backdrop */
.sheet    { animation: sheetin var(--in); }
#view > *  { animation: viewIn .2s cubic-bezier(.32,.72,0,1); }
@keyframes fadein  { from { opacity: 0; } }
@keyframes sheetin { from { transform: translateY(12px) scale(.97); } }
@keyframes viewIn  { from { opacity: 0; transform: translate3d(0,8px,0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ══ MICRO-LABEL — one role, one size, one tracking. Last on purpose. ══════
   This label ran at three sizes and three trackings across the form, the detail
   screen and the roster: pure copy-paste drift. */
.crit__label, .vital dt, .block dt, .incident dt, .f > label, .f > .lbl,
.gal__count, .gal__hint, .gal__ph span, .row__thumb--empty, .mast__sync, .count {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
}
.crit__label, .vital dt, .block dt, .incident dt, .f > label, .f > .lbl { font-weight: 700; }
.gal__count, .gal__hint, .gal__ph span, .row__thumb--empty, .count { font-weight: 400; }
.mast__sync { flex: none; white-space: nowrap; }

/* long names must not scroll the whole document sideways */
.namebar h1 { overflow-wrap: anywhere; }
.row__meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
             font-variant-numeric: tabular-nums; }
/* tracking is an uppercase-only device in this brand; on a mixed-case sentence
   it just gaps the letters, which is the most common amateur type tell */
.toast { letter-spacing: 0; }
.narr p:last-child { margin-bottom: 0; }
