/* Eye Spy Catalogue. Brand colours are the tokens below. */
:root {
  --blue: #2a6fa8;
  --blue-deep: #1d5687;
  --navy: #3e3672;
  --cyan: #03a0d8;
  --btn: #0b8ec4;
  --btn-hover: #0877a6;
  --ink: #1f2328;
  --muted: #646a73;
  --ground: #f3f5f8;
  --surface: #ffffff;
  --hair: #e3e7ec;
  --tint: #eaf3fa;
  --ok: #16794a; --ok-bg: #e5f5ec;
  --low: #9a5b00; --low-bg: #fdf1dc;
  --na: #5b6470; --na-bg: #eef0f3;
  --danger: #b42318;
  --r: 12px;
  --top: 112px;
  --font: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 8px); }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--ground); -webkit-font-smoothing: antialiased; }
body.has-tray { padding-bottom: 76px; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ── top bar ─────────────────────────────────────────── */
.top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--hair); padding-top: env(safe-area-inset-top); }
.top-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; margin-right: auto; }
.brand img { width: 38px; height: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text b { font-size: 16px; color: var(--navy); letter-spacing: .02em; }
.brand-text small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; }
.search { order: 3; flex: 1 1 100%; display: flex; align-items: center; gap: 8px; background: var(--ground); border: 1px solid var(--hair); border-radius: 999px; padding: 0 14px; height: 42px; color: var(--muted); }
.search:focus-within { border-color: var(--cyan); background: #fff; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; height: 100%; font-size: 15px; color: var(--ink); }
.top-tools { display: flex; align-items: center; gap: 6px; }
.seg { display: inline-flex; background: var(--ground); border: 1px solid var(--hair); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--blue-deep); color: #fff; }
.seg.big button { padding: 8px 16px; font-size: 14px; }
.icon-btn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--hair); background: #fff; border-radius: 999px; height: 34px; padding: 0 11px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--ink); border-color: #cfd6de; }
.icon-btn[aria-pressed="true"] { background: var(--low-bg); border-color: #f0d199; color: var(--low); }
.icon-btn span { display: none; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 16px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; text-decoration: none; padding: 6px 13px; border-radius: 999px; background: var(--ground); border: 1px solid var(--hair); font-size: 13.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.chip.on { background: var(--blue-deep); border-color: var(--blue-deep); color: #fff; }

/* ── layout ──────────────────────────────────────────── */
.layout { width: 100%; }
.side { display: none; }
main { padding: 16px; outline: none; min-width: 0; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 16px; }
.page-head h1 { font-size: 24px; color: var(--ink); }
.page-head .muted { font-size: 13.5px; margin-top: 2px; }
.crumb { font-size: 13px; margin-bottom: 2px; }
.crumb a { color: var(--blue); text-decoration: none; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── buttons ─────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 650; font-size: 14.5px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.sm { height: 36px; padding: 0 13px; font-size: 13.5px; }
.btn.primary { background: var(--btn); color: #fff; }
.btn.primary:hover { background: var(--btn-hover); }
.btn.ghost { background: #fff; border-color: var(--hair); color: var(--ink); }
.btn.ghost:hover { border-color: #c5cdd6; }
.btn.danger { background: #fff; border-color: #f1c4bf; color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.link { border: 0; background: none; padding: 0; color: var(--blue); font-weight: 600; font-size: 13px; cursor: pointer; }

/* ── home tiles ──────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.tile-hit { text-decoration: none; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.tile-pics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; height: 92px; margin-bottom: 9px; background: linear-gradient(180deg, #f8fafc, #fff); border-radius: 9px; padding: 6px; }
.tile-pics { overflow: hidden; grid-template-rows: 100%; }
.tile-pics img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.tile-ico { grid-column: 1 / -1; display: grid; place-items: center; color: #b6c4d2; }
.tile-ico svg { width: 40px; height: 40px; stroke-width: 1.4; }
.tile-name { font-weight: 700; font-size: 17px; }
.tile-meta { color: var(--muted); font-size: 13px; }
.tile .btn { align-self: stretch; }

/* ── product grid ────────────────────────────────────── */
.group-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 18px; }
.group-jump a { text-decoration: none; font-size: 13px; padding: 5px 11px; border-radius: 8px; background: var(--surface); border: 1px solid var(--hair); color: var(--ink); }
.group-jump em, .side em, .pl-tree em { font-style: normal; color: var(--muted); font-size: 12px; }
.group { margin-bottom: 26px; scroll-margin-top: calc(var(--top) + 8px); }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border-bottom: 2px solid var(--blue-deep); padding-bottom: 6px; margin-bottom: 12px; }
.group-head h2 { font-size: 17px; color: var(--blue-deep); }
h3.sub { font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 16px 0 8px; }
.grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r); display: flex; flex-direction: column; gap: 6px; padding: 10px 40px 10px 10px; transition: border-color .15s, box-shadow .15s; }
.card.on { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan); background: #f6fbfe; }
.card-hit { display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; min-width: 0; }
.ph { flex: none; width: 64px; height: 64px; display: grid; place-items: center; color: #b6c4d2; background: #fff; }
.ph img { width: 100%; height: 100%; object-fit: contain; }
.ph svg { width: 30px; height: 30px; stroke-width: 1.4; }
.body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.code { font-size: 12px; font-weight: 700; color: var(--blue-deep); letter-spacing: .01em; overflow-wrap: anywhere; }
.name { font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stock { white-space: nowrap; align-self: flex-start; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-top: 2px; }
.stock.ok { color: var(--ok); background: var(--ok-bg); }
.stock.low { color: var(--low); background: var(--low-bg); }
.stock.na { color: var(--na); background: var(--na-bg); }
.price { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; row-gap: 3px; padding-left: 76px; }
.price b { font-size: 16.5px; color: var(--ink); white-space: nowrap; }
.price small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.price .cost { flex: none; flex-basis: 100%; width: fit-content; max-width: 100%; font-size: 11px; font-weight: 600; color: var(--low); background: var(--low-bg); padding: 1px 6px; border-radius: 6px; }
.pick { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; cursor: pointer; }
.pick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pick span { position: absolute; inset: 3px; border: 2px solid #c3ccd6; border-radius: 6px; background: #fff; }
.pick input:checked + span { background: var(--cyan); border-color: var(--cyan); }
.pick input:checked + span::after { content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.pick input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }

.empty { text-align: center; background: var(--surface); border: 1px dashed #cdd5de; border-radius: var(--r); padding: 36px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty svg { width: 42px; height: 42px; color: #b6c4d2; stroke-width: 1.4; }
.empty h2 { font-size: 18px; }
.empty p { color: var(--muted); max-width: 46ch; }

/* ── selection tray ──────────────────────────────────── */
.tray { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; align-items: center; gap: 8px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--navy); color: #fff; box-shadow: 0 -6px 20px rgba(20, 30, 50, .18); }
.tray span { margin-right: auto; font-weight: 650; font-size: 14px; }
.tray .btn.ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }

/* ── dialogs ─────────────────────────────────────────── */
dialog.sheet { border: 0; padding: 0; width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; background: var(--surface); color: var(--ink); box-shadow: 0 -10px 40px rgba(0, 0, 0, .25); }
dialog.sheet::backdrop { background: rgba(15, 23, 35, .45); }
.sheet-in { display: flex; flex-direction: column; max-height: 92dvh; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 12px; border-bottom: 1px solid var(--hair); }
.sheet-head h2 { font-size: 18px; }
.close { width: 36px; height: 36px; padding: 0; justify-content: center; font-size: 15px; flex: none; }
.sheet-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--hair); background: #fbfcfd; }
.sheet-foot .btn { flex: 1 1 auto; }

.pd { overflow-y: auto; padding: 16px; display: grid; gap: 16px; }
.pd-img { display: grid; place-items: center; background: #fff; border: 1px solid var(--hair); border-radius: var(--r); height: 220px; padding: 12px; color: #b6c4d2; }
.pd-img img { max-height: 100%; object-fit: contain; }
.pd-img svg { width: 60px; height: 60px; stroke-width: 1.2; }
.pd-info { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.pd-name { font-size: 16px; font-weight: 600; }
.ptable { width: 100%; border-collapse: collapse; margin-top: 4px; }
.ptable th, .ptable td { padding: 9px 0; border-bottom: 1px solid var(--hair); text-align: left; font-weight: 600; font-size: 14.5px; }
.ptable th small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.ptable td { text-align: right; white-space: nowrap; font-size: 16px; }
.ptable tr.hi td { color: var(--blue-deep); font-size: 20px; }
.ptable .costrows th, .ptable .costrows td { color: var(--low); background: var(--low-bg); padding-inline: 8px; }

/* price list builder */
.pl { overflow-y: auto; padding: 16px; display: grid; gap: 18px; }
.pl-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.field small { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea, .mtable input { border: 1px solid #d3dae2; border-radius: 9px; padding: 9px 11px; background: #fff; font-weight: 400; font-size: 15px; width: 100%; min-width: 0; }
.field input:focus, .field select:focus, .field textarea:focus, .mtable input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(3, 160, 216, .15); }
.checks, .check { display: flex; flex-direction: column; gap: 8px; font-size: 14.5px; }
.checks label, .check { display: flex; gap: 9px; align-items: center; flex-direction: row; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--btn); margin: 0; flex: none; }
.pl-tree { border: 1px solid var(--hair); border-radius: var(--r); overflow: hidden; }
.pl-sec + .pl-sec { border-top: 1px solid var(--hair); }
.pl-sec summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; cursor: pointer; list-style: none; background: #fbfcfd; }
.pl-sec summary::-webkit-details-marker { display: none; }
.pl-sec summary label { display: flex; align-items: center; gap: 9px; }
.pl-sec summary::after { content: "▾"; color: var(--muted); font-size: 12px; transition: transform .15s; }
.pl-sec[open] summary::after { transform: rotate(180deg); }
.pl-sec summary em { margin-left: auto; }
.pl-groups { display: grid; gap: 2px; padding: 6px 12px 10px 38px; }
.pl-groups label { display: flex; align-items: center; gap: 9px; font-size: 14px; padding: 4px 0; }
.pl-groups em { margin-left: auto; }
.pl-selected { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--cyan); background: #f6fbfe; border-radius: var(--r); }
.pl-sum { margin-right: auto; font-size: 13.5px; color: var(--muted); flex: 1 1 100%; }
.pl-sum b { color: var(--ink); }

/* manage */
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 16px 0; border-bottom: 1px solid var(--hair); scrollbar-width: none; }
.tabs button { flex: none; border: 0; background: none; padding: 9px 12px; font-weight: 650; font-size: 14px; color: var(--muted); border-bottom: 2.5px solid transparent; cursor: pointer; }
.tabs button[aria-pressed="true"] { color: var(--blue-deep); border-bottom-color: var(--blue-deep); }
.mbody { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.example { background: var(--tint); border-radius: 10px; padding: 11px 13px; font-size: 14px; line-height: 1.6; }
.mh { font-size: 15px; margin-top: 6px; }
.mh small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.mtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.mtable th { text-align: left; font-size: 12.5px; color: var(--muted); padding: 4px 6px; }
.mtable td { padding: 4px 6px; border-top: 1px solid var(--hair); }
.mtable td:not(:first-child) { width: 92px; }
.mtable input { padding: 6px 8px; }
.mlist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--hair); border-radius: var(--r); }
.mlist li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; font-size: 13.5px; }
.mlist li + li { border-top: 1px solid var(--hair); }
.mlist small { display: block; color: var(--muted); font-size: 12px; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px 16px; border: 2px dashed #c6d2de; border-radius: var(--r); background: #fbfcfd; cursor: pointer; text-align: center; }
.drop.over { border-color: var(--cyan); background: #f0f9fd; }
.drop input { display: none; }
.drop b { color: var(--blue-deep); }
.drop span { color: var(--muted); font-size: 13px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.err { color: var(--danger); }
.edit-img { display: flex; align-items: center; gap: 14px; }
.edit-img .ph { width: 88px; height: 88px; border: 1px solid var(--hair); border-radius: 10px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; z-index: 100; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100% - 32px); transition: opacity .2s, transform .2s; white-space: pre-line; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.has-tray .toast { bottom: 90px; }

/* ── wider screens ───────────────────────────────────── */
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  dialog.sheet { max-width: 640px; margin: auto; border-radius: 16px; max-height: 88vh; }
  dialog.sheet.wide { max-width: 900px; }
  .sheet-in { max-height: 88vh; }
  .sheet-foot .btn { flex: 0 0 auto; }
  .pd { grid-template-columns: 240px 1fr; }
  .pl { grid-template-columns: 1fr 1fr; }
  .pl-sum { flex: 0 1 auto; }
  .icon-btn span { display: inline; }
}
@media (min-width: 960px) {
  :root { --top: 64px; }
  .top-row { flex-wrap: nowrap; padding: 11px 24px; gap: 16px; }
  .brand { margin-right: 8px; }
  .search { order: 0; flex: 1 1 auto; max-width: 560px; }
  .top-tools { margin-left: auto; }
  .chips { display: none; }
  .layout { display: grid; grid-template-columns: 180px 235px minmax(0, 1fr); }
  body.rail-hidden .layout { grid-template-columns: 235px minmax(0, 1fr); }
  body.rail-hidden .rail { display: none; }
  .side { display: block; position: sticky; top: var(--top); align-self: start; max-height: calc(100vh - var(--top)); overflow-y: auto; padding: 18px 10px 18px 20px; }
  .side-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; text-decoration: none; font-weight: 600; font-size: 14.5px; color: var(--ink); }
  .side-link svg { color: var(--blue); }
  .side-link em { margin-left: auto; }
  .side-link:hover { background: #e9eef4; }
  .side-link.on { background: var(--blue-deep); color: #fff; }
  .side-link.on svg, .side-link.on em { color: #cfe3f3; }
  .side-groups { display: flex; flex-direction: column; padding: 4px 0 8px 38px; }
  .side-groups a { text-decoration: none; font-size: 13.5px; color: var(--muted); padding: 4px 0; }
  .side-groups a:hover { color: var(--blue-deep); }
  main { padding: 22px 28px 40px; }
  .page-head h1 { font-size: 28px; }
}

/* quote quantities + discounts */
.pl-qty { border: 1px solid var(--hair); border-radius: var(--r); max-height: 320px; overflow-y: auto; }
.qrow { display: grid; grid-template-columns: var(--cols, 1fr auto); align-items: center; gap: 8px; padding: 7px 10px; font-size: 13px; }
.qrow + .qrow { border-top: 1px solid var(--hair); }
.qrow.qhead { position: sticky; top: 0; z-index: 1; background: #fbfcfd; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding-block: 6px; }
.qrow.qhead span:not(:first-child) { text-align: center; }
.qrow.off { opacity: .45; }
.qn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.qn b { display: block; color: var(--blue-deep); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.qn .below { display: block; font-style: normal; font-weight: 700; font-size: 11px; color: var(--danger); }
.qp { color: var(--ink); white-space: nowrap; text-align: right; font-weight: 600; }
.qp s { color: var(--muted); font-weight: 400; margin-right: 3px; }
.qrow input { width: 100%; border: 1px solid #d3dae2; border-radius: 8px; padding: 6px 4px; text-align: center; font-size: 15px; background: #fff; }
.qrow input:focus, .pct-in input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(3, 160, 216, .15); }
.qrow input[data-disc] { color: #007a4a; font-weight: 700; }
.disc-box { background: #eef8f2; border: 1px solid #cde9d8; border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.pct-in { display: flex; align-items: center; gap: 6px; }
.pct-in input { width: 90px; border: 1px solid #b9dcc7; border-radius: 9px; padding: 8px 10px; font-size: 17px; font-weight: 700; color: #007a4a; text-align: center; background: #fff; }
.pct-in b { font-size: 17px; color: #007a4a; }
.pl-sum .warn { color: var(--danger); font-weight: 700; }

/* new section tile + sections manager */
.tile-new { align-items: center; justify-content: center; text-align: center; border: 2px dashed #c6d2de; background: transparent; cursor: pointer; min-height: 200px; font: inherit; color: var(--ink); }
.tile-new:hover { border-color: var(--cyan); background: #f6fbfe; }
.tile-new .plus { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--tint); color: var(--blue-deep); font-size: 28px; line-height: 1; }
.sec-list li { gap: 8px; }
.sec-list input { flex: 1; min-width: 0; border: 1px solid #d3dae2; border-radius: 8px; padding: 7px 10px; font-size: 14.5px; }
.sec-list em { font-style: normal; color: var(--muted); font-size: 12px; min-width: 28px; text-align: right; }
.sec-btns { display: flex; gap: 4px; }
.sec-btns .btn { width: 34px; padding: 0; }
.row-btns .grow { flex: 1; min-width: 180px; border: 1px solid #d3dae2; border-radius: 9px; padding: 9px 11px; font-size: 15px; }

/* PDF preview */
dialog.sheet.preview { height: 92dvh; }
.preview .sheet-in { height: 100%; min-width: 0; width: 100%; overflow: hidden; }
.pv-pages { flex: 1; min-width: 0; min-height: 0; width: 100%; overflow-y: auto; overflow-x: hidden; background: #5d6670; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pv-pages canvas { display: block; max-width: 100%; height: auto; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .3); }
.pv-wait { color: #fff; margin-top: 30px; }
@media (min-width: 640px) { dialog.sheet.preview { height: 90vh; } }

/* live price check in the product form */
.cost-calc { margin: -4px 0 0; padding: 9px 12px; border-radius: 10px; background: var(--tint); font-size: 14px; color: var(--ink); }
.cost-calc b { color: var(--blue-deep); }
.cost-calc small { color: var(--muted); }

/* suppliers: column on desktop, chips on phones */
.rail { display: none; }
.chip-label { flex: none; align-self: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 2px 0 10px; border-left: 2px solid var(--hair); margin-left: 4px; }
.chip.sup { background: #f2f0fa; border-color: #dcd7ef; color: var(--navy); }
.chip.sup.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.sup.add { cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600; border-style: dashed; }
.sup-flag { color: var(--navy); }
.sup-card .price b { color: var(--navy); }
.price .ours { flex-basis: 100%; font-size: 11.5px; color: var(--muted); }
@media (min-width: 960px) {
  .rail { display: block; position: sticky; top: var(--top); align-self: start; max-height: calc(100vh - var(--top)); overflow-y: auto; padding: 18px 12px; background: #eceaf6; border-right: 1px solid #dcd7ef; min-height: calc(100vh - var(--top)); }
  .rail-head { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--navy); margin: 2px 2px 10px 8px; }
  .rail-hide { border: 0; background: none; color: var(--navy); font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: none; cursor: pointer; padding: 3px 6px; border-radius: 6px; }
  .rail-hide:hover { background: #dfdbf1; }
  /* tab on the left edge to bring the suppliers panel back */
  .rail-show { display: none; }
  body.rail-hidden .rail-show { display: flex; position: fixed; left: 0; top: calc(var(--top) + 18px); z-index: 15; writing-mode: vertical-rl; transform: rotate(180deg); align-items: center; gap: 6px; padding: 12px 6px; border: 1px solid #dcd7ef; border-left: 0; border-radius: 9px 0 0 9px; background: #eceaf6; color: var(--navy); font: inherit; font-size: 12.5px; font-weight: 700; letter-spacing: .06em; cursor: pointer; box-shadow: 2px 2px 8px rgba(30, 30, 60, .12); }
  body.rail-hidden .rail-show:hover { background: #dfdbf1; }
  body.rail-hidden .side { padding-left: 30px; }
  .rail-link { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--ink); }
  .rail-link em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--muted); }
  .rail-link:hover { background: #dfdbf1; }
  .rail-link.on { background: var(--navy); color: #fff; }
  .rail-link.on em { color: #d6d1ee; }
  .rail-add { margin: 10px 4px 0; width: calc(100% - 8px); border: 1.5px dashed #b9b1dc; background: transparent; border-radius: 9px; padding: 8px; font-weight: 600; font-size: 13.5px; color: var(--navy); cursor: pointer; }
  .rail-add:hover { background: #dfdbf1; }
  .rail-note { margin: 12px 8px 0; font-size: 12px; color: var(--muted); }
}

/* supplier box in product details */
.sup-move { display: flex; align-items: center; gap: 10px; width: 100%; font-weight: 600; font-size: 14px; }
.sup-move select { flex: 1; border: 1px solid #d3dae2; border-radius: 9px; padding: 7px 10px; font-size: 14.5px; background: #fff; color: var(--navy); font-weight: 600; }
.sup-move-note { margin-top: -6px; }
.sub-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sub-head h3.sub { margin-bottom: 8px; }

/* supplier prices panel (product details) */
.offers { width: 100%; border: 1px solid #dcd7ef; border-radius: 12px; background: #f7f6fc; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.offers-head { display: flex; flex-direction: column; }
.offers-head b { font-size: 13px; color: var(--navy); text-transform: uppercase; letter-spacing: .06em; }
.offers-head small { font-size: 12px; color: var(--muted); }
.offer { display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "name tag x" "cost cost cost"; align-items: center; column-gap: 8px; padding: 6px 8px; border-radius: 8px; background: #fff; border: 1px solid #e6e3f3; }
.offer.main { border-color: var(--navy); }
.o-name { grid-area: name; font-weight: 700; color: var(--navy); }
.offer .o-tag, .offer .link { grid-area: tag; }
.offer .o-x { grid-area: x; }
.o-cost { grid-area: cost; font-size: 12.5px; color: var(--low); }
.o-tag { font-size: 11px; font-weight: 700; background: var(--navy); color: #fff; border-radius: 999px; padding: 2px 8px; }
.o-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 4px; }
.o-x:hover { color: var(--danger); }
.offer-add summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--navy); padding: 4px 0; }
.offer-form { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.offer-form select, .offer-form input { border: 1px solid #d3dae2; border-radius: 8px; padding: 7px 9px; font-size: 14px; background: #fff; min-width: 0; }
.offer-form select, .offer-form [name=oNew] { grid-column: 1 / -1; }
.offer-form .btn { grid-column: 1 / -1; }
.price .all-sup { flex-basis: 100%; font-size: 11.5px; color: var(--navy); }
.o-sell { color: var(--ink); font-weight: 600; }

/* per-list price adjustments */
.adjust-note { background: #fff7e6; border: 1px solid #f3dcae; border-radius: var(--r); padding: 10px 12px; font-size: 13px; color: #6b4a00; }
.qrow input.over-in { color: #9a5b00; font-weight: 700; }

/* invoices */
.doc-seg { width: 100%; }
.doc-seg button { flex: 1; }
.inv-box { background: #f4f8fc; border: 1px solid #d3e3f1; border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.inv-box .form-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }

/* History */
.hist-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.hist-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.hist-filter button { border: 1px solid var(--hair); background: #fff; border-radius: 999px; padding: 6px 13px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.hist-filter button em { font-style: normal; font-size: 12px; opacity: .75; }
.hist-filter button[aria-pressed="true"] { background: var(--blue-deep); border-color: var(--blue-deep); color: #fff; }
#hq { flex: 1; min-width: 180px; max-width: 360px; border: 1px solid #d3dae2; border-radius: 999px; padding: 8px 14px; font-size: 14.5px; }
.hist-list { display: flex; flex-direction: column; gap: 8px; }
.hist { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "type main total" "acts acts acts"; gap: 6px 12px; align-items: center; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r); padding: 10px 12px; }
.h-type { grid-area: type; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 6px; background: var(--tint); color: var(--blue-deep); }
.h-type.invoice { background: #e5f5ec; color: #16794a; }
.h-type.quote { background: #f2f0fa; color: var(--navy); }
.h-main { grid-area: main; min-width: 0; }
.h-main b { color: var(--ink); }
.h-meta { font-size: 12.5px; color: var(--muted); }
.h-total { grid-area: total; font-weight: 700; white-space: nowrap; }
.h-acts { grid-area: acts; display: flex; flex-wrap: wrap; gap: 6px; }
.h-del { color: var(--danger); }
@media (min-width: 1500px) {
  .hist { grid-template-columns: 90px minmax(0, 1fr) auto auto; grid-template-areas: "type main total acts"; }
}

/* Import prices */
.imp-card { border: 1px solid var(--hair); border-radius: var(--r); padding: 12px 14px; margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.imp-card.done { background: #f6fbf7; }
.imp-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.imp-opts { display: flex; flex-direction: column; gap: 6px; }
.imp-list { max-height: 260px; overflow: auto; margin-top: 6px; }
.imp-num { white-space: nowrap; font-size: 13px; }
.imp-card details summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--blue-deep); }
.imp-sup td:not(:first-child) { width: auto; }

/* Login screen + sync light */
.gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: var(--ground); }
.gate-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--hair); border-radius: 16px; padding: 28px 22px 24px; box-shadow: 0 10px 40px rgba(15, 23, 35, .08); }
.gate-card img { align-self: center; }
.gate-card h1 { font-size: 21px; text-align: center; margin: 0; }
.gate-card .muted { text-align: center; margin: -6px 0 2px; }
.gate-err { color: var(--danger); font-size: 13.5px; min-height: 18px; margin: 0; }
.sync-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--na); flex: none; align-self: center; }
.sync-dot.ok { background: #1a9d5c; }
.sync-dot.syncing { background: var(--cyan); animation: syncpulse 1s ease-in-out infinite; }
.sync-dot.offline { background: #d99a1e; }
.sync-dot.error { background: var(--danger); }
@keyframes syncpulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .sync-dot.syncing { animation: none; } }
