/* A.CEMI Shopfront.
   Thai stacks vowels above consonants and tone marks above those, so line
   heights stay loose — a normal 1.4 clips them. Compact comes from padding
   and type size, never from squeezing the line height below 1.5.

   Layout follows Option A of the 23 September design review: a grouped side
   menu with work counts, and a Today page instead of an overview of totals. */

:root {
  /* Colours follow the Product Monitor (Automation/Product Monitor), so the
     report at /monitor/ and the desk read as one product: warm ivory paper,
     oxblood accent, forest / ochre / rust / navy for states. Ochre is one
     step deeper than the report's #aa7c12, which is too faint for small text. */
  --ink: #252226;
  --ink-2: #363236;
  --ink-soft: #676267;
  --line: #e7e1d9;
  --line-2: #efe9e2;
  --line-strong: #d8cfc5;
  --bg: #fcfaf7;
  --side: #fffdfa;
  --head: #faf7f2;
  --card: #fffdfa;
  --hover: #f5f0ea;
  --chip: #efe8df;
  --mute: #f3eee8;
  --accent: #621225;
  --accent-deep: #4f0e1d;
  --accent-soft: #f5ecec;
  --accent-line: #e6cfd3;
  --note-soft: #f6f0e7;
  --note-line: #e7dccd;
  --ok: #3f7653;
  --ok-soft: #e9f1ec;
  --ok-line: #c9dccf;
  --warn: #86610d;
  --warn-soft: #f8f0de;
  --warn-line: #ead9b3;
  --bad: #ad4d08;
  --bad-soft: #fbece3;
  --bad-line: #efd2c0;
  --bad-deep: #8e3f06;
  --info: #29476f;
  --info-soft: #e9eef5;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 80px; }

h1 { font-size: 21px; margin: 0 0 4px; font-weight: 600; letter-spacing: -0.01em; }
h1 span, h2 span { color: var(--ink-soft); font-weight: 400; font-size: 0.62em; }
h2 { font-size: 15px; margin: 26px 0 10px; font-weight: 600; }
code { font-family: var(--mono); font-size: 0.88em; }

.lede { color: var(--ink-soft); max-width: 80ch; margin: 0 0 16px; }
.footnote { color: var(--ink-soft); font-size: 13px; max-width: 80ch; }
.muted { color: var(--ink-soft); }

svg.i {
  width: 18px; height: 18px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

/* ---------------------------------------------------------------- shell */

.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.page { min-width: 0; }
.page main { max-width: 1320px; margin: 0; padding: 22px 28px 64px; }

.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px 12px 12px;
  background: var(--side); border-right: 1px solid var(--line);
}
.side .brand {
  display: flex; flex-direction: column; padding: 2px 8px;
  text-decoration: none; color: var(--ink); line-height: 1.25;
}
.side .brand span { font-size: 11px; letter-spacing: 0.16em; color: var(--ink-soft); font-weight: 500; }
.side .brand strong { font-size: 19px; color: var(--accent); font-weight: 600; }

/* The one place that says which live actions are switched on. */
.mode {
  display: flex; gap: 7px; align-items: flex-start;
  padding: 6px 10px; border-radius: 8px; text-decoration: none;
  background: var(--info-soft); color: var(--info); font-size: 12px; line-height: 1.45;
}
.mode .i { width: 14px; height: 14px; margin-top: 2px; }
.mode.live { background: var(--warn-soft); color: var(--warn); }
.mode:hover { filter: brightness(0.97); }

.find {
  display: flex; align-items: center; gap: 8px; height: 34px; margin: 0;
  padding: 0 8px 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink-soft);
}
.find:focus-within { border-color: var(--accent); }
.find .i { width: 16px; height: 16px; }
.find input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 13px; color: var(--ink);
}
.find kbd {
  font-family: var(--mono); font-size: 11px; line-height: 16px;
  border: 1px solid var(--line); border-radius: 4px; padding: 0 5px;
}

.side nav { display: flex; flex-direction: column; gap: 2px; }
.side .group { margin: 12px 10px 2px; font-size: 12px; font-weight: 500; color: var(--ink-soft); }
.navitem {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px;
  border-radius: 7px; text-decoration: none; color: var(--ink-2); font-size: 14px;
}
.navitem .i { color: var(--ink-soft); }
.navitem .label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navitem:hover { background: var(--hover); color: var(--accent); }
.navitem.on { background: var(--accent); color: #fff; font-weight: 600; }
.navitem.on .i { color: #fff; }
.navitem.on .badge { background: #fff; color: var(--accent); }
.badge {
  font-size: 12px; font-weight: 600; line-height: 20px; min-width: 20px;
  padding: 0 6px; border-radius: 10px; text-align: center;
  background: var(--chip); color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.badge.hot { background: var(--accent); color: #fff; }

.who {
  margin: auto 0 0; display: flex; align-items: center; gap: 10px;
  padding: 12px 6px 0; border-top: 1px solid var(--line);
}
.who .avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--side); font-size: 12px; font-weight: 600;
}
.who .name { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.35; }
.who .name strong { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .name span { font-size: 12px; color: var(--ink-soft); }
.who button {
  width: 32px; height: 32px; border: 0; border-radius: 6px; background: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); cursor: pointer;
}
.who button:hover { background: var(--hover); color: var(--ink); }

.mobilebar, .scrim { display: none; }

/* A phone gets the same menu as a drawer, behind a button. */
.side .drawer-close { display: none; }
@media (max-width: 900px) {
  .side .drawer-close { display: block; margin: 0 0 12px auto; }
  .shell { display: block; }
  .mobilebar {
    display: flex; align-items: center; gap: 4px; position: sticky; top: 0; z-index: 20;
    height: 52px; padding: 0 8px; background: var(--side); border-bottom: 1px solid var(--line);
  }
  .mobilebar .brand { text-decoration: none; color: var(--ink); font-size: 15px; letter-spacing: 0.02em; }
  .mobilebar .brand strong { color: var(--accent); font-weight: 600; }
  .navbtn {
    width: 44px; height: 44px; border: 0; border-radius: 8px; background: none;
    display: flex; align-items: center; justify-content: center; color: var(--ink); cursor: pointer;
  }
  .navbtn .i { width: 22px; height: 22px; }
  .side {
    visibility: hidden;
    position: fixed; z-index: 40; left: 0; top: 0; width: 272px; max-width: 85vw;
    transform: translateX(-100%); transition: transform 0.18s ease;
  }
  .shell.nav-open .side { visibility: visible; transform: none; box-shadow: 12px 0 32px rgba(47, 32, 35, 0.18); }
  .shell.nav-open .scrim {
    display: block; position: fixed; inset: 0; z-index: 30; background: rgba(47, 32, 35, 0.28);
  }
  .navitem { height: 44px; }
  .page main { padding: 16px 16px 48px; }
  /* Wide tables scroll inside themselves instead of pushing the page sideways. */
  .grid { display: block; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* ----------------------------------------------------------------- today */

.pagehead { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.pagehead h1 { margin: 0; }
.pagehead .muted { font-size: 13px; }
.today-block h2 { display: flex; align-items: baseline; gap: 10px; margin: 20px 0 8px; }
.today-block h2 .more { margin-left: auto; font-size: 13px; font-weight: 400; color: var(--accent); text-decoration: none; }
.today-block h2 .more:hover { text-decoration: underline; }

.worklist {
  list-style: none; margin: 0; padding: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}
.worklist li {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(0, 220px) 130px auto;
  align-items: center; gap: 14px; padding: 9px 16px; border-bottom: 1px solid var(--line-2);
}
.worklist li:last-child { border-bottom: 0; }
.wicon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.wicon.bad { background: var(--bad-soft); color: var(--bad); }
.wicon.warn { background: var(--warn-soft); color: var(--warn); }
.wtext { display: flex; flex-direction: column; min-width: 0; line-height: 1.5; }
.wtext strong { font-weight: 600; }
.wtext span { font-size: 12px; color: var(--ink-soft); }
.wchan { font-size: 13px; display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; }
.wchan code { font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; }
.wdue { font-size: 13px; font-weight: 600; white-space: nowrap; }
.wdue.bad { color: var(--bad); }
.wdue.warn { color: var(--warn); }
.wdue.muted { color: var(--ink-soft); font-weight: 400; }
.worklist .btn { justify-self: end; white-space: nowrap; }

.allclear {
  display: flex; align-items: center; gap: 10px; margin: 0;
  padding: 14px 16px; border-radius: 10px; background: var(--ok-soft); color: var(--ok);
}

.tiles.routine { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tiles.routine .tile .l { color: var(--ink-soft); font-size: 13px; }

.chan td { height: 40px; }
.chan .shop { display: inline-flex; align-items: center; gap: 8px; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }

/* One colour per platform, the same on every screen (owner, 30 Sep 2026):
   Shopify green, Lazada blue, Shopee orange, TikTok pink. The badge carries
   the name as well, so the colour is never the only signal. */
:root {
  --ch-shopify: #5e8e3e; --ch-shopify-ink: #3d6b24; --ch-shopify-soft: #ebf3e5;
  --ch-lazada: #2356e8;  --ch-lazada-ink: #1c46bd;  --ch-lazada-soft: #e7eefd;
  --ch-shopee: #ee4d2d;  --ch-shopee-ink: #c23a17;  --ch-shopee-soft: #fdebe5;
  --ch-tiktok: #e91e63;  --ch-tiktok-ink: #b8124d;  --ch-tiktok-soft: #fce6ef;
  /* Chat-only channels (2 Oct 2026). Facebook's older slate blue and
     Instagram's purple, so neither reads as Lazada blue or TikTok pink. */
  --ch-facebook: #3b5998;  --ch-facebook-ink: #2d4373;  --ch-facebook-soft: #e9edf5;
  --ch-instagram: #8a3ab9; --ch-instagram-ink: #6c2a93; --ch-instagram-soft: #f2e9f8;
}
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-soft); flex-shrink: 0; }
.dot.shopee { background: var(--ch-shopee); }
.dot.lazada { background: var(--ch-lazada); }
.dot.tiktok { background: var(--ch-tiktok); }
.dot.shopify { background: var(--ch-shopify); }
.dot.facebook { background: var(--ch-facebook); }
.dot.instagram { background: var(--ch-instagram); }

.plat {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 12px; font-weight: 600; line-height: 1.5;
  padding: 1px 8px 1px 7px; border-radius: 20px;
  background: var(--mute); color: var(--ink-2);
}
.plat .dot { width: 7px; height: 7px; }
.plat .plat-shop { font-weight: 400; opacity: .8; }
.plat.shopify { background: var(--ch-shopify-soft); color: var(--ch-shopify-ink); }
.plat.lazada { background: var(--ch-lazada-soft); color: var(--ch-lazada-ink); }
.plat.shopee { background: var(--ch-shopee-soft); color: var(--ch-shopee-ink); }
.plat.tiktok { background: var(--ch-tiktok-soft); color: var(--ch-tiktok-ink); }
.plat.facebook { background: var(--ch-facebook-soft); color: var(--ch-facebook-ink); }
.plat.instagram { background: var(--ch-instagram-soft); color: var(--ch-instagram-ink); }

/* A row or card from one platform: a coloured edge down its left side. */
tr.ch-shopify > td:first-child { box-shadow: inset 3px 0 0 var(--ch-shopify); }
tr.ch-lazada > td:first-child { box-shadow: inset 3px 0 0 var(--ch-lazada); }
tr.ch-shopee > td:first-child { box-shadow: inset 3px 0 0 var(--ch-shopee); }
tr.ch-tiktok > td:first-child { box-shadow: inset 3px 0 0 var(--ch-tiktok); }
.ch-card.ch-shopify { border-left: 4px solid var(--ch-shopify); }
.ch-card.ch-lazada { border-left: 4px solid var(--ch-lazada); }
.ch-card.ch-shopee { border-left: 4px solid var(--ch-shopee); }
.ch-card.ch-tiktok { border-left: 4px solid var(--ch-tiktok); }
.chip .dot { width: 7px; height: 7px; margin-right: 5px; vertical-align: 1px; }

@media (max-width: 1100px) {
  .tiles.routine { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .worklist li { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .worklist .wchan { grid-column: 2; grid-row: 2; }
  .worklist .wdue { grid-column: 3; grid-row: 1; }
  .worklist .btn { grid-column: 3; grid-row: 2; }
}

/* ------------------------------------------------------------------ tabs */

.tabs { display: flex; gap: 4px; margin: -4px 0 16px; border-bottom: 1px solid var(--line);
        overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a {
  padding: 8px 12px; margin-bottom: -1px; white-space: nowrap;
  text-decoration: none; color: var(--ink-soft); font-size: 13px;
  border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }

/* ----------------------------------------------------------------- tiles */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 13px 16px; display: flex; flex-direction: column; gap: 1px;
  text-decoration: none; color: inherit;
}
a.tile:hover { border-color: var(--accent); }
.tile .n { font-size: 24px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.tile .l { font-size: 13px; }
.tile .e { font-size: 12px; color: var(--ink-soft); }
.tile.urgent { background: var(--accent-soft); border-color: var(--accent-line); }
.tile.urgent .n { color: var(--accent); }

/* ----------------------------------------------------------------- table */

.grid { width: 100%; border-collapse: collapse; background: var(--card);
        border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.grid th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-soft);
  padding: 7px 12px; background: var(--head); border-bottom: 1px solid var(--line);
}
.grid td { padding: 8px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; font-size: 13px; line-height: 1.5; }
.grid tr:last-child td { border-bottom: none; }
.grid .th { display: block; font-size: 12px; color: var(--ink-soft); }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.grid .note { font-size: 12px; color: var(--ink-soft); max-width: 30ch; line-height: 1.5; }
.grid .empty { text-align: center; padding: 32px; color: var(--ink-soft); }
.tablewrap { overflow-x: auto; }

.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 20px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.lock { background: var(--info-soft); color: var(--info); }
.pill.muted { background: var(--mute); color: var(--ink-soft); }

/* ---------------------------------------------------------------- review */

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 12px; }
.chip {
  font-size: 13px; text-decoration: none; color: var(--ink-2);
  border: 1px solid var(--line-strong); background: var(--card);
  padding: 3px 11px; border-radius: 20px;
}
.chip:hover { border-color: var(--ink-soft); color: var(--ink); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.explain {
  background: var(--note-soft); border: 1px solid var(--note-line); border-radius: 8px;
  padding: 9px 13px; font-size: 13px; margin: 0 0 14px; max-width: 80ch;
}

.review .raw code.bad { background: var(--bad-soft); color: var(--bad); padding: 1px 6px; border-radius: 4px; }
.review .pname { display: block; font-size: 12px; color: var(--ink-soft); }
.review .suggest { max-width: 230px; }
.review td:first-child { width: 20%; overflow-wrap: anywhere; }
.review .raw { width: 22%; }
.review .suggest { min-width: 115px; }
.review form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 270px; }
.review form label, .review form [role="status"] { flex-basis: 100%; margin: 0; }
.review form select { font: inherit; width: 100%; padding: 5px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); }
.review input {
  font: inherit; font-size: 13px; padding: 5px 9px; width: 165px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.review input:focus { outline: none; border-color: var(--accent); }

.cutover-controls form { max-width: 760px; margin: 14px 0 20px; }
.cutover-controls label { display: block; margin: 10px 0; }
.cutover-controls :is(input:not([type="hidden"]), textarea, select) {
  display: block; box-sizing: border-box; width: 100%; margin-top: 5px;
  font: inherit; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--card);
}
.cutover-controls textarea { resize: vertical; min-height: 72px; }

button.sug {
  font: inherit; font-size: 12px; font-family: var(--mono);
  background: var(--mute); border: 1px solid var(--line); border-radius: 5px;
  padding: 2px 7px; margin: 0 4px 4px 0; cursor: pointer; color: var(--ink);
}
button.sug:hover { background: var(--accent-soft); border-color: var(--accent); }

.btn {
  font: inherit; font-size: 13px; padding: 6px 14px; border-radius: 7px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.5;
}
.btn:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn.sm { font-size: 13px; padding: 4px 11px; }
.btn.ghost { background: var(--card); color: var(--ink-2); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--hover); color: var(--accent); border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); }

tr.done td { background: var(--ok-soft); color: var(--ok); font-size: 13px; }
tr.done.muted td { background: var(--mute); color: var(--ink-soft); }

.pager { display: flex; gap: 18px; align-items: center; justify-content: center;
         margin-top: 16px; font-size: 13px; color: var(--ink-soft); }
.pager a { color: var(--ink); text-decoration: none; }
.pager a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- signin */

.signin { max-width: 380px; margin: 14vh auto; text-align: center; }
.signin h1 { font-size: 26px; font-weight: 400; letter-spacing: .02em; }
.signin h1 strong { color: var(--accent); }
.signin .sub { color: var(--ink-soft); margin: 0 0 30px; }
.signin .hint { font-size: 12px; color: var(--ink-soft); margin-top: 12px; }
.signin .warn { background: var(--warn-soft); color: var(--warn); padding: 11px 14px;
                border-radius: 8px; font-size: 13px; }
.signin .error { background: var(--bad-soft); color: var(--bad); padding: 11px 14px;
                 border-radius: 8px; font-size: 13px; }
.signin .dev { margin-top: 28px; padding-top: 22px; border-top: 1px dashed var(--line); }
.signin .devnote { font-size: 11px; color: var(--ink-soft); margin-bottom: 10px; }
.signin .dev input { font: inherit; font-size: 14px; padding: 9px 12px; width: 100%;
                     border: 1px solid var(--line); border-radius: 7px; margin-bottom: 9px; }

/* -------------------------------------------------------------- patterns */

.lede.small { font-size: 13px; }
.lede.small a { color: var(--ink); }

.pattern {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; margin-bottom: 12px;
}
.phead { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.phead h2 { margin: 0 0 4px; font-size: 15px; }
.pexplain { margin: 0; color: var(--ink-soft); font-size: 13px; max-width: 70ch; }
.pcount { text-align: right; white-space: nowrap; }
.pcount .n { display: block; font-size: 24px; font-weight: 600; color: var(--accent); line-height: 1.2; }
.pcount .l { font-size: 12px; color: var(--ink-soft); }

.pmatch { margin: 12px 0; }
.pmatch td { padding: 6px 12px; }
.pmatch .arrow { color: var(--ink-soft); width: 30px; text-align: center; }
.pmatch code.bad { background: var(--bad-soft); color: var(--bad); padding: 1px 6px; border-radius: 4px; }
.pmatch code.good { background: var(--ok-soft); color: var(--ok); padding: 1px 6px; border-radius: 4px; }
.pmatch .more { color: var(--ink-soft); font-size: 12px; font-style: italic; }

.papply { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.papply .hint { font-size: 12px; color: var(--ink-soft); }
.empty-state { color: var(--ink-soft); text-align: center; padding: 32px; }

/* ------------------------------------------------------------ zort queue */

.runline { font-size: 13px; color: var(--ink-soft); margin: -8px 0 14px; }
.runline .bad { color: var(--bad); }
.warn-box { background: var(--warn-soft); border-color: var(--warn-line); }

.proposal {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; margin-bottom: 12px;
}
.proposal h2 { margin: 0 0 4px; font-size: 15px; }
.proposal h2 code { font-size: 14px; color: var(--accent); }
.proposal .stock { font-variant-numeric: tabular-nums; }
.proposal .stock .arrow { color: var(--ink-soft); margin: 0 4px; }
.proposal .stock strong.bad { color: var(--bad); }
.whnote { font-size: 12px; color: var(--ink-soft); margin: 0 0 12px; }
.proposal .pstatus { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.proposal .pstatus .hint { margin: 0; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { display: flex; gap: 6px; align-items: center; margin: 0; }
.actions input {
  font: inherit; font-size: 13px; padding: 5px 9px; width: 150px;
  border: 1px solid var(--line); border-radius: 6px;
}
.actions input:focus { outline: none; border-color: var(--accent); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.searchbar { display: flex; gap: 8px; margin: 0 0 6px; }
.searchbar input {
  font: inherit; font-size: 13px; padding: 6px 12px; width: 320px; max-width: 100%;
  border: 1px solid var(--line); border-radius: 7px;
}
.searchbar input:focus { outline: none; border-color: var(--accent); }
code.tiny { font-size: 11px; color: var(--ink-soft); display: block; }

/* --------------------------------------------------------- connections */

.caps { max-width: 260px; }
.cap {
  display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 20px;
  margin: 0 4px 4px 0; background: var(--mute); color: var(--ink-soft);
}
.cap.on { background: var(--ok-soft); color: var(--ok); }
.grid .note { display: block; font-size: 11px; color: var(--ink-soft); margin-top: 3px;
              line-height: 1.5; max-width: 40ch; }
.grid td .bad { color: var(--bad); font-weight: 600; }

/* --------------------------------------------------------------- inbox */

/* Fills the window below the page padding, so the thread scrolls and the
   composer stays in view. */
.inbox { display: grid; grid-template-columns: 300px 1fr; gap: 14px;
         height: calc(100vh - 86px); min-height: 460px; }
@media (max-width: 900px) {
  .inbox { grid-template-columns: 1fr; height: auto; }
  .convlist { max-height: 40vh; }
}
.filters.tight { margin: 0 0 10px; gap: 5px; }
.filters.tight .chip { font-size: 12px; padding: 2px 9px; }

.convlist { overflow-y: auto; padding-right: 4px; }
.conv {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 12px; margin-bottom: 6px;
}
.conv:hover { border-color: var(--ink-soft); }
.conv.active { border-color: var(--accent); background: var(--accent-soft); }
.conv.unread .cname { font-weight: 600; }
.conv.unread::after {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); margin-left: 6px; vertical-align: middle;
}
.ctop { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cname { font-size: 14px; }
.cchan { font-size: 10px; color: var(--ink-soft); letter-spacing: .05em; }
.ctop .plat, .conv .plat { font-size: 10.5px; padding: 0 6px; flex-shrink: 0; }
.odhead h1 .plat { font-size: 13px; vertical-align: 3px; }
.proposal h2 .plat { font-size: 12px; vertical-align: 2px; }
.cprev { font-size: 12px; color: var(--ink-soft); line-height: 1.5;
         overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmeta { font-size: 11px; color: var(--ink-soft); margin-top: 4px;
         display: flex; gap: 8px; align-items: center; }
.cmeta .sla { background: var(--warn-soft); color: var(--warn); padding: 1px 7px; border-radius: 20px; }
.cmeta .who2 { background: var(--info-soft); color: var(--info); padding: 1px 7px; border-radius: 20px; }

.thread { display: flex; flex-direction: column; background: var(--card);
          border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.thead { display: flex; justify-content: space-between; align-items: center; gap: 14px;
         padding: 11px 16px; border-bottom: 1px solid var(--line); }
.thead h2 { margin: 0; font-size: 15px; }
.presence { margin: 3px 0 0; font-size: 12px; color: var(--warn); }

.ordercards { padding: 9px 16px; border-bottom: 1px solid var(--line); background: var(--head); }
.ordercard { display: flex; gap: 12px; align-items: baseline; font-size: 13px; flex-wrap: wrap; }
.ordercard code { color: var(--accent); }
.ordercard span { color: var(--ink-soft); font-size: 12px; }
.ordercard .track { background: var(--ok-soft); color: var(--ok); padding: 1px 8px; border-radius: 20px; }
.linkorder { display: flex; gap: 6px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.linkorder input { font: inherit; font-size: 13px; padding: 5px 10px; flex: 1; max-width: 320px;
                   border: 1px solid var(--line); border-radius: 6px; }

.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex;
            flex-direction: column; gap: 8px; }
.msg { display: flex; }
.msg.out { justify-content: flex-end; }
.bubble { max-width: 68%; padding: 8px 12px; border-radius: 12px; font-size: 14px;
          line-height: 1.65; background: var(--mute); }
.msg.out .bubble { background: var(--accent-soft); }
.bubble .stamp { display: block; font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.bubble .stamp .bad { color: var(--bad); }
.senderr { font-size: 11px; color: var(--bad); margin: 2px 0 0; }
/* Line breaks are part of what the customer typed. */
.bubble .mbody { white-space: pre-line; overflow-wrap: anywhere; }
.bubble .mimg { display: block; max-width: 100%; height: auto; border-radius: 8px; margin: 2px 0 6px; }
.bubble.notice { background: var(--head); border: 1px solid var(--line); }
.bubble .mkicker { display: block; font-size: 11px; color: var(--ink-soft); }
.bubble .mcard { display: flex; gap: 10px; align-items: flex-start; }
.bubble .mthumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; flex: none; }
.bubble .mcard-body { display: flex; flex-direction: column; min-width: 0; }
.bubble .mcard-detail { font-size: 13px; color: var(--ink-soft); }
.bubble a { color: var(--accent); }

.canned { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 16px 0; }
.composer { display: flex; gap: 8px; padding: 10px 16px 14px; align-items: flex-end; }
.composer textarea {
  flex: 1; font: inherit; font-size: 14px; line-height: 1.65; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 8px; resize: vertical;
}
.composer textarea:focus { outline: none; border-color: var(--accent); }
.thread .explain { margin: 12px 16px 14px; }
.empty-state.small { font-size: 13px; padding: 20px; }

.explain.ok-box  { background: var(--ok-soft);  border-color: var(--ok-line); color: var(--ok); }
.explain.bad-box { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.explain.warn-box{ background: var(--warn-soft);border-color: var(--warn-line); color: var(--warn); }
.explain.muted-box { background: var(--mute); border-color: var(--line); color: var(--ink-soft); }

/* ------------------------------------------------------------ fulfilment
   Shipping, cancelling and returns. The visual language is deliberately
   quieter than the buttons it guards: the loud colour is kept for the one
   thing that cannot be undone. */

.crumb { margin: 0 0 8px; font-size: 13px; }
.crumb a { color: var(--ink-soft); text-decoration: none; }
.crumb a:hover { color: var(--ink); }
.hint { font-size: 12px; color: var(--ink-soft); margin: 6px 0 0; }
.ok-text { color: var(--ok); margin: 0; }
.pill.big { font-size: 13px; padding: 3px 12px; }


form.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 0; }
form.inline input, form.inline select, .confirmform select, .confirmform input, .confirmform textarea {
  font: inherit; font-size: 13px; padding: 5px 10px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--card);
}
form.inline input:focus, .confirmform :is(input, select, textarea):focus { outline: none; border-color: var(--accent); }
form.inline label { font-size: 13px; color: var(--ink-soft); display: flex; gap: 6px; align-items: center; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px;
         grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.steps li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.steps li.done { border-color: var(--ok-line); background: linear-gradient(var(--ok-soft), var(--card) 60%); }
.steps h3 { font-size: 14px; margin: 0 0 6px; font-weight: 600; }
.steps h3 span { color: var(--ink-soft); font-weight: 400; font-size: 12px; margin-left: 4px; }
.steps .parcel { margin: 0 0 6px; font-size: 13px; }

.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad-deep); border-color: var(--bad-deep); }
.btn.ghost.danger { background: var(--card); color: var(--bad); border-color: var(--bad-line); }
.btn.ghost.danger:hover { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }

.confirmform { display: grid; gap: 12px; max-width: 460px; margin-top: 16px; }
.confirmform label { display: grid; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.confirmform .btn { justify-self: start; }
.confirmform .btn + .btn { margin-left: 0; }
.shopify-shipping-fields { display: grid; gap: 12px; min-width: 0; padding: 0; margin: 0; border: 0; }
.shopify-shipping-fields input { min-width: 0; width: 100%; box-sizing: border-box; }
.confirmform .shopify-check { display: flex; align-items: start; gap: 8px; }
.shopify-check input[type="checkbox"] { width: auto; margin: 2px 0 0; flex-shrink: 0; }
.shopify-shipping-fields:disabled { opacity: .6; }
input.digits { font-family: var(--mono); letter-spacing: 0.2em;
               width: 13ch; text-align: center; }
/* Spacing suits typed digits, not a Thai placeholder: stacked vowels pulled
   apart read as broken text. */
input.digits::placeholder { letter-spacing: normal; font-family: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif; }
.big-warning { font-size: 15px; }
.settle p { margin: 6px 0; }
.reverse .phead h2 a { text-decoration: none; }

/* Order numbers are links now. Keep them reading as data, not as web links.
   Buttons inside a table keep their own colours: this rule once turned a
   dark button's label dark as well, leaving a blank black box. */
.grid a:not(.btn), .reverse h2 a { color: var(--ink); text-decoration: none; border-bottom: 1px dotted var(--ink-soft); }
.grid a:not(.btn):hover, .reverse h2 a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- catalogue reconcile ------------------------------------------------ */
.grid td.pic { width: 52px; padding: 5px; }
.grid td.pic img, .proposal img.pic {
  width: 42px; height: 42px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--line); display: block; background: #fff; }
.proposal img.pic { width: 96px; height: 96px; margin: 8px 0; }
.grid .sku { display: block; font-family: var(--mono); font-weight: 500; font-size: 13px; }
.grid .hint, .explain .hint { display: block; font-size: 11px; color: var(--ink-soft); }
.grid .num.truth, .grid td.truth { color: inherit; font-weight: 600; }
.grid .num.bad { color: var(--bad); font-weight: 600; }
.grid .num.warn { color: var(--warn); font-weight: 600; }
.grid td.act { white-space: nowrap; text-align: right; }
.grid td.act .btn { color: #fff; }


.catalogue-table-wrap { overflow-x: auto; margin: 10px 0 18px; }
.catalogue-coverage .grid { min-width: 1000px; }
.catalogue-coverage h2 { margin-top: 16px; }
.catalogue-tiles { margin-top: 20px; }
.catalogue-evidence { max-width: 820px; }
.catalogue-evidence > p .hint { display: block; }
.catalogue-evidence .grid th { width: 38%; }
.catalogue-approval, .catalogue-recovery { margin: 20px 0; max-width: 820px; }
.catalogue-approval .actions { margin-top: 14px; }
.catalogue-approval .btn:disabled { opacity: .55; cursor: not-allowed; }
.catalogue-approval .confirmform { max-width: none; }

/* ------------------------------------------------------ shared helpers */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
details > summary { cursor: pointer; padding: 6px 0; }
details > summary:hover { color: var(--accent); }

/* ------------------------------------------------- order side panel
   The order list keeps its place; one order opens beside it. The panel only
   reads — every action stays on the full order page it links to. */

tr.peekable { cursor: pointer; }
tr.peekable:hover td { background: var(--hover); }
tr.peekable.sel td { background: var(--accent-soft); }

.peek-scrim { position: fixed; inset: 0; z-index: 30; background: rgba(47, 32, 35, 0.16); }
.peek {
  position: fixed; z-index: 40; top: 0; right: 0; bottom: 0; width: 460px; max-width: 100vw;
  display: flex; flex-direction: column; background: var(--card);
  border-left: 1px solid var(--line); box-shadow: -12px 0 32px rgba(47, 32, 35, 0.12);
}
.peek[hidden], .peek-scrim[hidden] { display: none; }
#peek { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.peek-head {
  display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 12px 0 18px;
  border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.peek-head .shop { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.peek-no { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.peek-close {
  width: 36px; height: 36px; border: 0; border-radius: 6px; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--ink-soft);
}
.peek-close:hover { background: var(--head); color: var(--ink); }
.peek-body { flex: 1; overflow-y: auto; padding: 14px 18px 18px; }
.peek-body h3 { font-size: 13px; font-weight: 600; margin: 16px 0 6px; }
.peek-body h3 span { font-weight: 400; color: var(--ink-soft); margin-left: 4px; }
.peek-body p { margin: 0 0 8px; }
.peek-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.peek-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin: 12px 0 0; }
.peek-meta div { display: flex; flex-direction: column; }
.peek-meta dt { font-size: 12px; color: var(--ink-soft); }
.peek-meta dd { margin: 0; }
.peek-lines { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; }
.peek-lines li {
  display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px;
  border-bottom: 1px solid var(--line-2);
}
.peek-lines li:last-child { border-bottom: 0; }
.peek-lines .what { display: flex; flex-direction: column; min-width: 0; }
.peek-lines .qty { white-space: nowrap; color: var(--ink-soft); font-size: 13px; }
.peek-lines code.good { color: var(--ok); }
.peek-history { list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--ink-2); }
.peek-history li { padding: 3px 0; }
.peek-foot { padding: 12px 18px 10px; border-top: 1px solid var(--line); flex-shrink: 0; }
.peek-foot .peek-open { display: flex; justify-content: center; align-items: center; gap: 6px; width: 100%;
                        padding: 9px 14px; font-size: 14px; }
.peek-foot-note { display: flex; justify-content: space-between; gap: 12px; margin: 7px 0 0;
                  font-size: 12px; color: var(--ink-soft); }
.peek-foot-note a { color: var(--ink-soft); white-space: nowrap; }
.peek-foot-note a:hover { color: var(--accent); }
a.peek-no { color: var(--ink); text-decoration: none; }
a.peek-no:hover code { color: var(--accent); text-decoration: underline; }
@media (max-width: 900px) { .peek { width: 100vw; } }

/* ------------------------------------------------ price/stock findings */

details.catalogue-coverage { margin: 4px 0 12px; }
details.catalogue-coverage > summary { font-weight: 600; font-size: 14px; }
details.catalogue-coverage > summary .muted { font-weight: 400; font-size: 13px; }
.findings { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.fchip {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 11px;
  border: 1px solid var(--line-strong); border-radius: 20px; background: var(--card);
  text-decoration: none; color: var(--ink-2); font-size: 13px;
}
.fchip .n { font-weight: 600; font-variant-numeric: tabular-nums; }
.fchip:hover { border-color: var(--ink-soft); color: var(--ink); }
.fchip.zero { color: var(--ink-soft); border-color: var(--line); }
.fchip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ------------------------------------------------------ SKU review form */

.review form .shoppick select { width: 128px; }
.review form .skufield input { width: 132px; }
.review form label.shoppick, .review form label.skufield { flex-basis: auto; }
.review form [role="status"]:empty { display: none; }

/* ------------------------------------------------------------ readiness */

.tiles.summary { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 8px; }
.tiles.summary .n { font-size: 20px; }
.tiles.summary .l { color: var(--ink-soft); }
.tiles.summary .tile.good { border-color: var(--ok-line); }
.tiles.summary .tile.good .n { color: var(--ok); }
.tiles.summary .tile.warn { border-color: var(--warn-line); }
.tiles.summary .tile.warn .n { color: var(--warn); }
.tiles.summary .tile.bad { border-color: var(--bad-line); }
.tiles.summary .tile.bad .n { color: var(--bad); }
.shopbox {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 16px; margin-bottom: 10px;
}
.shopbox[open] { padding-bottom: 14px; }
.shopbox > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; }
.shopbox > summary .shop { display: inline-flex; align-items: center; gap: 7px; }
.shopbox .grid { margin: 8px 0; }
.shopbox .note { display: block; font-size: 12px; color: var(--ink-soft); margin: 4px 0; }
.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 900px) {
  .tiles.summary, .formgrid { grid-template-columns: 1fr; }
}
.peek-body a { color: var(--accent); }

/* ------------------------------------------ head-office stock, owed items */

.hobox { margin: 12px 0 0; padding-top: 10px; border-top: 1px dashed var(--line-strong); }
.hobox h3 { font-size: 14px; font-weight: 600; margin: 0 0 6px; color: var(--bad);
            display: flex; align-items: center; gap: 6px; }
.hobox h3 span { font-weight: 400; font-size: 12px; color: var(--ink-soft); }
.hobox h3 + .hint { margin: -4px 0 6px; }
.hobox .grid + h3 { margin-top: 14px; color: var(--ink); }
.hobox .actions { margin-top: 10px; }
.hobox .where { white-space: nowrap; }
.holine { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.holine .i { width: 16px; height: 16px; }
.proposal .owedline td { background: var(--warn-soft); }
.pill.lock + .muted { font-size: 12px; }

.reflinks { font-size: 13px; }
button.copy {
  font: inherit; font-size: 11px; line-height: 1.4; cursor: pointer;
  padding: 0 7px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--ink-soft);
}
button.copy:hover { color: var(--ink); border-color: var(--ink-soft); }
.grid td a.pill, a.pill { text-decoration: none; border-bottom: 0; }
.grid td a.pill.bad, a.pill.bad { color: var(--bad); }
.grid td a.pill.bad:hover, a.pill.bad:hover { background: var(--bad-line); }

/* ------------------------------------------------------------ filter bar */
/* One row of combinable filters above a list (Orders, Returns). */

.filterbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
.filterbar input, .filterbar select {
  font: inherit; font-size: 13px; padding: 6px 10px; height: 34px;
  border: 1px solid var(--line-strong); border-radius: 7px; background: var(--card); color: var(--ink);
}
.filterbar input:focus, .filterbar select:focus { outline: none; border-color: var(--accent); }
.filterbar .fq { flex: 1 1 280px; min-width: 0; max-width: 460px; }
.filterbar select { padding-right: 26px; }
.filterbar .fdates { display: inline-flex; align-items: center; gap: 4px; }
.filterbar .fdates input { width: 142px; }
.fclear { font-size: 13px; color: var(--accent); white-space: nowrap; }
.filters.tight { margin-top: -4px; }
.chip.hot:not(.on) { border-color: var(--bad-line); color: var(--bad); }
.fsummary { font-size: 13px; color: var(--ink-soft); margin: 0 0 8px; }
.fsummary strong { color: var(--ink); }
.fsummary a { color: var(--ink-soft); text-decoration: none; margin-left: 2px; }
.fsummary a:hover { color: var(--accent); }
@media (max-width: 700px) {
  .filterbar .fq { flex-basis: 100%; max-width: none; }
  .filterbar select { flex: 1 1 40%; }
}

/* ZORT queue: what this send carries, line by line. */
.pickcell { white-space: nowrap; }
.pickcell .qty { width: 58px; font: inherit; font-size: 13px; padding: 3px 6px;
                 border: 1px solid var(--line-strong); border-radius: 6px; }
.pickcell .hint { display: block; }
.proposal .sentline td { color: var(--ink-soft); }
.sendform { flex-wrap: wrap; }
.sendform .agree { font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }

/* ------------------------------------------------------------ order page
   Redesigned 2 Oct 2026. A verdict says whether the order may go out; the
   work (items, shipping) runs down the left; money, customer and ZORT sit in
   a narrow column on the right. */

.odhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin: 0 0 12px; }
.odhead h1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.odhead h1 code { font-size: 19px; font-weight: 500; letter-spacing: 0; }
.odhead h1 .plat { vertical-align: 0; }
.odmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 13px; }
.odmeta .muted { margin-left: 4px; }
.odactions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.verdict {
  display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 11px 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--mute); color: var(--ink-soft);
}
.verdict > .i { width: 26px; height: 26px; stroke-width: 1.9; }
.verdict .vtext { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 12px; line-height: 1.5; }
.verdict .vtext strong { font-size: 16px; font-weight: 600; }
.verdict .vtext span { font-size: 13px; color: var(--ink-2); }
.verdict .vfig { margin: 0 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.35; }
.verdict .vfig span { font-size: 12px; }
.verdict .vfig strong { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.verdict.ship { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.verdict.wait { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.verdict.check { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }

.odgrid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.odmain, .odside { display: grid; gap: 14px; min-width: 0; }
.odside { position: sticky; top: 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 13px 16px 14px; min-width: 0; }
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; }
.cardhead h2 { margin: 0; font-size: 15px; }
.card .explain { max-width: none; }
.card details > summary { font-size: 13px; color: var(--accent); }

/* A table inside a card: no box of its own, edges aligned with the card's. */
.grid.flat { border: 0; border-radius: 0; background: transparent; }
.grid.flat th { background: transparent; padding-top: 4px; }
.grid.flat th:first-child, .grid.flat td:first-child { padding-left: 0; }
.grid.flat th:last-child, .grid.flat td:last-child { padding-right: 0; }
.grid.flat tr:last-child td { border-bottom: 0; }
.items .num.qty, .owedbox .num.qty { color: var(--ink); font-weight: 600; }
.items td .pill { margin-left: 4px; }

.buyernote {
  display: flex; gap: 10px; align-items: baseline; margin: 0 0 8px; padding: 7px 12px;
  background: var(--note-soft); border: 1px solid var(--note-line); border-radius: 8px; font-size: 13px;
}
.buyernote strong { white-space: nowrap; font-weight: 600; }
details.revisions { margin-top: 8px; }

.quiet { margin: 0; font-size: 13px; color: var(--ink-soft); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.quiet a { color: var(--accent); }

.card .steps { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.card .steps li { background: var(--bg); border-color: var(--line-2); }

.owedbox.attn { border-left: 4px solid var(--warn); }
.owedsum { margin: 0 0 4px; font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.owedsum strong { color: var(--warn); }
.owedsum a { color: var(--accent); }
.owedclose { margin-top: 10px; }
details.shipnow { margin: 10px 0 0; padding-top: 6px; border-top: 1px dashed var(--line-strong); }
details.shipnow[open] > summary { margin-bottom: 4px; }
.owedform .qty { width: 64px; font: inherit; font-size: 13px; padding: 3px 6px;
                 border: 1px solid var(--line-strong); border-radius: 6px; }
.owedfields, .owedsubmit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 10px 0 0; font-size: 13px; }
.owedfields label { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); }
.owedfields label.grow { flex: 1 1 280px; }
.owedfields label.grow input { flex: 1; min-width: 0; }
.owedfields input { font: inherit; font-size: 13px; padding: 5px 9px; border: 1px solid var(--line-strong);
                    border-radius: 6px; background: var(--card); color: var(--ink); }
.owedfields input:focus { outline: none; border-color: var(--accent); }
.owedsubmit .agree { display: inline-flex; align-items: center; gap: 6px; }

.paid { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 4px; }
.paid span { font-size: 13px; color: var(--ink-soft); }
.paid strong { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
dl.facts { margin: 0; display: grid; }
dl.facts div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
               padding: 5px 0; border-top: 1px solid var(--line-2); font-size: 13px; }
dl.facts dt { color: var(--ink-soft); white-space: nowrap; }
dl.facts dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 1100px) {
  .odgrid { grid-template-columns: minmax(0, 1fr); }
  .odside { position: static; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: start; }
}
@media (max-width: 600px) {
  .odhead { flex-direction: column; }
  .verdict { flex-wrap: wrap; }
  .verdict .vfig { margin-left: 38px; align-items: flex-start; }
  .card { padding: 12px; }
  /* On a phone the item list fits the card instead of scrolling inside it:
     the price per piece goes (the line total stays), codes may wrap. */
  .card .grid.flat.items { display: table; }
  .items th:nth-child(4), .items td:nth-child(4) { display: none; }
  .items td { padding-left: 6px; padding-right: 6px; }
  .items code { overflow-wrap: anywhere; }
  .buyernote { flex-direction: column; gap: 2px; }
}

/* The circled (i): an explanation behind a hover, focus or tap
   (owner, 27 Sep 2026), so it does not push the work down the page. */
.info-i {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; flex-shrink: 0; vertical-align: middle;
  border: 1.5px solid var(--line-strong); border-radius: 50%; color: var(--ink-soft);
  font: italic 600 10.5px/1 Georgia, "Times New Roman", serif; cursor: help; user-select: none;
}
.info-i:hover, .info-i:focus-visible, .info-i:focus { border-color: var(--accent); color: var(--accent); outline: none; }
.info-pop {
  display: none; position: absolute; z-index: 50; right: -8px; top: calc(100% + 8px);
  width: max-content; max-width: min(340px, 80vw); padding: 9px 12px;
  background: var(--card); color: var(--ink-2); border: 1px solid var(--line-strong); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(47, 32, 35, 0.14);
  font: 400 12.5px/1.6 "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif; text-align: left; white-space: normal;
}
.info-pop::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.info-i:hover .info-pop, .info-i:focus .info-pop, .info-i:focus-within .info-pop { display: block; }

/* Connecting Facebook + Instagram: one pasted Page token. */
.meta-connect { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.meta-connect input { font: inherit; font-size: 12px; padding: 4px 8px; min-width: 0; flex: 1 1 160px;
  border: 1px solid var(--line); border-radius: 6px; }
.bubble .mimg { max-height: 280px; width: auto; }
.bubble .mfile { display: inline-block; margin: 2px 0 6px; }

/* Chat choice 3: a waiting queue, conversation, and on-demand reply tools. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.page main:has(.chat-desk) { max-width: none; padding: 16px; }
.shell:has(.chat-desk) { grid-template-columns: 180px minmax(0, 1fr); }
.shell:has(.chat-desk) .side { padding-left: 12px; padding-right: 12px; }
.chat-desk { grid-template-columns: 390px minmax(320px, 1fr); gap: 0; height: calc(100dvh - 32px); min-height: 520px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.chat-desk:has(.chat-tools) { grid-template-columns: 390px minmax(320px, 1fr) 400px; }
.chat-desk :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.chat-desk .convlist { padding: 12px 0 8px; border-right: 1px solid var(--line); max-height: none; background: var(--bg); min-width: 0; }
.queue-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 16px; gap: 12px; }
.queue-head h1 { margin: 0; font-size: 20px; font-weight: 600; }
.queue-head > span { color: var(--ink-soft); font-size: 12.5px; }
.chat-search { padding: 8px 14px; display: grid; gap: 6px; }
.chat-search input, .chat-search select, .tool-search input, .tool-search select, .tool-note-form textarea { width: 100%; min-width: 0; font: inherit; font-size: 13px; padding: 5px 9px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--card); color: var(--ink); }
.queue-selects { display: flex; gap: 6px; }
.queue-selects select { font-size: 12.5px; padding: 4px 6px; }
/* The search box carries its own magnifier; the selects apply on change. */
.chat-find { position: relative; }
.chat-find input { padding-right: 34px; }
.chat-find-btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 30px; height: 28px;
  display: flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--ink-soft); cursor: pointer; border-radius: 6px; }
.chat-find-btn:hover { color: var(--accent); }
.chat-find-btn .i { width: 16px; height: 16px; }
.chat-desk .convlist > .filters { padding: 0 14px; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.chat-desk .convlist > .filters .chip { font-size: 12px; padding: 1px 8px; }
.queue-group { font-size: 12.5px; color: var(--ink-soft); background: var(--head); margin: 0; padding: 4px 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-weight: 500; }
.queue-group.urgent { color: var(--accent); background: var(--accent-soft); }
.chat-desk .conv { display: flex; gap: 9px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; margin: 0; padding: 9px 14px; background: transparent; }
.chat-desk .conv:hover { background: var(--hover); }
.chat-desk .conv.active { background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.chat-desk .conv.unread::after { display: none; }
.chat-avatar { display: flex; align-items: center; justify-content: center; flex: 0 0 32px; height: 32px; border-radius: 50%; background: var(--chip); color: var(--accent); font-weight: 600; font-size: 12px; }
.conv-body { flex: 1; min-width: 0; }
.chat-desk .cname { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-desk .cprev { display: block; margin: 1px 0 4px; font-size: 13px; }
.chat-desk .cmeta { font-size: 11.5px; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.chat-desk .conv .plat { font-size: 11px; }
.waiting { color: var(--accent); font-size: 12px; flex-shrink: 0; }
.unread-label { color: var(--accent); font-weight: 500; }
.platform-queue summary { padding: 12px 16px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.chat-desk .thread { position: relative; min-width: 0; min-height: 0; border: 0; border-radius: 0; }
.chat-desk .thead { flex-shrink: 0; padding: 12px 18px; align-items: flex-start; }
.chat-desk .thead h2 { font-size: 17px; line-height: 1.6; }
.chat-desk .thead .plat { font-size: 12px; }
.owner-label { color: var(--ink-soft); margin: 3px 0 0; font-size: 13px; }
.chat-back, .mobile-tools, .tool-close { display: none; }
.chat-desk .ordercards { flex-shrink: 0; padding: 10px 20px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chat-desk .messages { min-height: 0; padding: 18px 20px; gap: 14px; background: var(--card); overflow-anchor: none; }
.chat-day { color: var(--ink-soft); text-align: center; font-size: 12px; margin: 2px 0; }
.chat-desk .msg { flex-shrink: 0; flex-wrap: wrap; gap: 4px; }
.chat-desk .bubble { max-width: 88%; font-size: 15px; padding: 8px 13px; border-radius: 10px; }
.message-sender { display: block; font-size: 12px; font-weight: 500; color: var(--ink-soft); margin-bottom: 4px; }
.chat-desk .bubble .stamp, .chat-desk .senderr { font-size: 12px; }
.chat-desk .bubble .stamp { margin-top: 5px; }
.jump-latest { position: absolute; bottom: 240px; right: 20px; background: var(--card); box-shadow: 0 2px 10px #25222615; }
.jump-latest[hidden] { display: none; }
.canned-menu { padding: 9px 20px; border-top: 1px solid var(--line); flex-shrink: 0; }
.canned-menu summary { font-size: 13px; color: var(--accent); cursor: pointer; }
.chat-desk .canned { padding: 8px 0 0; }
.chat-desk .composer { display: block; flex-shrink: 0; padding: 10px 20px 16px; border-top: 1px solid var(--line); background: var(--bg); }
.chat-desk .composer label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.chat-desk .composer textarea { display: block; width: 100%; font-size: 15px; background: var(--card); resize: none; min-height: 96px; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; }
.composer-actions .btn { flex-shrink: 0; }
.chat-welcome { margin: auto; padding: 30px; max-width: 480px; }
.chat-welcome h2 { font-size: 19px; margin: 0 0 8px; }
.chat-welcome p { color: var(--ink-soft); margin: 0; }
.chat-tools { border-left: 1px solid var(--line); background: var(--bg); padding: 20px 16px; overflow-y: auto; min-width: 0; }
.tool-tabs { display: flex; border-bottom: 1px solid var(--line-strong); gap: 4px; }
.tool-tabs button { font: inherit; font-size: 13px; border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; padding: 8px 5px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tool-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
#chat-tool-status:empty { display: none; }
#chat-tool-status { margin-top: 10px; }
.tool-hint { color: var(--ink-soft); font-size: 12px; line-height: 1.7; }
.tool-search { display: grid; gap: 7px; margin: 16px 0 12px; }
.tool-search label, .tool-note-form label { font-size: 13px; font-weight: 500; }
.tool-search .btn { justify-self: start; margin-top: 3px; }
.tool-order, .tool-product, .internal-note { padding: 16px 0; border-top: 1px solid var(--line-strong); }
.tool-order p { margin: 7px 0; font-size: 13px; }
.tool-line { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; flex-wrap: wrap; }
.tool-line strong { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.order-product .tool-hint { display: block; }
.tool-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.tool-actions .btn { font-size: 13px; padding: 6px 8px; }
.tool-link-form { display: grid; gap: 8px; margin-top: 14px; }
.tool-link-form label { font-size: 12px; }
.tool-link-form .btn { justify-self: start; }
.product-heading { display: flex; gap: 12px; align-items: flex-start; }
.product-heading img { width: 100px; height: 104px; border-radius: 6px; object-fit: contain; background: var(--card); border: 1px solid var(--line); }
.product-heading > div { min-width: 0; }
.product-heading h3 { font-size: 17px; margin: 0; line-height: 1.6; font-weight: 600; }
.product-heading p { margin: 4px 0; font-size: 13px; }
.product-heading .tool-hint { font-size: 12px; }
.product-price { font-size: 17px; font-weight: 600; }
.stock-result:not(:empty) { background: var(--card); border: 1px solid var(--line); border-radius: 8px; margin-top: 12px; padding: 12px; }
.stock-result h4 { margin: 0 0 9px; font-size: 13px; font-weight: 500; }
.stock-locations { margin: 0; }
.stock-locations > div { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.stock-locations dd { margin: 0; text-align: right; color: var(--ok); font-weight: 500; }
.stock-locations small { display: block; color: var(--ink-soft); font-size: 11px; font-weight: 400; }
.tool-note-form { display: grid; gap: 8px; margin: 16px 0; }
.tool-note-form textarea { resize: vertical; }
.tool-note-form .btn { justify-self: start; }
.internal-note > strong { font-size: 13px; }
.internal-note > span { display: block; }
.internal-note p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; margin: 8px 0 0; }
[aria-busy=true] { opacity: .65; }
@media (max-width: 1400px) { .chat-desk:has(.chat-tools) { grid-template-columns: 300px minmax(300px, 1fr) 350px; } }
@media (max-width: 1300px) {
  .chat-desk:has(.chat-tools) { grid-template-columns: 270px minmax(300px, 1fr) 320px; }
  .chat-desk .thead, .chat-desk .messages, .chat-desk .ordercards { padding-left: 16px; padding-right: 16px; }
  .chat-desk .composer { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 1120px) {
  .chat-desk, .chat-desk:has(.chat-tools) { grid-template-columns: 270px minmax(0, 1fr); }
  .chat-desk .chat-tools { display: none; position: fixed; right: 16px; top: 16px; bottom: 16px; width: min(390px, calc(100vw - 32px)); z-index: 45; box-shadow: -8px 0 32px #25222624; border: 1px solid var(--line); border-radius: 12px; }
  .chat-desk.tools-open .chat-tools { display: block; }
  .mobile-tools { display: block; align-self: flex-end; margin: 6px 16px 0; flex-shrink: 0; }
  .tool-close { display: block; margin-top: 12px; }
}
@media (max-width: 900px) {
  .shell:has(.chat-desk) { display: block; }
  .page main:has(.chat-desk) { padding: 10px; }
  .chat-desk { height: calc(100dvh - 76px); min-height: 0; }
  .chat-desk, .chat-desk:has(.chat-tools) { grid-template-columns: 250px minmax(0, 1fr); }
  .chat-desk .chat-tools { top: 66px; bottom: 10px; }
}
@media (max-width: 680px) {
  .chat-desk, .chat-desk:has(.chat-tools) { grid-template-columns: minmax(0, 1fr); border-radius: 8px; }
  .chat-desk.has-thread .convlist { display: none; }
  .chat-desk:not(.has-thread) .thread { display: none; }
  .chat-desk .convlist { border-right: 0; }
  .chat-back { display: block; font-size: 12px; color: var(--accent); margin-bottom: 5px; }
  .chat-desk .thead { min-height: auto; padding: 12px; gap: 6px; }
  .chat-desk .thead h2 { font-size: 17px; }
  .chat-desk .messages { padding: 12px; }
  .chat-desk .bubble { max-width: 94%; font-size: 14px; }
  .chat-desk .composer { padding: 10px 12px 12px; }
  .composer-actions .tool-hint { max-width: 160px; }
  .chat-desk .ordercards { padding: 8px 12px; }
  .chat-desk .chat-tools { top: 66px; right: 10px; width: calc(100vw - 20px); }
  .canned-menu { padding: 8px 12px; }
  .jump-latest { bottom: 220px; }
}
.stock-locations dd.unknown { color: var(--ink-soft); }
.stock-locations dd.zero { color: var(--warn); }
/* Feedback and the demo banner share the page height with the desk. */
.page main:has(.chat-desk) { display: flex; flex-direction: column; height: 100dvh; gap: 10px; }
.page main:has(.chat-desk) > p { margin: 0; flex-shrink: 0; }
.page main:has(.chat-desk) .chat-desk { height: auto; min-height: 0; flex: 1; }
.chat-demo { padding: 6px 12px; border: 1px solid var(--warn-line); background: var(--warn-soft); color: var(--warn); border-radius: 6px; font-size: 12px; }
@media (max-width: 900px) { .page main:has(.chat-desk) { height: calc(100dvh - 56px); } }
/* The queue carries enough preview text; tools stay usable above the fold. */
.tool-head { position: sticky; top: -20px; z-index: 2; background: var(--bg); padding: 10px 0 0; margin-top: -10px; }
.tool-head h2 { font-size: 17px; margin: 0 0 8px; }
.tool-query-line { display: flex; gap: 8px; }
.tool-query-line .btn { margin: 0; flex-shrink: 0; }
.tool-source { display: flex; gap: 10px; align-items: center; margin-top: 3px; }
.tool-source label { white-space: nowrap; font-weight: 400; color: var(--ink-soft); }
.tool-source select { flex: 1; }
@media (max-width: 680px) and (max-height: 650px) {
  /* Keep reply controls reachable when the usable phone height is short.
     Full order context remains available in the tools drawer. */
  .chat-desk .ordercards { display: none; }
  .chat-desk .thead { padding: 8px 12px; }
  .chat-desk .owner-label { display: none; }
  .chat-desk .composer textarea { min-height: 64px; max-height: 100px; }
  .chat-desk .composer-actions .tool-hint { display: none; }
  .chat-desk .canned-menu { padding: 6px 12px; }
  .chat-desk .canned { max-height: 64px; overflow-y: auto; }
}

/* ----------------------------------------------------------------- phone
   3 Oct 2026: every screen fits a phone, without a table to scroll sideways
   (the owner's rule for all screens: every column visible). Four pieces:
   1. the five work queues along the bottom, in thumb reach (base.html);
   2. up to 900px, a table of four or more columns becomes one card per row,
      each value beside its column's heading — base.html copies the headings
      into the cells, so screens need no phone markup of their own;
   3. the order list as three-line cards, the one list read on the move;
   4. on a touch screen, buttons a thumb can hit, and fields at 16px — below
      that, an iPhone zooms the whole page in at every tap on a field. */

.tabbar, .findbtn { display: none; }

@media (max-width: 900px) {
  .mobilebar .findbtn { display: flex; margin-left: auto; }
  .shell { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .side {
    height: 100dvh; padding-left: calc(12px + env(safe-area-inset-left));
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: var(--side); border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgba(47, 32, 35, 0.06);
  }
  .tab {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1px; height: 56px; min-width: 0; text-decoration: none;
    color: var(--ink-soft); font-size: 11px; line-height: 1.45;
  }
  .tab .i { width: 22px; height: 22px; }
  .tab .tlabel { max-width: 100%; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tab.on { color: var(--accent); font-weight: 600; }
  .tab.on::before {
    content: ""; position: absolute; top: -1px; left: 26%; right: 26%; height: 2px;
    border-radius: 0 0 2px 2px; background: var(--accent);
  }
  .tbadge {
    position: absolute; top: 4px; left: calc(50% + 5px);
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; border: 1.5px solid var(--side);
    font-size: 11px; font-weight: 600; line-height: 15px; text-align: center; font-variant-numeric: tabular-nums;
    background: var(--chip); color: var(--ink-2);
  }
  .tbadge.hot { background: var(--accent); color: #fff; }
  .page main { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .peek-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  /* Inside a conversation the reply box needs the room, and "back" leads out. */
  .shell:has(.chat-desk.has-thread) .tabbar { display: none; }
  .page main:has(.chat-desk:not(.has-thread)) { height: calc(100dvh - 52px - 57px - env(safe-area-inset-bottom)); }
}

@media (max-width: 900px) {
  /* A long introduction folds to two lines; a tap opens it (base.html). */
  .lede { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; cursor: pointer; }
  .lede.open { display: block; overflow: visible; }

  /* Tables as cards. The heading floats into the cell's left padding, so a
     heading of two lines makes its row taller instead of running into the
     next one. */
  table.grid.stack { display: block; overflow: visible; min-width: 0; }
  table.grid.stack > thead { display: none; }
  table.grid.stack > tbody { display: block; }
  table.grid.stack > tbody > tr { display: block; padding: 8px 12px; border-bottom: 1px solid var(--line-2); }
  table.grid.stack > tbody > tr:last-child { border-bottom: 0; }
  table.grid.stack > tbody > tr > td {
    display: flow-root; width: auto; height: auto; max-width: none; min-width: 0; white-space: normal;
    padding: 3px 0 3px 112px; border: 0; background: transparent; box-shadow: none;
    text-align: left; overflow-wrap: anywhere;
  }
  table.grid.stack > tbody > tr > td::before {
    content: attr(data-label); float: left; width: 102px; margin-left: -112px;
    font-size: 12px; line-height: 1.5; padding-top: 1px; color: var(--ink-soft); overflow-wrap: normal;
  }
  table.grid.stack > tbody > tr > td:not([data-label]) { padding-left: 0; }
  table.grid.stack > tbody > tr > td:not([data-label])::before { content: none; }
  table.grid.stack > tbody > tr > td:empty { display: none; }
  table.grid.stack > tbody > tr > td[colspan] { padding: 18px 0; text-align: center; }
  /* A table that stays a table wraps a long code or address instead of
     pushing past the screen edge. */
  .grid td code { overflow-wrap: anywhere; }
  table.grid.stack .pill { white-space: normal; max-width: 100%; }
  table.grid.stack form { min-width: 0; }
  table.grid.stack.review form :is(label.shoppick, label.skufield) { flex: 1 1 100%; }
  table.grid.stack.review form :is(.shoppick select, .skufield input) { width: 100%; }
  table.grid.flat.stack > tbody > tr { padding-left: 0; padding-right: 0; }
  /* What a coloured row meant in the table, the whole card carries. */
  table.grid.stack > tbody > tr.done { background: var(--ok-soft); color: var(--ok); }
  table.grid.stack > tbody > tr.done.muted { background: var(--mute); color: var(--ink-soft); }
  .proposal table.grid.stack > tbody > tr.owedline { background: var(--warn-soft); }
}

@media (max-width: 1100px) {
  /* The order list: platform, number and amount; date, buyer, pieces and
     payment; then the states. The two empty breaks start lines two and three.
     Up to 1100px, because beside the menu ten columns no longer fit. */
  table.grid.cards { display: block; overflow: visible; }
  table.grid.cards > thead { display: none; }
  table.grid.cards > tbody { display: block; }
  table.grid.cards > tbody > tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px;
    padding: 10px 12px 11px 15px; border-bottom: 1px solid var(--line-2);
  }
  table.grid.cards > tbody > tr:last-child { border-bottom: 0; }
  table.grid.cards > tbody > tr::before,
  table.grid.cards > tbody > tr::after { content: ""; flex-basis: 100%; height: 0; }
  table.grid.cards > tbody > tr::before { order: 4; }
  table.grid.cards > tbody > tr::after { order: 9; }
  table.grid.cards > tbody > tr > td {
    display: block; padding: 0; border: 0; background: transparent; box-shadow: none; min-width: 0;
  }
  table.grid.cards > tbody > tr > td[colspan] { flex-basis: 100%; padding: 18px 0; text-align: center; }
  .orders .c-plat { order: 1; }
  .orders .c-no { order: 2; flex: 1 1 0; overflow-wrap: anywhere; }
  .orders .c-amt { order: 3; color: var(--ink); font-weight: 600; font-size: 14px; }
  .orders .c-date { order: 5; }
  .orders .c-buyer { order: 6; }
  .orders .c-units { order: 7; }
  .orders :is(.c-date, .c-buyer, .c-units) { color: var(--ink-soft); font-size: 12.5px; }
  .orders :is(.c-buyer, .c-units)::before { content: "·"; margin-right: 6px; }
  .orders .c-units::after { content: " ชิ้น"; }
  .orders .c-pay { order: 8; margin-left: auto; }
  .orders .c-status { order: 10; }
  .orders .c-ship { order: 11; }
  .orders .c-zort { order: 12; }
  .orders .c-zort::before { content: "ZORT"; margin-right: 4px; font-size: 12px; color: var(--ink-soft); }
  .orders :is(.c-status, .c-ship, .c-zort) { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
  .orders :is(.c-pay, .c-ship):has(> .muted:only-child) { display: none; }
  .orders code.tiny { display: inline; }
  .orders tr.ch-shopify { box-shadow: inset 3px 0 0 var(--ch-shopify); }
  .orders tr.ch-lazada { box-shadow: inset 3px 0 0 var(--ch-lazada); }
  .orders tr.ch-shopee { box-shadow: inset 3px 0 0 var(--ch-shopee); }
  .orders tr.ch-tiktok { box-shadow: inset 3px 0 0 var(--ch-tiktok); }
  .orders tr.peekable:hover { background: var(--hover); }
  .orders tr.peekable.sel { background: var(--accent-soft); }
}

@media (pointer: coarse) {
  .btn { padding-top: 9px; padding-bottom: 9px; }
  .btn.sm { padding-top: 7px; padding-bottom: 7px; }
  .chip, .fchip, .filters.tight .chip, .chat-desk .convlist > .filters .chip { padding-top: 5px; padding-bottom: 5px; }
  button.copy { padding: 3px 9px; }
  /* !important because many screens size their own fields at 12–13px. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea { font-size: 16px !important; }
  .filterbar input, .filterbar select, .find { height: 42px; }
  .find kbd, .pointer-hint { display: none; }
  .info-i::after { content: ""; position: absolute; inset: -12px; }
}

/* -------------------------------------------------------------- chat desk
   3 Oct 2026: each marketplace's reply clock, staff status, pass-on /
   snooze / close, the "/" reply picker, the send check and the reply
   library page. Red means the marketplace's time is up or under an hour
   away; ochre under three hours; otherwise quiet. */

.clock {
  display: inline-block; font-size: 11.5px; line-height: 1.5; padding: 0 7px; border-radius: 20px;
  background: var(--mute); color: var(--ink-soft); white-space: nowrap;
}
.clock.late, .clock.urgent { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.clock.soon { background: var(--warn-soft); color: var(--warn); }
.clockline { display: flex; align-items: flex-start; gap: 6px; margin: 3px 0 0; font-size: 13px; line-height: 1.55; color: var(--ink-soft); }
.clockline > span { min-width: 0; }
.clockline .i { width: 15px; height: 15px; margin-top: 2px; }
.clockline .info-i { margin-top: 2px; }
/* The header's text takes the room; its buttons drop below it when the
   middle column is narrow, instead of squeezing the clock into a column. */
.chat-desk .thead { flex-wrap: wrap; row-gap: 8px; }
.chat-desk .thead > div:first-child { flex: 1 1 220px; min-width: 0; }
.clockline.late, .clockline.urgent { color: var(--bad); font-weight: 600; }
.clockline.soon { color: var(--warn); }

.sdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 4px 1px 0; background: var(--line-strong); vertical-align: middle; }
.sdot.online { background: var(--ok); }
.sdot.break { background: var(--warn); }

.thead-actions { display: flex; align-items: flex-start; gap: 6px; flex-shrink: 0; }
.thead-actions form { margin: 0; }
.desk-menu { position: relative; }
.desk-menu > summary.btn { list-style: none; padding-top: 4px; padding-bottom: 4px; }
.desk-menu > summary::-webkit-details-marker { display: none; }
/* Opens in place, under the buttons: the chat column clips anything that
   floats out of it, and the column can be narrow. */
.thead-actions { flex-wrap: wrap; }
.thead-actions:has(.desk-menu[open]) { flex-basis: 100%; }
.desk-menu[open] { flex: 1 1 100%; }
.desk-pop {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px;
  margin-top: 8px; padding: 2px 14px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px;
}
.desk-form { display: grid; gap: 7px; align-content: start; padding: 12px 0; margin: 0; font-size: 13px; }
.desk-form label { display: grid; gap: 4px; color: var(--ink-soft); }
.desk-form label.opt { display: flex; align-items: center; gap: 7px; color: var(--ink-2); flex-wrap: wrap; }
.desk-form label.confirm { color: var(--warn); }
.desk-form fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 5px; }
.desk-form legend { padding: 0; margin-bottom: 4px; color: var(--ink-soft); }
.desk-form :is(select, input:not([type="radio"]):not([type="checkbox"])) {
  font: inherit; font-size: 13px; padding: 5px 9px; border: 1px solid var(--line-strong);
  border-radius: 6px; background: var(--card); color: var(--ink); min-width: 0;
}
.desk-form .btn { justify-self: start; }
.desk-form .hint { margin: 0; }

.thread-state {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin: 0; padding: 8px 20px; font-size: 13px; background: var(--mute); color: var(--ink-2);
  border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.thread-state.due { background: var(--warn-soft); color: var(--warn); }

.composer-box { position: relative; }
.slash-pop {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 30; max-height: 280px; overflow-y: auto;
  padding: 4px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(47, 32, 35, 0.16);
}
.slash-pop[hidden] { display: none; }
.slash-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; width: 100%; text-align: left;
  font: inherit; padding: 7px 10px; border: 0; border-radius: 7px; background: none; color: var(--ink); cursor: pointer;
}
.slash-item strong { font-size: 13px; font-weight: 600; }
.slash-item code { font-size: 12px; color: var(--accent); }
.slash-item span { grid-column: 1 / -1; font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slash-item.on, .slash-item:hover { background: var(--accent-soft); }

.guard-box {
  margin: 10px 0 0; padding: 10px 12px; border: 1px solid var(--warn-line); border-radius: 8px;
  background: var(--warn-soft); color: var(--warn); font-size: 13px;
}
.guard-box[hidden] { display: none; }
.guard-box ul { margin: 6px 0 8px; padding-left: 18px; color: var(--ink-2); }
.guard-box code { overflow-wrap: anywhere; }
.guard-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.queue-links { margin: -6px 16px 10px; font-size: 12px; }
.queue-links a { color: var(--ink-soft); }
.queue-links a:hover { color: var(--accent); }
.canned .manage { align-self: center; font-size: 12px; color: var(--ink-soft); margin-left: 4px; }
.canned .sug.mine { border-style: dashed; }

/* Status in the side menu: three buttons, the current one filled. */
.deskstatus { display: flex; align-items: center; gap: 4px; margin: 0; padding: 0 6px; flex-wrap: wrap; }
.deskstatus .dslabel { font-size: 12px; color: var(--ink-soft); margin-right: 2px; }
.dsbtn {
  font: inherit; font-size: 12px; line-height: 1.5; padding: 2px 9px; border-radius: 20px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink-soft);
}
.dsbtn:hover { color: var(--ink); border-color: var(--ink-soft); }
.dsbtn.on.online { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); font-weight: 600; }
.dsbtn.on.break { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); font-weight: 600; }
.dsbtn.on.off { background: var(--mute); border-color: var(--line-strong); color: var(--ink-2); font-weight: 600; }

/* The reply library page. */
.replies-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.grid.replies .rbody { white-space: pre-line; max-width: 46ch; color: var(--ink-2); }
.grid.replies tr.sel td { background: var(--accent-soft); }
.grid td.act .inline-form, .inline-form { display: inline; margin: 0; }
.grid td.act .btn.ghost { color: var(--ink-2); }
.grid td.act .btn.ghost.danger { color: var(--bad); }
.reply-form { position: sticky; top: 16px; }
.confirmform.wide { max-width: none; margin-top: 4px; }
.confirmform.wide textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.confirmform fieldset.scope { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.confirmform fieldset.scope legend { width: 100%; padding: 0; margin-bottom: 4px; color: var(--ink-soft); }
.confirmform label.opt { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.placeholders { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.placeholders .hint { margin: 0 4px 0 0; }
.phrase-form input[name="phrase"] { min-width: 220px; }
.phrase-form input[name="reason"] { min-width: 240px; }

@media (max-width: 900px) {
  .replies-layout { grid-template-columns: minmax(0, 1fr); }
  .reply-form { position: static; }
  .thead-actions { flex-direction: column; align-items: flex-end; }
}
@media (max-width: 680px) {
  .chat-desk .thead { flex-wrap: wrap; }
  .thead-actions { flex-direction: row; width: 100%; justify-content: flex-start; }
  .thread-state { padding: 8px 12px; }
  .phrase-form input { min-width: 0 !important; flex: 1 1 100%; }
}

/* SKU decisions: source context and complete recipes. */
.sku-thumb { width: 64px; height: 64px; object-fit: contain; border-radius: 6px; float: left; margin: 0 10px 8px 0; }
.recipe-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.component-row { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 12px 0; }
.component-row input[type=number] { width: 100px; }
.reply-classification { font-size: 12px; margin: 6px 0; }
.source-handoff { padding: 8px 12px; }
@media (max-width: 600px) { .recipe-compare { grid-template-columns: 1fr; } }

.sku-filters { align-items: end; gap: 10px 14px; }
.sku-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.sku-filters input, .sku-filters select, #component-form input, #component-form select {
  font: inherit; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink);
}
.sku-filters input { width: 210px; }
.sku-filters select { max-width: 230px; }
.review .batch-pick { display: flex; align-items: center; gap: 5px; margin: 0 0 5px; }
.review input[type=checkbox] { width: auto; margin: 0; }
.review .num { min-width: 100px; white-space: nowrap; }
@media (max-width: 900px) {
  .sku-filters label { flex: 1 1 150px; }
  .sku-filters input, .sku-filters select { width: 100%; max-width: 100%; }
}

/* Users page (admin_users.html): each row is one person's form. */
table.users :is(select, input.name) {
  font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--card); max-width: 100%;
}
table.users input.name { width: 100%; min-width: 8rem; box-sizing: border-box; }
table.users .who small { overflow-wrap: anywhere; }
@media (max-width: 760px) { table.users input.name { min-width: 0; } }
table.users :is(select, input):focus { outline: none; border-color: var(--accent); }
table.users .who small { display: block; color: var(--ink-soft); font-size: 12px; }
table.users tr.pending td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.role-can { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.role-can ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
