/* CableSource Ops -- design tokens and components.
   Minimal and soft: cool grey paper, slate ink, the logo blue softened, and
   one colour per menu category shown as a thin stripe, like the core colours
   of a cable. Colours follow color-scheme (light / dark / device) through
   light-dark(); older browsers fall back to the device setting. */

:root {
  /* light (review 15, Victor: "ให้ดูดีเหมือน comfort"): Comfort's softer colours -- a warmer grey page, softer
     text and lines, calmer amber and rose; the brand blue and the green stay */
  --paper-l: #F5F5F3;  --paper-d: #101419;
  --surface-l: #FFFFFF; --surface-d: #1C232C;
  --ink-l: #232831;    --ink-d: #E8ECF1;
  --muted-l: #4F555F;  --muted-d: #B3BDC8;
  --line-l: #E2E3E6;   --line-d: #344050;
  --blue-l: #1E4D8C;   --blue-d: #6EA6E8;
  --green-l: #1C8A5A;  --green-d: #5CC4A6;
  --amber-l: #A9762E;  --amber-d: #E8BC5E;
  --violet-l: #6B5BD2; --violet-d: #A397EE;
  --rose-l: #B4434A;   --rose-d: #EE7A8C;
  --on-blue-l: #FFFFFF; --on-blue-d: #0E1A2A;
  --on-rose-l: #FFFFFF; --on-rose-d: #1B0A10;

  --paper: var(--paper-l); --surface: var(--surface-l); --ink: var(--ink-l); --muted: var(--muted-l);
  --line: var(--line-l); --blue: var(--blue-l); --green: var(--green-l); --amber: var(--amber-l);
  --violet: var(--violet-l); --rose: var(--rose-l); --on-blue: var(--on-blue-l);
  --on-rose: var(--on-rose-l);

  @media (prefers-color-scheme: dark) {
    --paper: var(--paper-d); --surface: var(--surface-d); --ink: var(--ink-d); --muted: var(--muted-d);
    --line: var(--line-d); --blue: var(--blue-d); --green: var(--green-d); --amber: var(--amber-d);
    --violet: var(--violet-d); --rose: var(--rose-d); --on-blue: var(--on-blue-d);
    --on-rose: var(--on-rose-d);
  }
  @supports (color: light-dark(white, black)) {
    --paper: light-dark(var(--paper-l), var(--paper-d));
    --surface: light-dark(var(--surface-l), var(--surface-d));
    --ink: light-dark(var(--ink-l), var(--ink-d));
    --muted: light-dark(var(--muted-l), var(--muted-d));
    --line: light-dark(var(--line-l), var(--line-d));
    --blue: light-dark(var(--blue-l), var(--blue-d));
    --green: light-dark(var(--green-l), var(--green-d));
    --amber: light-dark(var(--amber-l), var(--amber-d));
    --violet: light-dark(var(--violet-l), var(--violet-d));
    --rose: light-dark(var(--rose-l), var(--rose-d));
    --on-blue: light-dark(var(--on-blue-l), var(--on-blue-d));
    --on-rose: light-dark(var(--on-rose-l), var(--on-rose-d));
  }

  /* the outline of a box to type in: stronger than a divider, so the box shows on a panel of its own colour */
  --line-control: color-mix(in srgb, var(--line) 55%, var(--muted));
  --r-panel: 10px; --r-control: 6px; --r-pill: 999px;
  --shadow-float: 0 8px 28px rgb(15 30 45 / 0.16);
  /* motion: short and soft; everything is switched off for "reduce motion" */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1); --t-fast: 120ms; --t-med: 220ms; --t-slow: 280ms;
  /* the notch / rounded corners / home indicator (0 on most computers) */
  --safe-t: env(safe-area-inset-top, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px);

  /* the personal setting, mapped from <meta name="color-scheme"> */
  color-scheme: light dark;
  &:has(> head > meta[name="color-scheme"][content="dark"]) { color-scheme: dark; }
  &:has(> head > meta[name="color-scheme"][content="light"]) { color-scheme: light; }
  accent-color: var(--blue);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* hidden wins over .btn / .flash display */
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif;
  line-height: 1.55;
}
/* text size (personal setting): on <html>, so every rem size grows with it -- on <body> only the few em sizes did (review 12) */
html:has(> body.text-large) { font-size: 106.25%; }
html:has(> body.text-xlarge) { font-size: 118.75%; }
h1 { font-size: 1.5rem; line-height: 1.3; margin: 0 0 0.25rem; font-weight: 600; }
h2 { font-size: 1.25rem; margin: 0 0 0.75rem; font-weight: 600; }
h3 { font-size: 1rem; margin: 0 0 0.5rem; font-weight: 600; }
p { margin: 0 0 0.75rem; }
b, strong { font-weight: 600; }   /* one bold in the whole app (the browser default is 700) */
a { color: var(--blue); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- frame ---------- */
/* beta: a thin dark-amber strip, not a loud full-width banner (2026-11-18) */
.beta-bar { background: light-dark(#7A5A12, #3A2C0C); color: light-dark(#FFF6E0, #F2D48A); text-align: center; font-size: 0.75rem;
  font-weight: 600; padding: 0.1rem 1rem; border-bottom: 1px solid light-dark(#6A4E10, #5A4416); }
/* under the notch: a strip in the header colour, so the page never scrolls into it */
body { padding-top: var(--safe-t); }
body::before { content: ""; position: fixed; z-index: 20; inset: 0 0 auto 0; height: var(--safe-t); background: var(--surface); pointer-events: none; }
html { scroll-padding-top: calc(4.5rem + var(--safe-t)); }
.top {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem calc(1rem + var(--safe-r)) 0.6rem calc(1rem + var(--safe-l));
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: var(--safe-t); z-index: 5;
}
.top .brand { display: flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; font-weight: 600; }
.top .brand img { height: 1.75rem; width: auto; }
.top .spacer { flex: 1; }
.top form { margin: 0; }
/* review 13: no fixed sidebar. "เมนู" (left of the logo on a computer, in the bottom bar on a phone) opens the
   whole menu as a drawer from the left; a computer's everyday pages sit in the top bar (.top-nav) */
.top .menu-toggle { display: inline-flex; align-items: center; gap: 0.4rem; }
.top .menu-toggle .ico { width: 1.2rem; height: 1.2rem; }
.top-nav { display: flex; align-self: stretch; align-items: stretch; gap: 0.15rem; margin-left: 0.75rem; min-width: 0; }
.top-nav a { display: flex; align-items: center; gap: 0.35rem; padding: 0 0.7rem; color: var(--muted); text-decoration: none;
  font-size: 0.9375rem; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -0.6rem; padding-bottom: 0.6rem;
  margin-top: -0.6rem; padding-top: 0.6rem; }
.top-nav a:hover { color: var(--ink); }
.top-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--blue); }
.top-nav-n { min-width: 1.3rem; padding: 0 0.35rem; border-radius: var(--r-pill); background: color-mix(in srgb, var(--blue) 16%, transparent);
  color: var(--blue); font-size: 0.75rem; font-weight: 600; text-align: center; line-height: 1.3rem; }
/* tabs that do not fit are hidden by app.js (last ones first) */
.top-nav a[hidden] { display: none; }

.frame { min-height: calc(100vh - 3.5rem); }
.side {
  position: fixed; z-index: 11; top: 0; left: 0; bottom: 0; width: min(21rem, 86vw);
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  padding: calc(1rem + var(--safe-t)) 0.9rem 2rem calc(0.9rem + var(--safe-l));
  border-right: 1px solid var(--line); border-radius: 0 var(--r-panel) var(--r-panel) 0; box-shadow: 8px 0 32px rgb(10 20 30 / 0.18);
  transform: translateX(-104%); visibility: hidden;
  transition: transform var(--t-slow) var(--ease-out), visibility 0s linear var(--t-slow);
}
.frame.nav-open .side { transform: none; visibility: visible; transition: transform var(--t-slow) var(--ease-out), visibility 0s; }
.side.dragging { transition: none !important; }
.nav-scrim { position: fixed; inset: 0; z-index: 10; background: rgb(10 20 30 / 0.42); opacity: 0; visibility: hidden;
  transition: opacity var(--t-slow) var(--ease-out), visibility 0s linear var(--t-slow); }
.frame.nav-open .nav-scrim { opacity: 1; visibility: visible; transition: opacity var(--t-slow) var(--ease-out), visibility 0s; }
body.nav-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .side, .nav-scrim, .frame.nav-open .side, .frame.nav-open .nav-scrim { transition: none; } }
.main { padding: 1.5rem clamp(1rem, 3vw, 2.25rem) 3rem; max-width: 80rem; width: 100%; min-width: 0; margin-inline: auto; }

.nav-cat { margin: 0 0 1rem; }
.nav-cat + .nav-cat { padding-top: 0.75rem; border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.nav-home + .nav-cat { border-top: 0; padding-top: 0; }
.nav-cat > h3, .nav-cat > summary > h3 {
  display: flex; align-items: center; gap: 0.45rem; margin: 0 0 0.3rem; padding: 0 0.65rem;
  font-size: 0.875rem; color: var(--muted); font-weight: 600;
}
.nav-cat > h3::before, .nav-cat > summary > h3::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--stripe); }
.nav-cat a {
  position: relative; display: flex; align-items: center; gap: 0.65rem;
  padding: 0.45rem 0.65rem; margin: 1px 0; border-radius: var(--r-control);
  color: var(--ink); text-decoration: none; font-size: 0.9375rem; line-height: 1.3;
}
.nav-cat a .label { flex: 1; min-width: 0; }
.nav-cat .ico { width: 1.15rem; height: 1.15rem; flex: none; color: var(--muted); }
.nav-cat a:hover { background: var(--paper); }
.nav-cat a:hover .ico { color: var(--stripe); }
.nav-cat a[aria-current="page"] { background: color-mix(in srgb, var(--stripe) 14%, transparent); font-weight: 600; }
.nav-cat a[aria-current="page"] .ico { color: var(--stripe); }
.nav-cat a[aria-current="page"]::before {
  content: ""; position: absolute; left: -0.6rem; top: 0.35rem; bottom: 0.35rem; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--stripe);
}
.nav-cat a:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.stripe-blue { --stripe: var(--blue); } .stripe-green { --stripe: var(--green); }
.stripe-amber { --stripe: var(--amber); } .stripe-violet { --stripe: var(--violet); }
.stripe-rose { --stripe: var(--rose); } .stripe-slate { --stripe: var(--muted); }

@media (max-width: 52em) {
  .top-nav { display: none; }   /* the phone's bottom bar has these pages */
  .top { gap: 0.4rem; padding-inline: calc(0.6rem + var(--safe-l)) calc(0.6rem + var(--safe-r)); }
  .top .brand span { display: none; }
  .top .segmented label { padding: 0.3rem 0.55rem; font-size: 0.875rem; }
}
.top .segmented { flex-wrap: nowrap; flex-shrink: 0; }

/* ---------- surfaces ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 0.75rem; margin-bottom: 1.25rem; }
.page-head p { margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 1.25rem; }
.panel + .panel { margin-top: 1rem; }
.bento { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.bento .wide { grid-column: span 2; }
@media (max-width: 40em) { .bento .wide { grid-column: auto; } }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 2.5rem; padding: 0.45rem 1rem; border-radius: var(--r-control);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 0.9375rem; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: var(--on-blue); font-weight: 600; }
.btn-primary:hover { border-color: var(--blue); filter: brightness(1.06); }
.btn-danger { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 45%, var(--line)); }
.btn-danger.solid { background: var(--rose); border-color: var(--rose); color: var(--on-rose); font-weight: 600; }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-sm { min-height: 2rem; padding: 0.2rem 0.65rem; font-size: 0.875rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.field > label, .field > .label { font-size: 0.875rem; font-weight: 600; }
.field .hint { font-size: 0.875rem; color: var(--muted); }
input[type=text], input[type=password], input[type=search], input[type=date], input[type=month], input[type=number], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-control); border-radius: var(--r-control); padding: 0.55rem 0.7rem; min-height: 2.5rem; width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.form-narrow { max-width: 26rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
/* The end of a form: buttons on the right, where the thumb and the eye end up;
   the main button last (rightmost) and a note, if any, on the left. On a
   phone the main button takes the whole row at the bottom. */
.form-foot { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; justify-content: flex-end; margin-top: 1rem; }
.form-foot > .btn-primary, .form-foot > .btn-danger:last-child, .form-foot > .mg-last { order: 10; }
.form-foot > .note { order: -1; margin-right: auto; }
.mg-head > .mg-last { order: 10; }
@media (max-width: 40em) {
  .form-foot > .btn-primary { flex: 1 1 100%; min-height: 2.9rem; }
  .form-foot > .note { flex: 1 1 100%; }
}

/* segmented choice built from real radio buttons */
.segmented { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--r-control); overflow: hidden; }
.segmented label { position: relative; padding: 0.45rem 0.9rem; cursor: pointer; font-size: 0.9375rem; border-left: 1px solid var(--line); }
.segmented label:first-child { border-left: 0; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented label:has(input:checked) { background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--ink); font-weight: 600; }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: -2px; }

.check { display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.table th, .table td { padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: 0.875rem; color: var(--muted); font-weight: 600; background: color-mix(in srgb, var(--paper) 60%, var(--surface)); }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; }
body.compact .table th, body.compact .table td { padding: 0.35rem 0.7rem; }

/* ---------- status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.05rem 0.45rem; border-radius: var(--r-control);
  font-size: 0.875rem; font-weight: 600; white-space: nowrap;
  color: color-mix(in srgb, var(--tone) 55%, var(--ink)); background: color-mix(in srgb, var(--tone) 14%, transparent);
}
.badge.in { --tone: var(--green); } .badge.out { --tone: var(--rose); }
.badge.incoming { --tone: var(--amber); } .badge.low { --tone: var(--amber); }
.badge.info { --tone: var(--blue); } .badge.neutral { --tone: var(--muted); }

.flash { padding: 0.7rem 1rem; border-radius: var(--r-control); margin-bottom: 1rem; border: 1px solid; font-size: 0.9375rem;
  --tone: var(--green); color: var(--ink); border-color: color-mix(in srgb, var(--tone) 40%, transparent);
  background: color-mix(in srgb, var(--tone) 10%, var(--surface)); }
.flash.error { --tone: var(--rose); } .flash.warning { --tone: var(--amber); } .flash.info { --tone: var(--blue); }

/* ---------- confirm dialog ---------- */
dialog.confirm {
  border: 1px solid var(--line); border-radius: var(--r-panel); padding: 1.5rem; max-width: min(28rem, calc(100vw - 2rem));
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-float);
}
dialog.confirm::backdrop { background: rgb(10 20 30 / 0.45); overflow: hidden; overscroll-behavior: contain; }
dialog.confirm:not([open])::backdrop { background-color: rgb(10 20 30 / 0); }
dialog.confirm { max-height: calc(100dvh - 2rem - var(--safe-t) - var(--safe-b)); overflow-y: auto; }
dialog:modal { overscroll-behavior: contain; }
dialog.confirm .actions { justify-content: flex-end; margin-top: 1.25rem; }

/* ---------- mini tabs ---------- */
.minitab { width: 17rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
  box-shadow: var(--shadow-float); overflow: hidden; border-top: 4px solid var(--stripe); }
.minitab header { display: flex; align-items: center; gap: 0.25rem; padding: 0.5rem 0.5rem 0.5rem 0.9rem; border-bottom: 1px solid var(--line); }
.minitab header h3 { margin: 0; flex: 1; font-size: 0.9375rem; }
.minitab .body { padding: 0.9rem; min-height: 9rem; }
.minitab.folded .body { display: none; }
.minitab.folded { width: auto; border-radius: var(--r-pill); }
.minitab.folded header { border-bottom: 0; }

/* ---------- catalog and search ---------- */
details.panel > summary, details > summary { cursor: pointer; }
details.panel { margin-top: 1rem; }
.nowrap { white-space: nowrap; }
.price-grid .cell { min-height: 2.1rem; padding: 0.25rem 0.45rem; font-size: 0.875rem; }
.price-grid td { padding: 0.25rem 0.35rem; border-bottom: 0; }
.price-grid tbody tr.first td { border-top: 1px solid var(--line); padding-top: 0.5rem; }
.price-grid .add-row td { padding: 0 0.35rem 0.4rem; }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
textarea { resize: vertical; line-height: 1.5; }
.table.lots { font-size: 0.875rem; }
.table.lots th, .table.lots td { padding: 0.4rem 0.7rem; }
tr[data-lots-for] > td { background: var(--paper); padding: 0.75rem; }
input[type=file] { font: inherit; color: var(--ink); max-width: 100%; }

/* ---------- customers, costs, margin, quotations ---------- */
hr.soft { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.spacer { flex: 1; }
.name-list { list-style: none; margin: 1rem 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); }
.name-list:empty { display: none; }
.name-list li { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.9rem; border-top: 1px solid var(--line); }
.name-list li:first-child { border-top: 0; }
.name-list li > span:first-child { flex: 1; overflow-wrap: anywhere; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.table td.est { color: color-mix(in srgb, var(--amber) 65%, var(--ink)); text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }

/* Margin: the table on the left, the two summaries on the right */
.main:has(#mg-root) { max-width: none; }
#mg-root { display: grid; grid-template-columns: minmax(0, 1fr) 18rem; gap: 1rem; align-items: start; }
.mg-main { padding: 0; overflow: hidden; }
.mg-side { display: grid; gap: 1rem; position: sticky; top: 4.5rem; }
@media (max-width: 90em) {
  #mg-root { grid-template-columns: minmax(0, 1fr); }
  .mg-side { position: static; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 52em) { .mg-side { grid-template-columns: minmax(0, 1fr); } }
.mg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; padding: 0.8rem 1rem; border-bottom: 1px solid var(--line); }
.mg-field { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.875rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.mg-field select { width: auto; max-width: 14rem; min-height: 2.25rem; padding-block: 0.3rem; }
.mg-cust-wrap { position: relative; flex: 1 1 16rem; min-width: 12rem; max-width: 26rem; }
.mg-customer { font-weight: 600; min-height: 2.25rem; padding-block: 0.35rem; }
.mg-customer.mg-need { border-color: var(--rose); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rose) 18%, transparent); }
.mg-ac { position: absolute; z-index: 6; top: calc(100% + 4px); left: 0; right: 0; max-height: 20rem; overflow-y: auto; padding: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-control); box-shadow: var(--shadow-float); }
.mg-ac-item { padding: 0.45rem 0.65rem; border-radius: var(--r-control); cursor: pointer; font-size: 0.9375rem; line-height: 1.35; }
.mg-ac-item:hover, .mg-ac-item.active { background: color-mix(in srgb, var(--blue) 10%, transparent); color: var(--blue); }
.mg-paste { display: flex; flex-wrap: wrap; gap: 1rem; padding: 0.9rem 1rem; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 70%, var(--surface)); }
.mg-paste[hidden] { display: none; }
.mg-paste textarea { flex: 1.6 1 20rem; min-height: 6.5rem; font-family: ui-monospace, Consolas, "IBM Plex Sans Thai", monospace; font-size: 0.875rem; }
.mg-paste-side { flex: 1 1 14rem; display: flex; flex-direction: column; gap: 0.5rem; }
/* relative: keeps screen-reader-only labels in the table inside the scroll box */
.mg-scroll, .table-wrap { overflow-x: auto; position: relative; }
.mg-empty { margin: 1.25rem 1rem; }
.mg-table { width: 100%; min-width: 50rem; table-layout: fixed; border-collapse: collapse; font-size: 0.875rem; }
.mg-c-no { width: 2rem; } .mg-c-qty { width: 9%; } .mg-c-pl { width: 12%; } .mg-c-in { width: 11%; }
.mg-c-in2 { width: 13%; } .mg-c-cost { width: 11%; } .mg-c-m { width: 9%; } .mg-c-del { width: 2.25rem; }
.mg-table th { padding: 0.6rem 0.5rem; background: color-mix(in srgb, var(--paper) 60%, var(--surface)); color: var(--muted);
  font-size: 0.75rem; font-weight: 600; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.mg-table th.num { text-align: right; }
.mg-table th.mg-in-h { color: var(--blue); }
.mg-table td { padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.mg-table td:first-child { padding-top: 1rem; }
.mg-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.mg-name { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.mg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: 0.35rem 0 0.25rem; }
.mg-fifo { font-size: 0.75rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 0 0.45rem; }
.mg-lot, .mg-cand, .mg-tierpick { display: block; width: 100%; max-width: 26rem; margin-top: 0.25rem; min-height: 1.85rem;
  padding: 0.1rem 0.45rem; font-size: 0.75rem; color: var(--muted); }
.mg-tierpick { border-style: dashed; color: var(--ink); }
.mg-big { min-height: 2.15rem; display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; justify-content: flex-end; font-size: 0.9375rem; }
.mg-sub { font-size: 0.75rem; color: var(--muted); line-height: 1.5; }
.mg-warn { color: color-mix(in srgb, var(--amber) 65%, var(--ink)); }
.mg-in { width: 100%; min-height: 2.15rem; padding: 0.25rem 0.5rem; text-align: right; font-variant-numeric: tabular-nums; font-size: 0.875rem;
  border: 1.5px solid color-mix(in srgb, var(--blue) 30%, var(--line)); background: color-mix(in srgb, var(--blue) 5%, var(--surface)); }
.mg-in.mg-typed { border-color: var(--blue); border-width: 2px; font-weight: 600; background: color-mix(in srgb, var(--blue) 11%, var(--surface)); }
.mg-in.mg-dashed { border-style: dashed; }
.mg-est { color: color-mix(in srgb, var(--amber) 65%, var(--ink)); text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.mg-owntier { text-decoration: underline dotted; text-underline-offset: 3px; }
.mg-use { padding: 0 0.4rem; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); color: var(--blue);
  font: inherit; font-size: 0.75rem; cursor: pointer; }
.mg-use:hover { border-color: var(--blue); }
.mg-del { margin-top: 0.3rem; border: 0; background: none; color: var(--muted); font-size: 1.125rem; line-height: 1; cursor: pointer;
  padding: 0.3rem 0.5rem; border-radius: var(--r-control); }
.mg-del:hover { color: var(--rose); background: color-mix(in srgb, var(--rose) 12%, transparent); }
.mg-table tr.mg-loss td { background: color-mix(in srgb, var(--rose) 8%, var(--surface)); }
.mg-table tr.mg-loss .mg-m { border-color: var(--rose); color: var(--rose); }
.mg-panel { padding: 1rem 1.1rem; }
.mg-side .panel + .panel { margin-top: 0; }
.mg-panel-h { margin: 0 0 0.4rem; font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.mg-panel-sub { display: block; margin-top: 2px; font-weight: 400; font-size: 0.75rem; }
.mg-suffix { display: inline-flex; align-items: center; gap: 0.3rem; }
.mg-suffix > span { color: var(--muted); font-weight: 600; }
.mg-suffix input { width: 4.4rem; min-height: 1.85rem; padding: 0.1rem 0.4rem; text-align: right; font-size: 0.875rem; }
.mg-suffix select { width: auto; min-height: 1.85rem; padding: 0.1rem 0.3rem; font-size: 0.875rem; }
.mg-sum-row { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; padding: 0.4rem 0;
  font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.mg-sum-row + .mg-sum-row { border-top: 1px dashed var(--line); }
.mg-sum-row > span:first-child { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.mg-disc-label { color: var(--rose); font-weight: 600; }
.mg-strong { font-weight: 600; }
.mg-net { font-weight: 600; font-size: 1rem; color: var(--blue); }
.mg-note { margin: 0.4rem 0 0; }
.mg-note:empty { display: none; }
.mg-bad { color: var(--rose) !important; }

/* The quotation: a light "paper" in every colour mode (logo, signature and
   the PDF are made for white), softened a little in dark mode. */
.qd-wrap { max-width: 66rem; margin: 0 auto; }
.qd-wrap.qd-mode-full { max-width: 84rem; }
.qd-mode-sale .full-only { display: none !important; }
.qd-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.qd-signer-pick { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.qd-signer-pick select { width: auto; min-height: 2rem; padding-block: 0.2rem; }
.qd-delete { margin: 0.9rem 0 0; text-align: right; }
.qd-paper {
  --qd-ink: #1b2433; --qd-muted: #5f6b80; --qd-line: #d5dbe5; --qd-blue: #2f5ea8; --qd-blue-2: #4472c4;
  --qd-tint: #eef3fb; --qd-red: #c62828; --qd-paper: #fff; --qd-stripe: #f8fafd;
  --surface: var(--qd-paper); --paper: var(--qd-tint); --ink: var(--qd-ink); --muted: var(--qd-muted); --line: var(--qd-line);
  background: var(--qd-paper); color: var(--qd-ink); border-radius: 6px; box-shadow: var(--shadow-float);
  padding: 30px 34px 22px; font-family: "Sarabun", "IBM Plex Sans Thai", Tahoma, sans-serif; font-size: 14px;
  position: relative; overflow: hidden; line-height: 1.45;
}
@supports (color: light-dark(white, black)) {
  .qd-paper { --qd-paper: light-dark(#fff, #e9edf3); --qd-stripe: light-dark(#f8fafd, #e2e7ee); }
}
.qd-paper input, .qd-paper textarea { color-scheme: light; }
.qd-paper::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px;
  background: linear-gradient(90deg, var(--qd-blue), var(--qd-blue-2) 60%, #d97a1f); }
.qd-internal { margin: -8px 0 14px; padding: 6px 12px; border-radius: 6px; background: #fdecea; color: var(--qd-red);
  font-weight: 700; font-size: 12.5px; text-align: center; }
.qd-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.qd-head-left { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.qd-logo { height: 62px; width: auto; display: block; margin-top: 4px; }
.qd-head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.qd-doc-title { line-height: 1.15; }
.qd-doc-th { display: block; font-size: 24px; font-weight: 700; color: var(--qd-blue); }
.qd-doc-en { display: block; font-size: 12px; font-weight: 600; letter-spacing: .3em; color: var(--qd-muted); }
.qd-meta { width: auto; font-size: 13px; border: 1px solid var(--qd-line); border-radius: 8px; border-collapse: separate;
  border-spacing: 0; overflow: hidden; min-width: 250px; }
.qd-meta th { background: var(--qd-tint); color: var(--qd-muted); font-weight: 600; text-align: left; padding: 5px 12px; width: 1%; white-space: nowrap; }
.qd-meta td { padding: 5px 12px; font-weight: 600; }
.qd-meta tr + tr > * { border-top: 1px solid var(--qd-line); }
.qd-paper .qd-meta-in, .qd-paper .qd-remark, .qd-paper .qd-note textarea {
  width: 210px; min-height: 0; border: 1px dashed #b9c4d6; border-radius: 6px; padding: 2px 7px; font: inherit;
  font-weight: 600; background: #fffdf3; color: var(--qd-ink); }
.qd-paper .qd-remark { width: 100%; min-width: 90px; font-weight: 400; font-size: 13px; }
.qd-paper .qd-note textarea { width: 100%; margin-top: 4px; padding: 6px 8px; font-weight: 400; }
.qd-print-val { display: none; }
.qd-frame { width: 100%; border-collapse: collapse; table-layout: fixed; }
.qd-frame > * > tr > td { padding: 0; border: 0; }
.qd-frame-gap { display: none; }
.qd-parties { display: grid; grid-template-columns: 1fr 2fr; margin: 18px 0 14px; border: 1px solid var(--qd-line); border-radius: 8px; overflow: hidden; }
.qd-parties > div { padding: 9px 14px; display: flex; flex-direction: column; gap: 1px; }
.qd-parties > div + div { border-left: 1px solid var(--qd-line); }
.qd-customer { background: var(--qd-tint); }
.qd-customer strong { font-size: 16.5px; color: var(--qd-blue); }
.qd-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--qd-muted); }
.qd-table-wrap { overflow-x: auto; }
.qd-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.qd-table th { background: var(--qd-blue-2); color: #fff; font-weight: 600; padding: 8px; text-align: left; white-space: nowrap; }
.qd-table th.num { text-align: right; }
.qd-table th.qd-cost-h { background: #5b6b84; }
.qd-table td { padding: 7px 8px; border-bottom: 1px solid var(--qd-line); vertical-align: top; }
.qd-table tbody tr:nth-child(even) td { background: var(--qd-stripe); }
.qd-table .num { text-align: right; white-space: nowrap; }
.qd-table .qd-c-no { width: 1%; color: var(--qd-muted); text-align: center; }
.qd-table .qd-c-rm { width: 17%; min-width: 110px; }
.qd-table .qd-nw { white-space: nowrap; }
.qd-mode-full .qd-table { font-size: 12.5px; }
.qd-mode-full .qd-table th, .qd-mode-full .qd-table td { padding-left: 6px; padding-right: 6px; }
.qd-table .qd-offer { color: var(--qd-red); font-weight: 700; }
.qd-table tr.qd-loss .qd-m { color: var(--qd-red); font-weight: 700; }
.qd-sub { font-size: 11px; color: var(--qd-muted); font-weight: 400; }
.qd-bottom { display: grid; grid-template-columns: 1fr minmax(260px, 330px); gap: 18px; margin-top: 16px; align-items: start; }
.qd-note { border: 1px solid var(--qd-line); border-radius: 8px; padding: 9px 12px; }
.qd-note-print, .qd-note-text { white-space: pre-wrap; margin-top: 4px; }
.qd-note-print { display: none; }
.qd-totals { width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; border-collapse: collapse; }
.qd-totals th { text-align: left; font-weight: 600; padding: 6px 10px; color: var(--qd-muted); }
.qd-totals td { text-align: right; padding: 6px 10px; font-weight: 600; }
.qd-totals tr + tr > * { border-top: 1px solid var(--qd-line); }
.qd-totals .qd-disc > * { color: var(--qd-red); }
.qd-totals .qd-net > * { background: var(--qd-blue); color: #fff; font-size: 16px; font-weight: 700; border-top: 0; }
.qd-margin { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; padding: 12px;
  border-radius: 8px; background: #f4f6fa; border: 1px solid var(--qd-line); }
.qd-mbox { background: #fff; border: 1px solid var(--qd-line); border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; }
.qd-mbox span { font-size: 12px; color: var(--qd-muted); font-weight: 600; }
.qd-mbox strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.qd-mbox-main { border-color: var(--qd-blue-2); background: var(--qd-tint); }
.qd-mbox-main strong { color: var(--qd-blue); }
.qd-mbox.qd-bad strong { color: var(--qd-red); }
.qd-mnote { grid-column: 1 / -1; font-size: 11.5px; color: var(--qd-muted); }
.qd-sign-row { display: flex; justify-content: flex-end; margin-top: 18px; break-inside: avoid; }
.qd-sign { width: 300px; max-width: 100%; border: 1px solid var(--qd-ink); padding: 8px 14px 10px; text-align: center; font-size: 13.5px;
  line-height: 1.55; font-weight: 600; }
.qd-sign-img { height: 70px; display: flex; align-items: flex-end; justify-content: center; margin-bottom: -4px; }
/* size / nudge from Margin settings (--sig-*): moves the image only, never the box */
.qd-sign img { display: block; max-height: 70px; max-width: 100%; width: auto; transform-origin: 50% 100%;
  transform: translate(var(--sig-x, 0px), var(--sig-y, 0px)) scale(var(--sig-s, 1)); }
.qd-sign-line { border-top: 1px solid var(--qd-ink); margin: 0 6px 6px; }
.qd-sign-name { font-weight: 700; }
@media screen and (max-width: 74em) {
  .qd-paper { padding: 24px 20px 18px; }
  .qd-table th, .qd-table td { padding-left: 5px; padding-right: 5px; }
  .qd-table .qd-nw { white-space: normal; }
}
@media screen and (max-width: 48em) {
  .qd-paper { padding: 22px 14px 16px; }
  .qd-head, .qd-bottom { display: block; }
  .qd-head-right { align-items: stretch; margin-top: 12px; }
  .qd-logo { height: 48px; }
  .qd-sign-row { justify-content: center; }
  .qd-meta { margin-top: 12px; width: 100%; }
  .qd-parties { grid-template-columns: minmax(0, 1fr); }
  .qd-parties > div + div { border-left: 0; border-top: 1px solid var(--qd-line); }
  .qd-table { min-width: 640px; }
  .qd-totals { margin-top: 12px; }
  .qd-margin { grid-template-columns: minmax(0, 1fr); }
}
/* Margin settings: a preview of each signature box with its sliders */
.qs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1rem; }
.qs-item { border: 1px solid var(--line); border-radius: var(--r-panel); padding: 0.9rem; display: flex; flex-direction: column; gap: 0.9rem; }
.qs-paper { padding: 26px 16px 18px; display: flex; justify-content: center; box-shadow: none; border: 1px solid #d5dbe5; }
.qs-paper::before { display: none; }
.qs-controls { display: flex; flex-direction: column; gap: 0.5rem; }
.qs-row { display: grid; grid-template-columns: 6rem 1fr 3.6rem; align-items: center; gap: 0.6rem; font-size: 0.875rem; font-weight: 600; }
.qs-row input[type=range] { width: 100%; }
.qs-row output { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.qs-locked .qs-row { opacity: .55; }
[data-when][hidden] { display: none; }

@media print {
  body:has(.qd-paper) { background: #fff !important; }
  body:has(.qd-paper) :is(.beta-bar, .top, .side, .flash, .qd-toolbar, .qd-delete, dialog) { display: none !important; }
  body:has(.qd-paper) .frame { display: block !important; min-height: 0; }
  .main:has(.qd-paper) { padding: 0 !important; max-width: none !important; margin: 0 !important; }
  .qd-wrap { max-width: none; }
  .qd-paper { --qd-paper: #fff; --qd-stripe: #f8fafd; box-shadow: none; border-radius: 0; font-size: 12.5px; padding: 0 12mm;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .qd-mbox { background: #fff; }
  .qd-paper::before { display: none; }
  .qd-table-wrap { overflow: visible; }
  .qd-table { font-size: 12px; min-width: 0; }
  .qd-table tr { break-inside: avoid; }
  .qd-bottom, .qd-margin { break-inside: avoid; }
  .qd-frame-gap { display: table-cell; height: 10mm; }
  .qd-paper .qd-meta-in, .qd-paper .qd-remark, .qd-paper .qd-note textarea { display: none; }
  .qd-print-val { display: inline; }
  .qd-meta tr.qd-empty { display: none; }
  .qd-note.qd-empty { visibility: hidden; }
  .qd-note-print { display: block; }
  /* the full version on A4 portrait: 12 columns, so smaller type and tighter cells */
  .qd-mode-full .qd-paper { padding: 0 9mm; }
  .qd-mode-full .qd-table { font-size: 10.2px; }
  .qd-mode-full .qd-table th { white-space: normal; line-height: 1.25; padding: 5px 4px; vertical-align: bottom; }
  .qd-mode-full .qd-table td { padding: 4px; }
  .qd-mode-full .qd-table .qd-c-rm { width: 12%; min-width: 0; }
  .qd-mode-full .qd-sub { font-size: 8.6px; }
  .qd-mode-full .qd-sub.qd-nw { white-space: normal; overflow-wrap: anywhere; }
  .qd-mode-full .qd-margin { margin-top: 10px; padding: 8px; gap: 8px; }
  .qd-mode-full .qd-mbox strong { font-size: 15px; }
}

/* ---------- Invoice, HOME mini tabs, JO, store pages, tickets ---------- */
.mono { font-family: ui-monospace, Consolas, "IBM Plex Sans Thai", monospace; font-variant-numeric: tabular-nums; }
.scroll-y { max-height: 26rem; overflow-y: auto; }
.meter { height: 0.4rem; border-radius: var(--r-pill); background: color-mix(in srgb, var(--muted) 18%, transparent); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--violet); border-radius: inherit; }
/* review 10: a still dot -- a dot that pulses for ever pulls the eye from the numbers and adds nothing */
.live-dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--green); margin-right: 0.35rem; }
.seg-link { padding: 0.45rem 0.9rem; border-left: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 0.9375rem; }
.seg-link:first-child { border-left: 0; }
.seg-link[aria-current="page"] { background: color-mix(in srgb, var(--blue) 14%, transparent); font-weight: 600; }
.seg-small label { padding: 0.25rem 0.6rem; font-size: 0.875rem; }

/* Invoice run box */
.inv-panel { max-width: 62rem; container-type: inline-size; }
/* a wide run page: button on the left, the numbers you ran beside it (the mini tab stays one column) */
@container (min-width: 44rem) {
  .inv-run { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 2rem; align-items: start; }
  .inv-list { padding-left: 2rem; border-left: 1px solid var(--line); }
  .inv-list .inv-mine-h { margin-top: 0; }
  .inv-list .inv-mine { max-height: 24rem; }
}
.inv-headline { font-weight: 600; margin-bottom: 0.5rem; }
.inv-meta { margin: 0 0 0.35rem; }
.inv-go { font-size: 1.125rem; min-height: 3rem; padding-inline: 1.6rem; width: 100%; justify-content: center; }
.inv-result { margin: 0.9rem 0 0; padding: 0.7rem 0.9rem; border-radius: var(--r-control); display: flex; flex-wrap: wrap;
  align-items: center; gap: 0.4rem; background: color-mix(in srgb, var(--green) 12%, var(--surface)); }
.inv-result b { font-family: ui-monospace, Consolas, "IBM Plex Sans Thai", monospace; font-size: 1.5rem; }
.inv-result.bad { background: color-mix(in srgb, var(--rose) 12%, var(--surface)); }
.inv-mine-h { margin: 1.1rem 0 0.35rem; font-size: 0.875rem; color: var(--muted); }
.inv-mine { list-style: none; margin: 0; padding: 0; max-height: 16rem; overflow-y: auto; }
.inv-mine li { display: flex; align-items: center; gap: 0.25rem; padding: 0.35rem 0; border-top: 1px solid var(--line); }
.inv-mine li:first-child { border-top: 0; }
.inv-no { font-family: ui-monospace, Consolas, "IBM Plex Sans Thai", monospace; font-size: 1rem; flex: 1; }
.inv-mine .btn { min-height: 2.25rem; }
/* the confirm box names the file an upload is about to read */
.confirm-file { display: block; margin-bottom: 0.4rem; overflow-wrap: anywhere; color: var(--ink); }
/* catalog: one heading per INVENTORY sheet */
.cat-sheet { margin: 1.5rem 0 0.5rem; font-size: 1rem; display: flex; align-items: baseline; gap: 0.4rem; }
/* a save button that stays at the bottom of the screen on long settings forms */
.sticky-save { position: sticky; bottom: 0; z-index: 2; padding: 0.6rem 0 calc(0.6rem + var(--safe-b)); background: var(--paper); border-top: 1px solid var(--line);
  align-items: center; gap: 0.75rem; }
@media (max-width: 52em) { .sticky-save { bottom: calc(var(--bar-h) + var(--safe-b)); padding-bottom: 0.6rem; } }
/* numbered steps above an upload */
.steps { margin: 0 0 0.75rem; padding-left: 1.2rem; color: var(--muted); display: grid; gap: 0.15rem; }
/* announcements: who gets it, only when "เลือกเอง" */
.an-pick { padding: 0.75rem; margin-bottom: 0.75rem; border: 1px solid var(--line); border-radius: var(--r-control); }
.an-people { display: grid; gap: 0.15rem; max-height: 14rem; overflow-y: auto; margin-top: 0.4rem; }
.an-people label[hidden] { display: none; }
/* Invoice settings: what is running now, in one row */
.inv-now { display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; margin-bottom: 1rem; }
.inv-now > div { display: grid; gap: 0.15rem; align-content: start; }
.inv-now b { font-size: 1.125rem; }
/* an action that cannot be undone, folded at the end of its section */
.danger-zone { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px dashed var(--line); }
.danger-zone summary { cursor: pointer; color: var(--rose); font-size: 0.875rem; width: fit-content; padding: 0.25rem 0; }
.danger-zone p { margin: 0.5rem 0; }
.inv-at { display: block; font-family: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif; font-size: 0.75rem; color: var(--muted); }
@media (max-width: 40em) { .inv-go { width: 100%; } }

/* HOME mini tabs (2026-11-18): a side panel on the right, opened from the top bar; the page moves over for it */
.dock-launch { display: flex; gap: 0.4rem; margin-right: 0.75rem; }
.dock-launch [aria-pressed="true"] { background: color-mix(in srgb, var(--blue) 12%, var(--surface)); border-color: var(--blue); color: var(--blue); }
.dock { position: fixed; z-index: 8; top: var(--top-b, 3.6rem); right: 0; bottom: 0; width: 21rem; padding: 0.75rem calc(0.75rem + var(--safe-r)) 0.75rem 0.75rem;
  background: var(--paper); border-left: 1px solid var(--line); }
.dock:not(:has(.minitab:not(.folded))) { display: none; }
.frame:has(.dock .minitab:not(.folded)) { padding-right: 21rem; }
.dock-tabs { display: flex; flex-direction: column; gap: 0.75rem; height: 100%; }
.dock .minitab { width: auto; display: flex; flex-direction: column; flex: 1; min-height: 0; border-top: 1px solid var(--line); box-shadow: none; }
.dock .minitab header { cursor: default; }
.dock .minitab header h2 { margin: 0; flex: 1; font-size: 0.9375rem; }
.dock .minitab .body { flex: 1; min-height: 0; overflow-y: auto; display: grid; gap: 0.6rem; align-content: start; }
.dock .minitab.folded { display: none; }
.dock .inv-go { width: 100%; }
.dock .form-foot { margin-top: 0.6rem; }
.name-list.compact { margin: 0; }
.name-list.compact li { padding: 0.4rem 0.6rem; font-size: 0.875rem; }
/* no mini tabs on a phone: Invoice numbers and customer search are in the menu */
@media (max-width: 52em) {
  .dock, .dock-launch { display: none; }
  .frame:has(.dock .minitab:not(.folded)) { padding-right: 0; }
}

/* JO */
.jo-msg { white-space: pre-wrap; font-family: ui-monospace, Consolas, "IBM Plex Sans Thai", monospace; font-size: 0.875rem; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--r-control); padding: 0.75rem; margin: 0; }
.status-select { width: auto; min-height: 2rem; padding: 0.15rem 0.5rem; font-size: 0.875rem; }
.tone-done { --tone: var(--green); } .tone-bad { --tone: var(--rose); } .tone-open { --tone: var(--blue); }
.tone-working { --tone: var(--amber); } .tone-muted { --tone: var(--muted); }
.two-col { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 60em) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0.5rem 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }

/* tickets */
.thread { display: grid; gap: 0.6rem; }
.msg { padding: 0.65rem 0.85rem; border-radius: var(--r-control); background: var(--paper); border: 1px solid var(--line); max-width: 46rem; }
.msg.mine { background: color-mix(in srgb, var(--blue) 9%, var(--surface)); justify-self: end; }
.msg.status { background: none; border-style: dashed; font-size: 0.875rem; color: var(--muted); justify-self: center; }
.msg .meta { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.2rem; }
.msg .text { white-space: pre-wrap; }
.dot-new { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--rose); }

/* announcements */
.notice { border-left: 4px solid var(--blue); }
.notice.important { border-left-color: var(--rose); }
.notice .text { white-space: pre-wrap; }

/* ---- product search results: sections of product cards (like the old system) ---- */
.sr { margin-top: 1rem; display: grid; gap: 1.5rem; }
.sr-section { display: grid; gap: 0.75rem; }
.sr-section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 0.8rem; }
.sr-section-head h2 { margin: 0; font-size: 1.125rem; display: flex; align-items: center; gap: 0.5rem; }
.sr-section-head h2::before { content: ""; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--green); }
.sr-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: var(--r-panel); overflow: hidden; }
.sr-card.incoming { border-left-color: var(--amber); }
.sr-card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.8rem 1rem 0.6rem; }
.sr-card-head h3 { margin: 0; font-size: 1rem; }
.sr-card-head p { margin: 0.2rem 0 0; }
.sr-card-head p b { white-space: nowrap; }
.sr-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.sr-lots > p { padding: 0 1rem 0.8rem; margin: 0; }
/* The lots follow the room the card really has (screen, sidebar, large text):
   wide enough -> a table with the same columns in every card; narrower -> each lot is a block. */
.sr-lots { container-type: inline-size; }
@container (min-width: 52rem) {
  .table.lots { table-layout: fixed; width: 100%; }
  .table.lots td { overflow-wrap: anywhere; }
  .table.lots .c-act, .table.lots th:last-child { text-align: right; }
  .table.lots .c-act .sr-actions { justify-content: flex-end; }
}
.sr-more { justify-self: center; }

/* ---- phone: bottom bar (Home, most used pages, Menu) and the menu as a full sheet ---- */
:root { --bar-h: 3.9rem; }
.bottom-bar { display: none; }
@media (max-width: 52em) {
  .bottom-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 12;
    height: calc(var(--bar-h) + var(--safe-b)); padding: 0.25rem calc(0.25rem + var(--safe-r)) var(--safe-b) calc(0.25rem + var(--safe-l));
    background: var(--surface); border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px color-mix(in srgb, var(--ink) 8%, transparent);
  }
  .bottom-bar a, .bottom-bar button {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem;
    border: 0; background: none; border-radius: var(--r-control); color: var(--muted); text-decoration: none;
    font: inherit; font-size: 0.75rem; line-height: 1.15; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .bottom-bar .ico { width: 1.55rem; height: 1.55rem; }
  /* review 10: the middle button looks like the others (no lit circle); only the page in use is blue */
  .bottom-bar span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-inline: 0.15rem; }
  .bottom-bar [aria-current="page"], .bottom-bar button[aria-expanded="true"] { color: var(--blue); font-weight: 600; }
  .bottom-bar [aria-current="page"] .ico, .bottom-bar button[aria-expanded="true"] .ico { stroke-width: 2.3; }
  .bottom-bar a:active, .bottom-bar button:active { background: var(--paper); }
  body { padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom)); }
  .top .menu-toggle { display: none; }
  /* the menu drawer (see .side above) stops at the bottom bar, which stays usable under it */
  .side { bottom: calc(var(--bar-h) + var(--safe-b)); }
  .nav-scrim { inset: 0 0 calc(var(--bar-h) + var(--safe-b)) 0; }
  .nav-cat a { padding: 0.65rem 0.75rem; font-size: 1rem; }
  .nav-cat a[aria-current="page"]::before { left: 0; }
  .main { padding: 1rem calc(0.9rem + var(--safe-r)) 2rem calc(0.9rem + var(--safe-l)); }
  .main:has(.dock) { padding-bottom: 2rem; }
  .page-head h1 { font-size: 1.25rem; }
  /* the search box scrolls away on a phone instead of covering half the screen */
  .search-box { position: static !important; }
  .search-box .segmented { display: flex; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .search-box .segmented label { flex: none; }
  .sr-card-head { padding: 0.7rem 0.8rem 0.5rem; }
  .btn, .btn-sm { min-height: 2.5rem; }
}
.nav-account { display: none; }
@media (max-width: 52em) { .nav-account { display: block; } }
/* product search: Type / Size / Brand pickers under the search box */
.sr-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 0.5rem; margin-top: 0.6rem; }
.sr-pick select { width: 100%; }
.sr-pick .btn[hidden] { display: none; }
.sr-status { margin-top: 0.6rem; }
#search-count:empty { display: none; }

/* phone: Type / Size / Brand always shown (folding them was harder to use); a shorter page head */
@media (max-width: 40em) {
  .sr-head { flex-wrap: nowrap; align-items: center; }   /* same title size and gap as every other page */
  .sr-head .btn { flex: none; }
  /* the phone bar already has "ตะกร้า": no second cart button squeezing the title and stock time (review 12) */
  body:has(.bottom-bar a[href="/cart"]) .sr-head > .btn { display: none; }
  .search-box { padding: 0.7rem; }
  .sr-status { flex-wrap: nowrap; gap: 0.4rem; }
  .sr-status .segmented { min-width: 0; flex: 1; }
  .sr-status #search-count { flex: none; }
  .sr-status:has(.show-sw) { flex-wrap: wrap; }
}

/* ---- product search: the lots of a card, grouped by colour and brand; each lot in two lines,
   the received date and the technical data under "รายละเอียด" ---- */
.lot-groups { border-top: 1px solid var(--line); }
.lot-group + .lot-group { border-top: 1px solid var(--line); }
.lot-group-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.15rem 1rem;
  padding: 0.45rem 1rem; background: var(--paper); font-size: 0.875rem; }
.lot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem 1rem; align-items: start; padding: 0.65rem 1rem; }
.lot + .lot { border-top: 1px dashed var(--line); }
.lot-main { min-width: 0; }
.lot-l1 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.6rem; }
.lot-name { font-size: 0.875rem; font-weight: 600; overflow-wrap: anywhere; }
.lot-color { font-size: 0.875rem; color: var(--muted); white-space: nowrap; }
.lot-l2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 1rem; margin-top: 0.2rem; font-size: 0.875rem; color: var(--muted); }
.lot-l2 b { color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lot-ready b { font-size: 1rem; color: color-mix(in srgb, var(--green) 60%, var(--ink)); }
.lot-owed b { color: var(--blue); }
.lot-booked b { color: color-mix(in srgb, var(--amber) 60%, var(--ink)); }
.lot-booked-unknown { color: color-mix(in srgb, var(--amber) 60%, var(--ink)); font-weight: 600; }
.lot-cost { white-space: nowrap; }
.lot-note { margin-top: 0.2rem; font-size: 0.875rem; color: var(--muted); overflow-wrap: anywhere; }
.lot-more { margin-top: 0.25rem; font-size: 0.875rem; }
.lot-more summary { cursor: pointer; color: var(--blue); width: fit-content; padding: 0.1rem 0; }
.lot-more dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.15rem 0.8rem; margin: 0.3rem 0 0; }
.lot-more dt { color: var(--muted); }
.lot-more dd { margin: 0; overflow-wrap: anywhere; }
.lot-act { justify-content: flex-end; flex-wrap: nowrap; }
/* a narrow card: the buttons go under the lot, side by side */
@container (max-width: 36rem) {
  .lot { grid-template-columns: minmax(0, 1fr); padding: 0.65rem 0.85rem; }
  .lot-group-head { padding: 0.45rem 0.85rem; }
  .lot-act .btn { flex: 1; }
  .lot-more summary { padding: 0.35rem 0; }
}
@media (max-width: 40em) {
  .sr-pick { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .sr-pick label:first-child { grid-column: 1 / 3; } .sr-pick #f-clear { grid-column: 3; grid-row: 1; }
  .sr-pick label:nth-child(3) { grid-column: 2 / 4; }
  .sr-pick:has(#f-clear[hidden]) label:first-child { grid-column: 1 / -1; }
}

/* ---- cart dialog: a number pad for touch screens ---- */
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; margin: 0.25rem 0 1rem; }
/* phones and tablets have their own number keyboard: no pad on screen */
@media (pointer: coarse), (max-width: 40em) { .numpad { display: none; } }
.numpad .btn { min-height: 3.1rem; font-size: 1.25rem; font-weight: 600; justify-content: center; font-variant-numeric: tabular-nums; }
#cart-qty { font-size: 1.5rem; text-align: right; font-variant-numeric: tabular-nums; }

/* ---- motion, feedback and affordance ----
   Press: things give a little under the finger. Open: dialogs and the drawer
   slide in, new content rises in. After an action: the button says it is busy,
   then a short message (toast) says what happened. */
.btn, .nav-cat a, .segmented label, .seg-link, .bottom-bar a, .bottom-bar button, .mg-del, .mg-use, .mg-ac-item,
input[type=text], input[type=password], input[type=search], select, textarea {
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast),
    box-shadow var(--t-fast), transform var(--t-fast) var(--ease-out), opacity var(--t-fast);
}
.btn:active:not(:disabled), .mg-del:active, .mg-use:active { transform: scale(0.97); }
.nav-cat a:active { transform: scale(0.985); background: var(--paper); }
.segmented label:active { background: color-mix(in srgb, var(--blue) 8%, transparent); }
.bottom-bar .ico { transition: transform var(--t-fast) var(--ease-out); }
.bottom-bar a:active .ico, .bottom-bar button:active .ico { transform: scale(0.86); }
/* hover says "this can be pressed" (mouse only, so a tap does not leave it stuck) */
@media (hover: hover) {
  .btn:not(.btn-primary):not(.solid):not(:disabled):hover { background: color-mix(in srgb, var(--blue) 5%, var(--surface)); }
  .btn-quiet:not(:disabled):hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
  input[type=text]:hover:not(:focus), input[type=password]:hover:not(:focus), input[type=search]:hover:not(:focus),
  select:hover:not(:focus), textarea:hover:not(:focus) { border-color: var(--muted); }
  .table a:hover { text-decoration-thickness: 2px; }
}
select { cursor: pointer; }
.table a { text-underline-offset: 3px; }
.btn:disabled { box-shadow: none; transform: none; }

/* sections that open and close show which way they go */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: ""; display: inline-block; width: 0.45rem; height: 0.45rem; margin: 0 0.6rem 0.15rem 0.1rem;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg);
  transition: transform var(--t-med) var(--ease-out);
}
details[open] > summary::before { transform: rotate(45deg); }
details > summary:hover::before { border-color: var(--blue); }
/* new content rises in -- only what a press brought up (review 10: messages that are there when the page
   opens, and every opened <details>, just appear: motion on everything reads as decoration) */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop { 40% { transform: scale(1.08); } }
.inv-result, .dock .minitab:not(.folded) .body, .mg-ac, .mg-paste:not([hidden]) {
  animation: rise var(--t-med) var(--ease-out);
}

/* dialogs: fade and lift in; on a phone they come up from the bottom, near the thumb */
dialog.confirm {
  opacity: 0; transform: translateY(10px);
  transition: opacity var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out),
    overlay var(--t-med) allow-discrete, display var(--t-med) allow-discrete;
}
dialog.confirm[open] { opacity: 1; transform: none; }
@starting-style { dialog.confirm[open] { opacity: 0; transform: translateY(10px); } }
dialog.confirm::backdrop { transition: background-color var(--t-med), overlay var(--t-med) allow-discrete, display var(--t-med) allow-discrete; }
@starting-style { dialog.confirm[open]::backdrop { background-color: rgb(10 20 30 / 0); } }
@media (max-width: 40em) {
  dialog.confirm {
    margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 14px 14px 0 0; border-bottom: 0;
    padding: 1.25rem calc(1.1rem + var(--safe-r)) calc(1.25rem + var(--safe-b)) calc(1.1rem + var(--safe-l));
    max-height: calc(100dvh - 1rem - var(--safe-t)); transform: translateY(100%);
  }
  dialog.confirm[open] { transform: none; }
  @starting-style { dialog.confirm[open] { transform: translateY(100%); } }
  dialog.confirm::before { content: ""; display: block; width: 2.5rem; height: 4px; margin: -0.4rem auto 0.9rem;
    border-radius: var(--r-control); background: var(--line); }
  dialog.confirm .actions .btn { flex: 1; min-height: 3rem; }
}

/* busy: the pressed button shows a spinner until the next page comes */
.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.is-busy > * { visibility: hidden; }
.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 1.1em; height: 1.1em; border-radius: 50%;
  border: 2px solid var(--spin, var(--ink)); border-right-color: transparent; animation: spin 0.7s linear infinite;
}
.btn-primary.is-busy { --spin: var(--on-blue); }
.btn-danger.solid.is-busy { --spin: var(--on-rose); }
@keyframes spin { to { transform: rotate(360deg); } }
/* done: green for a moment */
.is-done { border-color: var(--green) !important; background: color-mix(in srgb, var(--green) 14%, var(--surface)) !important;
  color: color-mix(in srgb, var(--green) 75%, var(--ink)) !important; font-weight: 600; }
.pop { animation: pop 320ms var(--ease-out); }
#cart-count, .inv-result b { display: inline-block; }
.btn.is-busy:disabled { opacity: 1; }

/* toasts: bottom centre, above the phone bar and the home indicator */
.toasts {
  position: fixed; z-index: 40; left: 50%; bottom: calc(1.25rem + var(--safe-b)); transform: translateX(-50%);
  width: min(26rem, calc(100vw - 2rem - var(--safe-l) - var(--safe-r))); display: grid; gap: 0.5rem; pointer-events: none;
}
@media (max-width: 52em) { .toasts { bottom: calc(var(--bar-h) + 0.75rem + var(--safe-b)); } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0.8rem 0.7rem 1rem;
  border-radius: var(--r-control); background: var(--ink); color: var(--paper); box-shadow: var(--shadow-float);
  font-size: 0.9375rem; line-height: 1.4; animation: toast-in var(--t-med) var(--ease-out);
  transition: opacity var(--t-med), transform var(--t-med) var(--ease-out);
}
.toast::before { content: "✓"; font-weight: 600; color: var(--green-d); }
.toast.error { background: var(--rose); color: var(--on-rose); }
.toast.error::before { content: "!"; color: var(--on-rose); }
.toast span { flex: 1; overflow-wrap: anywhere; }
.toast button { flex: none; min-height: 2.25rem; padding: 0 0.75rem; border: 0; border-radius: var(--r-control); background: transparent;
  color: inherit; font: inherit; font-weight: 600; cursor: pointer; opacity: 0.85; }
.toast button:hover { opacity: 1; background: rgb(255 255 255 / 0.12); }
.toast.leaving { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }

/* cart page: a removed line fades away at once */
tr.leaving { opacity: 0; transition: opacity var(--t-med); }

/* touch screens: everything pressable is at least 44px */
@media (pointer: coarse) {
  .btn, .btn-sm, select, input[type=text], input[type=password], input[type=search] { min-height: 2.75rem; }
  .segmented label, .seg-link { display: inline-flex; align-items: center; min-height: 2.75rem; }
  .check { min-height: 2.75rem; }
  .check input, input[type=checkbox], input[type=radio] { width: 1.3rem; height: 1.3rem; }
  .mg-del { min-width: 2.75rem; min-height: 2.75rem; }
  .mg-use { min-height: 2rem; padding-inline: 0.6rem; }
  .mg-ac-item { padding-block: 0.7rem; }
  .nav-cat a { min-height: 2.9rem; }
  .status-select, .mg-field select, .qd-signer-pick select { min-height: 2.75rem; }
  .toast button { min-height: 2.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::backdrop {
    animation-duration: 1ms !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; transition-delay: 0s !important; scroll-behavior: auto !important;
  }
  .is-busy::after { animation: spin 1.2s linear infinite !important; }   /* the spinner still says "working" */
}

/* customer search: the search box with "+ Add name" beside it */
.c-row { display: flex; gap: 0.5rem; align-items: stretch; }
.c-row input { flex: 1; min-width: 0; }
.c-add { flex: none; }
@media (max-width: 30em) { .c-add { padding-inline: 0.8rem; } }
/* a count on a menu link: new names for the back office */
.nav-count { min-width: 1.35rem; height: 1.35rem; padding: 0 0.35rem; border-radius: var(--r-pill); background: var(--rose); color: var(--on-rose);
  font-size: 0.75rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; animation: pop 400ms var(--ease-out); }
/* bookings: a lot with several bookings keeps its product cells beside all of them */
.bk-table tbody + tbody tr:first-child td { border-top: 2px solid var(--line); }
.bk-table td[rowspan] { vertical-align: top; }
.bk-filter { display: flex; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
.bk-filter label { flex: none; }
.cart-qty { width: 7rem; }
.cart-table form[data-cart-qty] { justify-content: flex-end; }
/* phone: no sideways scroll -- each cart line and each booked lot is a card */
@media (max-width: 40em) {
  .cart-table thead, .bk-table thead { display: none; }
  .cart-table, .cart-table tbody, .bk-table, .bk-table tbody { display: block; }
  .cart-table tr, .bk-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.4rem 0.75rem; align-items: center;
    padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--line); }
  .cart-table tbody tr:last-child, .bk-table tbody:last-child tr:last-child { border-bottom: 0; }
  .cart-table td, .bk-table td { display: block; padding: 0; border: 0; min-width: 0; }
  .cart-table td:first-child { grid-column: 1 / -1; font-weight: 600; }
  .bk-table tbody + tbody tr:first-child td { border-top: 0; }
  .bk-table tbody + tbody { border-top: 2px solid var(--line); }
  .bk-table tr:not(:first-child) { padding-top: 0; }
  .bk-table td[rowspan] { grid-column: 1 / -1; }
  .bk-table td[rowspan]:first-child { font-weight: 600; }
  .bk-table td.nowrap { white-space: normal; text-align: right; }
  .bk-filter { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
  .bk-filter label { display: flex; align-items: center; justify-content: center; text-align: center;
    min-height: 2.75rem; padding: 0.4rem 0.5rem; border-left: 0; }
  .bk-filter label:nth-child(even) { border-left: 1px solid var(--line); }
  .bk-filter label:nth-child(n+3) { border-top: 1px solid var(--line); }
  .bk-filter label:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* catalog suggestions: the page uses the whole width; each row fits on one line
   on a computer and turns into a small card when the panel is narrow */
.main:has(.sg-page) { max-width: 100rem; }
.sg-wrap { container-type: inline-size; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); }
.sg-table { table-layout: fixed; width: 100%; font-size: 0.9375rem; }
.sg-table th, .sg-table td { padding: 0.5rem 0.7rem; vertical-align: middle; }
.sg-table col.c-tick { width: 2.75rem; } .sg-table col.c-count { width: 15.5rem; } .sg-table col.c-pick { width: 17rem; }
.sg-table col.c-size { width: 12rem; } .sg-table col.c-color { width: 14rem; }
.sg-tick label { display: flex; align-items: center; justify-content: center; min-height: 2.5rem; cursor: pointer; }
.sg-tick input { width: 1.15rem; height: 1.15rem; cursor: pointer; }
.sg-what { min-width: 0; overflow-wrap: anywhere; }
.sg-sample { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.sg-count { display: table-cell; }
.sg-count .sg-lots { font-variant-numeric: tabular-nums; font-weight: 600; margin-right: 0.3rem; }
.sg-count .badge { margin: 0.1rem 0.15rem 0.1rem 0; }
.sg-pick select, .sg-pick input { width: 100%; min-height: 2.25rem; padding-block: 0.3rem; }
.sg-pick input[data-sg-newname] { margin-top: 0.35rem; }
.sg-table tbody tr { transition: background-color var(--t-fast); }
.sg-table tbody tr.sg-on { background: color-mix(in srgb, var(--blue) 6%, var(--surface)); }
@media (hover: hover) { .sg-table tbody tr:hover { background: color-mix(in srgb, var(--blue) 4%, var(--surface)); } }
.sg-foot { position: sticky; bottom: calc(0.5rem + var(--safe-b)); z-index: 3; box-shadow: var(--shadow-float); }
@media (max-width: 52em) { .sg-foot { bottom: calc(var(--bar-h) + 0.5rem + var(--safe-b)); } }
/* narrow: each row is a card -- tick on the left, what was found, then the answer under it */
@container (max-width: 40rem) {
  .sg-table, .sg-table tbody { display: block; }
  .sg-table thead, .sg-table colgroup { display: none; }
  .sg-table tr { display: grid; grid-template-columns: 2.75rem minmax(0, 1fr); gap: 0.2rem 0.4rem; padding: 0.6rem 0.7rem 0.7rem 0.2rem;
    border-bottom: 1px solid var(--line); }
  .sg-table td { display: block; padding: 0; border: 0; }
  .sg-table .sg-tick { grid-row: 1 / span 4; align-self: start; }
  .sg-table td:not(.sg-tick) { grid-column: 2; }
  .sg-sizes .sg-pick { order: 3; }
  .sg-table .sg-count { font-size: 0.875rem; }
  .sg-table .sg-pick { margin-top: 0.3rem; }
}
@media (max-width: 40em) {
  .sg-foot { padding: 0.6rem; flex-wrap: nowrap; }
  .sg-foot > .note { display: none; }
  .sg-foot > .btn, .sg-foot > .btn-primary { flex: 1 1 0; min-height: 2.9rem; white-space: normal; line-height: 1.2; }
}

/* ---- price list: types on the left, the sizes of one type on the right ---- */
.main:has(.pr-page) { max-width: none; }
.pr-layout { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 1rem; align-items: start; }
.pr-main { display: grid; gap: 1rem; min-width: 0; }
.pr-main > .panel + .panel { margin-top: 0; }
.pr-types { position: sticky; top: calc(4.25rem + var(--safe-t)); padding: 0.6rem; max-height: calc(100vh - 5.5rem - var(--safe-t));
  display: flex; flex-direction: column; gap: 0.5rem; }
.pr-types input { min-height: 2.25rem; }
.pr-types ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; scrollbar-width: thin; }
.pr-types a { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.6rem; border-radius: var(--r-control);
  color: var(--ink); text-decoration: none; font-size: 0.9375rem; transition: background-color var(--t-fast); }
.pr-types a:hover { background: var(--paper); }
.pr-types a[aria-current="page"] { background: color-mix(in srgb, var(--violet) 16%, transparent); font-weight: 600; }
.pr-tname { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pr-tcount { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pr-tcount.part { color: color-mix(in srgb, var(--amber) 65%, var(--ink)); } .pr-tcount.done { color: color-mix(in srgb, var(--green) 75%, var(--ink)); font-weight: 600; }
.pr-typepick { display: none; }
/* the next type is loading: dim at once-ish (a fast load never flickers), no presses on the old one */
.pr-main.pr-loading { opacity: 0.5; pointer-events: none; transition: opacity var(--t-fast) linear 80ms; }
body:has(.pr-loading) { cursor: progress; }
.pr-typepick select { max-width: 26rem; }
.pr-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 0.6rem; }
.pr-head h2 { margin: 0; }
.pr-head p { margin: 0.15rem 0 0; display: flex; align-items: center; gap: 0.6rem; }
.pr-meter { width: 8rem; display: inline-block; }
.pr-meter > i { background: var(--violet); }
.pr-tools { margin-bottom: 0.6rem; }
.pr-tools input[type=search] { flex: 0 1 16rem; width: auto; min-height: 2.25rem; }
/* the grid: plain text until you touch a box; the size column stays put when it scrolls sideways */
.pr-wrap { container-type: inline-size; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-panel); }
.price-grid { table-layout: fixed; width: 100%; min-width: 56rem; font-size: 0.875rem; }
.price-grid col.c-size { width: 9%; } .price-grid col.c-brand { width: 9%; } .price-grid col.c-cond { width: 12%; }
.price-grid col.c-range { width: 11%; } .price-grid col.c-price { width: 8.2%; } .price-grid col.c-note { width: 11%; }
.price-grid col.c-del { width: 2.5rem; }
.price-grid th { white-space: normal; line-height: 1.25; font-size: 0.75rem; vertical-align: bottom; padding: 0.5rem 0.4rem; }
.price-grid td { padding: 0.15rem 0.25rem; border-bottom: 0; }
.price-grid tbody + tbody tr.first td { border-top: 1px solid var(--line); }
.price-grid tbody tr.first td { padding-top: 0.35rem; }
.price-grid .pr-size { position: sticky; left: 0; z-index: 1; background: var(--surface); padding-left: 0.7rem; font-size: 0.9375rem; }
.price-grid input.cell { width: 100%; min-height: 2rem; padding: 0.2rem 0.4rem; font-size: 0.875rem; border-color: transparent;
  background: color-mix(in srgb, var(--paper) 55%, var(--surface)); border-radius: var(--r-control); }
.price-grid input.cell:hover { border-color: var(--line); }
.price-grid input.cell:focus { background: var(--surface); }
.price-grid input.cell::placeholder { color: color-mix(in srgb, var(--muted) 60%, transparent); }
.price-grid .pr-price input { font-weight: 600; }
.price-grid input.cell.is-changed { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 12%, var(--surface)); }
.pr-range { white-space: nowrap; }
.pr-range input.cell { width: calc(50% - 0.5rem); }
.pr-range span { color: var(--muted); }
.pr-del-btn { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: var(--r-control);
  cursor: pointer; color: var(--muted); font-size: 1.125rem; }
.pr-del-btn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pr-del-btn:hover { color: var(--rose); background: color-mix(in srgb, var(--rose) 12%, transparent); }
.pr-del-btn:has(input:checked) { color: var(--on-rose); background: var(--rose); }
.pr-del-btn:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 1px; }
tr.pr-deleting input.cell { text-decoration: line-through; opacity: 0.55; }
.price-grid .add-row td { padding: 0 0.3rem 0.4rem; }
.price-grid .add-row .btn { min-height: 1.9rem; font-size: 0.875rem; color: var(--blue); }
tr.pr-new { animation: rise var(--t-med) var(--ease-out); }
/* the save bar stays at the bottom while you work */
.pr-foot { position: sticky; bottom: calc(0.5rem + var(--safe-b)); z-index: 3; margin-top: 0.75rem; padding: 0.6rem 0.75rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.pr-dirty .pr-foot { box-shadow: var(--shadow-float); border-color: var(--amber); }
#pr-dirty { color: var(--muted); }
#pr-dirty.pr-has { color: color-mix(in srgb, var(--amber) 65%, var(--ink)); font-weight: 600; }
@media (max-width: 52em) { .pr-foot { bottom: calc(var(--bar-h) + 0.5rem + var(--safe-b)); } }
/* iPad / phone: the drop-down instead of the list; under 46rem each condition is a small card */
@media (max-width: 100em) {
  .pr-layout { grid-template-columns: minmax(0, 1fr); }
  .pr-types { display: none; }
  .pr-typepick { display: block; }
}
@container (max-width: 46rem) {
  .price-grid { min-width: 0; }
  .price-grid, .price-grid tbody { display: block; }
  .price-grid thead, .price-grid colgroup { display: none; }
  .price-grid tbody { padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--line); }
  .price-grid tr.pr-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.35rem 0.5rem; padding: 0.5rem 2.25rem 0.5rem 0;
    border-top: 1px dashed var(--line); position: relative; }
  .price-grid tr.pr-row.first { border-top: 0; padding-top: 0; }
  .price-grid tr.pr-row td { display: block; padding: 0; border: 0; }
  .price-grid tr.pr-row td::before { content: attr(data-label); display: block; font-size: 0.75rem; color: var(--muted); margin-bottom: 0.1rem; }
  .price-grid .pr-size { position: static; grid-column: 1 / -1; font-size: 1rem; }
  .price-grid .pr-size::before { display: none !important; }
  .price-grid tr.pr-row:not(.first) .pr-size { display: none; }
  .price-grid .pr-del { position: absolute; top: 0.35rem; right: 0; }
  .price-grid tr.pr-row.first .pr-del { top: -0.2rem; }
  .price-grid .pr-del::before { display: none !important; }
  .price-grid input.cell { min-height: 2.5rem; }
  .price-grid .add-row { display: block; }
  .price-grid .add-row td { display: block; padding: 0.3rem 0 0; }
  .price-grid .add-row td:first-child { display: none; }
}

/* ---- product panel (search): a side panel on a computer, a sheet from the bottom on a phone ---- */
.sr-open { all: unset; cursor: pointer; font: inherit; color: inherit; border-radius: var(--r-control); }
.sr-open:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.sr-open:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
h3 .sr-open::after { content: " ›"; color: var(--muted); }
dialog.confirm.pd { padding: 0; overflow: hidden; width: min(36rem, 100vw); max-width: none; }
dialog.confirm.pd[open] { display: flex; flex-direction: column; }
.pd-head { display: flex; align-items: flex-start; gap: 0.75rem; padding: 1rem 1.25rem 0.75rem; border-bottom: 1px solid var(--line); }
.pd-head > div { flex: 1; min-width: 0; }
.pd-head h2 { margin: 0; font-size: 1.125rem; overflow-wrap: anywhere; }
.pd-head p { margin: 0.15rem 0 0; }
.pd-head p:empty { display: none; }
.pd-x { min-width: 2.75rem; min-height: 2.75rem; justify-content: center; margin: -0.4rem -0.6rem 0 0; }
.pd-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0.9rem 1.25rem 1rem; }
.pd-foot { display: flex; gap: 0.5rem; justify-content: flex-end; padding: 0.75rem 1.25rem calc(0.75rem + var(--safe-b)); border-top: 1px solid var(--line); background: var(--surface); }
.pd-sec { margin-top: 1.1rem; }
.pd-sec h3 { margin: 0 0 0.5rem; font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.pd-ctl { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center; }
.pd-qty { display: inline-flex; align-items: center; gap: 0.4rem; }
.pd-qty input { width: 7rem; text-align: right; font-variant-numeric: tabular-nums; }
.pd-answer { margin: 0.8rem 0 0.7rem; padding: 0.7rem 0.9rem; border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: var(--r-control); min-height: 4.2rem; }
.pd-ctx { color: var(--muted); }
.pd-ctx b { color: var(--ink); }
.pd-wait { margin-top: 0.35rem; }
.pd-price-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.pd-seg { margin-bottom: 0.5rem; }
.pd-focus { margin-top: 0.8rem; padding: 0.6rem 0.8rem 0.7rem; border: 1px solid color-mix(in srgb, var(--blue) 45%, var(--line)); border-radius: var(--r-control);
  background: color-mix(in srgb, var(--blue) 8%, transparent); }
.pd-focus-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.pd-focus-label { font-size: 0.75rem; font-weight: 600; color: var(--blue); }
.pd-focus-row { display: flex; justify-content: space-between; gap: 0.75rem; align-items: flex-start; margin-top: 0.2rem; }
.pd-focus-bal { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.pd-focus-bal b { font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.pd-mx { width: 100%; border-collapse: collapse; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.pd-mx th, .pd-mx td { padding: 0; border-bottom: 1px solid var(--line); }
.pd-mx thead th { padding: 0.35rem 0.5rem; font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.pd-mx th.pd-mx-range { text-align: left; font-weight: 400; color: var(--muted); padding: 0.45rem 0.5rem 0.45rem 0; white-space: nowrap; }
.pd-mx-other th.pd-mx-range { white-space: normal; font-size: 0.75rem; }
.pd-mx thead th.is-col { color: var(--blue); }
.pd-mx td.is-col { background: color-mix(in srgb, var(--blue) 7%, transparent); }
.pd-mx tr.is-row th.pd-mx-range { color: var(--ink); font-weight: 600; }
.pd-mx tr.is-row td { background: color-mix(in srgb, var(--blue) 5%, transparent); }
.pd-mx td.is-none { color: var(--muted); padding: 0.45rem 0.5rem; }
.pd-cell { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 0.5rem; min-height: 2.5rem; text-align: right; cursor: pointer; font-weight: 400; }
.pd-cell:hover { background: color-mix(in srgb, var(--blue) 10%, transparent); }
.pd-cell:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.pd-mx td.is-on { background: color-mix(in srgb, var(--green) 18%, transparent); }
.pd-mx td.is-on .pd-cell { color: var(--green); font-weight: 600; box-shadow: inset 0 0 0 2px var(--green); border-radius: var(--r-control); }
.pd-tap { margin: 0.35rem 0 0; }
.sr-lot-act .btn { min-width: 5.5rem; justify-content: center; }
.pd-big b { font-size: 1.75rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pd-next { color: color-mix(in srgb, var(--green) 75%, var(--ink)); font-weight: 600; }
.pd-odd { margin: 0.6rem 0 0; }
.pd-note { margin: 0.5rem 0 0; }
.pd-lot { min-width: 0; }
.pd-lot-name { font-weight: 600; font-size: 0.875rem; overflow-wrap: anywhere; }
.pd-lot-note { margin-top: 0.15rem; }
@media (min-width: 40.01em) {
  dialog.confirm.pd { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; border-radius: 0; border-width: 0 0 0 1px; transform: translateX(2rem); }
  dialog.confirm.pd[open] { transform: none; }
  @starting-style { dialog.confirm.pd[open] { opacity: 0; transform: translateX(2rem); } }
}
@media (max-width: 40em) {
  dialog.confirm.pd { padding: 0; max-height: calc(100dvh - 0.5rem - var(--safe-t)); }
  dialog.confirm.pd::before { margin: 0.5rem auto 0; flex-shrink: 0; }
  .pd-head { padding: 0.5rem 1rem 0.6rem; }
  .pd-body { padding: 0.8rem 1rem 1rem; }
  .pd-foot { padding: 0.6rem 1rem calc(0.6rem + var(--safe-b)); }
  .pd-foot .btn { flex: 1; min-height: 3rem; justify-content: center; }
}
/* price panel: no motion -- it is there at once when opened and gone at once when closed,
   on a computer and a phone (Victor 2026-11-16) */
dialog.confirm.pd, dialog.confirm.pd::backdrop { transition: none; }
dialog.confirm.pd[open] { opacity: 1; transform: none; }

/* show / hide costs on the product search (a switch; off until turned on) */
body:not(.show-cost) .x-cost { display: none !important; }
.show-slot { margin-left: auto; }
.show-sw { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.show-sw .sw { position: relative; display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.7rem; min-height: 2.25rem;
  border: 1px solid var(--line); border-radius: var(--r-pill); cursor: pointer; font-size: 0.875rem; user-select: none; }
.show-sw .sw input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.show-sw .sw::before { content: ""; width: 1.9rem; height: 1.05rem; border-radius: 999px; background: var(--line); flex-shrink: 0;
  transition: background var(--t-fast); }
.show-sw .sw::after { content: ""; position: absolute; left: calc(0.7rem + 2px); width: calc(1.05rem - 4px); height: calc(1.05rem - 4px);
  border-radius: 50%; background: var(--surface); transition: transform var(--t-fast) var(--ease-out); }
.show-sw .sw:has(input:checked) { border-color: var(--blue); color: var(--blue); }
.show-sw .sw:has(input:checked)::before { background: var(--blue); }
.show-sw .sw:has(input:checked)::after { transform: translateX(0.85rem); }
.show-sw .sw:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.pd-show { margin-bottom: 0.2rem; }
@media (max-width: 40em) { .show-slot { margin-left: 0; flex-basis: 100%; } }
.pd-booking { white-space: pre-line; }


/* =====================================================================
   Thumb reach, optical centre and colour (2026-11-15)
   ===================================================================== */

/* ---- thumb: on a phone the actions sit on the right, where a right thumb reaches ---- */
@media (max-width: 52em) {
  /* a page's own button(s) beside the title wrap under it -- keep them on the right */
  .page-head > :not(:first-child) { margin-left: auto; }
  /* a row that is only buttons ends on the right */
  .actions:not(:has(input, select, textarea, .segmented, label)) { justify-content: flex-end; }
  /* bigger touch targets for small buttons */
  .btn-sm { min-height: 2.75rem; padding-inline: 0.85rem; }
}

/* ---- optical centre: things meant to sit "in the middle" sit a little above it ---- */
.main { margin-inline: auto; }                                   /* the page balanced between sidebar and edge */
@media (min-width: 40.01em) { dialog.confirm:not(.pd)[open] { translate: 0 -5vh; } }
.auth-card { margin: max(1.5rem, calc(50dvh - 17rem)) auto 3rem; }
.sr-empty { text-align: center; padding: 10vh 1rem 16vh; margin: 0; }

/* ---- colour (2026-11-18, "ไม่ดูเป็น AI"): a plain page; colour only where it says something
   (stock status, warnings, the menu group dot). No glows, gradients, title bars or colour washes. ---- */
body { background: var(--paper); }
.top { border-bottom-color: transparent; }
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none; }
:where(.main) { --stripe: var(--blue); }
.main > .page-head { --stripe: inherit; }
.table th { background: color-mix(in srgb, var(--blue) 7%, var(--surface)); color: color-mix(in srgb, var(--blue) 40%, var(--muted)); }
/* the picked option in a segmented choice reads as picked */
.segmented label:has(input:checked) {
  background: color-mix(in srgb, var(--blue) 20%, transparent); color: color-mix(in srgb, var(--blue) 70%, var(--ink));
}
.segmented label:has(input:checked) .muted { color: color-mix(in srgb, var(--muted) 45%, var(--ink)); }
/* product search: colour/brand rows and lot cards pick up their section's colour */
.lot-group-head { background: color-mix(in srgb, var(--green) 8%, var(--surface)); }
.sr-card.incoming .lot-group-head { background: color-mix(in srgb, var(--amber) 10%, var(--surface)); }
/* the phone's bottom bar: the current page in colour */
.bottom-bar [aria-current="page"] .ico { color: var(--blue); }

/* product search on a phone: the four choices (ทั้งหมด / ในสต็อก / สินค้ารอเข้า / สินค้าหมด)
   all in view, two by two across the box -- no sideways scroll to find "สินค้ารอเข้า" */
@media (max-width: 40em) {
  .search-box .sr-status { flex-wrap: wrap; }
  .search-box .sr-status .segmented { display: grid; grid-template-columns: 1fr 1fr; flex: 1 1 100%; overflow: visible; }
  .search-box .sr-status .segmented label { display: flex; align-items: center; justify-content: center; text-align: center;
    min-height: 2.75rem; padding: 0.4rem 0.5rem; border-left: 0; }
  .search-box .sr-status .segmented label:nth-child(even) { border-left: 1px solid var(--line); }
  .search-box .sr-status .segmented label:nth-child(n+3) { border-top: 1px solid var(--line); }
  .search-box .sr-status #search-count { flex: 1 1 auto; }
}

/* Invoice Dashboard: a card per system, then two plain lists */
/* latest runs across the whole width (what people look at most), deleted numbers under it */

/* JO history: a card per JO -- JO no. and date, then customer / sales / items, then status, SAME JOB and MU % on the right */
.jo-filter select { width: auto; }
.jo-list { display: grid; gap: 0.6rem; margin-top: 1rem; }
.jo-card { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) minmax(16rem, 22rem); gap: 0.5rem 1.25rem; align-items: start;
  padding: 0.85rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.jo-id { display: grid; gap: 0.1rem; }
.jo-no { font-weight: 600; font-size: 1rem; }
.jo-cus { display: block; line-height: 1.35; }
.jo-items { white-space: pre-line; margin-top: 0.25rem; color: color-mix(in srgb, var(--ink) 80%, var(--muted)); }
.jo-edit { display: grid; gap: 0.5rem; justify-items: end; }
.jo-edit .status-select { min-width: 9rem; font-weight: 600; }
.jo-fields { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem; gap: 0.5rem; width: 100%; }
.jo-f { display: grid; gap: 0.15rem; }
.jo-f textarea, .jo-f input { min-height: 2.25rem; padding: 0.35rem 0.55rem; resize: vertical; }
@media (max-width: 52em) {
  .jo-card { grid-template-columns: minmax(0, 1fr) auto; }
  .jo-id { grid-column: 1; grid-row: 1; }
  .jo-edit { display: contents; }
  .jo-edit .status-select { grid-column: 2; grid-row: 1; justify-self: end; }
  .jo-who { grid-column: 1 / -1; }
  .jo-fields { grid-column: 1 / -1; }
}
@media (max-width: 40em) { .jo-filter select { flex: 1 1 40%; min-width: 0; } .jo-filter input[type=search] { flex: 1 1 100%; } }

/* Margin settings: both signature cards the same height, the box in the middle, the controls lined up */
.qs-grid { align-items: stretch; }
.qs-paper { flex: 1; align-items: center; }
.qs-paper .qd-sign { align-self: stretch; display: flex; flex-direction: column; justify-content: flex-end; }
.qs-controls { margin-top: auto; }

/* usage tracking: number tiles, a bar per day, bars for people and pages */
.tk-tiles { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); margin-bottom: 1rem; }
.tk-tile { display: grid; gap: 0.15rem; padding: 0.8rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
  border-top: 3px solid var(--blue); }
.tk-tile span { font-size: 0.875rem; color: var(--muted); }
.tk-tile b { font-size: 1.5rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tk-chart { display: flex; align-items: flex-end; gap: 4px; height: 11rem; padding-top: 1.2rem; overflow-x: auto; }
.tk-col { flex: 1 0 1.6rem; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 0.2rem; }
.tk-col i { display: block; width: 70%; min-height: 2px; border-radius: 4px 4px 0 0;
  background: var(--blue); }
.tk-n { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tk-d { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.tk-cols { display: grid; gap: 1rem; margin-top: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); align-items: start; }
.tk-cols .panel + .panel { margin-top: 0; }
.tk-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.tk-row { display: flex; justify-content: space-between; gap: 0.75rem; align-items: baseline; }
.tk-bar { height: 0.45rem; margin: 0.25rem 0; border-radius: var(--r-pill); background: color-mix(in srgb, var(--muted) 15%, transparent); overflow: hidden; }
.tk-bar i { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.tk-bar-green i { background: var(--green); }

/* Stock Dashboard: Inventory - Stock (as on the old system) */
#inv-q { margin-bottom: 0.6rem; }
.inv-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 0.5rem; }
@media (max-width: 40em) { .inv-filters { grid-template-columns: 1fr 1fr; } .inv-filters #inv-type { grid-column: 1 / -1; } }
.inv-empty { text-align: center; padding: 2.5rem 1rem 3.5rem; margin: 0; }
.inv-table td { vertical-align: middle; }
.inv-table .inv-group td { background: color-mix(in srgb, var(--green) 8%, var(--surface)); font-weight: 600; }
.inv-table .inv-group .muted { font-weight: 400; }
.inv-table tr.inv-row { cursor: pointer; }
.inv-table tr.inv-row:hover td { background: color-mix(in srgb, var(--blue) 5%, var(--surface)); }
.inv-table tr.inv-row td:first-child::before { content: "▸"; display: inline-block; width: 1rem; color: var(--muted); transition: transform var(--t-fast); }
.inv-table tr.inv-row.open td:first-child::before { transform: rotate(90deg); }
.inv-size { font-weight: 600; }
.inv-wait { color: color-mix(in srgb, var(--amber) 65%, var(--ink)); }
.inv-total { font-weight: 600; }
.inv-low td.inv-opt { color: var(--rose); font-weight: 600; }
.inv-lots td { background: var(--paper); font-size: 0.875rem; }
.inv-lots ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.inv-lots li { display: flex; justify-content: space-between; gap: 1rem; }
.inv-opt .btn { margin-left: 0.4rem; min-height: 1.8rem; padding: 0.1rem 0.5rem; }
.opt-in { width: 6rem; min-height: 2rem; }
@media (max-width: 52em) {
  .inv-table thead { display: none; }
  .inv-table, .inv-table tbody { display: block; }
  .inv-table tr.inv-row { display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.75rem; padding: 0.6rem 0.2rem; border-bottom: 1px solid var(--line); }
  .inv-table tr.inv-row td { border: 0; padding: 0; background: none; }
  .inv-table tr.inv-row td:not(:nth-child(-n+3))::before { content: attr(data-label) " "; color: var(--muted); font-size: 0.75rem; font-weight: 400; }
  .inv-table tr.inv-row td:first-child { grid-column: 1 / -1; font-size: 0.875rem; color: var(--muted); }
  .inv-table tr.inv-row td.num { text-align: left; }
  .inv-table tr.inv-group, .inv-table tr.inv-lots { display: block; }
  .inv-table tr.inv-group td, .inv-table tr.inv-lots td { display: block; }
}

/* Users page: who is online now */

/* toasts: every message after an action, in one place */
.toast.warning { background: var(--amber); color: #1b1300; }
.toast.warning::before { content: "!"; color: inherit; }
.toast.info::before { content: "i"; color: var(--blue-d); font-style: italic; }
.toast .toast-x { padding: 0 0.6rem; font-weight: 400; }

/* the bell in the top bar and the notice pop-up */
.top .bell { position: relative; }
.top .bell svg { width: 1.15rem; height: 1.15rem; }
.bell-n { position: absolute; top: -0.3rem; right: -0.35rem; min-width: 1.25rem; height: 1.25rem; padding: 0 0.3rem; border-radius: 999px;
  background: var(--rose); color: var(--on-rose); font-size: 0.75rem; font-weight: 600; line-height: 1.25rem; text-align: center; }
dialog.notice-modal { width: min(30rem, calc(100vw - 2rem)); border-top: 4px solid var(--blue); }
dialog.notice-modal.important { border-top-color: var(--rose); }
.notice-tag { margin: 0 0 0.35rem; font-size: 0.75rem; font-weight: 600; color: var(--blue); }
dialog.notice-modal.important .notice-tag { color: var(--rose); }
.notice-modal h2 { margin: 0 0 0.6rem; }
.notice-body { white-space: pre-line; line-height: 1.6; margin-bottom: 0.75rem; }
.notice-modal .actions { align-items: center; justify-content: space-between; }
dialog.bell-list { width: min(32rem, calc(100vw - 2rem)); padding: 1rem 1.25rem; }
.bell-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.bell-head h2 { margin: 0; }
.bell-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; }
.bell-items button { display: block; width: 100%; text-align: left; padding: 0.6rem 0.75rem; border: 0; border-radius: var(--r-control);
  background: transparent; color: inherit; font: inherit; cursor: pointer; }
.bell-items button:hover { background: color-mix(in srgb, var(--blue) 7%, var(--surface)); }
.bell-items .unread button { background: color-mix(in srgb, var(--blue) 10%, var(--surface)); }
.bell-items b { display: block; }
.bell-items .unread b::before { content: ""; display: inline-block; width: 0.45rem; height: 0.45rem; margin-right: 0.4rem; border-radius: 50%;
  background: var(--rose); vertical-align: middle; }
.bell-items .muted { font-size: 0.875rem; }

/* error pages */
.error-page .error-code { margin: 0; font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.error-page h1 { margin-top: 0.25rem; }

/* top right: name · language · bell · gear, one row of controls the same height */
.top-tools { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.top-tools > * { height: 2.375rem; }
.top-lang { align-items: stretch; }
.top-lang label { display: inline-flex; align-items: center; padding: 0 0.75rem; }
.top-icon { position: relative; display: inline-grid; place-items: center; width: 2.375rem; padding: 0; border: 1px solid var(--line);
  border-radius: var(--r-control); background: transparent; color: var(--ink); cursor: pointer; text-decoration: none;
  transition: background var(--t-fast); }
.top-icon:hover { background: color-mix(in srgb, var(--blue) 8%, var(--surface)); }
.top-icon[aria-current="page"] { border-color: var(--blue); color: var(--blue); }
.top-icon svg { width: 1.15rem; height: 1.15rem; }
@media (max-width: 52em) {
  .top-tools { gap: 0.35rem; }
  .top-tools > * { height: 2.25rem; }
  .top-lang label { padding: 0 0.55rem; }
  .top-icon { width: 2.25rem; }
}

/* Folded sections (details) open and close smoothly where the browser can animate to the content's
   height (Chrome / Edge / Android); elsewhere the content still rises in when it opens. */
@supports (interpolate-size: allow-keywords) {
  :root { interpolate-size: allow-keywords; }
  details::details-content { block-size: 0; overflow-y: clip;
    transition: block-size var(--t-med) var(--ease-out), content-visibility var(--t-med) allow-discrete; }
  details[open]::details-content { block-size: auto; }
  details[open] > :not(summary) { animation: none; }
}
@media (prefers-reduced-motion: reduce) { details::details-content { transition: none; } }

/* touch screens, after every other rule so nothing later pulls these back under 44px */
@media (pointer: coarse) {
  input[type=number], input[type=date], input[type=month], input[type=file], input[type=range], .mg-suffix select, .mg-suffix input,
  .jo-f input, .jo-f textarea, .price-grid input.cell, .price-grid .add-row .btn, .opt-in, .inv-opt .btn { min-height: 2.75rem; }
  .btn-sm, .top .segmented label { min-width: 2.75rem; justify-content: center; }
  .top .brand { min-height: 2.75rem; }
  details > summary, .danger-zone summary { padding-block: 0.7rem; }
  .pr-del-btn { width: 2.75rem; height: 2.75rem; }
  .show-sw .sw { min-height: 2.75rem; }
  .top-tools > * { height: 2.75rem; }
  .top-icon { width: 2.75rem; }
  .sg-pick select, .sg-pick input { min-height: 2.75rem; }
}

/* ===== colour modes (2026-11-16, Victor): light as the old system, Comfort back, the old dark sidebar =====
   The sidebar is a dark panel in every mode (navy in light, warm brown in Comfort, a step above the page in
   dark): color-scheme: dark inside it turns every colour token to its dark value, so text and icons read
   light on it. Its own background and the picked page are registered colours, worked out on <html>. */
@property --side-bg { syntax: "<color>"; inherits: true; initial-value: #16233D; }
@property --side-pick { syntax: "<color>"; inherits: true; initial-value: #1E4D8C; }
@property --side-ink { syntax: "<color>"; inherits: true; initial-value: #F5F8FD; }
@property --side-muted { syntax: "<color>"; inherits: true; initial-value: #B0BBD0; }
@supports (color: light-dark(white, black)) {
  :root { --side-bg: light-dark(#1B2638, #1A1F26); --side-pick: light-dark(#2A5FA8, #3B6FD0);
    --side-ink: light-dark(#F1F4F9, #F1F3F6); --side-muted: light-dark(#A7B1C2, #A9B1BD); }
}
.side { color-scheme: dark; background: var(--side-bg); border-right-color: transparent;
  scrollbar-color: rgb(255 255 255 / 0.18) transparent; }
.side .nav-cat + .nav-cat { border-top-color: rgb(255 255 255 / 0.08); }
.side .nav-cat a:hover, .side .nav-cat a:active { background: rgb(255 255 255 / 0.07); }
/* the page you are on: a light tint and a thin bar, like the top bar's underline (a solid blue block outshouted the page) */
.side .nav-cat a[aria-current="page"] { background: rgb(255 255 255 / 0.09); color: #FFFFFF; }
.side .nav-cat a[aria-current="page"] .ico { color: #FFFFFF; }
.side .nav-cat a[aria-current="page"]::before { left: 0; background: color-mix(in srgb, var(--side-pick) 55%, #FFFFFF); }
.side .nav-count { color: var(--on-rose); }


/* Comfort (2026-11-18): the brand's blue as the main colour, like the logo -- a softer light mode, not a
   different palette: a slightly warmer grey page, softer text, a little rounder. Green stays for "ready to sell". */
:root:has(meta[name="ui-theme"][content="comfort"]) {
  color-scheme: light;
  --paper-l: #F5F5F3; --surface-l: #FFFFFF; --ink-l: #232831; --muted-l: #4F555F; --line-l: #E2E3E6;
  --blue-l: #1E4D8C; --green-l: #1C8A5A; --amber-l: #A9762E; --violet-l: #6B5BD2; --rose-l: #B4434A;
  --on-blue-l: #FFFFFF; --on-rose-l: #FFFFFF;
  --side-bg: #1B2638; --side-pick: #2A5FA8; --side-ink: #F1F4F9; --side-muted: #A7B1C2;
  --r-panel: 10px; --r-control: 6px;
}

/* ===== price reply (2026-11-16): each line is a card; its prices are buttons, one per price type ===== */
.qr-layout { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); margin-top: 1rem; align-items: start; }
.qr-layout > .panel { margin: 0; }
@media (min-width: 75em) {
  .qr-layout { grid-template-columns: minmax(0, 1fr) minmax(20rem, 26rem); }
  .qr-reply { position: sticky; top: calc(4.5rem + var(--safe-t)); }
}
.qr-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 0.75rem; }
.qr-top h2 { margin: 0; }
.qr-all { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; }
.qr-items { display: grid; gap: 0.75rem; }
.qr-item { display: grid; gap: 0.5rem; padding: 0.85rem 1rem; border: 1px solid var(--line); border-radius: var(--r-control);
  background: var(--surface); border-left: 4px solid var(--green); }
.qr-item.is-open { border-left-color: var(--amber); background: color-mix(in srgb, var(--amber) 5%, var(--surface)); }
.qr-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.qr-name { font-size: 1rem; overflow-wrap: anywhere; }
.qr-qty { flex: none; font-weight: 600; font-size: 1rem; font-variant-numeric: tabular-nums; color: var(--blue); }
.qr-typed { margin-top: -0.3rem; overflow-wrap: anywhere; }
.qr-step { font-weight: 600; color: color-mix(in srgb, var(--amber) 60%, var(--ink)); }
.qr-conds, .qr-prices { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.qr-cond, .qr-price { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--r-control); min-height: 2.75rem; padding: 0.35rem 0.75rem; text-align: left;
  transition: background-color var(--t-fast), border-color var(--t-fast); }
.qr-cond { display: inline-flex; flex-direction: column; justify-content: center; font-size: 0.875rem; }
.qr-warn { font-size: 0.75rem; color: color-mix(in srgb, var(--amber) 60%, var(--ink)); }
.qr-price { display: inline-flex; flex-direction: column; justify-content: center; min-width: 6.5rem; }
.qr-price-name { font-size: 0.75rem; color: var(--muted); }
.qr-price-val { font-size: 1.125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.qr-cond:hover, .qr-price:hover { border-color: var(--blue); }
.qr-cond.is-on, .qr-price.is-on { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }
.qr-price.is-on .qr-price-name { color: inherit; opacity: 0.85; }
.qr-cond:focus-visible, .qr-price:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.qr-cond-one { margin-top: -0.2rem; }
.qr-problem { font-size: 0.875rem; font-weight: 600; color: color-mix(in srgb, var(--amber) 60%, var(--ink)); }
.qr-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.6rem; }
.qr-reply-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.qr-reply-head h2 { margin-bottom: 0.5rem; }
.qr-todo { font-weight: 600; color: color-mix(in srgb, var(--amber) 60%, var(--ink)); }
.qr-reply textarea { font-variant-numeric: tabular-nums; }
.qr-copy { width: 100%; margin-top: 0.6rem; justify-content: center; min-height: 2.75rem; }

/* ===== Invoice Dashboard (old layout, 2026-11-16): three tables ===== */
.iv-table .iv-no { font-weight: 600; }
.iv-table .iv-sys { white-space: nowrap; }
.iv-table tr.is-dim td { color: var(--muted); }
.iv-table tr.is-dim .iv-no { text-decoration: line-through; }
.iv-scroll { max-height: 30rem; overflow-y: auto; }
.iv-scroll thead th { position: sticky; top: 0; z-index: 1; }
@media (max-width: 40em) {   /* phone: each row a short card, no sideways scroll */
  .iv-table thead { display: none; }
  .iv-table, .iv-table tbody { display: block; }
  .iv-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.15rem 0.75rem; padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--line); }
  .iv-table td { display: block; padding: 0; border: 0; }
  .iv-table td.num { text-align: left; }
  .iv-table td[data-label]:not(.iv-sys):not(.iv-no)::before { content: attr(data-label) " "; color: var(--muted); font-size: 0.75rem; }
  .iv-table td.iv-no { grid-column: 2; grid-row: 1; text-align: right; }
  .iv-scroll { max-height: none; }
}

/* ===== users (old layout, 2026-11-16): search on top, boxes waiting / online / offline ===== */
.us-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(9rem, 14rem); gap: 0.6rem; }
.us-counts { margin: 0.6rem 0 0; }
.us-wait { color: color-mix(in srgb, var(--amber) 60%, var(--ink)); }
.us-box-h { display: flex; align-items: center; gap: 0.5rem; }
.us-n { font-size: 0.875rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.us-box-pending { border-top: 3px solid var(--amber); }
.presence { display: inline-block; flex: none; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--line); }
.presence.on { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); }
.us-user { display: flex; align-items: flex-start; gap: 0.6rem; }
.us-user .presence { margin-top: 0.45rem; }
.us-name { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.us-table td { vertical-align: top; }
.us-table select { min-width: 8rem; }
.us-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.us-actions form { margin: 0; }
.us-edit { width: min(30rem, calc(100vw - 2rem)); }
.us-edit-more { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; margin-top: 1rem; padding-top: 0.9rem;
  border-top: 1px dashed var(--line); }
.us-edit-more form { margin: 0; }
@media (max-width: 40em) {
  .us-filters { grid-template-columns: minmax(0, 1fr); }
  .us-table thead { display: none; }
  .us-table, .us-table tbody { display: block; }
  .us-table tr { display: grid; gap: 0.5rem; padding: 0.8rem 0.9rem; border-bottom: 1px solid var(--line); }
  .us-table tr[hidden] { display: none; }
  .us-table td { display: block; padding: 0; border: 0; }
  .us-table td.us-company:not(:empty)::before { content: attr(data-label) " "; color: var(--muted); font-size: 0.75rem; }
  .us-actions { justify-content: flex-end; }
}

/* ===== Stock Dashboard focus (2026-11-16): what to reorder first, the emptiest on top ===== */
.sd-alerts-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 0.75rem; }
.sd-alerts-head h2 { margin: 0 0 0.15rem; display: flex; align-items: center; gap: 0.5rem; }
.sd-alerts-head p { margin: 0; }
.sd-table tr.sd-zero td { background: color-mix(in srgb, var(--rose) 6%, transparent); }
.sd-table tr.sd-zero td:first-child { box-shadow: inset 3px 0 0 var(--rose); }
/* "short by" = optimum - balance - incoming: the number to order, the % beside it small */
.sd-short { white-space: nowrap; }
.sd-short b { font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--amber) 60%, var(--ink)); }
.sd-short .small { display: inline-block; min-width: 2.6rem; }
.sd-table tr.sd-zero .sd-short b, .sd-table tr[data-level="quarter"] .sd-short b { color: color-mix(in srgb, var(--rose) 65%, var(--ink)); }

/* ===== product search: metres wanted (2026-11-16) — a suggestion, nothing is hidden ===== */
.sr-need { display: flex; align-items: center; gap: 0.4rem; border: 1px solid var(--line-control); border-radius: var(--r-control);
  padding: 0 0.6rem; background: var(--surface); }
.sr-need:focus-within { border-color: var(--blue); outline: 2px solid color-mix(in srgb, var(--blue) 30%, transparent); }
.sr-need input { border: 0; padding-inline: 0; min-width: 0; text-align: right; font-variant-numeric: tabular-nums; background: transparent; }
.sr-need input:focus-visible { outline: none; }
.sr-need-l, .sr-need-u { font-size: 0.875rem; color: var(--muted); white-space: nowrap; }
.lot.fit { background: color-mix(in srgb, var(--green) 7%, transparent); box-shadow: inset 3px 0 0 color-mix(in srgb, var(--green) 55%, transparent); }
.lot.fit-best { background: color-mix(in srgb, var(--green) 14%, transparent); box-shadow: inset 4px 0 0 var(--green); }
.lot-fit { font-size: 0.75rem; font-weight: 600; padding: 0.05rem 0.5rem; border-radius: var(--r-pill); white-space: nowrap;
  background: color-mix(in srgb, var(--green) 18%, transparent); color: color-mix(in srgb, var(--green) 55%, var(--ink)); }
.sr-card.no-fit { opacity: 0.55; }
.sr-card.no-fit:hover, .sr-card.no-fit:focus-within { opacity: 1; }

/* ===== numbers line up in columns everywhere (tabular figures) ===== */
body { font-variant-numeric: tabular-nums; }
@media (max-width: 40em) {   /* phone: each item to reorder is a card -- name, the figures, the bar */
  .sd-table thead { display: none; }
  .sd-table, .sd-table tbody { display: block; }
  .sd-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.3rem 0.6rem; padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--line); }
  .sd-table tr[hidden] { display: none; }
  .sd-table td { display: block; padding: 0; border: 0; background: none !important; box-shadow: none !important; }
  .sd-table td:nth-child(-n+3) { font-weight: 600; }
  .sd-table td.num { text-align: left; }
  .sd-table td[data-label]::before { content: attr(data-label); display: block; font-size: 0.75rem; color: var(--muted); font-weight: 400; }
  .sd-table td:last-child:has(button) { grid-column: 1 / -1; text-align: right; }
  .sd-table tr.sd-zero { background: color-mix(in srgb, var(--rose) 6%, transparent); box-shadow: inset 3px 0 0 var(--rose); }
  .sd-table .opt-in { width: 100%; }
}

/* ===== System Dashboard (admin, 2026-11-16) ===== */
.sysd { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
.sysd > .panel { margin: 0; }
.sysd p > .badge { white-space: normal; border-radius: var(--r-control); }   /* a long notice wraps on a phone */
.sysd-tiles { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
.sysd-tile { display: grid; gap: 0.15rem; align-content: start; padding: 0.9rem 1rem; border-radius: var(--r-panel);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none;
  transition: border-color var(--t-fast); }
.sysd-tile:hover { background: color-mix(in srgb, var(--blue) 5%, var(--surface)); }
.sysd-tile:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sysd-label { font-size: 0.875rem; color: var(--muted); font-weight: 600; }
.sysd-num { font-size: 1.75rem; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.sysd-num small { font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.sysd-sub { font-size: 0.875rem; color: var(--muted); }
.sysd-tiles-sm .sysd-num { font-size: 1.25rem; }
.sysd-tile.is-warn .sysd-num { color: color-mix(in srgb, var(--amber) 65%, var(--ink)); }
.sysd-tile.is-bad .sysd-num { color: color-mix(in srgb, var(--rose) 70%, var(--ink)); }
.sysd-tile.is-time .sysd-num { font-size: 1.25rem; padding-block: 0.2rem; }
.sysd-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; margin-bottom: 0.6rem; }
.sysd-head h2 { margin: 0; }
.sysd-inv-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
.sysd-inv { display: grid; gap: 0.25rem; padding: 0.8rem 0.9rem; border: 1px solid var(--line); border-radius: var(--r-control); }
.sysd-inv-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.sysd-inv-no { font-size: 1.25rem; font-weight: 600; }
.sysd-inv-today { font-size: 0.875rem; }
.sysd-cols { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); }
.sysd-cols > .panel { margin: 0; }
.sysd-src { margin: 0 0 0.6rem; }
.sysd-dl { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: 0.45rem 1rem; margin: 0 0 0.75rem; font-size: 0.875rem; }
.sysd-dl dt { color: var(--muted); }
.sysd-dl dd { margin: 0; }
.sysd-err { color: color-mix(in srgb, var(--rose) 75%, var(--ink)); }
.sysd-file { overflow-wrap: anywhere; max-width: 22rem; }
.sysd-roles { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
.sysd-role { display: grid; gap: 0.35rem; padding: 0.7rem 0.85rem; border: 1px solid var(--line); border-radius: var(--r-control); }
.sysd-role-top { display: flex; justify-content: space-between; gap: 0.5rem; }
.sysd-on { color: color-mix(in srgb, var(--green) 75%, var(--ink)); }
.sysd-role .meter > i { background: var(--green); }
@media (max-width: 40em) {
  .sysd-dl { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
  .sysd-dl dd { margin-bottom: 0.5rem; }
  .sysd-table thead { display: none; }
  .sysd-table, .sysd-table tbody { display: block; }
  .sysd-table tr { display: grid; gap: 0.2rem; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); }
  .sysd-table td { display: block; padding: 0; border: 0; text-align: left; }
  .sysd-table td:not(:first-child)::before { content: attr(data-label) " "; color: var(--muted); font-size: 0.75rem; }
}

/* ===== text settings (2026-11-16): bold letters and strong contrast, for people who like it thick and dark ===== */
body.text-bold { font-weight: 500; }
body.text-bold :where(b, strong, h1, h2, h3, h4, th, .btn, .badge, .label, dt, .segmented label:has(input:checked)) { font-weight: 700; }
body.text-bold :where(.small, .muted, .hint, small) { font-weight: 500; }
body.text-strong {
  --ink: light-dark(#05080F, #FFFFFF);
  --muted: color-mix(in srgb, light-dark(var(--muted-l), var(--muted-d)) 35%, light-dark(#05080F, #FFFFFF));
  --line: color-mix(in srgb, light-dark(var(--line-l), var(--line-d)) 70%, light-dark(#05080F, #FFFFFF));
}
body.text-strong .side { --side-muted: color-mix(in srgb, var(--side-ink) 80%, var(--side-bg)); }
body.text-strong .side .nav-cat a { color: #FFFFFF; }
body.text-strong .table th { color: var(--ink); }
body.text-strong input::placeholder, body.text-strong textarea::placeholder { color: color-mix(in srgb, var(--muted) 85%, transparent); }
.font-preview { margin: 0 0 1rem; padding: 0.7rem 0.9rem; border: 1px dashed var(--line); border-radius: var(--r-control); background: var(--paper); }

/* ===== light and Comfort tuned (2026-11-16): calmer, like the old system — white cards that lift a little off a
   plain page, one brand colour for lines and title bars, no rainbow; dark keeps its own look ===== */
.panel { box-shadow: none; }
/* the line under the top bar: plain grey in light, a quiet blue-grey in dark (no rainbow) */
.top::after { background: light-dark(var(--line), color-mix(in srgb, var(--blue) 35%, var(--line))); height: 1px; }
.table th { background: light-dark(#EEF1F6, color-mix(in srgb, var(--blue) 7%, var(--surface))); color: light-dark(#4A5468, color-mix(in srgb, var(--blue) 40%, var(--muted))); }

/* ===== sidebar text (2026-11-16): one text colour per mode, as on the old system — light text on the panel,
   group names a soft grey of the same tone, icons in the text colour (a little dimmer), the group colour kept
   only as the small dot. Navy in light, warm cream on brown in Comfort, cool grey in dark. ===== */
.side { --ink: var(--side-ink); --muted: var(--side-muted); color: var(--side-ink); }
.side .nav-cat a { color: var(--side-ink); font-weight: 400; }
.side .nav-cat > h3, .side .nav-cat > summary > h3 { color: var(--side-muted); }
.side .nav-cat .ico { color: var(--side-ink); opacity: 0.88; transition: opacity var(--t-fast); }
.side .nav-cat a:hover .ico { color: var(--side-ink); opacity: 1; }
.side .nav-cat a[aria-current="page"] .ico { opacity: 1; }
.side .nav-cat > h3::before, .side .nav-cat > summary > h3::before { opacity: 1; }
/* Each menu group's colour (the dot) follows the colour mode. Inside the sidebar every token is its dark
   value (color-scheme: dark), so the group colours are registered colours worked out on <html>, one set
   per mode: the old system's colours lifted for the navy panel, the dark set, and warm ones on Comfort brown. */
@property --cat-blue { syntax: "<color>"; inherits: true; initial-value: #4A8FE0; }
@property --cat-green { syntax: "<color>"; inherits: true; initial-value: #2FB37A; }
@property --cat-amber { syntax: "<color>"; inherits: true; initial-value: #DDA829; }
@property --cat-violet { syntax: "<color>"; inherits: true; initial-value: #8C7CF0; }
@property --cat-rose { syntax: "<color>"; inherits: true; initial-value: #E8606F; }
@property --cat-slate { syntax: "<color>"; inherits: true; initial-value: #8F9BB3; }
@supports (color: light-dark(white, black)) {
  :root { --cat-blue: light-dark(#4A8FE0, #6EA6E8); --cat-green: light-dark(#2FB37A, #5CC4A6);
    --cat-amber: light-dark(#DDA829, #E8BC5E); --cat-violet: light-dark(#8C7CF0, #A397EE);
    --cat-rose: light-dark(#E8606F, #EE7A8C); --cat-slate: light-dark(#8F9BB3, #9AA6B2); }
}
.side .stripe-blue { --stripe: var(--cat-blue); } .side .stripe-green { --stripe: var(--cat-green); }
.side .stripe-amber { --stripe: var(--cat-amber); } .side .stripe-violet { --stripe: var(--cat-violet); }
.side .stripe-rose { --stripe: var(--cat-rose); } .side .stripe-slate { --stripe: var(--cat-slate); }

/* ===== the floating cart (Sales, no mini tabs; 2026-11-16): bottom-right on every page, above the phone bar ===== */
.cart-bubble {
  position: fixed; z-index: 9; right: calc(1.25rem + var(--safe-r)); bottom: calc(1.25rem + var(--safe-b));
  display: grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: 50%;
  background: var(--blue); color: var(--on-blue); text-decoration: none; box-shadow: var(--shadow-float);
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast);
}
.cart-bubble .ico { width: 1.5rem; height: 1.5rem; translate: -1px 1px; }   /* the cart's handle pulls it right and up: centred by eye */
.cart-bubble:active { transform: scale(0.94); }
.cart-bubble:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 45%, transparent); outline-offset: 3px; }
.cart-bubble-n {
  position: absolute; top: -0.2rem; right: -0.2rem; min-width: 1.4rem; height: 1.4rem; padding: 0 0.35rem;
  display: grid; place-items: center; border-radius: var(--r-pill); border: 2px solid var(--paper);
  background: var(--rose); color: var(--on-rose); font-size: 0.75rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums;
}
@media (max-width: 52em) { .cart-bubble { bottom: calc(var(--bar-h) + 0.9rem + var(--safe-b)); right: calc(0.9rem + var(--safe-r)); } }
/* the page ends above the bubble, so the last button is never under it */
body:has(.cart-bubble) .main { padding-bottom: 6rem; }
/* toasts on a phone sit a little higher so they never cover the bubble */
@media (max-width: 52em) { body:has(.cart-bubble) .toasts { width: min(26rem, calc(100vw - 6.5rem)); left: calc(50% - 2rem); } }

/* ===== System Dashboard cards (2026-11-16): even rows at every width, no card left alone on a row ===== */
.sysd { container-type: inline-size; }
.sysd-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sysd-tiles-sm { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.sysd-tile { min-height: 7.25rem; }
.sysd-tiles-sm .sysd-tile { min-height: 6.5rem; }
@container (max-width: 64rem) { .sysd-tiles-sm { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container (max-width: 40rem) { .sysd-tiles, .sysd-tiles-sm { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 22rem) { .sysd-tiles, .sysd-tiles-sm { grid-template-columns: minmax(0, 1fr); } }

/* ===== moving between pages: the top bar, menu and phone bar stay put and the page content cross-fades
   quickly. Review 10: no sliding menu highlight, moving title or rise -- a work tool changes page plainly.
   Browsers without cross-page view transitions just change page as before. ===== */
@view-transition { navigation: auto; }
.top { view-transition-name: cs-top; }
.side { view-transition-name: cs-side; }
.bottom-bar { view-transition-name: cs-bar; }
.cart-bubble { view-transition-name: cs-cart; }
::view-transition-group(*) { animation-duration: 0s; }
::view-transition-old(root) { animation: 90ms ease-out both cs-fade-out; }
::view-transition-new(root) { animation: 120ms ease-out both cs-fade-in; }
@keyframes cs-fade-out { to { opacity: 0; } }
@keyframes cs-fade-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}


/* line height for Thai: the vowel and tone marks above and below need room once a line wraps */
h1 { line-height: 1.38; }
h2, h3 { line-height: 1.45; }
.nav-cat a { line-height: 1.4; }
.mg-name, .jo-cus, .mg-ac-item { line-height: 1.45; }
.price-grid th, .qd-mode-full .qd-table th { line-height: 1.35; }
.sg-foot > .btn, .sg-foot > .btn-primary { line-height: 1.3; }

/* touch screens: the last small targets found on the phone check (2026-11-16) -- each at least 44px */
@media (pointer: coarse) {
  .sr-open { display: inline-flex; align-items: center; min-height: 2.75rem; }
  .lot-more summary { display: flex; align-items: center; min-height: 2.75rem; width: auto; }
  .inv-mine .btn { min-height: 2.75rem; }
  .jo-no { display: inline-flex; align-items: center; min-height: 2.75rem; }
  .sysd-head > a, .bento > .panel > a.small { display: inline-flex; align-items: center; min-height: 2.75rem; }
  td > label.check { min-width: 2.75rem; justify-content: center; }
}

/* easy to reach: on a phone the Save of a long settings form stays at the bottom of the screen */
@media (max-width: 52em) {
  form.form-narrow:not(.panel) > .form-foot:last-child, form.bento > .form-foot.wide:last-child {
    position: sticky; z-index: 3; bottom: calc(var(--bar-h) + 0.5rem + var(--safe-b));
    padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: var(--r-panel);
    background: var(--surface); box-shadow: var(--shadow-float);
  }
}

/* ===== plainer still (2026-11-18): System Dashboard numbers on one sheet with hairline dividers,
   not a pile of separate cards ===== */
.sysd-tiles { gap: 0; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); overflow: hidden; }
.sysd-tiles .sysd-tile { border: 0; border-radius: 0; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }

/* ===== flatter (2026-11-18, review): fewer boxes inside boxes, one main button per lot, fixed places ===== */
/* product search: the search area is part of the page, not a card; result cards one plain level */
.search-box.panel { background: var(--paper); border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  padding: 0.25rem 0 1rem; box-shadow: none; }
.sr-card { border-left-width: 1px; }
/* a lot: name and colour | the metres, always in the same place | one button */
.sr-open.lot-name { font-size: 0.875rem; font-weight: 600; color: var(--blue); overflow-wrap: anywhere; }
@media (min-width: 40.01em) {
  .lot-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(12rem, 16rem); column-gap: 1.25rem; align-items: baseline; }
  .lot-l2 { margin-top: 0; }
  .lot-main > .lot-note, .lot-main > .lot-more { grid-column: 1 / -1; }
  .lot { align-items: center; }
}
/* Invoice with no number set: one message and the next step */
.inv-run:has(> .inv-list[hidden]) { grid-template-columns: minmax(0, 1fr); }
.inv-unset { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; }
.inv-unset p { margin: 0; }
.sysd-inv-idle { margin: 0.75rem 0 0; }
.sysd-inv-idle a { margin-left: 0.5rem; }

/* ===== sidebar (2026-11-18): menu groups fold; only the group in use starts open (others as the person
   left them, kept in this browser); system-admin groups under their own line ===== */
details.nav-cat > summary { list-style: none; cursor: pointer; border-radius: var(--r-control); }
details.nav-cat > summary::-webkit-details-marker { display: none; }
details.nav-cat > summary::before { content: none; }
details.nav-cat > summary > h3 { margin: 0; padding-block: 0.35rem; }
details.nav-cat > summary > h3::after { content: ""; margin-left: auto; width: 0.4rem; height: 0.4rem; border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform var(--t-fast); opacity: 0.7; }
details.nav-cat[open] > summary > h3::after { transform: rotate(45deg); }
details.nav-cat > summary:hover { background: rgb(255 255 255 / 0.05); }
details.nav-cat > summary:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.side details.nav-cat:not([open]) { margin-bottom: 0.25rem; }
.nav-section { margin: 1rem 0.65rem 0.4rem; padding-top: 0.75rem; border-top: 1px solid rgb(255 255 255 / 0.14);
  font-size: 0.75rem; font-weight: 600; color: var(--side-muted); }

/* ===== product search (2026-11-18, review 2) ===== */
/* what the search covers, next to the box */
.sr-scope { margin: 0.6rem 0 0; color: var(--muted); }
.sr-scope { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 1rem; }
.sr-scope a { white-space: nowrap; }
/* nothing found: what was searched and the ways on */
.sr-empty { text-align: left; padding: 2rem 0 3rem; margin: 0; }
.sr-empty-what { font-size: 1rem; font-weight: 600; margin: 0 0 0.3rem; overflow-wrap: anywhere; }
.sr-empty .actions { margin-top: 0.9rem; }
/* a colour with one lot: no head row of its own */
.lot-solo { border-top: 1px solid var(--line); }
.lot-group + .lot-solo, .lot-solo + .lot-group { border-top: 1px solid var(--line); }
/* a lot's note can change the sale ("ขายตัวนี้ก่อน", "ไม่แบ่งขาย"): readable, not grey small print */
.lot-note { color: color-mix(in srgb, var(--amber) 55%, var(--ink)); font-weight: 600; }

/* bookings (2026-11-18): metres, customer, PO / note and expiry each in a column */
.bk-qty { font-weight: 600; font-variant-numeric: tabular-nums; }
.bk-cus { font-weight: 600; }
.bk-note { overflow-wrap: break-word; min-width: 9rem; max-width: 18rem; }
@media (max-width: 40em) {
  .bk-table td.bk-qty, .bk-table td.bk-cus { text-align: left; }
  .bk-table td.bk-note { grid-column: 1 / -1; max-width: none; }
  .bk-table td[data-label]::before { content: attr(data-label); display: block; font-size: 0.75rem; color: var(--muted); font-weight: 400; }
}

/* Stock Dashboard (2026-11-18): one scroll for the page, the table head stays at the top while scrolling */
@media (min-width: 64em) {
  .sd-wrap { overflow: visible; }
  .sd-table thead th { position: sticky; top: calc(var(--top-h, 3.6rem) + var(--safe-t)); z-index: 2; }
}

/* empty pages (2026-11-18): what is missing and the next step, side by side */
.empty-next { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem;
  margin-top: 1rem; padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); }
.empty-next p { margin: 0; }
.iv-steps { margin: 0.25rem 0 1rem; padding-left: 1.25rem; display: grid; gap: 0.3rem; }

/* ===== review 3 (2026-11-18) ===== */
/* a count inside a filter: a small badge a little apart from the word */
.seg-n { display: inline-block; margin-left: 0.35rem; padding: 0 0.4rem; min-width: 1.4rem; border-radius: var(--r-control); text-align: center;
  font-size: 0.75rem; font-weight: 600; line-height: 1.5; font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.segmented label:has(input:checked) .seg-n { background: color-mix(in srgb, var(--blue) 18%, transparent); }
/* codes stay on one line, with a copy button */
.code-line { display: inline-flex; align-items: center; gap: 0.25rem; }
.copy-btn { all: unset; cursor: pointer; padding: 0.1rem 0.3rem; border-radius: var(--r-control); color: var(--muted); font-size: 0.875rem; line-height: 1; }
.copy-btn:hover { color: var(--blue); background: color-mix(in srgb, var(--blue) 8%, transparent); }
.copy-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.bk-code { min-width: 13rem; }
.bk-exp { font-variant-numeric: tabular-nums; }
/* Stock: rows that can't be edited carry a small mark; the reason is in the note above the table */
.sd-lock { all: unset; cursor: help; margin-left: 0.3rem; color: var(--muted); font-size: 0.875rem; }
.sd-lock:hover, .sd-lock:focus-visible { color: var(--blue); }
.sd-lock:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 50%; }
.sd-table td:nth-child(2) { min-width: 8rem; }
/* metres wanted: a visible name, and one line on what it does while it is in use */
.sr-need-l { white-space: nowrap; }
/* review 12: the hint is for screen readers only -- shown on focus it pushed the filters down (the page jumped);
   the label "จำนวนที่ต้องการ … ม." already says it */
.sr-need-help { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }
@media (pointer: coarse) { .copy-btn, .sd-lock { min-width: 2.75rem; min-height: 2.75rem; display: inline-grid; place-items: center; } }

/* ===== review 4 (2026-11-18) ===== */
/* the menu: one colour for every group (colour is kept for status); no coloured dots */
.nav-cat > h3::before, .nav-cat > summary > h3::before { display: none; }
/* weight: the ready metres stand out, codes read easily, the rest lighter */
.side .nav-cat a { font-weight: 400; }
.side .nav-cat a[aria-current="page"] { font-weight: 600; }
.sr-open.lot-name { font-weight: 400; }
.lot-note { font-weight: 400; }
/* a lot row: code | colour | brand | ready -- the same columns on every row, to compare down the list */
.lot-group-head { display: none; }
@media (min-width: 64em) {
  .lot-main { grid-template-columns: 16rem 5.5rem minmax(5rem, 8rem) auto; column-gap: 1.25rem; }
  .lot-main > .lot-l2 { white-space: nowrap; flex-wrap: nowrap; }
  .lot-main > .lot-l1 { display: contents; }
  .lot-main > .lot-l1 > .lot-name { grid-column: 1; }
  .lot-main > .lot-l1 > .lot-color { grid-column: 2; }
  .lot-main > .lot-l1 > .lot-brand { grid-column: 3; }
  .lot-main > .lot-l2 { grid-column: 4; }
}
.lot-brand { font-size: 0.875rem; color: var(--muted); overflow-wrap: anywhere; }
/* colour and brand never run together ("VioletCS DELTA" at mid widths); the table layout lays them out as cells */
.lot-cb { display: inline-flex; flex-wrap: wrap; column-gap: 0.75rem; }
/* cart: a short metres box with its unit; ready next to it; the main job first, tools after, emptying apart */
.cart-qty-box { display: inline-flex; align-items: center; gap: 0.35rem; justify-content: flex-end; }
.cart-table .cart-qty { width: 6.5rem; }
.cart-qty-box .unit { color: var(--muted); }
.cart-ready { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cart-ready b { font-size: 1rem; color: color-mix(in srgb, var(--green) 60%, var(--ink)); }
.cart-ready.is-short b, .cart-ready.is-short .small { color: color-mix(in srgb, var(--rose) 70%, var(--ink)); }
.cart-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin-top: 1rem; }
.cart-main { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.cart-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.cart-clear { margin-left: auto; }
/* price reply: the steps, the one in progress marked */
.qr-steps { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 0.35rem 0 0; padding: 0; list-style: none; counter-reset: qs;
  font-size: 0.875rem; color: var(--muted); }
.qr-steps li { counter-increment: qs; display: flex; align-items: center; gap: 0.4rem; }
.qr-steps li::before { content: counter(qs); display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%;
  border: 1px solid var(--line-control); font-size: 0.75rem; font-weight: 600; }
.qr-steps li.is-now { color: var(--ink); font-weight: 600; }
.qr-steps li.is-now::before { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }
/* lot codes stay on one line (on a phone they may wrap rather than run off the screen) */
.sr-open.lot-name { white-space: nowrap; overflow-wrap: normal; }
@media (max-width: 40em) { .sr-open.lot-name { white-space: normal; overflow-wrap: anywhere; } }

/* ===== dark mode (2026-11-18, review 5) ===== */
/* the logo is navy and blue: on a dark top bar the light-on-dark version (logo-cablesource-dark.png) shows
   instead -- no white plate (review 12) */
.top .brand .logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not(:has(meta[name="ui-theme"][content="light"])):not(:has(meta[name="ui-theme"][content="comfort"])) .top .brand {
    .logo-light { display: none; } .logo-dark { display: block; } }
}
:root:has(meta[name="ui-theme"][content="dark"]) .top .brand { .logo-light { display: none; } .logo-dark { display: block; } }
/* boxes you can type in: a level of their own (lighter than the card), with a clear edge */
input[type=text], input[type=password], input[type=search], input[type=date], input[type=month], input[type=number], select, textarea {
  background: light-dark(var(--surface), #252E39); border-color: light-dark(var(--line-control), #4A5868); }
input::placeholder, textarea::placeholder { color: light-dark(#6B7385, #8E99A6); }
/* the metres box is the label around a bare input: the whole box takes the input colour */
.sr-need { background: light-dark(var(--surface), #252E39); border-color: light-dark(var(--line-control), #4A5868); }
.sr-need input[type=text] { background: transparent; border: 0; }

/* ===== review 6 (2026-11-18) ===== */
/* the lot code says it opens the prices */
.lot-id { display: grid; gap: 0.1rem; min-width: 0; }
.sr-open.lot-name { display: inline-flex; align-items: baseline; gap: 0.45rem; }
.lot-po { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
/* incoming: made-by / due-in date in a slot of its own; late in red, otherwise plain */
.lot-when { font-size: 0.875rem; display: flex; flex-wrap: wrap; gap: 0 0.35rem; align-items: baseline; }
.lot-when-what { color: var(--muted); }
.lot-when b { font-variant-numeric: tabular-nums; font-weight: 600; }
.lot-when-st { color: var(--muted); }
.lot-when-st.is-late { color: color-mix(in srgb, var(--rose) 70%, var(--ink)); font-weight: 600; }
/* notes: plain unless they change the sale (a rule = amber, "sell first" = green) */
.lot-note { color: var(--ink); font-weight: 400; }
.lot-note.lot-rule { color: color-mix(in srgb, var(--amber) 60%, var(--ink)); font-weight: 600; }
/* the rows follow the space the results have (the side panel can make it narrow): columns only when they fit */
.sr { container: sr / inline-size; }
@media (min-width: 64em) {
  .lot-main { grid-template-columns: minmax(0, 1fr) minmax(12rem, 16rem); }
  .lot-main > .lot-l1 { display: flex; flex-wrap: wrap; gap: 0.1rem 0.75rem; }
}
@container sr (min-width: 50rem) {
  .lot-main { grid-template-columns: 19rem 5.5rem minmax(5rem, 8rem) auto; column-gap: 1.25rem; }
  .lot-main > .lot-l1 { display: contents; }
  .lot-main > .lot-l1 > .lot-id { grid-column: 1; }
  .lot-main > .lot-l1 > .lot-color { grid-column: 2; }
  .lot-main > .lot-l1 > .lot-brand { grid-column: 3; }
  .lot-main > .lot-l2 { grid-column: 4; white-space: nowrap; flex-wrap: nowrap; }
  .lot-in-wait .lot-main { grid-template-columns: 19rem 5.5rem minmax(5rem, 8rem) minmax(9rem, 12rem) auto; }
  .lot-in-wait .lot-main > .lot-when { grid-column: 4; }
  .lot-in-wait .lot-main > .lot-l2 { grid-column: 5; }
}
@container sr (max-width: 49.99rem) {
  .lot { grid-template-columns: minmax(0, 1fr); }
  .lot-main { display: grid; grid-template-columns: minmax(0, 1fr); }
  .lot-main > .lot-l1 { display: flex; flex-wrap: wrap; gap: 0.1rem 0.75rem; align-items: baseline; }
  .lot-main > .lot-l2 { white-space: normal; }
  .lot-act { justify-content: flex-start; }
}
/* price panel: as tall as what it holds (it was the full screen height even with one line in it) */
@media (min-width: 40.01em) {
  dialog.confirm.pd { height: auto; max-height: calc(100dvh - 2rem); margin: 1rem 1rem auto auto; border-radius: var(--r-panel); border-width: 1px; }
}
/* narrow results: every part of a lot in one column (overrides the wide-screen column numbers) */
@container sr (max-width: 49.99rem) { .lot-main > .lot-l2, .lot-main > .lot-when, .lot-main > .lot-l1 > * { grid-column: auto; } }

/* ===== review 7 (2026-11-18): metres wanted ===== */
/* a lot that doesn't hold enough says by how much */
.lot-short { color: color-mix(in srgb, var(--rose) 70%, var(--ink)); font-weight: 600; white-space: nowrap; }
/* the switch to see only the lots that hold enough */
.only-fit-sw { display: inline-flex; align-items: center; gap: 0.3rem; margin-left: 0.5rem; color: var(--ink); cursor: pointer; white-space: nowrap; }
.sr.only-fit .lot:not(.fit), .sr.only-fit .sr-card:not(:has(.lot.fit)) { display: none; }
/* the add-to-cart button stays at the top of its row when the details open */
.lot { align-items: start !important; }
.lot-act { align-self: start; }
/* "sell first": a short tag, the date small */
.lot-first-tag { display: inline-block; padding: 0 0.4rem; border-radius: var(--r-control); font-size: 0.75rem; font-weight: 600;
  color: color-mix(in srgb, var(--green) 65%, var(--ink)); background: color-mix(in srgb, var(--green) 14%, transparent); }
.lot-first-line { font-weight: 400; color: var(--ink); }
/* the ready column may take a second line (booked, short by) instead of running under the button */
@container sr (min-width: 50rem) { .lot-main > .lot-l2 { flex-wrap: wrap; white-space: normal; flex-direction: column; align-items: flex-start; gap: 0.1rem; } }

/* ===== check round (2026-11-18) ===== */
/* catalog: the quote-name box, small on a computer, 44px on a touch screen (rule at the end of the file) */
.qn-box { max-width: 20rem; min-height: 2rem; padding: 0.2rem 0.5rem; }
/* System Dashboard: an Invoice card keeps a card's width, even when it is the only one */
.sysd-inv-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
/* side panel: clear of the home indicator */
.dock { padding-bottom: calc(0.75rem + var(--safe-b)); }
/* easy to reach: on a phone the main button of a page's form, and the cart's buttons, stay at the bottom of the screen */
@media (max-width: 52em) {
  main form > .form-foot:last-child:has(.btn-primary), .cart-foot {
    position: sticky; z-index: 3; bottom: calc(var(--bar-h) + 0.5rem + var(--safe-b));
    padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); box-shadow: var(--shadow-float);
  }
  .cart-foot { gap: 0.4rem 1rem; }
  .cart-main { flex-wrap: nowrap; width: 100%; }
  .cart-main .btn { flex: 1 1 0; justify-content: center; white-space: normal; line-height: 1.3; }
  .cart-main .note:empty { display: none; }
}
/* touch screens: the last small targets found in this check */
@media (pointer: coarse) {
  .qn-box { min-height: 2.75rem; }
  .flash a, .sr-scope a, .sysd-inv-idle a, .timeline li > a { display: inline-flex; align-items: center; min-height: 2.75rem; }
}
/* cart on a phone: the name across, then ready | wanted side by side with their names, remove at the end */
@media (max-width: 40em) {
  .cart-table tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cart-table td:first-child { grid-column: 1 / -1; font-weight: 600; }
  .cart-table td.cart-ready { text-align: left; }
  .cart-table td[data-label]::before { content: attr(data-label); display: block; font-size: 0.75rem; color: var(--muted); font-weight: 400; text-align: inherit; }
  .cart-table td:nth-child(3) { text-align: right; }
  .cart-table td:last-child { grid-column: 1 / -1; text-align: right; }
}
@media (max-width: 40em) {
  .cart-table tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; grid-template-areas: "name name rm" "ready want want";
    gap: 0.15rem 0.75rem; padding: 0.55rem 0.4rem 0.6rem 0.9rem; align-items: start; }
  .cart-table td:first-child { grid-area: name; align-self: center; }
  .cart-table td.cart-ready { grid-area: ready; align-self: end; }
  .cart-table td:nth-child(3) { grid-area: want; }
  .cart-table td:last-child { grid-area: rm; }
  .cart-table td:last-child .btn { min-height: 2.25rem; padding-inline: 0.5rem; color: var(--muted); }
}
@media (max-width: 40em) and (pointer: coarse) { .cart-table td:last-child .btn { min-height: 2.75rem; margin-block: -0.35rem; } }
@media (max-width: 52em) { .cart-tools .btn-sm, .cart-clear .btn-sm { min-height: 2.75rem; } .cart-tools > .small { display: none; } }
/* results narrowed by the side panel (computer / iPad): the add-to-cart button stays on the right of its lot, at the top
   (a phone keeps the full-width button under the lot) */
@container sr (min-width: 26rem) and (max-width: 49.99rem) {
  .lot { grid-template-columns: minmax(0, 1fr) auto; }
  .lot-act { justify-content: flex-end; align-self: start; }
  .lot-act .btn { flex: none; }
}
/* a phone-wide results area: the button full width under the lot, easy for a thumb */
@container sr (max-width: 25.99rem) {
  .lot { grid-template-columns: minmax(0, 1fr); }
  .lot-act { width: 100%; }
  .lot-act .btn { flex: 1 1 auto; }
}
/* the side panel only where there is room for it beside the results (1024px and up); smaller screens use the menu */
@media (max-width: 63.99em) {
  .dock, .dock-launch { display: none !important; }
  .frame:has(.dock .minitab:not(.folded)) { padding-right: 0; }
}
/* bookings on a phone: status on the left, expiry date on the right, like booked / customer above them */
@media (max-width: 40em) {
  .bk-table td.nowrap:not(.bk-qty):not(.bk-exp) { text-align: left; }
  .bk-table td.bk-exp { text-align: right; }
  .bk-table td.bk-qty { text-align: left; }
}

/* ===== review 8 (2026-11-18): computer = compare many lots; phone = search fast, one lot at a time ===== */
/* -- search area: one bar -- */
.sr-bar { display: grid; gap: 0.5rem; grid-template-columns: minmax(10rem, 2fr) minmax(7.5rem, 11rem) repeat(3, minmax(6rem, 1fr)) auto; align-items: stretch; }
.sr-filters, .sr-filters > .sr-pick, .sr-pick > label { display: contents; }
.sr-filter-btn, .sr-sheet-head, .sr-sheet-done { display: none; }
.search-box .sr-status { margin-top: 0.6rem; }
.search-box .sr-pick select { width: 100%; }
@media (max-width: 64em) and (min-width: 40.01em) {
  .sr-bar { grid-template-columns: minmax(0, 2fr) minmax(9rem, 1fr); }
  .sr-filters > .sr-pick { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 0.5rem; }
}
/* -- phone: search + "ตัวกรอง"; the filters open from the bottom; status tabs in one row that slides -- */
@media (max-width: 40em) {
  .sr-bar { grid-template-columns: minmax(0, 1fr) auto; }
  .sr-filter-btn { display: inline-flex; align-items: center; gap: 0.3rem; min-height: 2.75rem; }
  .sr-filters { display: none; }
  .search-box.filters-open .sr-filters { display: grid; gap: 0.6rem; }   /* the sheet look: "bottom sheet" below */
  .search-box.filters-open .sr-filters > .sr-pick { display: grid; gap: 0.6rem; grid-template-columns: minmax(0, 1fr); }
  .search-box.filters-open .sr-sheet-done { display: flex; justify-content: center; min-height: 3rem; }
  .search-box .sr-status .segmented { display: flex !important; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; flex: 1 1 100%; }
  .search-box .sr-status .segmented label { flex: none; border-top: 0 !important; border-left: 1px solid var(--line) !important; min-height: 2.75rem;
    display: flex; align-items: center; padding-inline: 0.9rem; }
  .search-box .sr-status .segmented label:first-child { border-left: 0 !important; }
}
.sr-sheet-backdrop[hidden] { display: none; }

/* -- lots: one grid per row; the column names over them where they sit in columns -- */
.lot-thead { display: none; }
@container sr (min-width: 50rem) {
  .lot { grid-template-columns: minmax(12rem, 19rem) 6.5rem minmax(6rem, 9rem) minmax(9rem, 1fr) 7.5rem; column-gap: 1rem; align-items: center !important; }
  .lot.lot-in-wait { grid-template-columns: minmax(12rem, 19rem) 6.5rem minmax(6rem, 9rem) minmax(9rem, 12rem) minmax(8rem, 1fr) 7.5rem; }
  .lot > .lot-main, .lot > .lot-main > .lot-l1, .lot-l1 > .lot-cb { display: contents; }
  .lot .lot-id { grid-column: 1; } .lot .lot-color { grid-column: 2; } .lot .lot-brand { grid-column: 3; }
  .lot .lot-l2 { grid-column: 4; } .lot > .lot-act { grid-column: 5; justify-content: flex-end; }
  .lot.lot-in-wait .lot-when { grid-column: 4; } .lot.lot-in-wait .lot-l2 { grid-column: 5; }
  .lot.lot-in-wait > .lot-act { grid-column: 6; }
  /* rows of one height: a note is one line (all of it on hover and in the price panel); details live in the price panel */
  .lot .lot-note { grid-column: 1 / -2; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lot .lot-more { display: none; }
  .lot-thead { display: grid; padding-block: 0.4rem; font-size: 0.75rem; font-weight: 600; color: var(--muted); background: var(--paper);
    border-bottom: 1px solid var(--line); }
  .lot-thead > * { display: block; }
}
/* -- phone: three fixed tiers: code -> colour and brand -> ready on the left, "เพิ่ม" on the right -- */
@container sr (max-width: 25.99rem) {
  .lot { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "id id" "cb cb" "when when" "ready act" "note note" "more more"; row-gap: 0.25rem; }
  .lot > .lot-main, .lot > .lot-main > .lot-l1 { display: contents; }
  .lot .lot-id { grid-area: id; } .lot .lot-cb { grid-area: cb; display: flex; gap: 0.75rem; font-size: 0.875rem; color: var(--muted); }
  .lot .lot-when { grid-area: when; } .lot .lot-l2 { grid-area: ready; align-self: center; }
  .lot > .lot-act { grid-area: act; width: auto; align-self: center; }
  .lot > .lot-act .btn { flex: none; min-width: 6rem; justify-content: center; }
  .lot .lot-note { grid-area: note; } .lot .lot-more { grid-area: more; }
}
/* -- bottom sheet (review 10): the search filters (phone) and the cart's "เพิ่มเติม" (phone, tablet) share one look,
      the same backdrop (.sr-sheet-backdrop) and the same page lock (html.sheet-open) -- */
@media (max-width: 52em) {
  .search-box.filters-open .sr-filters, .cart-more[open] > .cart-more-menu {
    position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain;
    padding: 0.75rem calc(1rem + var(--safe-r)) calc(1rem + var(--safe-b)) calc(1rem + var(--safe-l));
    background: var(--surface); border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; box-shadow: var(--shadow-float); }
  .sr-sheet-backdrop { position: fixed; inset: 0; z-index: 39; background: rgb(10 20 30 / 0.45); }
  html.sheet-open { overflow: hidden; }
  .search-box.filters-open .sr-sheet-head, .cart-more[open] .sr-sheet-head { display: flex; align-items: center; justify-content: space-between; }
  .cart-foot:has(.cart-more[open]) { z-index: 40; }   /* the sticky bar holds the sheet: above the bottom bar while open */
}
/* -- cart line: type and size, then colour · brand quieter (review 10) -- */
.cart-name, .cart-sub { display: block; }
.cart-sub { font-weight: 400; margin-top: 0.1rem; }
/* -- cart: one main button; the rest in a row on a computer, under "เพิ่มเติม" on a phone -- */
.cart-more > summary { display: none; }
.cart-more-menu { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; }
.cart-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; }
.cart-more { flex: 1; } .cart-more .cart-clear { margin-left: auto; }
@media (max-width: 52em) {
  .cart-foot { flex-wrap: nowrap; gap: 0.5rem; }
  .cart-main { flex: 1; } .cart-main .btn-primary { width: 100%; justify-content: center; }
  .cart-more { flex: none; }
  .cart-more > summary { display: inline-flex; align-items: center; min-height: 2.75rem; list-style: none; }
  .cart-more > summary::-webkit-details-marker { display: none; }
  .cart-more > summary::before { content: none; }
  .cart-more-menu { flex-direction: column; align-items: stretch; gap: 0.4rem; }   /* opens as the bottom sheet above */
  .cart-more-menu .btn { justify-content: flex-start; min-height: 2.75rem; }
  .cart-more-menu .cart-tools { flex-direction: column; align-items: stretch; }
  .cart-more-menu .cart-tools > .small { display: block; }
  .cart-more .cart-clear { margin-left: 0; }
}
/* -- side panel: the page moves over to make room, so the panel covers nothing (review 15: with no fixed sidebar since
      review 13 there is room down to 1024px); only narrower screens get it on top -- */
@media (max-width: 63.99em) {
  .frame:has(.dock .minitab:not(.folded)) { padding-right: 0; }
  .dock { box-shadow: var(--shadow-float); background: var(--surface); }
}
/* -- calmer: blue only for what can be pressed or is picked; plain table heads; owed metres in ink -- */
.table th { background: light-dark(#F1F3F6, color-mix(in srgb, var(--ink) 6%, var(--surface))); color: var(--muted); }
.lot-owed b { color: var(--ink); }
/* lot table: every cell on the first line, the note under it; the column head names the metres, so the row doesn't repeat it */
@container sr (min-width: 50rem) {
  .lot > *, .lot > .lot-main > *, .lot > .lot-main > .lot-l1 > *, .lot-l1 > .lot-cb > * { grid-row: 1; }
  .lot .lot-note { grid-row: 2; } .lot .lot-more { grid-row: 3; }
  .lot:not(.lot-thead) .lot-l2 .fig-l { display: none; }
}
/* phone lot rows: no empty "due" row for lots in stock */
@container sr (max-width: 25.99rem) {
  .lot:not(.lot-in-wait) { grid-template-areas: "id id" "cb cb" "ready act" "note note" "more more"; }
}

/* ===== review 9 (2026-11-18) ===== */
/* computer: columns that don't depend on what is in them, so colour and brand start at the same place on every row;
   a long code wraps inside its own column instead of running into the colour */
@container sr (min-width: 50rem) {
  .lot { grid-template-columns: minmax(13rem, 1.6fr) 6.5rem minmax(6rem, 9rem) minmax(8rem, 1fr) 7.5rem; }
  .lot.lot-in-wait { grid-template-columns: minmax(13rem, 1.6fr) 6.5rem minmax(6rem, 9rem) minmax(9rem, 12rem) minmax(7rem, 1fr) 7.5rem; }
  .lot .lot-id { min-width: 0; }
  .lot .sr-open.lot-name { white-space: normal; overflow-wrap: anywhere; text-align: left; }
  .lot .lot-color, .lot .lot-brand { min-width: 0; overflow-wrap: anywhere; }
}
/* price check: the steps in full on a computer; one short line on a phone */
.qr-step-now { display: none; margin: 0.35rem 0 0; font-size: 0.875rem; font-weight: 600; }
@media (max-width: 40em) { .qr-steps { display: none; } .qr-step-now { display: block; } }

/* ===== review 14 (2026-11-24): fewer things in the bars ===== */
/* the import time and its warning on one line under the title (it was a full-width box) */
.sr-meta { margin: 0.2rem 0 0; }
.sr-stale { color: color-mix(in srgb, var(--amber) 70%, var(--ink)); font-weight: 600; }
.sr-stale::before { content: "· "; color: var(--muted); font-weight: 400; }
/* the mini-tab buttons now sit in the search page head, beside the title */
.sr-head .dock-launch { margin: 0; align-self: center; }
/* the language switch at the foot of the menu, on its dark background */
.side .nav-lang { margin: 0.6rem 0.6rem 0; border-color: rgb(255 255 255 / 0.18); }
.side .nav-lang label { padding: 0.35rem 0.9rem; border-left-color: rgb(255 255 255 / 0.18); color: var(--side-muted); }
.side .nav-lang label:has(input:checked) { background: rgb(255 255 255 / 0.12); color: #FFFFFF; font-weight: 600; }
/* ===== review 15 (2026-11-24) ===== */
/* a mini tab open on a computer narrower than 1440px: the search takes the first row, Type / Size / Brand a second
   (as on a tablet), so nothing is squeezed beside the panel */
@media (min-width: 64.01em) and (max-width: 89.99em) {
  .frame:has(.dock .minitab:not(.folded)) .sr-bar { grid-template-columns: minmax(0, 2fr) minmax(9rem, 1fr); }
  .frame:has(.dock .minitab:not(.folded)) .sr-filters > .sr-pick { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 0.5rem; }
}

/* ===== review 16 (2026-11-25): one box less, one bold, one rhythm, one button kit, calmer colour, one sheet ===== */
:root { --pad-card: 0.875rem 1rem; --h-control: 2.5rem; --h-control-sm: 2rem; --r-sheet: 14px;
  --shadow-sheet: 0 -6px 24px rgb(15 30 45 / 0.14); --tint: 8%; }

/* 1. one box less: the price-check results sit on the page and each line keeps its own card;
      a table or a list inside a panel uses the panel's edge instead of drawing its own */
.qr-results.panel { background: none; border: 0; padding: 0; }
.qr-item { border-radius: var(--r-panel); }
.panel > .table-wrap, .panel > .name-list { border: 0; border-radius: 0; background: none; }
.pd-answer { border-left-width: 1px; }
.pd-focus { border-color: var(--line); background: var(--paper); }

/* 2. one bold in a product name: type and size; colour, brand and code in the normal weight */
.qr-name { font-weight: 400; }
.qr-name > b { font-weight: 600; }
.pd-lot-name { font-weight: 400; }

/* 3. one rhythm: the same inner edge for every card, the same gap under every heading,
      the same height for every box to type in, choice and button */
.qr-item, .sr-card-head, .tk-tile, .sysd-tile, .sysd-inv, .sysd-role, .qs-item, .an-pick { padding: var(--pad-card); }
.qr-items { gap: 0.75rem; }
.qr-reply-head h2, .qr-top h2, .pr-head h2 { margin: 0 0 0.75rem; }
.qr-top { margin-bottom: 0; }
.btn, input[type=text], input[type=password], input[type=search], input[type=date], input[type=month], input[type=number], select,
  .sr-need { min-height: var(--h-control); }
.btn-sm { min-height: var(--h-control-sm); }
.segmented label { display: inline-flex; align-items: center; min-height: calc(var(--h-control) - 2px); padding-block: 0; }
.seg-small label { min-height: calc(var(--h-control-sm) - 2px); }

/* 4. columns that line up on a computer: every price type keeps its slot, one width each; metres in tabular figures */
@media (min-width: 52.01em) {
  .qr-prices { display: grid; grid-template-columns: repeat(auto-fill, 7.5rem); gap: 0.4rem; }
  .qr-price { min-width: 0; width: 100%; }
  .qr-head { display: grid; grid-template-columns: minmax(0, 1fr) 7rem; }
  .qr-qty { text-align: right; }
}
.qr-price.is-none { cursor: default; border-style: dashed; color: var(--muted); background: none; }
.qr-price.is-none:hover { border-color: var(--line); }
@media (max-width: 52em) { .qr-price.is-none { display: none; } }
.lot-l2, .lot-ready, .lot-booked, .sr-card-head p { font-variant-numeric: tabular-nums; }

/* 5. calmer colour: blue only on the main button and on what is picked; status tags and notes on a paler ground */
.badge { background: color-mix(in srgb, var(--tone) var(--tint), transparent); }
.flash { background: color-mix(in srgb, var(--tone) 6%, var(--surface)); border-color: color-mix(in srgb, var(--tone) 30%, transparent); }
.qr-qty, .mg-net { color: var(--ink); }
.qr-item.is-open { background: var(--surface); }
.notice-tag, .pd-focus-label { color: var(--muted); }
.sr-open.lot-name { color: var(--ink); }
.sr-open.lot-name:hover { color: var(--blue); }
.top-icon:hover { background: color-mix(in srgb, var(--ink) 5%, var(--surface)); }

/* 6. one button kit: one corner, one height, one icon line */
.top-icon { width: var(--h-control); min-height: var(--h-control); }
.qr-cond, .qr-price, .copy-btn, .pr-del-btn, .mg-use, .sr-need, .dock-launch button { border-radius: var(--r-control); }
.ico { stroke-width: 1.8; }
.bottom-bar [aria-current="page"] .ico, .bottom-bar button[aria-expanded="true"] .ico { stroke-width: 1.8; }
.btn .ico, .top-icon .ico { width: 1.15rem; height: 1.15rem; flex: none; }

/* 7. phone: the filters, the product panel, a question and the cart's "เพิ่มเติม" are one kind of sheet --
      the same corner, shadow, inner edge and handle */
@media (max-width: 52em) {
  .search-box.filters-open .sr-filters, .cart-more[open] > .cart-more-menu {
    border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: var(--shadow-sheet); border: 0; }
  .search-box.filters-open .sr-filters::before, .cart-more[open] > .cart-more-menu::before {
    content: ""; display: block; justify-self: center; align-self: center; width: 2.5rem; height: 4px; margin: 0 auto 0.25rem;
    border-radius: var(--r-control); background: var(--line); }
  .sr-sheet-head { min-height: var(--h-control); }
  .sr-sheet-head > b { font-size: 1rem; font-weight: 600; }
}
@media (max-width: 40em) {
  dialog.confirm { border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: var(--shadow-sheet); border: 0;
    padding: 0.75rem calc(1rem + var(--safe-r)) calc(1rem + var(--safe-b)) calc(1rem + var(--safe-l)); }
  dialog.confirm::before { margin: 0 auto 0.75rem; }
  dialog.confirm.pd { padding: 0; }
  dialog.confirm.pd::before { margin: 0.75rem auto 0; }
  .pd-head { padding: 0.5rem 1rem 0.75rem; }
  .pd-body { padding: 0.75rem 1rem 1rem; }
  .pd-foot { padding: 0.75rem 1rem calc(0.75rem + var(--safe-b)); }
}

/* touch screens: every button, box to type in and choice stays at least 44px (2.75rem) tall.
   Keep this block LAST -- a later size rule (like review 16's one button kit) would win over it. */
@media (pointer: coarse) {
  .btn, .btn-sm, .top-icon, select, .sr-need,
  input[type=text], input[type=password], input[type=search], input[type=date], input[type=month], input[type=number] { min-height: 2.75rem; }
  .top-icon { width: 2.75rem; }
  .sg-pick select, .sg-pick input { min-height: 2.75rem; }
  .segmented label, .seg-small label { min-height: 2.75rem; }
  .mg-use { min-height: 2rem; }   /* the small "ใช้" pick inside a Margin line, as before review 16 */
}
