* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }

/* buttons */
.primary, .ghost { display: inline-flex; align-items: center; justify-content: center; gap: .4em; border-radius: var(--r-pill); padding: .55em 1.2em; border: 1px solid var(--accent); text-decoration: none; font-size: 14px; white-space: nowrap; }
.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.primary:hover { background: var(--accent-hover); }
.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.ghost:hover { border-color: var(--accent); color: var(--accent); }
.ghost[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.link { background: none; border: 0; color: var(--accent); padding: 0; text-decoration: underline; }
.eyebrow { text-transform: var(--cap); letter-spacing: var(--cap-track); font-size: var(--cap-size); color: var(--accent); margin: 0 0 .6em; }

.ghost.only-mobile { display: none; }

/* header */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; padding: 12px clamp(16px, 4vw, 48px); background: var(--header-bg); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); font: var(--dw) calc(26px * var(--dscale))/1 var(--display); letter-spacing: var(--brand-track); text-transform: var(--brand-case); }
.brand b { font-weight: 400; }
.brand .logo { width: 44px; height: 44px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1.5px var(--accent-line); }
.search { flex: 1; max-width: 520px; margin-left: auto; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 0 16px; background: var(--panel); color: var(--muted); }
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; background: none; border: 0; outline: 0; padding: 10px 0; color: var(--text); min-width: 0; }
.top-actions { display: flex; gap: 8px; }

/* hero */
.hero { text-align: center; padding: clamp(28px, 4.5vw, 56px) 16px 16px; background: radial-gradient(ellipse at 50% 0%, var(--hero-glow), transparent 60%); }
.hero h1 { font: var(--dw) calc(clamp(36px, 6vw, 68px) * var(--dscale))/1.05 var(--display); letter-spacing: var(--h-track); margin: 0 0 .3em; }
.hero .sub { color: var(--muted); margin: 0; }

/* category tabs */
.cats { display: flex; gap: 8px; padding: 8px clamp(16px, 4vw, 48px) 18px; overflow-x: auto; justify-content: safe center; scrollbar-width: none; }
.cats button { background: none; border: 1px solid var(--line); border-radius: var(--r-pill); padding: .5em 1.1em; white-space: nowrap; color: var(--muted); }
.cats button:hover { color: var(--text); border-color: var(--accent-line); }
.cats button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.cats small { opacity: .7; margin-left: .35em; }

/* layout */
.layout { display: grid; grid-template-columns: 250px 1fr; gap: 32px; padding: 0 clamp(16px, 4vw, 48px) 64px; max-width: 1500px; margin: 0 auto; }
.layout > * { min-width: 0; }
.filters { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 92px); overflow: auto; padding-right: 4px; }
.filters-head { display: flex; justify-content: space-between; align-items: baseline; }
.filters h2 { font: var(--dw) calc(22px * var(--dscale)) var(--display); letter-spacing: var(--h-track); margin: 0 0 8px; }
fieldset { border: 0; border-top: 1px solid var(--line); padding: 16px 0; margin: 0; }
legend { padding: 0; font-size: var(--cap-size); text-transform: var(--cap); letter-spacing: var(--cap-track); color: var(--muted); float: left; width: 100%; margin-bottom: 10px; }
legend small { text-transform: none; letter-spacing: 0; opacity: .7; }
fieldset > *:not(legend) { clear: both; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills button { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: var(--r-pill); padding: .3em .85em; font-size: 13px; }
.pills.small { margin-top: 10px; } .pills.small button { font-size: 12px; color: var(--muted); }
.pills button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.range { display: flex; align-items: center; gap: 8px; }
.range input { width: 100%; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-in); padding: 8px 10px; }
.range input:focus { border-color: var(--accent); outline: 0; }
.check { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; cursor: pointer; }
.check input { accent-color: var(--accent); margin-top: 4px; }
.check small { color: var(--muted); display: block; font-size: 12px; }

.bar { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.bar p { margin: 0; color: var(--muted); flex: 1; }
.sort { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.sort select { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-in); padding: 7px 10px; }

/* grid + card */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; cursor: pointer; transition: border-color .15s, transform .15s; display: flex; flex-direction: column; }
.card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.card.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.card .ph { aspect-ratio: 1; background: var(--photo-bg); display: grid; place-items: center; }
.card img { width: 100%; height: 100%; object-fit: contain; }
.card .meta { padding: 12px 14px 14px; }
.card .serial { font: var(--dw) calc(19px * var(--dscale))/1.2 var(--display); letter-spacing: var(--h-track); }
.card .cat { color: var(--muted); font-size: var(--cap-size); text-transform: var(--cap); letter-spacing: var(--cap-track); }
.card .facts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 13px; color: var(--soft); }
.card .facts span::before { content: ""; }
.badge { display: inline-block; font-size: 11.5px; color: var(--accent); border: 1px solid var(--accent-line); border-radius: var(--r-pill); padding: .1em .7em; margin-top: 8px; }
.pick { position: absolute; top: 10px; left: 10px; width: 26px; height: 26px; border-radius: 6px; background: rgba(0,0,0,.65); border: 1.5px solid #aaa; display: none; place-items: center; }
.admin .pick { display: grid; }
.card.sel .pick { background: var(--accent); border-color: var(--accent); }
.card.sel .pick::after { content: "✓"; color: var(--accent-ink); font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: 64px 0; }

.foot { border-top: 1px solid var(--line); padding: 32px clamp(16px, 4vw, 48px) 110px; display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; }
.foot b { font: var(--dw) calc(20px * var(--dscale)) var(--display); letter-spacing: var(--brand-track); color: var(--text); text-transform: var(--brand-case); }
.foot p { margin: 4px 0 0; } .foot .muted { max-width: 420px; }

/* admin tray */
.tray { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 20px; background: var(--tray-bg); border: 1px solid var(--accent); border-radius: var(--r-pill); box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.tray[hidden] { display: none; }
.admin-banner { }
body.admin .top { box-shadow: inset 0 -2px 0 var(--accent); }

/* dialogs */
dialog { color: var(--text); border: 1px solid var(--line); padding: 0; background: var(--panel); }
dialog::backdrop { background: var(--overlay); backdrop-filter: blur(3px); }
.close { position: absolute; top: 10px; right: 14px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 24px; line-height: 1; }
.close:hover { border-color: var(--accent); color: var(--accent); }
.close.static { position: static; }

.detail { width: min(1080px, 94vw); max-height: 92vh; border-radius: var(--r-card); overflow: auto; }
.d-grid { display: grid; grid-template-columns: 1.1fr 1fr; }
.d-photo { background: var(--photo-bg); display: grid; place-items: center; position: relative; min-height: 380px; }
.d-photo img { width: 100%; max-height: 80vh; object-fit: contain; }
.d-nav { position: absolute; inset: auto 0 12px; display: flex; justify-content: space-between; padding: 0 12px; pointer-events: none; }
.d-nav button { color: #fff; pointer-events: auto; width: 40px; height: 40px; border-radius: 50%; background: rgba(0,0,0,.55); border: 1px solid var(--line); font-size: 24px; line-height: 1; }
.d-nav button:hover { border-color: var(--accent); color: var(--accent); }
.d-info { padding: 36px 36px 28px; }
.d-info h2 { font: var(--dw) calc(40px * var(--dscale))/1.1 var(--display); letter-spacing: var(--h-track); margin: 0 0 6px; }
.headline { color: var(--accent); margin: 0 0 20px; font-size: 15px; }
.spec { border: 1px solid var(--line); border-radius: var(--r-in); margin-bottom: 12px; overflow: hidden; }
.spec h3 { margin: 0; padding: 8px 14px; font: 500 var(--cap-size) var(--body); text-transform: var(--cap); letter-spacing: var(--cap-track); color: var(--muted); background: var(--panel2); }
.spec dl { margin: 0; padding: 4px 14px; }
.spec dl > div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.spec dl > div:last-child { border: 0; }
.spec dt { color: var(--muted); } .spec dd { margin: 0; text-align: right; }
.d-cta { display: flex; gap: 10px; margin: 22px 0 14px; flex-wrap: wrap; }
.ondemand { border: 1px dashed var(--accent-line); border-radius: var(--r-in); padding: 14px; color: var(--soft); }

/* pdf builder */
.pdf-dlg { width: min(1200px, 96vw); height: min(860px, 92vh); border-radius: var(--r-card); overflow: hidden; }
.pdf-dlg[open] { display: grid; grid-template-columns: 300px 1fr; }
.pdf-side { padding: 20px; overflow: auto; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.pdf-side label:not(.check) { display: grid; gap: 6px; font-size: var(--cap-size); text-transform: var(--cap); letter-spacing: var(--cap-track); color: var(--muted); }
.pdf-side input[type="text"] { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-in); padding: 9px 10px; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); }
.pdf-side fieldset { padding: 12px 0 0; }
.pdf-head { display: flex; justify-content: space-between; align-items: center; }
.pdf-head h2 { font: var(--dw) calc(24px * var(--dscale)) var(--display); letter-spacing: var(--h-track); margin: 0; }
.pdf-actions { display: flex; gap: 8px; } .pdf-actions .primary { flex: 1; }
.pdf-preview { overflow: auto; background: var(--preview-bg); padding: 24px; }
.pdf-root { display: grid; gap: 22px; justify-items: center; }

/* A4 landscape pages, built at 297x210mm and scaled for preview */
.page { width: 297mm; height: 210mm; background: var(--pg-bg); color: var(--pg-text); position: relative; overflow: hidden; flex: none; zoom: var(--zoom, .55); font-family: var(--body); display: flex; flex-direction: column; padding: 11mm 14mm 9mm; }
.pg-head { display: flex; align-items: center; gap: 4mm; height: 12mm; font: var(--dw) calc(20pt * var(--dscale))/1 var(--display); letter-spacing: var(--brand-track); text-transform: var(--brand-case); }
.pg-head .logo { width: 11mm; height: 11mm; border-radius: 50%; }
.pg-head .for { margin-left: auto; font: 400 9pt var(--body); letter-spacing: .06em; text-transform: none; color: var(--pg-muted); }
.pg-body { flex: 1; display: grid; gap: 5mm 6mm; padding: 4mm 0; min-height: 0; }
.per-6 .pg-body { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); }
.per-3 .pg-body { grid-template-columns: repeat(3, 1fr); }
.per-1 .pg-body { grid-template-columns: 1.2fr 1fr; align-items: start; gap: 12mm; }
.pcell { display: flex; flex-direction: column; min-height: 0; text-align: center; align-items: center; }
.pcell .im { flex: none; height: 78mm; width: 100%; }
.per-6 .pcell .im { height: 52mm; }
.pcell img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pcell .sn { font: 400 11pt var(--body); color: var(--pg-soft); margin: 2mm 0; }
.pcell table { width: 88%; border-collapse: collapse; font-size: 7.5pt; margin-bottom: 2mm; }
.pcell th { font-weight: 400; border: .25mm solid var(--pg-line); padding: 1.2mm; }
.pcell td { border: .25mm solid var(--pg-line); padding: 1.1mm 2mm; text-align: left; } .pcell td + td { text-align: right; }
.per-6 .pcell .sn { font-size: 9.5pt; }
.per-1 .pcell { align-items: stretch; text-align: left; }
.per-1 .pcell .im { height: 140mm; }
.per-1 .pcell .sn { font: var(--dw) calc(26pt * var(--dscale)) var(--display); letter-spacing: var(--h-track); margin: 0 0 4mm; color: var(--pg-text); }
.per-1 .pcell.ph-side { display: block; padding-top: 10mm; }
.per-1 .pcell table { width: 100%; font-size: 10pt; }
.pdemand { color: var(--accent); font-weight: 600; font-size: 9pt; margin-top: 1mm; }
.pg-foot { height: 8mm; display: flex; justify-content: space-between; align-items: center; font-size: 8.5pt; color: var(--pg-muted); font-family: var(--display); letter-spacing: .05em; }
.page.cover, .page.closing { align-items: center; justify-content: center; text-align: center; background: var(--pg-cover); }
.cover h1 { font: var(--dw) calc(46pt * var(--dscale))/1.1 var(--display); letter-spacing: var(--brand-track); text-transform: var(--brand-case); margin: 6mm 0 3mm; }
.cover .eyebrow { font-size: 10pt; }
.cover img.logo { width: 34mm; height: 34mm; }
.cover p { color: var(--pg-muted); margin: 1mm; }

/* ---------- mobile ---------- */
input, select, textarea { font-size: 16px; }              /* iOS zooms the page on focus below 16px */
button, a, .card { -webkit-tap-highlight-color: transparent; }
.sheet-close, .sheet-foot, .scrim { display: none; }
.pdf-opts { display: flex; flex-direction: column; gap: 14px; }
.n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.n[hidden] { display: none; }
body:has(dialog[open]), body.sheet-open { overflow: hidden; }

@media (max-width: 900px) {
  body { font-size: 16px; }
  .ghost.only-mobile { display: inline-flex; }

  /* header: brand + actions on one line, search under it; scrolls away so the sticky bar can own the top */
  .top { position: static; flex-wrap: wrap; gap: 10px 8px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; }
  .brand { font-size: calc(19px * var(--dscale)); gap: 9px; }
  .brand .logo { width: 36px; height: 36px; }
  .top-actions { margin-left: auto; gap: 6px; }
  .top-actions .ghost { padding: .5em .9em; min-height: 40px; font-size: 14px; }
  .search { order: 3; flex: 1 1 100%; max-width: none; margin: 0; min-height: 46px; }
  .search input { padding: 12px 0; }

  .hero { padding: 22px 16px 8px; }
  .hero h1 { font-size: calc(clamp(30px, 9vw, 40px) * var(--dscale)); }
  .hero .sub { font-size: 14px; max-width: 28ch; margin: 0 auto; }
  .eyebrow { margin-bottom: .4em; }

  /* categories: one swipeable row with edge padding */
  .cats { justify-content: flex-start; padding: 12px 14px 12px; scroll-snap-type: x proximity; gap: 8px; -webkit-overflow-scrolling: touch; }
  .cats button { scroll-snap-align: start; min-height: 42px; padding: .5em 1.15em; font-size: 15px; }

  .layout { display: block; padding: 0 12px 28px; }

  /* sticky filter / count / sort bar */
  .bar { position: sticky; top: 0; z-index: 15; margin: 0 -12px 12px; padding: 8px 12px; background: var(--header-bg); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); gap: 10px; }
  .bar p { flex: 1; white-space: nowrap; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  #filterBtn { min-height: 42px; padding: .4em 1em; }
  .sort span { display: none; }
  .sort select { max-width: 150px; min-height: 42px; padding: 8px 10px; font-size: 15px; }

  /* filters: bottom sheet */
  .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: var(--overlay); }
  .scrim[hidden] { display: none; }
  .filters { position: fixed; inset: auto 0 0 0; z-index: 40; max-height: 88dvh; margin: 0; padding: 0 18px calc(84px + env(safe-area-inset-bottom)); background: var(--panel); color: var(--text); border-radius: var(--r-card) var(--r-card) 0 0; border: 1px solid var(--line); border-bottom: 0; overflow: auto; transform: translateY(105%); transition: transform .26s cubic-bezier(.2,.8,.2,1); box-shadow: 0 -12px 40px rgba(0,0,0,.25); align-self: auto; }
  .filters.open { transform: none; }
  .filters-head { position: sticky; top: 0; z-index: 2; background: var(--panel); padding: 16px 0 10px; align-items: center; gap: 14px; }
  .filters-head::before { content: ""; position: absolute; top: 6px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: var(--line); }
  .filters-head h2 { margin: 0; flex: 1; font-size: calc(24px * var(--dscale)); }
  .sheet-close { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: transparent; font-size: 24px; line-height: 1; }
  .sheet-foot { display: block; position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); transform: translateY(150%); transition: transform .26s cubic-bezier(.2,.8,.2,1); z-index: 41; }
  .filters.open .sheet-foot { transform: none; }
  .sheet-foot .primary { width: 100%; min-height: 50px; font-size: 16px; }
  .pills button { min-height: 40px; padding: .35em 1em; font-size: 15px; }
  .pills.small button { font-size: 14px; }
  .range input { min-height: 46px; }
  .check { padding: 9px 0; font-size: 16px; } .check input { width: 20px; height: 20px; margin-top: 2px; }
  legend { font-size: 12px; }

  /* grid: two columns, full-bleed feel */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { transition: none; } .card:hover { transform: none; }
  .card .meta { padding: 9px 10px 11px; }
  .card .serial { font-size: calc(17px * var(--dscale)); overflow-wrap: anywhere; }
  .card .cat { font-size: 11px; }
  .card .facts { gap: 2px 9px; font-size: 13px; margin-top: 5px; }
  .badge { font-size: 11.5px; margin-top: 6px; }
  .pick { top: 8px; left: 8px; width: 34px; height: 34px; border-radius: 9px; }
  .card.sel .pick::after { font-size: 18px; }

  .foot { padding: 24px 16px calc(96px + env(safe-area-inset-bottom)); }

  /* product detail: full screen, photo then specs, sticky enquire bar */
  .detail { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; margin: 0; }
  .d-grid { display: block; }
  .d-photo { min-height: 0; height: min(78vw, 46dvh); touch-action: pan-y; }
  .d-photo img { max-height: 100%; height: 100%; width: 100%; object-fit: contain; }
  .d-nav { inset: auto 0 10px; } .d-nav button { width: 44px; height: 44px; }
  .detail > .close { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; background: rgba(0,0,0,.6); border-color: rgba(255,255,255,.3); color: #fff; }
  .d-info { padding: 18px 18px calc(110px + env(safe-area-inset-bottom)); }
  .d-info h2 { font-size: calc(34px * var(--dscale)); }
  .headline { font-size: 15px; margin-bottom: 16px; }
  .spec dl > div { padding: 10px 0; font-size: 15.5px; }
  .d-cta { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; margin: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0,0,0,.12); flex-wrap: nowrap; }
  .d-cta .primary { flex: 1; min-height: 48px; font-size: 16px; }
  .d-cta .ghost { min-height: 48px; padding: 0 1.2em; }
  .d-info > .muted { margin-top: 18px; }

  /* admin tray: full-width bar docked to the bottom */
  .tray { left: 0; right: 0; bottom: 0; transform: none; border-radius: var(--r-card) var(--r-card) 0 0; border-width: 1px 0 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); gap: 8px; box-shadow: 0 -8px 30px rgba(0,0,0,.25); }
  .tray > span { flex: 1; font-size: 14px; white-space: nowrap; }
  .tray .ghost, .tray .primary { min-height: 44px; padding: .4em .95em; font-size: 14px; }
  .hide-sm { display: none; }
  body.admin .lab { bottom: calc(76px + env(safe-area-inset-bottom)); }

  /* PDF builder: full screen, preview on top, options tucked into a bottom panel */
  .pdf-dlg { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; margin: 0; }
  .pdf-dlg[open] { display: flex; flex-direction: column-reverse; }
  .pdf-preview { flex: 1; min-height: 0; padding: 12px; }
  .pdf-side { border: 0; border-top: 1px solid var(--line); padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); gap: 10px; max-height: 62dvh; flex: none; }
  .pdf-head { order: -1; } .pdf-head h2 { font-size: calc(20px * var(--dscale)); }
  .pdf-opts { display: none; }
  .pdf-dlg.show-opts .pdf-opts { display: flex; }
  .pdf-dlg.show-opts .pdf-preview { flex: 0 0 24dvh; }
  .pdf-side > .muted.small:last-child { display: none; }
  .pdf-actions .primary, .pdf-actions .ghost { min-height: 48px; font-size: 15px; }
  .pdf-actions .ghost[data-close] { display: none; }
  .pdf-side .check { padding: 8px 0; }

  /* design lab */
  .lab { left: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .lab > button.lab-open { padding: .6em 1em; min-height: 40px; }
  .lab-panel { position: fixed; left: 0; right: 0; bottom: 0; width: auto; max-height: 72dvh; border-radius: var(--r-card) var(--r-card) 0 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .lab-opt { min-height: 48px; }
}
@media (max-width: 380px) {
  .brand span { font-size: .9em; }
  .top-actions .ghost:first-child { display: none; }       /* WhatsApp lives in the detail bar on very small phones */
}

#printRoot { display: none; }
@media print {
  body { background: var(--pg-bg); }
  body > *:not(#printRoot) { display: none !important; }
  #printRoot { display: block; }
  .page { zoom: 1 !important; break-after: page; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* design lab */
.lab { position: fixed; left: 16px; bottom: 16px; z-index: 50; font-size: 13px; }
.lab > button.lab-open { background: var(--text); color: var(--bg); border: 0; border-radius: var(--r-pill); padding: .6em 1.1em; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.3); }
.lab-panel { width: min(340px, calc(100vw - 32px)); max-height: min(78vh, 640px); overflow: auto; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: 0 16px 50px rgba(0,0,0,.35); padding: 14px 14px 12px; }
.lab-panel h3 { margin: 0 0 4px; font: var(--dw) calc(20px * var(--dscale)) var(--display); }
.lab-panel .hint { color: var(--muted); margin: 0 0 10px; font-size: 12px; }
.lab-panel h4 { margin: 14px 0 6px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.lab-opts { display: grid; gap: 6px; }
.lab-opts.cols2 { grid-template-columns: 1fr 1fr; } .lab-opts.cols3 { grid-template-columns: repeat(3, 1fr); }
.lab-opt { display: flex; align-items: center; gap: 9px; text-align: left; background: transparent; border: 1px solid var(--line); border-radius: var(--r-in); padding: 7px 9px; color: var(--text); }
.lab-opt:hover { border-color: var(--accent); }
.lab-opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.lab-opt .sw { display: inline-flex; flex: none; border-radius: 50%; overflow: hidden; width: 28px; height: 28px; border: 1px solid rgba(128,128,128,.4); }
.lab-opt .sw i { flex: 1; }
.lab-opt .nm { font-weight: 600; line-height: 1.15; } .lab-opt .ds { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.lab-opt .aa { font-size: 22px; line-height: 1; width: 32px; text-align: center; flex: none; }
.lab-row { display: flex; gap: 8px; margin-top: 14px; }
.lab-row button { flex: 1; background: transparent; border: 1px solid var(--line); border-radius: var(--r-in); padding: 7px; color: var(--text); }
.lab-row button:hover { border-color: var(--accent); color: var(--accent); }
@media print { .lab { display: none !important; } }

/* serials and figures read better with lining numerals, whatever the display face */
.card .serial, .d-info h2, .pcell .sn, .facts, .spec dd, .headline { font-variant-numeric: lining-nums; font-feature-settings: "lnum"; }
