/* Alpha-Delta Spare Parts. Brand tokens copied from 00_CLAUDE_ALPHA/00_BRAND/tokens.css (do not link across projects),
   then a few portal values with more contrast (customers are often older: darker greys, visible rules). */

:root {
  /* Surfaces and text */
  --bg: #f5f5f2;
  --card: #ffffff;
  --ink: #1d1d1b;
  --muted: #6b6b66;
  --line: #e3e2dc;
  --hover: #f0efe9;

  /* Brand */
  --accent: #1a6b4f;
  --accent-soft: #e4f1eb;
  --accent-ink: #ffffff;
  --gold: #c9970e;

  /* Status (success = accent) */
  --warn: #8a5a00;
  --warn-soft: #fbf1dc;
  --bad: #a12b2b;
  --bad-soft: #f8e3e3;

  /* Fixed logo colours (same in both modes) */
  --forest: #23402a;
  --forest-deep: #16261a;
  --forest-light: #3a7a40;
  --gold-bright: #e8be22;
  --cream: #f8efcf;

  /* Shape and spacing */
  --radius: 12px;
  --radius-control: 10px;
  --radius-small: 8px;
  --radius-tiny: 6px;
  --radius-pill: 999px;
  --space-xs: 4px;
  --space-s: 8px;
  --space-m: 12px;
  --space-l: 16px;
  --space-xl: 24px;
  --space-xxl: 32px;

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --font-size: 15px;
  --line-height: 1.4;

  --watermark-opacity: 0.2;
}
/* Portal: more contrast than the shared tokens. */
:root {
  --muted: #52524d;
  --line: #d4d3cb;
  --line-strong: #a9a89f;
  --font-size: 16px;
  --accent-hover: #145a42;
  --pic-bg: #ffffff;
  --header-h: 67px;
  color-scheme: light;
}
/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: var(--font-size)/1.45 var(--font);
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 19px; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
#main:focus, h1:focus { outline: none; }

.ic { display: inline-flex; width: 20px; height: 20px; flex: none; }
.ic svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.sr-only, .offscreen { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 200; background: var(--card); padding: 10px 14px; border: 2px solid var(--accent); border-radius: var(--radius-control); }
.skip:focus { top: 8px; }
.muted { color: var(--muted); font-weight: 400; }
.label { text-transform: uppercase; letter-spacing: .06em; font-size: 12px; font-weight: 700; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.pad { padding: var(--space-l); }
.print-only { display: none; }

/* ------------------------------------------------------------------ buttons and controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 9px 16px; border-radius: var(--radius-control);
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  font-weight: 700; cursor: pointer; text-decoration: none; text-align: center; line-height: 1.2;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.secondary { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--hover); }
.btn.wide { width: 100%; }
.btn.big { min-height: 52px; padding: 12px 26px; font-size: 18px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  background: none; border: 0; border-radius: var(--radius-control); cursor: pointer; color: var(--ink); padding: 0;
}
.icon-btn:hover { background: var(--hover); }

input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; font-size: 16px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-control);
}
textarea { resize: vertical; line-height: 1.4; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input.ro { background: var(--hover); }

.stepper {
  display: grid; grid-template-columns: 44px minmax(44px, 1fr) 44px; height: 46px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-control); overflow: hidden; background: var(--card);
}
.stepper .step { background: var(--hover); border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--ink); }
.stepper .step:hover { background: var(--line); }
.stepper .step:first-child { border-right: 1px solid var(--line-strong); }
.stepper .step:last-child { border-left: 1px solid var(--line-strong); }
.stepper input {
  width: 100%; min-width: 0; min-height: 0; height: 100%; border: 0; border-radius: 0; text-align: center;
  font-weight: 700; font-variant-numeric: tabular-nums; padding: 0 4px;
}

.segs { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-control); overflow: hidden; flex: none; }
.seg {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px;
  background: var(--card); border: 0; cursor: pointer; font-weight: 600; color: var(--ink);
}
.seg + .seg { border-left: 1px solid var(--line-strong); }
.seg[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

.notice { padding: 12px 14px; border-radius: var(--radius-control); background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.notice.bad { background: var(--bad-soft); color: var(--bad); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; justify-content: space-between; }

.loading { display: flex; align-items: center; gap: 10px; padding: 24px 4px; color: var(--muted); font-weight: 600; animation: appear 0s .3s both; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes appear { from { visibility: hidden; } to { visibility: visible; } }

/* ------------------------------------------------------------------ header */

.top {
  position: sticky; top: 0; z-index: 30;
  background: var(--card); border-top: 3px solid var(--gold); border-bottom: 1px solid var(--line-strong);
}
.top-in { max-width: 1440px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 0 16px; min-height: 64px; }
.menu-btn { display: none; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex: none; }
.brand:hover { text-decoration: none; }
.brand img { width: 40px; height: 40px; }
.brand-t { display: flex; flex-direction: column; line-height: 1.15; }
.brand-t strong { font-size: 18px; }
.brand-t small { font-size: 13px; color: var(--muted); font-weight: 600; }
.search-slot { flex: 1; max-width: 640px; margin-left: 16px; }
.search { position: relative; margin: 0; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 42px; min-height: 46px; }
.search input::placeholder { color: var(--muted); opacity: 1; }
.search.big .ic { left: 16px; width: 24px; height: 24px; }
.search.big input { min-height: 58px; font-size: 18px; padding-left: 52px; border-width: 2px; }
.who { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; color: var(--ink); line-height: 1.2; max-width: 220px; min-height: 44px; justify-content: center; }
.who span, .who small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--muted); font-weight: 400; font-size: 13px; }
.cart-link {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-control); color: var(--ink); flex: none;
}
.cart-link:hover { background: var(--hover); text-decoration: none; }
.count { font-variant-numeric: tabular-nums; }
.cart-link .count {
  min-width: 24px; height: 24px; padding: 0 7px; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.cart-link .count[hidden] { display: none; }

body.signed-out .menu-btn, body.signed-out .search-slot, body.signed-out .who,
body.signed-out .cart-link, body.signed-out .side, body.signed-out .scrim { display: none !important; }
body.is-home .search-slot { visibility: hidden; }

/* ------------------------------------------------------------------ layout and sidebar */

.layout { max-width: 1440px; margin: 0 auto; display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 28px; padding: 20px 16px 48px; }
body.signed-out .layout { grid-template-columns: minmax(0, 1fr); }
main { min-width: 0; }

.side { position: sticky; top: calc(var(--header-h) + 20px); align-self: start; max-height: calc(100vh - var(--header-h) - 40px); overflow-y: auto; padding-right: 4px; }
.side-top { display: none; }
.side-sec + .side-sec { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.side-sec .label { margin: 0 0 8px 10px; }
.navlist { list-style: none; margin: 0; padding: 0; }
.nav {
  display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 8px 10px;
  border-radius: var(--radius-small); color: var(--ink); font-weight: 600; line-height: 1.25;
}
.nav:hover { background: var(--hover); text-decoration: none; }
.nav .t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.nav .n { color: var(--muted); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.nav[aria-current] { background: var(--accent-soft); color: var(--accent); }
.nav[aria-current] .n { color: var(--accent); }
.subs { margin: 2px 0 6px 18px; padding-left: 8px; border-left: 2px solid var(--line); }
.subs .nav { font-weight: 500; min-height: 40px; }
.subs .nav[aria-current] { font-weight: 700; }
.nav.radio .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; background: var(--card); }
.nav.radio[aria-current] .dot { border-color: var(--accent); box-shadow: inset 0 0 0 4px var(--card); background: var(--accent); }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 40; }

/* ------------------------------------------------------------------ shared page parts */

.crumbs { margin-bottom: 12px; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; font-size: 15px; }
.crumbs li { display: inline-flex; align-items: center; min-width: 0; }
.crumbs li + li::before { content: "›"; margin: 0 8px; color: var(--muted); }
.crumbs a { display: inline-flex; align-items: center; min-height: 32px; }
.crumbs .ic { display: none; }
.crumbs [aria-current] { color: var(--muted); overflow-wrap: anywhere; }

.list-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.lh-t { min-width: 0; flex: 1 1 260px; }
.lh-t h1 { overflow-wrap: anywhere; }
.list-head .count { color: var(--muted); margin-top: 4px; font-weight: 600; }
.head-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.note { margin: -6px 0 14px; }

.sec { margin-top: 32px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.more { margin-top: 16px; }

.empty { text-align: center; padding: 36px 16px; }
.empty .watermark { width: 120px; height: 120px; margin: 0 auto 14px; opacity: var(--watermark-opacity); pointer-events: none; user-select: none; }
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 46ch; margin: 0 auto; }

.pic { display: block; position: relative; background: var(--pic-bg); aspect-ratio: 1 / 1; overflow: hidden; }
.pic img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--hover); color: var(--line-strong); }
.ph .ic { width: 42%; height: 42%; max-width: 72px; max-height: 72px; }
.ph .ic svg { stroke-width: 2.5; }

.bought {
  display: inline-block; align-self: flex-start; margin-top: 6px; padding: 2px 10px; border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 700;
}

/* ------------------------------------------------------------------ home */

.hero { max-width: 780px; padding: 8px 0 4px; }
.hero h1 { font-size: 28px; margin-bottom: 14px; }
.hero .hint { color: var(--muted); margin-top: 10px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; overflow: hidden; color: var(--ink); }
.tile:hover { border-color: var(--line-strong); text-decoration: none; }
.tile:hover .tt strong { color: var(--accent); }
.tile .pic { aspect-ratio: 4 / 3; border-bottom: 1px solid var(--line); }
.tt { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px 12px; }
.tt strong { font-size: 17px; }
.tt span { color: var(--muted); font-weight: 600; font-size: 14px; }

/* ------------------------------------------------------------------ my machines */

.mgrid { display: grid; grid-template-columns: 1fr; gap: 8px; }      /* one tidy row per machine, whatever the width (a lone card in a wide grid left dead space) */
.mgroups > .sec:first-child { margin-top: 4px; }
.mcard { display: grid; grid-template-columns: 52px minmax(0, 1fr) 20px; gap: 14px; align-items: center; padding: 14px 12px 14px 14px; min-height: 88px; color: var(--ink); }
.mcard:hover { border-color: var(--line-strong); text-decoration: none; }
.mcard:hover .m-n { color: var(--accent); }
.mcard > .ic { color: var(--muted); }
.m-ic { width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-small); background: var(--accent-soft); color: var(--accent); }
.m-ic .ic { width: 30px; height: 30px; }
.m-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.m-n { font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.m-s { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.m-a { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.m-c { font-size: 14px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.sec-empty { color: var(--muted); font-weight: 600; padding: 4px 0; }

/* documents of a machine: one row each, the whole row opens the PDF in a new tab */
.dgroup + .dgroup { margin-top: 18px; }
.dg-h { font-size: 16px; margin: 0 0 8px; }
.docs { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.docs li + li { border-top: 1px solid var(--line); }
.drow { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 64px; padding: 10px 12px 10px 14px; color: var(--ink); }
a.drow:hover { background: var(--hover); text-decoration: none; }
a.drow:hover .d-n { color: var(--accent); }
.pdf { width: 40px; height: 48px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; border: 2px solid var(--muted); border-radius: 4px 12px 4px 4px; color: var(--ink); background: var(--card); font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.d-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.d-n { font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.d-s { font-size: 14px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.d-open { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); color: var(--accent); font-weight: 700; white-space: nowrap; background: var(--card); }
.d-open .ic { width: 18px; height: 18px; }
.doc-tip { margin-top: 10px; color: var(--muted); font-size: 14px; }

/* spare parts of a machine */
.mp-head { margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.mp-head .count { color: var(--muted); margin-top: 4px; font-weight: 600; }
.mp-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.mp-find { position: relative; flex: 1 1 auto; max-width: 480px; min-width: 0; }
.mp-find .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.mp-find input { padding-left: 42px; }
.mp-find input::placeholder { color: var(--muted); opacity: 1; }

/* ------------------------------------------------------------------ part cards: grid */

.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(224px, 1fr)); gap: 12px; }
.part { display: flex; flex-direction: column; overflow: hidden; }
.part .pic-wrap { position: relative; border-bottom: 1px solid var(--line); }

/* bookmark + «add to list»: on cards they sit on the picture's top-right corner, on rows in their own column */
.tools { display: flex; gap: 6px; }
.part .tools { position: absolute; top: 6px; right: 6px; flex-direction: column; }
.tool { color: var(--ink); background: var(--card); border: 1px solid var(--line-strong); border-radius: 50%; }
.tool:hover { background: var(--hover); color: var(--accent); }
.save[aria-pressed="true"], .save-t[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.save[aria-pressed="true"] .ic svg, .save-t[aria-pressed="true"] .ic svg { fill: currentColor; }
.part .body { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 12px 12px 10px; min-width: 0; }
.name { font-size: 16px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.name a { color: var(--ink); }
.name a:hover { color: var(--accent); }
.part .name { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.codes { font-size: 14px; display: grid; gap: 2px; }
.codes .k { color: var(--muted); }
.codes .v { font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.brand-l { font-size: 14px; color: var(--muted); }
.buy { display: grid; gap: 8px; padding: 0 12px 12px; }
.part .buy .btn { width: 100%; }

/* compact rows */
.prows { overflow: hidden; }
.prow { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.prow:last-child { border-bottom: 0; }
.prow .pic { width: 76px; border: 1px solid var(--line); border-radius: var(--radius-small); }
.prow .pic img { padding: 4px; }
.prow .body { display: grid; gap: 3px; min-width: 0; }
.prow .codes { grid-auto-flow: column; justify-content: start; gap: 16px; }
.prow .buy { padding: 0; grid-template-columns: 140px auto; align-items: center; }

/* small cards for strips and related parts */
.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 10px; }
.mini { display: flex; flex-direction: column; overflow: hidden; color: var(--ink); }
.mini:hover { border-color: var(--line-strong); text-decoration: none; }
.mini:hover .name { color: var(--accent); }
.mini .pic { border-bottom: 1px solid var(--line); }
.mini .name { font-size: 14px; padding: 8px 10px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini .id { font-size: 13px; color: var(--muted); font-weight: 600; padding: 2px 10px 10px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.mini .bought { margin: -4px 10px 10px; font-size: 12px; }

/* ------------------------------------------------------------------ item page */

.item { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 28px; align-items: start; }
.gallery { display: grid; gap: 10px; }
.main-pic { position: relative; display: block; width: 100%; padding: 0; aspect-ratio: 1 / 1; background: var(--pic-bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: zoom-in; }
div.main-pic { cursor: default; }
.main-pic img { width: 100%; height: 100%; object-fit: contain; padding: 16px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, 72px); gap: 8px; }
.thumb { position: relative; width: 72px; height: 72px; padding: 0; background: var(--pic-bg); border: 1px solid var(--line-strong); border-radius: var(--radius-small); overflow: hidden; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.thumb[aria-pressed="true"] { border: 2px solid var(--accent); }
.small { font-size: 13px; color: var(--muted); }

.info h1 { font-size: 28px; overflow-wrap: anywhere; }
.genuine { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 4px 12px 4px 8px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.genuine .ic { width: 18px; height: 18px; }
.code-list { margin-top: 16px; border-top: 1px solid var(--line); }
.code-row { display: grid; grid-template-columns: 128px minmax(0, 1fr) 44px; align-items: center; gap: 8px; min-height: 50px; border-bottom: 1px solid var(--line); }
.code-row .k { color: var(--muted); font-weight: 600; }
.code-row .v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.copy { color: var(--muted); }
.copy:hover, .copy.done { color: var(--accent); }
.info > .bought { margin-top: 14px; font-size: 14px; }
.buy-slot { margin-top: 18px; }
.buy-form { display: grid; gap: 4px; max-width: 460px; }
.buy-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; }
.buy-row .btn { min-height: 46px; }
.item-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 4px; }

.field { margin-bottom: 14px; }
.field > label { display: block; font-weight: 700; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 14px; margin-top: 4px; }
.form-err { color: var(--bad); background: var(--bad-soft); font-weight: 600; padding: 10px 12px; border-radius: var(--radius-control); margin-bottom: 12px; }
.form-err[hidden] { display: none; }
.ok { color: var(--accent); background: var(--accent-soft); font-weight: 600; padding: 10px 12px; border-radius: var(--radius-control); margin-top: 12px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.actions .hint { color: var(--muted); flex: 1 1 220px; }

.desc { max-width: 76ch; }
.desc h2 { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.desc p + p { margin-top: 10px; }
.desc p { white-space: pre-line; }
.specs { margin: 0; }
.specs > div { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.specs dt { color: var(--muted); font-weight: 600; }
.specs dd { margin: 0; font-weight: 600; }

/* picture viewer */
.viewer { position: fixed; inset: 0; z-index: 100; background: rgba(12, 12, 11, .94); display: flex; align-items: center; justify-content: center; padding: 56px 64px; }
.v-pic { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.v-pic img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; border-radius: var(--radius-small); padding: 12px; }
.viewer .icon-btn { position: absolute; background: rgba(255, 255, 255, .92); color: #1d1d1b; border-radius: 50%; width: 48px; height: 48px; }
.viewer .icon-btn:hover { background: #fff; }
.v-close { top: 12px; right: 12px; }
.v-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.v-next { right: 10px; top: 50%; transform: translateY(-50%); }
.v-cap { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #e9e8e3; font-size: 14px; }
body.viewer-open { overflow: hidden; }

/* ------------------------------------------------------------------ cart and orders */

.cart-lines { overflow: hidden; }
.cline { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cline:last-child { border-bottom: 0; }
.cline .pic { width: 72px; border: 1px solid var(--line); border-radius: var(--radius-small); }
.cline .pic img { padding: 4px; }
.cline .body { display: grid; gap: 2px; min-width: 0; }
.cline .name { color: var(--ink); }
.cline a.name:hover { color: var(--accent); }
.cline .meta { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.cline .opt { color: var(--ink); font-weight: 600; }
.cqty { display: grid; grid-template-columns: 148px auto; gap: 8px; align-items: center; }
.rm .ic { width: 18px; height: 18px; }
.oqty { font-size: 17px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.oqty .k { color: var(--muted); font-size: 14px; font-weight: 600; }
.order-form { margin-top: 20px; padding: 18px 18px 20px; }
.order-form h2 { margin-bottom: 14px; }
.order-form .field { max-width: 640px; }

.done { max-width: 620px; padding: 28px 24px; text-align: center; margin: 12px auto 0; }
.done-ic { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.done-ic .ic { width: 30px; height: 30px; }
.done .big-num { font-size: 22px; font-weight: 800; margin: 8px 0 10px; font-variant-numeric: tabular-nums; }
.done p { max-width: 50ch; margin-left: auto; margin-right: auto; }
.done .actions { justify-content: center; margin-top: 20px; }

.olist { overflow: hidden; }
.orow { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "o1 chev" "o2 chev"; column-gap: 12px; row-gap: 2px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink); min-height: 60px; }
.orow:last-child { border-bottom: 0; }
.orow:hover { background: var(--hover); text-decoration: none; }
.orow .o1 { grid-area: o1; display: flex; gap: 14px; flex-wrap: wrap; align-items: baseline; }
.orow .o1 strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.orow .o1 span { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.orow .o2 { grid-area: o2; color: var(--muted); font-weight: 400; font-size: 14px; overflow-wrap: anywhere; }
.orow > .ic { grid-area: chev; color: var(--muted); }

.facts { display: flex; flex-wrap: wrap; margin: 0 0 16px; overflow: hidden; }
.facts > div { flex: 1 1 190px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.facts > .wide { flex-basis: 100%; }
.facts > div:last-child { border-bottom: 0; }
.facts dt { text-transform: uppercase; letter-spacing: .06em; font-size: 12px; font-weight: 700; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.pre { white-space: pre-line; }
.facts-btn { display: flex; justify-content: flex-start; }
.facts-btn { align-items: center; flex-wrap: wrap; gap: 8px 18px; }
.privacy-link { min-height: 44px; display: inline-flex; align-items: center; }
.acct { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* lists */
.new-list { margin-top: 20px; padding: 18px 18px 20px; }
.new-list h2 { margin-bottom: 14px; }
.list-form .field { max-width: 560px; }
.actions.two .btn { min-width: 120px; }
.lrow .o2 { display: block; }
.lrow .lnote { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.list-note { margin-top: 8px; max-width: 70ch; font-weight: 600; }
.edit-slot .new-list { margin: 0 0 16px; }
.empty-list p { color: var(--muted); font-weight: 600; }

/* privacy */
.prose { max-width: 68ch; }
.prose p { line-height: 1.6; }
.prose p + p { margin-top: 12px; }
.privacy-card.auth-card { max-width: 640px; }
.auth-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; text-align: center; }
.auth-foot a { display: inline-flex; align-items: center; min-height: 44px; }

/* dialog (add to list, save cart as list) */
.dlg { padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); color: var(--ink);
  width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 48px); box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
.dlg::backdrop { background: rgba(0, 0, 0, .45); }
.dlg-in { padding: 6px 18px 18px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0 10px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.dlg-head .icon-btn { margin-right: -10px; }
.dlg-sub { margin-bottom: 14px; overflow-wrap: anywhere; }
.dlg-sub span { color: var(--muted); }
.dlg-note { margin-bottom: 12px; }
.dlg-rows { list-style: none; margin: 0 0 12px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-control); overflow: hidden; }
.dlg-rows li + li { border-top: 1px solid var(--line); }
.dlg-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 14px; background: var(--card); border: 0; cursor: pointer; text-align: left; color: var(--ink); }
.dlg-row:hover { background: var(--hover); }
.dlg-row:disabled { opacity: .6; cursor: default; }
.dlg-row .t { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.dlg-row .t .muted { font-size: 14px; }
.dlg-row .n { color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; }
.dlg .list-form .field { max-width: none; }
.dlg .list-form .actions .btn { width: 100%; }

/* «view as» strip: fixed at the very top on every view, amber = needs attention */
.va-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 95; display: flex; align-items: center; justify-content: center;
  gap: 8px 16px; flex-wrap: wrap; padding: 6px 16px; background: #7a4f00; color: #fff; font-weight: 700; text-align: center;
}
.va-t { overflow-wrap: anywhere; }
.va-stop.btn { min-height: 40px; padding: 6px 18px; background: #fff; color: #1d1d1b; border-color: #fff; }
.va-stop.btn:hover { background: #f5f5f2; border-color: #f5f5f2; }
body.viewing-as { padding-top: var(--va-h, 52px); }
body.viewing-as .top { top: var(--va-h, 52px); }
body.viewing-as .side { top: calc(var(--header-h) + 20px + var(--va-h, 52px)); max-height: calc(100vh - var(--header-h) - 40px - var(--va-h, 52px)); }
.acct .facts { margin: 0; }
.acct form h2 { margin-bottom: 14px; }

/* ------------------------------------------------------------------ sign-in and password pages */

.auth { display: flex; justify-content: center; padding: 24px 0; }
.auth-card { width: 100%; max-width: 460px; padding: 28px 28px 24px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.auth-brand img { width: 64px; height: 64px; }
.auth-brand div { display: flex; flex-direction: column; line-height: 1.2; }
.auth-brand strong { font-size: 20px; }
.auth-brand span { color: var(--muted); font-weight: 600; }
.auth-card h1 { font-size: 24px; margin-bottom: 8px; }
.auth-card .lead { color: var(--muted); margin-bottom: 18px; }
.auth-card .actions { flex-direction: column; align-items: stretch; text-align: center; gap: 14px; }
.auth-card .actions a { align-self: center; min-height: 32px; display: inline-flex; align-items: center; }

/* ------------------------------------------------------------------ toasts */

.toast-wrap { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 16px; border-radius: var(--radius-control);
  background: var(--ink); color: var(--bg); font-weight: 600; box-shadow: 0 6px 24px rgba(0, 0, 0, .22);
}
.toast span { flex: 1; min-width: 0; overflow-wrap: anywhere; padding: 6px 0; }
.toast a { color: inherit; text-decoration: underline; white-space: nowrap; }
.toast .icon-btn { color: inherit; flex: none; }
.toast .icon-btn:hover { background: rgba(127, 127, 127, .25); }
.toast.bad { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad); }

/* ------------------------------------------------------------------ tablets and phones */

@media (max-width: 1100px) {
  .acct { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .menu-btn { display: inline-flex; margin-left: -8px; }
  .who { display: none; }
  .search-slot { margin-left: 4px; }
  .cart-link { margin-left: auto; }
  .layout { display: block; padding-top: 16px; }
  .side {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; width: min(330px, 88vw); max-height: none;
    background: var(--card); border-right: 1px solid var(--line-strong); padding: 8px 12px 32px;
    transform: translateX(-102%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s;
    overscroll-behavior: contain;
  }
  .side.open { transform: none; visibility: visible; transition: transform .2s ease; }
  body.viewing-as .side { top: var(--va-h, 52px); max-height: none; }
  .side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
  .side-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
  .side-who span { color: var(--muted); font-size: 14px; }
  .nav { min-height: 46px; }
  .subs .nav { min-height: 44px; }
  body.side-open { overflow: hidden; }
  .item { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .gallery { max-width: 520px; }
}

@media (max-width: 640px) {
  :root { --font-size: 16px; }
  h1, .info h1 { font-size: 23px; }
  .top { position: static; }
  .top-in { flex-wrap: wrap; gap: 8px; padding: 0 12px; min-height: 0; }
  .menu-btn { order: 1; margin-left: -6px; }
  .brand { order: 2; flex: 1; min-width: 0; padding: 8px 0; }
  .brand img { width: 36px; height: 36px; }
  .brand-t strong { font-size: 17px; }
  .cart-link { order: 3; padding: 0 10px; }
  .cart-lbl { display: none; }
  .search-slot { order: 4; flex: 1 0 100%; max-width: none; margin: 0 0 10px; }
  body.is-home .search-slot { display: none; }
  .layout { padding: 14px 16px 40px; }

  .crumbs li { display: none; }
  .crumbs li.up { display: inline-flex; }
  .crumbs li + li::before { content: none; }
  .crumbs .up a { min-height: 44px; gap: 2px; margin-left: -4px; }
  .crumbs .ic { display: inline-flex; }

  .hero h1 { font-size: 23px; }
  .search.big input { min-height: 54px; font-size: 17px; }
  .tiles, .pgrid, .mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tt { padding: 8px 10px 10px; }
  .tt strong { font-size: 15px; }
  .part .body { padding: 10px 10px 8px; }
  .name { font-size: 15px; }
  .codes { font-size: 13px; }
  .buy { padding: 0 10px 10px; }
  .stepper { grid-template-columns: 44px minmax(36px, 1fr) 44px; }

  .lh-t { flex: 1 1 0; }
  .list-head { align-items: flex-start; }
  .list-head .segs { margin-top: -2px; }
  .part .bought, .mini .bought { font-size: 12px; white-space: nowrap; padding: 2px 8px; }
  .seg { padding: 0; width: 46px; justify-content: center; }
  .seg-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

  .prow { grid-template-columns: 64px minmax(0, 1fr) 44px; padding: 12px; gap: 6px 12px; }
  .prow .pic { width: 64px; align-self: start; }
  .prow .codes { grid-auto-flow: row; gap: 2px; }
  .prow .buy { grid-column: 1 / -1; grid-row: 2; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .prow .tools { grid-column: 3; grid-row: 1; flex-direction: column; align-self: start; }
  .part .tools { top: 4px; right: 4px; }
  .item-tools .btn { padding: 9px 10px; }
  .head-btns.three > :first-child { grid-column: 1 / -1; }
  .new-list { padding: 16px 14px; }
  .list-form .actions .btn { width: 100%; }
  .list-form .actions.two { display: grid; grid-template-columns: 1fr 1fr; }
  .lrow .o1 strong { overflow-wrap: anywhere; }
  .va-bar { flex-wrap: nowrap; justify-content: space-between; text-align: left; padding: 6px 12px; font-size: 15px; line-height: 1.3; }
  .va-stop.btn { flex: none; min-height: 44px; }
  .dlg-in { padding: 4px 14px 14px; }

  .mgrid { gap: 8px; }
  .mcard { grid-template-columns: 44px minmax(0, 1fr) 20px; gap: 12px; padding: 12px 10px 12px 12px; }
  .m-ic { width: 44px; height: 44px; }
  .m-ic .ic { width: 26px; height: 26px; }
  .drow { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; padding: 10px 10px 10px 12px; }
  .pdf { width: 34px; height: 42px; font-size: 11px; padding-bottom: 5px; }
  .d-open { padding: 0 10px; }
  .mp-find { max-width: none; }
  .facts.mfacts > div { flex-basis: 50%; }
  .facts.mfacts > .wide { flex-basis: 100%; }

  .code-row { grid-template-columns: 96px minmax(0, 1fr) 44px; }
  .buy-row { grid-template-columns: 136px minmax(0, 1fr); }

  .cline { grid-template-columns: 60px minmax(0, 1fr); gap: 8px 12px; padding: 12px; }
  .cline .pic { width: 60px; align-self: start; }
  .cqty { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) auto; }
  .cline.ro { grid-template-columns: 60px minmax(0, 1fr) auto; }
  .head-btns { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .order-form { padding: 16px 14px; }
  .order-form .actions .btn { width: 100%; }
  .facts > div { flex-basis: 100%; }

  .auth { padding: 4px 0; }
  .auth-card { padding: 20px 16px; }
  .viewer { padding: 60px 8px 48px; }
  .v-prev, .v-next { top: auto; bottom: 6px; transform: none; }
  .v-cap { bottom: 20px; padding: 0 64px; }
  .toast-wrap { right: 8px; left: 8px; width: auto; bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
  .spin { animation: none; }
}

/* ------------------------------------------------------------------ print (cart, order and list pages) */

@media print {
  @page { margin: 14mm; }
  :root { --bg: #fff; --card: #fff; --ink: #000; --muted: #333; --line: #999; --line-strong: #666; --accent: #1a6b4f; --accent-soft: #fff; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .no-print, .top, .side, .scrim, .toast-wrap, .skip, .crumbs, .viewer,
  .order-form, .cqty, .buy, .btn, .icon-btn, .segs, .tools, .va-bar, .dlg, .edit-slot { display: none !important; }
  body.viewing-as { padding-top: 0; }
  .list-note { font-weight: 400; }
  .print-only { display: block; }
  .print-head { display: flex; align-items: center; gap: 12px; padding-bottom: 8px; margin-bottom: 14px; border-bottom: 2px solid #c9970e; }
  .print-head img { width: 44px; height: 44px; }
  .layout { display: block; padding: 0; max-width: none; }
  .card { border-color: #999; }
  .cart-lines, .olist, .facts { overflow: visible; }
  .cline, .facts > div, .print-fields dt, .print-fields dd { break-inside: avoid; page-break-inside: avoid; }
  .cline, .cline.ro { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .cline .pic { width: 56px; }
  .pqty { display: block; font-weight: 700; white-space: nowrap; }
  .print-fields { margin: 16px 0 0; border: 1px solid #999; border-radius: 8px; padding: 10px 14px; }
  .print-fields dt { font-size: 9pt; text-transform: uppercase; letter-spacing: .05em; color: #333; font-weight: 700; margin-top: 8px; }
  .print-fields dt:first-child { margin-top: 0; }
  .print-fields dd { margin: 2px 0 0; white-space: pre-line; break-before: avoid; }
  a { color: #000; }
}
