<style>
  /* ── Reset & Variables ─────────────────────────────────────── */
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  /* v0.9.1138 (Brad: "the black numbers need to be cream") — a <button> does
     NOT inherit colour from its parent. Browsers force `color: buttontext`,
     which is black. So any button that sets a background but no colour renders
     black text, and on our dark surfaces that is close to unreadable. Brad hit
     it on the Upgrade picker, where the condition numbers came out black on
     navy; ten button tags across the app had the same gap.

     One rule fixes all of them because --text is re-scoped per context: :root
     is cream for the dark chrome, .main re-scopes it to near-black for the
     cream page area, and the light and high-contrast themes set their own. So
     this resolves to the correct colour wherever the button happens to be.

     Specificity is 0,0,1 — the lowest possible for an element selector — so
     every class rule and every inline style still overrides it. Nothing that
     already sets its own colour changes. */
  button { color: var(--text); }

  /* ── v0.9.1140 — the standard ADD / RESEARCH pop-up card ────────────────
     Brad: "we need all the different pop up add screens and research screens
     to look the same and be the same size." And, when a first pass painted it
     wider: "the cards should be left alone, we are just talking about the add
     item like want list collection, sale list ect."

     SCOPE — this class is for the pop-ups where the user is ADDING something
     (collection, want list, sale list, sold, upgrade, parts, add-by-photo,
     add-by-barcode) and the research/identify screens that serve those flows.
     Detail cards, info popups, contacts, backups, tutorials and the like keep
     their own styling deliberately — do not convert them.

     Rules inside that scope:
       - the CONTAINER gets class="rr-card" and loses its inline background /
         border / radius / width / padding — everything else it needs (flex
         column, overflow handling) may stay inline.
       - an accent identity is allowed ONLY on border-color (e.g. the orange
         collection tint) — never on background or size.
       - headings inside use .rr-card-title. Cream, Oswald, one size.
     New ADD pop-ups: use this class. Do not hand-roll another card. */
  .rr-card {
    background: var(--bg);
    border: 1px solid var(--border-hi);
    /* v0.9.1143 (Brad): "add this orange bar at the top for these as well" —
       the accent top edge from the research card, now on every card in the
       standard. Cards that override border-color for a flow identity get the
       bar in THEIR accent (same rule as the wizard's progress bar, which is
       blue on Want and green on Sold). */
    border-top: 3px solid var(--accent);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 92dvh;
    overflow-y: auto;
    padding: 1.4rem;
    position: relative;
  }
  .rr-card-title {
    font-family: var(--font-head);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.6rem;
    padding-right: 2rem;   /* clear the ✕ */
  }
  /* Pop-ups that manage their own scroll region (pickers with a fixed search
     bar over a scrolling list) add this to the container. */
  .rr-card.rr-card-flex { display: flex; flex-direction: column; overflow: hidden; padding: 1.4rem; }

  /* Prevent iOS auto-zoom on inputs */
  @media (max-width: 640px) {
    input, select, textarea { font-size: 16px !important; }
  }

  :root {
    /* My Collection App — Lionel Box Palette */
    --bg:        #0f1220;
    --surface:   #161c34;
    --surface2:  #1c2544;
    --surface3:  #222e58;
    --border:    #2a3560;
    --border-hi: #3a4880;
    --accent:    #f05008;
    --accent-dk: #c84406;
    --accent2:   #d4a843;
    --accent3:   #8b5cf6;
    --text:      #f8e8c0;
    --text-dim:  #6a5e48;
    --text-mid:  #c8b88a;
    --green:     #2ecc71;
    --green-light:#4dc880;
    --red:       #f05008;
    --gold:      #d4a843;
    --gold-light:#e8c060;
    --navy:      #1a1d3a;
    --cream:     #f8e8c0;
    /* Semantic status colors (Session 185 — Appearance editor).
       Single source for status hues; the Appearance page edits these
       live. Sweeps will migrate matching literals onto them over time. */
    --want:      #2980b9;   /* want-list blue */
    --forsale:   #e67e22;   /* for-sale orange (distinct from --accent) */
    --danger:    #e74c3c;   /* errors / destructive */
    --warn:      #f0b429;   /* warnings */
    --info:      #3498db;   /* informational */
    --on-accent: #ffffff;   /* text placed on accent-colored fills */
    /* v0.9.1178 — the dim behind a modal or a bottom sheet. Twenty-odd screens
       type this value out by hand; a scrim is a palette decision, so it belongs
       here. Same value the hand-typed ones already use, so nothing looks any
       different today, and it is deliberately NOT overridden per theme — a dark
       scrim reads correctly over both the dark and the light surfaces. */
    --scrim:     rgba(0,0,0,0.55);
    /* v0.9.1153 — MY BUG FROM v0.9.1148, and a CSS trap worth remembering.
       The census flagged --bg-card as "used but never defined", and I defined
       it here as `var(--surface2)`. That looked equivalent and is NOT: a custom
       property's value is substituted where it is DECLARED, not where it is
       used. So --bg-card computed to :root's DARK #1c2544 and inherited into
       the light `.main` content area, completely ignoring .main's own
       --surface2: #f5eeda override. Before my change it was undefined, the
       background declaration was invalid, and the cream showed through — so
       "defining it" is what turned Brad's filter chips and search box into
       unreadable dark navy boxes on a cream page.
       Fix: a LITERAL per scope, never an alias. Brad: "the filter boxes can not
       be a dark color. they should be white background" — so the light scopes
       get near-white --surface, not cream --surface2. */
    --bg-card:   #1c2544;
    --radius:    8px;
    --font-head: 'Oswald', 'Barlow Condensed', sans-serif;
    --font-body: 'Merriweather Sans', 'Helvetica Neue', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
    --sidebar-w: 260px;
    --header-h:  60px;
  }

  /* ── High-Contrast theme (Session 112, accessibility) ─────── */
  /* Applied via document.documentElement.dataset.theme = "high-contrast". */
  /* Uses pure black/white for maximum legibility, stronger borders,     */
  /* and a brighter accent. Everything else keeps its existing layout.    */
  /* ── Light theme — full cohesive light palette (chrome + content). ── */
  /* Applied via document.documentElement.dataset.theme = "light". Reuses  */
  /* the proven cream palette already used for .main so the sidebar,       */
  /* modals and wizard match the (already-light) content area.             */
  html[data-theme="light"] {
    --bg:        #f8e8c0;
    --surface:   #fffdf6;
    --surface2:  #f5eeda;
    --bg-card:   #fffdf6;   /* v0.9.1153: white cards, not dark (see :root note) */
    --surface3:  #ede2cc;
    --border:    #d4c8a8;
    --border-hi: #c0b090;
    --border-light: #d4c8a8;
    --text:      #2a2015;
    --text-dim:  #8a7e68;
    --text-mid:  #5a4e38;
    --navy:      #2a2015;
    --cream:     #2a2015;
    --accent2:   #b8860b;
    --gold:      #b8860b;
    background:  #f8e8c0;
  }
  html[data-theme="light"] body { background: #f8e8c0; }
  html[data-theme="light"] .sidebar,
  html[data-theme="light"] .sidebar-light { background: var(--surface); }

  html[data-theme="high-contrast"] {
    --bg:        #000000;
    --surface:   #000000;
    --surface2:  #0a0a0a;
    --bg-card:   #000000;   /* v0.9.1153 */
    --surface3:  #141414;
    --border:    #ffffff;
    --border-hi: #ffff00;
    --accent:    #ffb000;
    --accent-dk: #cc8c00;
    --accent2:   #ffff00;
    --accent3:   #00eaff;
    --text:      #ffffff;
    --text-dim:  #c0c0c0;
    --text-mid:  #e0e0e0;
    --green:     #00ff40;
    --green-light:#80ff80;
    --red:       #ff4040;
    --gold:      #ffff00;
    --gold-light:#ffff80;
    --navy:      #000000;
    --cream:     #ffffff;
  }
  /* Reinforce borders so UI boundaries are clearer in HC mode */
  html[data-theme="high-contrast"] .nav-item,
  html[data-theme="high-contrast"] .stat-card,
  html[data-theme="high-contrast"] .panel,
  html[data-theme="high-contrast"] .item-table th,
  html[data-theme="high-contrast"] .item-table td,
  html[data-theme="high-contrast"] button,
  html[data-theme="high-contrast"] select,
  html[data-theme="high-contrast"] input[type="text"],
  html[data-theme="high-contrast"] input[type="search"] {
    border-width: 2px !important;
  }
  html[data-theme="high-contrast"] a { text-decoration: underline; }
  html[data-theme="high-contrast"] .main {
    /* Override .main's light-mode colors when HC is active */
    --bg:        #000000;
    --surface:   #000000;
    --surface2:  #0a0a0a;
    --bg-card:   #000000;   /* v0.9.1153 */
    --surface3:  #141414;
    --border:    #ffffff;
    --text:      #ffffff;
    --text-dim:  #c0c0c0;
    --text-mid:  #e0e0e0;
    background:  #000000;
  }

  /* ── Light mode for main content area ─────────────────────── */
  .main {
    --bg:        #f8e8c0;
    --surface:   #fffdf6;
    --surface2:  #f5eeda;
    /* v0.9.1153 (Brad's screenshot): the filter chips and the search box in the
       content area read --bg-card. Without this line they inherited :root's
       dark navy and rendered as unreadable dark boxes on the cream page. */
    --bg-card:   #fffdf6;
    --surface3:  #ede2cc;
    --border:    #d4c8a8;
    --border-hi: #c0b090;
    --border-light: #d4c8a8;
    --text:      #2a2015;
    --text-dim:  #8a7e68;
    --text-mid:  #5a4e38;
    --navy:      #2a2015;
    --cream:     #2a2015;
    background: #f8e8c0;
  }
  .main .stat-card { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
  .main .stat-card:hover { border-color: #c0b090; }
  .main .table-wrap { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
  .main .item-table th { background: #f0e6cc; color: #5a4e38; border-bottom: 2px solid #d4c8a8; }
  .main .item-table td { border-bottom: 1px solid #e8ddc0; color: #2a2015; }
  .main .item-table tr:hover td { background: #f5eed8; }
  .main .page-title { color: #2a2015; }
  .main .page-title span { color: inherit; }
  .main .page-title span span { color: #8a7e68; }
  .main .item-num { color: #c84406; }
  .main .tag { background: #f0e6cc; color: #5a4e38; border: 1px solid #d4c8a8; }
  .main .market-val { color: #2a7a18; }
  .main .text-dim { color: #8a7e68; }
  .main .empty-state { color: #8a7e68; }
  .main .panel { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
  .main .owned-badge.yes { background: rgba(46,204,113,0.12); color: #2a7a18; border-color: rgba(46,204,113,0.3); }
  .main .owned-badge.no { background: #f0e6cc; color: #8a7e68; }
  .main .owned-badge.want { background: rgba(212,168,67,0.12); color: #b08820; border-color: rgba(212,168,67,0.3); }
  .main .owned-badge.forsale { background: rgba(230,126,34,0.12); color: #c05a10; border-color: rgba(230,126,34,0.3); }
  .main input[type="text"], .main input[type="search"], .main select {
    background: #fffcf5; color: #2a2015; border-color: #d4c8a8;
  }
  .main input::placeholder { color: #a09080; }
  .main .filter-btn, .main .chip { background: #f0e6cc; color: #5a4e38; border-color: #d4c8a8; }
  .main .filter-btn:hover, .main .chip:hover { background: #e8ddc0; }

  html, body { height: 100%; font-family: var(--font-body); background: var(--bg); color: var(--text); font-size: 16px; }

  /* ── Accessibility: minimum font sizes for readability ─────── */
  /* Floor: nothing below 0.75rem (12px) for labels/badges, 0.85rem (13.6px) for body text */
  .nav-label { font-size: 0.7rem !important; }
  .stat-label { font-size: 0.68rem !important; }
  .section-title { font-size: 0.75rem !important; }
  .owned-badge.yes, .owned-badge.no, .owned-badge.want, .owned-badge.forsale { font-size: 0.72rem !important; }
  .mobile-nav-item { font-size: 0.72rem !important; }
  .info-field label { font-size: 0.78rem !important; }
  .form-field label { font-size: 0.78rem !important; }
  .input-group label { font-size: 0.78rem !important; }
  .item-num { font-size: 0.9rem !important; }
  .item-road { font-size: 0.85rem !important; }
  .cat-count { font-size: 0.8rem !important; }
  .report-table th { font-size: 0.75rem !important; }
  .report-table td { font-size: 0.88rem !important; }
  .auth-note { font-size: 0.82rem !important; }
  .browse-card-sub { font-size: 0.8rem !important; }
  .browse-card-name { font-size: 0.92rem !important; }
  .modal-item-num { font-size: 0.92rem !important; }
  .modal-subtitle { font-size: 0.88rem !important; }
  .info-field .info-val { font-size: 0.92rem !important; }
  .desc-block { font-size: 0.88rem !important; }
  .eph-title { font-size: 0.95rem !important; }
  .eph-year { font-size: 0.82rem !important; }
  .eph-val { font-size: 0.85rem !important; }
  /* Table header minimum */
  .item-table th { font-size: 0.75rem !important; }
  /* Ephemera type badge */
  .eph-type-badge { font-size: 0.72rem !important; }
  /* Identify confidence */
  .identify-conf { font-size: 0.72rem !important; }

  /* ── Item detail: photo fills the space beside the description ──
     (v0.9.1010, Brad — supersedes the fixed 340px strip of v0.9.1009.)
     Desktop only. The header/description and the photo card share a
     two-column grid; the photo column takes every pixel the text doesn't
     use, and the hero may grow to 70% of the window height. The toolbar,
     details card and galleries render full width BELOW the pair, so a
     grouped item's per-member galleries are untouched. */
  .rr-detail-wrap { display: block; }
  @media (min-width: 1000px) {
    .rr-detail-wrap {
      display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
      gap: 1.5rem; align-items: start;
    }
    .rr-detail-main { min-width: 0; }
    .rr-detail-side img { max-height: 70vh; }
    /* the thumbnail rail sits UNDER the hero here, not beside it */
    .rr-detail-side #item-detail-photos { flex-direction: column; }
  }

  /* ── Buttons — ONE rule (v0.9.1005, Brad) ────────────────────────────
     Brad's insight: the outline should BE the text colour. So a button has
     exactly ONE value to set — `--rr-c` — and the label, the border and the
     fill all derive from it. Nothing to keep in sync, and a new button in a
     new colour is correct automatically.

       <button class="rr-btn">…</button>                  ghost, cream
       <button class="rr-btn fill">…</button>             filled, cream
       <button class="rr-btn rr-btn--quiet">…</button>    ghost, secondary
       <button class="rr-btn fill rr-btn--accent">…</button>

     House rule: the PRIMARY action is `fill`, the secondary is a plain ghost
     — never the reverse, or the eye lands on Cancel first.
     Replaces hand-written inline border/background/color on every button;
     that drift is why the old buttons stopped matching each other. */
  .rr-btn {
    --rr-c: var(--cream, #f8e8c0);
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    font-family: var(--font-body); font-size: 0.85rem; font-weight: 700; line-height: 1.2;
    padding: 0.55rem 1.15rem; border-radius: 9px; cursor: pointer;
    color: var(--rr-c); border: 2px solid var(--rr-c); background: transparent;
    box-sizing: border-box; min-height: 40px;
    transition: background 0.15s, color 0.15s, filter 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .rr-btn.fill { background: var(--rr-c); color: #14171f; }
  .rr-btn:hover  { filter: brightness(1.12); }
  .rr-btn:active { transform: translateY(1px); }
  .rr-btn:focus-visible { outline: 2px solid var(--accent2, #d4a843); outline-offset: 2px; }
  .rr-btn[disabled], .rr-btn:disabled { opacity: 0.38; cursor: not-allowed; filter: none; transform: none; }
  /* colour variants — set ONE value */
  .rr-btn--quiet  { --rr-c: #9a8f6e; }
  .rr-btn--green  { --rr-c: #3fd67f; }
  .rr-btn--accent { --rr-c: var(--accent, #f05008); }
  .rr-btn--danger { --rr-c: #ff7a3d; }
  /* phones: same shape, a little tighter */
  @media (max-width: 560px) {
    .rr-btn { font-size: 0.82rem; padding: 0.5rem 0.9rem; min-height: 42px; }
  }

  /* ── Auth Screen ───────────────────────────────────────────── */
  /* v0.9.997 (Brad): two-column on desktop so "Continue with Google" sits
     above the fold. Brand + feature blurbs left, sign-in card right; stacks
     to a single column at 900px. The old .auth-logo gradient (background-clip
     + transparent text fill) silently overrode the orange "Rail" — the
     wordmark is plain cream + accent now, matching the invite gate. */
  #auth-screen {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 100vh; padding: 1.5rem;
    background: radial-gradient(ellipse at 30% 20%, #1a1f3a 0%, var(--bg) 60%),
                radial-gradient(ellipse at 80% 80%, #2a1008 0%, transparent 50%);
  }
  /* NOTE: these five set box-sizing explicitly on purpose. The global reset
     at the top of this file is not reaching the page (see the stray <style>
     on line 1), so width:100% + padding would otherwise overflow on phones. */
  #auth-screen, .auth-wrap, .auth-brand, .auth-card, .auth-feature { box-sizing: border-box; }
  .auth-wrap {
    display: flex; align-items: center; justify-content: center;
    gap: 3rem; width: 100%; max-width: 980px;
  }
  .auth-brand { flex: 1 1 0; min-width: 0; max-width: 520px; text-align: left; }
  .auth-conductor {
    height: clamp(130px, 18vh, 200px); width: auto; display: block;
    margin-bottom: 0.7rem;
  }
  .auth-wordmark {
    font-family: var(--font-head); font-size: clamp(1.8rem, 3.3vw, 2.75rem);
    font-weight: 700; color: var(--cream); letter-spacing: 0.05em;
    text-transform: uppercase; line-height: 1.05; white-space: nowrap;
  }
  .auth-tagline {
    font-family: var(--font-head); font-weight: 400; font-size: 0.88rem;
    letter-spacing: 0.24em; text-transform: uppercase;
    color: var(--text-dim); margin-top: 0.55rem;
  }
  .auth-features { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 1.5rem; }
  .auth-feature {
    display: block;
    background: rgba(200,16,46,0.06); border-radius: 10px; padding: 0.95rem 1.15rem;
  }
  /* v0.9.999: right side is a COLUMN of two cards — action, then help. */
  .auth-col {
    flex: 0 0 auto; width: 100%; max-width: 400px;
    display: flex; flex-direction: column; gap: 0.9rem; box-sizing: border-box;
  }
  .auth-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; padding: 2rem; width: 100%;
    flex: 0 0 auto; text-align: center;
  }
  /* ── The one loud thing on the page ──────────────────────────────────
     Solid amber with near-black text. Everything else on this screen is
     light-text-on-dark, so an inverted block is the only treatment that
     can't be skimmed past. Welded to the button below it: no gap, flat
     bottom corners, so the two read as a single unit. */
  .auth-alert {
    background: #d4a843; color: #14171f;
    border-radius: 10px 10px 0 0; padding: 0.8rem 0.95rem 0.85rem;
    text-align: left; box-sizing: border-box;
    box-shadow: 0 0 0 1px rgba(212,168,67,0.9), 0 6px 18px rgba(212,168,67,0.18);
  }
  .auth-alert-head {
    font-family: var(--font-head); font-weight: 700; font-size: 0.82rem;
    letter-spacing: 0.09em; text-transform: uppercase;
    margin-bottom: 0.3rem; color: #14171f;
  }
  .auth-alert-body { font-size: 0.83rem; line-height: 1.5; color: #14171f; }
  .auth-alert-body strong { color: #14171f; font-weight: 700; }
  .auth-alert-body u { text-decoration-thickness: 2px; text-underline-offset: 2px; }
  .btn-google-welded { border-radius: 0 0 8px 8px !important; }
  /* Secondary card: same shape, deliberately quieter — no fill, dim border. */
  .auth-help-card {
    background: transparent; border: 1px solid var(--border);
    border-radius: 16px; padding: 1.25rem 1.35rem; width: 100%;
    text-align: left; box-sizing: border-box;
  }
  /* v0.9.1001 (Brad): match the '.auth-card h2' treatment exactly — same
     size, weight, colour and centring — so the two cards read as siblings. */
  .auth-help-title {
    font-size: 1.1rem; font-weight: 500; color: var(--text);
    text-align: center; margin-bottom: 0.9rem;
  }
  .auth-help-q { font-size: 0.85rem; font-weight: 600; color: var(--cream); margin-bottom: 0.3rem; }
  .auth-help-a { font-size: 0.8rem; color: var(--text-mid); line-height: 1.6; margin: 0 0 1rem; }
  .auth-help-btn {
    display: block; width: 100%; padding: 0.8rem 0.9rem; box-sizing: border-box;
    background: var(--surface2); border: 1px solid var(--border); border-radius: 10px;
    color: var(--text); font-family: var(--font-body); font-size: 0.92rem;
    font-weight: 600; cursor: pointer; text-align: left; line-height: 1.4;
  }
  /* Phones / narrow windows: back to one centered column. */
  @media (max-width: 900px) {
    .auth-wrap { flex-direction: column; gap: 1.5rem; max-width: 420px; }
    .auth-brand { flex: none; width: 100%; text-align: center; max-width: 420px; }
    .auth-col { max-width: 420px; }
    .auth-card { width: 100%; }
    .auth-conductor { margin: 0 auto 0.5rem; }
    .auth-feature { text-align: left; }
  }
  /* Phones: tighten the brand block so the Google button lands at/near the
     fold instead of a screen-and-a-half down. */
  @media (max-width: 560px) {
    #auth-screen { padding: 1rem; }
    .auth-wrap { gap: 1rem; }
    .auth-conductor { height: 80px; }
    .auth-features { gap: 0.4rem; margin-top: 0.8rem; }
    .auth-feature { padding: 0.5rem 0.7rem; }
    /* blurb text is set inline on the inner div — needs !important to trim */
    .auth-feature > div { font-size: 0.88rem !important; line-height: 1.5 !important; }
    .auth-card { padding: 1.25rem 1.1rem; }
    .auth-help-card { padding: 1rem 1.1rem; }
    .auth-col { gap: 0.75rem; }
  }
  /* Short laptop screens: trim the artwork so the card still clears. */
  @media (min-width: 901px) and (max-height: 720px) {
    .auth-conductor { height: 92px; }
    .auth-features { gap: 0.4rem; margin-top: 0.9rem; }
    .auth-feature { padding: 0.5rem 0.8rem; }
  }
  .auth-card h2 { font-size: 1.1rem; font-weight: 500; margin-bottom: 0.5rem; }
  .auth-card p { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 2rem; line-height: 1.6; }
  /* v0.9.999: the rule above also put 2rem under the LAST paragraph, leaving
     a band of dead space at the bottom of the action card. */
  .auth-card p:last-child { margin-bottom: 0; }

  .btn-google {
    display: flex; align-items: center; justify-content: center; gap: 0.75rem;
    width: 100%; padding: 0.85rem 1.5rem;
    background: #fff; color: #333; border: none; border-radius: 8px;
    font-family: var(--font-body); font-size: 0.95rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s;
  }
  .btn-google:hover { background: #f0f0f0; transform: translateY(-1px); box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
  .btn-google svg { width: 20px; height: 20px; flex-shrink: 0; }

  .auth-note {
    margin-top: 1.5rem; font-size: 0.75rem; color: var(--text-dim); line-height: 1.5;
  }

  /* ── App Shell ─────────────────────────────────────────────── */
  /* v0.9.1020 (Brad, phones): dvh not vh — on iPhone Safari 100vh counts the
     area BEHIND the browser toolbar, so the shell was taller than the visible
     screen and the bottom nav could hide under the chrome. dvh tracks the
     real visible height; it falls back cleanly on older browsers via the
     vh line above it. */
  #app { display: none; height: 100vh; height: 100dvh; flex-direction: column; overflow: hidden; }
  #app.active { display: flex; }

  /* Header */
  .header {
    position: relative;   /* v0.9.1213: so the collector's line can centre in it */
    /* v0.9.1223. Brad, boxing the top bar: "the blue area inside of my box,
       needs to be selectable as well. the area left of my box will keep the
       same becasue that is our apps logo and we won't change that."
       It read --navy, which no skin has ever touched, while the preview's
       own header read --surface — so the mock showed the bar recolouring
       and the real one never did. The label on that control has said
       "cards · sidebar · top bar" since the day it was written; the top bar
       simply was not wired to it. The conductor and the wordmark to its
       left are untouched. */
    height: var(--header-h); background: var(--surface, var(--navy,#1a1d3a));
    border-bottom: 4px solid #2980b9;   /* v0.9.914 (Brad): doubled 2px -> 4px */
    display: flex; align-items: center; padding: 0 1.25rem;
    gap: 1rem; flex-shrink: 0; z-index: 100;
  }
  .header-logo { font-family: var(--font-head); flex-shrink: 0; line-height: 1.2; }
  .sidebar { background: var(--surface); }
  .sidebar .nav-label { color: var(--text-dim); }
  /* Lionel box-style brand header in sidebar */
  .sidebar-logo-wrap { background: var(--navy,#1a1d3a); border-bottom: 2px solid #2980b9; padding: 1.2rem 1rem; }
  .header-search {
    flex: 1; max-width: 480px;
    display: flex; align-items: center; gap: 0.5rem;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; padding: 0.4rem 0.75rem;
  }
  .header-search input {
    flex: 1; background: none; border: none; outline: none;
    color: var(--text); font-family: var(--font-body); font-size: 0.9rem;
  }
  .header-search input::placeholder { color: var(--text-dim); }
  .header-search svg { color: var(--text-dim); flex-shrink: 0; }
  .header-right { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
  .user-chip {
    display: flex; align-items: center; gap: 0.5rem;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 20px; padding: 0.3rem 0.75rem 0.3rem 0.3rem;
    font-size: 0.8rem; cursor: pointer; user-select: none;
    transition: border-color 0.2s, background 0.2s;
  }
  .user-chip:hover { border-color: var(--accent); background: var(--surface); }
  .user-avatar {
    width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 600; color: white; overflow: hidden;
  }
  /* Account dropdown menu */
  .account-menu {
    position: absolute; top: calc(100% + 8px); right: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; min-width: 220px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.45);
    z-index: 9000; overflow: hidden;
  }
  .account-menu-header {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.9rem 1rem;
  }
  .account-menu-avatar {
    width: 38px; height: 38px; border-radius: 50%; background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; font-weight: 700; color: white;
    flex-shrink: 0; overflow: hidden;
  }
  .account-menu-name { font-weight: 600; font-size: 0.88rem; color: var(--text); }
  .account-menu-email { font-size: 0.75rem; color: var(--text-dim); margin-top: 1px; }
  .account-menu-divider { height: 1px; background: var(--border); margin: 0; }
  .account-menu-item {
    display: flex; align-items: center; gap: 0.65rem;
    width: 100%; padding: 0.75rem 1rem;
    background: none; border: none; color: var(--text-mid);
    font-family: var(--font-body); font-size: 0.85rem;
    cursor: pointer; text-align: left; transition: background 0.15s, color 0.15s;
  }
  .account-menu-item:hover { background: rgba(255,255,255,0.06); color: var(--text); }
  .account-menu-signout { color: var(--accent); }
  .account-menu-signout:hover { background: rgba(240,80,8,0.1); color: var(--accent); }

  /* Body layout */
  .app-body { display: flex; flex: 1; overflow: hidden; }

  /* Sidebar Nav */
  .sidebar {
    width: var(--sidebar-w); background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column; flex-shrink: 0;
    overflow-y: auto; overflow-x: hidden;
  }
  .nav-section { padding: 0.3rem 0.75rem 0.2rem; }
  .nav-label { font-family: var(--font-head); font-size: 0.58rem; letter-spacing: 0.2em; text-transform: uppercase;
    color: var(--text-dim); padding: 0 0.5rem; margin-bottom: 0.4rem; }
  .nav-item {
    display: flex; align-items: center; gap: 0.65rem;
    padding: 0.45rem 0.75rem; border-radius: 7px; cursor: pointer;
    color: var(--text-mid); font-size: 0.92rem; font-weight: 400;
    transition: all 0.15s; border: none; background: none; width: 100%; text-align: left;
  }
  .nav-item:hover { background: var(--surface2); color: var(--text); }
  .nav-item.active { background: rgba(139,142,148,0.12); color: #2980b9; font-family: var(--font-body); font-weight: 500; }
  .nav-item svg { flex-shrink: 0; opacity: 0.8; }
  .nav-badge {
    margin-left: auto; background: var(--accent); color: white;
    border-radius: 10px; padding: 0.1rem 0.45rem; font-size: 0.7rem; font-weight: 600;
  }
  .nav-badge.green { background: var(--green); }

  /* Main content */
  /* v0.9.1241: position + z-index:0 make .main a stacking context, which is
     what lets the watermark sit at z-index:-1 — above .main's own cream
     background, below every card, list and photograph inside it. Without
     these two values the watermark is painted behind the cream and vanishes.
     See applyLogoBackdrop in appearance.js. */
  .main { flex: 1; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem;
          position: relative; z-index: 0; }

  /* ── The Appearance editor's paper (v0.9.1206) ──────────────────
     Brad: "this whole page is super dark, its hard to see anything.
     This should be the cream background."

     The cause was structural, not cosmetic: the editor painted itself
     with the very skin it was editing, so designing a dark skin made
     the tool unreadable. The chrome now has its own palette that never
     changes; only the preview inside it repaints.

     Deliberately named --p-* rather than --bg/--surface/--text so it
     can NEVER shadow the skin variables the preview replica reads.
     Values match the light .main island above — one cream, not two. */
  /* ── The collector's own dashboard cards (v0.9.1211) ────────────
     A large card spans two columns of the stats grid; below the grid's
     two-column breakpoint it takes the full width instead, so it can
     never be squeezed narrower than a small one. */
  .stat-card.rr-lc-wide { grid-column: span 2; }
  .rr-lc { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 66px; }
  .rr-lc-t { text-align: center; line-height: 1.25; max-width: 100%; overflow-wrap: anywhere; }
  .rr-lc-empty { text-align: center; color: var(--text-dim); font-size: 0.82rem; padding: 1.2rem 0; }

  /* the composer */
  #rrlc-pop { position: fixed; inset: 0; z-index: 99960; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 1rem; overflow-y: auto; }
  .rrlc-box { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; max-width: 720px; width: 100%; max-height: 92vh; overflow-y: auto; padding: 1.1rem 1.2rem; color: var(--text); font-family: var(--font-body); }
  .rrlc-h { font-family: var(--font-head); font-size: 1rem; font-weight: 700; margin-bottom: 0.15rem; }
  .rrlc-sub, .rrlc-empty, .rrlc-note { font-size: 0.75rem; color: var(--text-dim); line-height: 1.5; margin-bottom: 0.7rem; }
  .rrlc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 0.7rem; }
  .rrlc-item { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
  .rrlc-prev { border: 1px solid var(--border); border-radius: 10px; padding: 0.5rem; background: var(--surface2); cursor: pointer; }
  .rrlc-prev:hover { border-color: var(--accent); }
  .rrlc-prevbig { cursor: default; padding: 0.9rem; }
  .rrlc-name { font-size: 0.76rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rrlc-row { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
  .rrlc-btn { font-size: 0.76rem; padding: 0.35rem 0.7rem; border-radius: 8px; border: 1px solid var(--border-hi, var(--border)); background: var(--surface2); color: var(--text); font-family: var(--font-body); cursor: pointer; }
  .rrlc-btn:hover { border-color: var(--accent); }
  .rrlc-btn.rrlc-go { background: var(--accent); border-color: var(--accent); color: var(--on-accent, var(--text)); font-weight: 600; }
  .rrlc-2col { display: flex; gap: 1rem; flex-wrap: wrap; }
  .rrlc-2col > div { flex: 1; min-width: 220px; }
  .rrlc-drop { aspect-ratio: 1/1; border: 2px dashed var(--border-hi, var(--border)); border-radius: 14px; background: var(--surface2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem; text-align: center; font-size: 0.76rem; color: var(--text-dim); cursor: pointer; padding: 0.8rem; overflow: hidden; }
  .rrlc-drop:hover { border-color: var(--accent); }
  .rrlc-drop img { max-width: 100%; max-height: 100%; object-fit: contain; }
  .rrlc-l { display: block; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin: 0.5rem 0 0.15rem; }
  .rrlc-in { width: 100%; box-sizing: border-box; padding: 0.45rem 0.6rem; border-radius: 8px; border: 1.5px solid var(--border); background: var(--surface2); color: var(--text); font-family: var(--font-body); font-size: 0.84rem; }
  .rrlc-col { display: block; width: 100%; height: 32px; margin-top: 0.15rem; border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface2); cursor: pointer; }

  /* ── A collector's own marks (v0.9.1209) ────────────────────────
     Three slots, three homes: a faint watermark behind everything, a
     mark at the foot of the menu, and a mark and/or a typed line in the
     top bar beside THE RAIL ROSTER. Screen only, this device only —
     nothing here is ever drawn on a share card or a PDF.
     Sizes are capped here rather than in script so a very tall logo can
     never push the menu or stretch the header. */
  #rr-brand-header {
    position: absolute; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 0.55rem;
    max-width: 46vw; min-width: 0; overflow: hidden;
    pointer-events: none;
  }
  #rr-brand-header img { height: 38px; width: auto; display: block; flex-shrink: 0; }
  #rr-brand-header span {
    font-size: 1.05rem; letter-spacing: 0.04em; line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* margin-top:auto drops it to the foot of the menu — .sidebar is
     already a flex column, so this needs no other change. */
  #rr-brand-sidebar { margin-top: auto; padding: 1rem 0.9rem 1.2rem; display: flex; justify-content: center; }
  #rr-brand-sidebar img { max-width: 100%; max-height: 110px; width: auto; object-fit: contain; }
  @media (max-width: 900px) {
    #rr-brand-header span { display: none; }
    #rr-brand-header img { height: 28px; }
  }

  /* v0.9.1221: the pop-ups live on <body>, OUTSIDE #rrap, so they never
     inherited this palette and every var(--p-*) in them resolved to
     nothing — which renders as transparent. That is why the colour grid
     and the chooser had the app showing straight through them, and why
     three screenshots looked like something was painting over the picker
     when hit-testing said it was on top. It was on top; it was see-through. */
  #rrap, #rrap-prevbar, #rrap-mini, #rrap-pal, #rrap-tip, #rrap-what, #rrap-save {
    --p-paper:   #f8e8c0;
    --p-panel:   #fffdf6;
    --p-panel2:  #f5eeda;
    --p-line:    #d4c8a8;
    --p-line-hi: #c0b090;
    --p-ink:     #2a2015;
    --p-ink-mid: #5a4e38;
    --p-ink-dim: #8a7e68;
    --p-accent:  #b8480f;
  }

  /* ── Dashboard ─────────────────────────────────────────────── */
  .page { display: none; }
  .page.active { display: contents; }

  /* v0.9.817 (Brad): ONE title style on every page — matches My Collection
     (compact, bold, uppercase). Title text may be bare or in a span; a
     NESTED span is the count/stat suffix (small + dim). */
  .page-title {
    font-family: var(--font-head); font-size: 0.95rem; font-weight: 700;
    letter-spacing: 0.04em; text-transform: uppercase; color: var(--text);
    display: flex; align-items: baseline; gap: 0.75rem;
  }
  .page-title span { font-family: inherit; font-size: inherit;
    color: inherit; font-weight: inherit; letter-spacing: inherit; }
  .page-title span span { font-family: var(--font-body); font-size: 0.8rem;
    color: var(--text-dim); font-weight: 400; letter-spacing: 0; text-transform: none; }

  /* Stat cards */
  .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.6rem; }
  .stat-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0.75rem 0.85rem; position: relative;
    /* v0.9.876 (Brad): cap card height so one long card (Era Progress)
       can't stretch the whole row — anything taller scrolls inside. */
    max-height: 18rem; overflow-y: auto; overflow-x: hidden;
    transition: border-color 0.2s, transform 0.15s;
  }
  .stat-card::-webkit-scrollbar { width: 5px; }
  .stat-card::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
  /* v0.9.877 (Brad): From My Collection — photo centered in the card.
     The card becomes a flex column (label on top) and the reel host
     fills the leftover height, centering the photo block both ways. */
  .stat-card:has(.reel-host) { display: flex; flex-direction: column; }
  .reel-host { flex: 1; display: flex; align-items: center; justify-content: center; }
  .stat-card::before { content:''; position:absolute; top:0; left:0; right:0; height:2px; background:var(--card-accent,var(--accent)); }
  .stat-card:hover { border-color: var(--border-light,#354870); transform: translateY(-1px); }
  .stat-label { font-family: var(--font-head); font-size: 0.58rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 0.25rem; }
  .stat-value { font-family: var(--font-head); font-size: clamp(1.25rem, 1rem + 0.9vw, 1.95rem); font-weight: 700; letter-spacing: 0.02em;
    line-height: 1; color: var(--text); }
  .stat-sub { font-size: 0.7rem; color: var(--text-dim); margin-top: 0.2rem; }

  .section-title { font-family: var(--font-head); font-size: 0.68rem; font-weight: 600;
    letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--text-dim); margin-bottom: 0.75rem; padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.45rem;
  }
  .section-title::before { content: ''; width: 3px; height: 11px; background: var(--accent); border-radius: 2px; flex-shrink: 0; }

  .cat-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem; display: flex; align-items: center; gap: 0.75rem;
    cursor: pointer; transition: all 0.15s;
  }
  .cat-card:hover { border-color: var(--accent); transform: translateY(-1px); }
  .cat-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--surface2);
    display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
  .cat-info { flex: 1; min-width: 0; }
  .cat-name { font-weight: 500; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cat-count { font-size: 0.75rem; color: var(--text-dim); }
  .cat-bar { height: 3px; background: var(--border); border-radius: 2px; margin-top: 0.4rem; }
  .cat-bar-fill { height: 100%; border-radius: 2px; background: var(--accent); transition: width 0.8s ease; }

  /* Recent / want list */
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
  @media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

  .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; max-height: 420px; overflow-y: auto; }
  /* v0.9.891 (Brad): dashboard panels never scroll — they size to their
     content (the photo grids trim to full rows instead of overflowing). */
  #dash-panels-host .panel { max-height: none; overflow-y: visible; }
  .two-col .panel { max-height: calc(100vh - 440px); max-height: calc(100dvh - 440px); overflow-y: auto; }   /* v0.9.1020: dvh for iPhone */

  /* ── Browse / Search Page ──────────────────────────────────── */
  .filter-bar {
    display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
  }
  .filter-select {
    background: var(--surface); border: 1px solid var(--border); border-radius: 7px;
    padding: 0.45rem 0.75rem; color: var(--text); font-family: var(--font-body); font-size: 0.85rem;
    outline: none; cursor: pointer; transition: border-color 0.15s;
  }
  .filter-select:focus { border-color: var(--accent); }
  .filter-toggle {
    padding: 0.45rem 0.75rem; border-radius: 7px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-mid); font-size: 0.85rem;
    font-family: var(--font-body); cursor: pointer; transition: all 0.15s;
  }
  .filter-toggle.on { background: rgba(232,64,28,0.15); border-color: var(--accent); color: var(--accent); }

  /* Item table */
  .table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
  .item-table { width: 100%; border-collapse: collapse; }
  .item-table th {
    background: var(--surface); padding: 0.55rem 0.85rem; text-align: left;
    font-family: var(--font-head); font-size: 0.6rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--text-dim); border-bottom: 2px solid var(--border);
  }
  .item-table td {
    padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
    font-size: 0.85rem; vertical-align: middle;
  }
  .item-table tr:last-child td { border-bottom: none; }
  /* v0.9.816 (Brad): maximize visible rows in My Collection — tighter row
     padding (collection view only) and slimmer header spacing on browse. */
  .item-table.collection-view td { padding: 0.45rem 0.75rem; }
  #page-browse > .page-title { margin-bottom: 0.3rem; }
  #hierarchy-chip-row { margin-bottom: 0.35rem; }
  .item-table tr:hover td { background: var(--surface2); cursor: pointer; }
  /* Sticky column headers — works on all scrollable table-wraps */
  .item-table thead th,
  .report-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface3);
    box-shadow: 0 1px 0 var(--border);
  }
  .main .item-table thead th,
  .main .report-table thead th { background: #f0e6cc; box-shadow: 0 1px 0 #d4c8a8; }
  @media print { .table-wrap { max-height: none !important; overflow: visible !important; } }

  /* Browse table wrapper: vertical + horizontal scroll with sticky headers */
  .browse-table-wrap { overflow-x: auto; overflow-y: auto; }
  /* Collection view: fills container width, no horizontal scroll */
  #page-browse .item-table.collection-view { table-layout: fixed; width: 100%; min-width: 0; }
  #page-browse .item-table.collection-view th:nth-child(1),
  #page-browse .item-table.collection-view td:nth-child(1) { width: 54px; }
  .item-table.collection-view th:nth-child(2),
  #page-browse .item-table.collection-view td:nth-child(2) { width: 92px; }
  .item-table.collection-view th:nth-child(3),
  #page-browse .item-table.collection-view td:nth-child(3) { width: 44px; }
  .item-table.collection-view th:nth-child(4),
  #page-browse .item-table.collection-view td:nth-child(4) { width: 66px; }
  .item-table.collection-view th:nth-child(5),
  #page-browse .item-table.collection-view td:nth-child(5) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .item-table.collection-view th:nth-child(6),
  #page-browse .item-table.collection-view td:nth-child(6) { width: 58px; }
  .item-table.collection-view th:nth-child(7),
  #page-browse .item-table.collection-view td:nth-child(7) { width: 250px; text-align: right; }
  /* Actions buttons wrap within their column instead of forcing sideways scroll */
  #page-browse .item-table.collection-view .coll-actions-cell { white-space: normal; }
  /* Phones: drop the Actions column; tap a row to open its detail (all actions there) */
  @media (max-width: 760px) {
    #page-browse .item-table.collection-view th:nth-child(7),
    #page-browse .item-table.collection-view td:nth-child(7) { display: none; }
  }
  /* Tighter rows + headers to fit more on a page */
  #page-browse .item-table.collection-view td { padding: 0.4rem 0.55rem; vertical-align: top; }
  #page-browse .item-table.collection-view th { padding: 0.4rem 0.55rem; line-height: 1.1; }
  /* Compact action buttons — wrap text so they don't force horizontal scroll */
  #page-browse .item-table.collection-view td:last-child button {
    white-space: normal; line-height: 1.15; padding: 0.2rem 0.3rem; max-width: 58px; text-align: center;
  }

  /* ── Master Catalog: Var. column narrower ── */
  #page-browse .item-table:not(.collection-view) th:nth-child(4),
  #page-browse .item-table:not(.collection-view) td:nth-child(4) { width: 55px; }

  /* ── Utility classes (extracted from repeated inline styles) ── */
  .ui-empty { text-align:center;padding:2rem;color:var(--text-dim) }
  .field-label { font-size:0.7rem;font-weight:700;text-transform:uppercase;letter-spacing:0.08em;color:var(--text-dim);margin-bottom:0.3rem }

  .item-num { font-family: var(--font-mono); font-size: 0.82rem; color: var(--accent2); font-weight: 600; }
  .item-road { color: var(--text-dim); font-size: 0.8rem; }
  .owned-badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.2rem 0.55rem; border-radius: 12px; font-size: 0.72rem; font-weight: 500;
  }
  .owned-badge.yes  { background: rgba(46,204,113,0.15); color: #4dc880; border: 1px solid rgba(46,204,113,0.3); font-family: var(--font-head); font-size: 0.62rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; }
  .owned-badge.no   { background: var(--surface2); color: var(--text-dim); font-family: var(--font-head); font-size: 0.62rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; }
  .owned-badge.want { background: rgba(212,168,67,0.15); color: #e8c060; border: 1px solid rgba(212,168,67,0.3); font-family: var(--font-head); font-size: 0.62rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; }
  .owned-badge.forsale { background: rgba(230,126,34,0.15); color: #e67e22; border: 1px solid rgba(230,126,34,0.3); font-family: var(--font-head); font-size: 0.62rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; }

  /* Set membership badge — teal, distinct from purple group badge */
  .badge-set {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.15rem 0.5rem; border-radius: 10px;
    background: rgba(8,145,178,0.15); color: #0891b2;
    border: 1px solid rgba(8,145,178,0.35);
    font-family: var(--font-head); font-size: 0.6rem; font-weight: 600;
    letter-spacing: 0.07em; text-transform: uppercase; white-space: nowrap;
  }

  /* Tools page */
  .tools-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; padding: 1.5rem; margin-bottom: 1.5rem;
  }
  /* v0.9.823 (Brad): Collection Tools fits one desktop screen — cards sit
     in a 2-up grid with tighter padding; stacks back to 1-col on phones. */
  @media (min-width: 900px) {
    #universal-body, #lionel-body {
      display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
      gap: 0.75rem; align-items: start;
    }
    #universal-body .tools-card, #lionel-body .tools-card { margin-bottom: 0; padding: 1rem 1.1rem; }
    #page-tools .tools-card-desc { font-size: 0.8rem; line-height: 1.45; margin-bottom: 0.7rem; }
  }
  .tools-card-title {
    font-family: var(--font-head); font-size: 1rem; font-weight: 700;
    letter-spacing: 0.05em; text-transform: uppercase; color: var(--text);
    margin-bottom: 0.25rem; display: flex; align-items: center; gap: 0.5rem;
  }
  .tools-card-desc { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 1rem; line-height: 1.5; }
  .tools-result-row {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.65rem 0.75rem; border-radius: 9px;
    background: var(--surface2); border: 1px solid var(--border);
    margin-bottom: 0.5rem;
  }
  .tools-set-row {
    border: 1px solid var(--border); border-radius: 10px;
    margin-bottom: 0.6rem; overflow: hidden;
  }
  .tools-set-header {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.7rem 0.9rem; cursor: pointer;
    background: var(--surface2); transition: background 0.15s;
  }
  .tools-set-header:hover { background: var(--surface); }
  .tools-set-body { padding: 0.75rem 0.9rem; display: none; border-top: 1px solid var(--border); }
  .tools-set-body.open { display: block; }
  .tools-progress-bar {
    flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden;
  }
  .tools-progress-fill { height: 100%; background: #0891b2; border-radius: 3px; transition: width 0.3s; }
  .condition-pip {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    margin-right: 0.25rem;
  }
  .cond-9, .cond-10 { background: #2ecc71; }
  .cond-7, .cond-8  { background: #f1c40f; }
  .cond-5, .cond-6  { background: #e67e22; }
  .cond-low         { background: #e74c3c; }

  .table-pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1rem; border-top: 1px solid var(--border);
    font-size: 0.8rem; color: var(--text-dim);
  }
  .pagination-btns { display: flex; gap: 0.35rem; }
  .page-btn {
    width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-mid); cursor: pointer;
    font-size: 0.8rem; font-family: var(--font-body); transition: all 0.15s;
    display: flex; align-items: center; justify-content: center;
  }
  .page-btn:hover { border-color: var(--accent); color: var(--accent); }
  .page-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
  .page-btn:disabled { opacity: 0.3; cursor: default; }

  /* ── Item Detail Modal ─────────────────────────────────────── */
  /* v0.9.753 (Brad): big cards side-by-side on desktop, stacked on phones */
  @media (max-width: 767px) {
    #dash-panels-host { flex-wrap: wrap; }
    #dash-panels-host .panel { flex: 1 1 100% !important; }
  }
  .modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 200;
    display: flex; align-items: center; justify-content: center; padding: 1rem;
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
  }
  .modal-overlay.open { opacity: 1; pointer-events: all; }
  .modal {
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    width: 100%; max-width: 680px; max-height: 92vh; max-height: 92dvh; overflow-y: auto;   /* v0.9.1020: dvh for iPhone */
    transform: translateY(20px); transition: transform 0.2s;
  }
  #wizard-modal .modal {
    overflow: hidden; display: flex; flex-direction: column;
    transition: background 0.3s, border-color 0.3s;
  }
  /* ── Wizard tab themes ──────────────────────────────────────────────────
     v0.9.1137 (Brad): all three wizards now sit on the app's own background
     instead of three tinted washes — collection was #1a0e08 (brown), want
     #08101a, sold #081a0e. The tint was carrying the "which list am I adding
     to?" signal; that job now belongs entirely to the ACCENT — the border, the
     progress bar and the Next button — which was always the louder signal
     anyway. Orange = Collection, blue = Want, green = Sold, unchanged.

     Using var(--bg) rather than a literal fixes a second thing for free. The
     light theme (html[data-theme="light"]) redefines --bg to cream #f8e8c0 and
     --text to near-black, but it never overrode these three hardcoded darks —
     so in light mode the wizard was dark-brown-on-dark with near-black text.
     Following the variable means the wizard tracks whatever theme is active. */
  /* v0.9.1146 (Brad): the top bar is ONE colour — orange, var(--accent) — on
     every pop-up, every flow. v0.9.1145 tried flow-coloured bars (blue on
     Want, green on Sold); he did not ask for that: "just make them all the
     same color. i didn't say color cordinate." The flow identity stays where
     it always was — the progress line and the Next button. */
  #wizard-modal .modal { border-top: 3px solid var(--accent); }
  #wizard-modal .modal.wiz-collection {
    background: var(--bg);
    border-color: rgba(232,64,28,0.4);
    border-top: 3px solid var(--accent);
  }
  #wizard-modal .modal.wiz-collection .modal-header {
    background: var(--bg);
    border-bottom-color: rgba(232,64,28,0.25);
  }
  #wizard-modal .modal.wiz-collection #wizard-progress { background: var(--accent); }
  #wizard-modal .modal.wiz-collection .modal-footer {
    background: var(--bg);
    border-top-color: rgba(232,64,28,0.25);
  }
  #wizard-modal .modal.wiz-want {
    background: var(--bg);
    border-color: rgba(41,128,185,0.4);
    border-top: 3px solid var(--accent);
  }
  #wizard-modal .modal.wiz-want .modal-header {
    background: var(--bg);
    border-bottom-color: rgba(41,128,185,0.25);
  }
  #wizard-modal .modal.wiz-want #wizard-progress { background: #2980b9; }
  #wizard-modal .modal.wiz-want .modal-footer {
    background: var(--bg);
    border-top-color: rgba(41,128,185,0.25);
  }
  #wizard-modal .modal.wiz-sold {
    background: var(--bg);
    border-color: rgba(46,204,113,0.4);
    border-top: 3px solid var(--accent);
  }
  #wizard-modal .modal.wiz-sold .modal-header {
    background: var(--bg);
    border-bottom-color: rgba(46,204,113,0.25);
  }
  #wizard-modal .modal.wiz-sold #wizard-progress { background: #2ecc71; }
  #wizard-modal .modal.wiz-sold .modal-footer {
    background: var(--bg);
    border-top-color: rgba(46,204,113,0.25);
  }
  .modal-overlay.open .modal { transform: translateY(0); }

  .modal-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 1.5rem 1.5rem 1rem; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: var(--surface); z-index: 1;
  }
  .modal-item-num { font-family: var(--font-mono); font-size: 0.9rem; color: var(--text); font-weight: 600; margin-bottom: 0.25rem; }
  .modal-title { font-size: 1.2rem; font-weight: 700; color: var(--text); }
  .modal-subtitle { font-size: 0.82rem; color: var(--text-dim); margin-top: 0.2rem; }
  .btn-close {
    width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border);
    background: var(--surface2); color: var(--text-dim); cursor: pointer;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    font-size: 1rem; transition: all 0.15s;
  }
  .btn-close:hover { border-color: var(--accent); color: var(--accent); }

  .modal-body { padding: 1.25rem 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; flex: 1; overflow-y: auto; }

  .info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  @media (max-width: 480px) { .info-grid { grid-template-columns: 1fr; } }
  .info-field { }
  .info-field label { font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--text-dim); display: block; margin-bottom: 0.25rem; }
  .info-field .info-val { font-size: 0.875rem; color: var(--text); }
  .info-field a { color: var(--accent2); text-decoration: none; font-size: 0.8rem; }
  .info-field a:hover { text-decoration: underline; }

  .desc-block { background: var(--surface2); border-radius: 8px; padding: 0.85rem;
    font-size: 0.82rem; line-height: 1.6; color: var(--text-mid); white-space: pre-line; }

  /* Form fields */
  .form-section-title {
    font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--accent); font-weight: 600; padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(232,64,28,0.2);
  }
  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  @media (max-width: 480px) { .form-grid { grid-template-columns: 1fr; } }

  /* ── The add step's fields (v0.9.1232, Brad) ─────────────────────────────
     "the add step needs to be as wide as it can on the desktop to minimize
     scrolling down."

     One column, exactly as they have always been — gap:0 because every block
     already carries its own margin, so single-column spacing is untouched to
     the pixel. Two columns ONLY when wizard.js has put .cd-2up on the panel,
     which it does for a single item on a screen at least 900px wide. Adding an
     engine and tender already spends the width on the two units and must not
     also halve each one.

     align-items:start so a block that grows (the "what changed?" box opening)
     stretches nothing beside it. min-width:0 so a long label ellipses inside
     its own cell instead of widening the column. */
  /* ── The write outbox (v0.9.1246) ───────────────────────────────────────
     A badge, not a modal. A write that did not land is usually recoverable,
     and interrupting an add to announce it would be its own kind of rude —
     but it must never be invisible, which is the whole bug this fixes. */
  #rr-outbox-badge { position: fixed; left: 1rem; bottom: 1rem; z-index: 9000;
    padding: 0.5rem 0.9rem; border-radius: 999px; cursor: pointer;
    border: 1.5px solid var(--warn, var(--accent2)); background: var(--surface);
    color: var(--accent2); font-family: var(--font-body); font-weight: 700;
    font-size: 0.8rem; box-shadow: 0 4px 16px var(--scrim); }
  #rr-outbox-panel { position: fixed; inset: 0; z-index: 100095; display: flex;
    align-items: center; justify-content: center; padding: 1rem;
    background: var(--scrim); font-family: var(--font-body); }
  .rr-ob-box { background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: 14px; padding: 1.1rem 1.25rem;
    width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
    box-shadow: 0 12px 40px var(--scrim); }
  .rr-ob-h { font-family: var(--font-head); font-size: 1.05rem; font-weight: 700;
    margin-bottom: 0.35rem; }
  .rr-ob-p, .rr-ob-note { font-size: 0.85rem; color: var(--text-mid); line-height: 1.45;
    margin-bottom: 0.85rem; }
  .rr-ob-note { border-left: 3px solid var(--accent2); padding-left: 0.7rem; }
  .rr-ob-list { margin-bottom: 0.9rem; }
  .rr-ob-row { padding: 0.5rem 0; border-top: 1px solid var(--border); }
  .rr-ob-what { font-size: 0.85rem; color: var(--text); font-weight: 600; }
  .rr-ob-why { font-size: 0.72rem; color: var(--text-dim); margin-top: 0.15rem; }
  .rr-ob-b { display: flex; gap: 0.6rem; justify-content: flex-end; flex-wrap: wrap; }
  .rr-ob-btn { padding: 0.6rem 1rem; border-radius: 9px; cursor: pointer;
    font-family: var(--font-body); font-weight: 700; font-size: 0.9rem;
    border: 1.5px solid var(--border); background: var(--surface2); color: var(--text); }
  .rr-ob-ok { background: var(--accent); border-color: var(--accent); color: var(--cream); }

  /* ── The dashboard's add buttons (v0.9.1244, Brad) ──────────────────────
     "the add buttons on top need to sit above the background logo, and not be
     transparant."

     They carried background:rgba(139,142,148,0.12) inline — 12% of a grey, so
     effectively see-through, which nobody noticed until a watermark appeared
     behind them. The inline value is gone and the background lives here, where
     it follows the theme like every other surface. --bg-card is the same near
     white the stat cards beside them use, so the row reads as one family.

     position:relative + z-index put them above the watermark for the same
     reason .main needed a stacking context: the mark sits at z-index -1 inside
     .main, and an ordinary block's background is painted after that. Being
     explicit here means it stays true if the row is ever moved. */
  .dash-desktop-actions .btn,
  .dash-mobile-actions .btn { background: var(--bg-card); position: relative; z-index: 1; }

  /* ── "Save as" on Apply (v0.9.1243, Brad) ───────────────────────────────
     "when saving, we need a way to save as an existing one as well as
     creating a new one. maybe a dropdown."
     z-index sits above the editor (100040) and its pop-ups, for the same
     reason the shared dialogs do: a modal must outrank whatever opened it. */
  #rrap-save { position: fixed; inset: 0; z-index: 100090; display: flex;
    align-items: center; justify-content: center; padding: 1rem;
    background: var(--scrim); font-family: var(--font-body); }
  .rrap-savebox { background: var(--p-panel); color: var(--p-ink);
    border: 1px solid var(--p-line); border-radius: 14px; padding: 1.1rem 1.25rem;
    width: 100%; max-width: 460px; box-shadow: 0 12px 40px var(--scrim); }
  .rrap-saveh { font-family: var(--font-head); font-size: 1.05rem; font-weight: 700;
    margin-bottom: 0.35rem; }
  .rrap-savep { font-size: 0.85rem; color: var(--p-ink-dim); line-height: 1.45;
    margin-bottom: 0.85rem; }
  .rrap-savel { display: block; font-size: 0.68rem; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--p-ink-dim); margin-bottom: 0.25rem; }
  .rrap-savesel, .rrap-savein { width: 100%; box-sizing: border-box;
    background: var(--p-paper); color: var(--p-ink); border: 1.5px solid var(--p-line);
    border-radius: 9px; padding: 0.6rem 0.75rem; font-family: var(--font-body);
    font-size: 0.95rem; outline: none; margin-bottom: 0.7rem; }
  .rrap-saveb { display: flex; gap: 0.6rem; justify-content: flex-end; }
  .rrap-savebtn { padding: 0.6rem 1rem; border-radius: 9px; cursor: pointer;
    font-family: var(--font-body); font-weight: 700; font-size: 0.9rem;
    border: 1.5px solid var(--p-line); background: var(--p-paper); color: var(--p-ink); }
  .rrap-saveok { background: var(--p-accent); border-color: var(--p-accent); color: var(--p-paper); }

  /* ── A variation description, in the sections the book wrote it in ──────
     v0.9.1233 (Brad's Step 2 of 8 screenshot). One attribute per line in a
     520px box is a mile-long ribbon. The preamble spans the full width — it
     identifies the variation — and the headed sections (ENGINE, TENDER) sit
     side by side, each kept whole. wizard.js only emits .var-desc when the
     modal is wide AND the book gave the description at least two headings;
     everything else still renders as the plain single column it always was. */
  .var-desc-plain { font-size: 0.82rem; color: var(--text-mid); line-height: 1.5;
    padding-left: 0.1rem; white-space: pre-line; }
  .var-desc { display: grid; grid-template-columns: 1fr 1fr; gap: 0.3rem 1.25rem;
    align-items: start; padding-left: 0.1rem; }
  .var-lead { grid-column: 1 / -1; }
  .var-sec { min-width: 0; }
  .var-sec-h { font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--accent2); font-weight: 700; margin-bottom: 0.15rem; }
  .var-sec-b { font-size: 0.82rem; color: var(--text-mid); line-height: 1.5;
    white-space: pre-line; overflow-wrap: anywhere; }

  .cd-fields { display: grid; grid-template-columns: 1fr; gap: 0; align-items: start; }
  .cd-col.cd-2up .cd-fields { grid-template-columns: 1fr 1fr; column-gap: 1rem; }
  .cd-blk { min-width: 0; }
  .form-field label { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--text-dim); display: block; margin-bottom: 0.3rem; }
  .form-field input, .form-field select, .form-field textarea {
    width: 100%; background: var(--bg); border: 1px solid var(--border);
    border-radius: 7px; padding: 0.55rem 0.75rem; color: var(--text);
    font-family: var(--font-body); font-size: 0.875rem; outline: none;
    transition: border-color 0.15s;
  }
  .form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--accent); }
  .form-field textarea { resize: vertical; min-height: 70px; }
  .form-field.full { grid-column: 1 / -1; }

  /* Toggle switch */
  .toggle-row { display: flex; align-items: center; gap: 0.75rem; }
  .toggle-label { font-size: 0.875rem; }
  .toggle {
    position: relative; width: 40px; height: 22px;
    background: var(--border); border-radius: 11px; cursor: pointer;
    transition: background 0.2s; flex-shrink: 0;
  }
  .toggle.on { background: var(--green); }
  .toggle::after {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 16px; height: 16px; border-radius: 50%; background: white;
    transition: transform 0.2s;
  }
  .toggle.on::after { transform: translateX(18px); }

  /* Condition slider */
  .condition-display { display: flex; align-items: center; gap: 0.75rem; }
  .condition-num { font-family: var(--font-head); font-size: 2rem; width: 2rem; color: var(--accent2); }
  input[type=range] { flex: 1; accent-color: var(--accent); }

  /* Price row */
  .price-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }
  @media (max-width: 480px) { .price-row { grid-template-columns: 1fr; } }

  .modal-footer {
    display: flex; gap: 0.75rem; justify-content: flex-end;
    padding: 1rem 1.5rem; border-top: 1px solid var(--border);
    position: sticky; bottom: 0; background: var(--surface);
  }
  .btn { padding: 0.65rem 1.15rem; border-radius: 6px; font-family: var(--font-head);
    font-size: 0.88rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
    cursor: pointer; transition: all 0.15s; border: none; touch-action: manipulation; }
  .btn-primary { background: var(--accent); color: white; }
  .btn-primary:hover { background: #d63518; }
  .btn-secondary { background: var(--surface2); color: var(--text-mid); border: 1px solid var(--border); }
  .btn-secondary:hover { border-color: var(--accent); color: var(--text); }

  /* ── Reports Page ──────────────────────────────────────────── */
  .report-controls { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
  .btn-export {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.55rem 1rem; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-mid); font-family: var(--font-body);
    font-size: 0.85rem; cursor: pointer; transition: all 0.15s;
  }
  .btn-export:hover { border-color: var(--accent2); color: var(--accent2); }

  .report-table { width: 100%; border-collapse: collapse; }
  .report-table th {
    text-align: left; padding: 0.6rem 1rem; font-size: 0.7rem;
    letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim);
    background: var(--surface2); border-bottom: 1px solid var(--border);
  }
  .report-table td { padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.83rem; }
  .report-table tr:last-child td { border-bottom: none; }

  /* ── Report Builder ─────────────────────────────────────────── */
  .rb-overlay { position:fixed;inset:0;background:rgba(0,0,0,0.62);z-index:9990;display:flex;align-items:flex-end;justify-content:center; }
  .rb-sheet { background:var(--surface);border-radius:16px 16px 0 0;width:100%;max-width:600px;max-height:90vh;max-height:90dvh;display:flex;flex-direction:column;overflow:hidden; }   /* v0.9.1020: dvh */
  .rb-tabs { display:flex;border-bottom:1px solid var(--border); }
  .rb-tab { flex:1;padding:0.55rem 0.5rem;border:none;border-bottom:2px solid transparent;background:none;color:var(--text-dim);font-family:var(--font-body);font-size:0.84rem;font-weight:600;cursor:pointer;transition:all 0.15s; }
  .rb-tab.active { color:var(--accent2);border-bottom-color:var(--accent2); }
  .rb-col-item { display:flex;align-items:center;gap:0.6rem;padding:0.48rem 0.6rem;border-radius:8px;border:1px solid var(--border);margin-bottom:0.32rem;background:var(--surface2);transition:background 0.1s,border-color 0.1s; }
  .rb-col-item.drag-over { border-color:var(--accent2);background:rgba(180,140,60,0.1); }
  .rb-col-item.dragging { opacity:0.35; }
  .rb-drag-handle { color:var(--text-dim);font-size:1rem;cursor:grab;user-select:none;flex-shrink:0;padding:0 2px;line-height:1; }
  .rb-drag-handle:active { cursor:grabbing; }
  .rb-col-item input[type=checkbox] { accent-color:var(--accent2);width:15px;height:15px;cursor:pointer;flex-shrink:0; }
  .rb-col-item label { font-size:0.85rem;color:var(--text);cursor:pointer;flex:1;user-select:none; }
  .rb-filter-row { margin-bottom:1rem; }
  .rb-filter-label { font-size:0.68rem;font-weight:700;text-transform:uppercase;letter-spacing:0.09em;color:var(--text-dim);margin-bottom:0.35rem; }
  .rb-filter-chips { display:flex;flex-wrap:wrap;gap:0.3rem; }
  .rb-chip { padding:0.28rem 0.65rem;border-radius:20px;border:1px solid var(--border);background:var(--surface);font-size:0.78rem;cursor:pointer;color:var(--text-mid);transition:all 0.12s;user-select:none; }
  .rb-chip.selected { border-color:var(--accent2);background:rgba(180,140,60,0.13);color:var(--accent2);font-weight:600; }
  .rb-range { display:flex;align-items:center;gap:0.5rem; }
  .rb-range input { flex:1;padding:0.38rem 0.55rem;border-radius:6px;border:1px solid var(--border);background:var(--bg);color:var(--text);font-family:var(--font-mono);font-size:0.85rem;outline:none;min-width:0; }
  .rb-range input:focus { border-color:var(--accent2); }
  .rb-sort-dir { padding:0.42rem 0.65rem;border-radius:6px;border:1px solid var(--border);background:var(--surface2);color:var(--text-mid);font-size:0.8rem;cursor:pointer;font-family:var(--font-body);white-space:nowrap;flex-shrink:0; }
  .rb-sort-dir.asc  { border-color:#2ecc71;color:#2ecc71; }
  .rb-sort-dir.desc { border-color:var(--accent);color:var(--accent); }

  /* ── Preferences Page ──────────────────────────────────────── */
  .pref-page { max-width: 680px; }
  .pref-section { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 1.25rem; overflow: hidden; }
  .pref-section-title { font-family: var(--font-head); font-size: 0.65rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); padding: 0.75rem 1.25rem 0.5rem; border-bottom: 1px solid var(--border); background: var(--surface2); }
  .pref-row { display: flex; align-items: center; justify-content: space-between; padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--border); gap: 1rem; }
  .pref-row:last-child { border-bottom: none; }
  .pref-row-label { flex: 1; min-width: 0; }
  .pref-row-label strong { display: block; font-size: 0.88rem; color: var(--text); font-weight: 600; margin-bottom: 0.1rem; }
  .pref-row-label span { display: block; font-size: 0.75rem; color: var(--text-dim); line-height: 1.4; }
  .pref-toggle { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
  .pref-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
  .pref-toggle-track { position: absolute; inset: 0; border-radius: 24px; background: var(--surface3); border: 1px solid var(--border); transition: background 0.2s, border-color 0.2s; cursor: pointer; }
  .pref-toggle input:checked + .pref-toggle-track { background: var(--accent2); border-color: var(--accent2); }
  .pref-toggle-track::after { content: ''; position: absolute; left: 3px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; border-radius: 50%; background: white; transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
  .pref-toggle input:checked + .pref-toggle-track::after { left: 21px; }
  .pref-select { padding: 0.38rem 0.6rem; border-radius: 7px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); font-family: var(--font-body); font-size: 0.85rem; outline: none; cursor: pointer; }
  .pref-select:focus { border-color: var(--accent2); }
  .pref-btn { padding: 0.45rem 0.9rem; border-radius: 7px; border: 1px solid var(--border); background: var(--surface2); color: var(--text-mid); font-family: var(--font-body); font-size: 0.82rem; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
  .pref-btn:hover { border-color: var(--accent2); color: var(--accent2); }
  .pref-btn.danger { border-color: rgba(240,80,8,0.4); color: var(--accent); }
  .pref-btn.danger:hover { background: rgba(240,80,8,0.1); }
  .pref-account-card { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; }
  .pref-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: white; display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-size: 1.4rem; font-weight: 700; flex-shrink: 0; overflow: hidden; }
  .pref-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

  /* ── Insurance Report ──────────────────────────────────────── */
  .ins-report-header { padding: 1.5rem 1.75rem; background: linear-gradient(135deg, #1a3a6b 0%, #1e4d8c 60%, #2563b0 100%); border-radius: 10px 10px 0 0; margin-bottom: 0; }
  .ins-report-title { font-family: var(--font-head); font-size: 1.35rem; font-weight: 800; color: #ffffff; margin-bottom: 0.35rem; letter-spacing: 0.02em; }
  .ins-report-meta { font-size: 0.82rem; color: rgba(255,255,255,0.75); display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 0.3rem; }
  .ins-report-meta strong { color: #ffffff; }
  .ins-report-totals { display: flex; gap: 2rem; flex-wrap: wrap; padding: 0.85rem 1.75rem; background: #163060; border-radius: 0 0 10px 10px; margin-bottom: 1.25rem; font-size: 0.85rem; color: rgba(255,255,255,0.7); align-items: center; }
  .ins-report-totals strong { color: #7dd3fc; font-size: 1rem; }
  .ins-photo { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
  .ins-photo-placeholder { width: 72px; height: 72px; border-radius: 6px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: 0.65rem; background: var(--surface2); text-align: center; }

  /* ── Print Styles ───────────────────────────────────────────── */
  @media print {
    body { background: white !important; color: black !important; }
    .sidebar, .mobile-nav, .topbar, .page:not(#page-reports), .report-controls,
    .btn-export, #page-reports .page-title { display: none !important; }
    /* v0.9.1332: the preview card is viewport-capped on screen so its export
       bar can never scroll away; on paper the cap would clip the report to
       one page. Uncap and let the .table-wrap rule above flatten the scroll. */
    #report-preview-modal { position: static !important; padding: 0 !important; background: none !important; }
    #report-preview-modal > div { max-height: none !important; display: block !important; border: none !important; box-shadow: none !important; }
    #page-reports { display: block !important; padding: 0 !important; }
    .table-wrap { overflow: visible !important; box-shadow: none !important; border: none !important; }
    .ins-report-header { background: #1a3a6b !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; border-radius: 10px 10px 0 0; }
    .ins-report-title { color: #ffffff !important; }
    .ins-report-meta { color: rgba(255,255,255,0.8) !important; }
    .ins-report-meta strong { color: #ffffff !important; }
    .ins-report-totals { background: #163060 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; border-radius: 0 0 10px 10px; color: rgba(255,255,255,0.8) !important; }
    .ins-report-totals strong { color: #7dd3fc !important; }
    .report-table th { background: #eee !important; color: #333 !important; border-bottom: 1px solid #ccc; }
    .report-table td { border-bottom: 1px solid #e0e0e0; color: #111 !important; }
    .ins-photo { width: 60px; height: 60px; }
    .ins-photo-placeholder { display: none; }
    .item-num { color: #c0392b !important; }
    a { color: #333 !important; text-decoration: none; }
    @page { margin: 1.8cm 2cm; }
  }

  /* ── Loading & Empty States ────────────────────────────────── */
  .loading {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 3rem; gap: 1rem; color: var(--text-dim);
  }
  .spinner {
    width: 32px; height: 32px; border: 3px solid var(--border);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .spinner { will-change: transform; }
  .modal { will-change: transform; }
  .nav-item, .btn { will-change: opacity; }

  .empty-state { text-align: center; padding: 3rem; color: var(--text-dim); }
  .empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
  .empty-state p { font-size: 0.875rem; }

  /* ── Setup Screen ──────────────────────────────────────────── */
  #setup-screen {
    display: none; flex-direction: column; align-items: center; justify-content: center;
    min-height: 100vh; padding: 2rem;
  }
  #setup-screen.active { display: flex; }
  .setup-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    padding: 2.5rem; width: 100%; max-width: 500px;
  }
  .setup-card h2 { font-family: var(--font-head); font-size: 1.8rem; margin-bottom: 0.5rem; }
  .setup-card p { color: var(--text-dim); font-size: 0.875rem; margin-bottom: 1.5rem; line-height: 1.6; }
  .setup-step { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 1rem; }
  .setup-num {
    width: 24px; height: 24px; border-radius: 50%; background: var(--accent);
    color: white; font-size: 0.75rem; font-weight: 700; display: flex;
    align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px;
  }
  .setup-step p { color: var(--text-mid); font-size: 0.85rem; margin: 0; }
  .input-group { margin-top: 1.25rem; }
  .input-group label { display: block; font-size: 0.72rem; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--text-dim); margin-bottom: 0.4rem; }
  .input-group input {
    width: 100%; background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; padding: 0.65rem 0.9rem; color: var(--text);
    font-family: var(--font-mono); font-size: 0.85rem; outline: none; transition: border-color 0.15s;
  }
  .input-group input:focus { border-color: var(--accent); }

  /* ── Mobile nav ────────────────────────────────────────────── */
  .mobile-nav {
    display: none; background: var(--surface); border-top: 1px solid var(--border);
    padding: 0.5rem 0; flex-shrink: 0;
    /* v0.9.882 (Brad): pin the bottom nav to the screen — it used to sit at
       the end of the page and only appeared after scrolling all the way down.
       .main now carries the padding that reserves the space beneath it. */
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 800;
  }
  .mobile-nav-items { display: flex; justify-content: flex-start; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 0.1rem; padding: 0 0.25rem; }
  .mobile-nav-items::-webkit-scrollbar { display: none; }
  .mobile-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
    padding: 0.5rem 0.75rem; color: var(--text-dim); cursor: pointer;
    font-size: 0.72rem; border: none; background: none; font-family: var(--font-head); letter-spacing: 0.06em; text-transform: uppercase;
    transition: color 0.15s; border-radius: 8px; flex-shrink: 0;
  }
  .mobile-nav-item.active { color: #2980b9; }


  @media (max-width: 640px) {
    /* Layout */
    .sidebar { display: none; }
    .mobile-nav { display: block; }
    /* v0.9.1053 (Brad: "Help and Tips is the last option I see"): this used to
       read `.app-layout { padding-bottom: 68px }` — but there IS no .app-layout
       element anywhere in the app, so the rule reserved nothing and the bottom
       of every scrolling page sat underneath the fixed nav, unreachable. The
       padding belongs on .main, which is the element that actually scrolls.
       92px clears the nav (measured ~85px) with a little to spare. */
    .main { padding: 0.75rem 0.75rem 92px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }

    /* Browse — switch from table to cards on mobile */
    .browse-table-wrap { overflow-x: visible !important; }
    .item-table { display: none; }
    #browse-cards { display: flex; flex-direction: column; gap: 0.5rem; }
    .browse-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 0.75rem 1rem;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 0.75rem;
      transition: background 0.15s;
    }
    .browse-card:active { background: var(--surface2); }
    .browse-card-left { flex: 1; min-width: 0; }
    .browse-card-num { font-family: var(--font-head); font-size: 1.1rem; color: var(--accent); }
    .browse-card-name { font-size: 0.85rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .browse-card-sub { font-size: 0.72rem; color: var(--text-dim); margin-top: 0.15rem; }
    .browse-card-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; flex-shrink: 0; }

    /* Filters bar on mobile */
    .filter-bar { gap: 0.4rem; flex-wrap: wrap; }
    .filter-bar input { font-size: 16px !important; } /* prevent iOS zoom */
    /* My Collection mobile: hide road + quick-entry filters, keep type + search */
    #filter-road { display: none !important; }
    #filter-quick-inline { display: none !important; }
    /* Stack All Types above search bar, search goes full width */
    #page-browse .filter-bar { flex-direction: column; align-items: stretch; gap: 0.4rem; }
    #page-browse .filter-bar #filter-type { width: 100%; }
    #page-browse .filter-bar > div { max-width: 100% !important; flex: none !important; width: 100% !important; box-sizing: border-box; }
    #page-browse #result-count { margin-left: 0; }

    /* Wizard modal — full screen on mobile */
    .wizard-modal-inner {
      width: 100% !important;
      max-width: 100% !important;
      height: 100dvh !important;
      max-height: 100dvh !important;
      border-radius: 0 !important;
      margin: 0 !important;
    }

    /* Photo grid — single column on small screens */
    #photo-grid { grid-template-columns: repeat(4, 1fr) !important; gap: 0.4rem !important; }

    /* Buttons — bigger tap targets */
    .btn { min-height: 48px; font-size: 0.92rem !important; }
    .page-btn { min-width: 44px; min-height: 44px; }

    /* Accessibility: bump mobile font floors */
    .browse-card-num { font-size: 1.2rem !important; }
    .browse-card-name { font-size: 1rem !important; }
    .browse-card-sub { font-size: 0.85rem !important; }
    .cat-name { font-size: 0.95rem !important; }
    .stat-value { font-size: 1.8rem !important; }
    .stat-label { font-size: 0.68rem !important; }
    .page-title { font-size: 1.5rem !important; }
    .modal-title { font-size: 1.2rem !important; }
    .info-field .info-val { font-size: 1rem !important; }
    .form-field input, .form-field select, .form-field textarea { font-size: 1rem !important; min-height: 48px; }
    .status-btn { min-height: 48px !important; font-size: 0.95rem !important; }
    .filter-bar input { min-height: 44px; }
    .filter-bar select { min-height: 44px; font-size: 0.9rem !important; }

    /* Modal full screen */
    .modal-inner { width: 100% !important; max-width: 100% !important;
      margin: 0 !important; border-radius: 0 !important;
      max-height: 100dvh !important; height: 100dvh !important; }

    /* Fix safe areas for notched phones */
    .mobile-nav {
      padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
      height: calc(68px + env(safe-area-inset-bottom));
    }
    .main { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }   /* v0.9.1053 — see above */
    .main {
      padding-top: 0.75rem;
      padding-left: max(0.75rem, env(safe-area-inset-left));
      padding-right: max(0.75rem, env(safe-area-inset-right));
    }
    /* Compact stat cards on mobile */
    .stat-card { padding: 0.7rem 0.8rem; }
    .stat-val { font-size: 1.6rem; }
    /* Search bar full width */
    #search-input { width: 100%; }
    /* Dashboard recent items as cards */
    .two-col { gap: 0.75rem; }

    /* Header — tighten on mobile to prevent overflow */
    .header { padding: 0 0.6rem; gap: 0.4rem; }
    .header-search { max-width: none; flex: 1; min-width: 0; }
    /* v0.9.1054 (Brad: "the user initial at the top right is cut off"). The
       logo block was flex-shrink:0 while carrying a 55px image and 1.8rem
       uppercase text — wider than a phone on its own — so the account chip,
       last in the row, was pushed off the right edge and left half-tappable.
       The logo gives way now and the chip keeps its full width. */
    .header-logo { flex-shrink: 1; min-width: 0; overflow: hidden; }
    .header-logo > div { font-size: 1.35rem !important; letter-spacing: 0.04em !important; }
    .header-logo img { height: 44px !important; }
    .header-right { flex-shrink: 0; }

    /* Hide top-right help widget on mobile (it lives in bottom nav instead) */
    #tut-help-widget { display: none !important; }

    /* Browse My Collection button — full width on mobile */
    #dash-btn-browse-col { width: 100%; justify-content: center; }

    /* Want List & Upgrade List — filter bars on mobile */
    #want-priority-filter, #want-type-filter, #want-sort,
    #upgrade-priority-filter {
      font-size: 16px !important; /* prevent iOS zoom */
      min-height: 40px;
      flex: 1 1 45%;
      min-width: 0;
    }
    #want-search, #upgrade-search {
      font-size: 16px !important; /* prevent iOS zoom */
    }
  }

  /* ── Utility ───────────────────────────────────────────────── */
  .tag {
    display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px;
    font-family: var(--font-head); font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500; background: var(--surface2); color: var(--text-dim);
  }
  .market-val { font-family: var(--font-mono); color: var(--accent2); }
  .dash-row-hover:hover { background: var(--surface2); }
  .eph-tab {
    padding: 0.4rem 0.9rem; border-radius: 20px; border: 1.5px solid var(--border);
    background: var(--surface2); color: var(--text-dim); cursor: pointer;
    font-family: var(--font-body); font-size: 0.82rem; transition: all 0.15s;
  }
  .eph-tab.active { border-color: #e67e22; color: #e67e22; background: rgba(230,126,34,0.12); }
  .eph-row { display:flex;align-items:center;gap:0.75rem;padding:0.55rem 0;border-bottom:1px solid var(--border);cursor:pointer; }
  .eph-row:hover { background: var(--surface2); }
  .eph-title { font-size:0.9rem;font-weight:500;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap }
  .eph-year  { font-size:0.75rem;color:var(--text-dim);flex-shrink:0 }
  .eph-val   { font-size:0.78rem;color:var(--accent2);font-family:var(--font-mono);flex-shrink:0 }
  .text-dim { color: var(--text-dim); }
  .text-accent { color: var(--accent); }
  .mt-sm { margin-top: 0.5rem; }
  .link-btn {
    background: none; border: none; color: var(--accent2); cursor: pointer;
    font-size: 0.8rem; font-family: var(--font-body); text-decoration: underline; padding: 0;
  }

  /* ── Photo Source Picker (camera vs library) ────────────────── */
  #photo-picker-sheet {
    position: fixed; inset: 0; z-index: 9500;
    background: rgba(0,0,0,0.55);
    display: none; align-items: flex-end; justify-content: center;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  #photo-picker-sheet.open { display: flex; }
  #photo-picker-inner {
    background: var(--surface);
    border-radius: 18px 18px 0 0;
    border-top: 3px solid var(--accent);
    width: 100%; max-width: 480px;
    padding: 1.25rem 1rem 1.5rem;
    display: flex; flex-direction: column; gap: 0.6rem;
  }
  .picker-btn {
    width: 100%; padding: 0.9rem 1rem;
    border-radius: 12px; border: 1.5px solid var(--border);
    background: var(--surface2); color: var(--text);
    font-family: var(--font-head); font-size: 0.92rem;
    font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
    cursor: pointer; display: flex; align-items: center;
    gap: 0.75rem; transition: background 0.15s;
  }
  .picker-btn:hover { background: rgba(224,64,40,0.08); border-color: var(--accent); }
  .picker-btn .picker-icon { font-size: 1.4rem; line-height: 1; }

  /* ── Identify Item Modal ─────────────────────────────────── */
  #identify-modal {
    position: fixed; inset: 0; z-index: 8000;
    /* v0.9.1142: was rgba(8,10,18,0.88) — near-opaque and near-identical to
       var(--bg), so once the panel below moved onto the standard card its
       edges vanished into the scrim and the whole thing read as a full page.
       This is the same dim the wizard's overlay uses; the card pops again. */
    background: rgba(0,0,0,0.7);
    display: none; align-items: center; justify-content: center;
    padding: 1rem;
  }
  #identify-modal.open { display: flex; }
  /* v0.9.1140: aligned to the .rr-card standard (Brad: research screens match
     the add screens). The accent top edge stays — it identifies Photo-ID. */
  #identify-panel {
    background: var(--bg);
    border: 1px solid var(--border-hi);
    border-top: 3px solid var(--accent);
    border-radius: 16px;
    width: 100%; max-width: 520px;
    max-height: 92dvh; overflow-y: auto;
    padding: 1.4rem;
    display: flex; flex-direction: column; gap: 1rem;
  }
  .identify-drop {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--surface2);
    position: relative;
  }
  .identify-drop:hover, .identify-drop.dragover {
    border-color: var(--accent);
    background: rgba(224,64,40,0.06);
  }
  .identify-drop input[type=file] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
  }
  .identify-preview {
    width: 100%; border-radius: 8px; max-height: 260px;
    object-fit: contain; background: #000; display: none;
  }
  .identify-candidate {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem; border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--surface2);
    cursor: pointer; transition: all 0.15s;
  }
  .identify-candidate:hover { border-color: var(--accent); background: rgba(224,64,40,0.07); }
  .identify-candidate.selected { border-color: var(--accent); background: rgba(224,64,40,0.12); }
  .identify-num {
    font-family: var(--font-mono); font-size: 1.1rem; font-weight: 700;
    color: var(--gold); min-width: 64px;
  }
  .identify-desc { flex: 1; font-size: 0.82rem; color: var(--text-mid); line-height: 1.4; }
  .identify-conf {
    font-family: var(--font-head); font-size: 0.62rem; font-weight: 600;
    letter-spacing: 0.1em; text-transform: uppercase;
    padding: 2px 7px; border-radius: 4px;
  }
  .identify-conf.high { background: rgba(46,204,113,0.2); color: #4dc880; }
  .identify-conf.med  { background: rgba(212,168,67,0.2); color: #e8c060; }
  .identify-conf.low  { background: rgba(224,64,40,0.15); color: #f08070; }
  @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
  .gemini-setup {
    background: rgba(212,168,67,0.08);
    border: 1px solid rgba(212,168,67,0.25);
    border-radius: 8px; padding: 1rem;
    font-size: 0.82rem; color: var(--text-mid); line-height: 1.6;
  }

  /* ── Landscape phone: hide dashboard stats/recent, show only buttons ── */
  @media (max-height: 500px) and (max-width: 900px) and (orientation: landscape) {
    #page-dashboard .stats-grid,
    #page-dashboard .two-col,
    #page-dashboard .page-title { display: none !important; }
    #page-dashboard .dash-btn-grid { margin-top: 0.5rem; }
    .main { padding-top: 0.5rem !important; }
  }

  /* ── Hide native date picker calendar icon — we use our own 📅 button ── */
  input[type="date"]::-webkit-calendar-picker-indicator {
    display: none;
  }

  /* ── Dashboard action buttons: desktop shows row, mobile shows side-by-side panels ── */
  .dash-mobile-actions { display: none; }
  /* v0.9.709 (Brad): ONE row — buttons share the width equally and the text
     scales with the window instead of wrapping or scrolling. */
  .dash-desktop-actions { display: flex; gap: 0.35rem; flex-wrap: nowrap; flex: 1 1 100%; width: 100%; }
  /* v0.9.725 (Brad): collection-row action buttons — ONE row, equal size. */
  .coll-actions-cell { white-space: nowrap !important; }
  .coll-actions-cell button { display: inline-block; width: 62px; text-align: center; margin: 0 0 0 4px !important; padding: 0.3rem 0 !important; }
  .dash-desktop-actions .btn { flex: 1 1 0; min-width: 0; justify-content: center; white-space: nowrap; overflow: hidden; font-size: clamp(0.55rem, 0.9vw, 0.74rem) !important; padding: 0.42rem 0.3rem !important; }
  @media (max-width: 640px) {
    .dash-mobile-actions { display: flex !important; gap: 0.5rem; width: 100%; flex-wrap: wrap; }
    .dash-desktop-actions { display: none !important; }
    #dash-greeting { display: none !important; }
  }
</style>

/* ── Road Name Searchable Combobox ── */
.road-combo { position:relative; display:inline-block; min-width:180px; }
.road-combo input { width:100%; box-sizing:border-box; cursor:pointer; }
.road-combo-clear { position:absolute; right:8px; top:50%; transform:translateY(-50%); background:none; border:none; color:var(--text-dim); font-size:1.1rem; cursor:pointer; padding:0 4px; line-height:1; z-index:2; }
.road-combo-clear:hover { color:var(--text); }
.road-combo-list { position:absolute; top:100%; left:0; right:0; max-height:280px; overflow-y:auto; background:var(--bg-card); border:1px solid var(--border); border-radius:0 0 8px 8px; box-shadow:0 4px 12px rgba(0,0,0,0.25); z-index:100; }
.road-combo-list .road-opt { padding:0.45rem 0.7rem; font-size:0.84rem; font-family:var(--font-body); color:var(--text); cursor:pointer; border-bottom:1px solid var(--border); }
.road-combo-list .road-opt:last-child { border-bottom:none; }
.road-combo-list .road-opt:hover, .road-combo-list .road-opt.active { background:rgba(212,168,67,0.15); }
.road-combo-list .road-opt .road-count { float:right; font-size:0.75rem; color:var(--text-dim); }

/* ── Insurance report print styles (Session 112) ── */
/* When the user prints, hide app chrome and show just the report content. */
@media print {
  .sidebar, .mobile-nav, .tut-help-widget, #tut-help-widget, #tut-overlay,
  #gmail-help-overlay, #onboarding-map-overlay, #onboarding-return-bar,
  .header, #mnav, .nav-toggle, .report-controls, .qa-fab, #qa-panel,
  #export-report-btn, #report-type, select, button {
    display: none !important;
  }
  body, html { background: #fff !important; color: #000 !important; }
  .main, #main-content, #page-reports, #page-reports * {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
  }
  #ins-report-hdr .ins-report-title { color: #000; font-size: 18pt; }
  #ins-report-hdr .ins-report-meta span,
  #ins-report-hdr .ins-report-subtitle { color: #333; }
  #ins-report-foot { color: #000 !important; }
  #ins-report-foot .ins-report-footer div[style*="border-bottom"] { border-bottom-color: #000 !important; }
  .ins-photo-placeholder { background: #eee !important; color: #666 !important; border: 1px solid #999; }
  table { page-break-inside: auto; }
  tr { page-break-inside: avoid; }
  thead { display: table-header-group; }   /* repeat headers per page */
  .item-table th, .item-table td { border: 1px solid #888 !important; padding: 4pt 6pt; font-size: 9pt; }
  .item-num { color: #000 !important; font-weight: bold; }
}


/* Compact UI (Session 161+) ============================================== */
.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
}
.qa-add-dropdown-wrap { position: relative; display: inline-flex; }
.qa-add-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 230px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.35rem;
  box-shadow: 0 6px 24px rgba(0,0,0,0.35);
  z-index: 50;
  flex-direction: column;
  gap: 0.2rem;
}
.qa-add-dropdown-menu button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 7px;
  text-align: left;
}
.qa-add-dropdown-menu button:hover { background: var(--surface2); }
body.compact-mode .table-wrap td,
body.compact-mode .table-wrap th {
  padding-top: 0.35rem !important;
  padding-bottom: 0.35rem !important;
  font-size: 0.78rem !important;
}
body.compact-mode #coll-icon-legend { display: none !important; }
body.compact-mode .qa-tr-actions .qa-tr-btn {
  padding: 0.3rem 0.5rem !important;
  font-size: 0.72rem !important;
}

/* ── Want/Upgrade list: density, fit-to-width, responsive ── */
#page-upgrade .item-table { table-layout: fixed; width: 100%; }
#page-upgrade .item-table td, #page-upgrade .item-table th { padding: 0.42rem 0.55rem; }
#page-upgrade .item-table th { line-height: 1.15; }
#page-upgrade .item-table th:nth-child(1), #page-upgrade .item-table td:nth-child(1) { width: 116px; overflow: hidden; text-overflow: ellipsis; }
#page-upgrade .item-table td:last-child { white-space: normal; }
#page-upgrade .item-table td:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#page-upgrade .item-table th:nth-child(3), #page-upgrade .item-table td:nth-child(3) { width: 74px; }
#page-upgrade .item-table th:nth-child(4), #page-upgrade .item-table td:nth-child(4) { width: 62px; }
#page-upgrade .item-table th:nth-child(5), #page-upgrade .item-table td:nth-child(5) { width: 60px; }
#page-upgrade .item-table th:nth-child(6), #page-upgrade .item-table td:nth-child(6) { width: 66px; }
#page-upgrade .item-table th:nth-child(7), #page-upgrade .item-table td:nth-child(7) { width: 108px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#page-upgrade .item-table th:nth-child(8), #page-upgrade .item-table td:nth-child(8) { width: 186px; }
#page-upgrade .item-table td:last-child { white-space: normal; }
@media (max-width: 760px) {
  #page-upgrade .item-table th:nth-child(3), #page-upgrade .item-table td:nth-child(3),
  #page-upgrade .item-table th:nth-child(7), #page-upgrade .item-table td:nth-child(7),
  #page-upgrade .item-table th:nth-child(8), #page-upgrade .item-table td:nth-child(8) { display: none; }
}

/* ── For Sale list: density, fit-to-width, responsive ── */
#page-forsale .item-table { table-layout: fixed; width: 100%; }
#page-forsale .item-table td, #page-forsale .item-table th { padding: 0.42rem 0.55rem; }
#page-forsale .item-table th { line-height: 1.15; }
#page-forsale .item-table th:nth-child(1), #page-forsale .item-table td:nth-child(1) { width: 54px; }
#page-forsale .item-table th:nth-child(2), #page-forsale .item-table td:nth-child(2) { width: 116px; overflow: hidden; text-overflow: ellipsis; }
#page-forsale .item-table th:nth-child(3), #page-forsale .item-table td:nth-child(3) { width: 70px; }
#page-forsale .item-table td:nth-child(4) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#page-forsale .item-table th:nth-child(5), #page-forsale .item-table td:nth-child(5) { width: 48px; }
#page-forsale .item-table th:nth-child(6), #page-forsale .item-table td:nth-child(6) { width: 86px; }
#page-forsale .item-table th:nth-child(7), #page-forsale .item-table td:nth-child(7) { width: 84px; }
#page-forsale .item-table th:nth-child(8), #page-forsale .item-table td:nth-child(8) { width: 88px; }
#page-forsale .item-table th:nth-child(9), #page-forsale .item-table td:nth-child(9) { width: 200px; }
#page-forsale .item-table td:last-child { white-space: normal; }
@media (max-width: 760px) {
  #page-forsale .item-table th:nth-child(3), #page-forsale .item-table td:nth-child(3),
  #page-forsale .item-table th:nth-child(7), #page-forsale .item-table td:nth-child(7),
  #page-forsale .item-table th:nth-child(8), #page-forsale .item-table td:nth-child(8),
  #page-forsale .item-table th:nth-child(9), #page-forsale .item-table td:nth-child(9) { display: none; }
}

/* ── Sold Items list: density, fit-to-width, responsive ── */
#page-sold .item-table { table-layout: fixed; width: 100%; }
#page-sold .item-table td, #page-sold .item-table th { padding: 0.42rem 0.55rem; }
#page-sold .item-table th { line-height: 1.15; }
#page-sold .item-table th:nth-child(1), #page-sold .item-table td:nth-child(1) { width: 54px; }
#page-sold .item-table th:nth-child(2), #page-sold .item-table td:nth-child(2) { width: 88px; }
#page-sold .item-table th:nth-child(3), #page-sold .item-table td:nth-child(3) { width: 84px; }
#page-sold .item-table td:nth-child(4) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#page-sold .item-table th:nth-child(5), #page-sold .item-table td:nth-child(5) { width: 70px; }
#page-sold .item-table th:nth-child(6), #page-sold .item-table td:nth-child(6) { width: 56px; }
#page-sold .item-table th:nth-child(7), #page-sold .item-table td:nth-child(7) { width: 86px; }
#page-sold .item-table th:nth-child(8), #page-sold .item-table td:nth-child(8) { width: 96px; }
@media (max-width: 760px) {
  #page-sold .item-table th:nth-child(3), #page-sold .item-table td:nth-child(3),
  #page-sold .item-table th:nth-child(5), #page-sold .item-table td:nth-child(5),
  #page-sold .item-table th:nth-child(8), #page-sold .item-table td:nth-child(8) { display: none; }
}

/* ── Cataloged Master List: tighter rows ── */
#page-browse .item-table:not(.collection-view) td,
#page-browse .item-table:not(.collection-view) th { padding: 0.45rem 0.6rem; }

@media print {
  #page-reports .table-wrap { max-height: none !important; overflow: visible !important; }
}

/* ── v0.9.854: dashboard card text = frame navy; numbers stay black ── */
/* Labels/sub-text inside stat cards and dash panel titles pick up navy   */
/* by re-scoping the two shared text vars. Numbers use var(--text) and    */
/* are unaffected. High-contrast theme re-overridden below (a11y).        */
.main .stat-card,
.main #dash-panels-host .section-title { --text-dim:#2980b9; --text-mid:var(--text); }
.main .stat-label,
.main #dash-panels-host .section-title { font-weight:700; }
.main .stat-card::before { background:#2980b9; }
html[data-theme="high-contrast"] .main .stat-card,
html[data-theme="high-contrast"] .main #dash-panels-host .section-title { --text-dim:#c0c0c0; --text-mid:#e0e0e0; }


/* ── v0.9.869: ONE master lever — all colored action buttons -> blue/gray scheme ──
   Any button styled inline with one of the legacy action colors (green, orange,
   purple, teal, legacy blues, accent orange) is reskinned here: gray border,
   want-list blue text, gray tint background. Destructive red (#e74c3c) and
   neutral gray buttons keep their colors on purpose. Solid primary buttons go
   solid blue. High-contrast theme re-overridden below (a11y). */
.main button[style*="#2ecc71"], .main button[style*="#e67e22"],
.main button[style*="#8b5cf6"], .main button[style*="#16a085"],
.main button[style*="#3498db"], .main button[style*="#2980b9"],
.main button[style*="var(--accent)"] {
  border-color:#8b8e94 !important; color:#2980b9 !important;
  /* v0.9.1274 (Brad: "still transparent"): this !important beat every one of
     the 139 opaque backgrounds v0.9.1273 wrote into the buttons — the sweep
     was right, and this line painted the 12% wash straight back over it. Same
     tint, now mixed into the card colour so nothing behind shows through.
     Two declarations on purpose: a browser without color-mix drops the
     second and keeps the first (opaque, slightly wrong tint). */
  background:var(--bg-card) !important;
  background:color-mix(in srgb, rgb(139,142,148) 12%, var(--bg-card)) !important;
}
.main .btn-primary { background:#2980b9 !important; color:#fff !important; }
.main .btn-primary:hover { background:#216f9e !important; }
html[data-theme="high-contrast"] .main button[style*="#2ecc71"],
html[data-theme="high-contrast"] .main button[style*="#e67e22"],
html[data-theme="high-contrast"] .main button[style*="#8b5cf6"],
html[data-theme="high-contrast"] .main button[style*="#16a085"],
html[data-theme="high-contrast"] .main button[style*="#3498db"],
html[data-theme="high-contrast"] .main button[style*="#2980b9"],
html[data-theme="high-contrast"] .main button[style*="var(--accent)"] {
  border-color:#ffffff !important; color:#ffb000 !important; background:#000000 !important;
}
html[data-theme="high-contrast"] .main .btn-primary { background:#ffb000 !important; color:#000 !important; }


/* ── v0.9.870: destructive buttons — gray frame, bright orange text ── */
button[style*="#e74c3c"] {
  border-color:#8b8e94 !important; color:#f05008 !important;
  /* v0.9.1274: same fix as the v0.9.869 lever above — opaque, not a wash. */
  background:var(--bg-card) !important;
  background:color-mix(in srgb, rgb(139,142,148) 12%, var(--bg-card)) !important;
}
html[data-theme="high-contrast"] button[style*="#e74c3c"] {
  border-color:#ffffff !important; color:#ffb000 !important; background:#000000 !important;
}

/* v0.9.908 (Brad, item [8]): detail-page photos — on wider screens show them
   bigger and at their natural shape instead of cropping to a square. Mobile
   keeps the compact square grid (inline styles); this only overrides >=700px. */
@media (min-width: 700px) {
  #ni-detail-photos,
  #item-detail-photos,
  [id^="grp-photos-"] {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
    align-items: start;
  }
  #ni-detail-photos a[href],
  #item-detail-photos a[href],
  [id^="grp-photos-"] a[href] {
    aspect-ratio: auto !important;
  }
  #ni-detail-photos a[href] img,
  #item-detail-photos a[href] img,
  [id^="grp-photos-"] a[href] img {
    height: auto !important;
    max-height: 70vh;
    object-fit: contain !important;
  }
}
/* v0.9.933 (Brad): the same big-uncropped treatment now covers GROUP items
   (paired A units, sets) whose photos render in grp-photos-N containers —
   they were stuck at the 120px square crop the singles fix didn't reach. */

/* ── Dashboard photo ticker (v0.9.1017, Brad) ─────────────────────────
   A screen-wide strip of thumbnails drifting right-to-left above the
   large cards. Desktop only (dashboard.js gates it). The track holds the
   thumbnails TWICE — when the first copy has fully scrolled out (-50%),
   the loop restarts invisibly. Hover pauses so a photo can be clicked. */
@keyframes rr-ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.rr-ticker-track {
  display: flex; gap: 0.5rem; width: max-content;
  animation: rr-ticker-scroll var(--rr-ticker-dur, 80s) linear infinite;
}
.rr-ticker-wrap:hover .rr-ticker-track { animation-play-state: paused; }

/* ── Bottom-nav "more" hint (v0.9.1019, Brad) ─────────────────────────
   The bar scrolls sideways with the scrollbar hidden — nothing said so.
   A fade + chevron on the right edge marks the off-screen buttons; it
   disappears once the user scrolls to the end (app.js listener). */
.mobile-nav { position: fixed; }
.mnav-more {
  display: none; position: absolute; right: 0; top: 0; bottom: 0; width: 44px;
  pointer-events: none; align-items: center; justify-content: flex-end;
  padding-right: 4px; color: var(--text-dim); font-size: 1.5rem; line-height: 1;
  background: linear-gradient(90deg, rgba(0,0,0,0), var(--surface) 72%);
  opacity: 1; transition: opacity 0.25s;
}
.mnav-more.gone { opacity: 0; }
@media (max-width: 640px) { .mnav-more { display: flex; } }

/* ── Item-detail action buttons on phones (v0.9.1021, Brad) ───────────
   Five buttons wrapped into a ragged three rows with small tap targets.
   On phones they become a tidy grid: the PRIMARY action (first button —
   Update Info/Pictures) spans the full width, the rest sit two-across.
   Every button gets the app's 48px phone tap-target floor. Desktop keeps
   the existing single flex row. */
@media (max-width: 640px) {
  .rr-detail-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem !important;
    align-items: stretch;
  }
  .rr-detail-actions > button {
    width: 100%;
    min-height: 48px;
    justify-content: center;
    font-size: 0.84rem !important;
    padding: 0.5rem 0.6rem !important;
  }
  .rr-detail-actions > button:first-child { grid-column: 1 / -1; }
  /* an odd last button fills the row rather than leaving a gap */
  .rr-detail-actions > button:last-child:nth-child(even) { grid-column: 1 / -1; }
}

/* ── Phone tap-target floor for small square controls (v0.9.1021) ─────
   The app promises 44-48px targets on phones, but small square buttons
   added since (showcase ‹ ⏸ ›, photo ✂ crop, picker checkboxes) were
   26px and 15px. One rule, applied by class. */
@media (max-width: 640px) {
  .rr-tap { min-width: 44px !important; min-height: 44px !important;
            width: 44px !important; height: 44px !important; font-size: 1.05rem !important; }
  .rr-tap-box { width: 22px !important; height: 22px !important; }
}

/* ── For Sale page on phones (v0.9.1022, Brad) ───────────────────────
   "Share / Customers" is a desk job — hidden on phones. "Share to a
   friend" and the "+ Add" dropdown share one row below the title, equal
   width, at the phone tap-target height. Card action buttons likewise. */
@media (max-width: 640px) {
  #page-forsale .fs-share-customers { display: none !important; }
  #page-forsale .page-title { flex-wrap: wrap; row-gap: 0.5rem; }
  #page-forsale .page-title > span:first-child { flex: 1 1 100%; }
  #page-forsale .page-title > div { flex: 1 1 0; min-width: 0; margin-left: 0 !important; }
  #page-forsale .page-title .qa-tr-actions { flex: 1 1 0; margin-left: 0 !important; }
  #page-forsale .qa-add-dropdown-wrap { display: block; width: 100%; }
  #page-forsale .fs-share-friend,
  #page-forsale .qa-add-btn {
    width: 100%; justify-content: center; min-height: 44px;
    font-size: 0.8rem !important; padding: 0.5rem 0.6rem !important;
  }
  /* card actions: three equal buttons at the tap-target floor */
  .rr-fs-actions > button { min-height: 44px; flex: 1 1 0 !important; }
}

/* ── For Sale on phones: fit three listings without scrolling ─────────
   (v0.9.1023, Brad). Every band above the first card was costing rows:
   an oversized page title, a tall button row, a chunky search box and
   generous card padding. Trimmed together, plus half-height card
   buttons on ONE line each, three cards now land above the fold on a
   normal phone. Desktop untouched. */
@media (max-width: 640px) {
  /* card action buttons: half the height, one line, evenly spaced */
  .rr-fs-actions { gap: 0.35rem !important; margin-top: 0.45rem !important; }
  .rr-fs-actions > button {
    min-height: 34px !important;
    padding: 0.25rem 0.3rem !important;
    font-size: 0.74rem !important;
    white-space: nowrap;
    line-height: 1.1;
  }
  /* title band */
  #page-forsale .page-title { font-size: 1.15rem !important; margin-bottom: 0.4rem !important; row-gap: 0.35rem; }
  #page-forsale #forsale-title-stats { font-size: 0.72rem !important; margin-left: 0.4rem !important; }
  /* the two header buttons — shorter, still comfortably tappable */
  #page-forsale .fs-share-friend,
  #page-forsale .qa-add-btn { min-height: 38px !important; padding: 0.35rem 0.5rem !important;
    font-size: 0.74rem !important; white-space: nowrap; }
  #page-forsale .fs-share-friend svg { flex-shrink: 0; }
  /* search band */
  #page-forsale #forsale-search { font-size: 16px !important; }   /* iOS: no zoom-on-focus */
  #page-forsale .fs-search-band { margin-bottom: 0.45rem !important; }
  #page-forsale .fs-search-band > div { max-width: none !important; padding: 0.3rem 0.6rem !important; }
  /* cards: tighter padding + gap */
  #forsale-cards { gap: 0.45rem !important; }
  #forsale-cards > div { padding: 0.6rem 0.7rem !important; }
  /* page gutter */
  #page-forsale { padding-top: 0.25rem; }
}

/* ── Want/Upgrade on phones: compact filter block (v0.9.1024, Brad) ───
   The four controls wrapped into three tall rows and pushed the first
   card off the fold. On phones they become a 2x2 grid at a tighter
   height, the "Showing x of y" count moves up into the page title, and
   card buttons match the For Sale half-height treatment. */
@media (max-width: 640px) {
  #page-upgrade .page-title { font-size: 1rem !important; margin-bottom: 0.4rem !important; letter-spacing: 0.02em; }
  #page-upgrade #upgrade-title-stats { white-space: nowrap; }
  #page-upgrade .wu-filter-bar {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem !important;
    margin-bottom: 0.5rem !important;
    align-items: stretch;
  }
  #page-upgrade .wu-filter-bar > select {
    width: 100%; min-height: 38px !important; min-width: 0;
    padding: 0.3rem 0.45rem !important; font-size: 0.8rem !important;
  }
  #page-upgrade .wu-filter-bar > div {            /* the search pill */
    max-width: none !important; min-width: 0 !important; min-height: 38px;
    padding: 0.25rem 0.5rem !important;
  }
  #page-upgrade #upgrade-count { display: none !important; }   /* lives in the title now */
  #page-upgrade #upgrade-cards { gap: 0.45rem !important; }
  #page-upgrade #upgrade-cards > div { padding: 0.6rem 0.7rem !important; }
  #page-upgrade #upgrade-cards button {
    min-height: 34px !important; padding: 0.25rem 0.3rem !important;
    font-size: 0.72rem !important; white-space: nowrap !important; line-height: 1.1;
  }
}

/* ── My Collection / Catalog on phones (v0.9.1025, Brad) ─────────────
   • the filter block moves into a bottom sheet behind a Filters button,
     so it costs one button instead of a third of the screen;
   • nothing scrolls sideways — rows are clamped to the viewport;
   • rows are tighter, and the row thumbnail sits on the right. */
@media (max-width: 640px) {
  /* filters live in the sheet — hidden inline, shown when moved into it */
  #page-browse > #hierarchy-chip-row { display: none !important; }
  #rr-filter-sheet #hierarchy-chip-row.rr-in-sheet {
    display: flex !important; background: transparent; border: none;
    padding: 0; margin: 0; flex-direction: column; align-items: stretch; gap: 0.5rem;
  }
  #rr-filter-sheet #hierarchy-chips { gap: 0.4rem; }
  #rr-filter-sheet #browse-search-wrap { max-width: none !important; width: 100%; }
  /* no sideways scrolling anywhere on this page */
  #page-browse { overflow-x: hidden; }
  #browse-cards { width: 100%; max-width: 100%; }
  .browse-card { max-width: 100%; box-sizing: border-box; overflow: hidden; }
  .browse-card > div { min-width: 0; }
  /* tighter rows */
  #page-browse .page-title { font-size: 1rem !important; margin-bottom: 0.4rem !important; flex-wrap: wrap; row-gap: 0.4rem; }
  #browse-cards { gap: 0.4rem !important; }
  .browse-card { padding: 0.55rem 0.65rem !important; }
}

/* v0.9.1026 (Brad): long titles must not run under the row thumbnail —
   the number line clips with an ellipsis instead of overflowing. */
@media (max-width: 640px) {
  .browse-card .browse-card-num { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .browse-card .browse-card-num + span,
  .browse-card > div > div { min-width: 0; }
  .browse-card > div > div:first-of-type > div:first-child { overflow: hidden; }
}

/* ── Filter sheet polish (v0.9.1028, Brad) ───────────────────────────
   Inside the sheet the chips get room to breathe: the duplicated
   "Filters" caption and the decorative > separators come off (the sheet
   already says Filters), the clear-all X moves to the end, and the chip
   row loses its inline panel styling so it reads as one clean block. */
#rr-filter-sheet #hierarchy-chip-row .ph-label,
#rr-filter-sheet #hierarchy-chip-row .ph-sep { display: none !important; }
#rr-filter-sheet #hierarchy-chips {
  display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center;
}
#rr-filter-sheet #hierarchy-chips button { min-height: 40px; }
#rr-filter-sheet #hierarchy-chip-row .ph-clear {
  order: 99; margin-left: auto; min-height: 40px;
}
#rr-filter-sheet #browse-search-wrap {
  width: 100%; max-width: none !important; min-height: 44px;
  margin-top: 0.2rem;
}
#rr-filter-panel { color: var(--text); }

/* ── Wizard footer on phones (v0.9.1028, Brad) ───────────────────────
   "Done with Photos" wrapped onto three lines and dragged the whole
   footer to a third of the screen. Buttons now sit on one line each,
   shrink to fit, and the footer keeps a sane height. */
@media (max-width: 640px) {
  .modal-footer {
    padding: 0.6rem 0.7rem !important;
    gap: 0.4rem !important;
    flex-wrap: nowrap;
  }
  .modal-footer .btn {
    padding: 0.5rem 0.6rem !important;
    font-size: 0.72rem !important;
    letter-spacing: 0.03em !important;
    white-space: nowrap;
    min-height: 44px;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .modal-footer #wizard-next-btn { flex: 0 0 auto; }
}

/* Filter-sheet action button: an explicit hex keeps it out of the
   light-theme "recolour inline-styled buttons" rule (v0.9.1028). */
#rr-filter-panel > button:last-child {
  background: #f05008 !important; color: #fff !important; border: none !important;
}
#rr-filter-sheet #hierarchy-chip-row .ph-clear { margin-left: 0 !important; order: 0; }

/* Footer labels on phones (v0.9.1029): Back and Cancel become their
   symbols so "Done with Photos" stays fully readable. All four buttons
   share one row, centred, at the same height. */
.wiz-lbl-short { display: none; }
@media (max-width: 640px) {
  .wiz-lbl-full { display: none; }
  .wiz-lbl-short { display: inline; }
  .modal-footer { align-items: center !important; }
  .modal-footer .btn {
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1.15;
  }
  .modal-footer #wizard-skip-photos-btn { flex: 1 1 auto; font-size: 0.68rem !important; }
  .modal-footer #wizard-back-btn,
  .modal-footer .btn:nth-child(2) { flex: 0 0 auto; padding: 0.5rem 0.7rem !important; }
}

/* ══ Phone compacting — remaining list pages (v0.9.1030, Brad) ═══════
   Same treatment already applied to For Sale, Want/Upgrade and My
   Collection: smaller page title, filter controls in a tidy grid rather
   than three ragged wrapped rows, tighter cards, and card buttons at
   half height on ONE line. Desktop is untouched throughout. */
@media (max-width: 640px) {

  /* ── shared: titles + card blocks on every list page ── */
  #page-parts .page-title,
  #page-sold .page-title,
  #page-sets .page-title,
  #page-contacts .page-title {
    font-size: 1rem !important; margin-bottom: 0.4rem !important;
    flex-wrap: wrap; row-gap: 0.4rem; letter-spacing: 0.02em;
  }
  #page-parts, #page-sold, #page-sets, #page-contacts { overflow-x: hidden; }

  /* ── Parts Needed ── */
  #page-parts > div:nth-of-type(2) {          /* the explainer paragraph */
    font-size: 0.74rem !important; margin-bottom: 0.5rem !important; line-height: 1.35;
  }
  #parts-list { display: flex; flex-direction: column; gap: 0.45rem; }
  #parts-list > div { padding: 0.6rem 0.7rem !important; }
  #parts-list button {
    min-height: 34px !important; padding: 0.25rem 0.4rem !important;
    font-size: 0.74rem !important; white-space: nowrap; line-height: 1.1;
  }

  /* ── Sold Items ── */
  #page-sold .filter-bar {
    display: grid !important; grid-template-columns: auto minmax(0, 1fr);
    gap: 0.4rem !important; align-items: stretch;
  }
  #page-sold .filter-bar > select,
  #page-sold .filter-bar > button {
    width: 100%; min-width: 0; min-height: 38px !important;
    padding: 0.3rem 0.45rem !important; font-size: 0.8rem !important;
  }
  #page-sold .filter-bar > div { min-width: 0; }   /* search rides beside the sort arrow */
  #page-sold > div:nth-of-type(3) { margin-bottom: 0.5rem !important; }
  #sold-cards { gap: 0.45rem !important; }
  #sold-cards > div { padding: 0.6rem 0.7rem !important; }
  #sold-cards button {
    min-height: 34px !important; padding: 0.25rem 0.4rem !important;
    font-size: 0.74rem !important; white-space: nowrap; line-height: 1.1;
  }

  /* ── Sets ── */
  #page-sets .sets-filter-bar {              /* search + year + gauge row */
    display: grid !important; grid-template-columns: 1fr 1fr;
    gap: 0.4rem !important; margin-bottom: 0.5rem !important; align-items: stretch;
  }
  #page-sets .sets-filter-bar > div:first-child { grid-column: 1 / -1; max-width: none !important; min-height: 38px; }
  #page-sets .sets-filter-bar > select {
    width: 100%; min-width: 0; min-height: 38px !important;
    padding: 0.3rem 0.45rem !important; font-size: 0.8rem !important;
  }
  #sets-count-label { grid-column: 1 / -1; text-align: right; }
  #sets-cards { gap: 0.45rem !important; }
  #sets-cards > div { padding: 0.6rem 0.7rem !important; }
  #sets-cards button {
    min-height: 34px !important; padding: 0.25rem 0.4rem !important;
    font-size: 0.74rem !important; white-space: nowrap; line-height: 1.1;
  }

  /* ── Contacts (built by contacts.js) ── */
  #page-contacts .filter-bar { display: grid !important; grid-template-columns: 1fr 1fr; gap: 0.4rem !important; }
  #page-contacts .filter-bar > * { width: 100%; min-width: 0; min-height: 38px !important; }

  /* ── the condition pip everywhere else (Brad: "just delete it") ── */
  .condition-pip { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════════════
   v0.9.1033 (Brad: "when the keyboard pops up, you can hardly see what
   you're typing"). While the on-screen keyboard is up on a phone, the
   wizard popup only has an inch or two of height left — so its chrome
   stands down and gives that space to the field being typed in.
   .wiz-kb is put on / taken off the popup by _kbApply() in wizard.js.
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .modal.wiz-kb .modal-header { padding-top: 0.5rem !important; padding-bottom: 0.35rem !important; }
  .modal.wiz-kb .modal-title { font-size: 0.95rem !important; line-height: 1.15 !important; }
  .modal.wiz-kb .modal-item-num { font-size: 0.62rem !important; margin-bottom: 0 !important; }
  .modal.wiz-kb #wizard-progress-wrap { display: none !important; }
  .modal.wiz-kb #wizard-adding-banner { display: none !important; }
  /* the ITEM TYPE selector stays put — Brad wants the maker/type visible while typing */
  .modal.wiz-kb .modal-footer { padding-top: 0.45rem !important; padding-bottom: 0.45rem !important; }
}

/* ══════════════════════════════════════════════════════════════════════
   v0.9.1036 (Brad: "can't scroll down to hit next when adding a grouped
   item"). The bottom nav is pinned to the screen at layer 800; popups sit
   at layer 200, so on a phone the nav painted straight over the wizard's
   footer and swallowed the Next button. Rather than re-stack them, the
   popup now ends ABOVE the nav — everything inside still scrolls, and the
   footer is always on screen where you can reach it.
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  /* the nav is ~85px tall on a phone — clear it with a little to spare */
  .modal-overlay { padding-bottom: 92px; }
  #wizard-modal .modal {
    max-height: calc(100vh - 108px);
    max-height: calc(100dvh - 108px);
  }
}
