/* Dealer catalogue sites. Neutrals, type sizes and radii are the trade
   catalogue's own tokens (copied from the design preview); one accent colour
   per shop, from the fixed safe list (src/config.mjs ACCENTS). System fonts
   only: nothing is loaded from anywhere else. */
:root {
  --ink:      oklch(0.17 0.006 260);
  --ink-2:    oklch(0.45 0.010 260);
  --ink-3:    oklch(0.55 0.008 260);
  --ground:   oklch(1 0 0);
  --ground-2: oklch(0.972 0.002 260);
  --ground-3: oklch(0.940 0.003 260);
  --line:     oklch(0.895 0.004 260);
  --line-2:   oklch(0.82 0.006 260);
  --signal:   oklch(0.55 0.20 27);
  --accent:     oklch(0.45 0.13 240);
  --accent-ink: oklch(1 0 0);
  --accent-bg:  oklch(0.96 0.02 240);
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px;
  --t-xs: 0.75rem; --t-sm: 0.8125rem; --t-base: 0.9375rem; --t-lg: 1.125rem; --t-xl: 1.375rem;
  --page: 76rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--ground);
}
.accent-blue     { --accent: oklch(0.45 0.13 240); --accent-bg: oklch(0.96 0.02 240); }
.accent-ocean    { --accent: oklch(0.44 0.09 225); --accent-bg: oklch(0.96 0.02 225); }
.accent-plum     { --accent: oklch(0.42 0.14 320); --accent-bg: oklch(0.96 0.02 320); }
.accent-rose     { --accent: oklch(0.45 0.15 355); --accent-bg: oklch(0.96 0.02 355); }
.accent-slate    { --accent: oklch(0.40 0.03 250); --accent-bg: oklch(0.96 0.01 250); }
.accent-charcoal { --accent: oklch(0.30 0.01 260); --accent-bg: oklch(0.95 0.005 260); }

@media (prefers-color-scheme: dark) {
  :root {
    --ink: oklch(0.95 0.004 260); --ink-2: oklch(0.78 0.008 260); --ink-3: oklch(0.68 0.008 260);
    --ground: oklch(0.19 0.006 260); --ground-2: oklch(0.23 0.006 260); --ground-3: oklch(0.29 0.006 260);
    --line: oklch(0.32 0.006 260); --line-2: oklch(0.40 0.006 260);
  }
  .tag { background: var(--accent); color: var(--accent-ink); }
}

* { box-sizing: border-box; }
body { margin: 0; font-size: var(--t-base); line-height: 1.4; background: var(--ground); color: var(--ink); }
body.shop { padding-bottom: 5rem; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.preview-flag { background: var(--ink); color: var(--ground); font-size: var(--t-xs); text-align: center; padding: 4px 8px; letter-spacing: .02em; }
.closed-flag { background: var(--signal); color: #fff; }
.wrap { max-width: var(--page); margin: 0 auto; padding: 0 12px; }
.narrow { max-width: 34rem; padding-top: 24px; }

header.top { border-bottom: 1px solid var(--line); background: var(--ground); position: sticky; top: 0; z-index: 5; }
.top-row { display: flex; align-items: center; gap: 10px; min-height: 56px; }
.mark { width: 36px; height: 36px; border-radius: var(--r-md); background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; flex: none; }
.top .shop { min-width: 0; flex: 1; }
.top .shop b { display: block; font-size: var(--t-lg); line-height: 1.2; }
.top .shop span { color: var(--ink-2); font-size: var(--t-xs); }
.call { flex: none; min-height: 44px; padding: 0 14px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--ground); color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; font-size: var(--t-sm); }

.search { padding: 10px 0 6px; }
.search input { width: 100%; min-height: 44px; border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 0 12px; background: var(--ground-2); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.chip { flex: none; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--ground); font-size: var(--t-sm); color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; }
.chip[aria-current="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }

h2.section { font-size: var(--t-sm); color: var(--ink-2); font-weight: 600; margin: 8px 0; text-transform: uppercase; letter-spacing: .04em; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px)  { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } .wrap { padding: 0 24px; } }
@media (min-width: 1280px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.card { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; background: var(--ground); }
.plate { aspect-ratio: 1; background: #fff; border-bottom: 1px solid var(--line); display: grid; place-items: center; }
.plate img { width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; user-select: none; }
.no-photo { color: #6b7280; font-size: var(--t-xs); }
.card .body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.brand { font-size: var(--t-xs); color: var(--ink-2); min-height: 1.2em; }
.tag { font-size: 0.6875rem; border-radius: var(--r-sm); padding: 1px 6px; background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.name { font-size: var(--t-sm); font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.price { margin-top: auto; padding-top: 4px; display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.price b { font-size: var(--t-lg); }
.price small { color: var(--ink-2); font-size: var(--t-xs); }
.ask { color: var(--ink-2); font-size: var(--t-sm); }
.moq { color: var(--ink-2); font-size: var(--t-xs); }
.mrp { color: var(--ink-2); font-size: var(--t-xs); }
.add { min-height: 44px; border-radius: var(--r-md); border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; margin-top: 6px; cursor: pointer; }
.add[aria-pressed="true"] { background: var(--ground-3); color: var(--ink); }
.empty { color: var(--ink-2); padding: 24px 0; }
.pager { display: flex; gap: 16px; align-items: center; justify-content: center; padding: 16px 0; }
.pager a { min-height: 44px; display: inline-flex; align-items: center; }

.basket { position: fixed; left: 0; right: 0; bottom: 0; background: var(--ground); border-top: 1px solid var(--line-2); z-index: 6; }
.basket .wrap { display: flex; align-items: center; gap: 10px; min-height: 64px; }
.basket .sum { flex: 1; font-size: var(--t-sm); color: var(--ink-2); }
.basket .sum b { color: var(--ink); font-size: var(--t-base); }
.basket form { margin: 0; }
.basket .list { flex: 1; min-width: 0; }
.basket .list[hidden] { display: none; }
.basket .list summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.basket .list[open] .lines { position: absolute; left: 0; right: 0; bottom: 100%; max-height: 50vh; overflow: auto; background: var(--ground); border-top: 1px solid var(--line-2); padding: 0 16px; }
.line { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: var(--t-sm); align-items: center; }
.line .ln { flex: 1; }
.basket button { min-height: 48px; padding: 0 18px; border: 0; border-radius: var(--r-md); background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; }
.basket button:disabled { background: var(--ground-3); color: var(--ink-3); cursor: default; }

footer.foot { color: var(--ink-2); font-size: var(--t-xs); padding: 24px 0 8px; }

.qty { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.qty[hidden] { display: none; }
.qty button { min-width: 44px; min-height: 44px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--ground); cursor: pointer; }
.qty output { min-width: 2.5em; text-align: center; }
.primary { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; border: 0; border-radius: var(--r-md); background: var(--accent); color: var(--accent-ink); font-weight: 700; margin-top: 14px; text-decoration: none; cursor: pointer; }
.primary.big { min-height: 56px; font-size: var(--t-lg); }
.quiet { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 44px; border: 0; background: none; color: var(--ink-2); margin-top: 6px; cursor: pointer; }
.note { font-size: var(--t-xs); color: var(--ink-2); }
pre.message { white-space: pre-wrap; background: var(--ground-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; font-size: var(--t-sm); }

/* Back office and Mithun's screens */
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tabs a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 12px; color: var(--ink); text-decoration: none; font-size: var(--t-sm); }
.office-main { padding-top: 12px; padding-bottom: 48px; }
.office-main h1 { font-size: var(--t-xl); }
.panel { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; margin: 14px 0; list-style: none; }
.panel h2 { font-size: var(--t-lg); margin: 0 0 8px; }
.office label { display: inline-flex; flex-direction: column; gap: 2px; font-size: var(--t-sm); margin: 4px 8px 4px 0; }
.office label.check { flex-direction: row; align-items: center; gap: 6px; }
.office input:not([type=checkbox]):not([type=hidden]), .office select { min-height: 44px; border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 0 10px; background: var(--ground); }
.office button { min-height: 44px; padding: 0 14px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--ground-2); cursor: pointer; }
.office button.primary-inline { background: var(--accent); color: var(--accent-ink); border: 0; font-weight: 600; }
.office button.danger { color: var(--signal); }
.row-fields { display: flex; flex-wrap: wrap; align-items: flex-end; }
.muted { color: var(--ink-2); }
.pill { font-size: var(--t-xs); border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 8px; }
.pill.warn { border-color: var(--signal); color: var(--signal); }
.flash { background: var(--ground-2); border-left: 4px solid var(--accent); padding: 8px 12px; }
table.preview { width: 100%; border-collapse: collapse; font-size: var(--t-sm); display: block; overflow-x: auto; }
table.preview th, table.preview td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
/* On a phone the price preview fits the screen: each product is a small card, each figure on its own line with its name. */
@media (max-width: 639px) {
  table.preview, table.preview tbody, table.preview tr, table.preview td { display: block; width: 100%; overflow: visible; }
  table.preview thead { display: none; }
  table.preview tr { border: 1px solid var(--line); border-radius: var(--r-md); padding: 6px 10px; margin: 0 0 8px; }
  table.preview td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; white-space: normal; overflow-wrap: anywhere; }
  table.preview td:first-child { font-weight: 600; padding-bottom: 4px; }
  table.preview td[data-label]:not(:first-child)::before { content: attr(data-label); color: var(--ink-2); flex: none; }
}
ul.groups, ul.owns, ul.orders, ul.dealers, ul.settings { padding: 0; list-style: none; }
li.group, li.own, li.order, ul.settings li { border-bottom: 1px solid var(--line); padding: 10px 0; }
li.own { display: flex; gap: 12px; flex-wrap: wrap; }
.own-photo img { border-radius: var(--r-md); border: 1px solid var(--line); background: #fff; }
form.inline { display: inline; }
code { overflow-wrap: anywhere; }

/* Filters on the shop page (round 2): brand buttons above, product type and category below. */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 0 0 10px; }
.filter { display: inline-flex; flex-direction: column; gap: 2px; font-size: var(--t-xs); color: var(--ink-2); flex: 1 1 9rem; min-width: 0; }
.filter select { min-height: 44px; border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 0 10px; background: var(--ground); color: var(--ink); font-size: var(--t-sm); width: 100%; }
.filters .apply { min-height: 44px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--ground-2); cursor: pointer; }
h2.section .clear { min-height: 44px; display: inline-flex; align-items: center; margin-left: 8px; text-transform: none; letter-spacing: 0; font-weight: 400; }

/* THE LOOK of a shop's site (round 2): the dealer picks clean, bold or classic in the back office. All three keep
   the layout, the 44px tap sizes, the white photo plates and system fonts; only type, lines and the header change.
   Clean is the plain base look above, unchanged. */
.theme-bold { --r-md: 12px; --r-lg: 18px; }
.theme-bold header.top { background: var(--accent); border-bottom: 0; }
.theme-bold header.top .shop b, .theme-bold header.top .shop span { color: var(--accent-ink); }
.mark-logo { object-fit: contain; background: #fff; padding: 2px; border: 1px solid var(--line, #e3e6ea); }
.theme-bold .mark { background: var(--accent-ink); color: var(--accent); }
.theme-bold .call { background: var(--accent-ink); color: var(--accent); border-color: transparent; font-weight: 700; }
.theme-bold .card { border: 2px solid var(--ink); }
.theme-bold .name { font-size: var(--t-base); font-weight: 800; }
.theme-bold .price b { font-size: var(--t-xl); font-weight: 800; }
.theme-bold h2.section { color: var(--ink); font-size: var(--t-base); font-weight: 800; }
.theme-bold .chip { border-width: 2px; font-weight: 700; }
.theme-bold .chip[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.theme-bold .add { text-transform: uppercase; letter-spacing: .03em; font-weight: 800; }
.theme-classic { font-family: Georgia, "Times New Roman", Times, serif; --r-sm: 2px; --r-md: 3px; --r-lg: 4px; }
.theme-classic header.top { border-bottom: 3px double var(--line-2); }
.theme-classic .mark { border-radius: 50%; font-style: italic; }
.theme-classic .top .shop b { font-weight: 400; letter-spacing: .02em; }
.theme-classic h2.section { text-transform: none; letter-spacing: 0; font-style: italic; font-weight: 400; font-size: var(--t-lg); color: var(--ink); border-bottom: 3px double var(--line-2); padding-bottom: 4px; }
.theme-classic .card { border-color: var(--line-2); }
.theme-classic .name { font-weight: 400; font-size: var(--t-base); }
.theme-classic .add { background: var(--ground); color: var(--accent); border: 1px solid var(--accent); font-weight: 400; }
.theme-classic .add[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.theme-classic .chip[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* The look page in the back office: a small sample of each look, drawn with that look's own rules above. */
.look-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 12px; margin: 12px 0; }
.office label.look-option { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 12px; margin: 0; cursor: pointer; }
.office label.look-option:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.look-option .check { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.look-sample { display: block; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--ground); color: var(--ink); }
.look-sample .ls-top { display: flex; align-items: center; gap: 8px; padding: 8px; border-bottom: 1px solid var(--line); }
.look-sample.theme-bold .ls-top { background: var(--accent); color: var(--accent-ink); border-bottom: 0; }
.look-sample.theme-classic .ls-top { border-bottom: 3px double var(--line-2); }
.look-sample .mark { width: 28px; height: 28px; font-size: var(--t-xs); }
.look-sample .ls-section { display: block; padding: 8px 8px 0; font-size: var(--t-xs); color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.look-sample.theme-bold .ls-section { color: var(--ink); font-weight: 800; }
.look-sample.theme-classic .ls-section { text-transform: none; font-style: italic; font-weight: 400; font-size: var(--t-sm); }
.look-sample .ls-card { margin: 8px; padding: 8px; gap: 4px; }
.look-sample .ls-card .price { padding-top: 0; }
.look-sample .ls-card .add { display: flex; align-items: center; justify-content: center; min-height: 36px; }

/* Round 3: a page per product. The name on a card leads there; the shop's name in the header leads home. */
.top .shop a.home { color: inherit; text-decoration: none; }
.card .name a { color: inherit; text-decoration: none; }
.card .name a:hover, .card .name a:focus-visible { text-decoration: underline; }
.crumbs { padding: 10px 0 4px; }
.product-one { max-width: 34rem; margin: 0 auto; padding-bottom: 12px; }
.card.one h1.name { font-size: var(--t-lg); margin: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: var(--t-sm); margin: 12px 0; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; }

/* Round 3: problem reports (back office and Mithun's list), downloads, the sign-in mail counts. */
.office textarea { width: 100%; min-height: 6rem; border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 8px 10px; background: var(--ground); font: inherit; }
.office label:has(textarea) { display: flex; }
.voice { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 8px 0; }
ul.reports { padding: 0; list-style: none; }
li.report { border-bottom: 1px solid var(--line); padding: 10px 0; }
.report-text { white-space: normal; overflow-wrap: anywhere; }
.report-shot { display: block; max-width: 160px; height: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; margin: 6px 0; }
li.report audio { display: block; width: 100%; max-width: 360px; margin: 6px 0; }
.pill.status-received { border-color: var(--signal); color: var(--signal); }
.pill.status-fixing { border-color: var(--accent); color: var(--accent); }
.downloads { padding: 0; list-style: none; }
.downloads li { padding: 6px 0; }
.downloads a { display: inline-flex; align-items: center; min-height: 44px; }
table.counts { border-collapse: collapse; font-size: var(--t-sm); }
table.counts th, table.counts td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); }
