/* Ordo seller platform.
   Mobile-first: the seller is on a phone, standing at a table, in the evening.
   Section 21.6 drives the packing screen's type sizes — they are large on
   purpose, not by accident.

   The palette is fixed. Every colour token below is the one the product
   shipped with; the work in this file is hierarchy, rhythm, depth and
   feedback, never hue. If you are changing a hex here, you are in the wrong
   file. */

/* Fonts are served from here, not a font CDN: the app is used on patchy
   mobile data, and Sinhala text in the phone's old system font was what
   sellers called out as dated. Both are SIL Open Font License. */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("/seller/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Noto Sans Sinhala"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("/seller/fonts/noto-sans-sinhala.woff2") format("woff2");
  unicode-range: U+0964-0965, U+0D81-0DF4, U+1CF2, U+200C-200D, U+25CC, U+111E1-111F4;
}

:root {
  --ink: #12211f;
  --ink-soft: #5b6b68;
  --line: #dfe5e3;
  --bg: #f6f8f7;
  --card: #ffffff;
  --brand: #0f3d3e;
  --brand-soft: #e6efee;
  --accent: #b4530a;
  --ok: #1f7a44;
  --warn: #a8730b;
  --danger: #b3261e;

  /* Tinted backings for the status pills. They were inline hex values that
     only existed in the light theme, so a warning pill in dark mode kept a
     cream background behind amber text. */
  --warn-soft: #fdf1dc;
  --danger-soft: #fbe6e4;
  --ok-soft: #e2f3e9;

  /* One spacing scale, 4px based. The previous stylesheet used 6, 8, 9, 10,
     11, 12 and 14px inside a single card, which is why nothing quite lined
     up with anything else. */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;

  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --tabbar-h: 62px;

  /* Three elevations. Everything used to be a flat 1px border, so a card, a
     sheet and the navigation all sat on the same plane and the eye had
     nothing to order them by. */
  --e1: 0 1px 2px rgba(18, 33, 31, 0.05), 0 1px 1px rgba(18, 33, 31, 0.04);
  --e2: 0 2px 4px rgba(18, 33, 31, 0.05), 0 4px 12px rgba(18, 33, 31, 0.06);
  --e3: 0 8px 24px rgba(18, 33, 31, 0.1), 0 2px 6px rgba(18, 33, 31, 0.06);

  /* A focus ring that sits outside the border without moving the element.
     `outline-offset` made every field visibly jump when it was focused. */
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);

  --tap: 44px; /* Minimum comfortable touch target. */
  /* Text size chosen in Settings. Every font-size is multiplied by it. */
  --fs: 1;
  /* Filled surfaces are tints, not the dark brand colour: sellers found the
     solid dark buttons and chat bubbles heavy on a bright phone screen. */
  --fill: #dcefea; --fill-hover: #cce7e0; --fill-ink: #0b4a47; --fill-line: #b9dcd4;
  /* Switches, radio dots and meters: a clear mid teal, never the near-black brand. */
  --on: #2bb39a;
  /* Chart series: one hue, validated (>= 3:1 on the card, inside the lightness band). */
  --viz-1: #1a9580; --viz-grid: #e6ebea; --viz-base: #c5cfcd;
  --bubble-out: #e3f3ee; --bubble-out-ink: #12211f;
  --cod: #fff3e6; --cod-ink: #9a4508; --cod-line: #f5c79c;

}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8efed; --ink-soft: #9bada9; --line: #2a3634;
    --bg: #101917; --card: #17221f; --brand: #7fd1c8;
    --brand-soft: #1d2c2a; --accent: #e59a5b; --ok: #63c48d;
    --warn: #d9ad55; --danger: #f08a82;
    --warn-soft: #33290f; --danger-soft: #3a1f1d; --ok-soft: #16301f;
    --e1: 0 1px 2px rgba(0, 0, 0, 0.3);
    --e2: 0 2px 4px rgba(0, 0, 0, 0.28), 0 4px 12px rgba(0, 0, 0, 0.3);
    --e3: 0 8px 24px rgba(0, 0, 0, 0.44), 0 2px 6px rgba(0, 0, 0, 0.3);
    --fill: #245a55; --fill-hover: #2c6a64; --fill-ink: #e6fbf7; --fill-line: #2f6b65; --on: #3fc2aa; --viz-1: #27a38b; --viz-grid: #24302d; --viz-base: #34423f;
    --bubble-out: #1f3a37; --bubble-out-ink: #e8efed;
    --cod: #3a2610; --cod-ink: #f3b06f; --cod-line: #6b4520;
  }
}

/* The toggle in the top bar forces a theme, overriding the phone's setting.
 *
 * It used to switch to a different PALETTE — blue brand, glass panels, a stack
 * of !important — which meant the product had two unrelated identities
 * depending on a button nobody explained. It now does what its sun/moon icon
 * says: light or dark, in Ordo's own colours.
 *
 * Declared after :root and before any component so it wins on order, not on
 * !important. */
html.light-theme {
  --ink: #12211f; --ink-soft: #5b6b68; --line: #dfe5e3;
  --bg: #f6f8f7; --card: #ffffff; --brand: #0f3d3e;
  --brand-soft: #e6efee; --accent: #b4530a; --ok: #1f7a44;
  --warn: #a8730b; --danger: #b3261e;
  --warn-soft: #fdf1dc; --danger-soft: #fbe6e4; --ok-soft: #e2f3e9;
  --e1: 0 1px 2px rgba(18, 33, 31, 0.05), 0 1px 1px rgba(18, 33, 31, 0.04);
  --e2: 0 2px 4px rgba(18, 33, 31, 0.05), 0 4px 12px rgba(18, 33, 31, 0.06);
  --e3: 0 8px 24px rgba(18, 33, 31, 0.1), 0 2px 6px rgba(18, 33, 31, 0.06);
  /* Filled surfaces are tints, not the dark brand colour: sellers found the
     solid dark buttons and chat bubbles heavy on a bright phone screen. */
  --fill: #dcefea; --fill-hover: #cce7e0; --fill-ink: #0b4a47; --fill-line: #b9dcd4;
  /* Switches, radio dots and meters: a clear mid teal, never the near-black brand. */
  --on: #2bb39a;
  /* Chart series: one hue, validated (>= 3:1 on the card, inside the lightness band). */
  --viz-1: #1a9580; --viz-grid: #e6ebea; --viz-base: #c5cfcd;
  --bubble-out: #e3f3ee; --bubble-out-ink: #12211f;
  --cod: #fff3e6; --cod-ink: #9a4508; --cod-line: #f5c79c;
}
html.dark-theme {
  --ink: #e8efed; --ink-soft: #9bada9; --line: #2a3634;
  --bg: #101917; --card: #17221f; --brand: #7fd1c8;
  --brand-soft: #1d2c2a; --accent: #e59a5b; --ok: #63c48d;
  --warn: #d9ad55; --danger: #f08a82;
  --warn-soft: #33290f; --danger-soft: #3a1f1d; --ok-soft: #16301f;
  --e1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --e2: 0 2px 4px rgba(0, 0, 0, 0.28), 0 4px 12px rgba(0, 0, 0, 0.3);
  --e3: 0 8px 24px rgba(0, 0, 0, 0.44), 0 2px 6px rgba(0, 0, 0, 0.3);
  --fill: #245a55; --fill-hover: #2c6a64; --fill-ink: #e6fbf7; --fill-line: #2f6b65; --on: #3fc2aa; --viz-1: #27a38b; --viz-grid: #24302d; --viz-base: #34423f;
  --bubble-out: #1f3a37; --bubble-out-ink: #e8efed;
  --cod: #3a2610; --cod-ink: #f3b06f; --cod-line: #6b4520;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: calc(15px * var(--fs))/1.55 "Inter", "Noto Sans Sinhala", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--ink-soft); }
.spacer { flex: 1; }

/* Digits that stack in a column have to line up, or the eye realigns them
   before it can compare them. Money, counts, phone numbers, references. */
.tnum, .kpi .v, .pill, .count, .badge,
.ord-total, .ord-ref, .pack-phone, .pack-cod .amt, .pack-item-qty {
  font-variant-numeric: tabular-nums;
}

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------------------------------------------------------- login */
.login { display: grid; place-items: center; min-height: 100dvh; padding: var(--s5) var(--s4); }
.login-card {
  background: var(--card); border-radius: var(--radius-xl);
  padding: var(--s6) var(--s5); width: min(400px, 100%);
  display: grid; gap: var(--s3); box-shadow: var(--e3);
}
.brand {
  font-size: calc(32px * var(--fs)); font-weight: 700; color: var(--brand);
  letter-spacing: -0.03em; line-height: 1.1; text-decoration: none; width: fit-content;
}
/* The portal is reached from the landing page; without this a seller who
   opened it by mistake had only the browser's back button to get out. */
.back-home {
  display: inline-flex; align-items: center; gap: 4px; width: fit-content;
  font-size: calc(13px * var(--fs)); font-weight: 500; color: var(--ink-soft); text-decoration: none;
  margin: calc(-1 * var(--s2)) 0 0 -4px; padding: 4px; border-radius: 8px;
}
.back-home:hover { color: var(--brand); }
label { display: grid; gap: 6px; font-size: calc(13px * var(--fs)); color: var(--ink-soft); font-weight: 500; }

input, select, textarea {
  font: inherit; padding: 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--card); color: var(--ink); width: 100%;
  transition: border-color 0.16s, box-shadow 0.16s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: var(--ring);
}
input::placeholder, textarea::placeholder { color: var(--ink-soft); opacity: 0.7; }

button { font: inherit; cursor: pointer; border-radius: var(--radius); border: 1px solid transparent; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

/* Press feedback. There was none: on a slow connection a tap gave no sign it
   had registered, so sellers tapped a second time. */
.primary {
  background: var(--fill); color: var(--fill-ink); padding: 13px; font-weight: 600;
  border-color: var(--fill-line);
  box-shadow: var(--e1); transition: transform 0.14s, box-shadow 0.14s, filter 0.14s;
}
.primary:hover:not(:disabled) { box-shadow: var(--e2); background: var(--fill-hover); }
.primary:active:not(:disabled) { transform: translateY(1px); box-shadow: var(--e1); }
.ghost {
  background: transparent; border-color: var(--line); color: var(--ink);
  padding: 8px 12px; transition: background 0.14s, border-color 0.14s;
}
.ghost:hover:not(:disabled) { background: var(--brand-soft); border-color: var(--brand); }
.ghost:active:not(:disabled) { transform: translateY(1px); }
.danger-btn { background: var(--danger); color: #fff; padding: 13px; font-weight: 600; }

.error { color: var(--danger); font-size: calc(13px * var(--fs)); min-height: 18px; }
.hint { font-size: calc(12px * var(--fs)); color: var(--ink-soft); }
.auth-switch { text-align: center; font-size: calc(13px * var(--fs)); color: var(--ink-soft); }
.linkish {
  background: none; border: none; color: var(--brand);
  font-weight: 600; padding: 2px 4px; text-decoration: underline;
}

/* Setup checklist — a new shop starts empty, and an empty shop is a shop the
   AI cannot answer for. This is the first thing the seller sees. */
.setup { border-left: 3px solid var(--brand); }
.setup ol { margin: var(--s2) 0 0; padding-left: 20px; display: grid; gap: 6px; }
.setup li.done { color: var(--ink-soft); text-decoration: line-through; }

/* ---------------------------------------------------------------- shell */
.app { display: flex; flex-direction: column; min-height: 100dvh; }
.topbar {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
/* Everything after the shop name is account chrome and belongs together at
   the far end, rather than drifting apart across the width of a monitor. */
.topbar .who { margin-left: auto; }
.shop { font-weight: 700; color: var(--brand); font-size: calc(17px * var(--fs)); letter-spacing: -0.01em; }
/* A returning customer's saved delivery details, under their name in a chat. */
.saved-details {
  margin-top: 4px; font-size: calc(12px * var(--fs)); color: var(--ink-soft);
  background: var(--brand-soft); border-radius: 8px; padding: 4px 8px; display: inline-block;
}

/* In-app back. Leftmost, where a thumb and every other app expect it. */
.nav-back {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  background: var(--brand-soft); color: var(--brand); border: 1px solid transparent;
  border-radius: 999px; padding: 6px 12px 6px 8px; font-size: calc(13px * var(--fs)); font-weight: 600;
  max-width: 40vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  transition: border-color .14s, filter .14s;
}
.nav-back:hover { border-color: var(--brand); }
.nav-back:active { transform: translateY(1px); }
/* A phone is 360–400px wide, and back + Ordo + shop name + theme + who +
   Logout does not fit on one line: Logout was pushed off the edge. The shop
   name takes the space that is left and shortens with an ellipsis, and the
   signed-in name goes — it is in Settings. */
@media (max-width: 560px) {
  .topbar { gap: var(--s2); padding-inline: var(--s3); }
  .topbar .who { display: none; }
  .topbar .spacer { display: none; }
  /* Sign out lives in Settings → My account on a phone; the bar keeps the
     room for the shop's name. */
  .topbar #logout { display: none; }
  .shop {
    flex: 1; min-width: 0; font-size: calc(15px * var(--fs));
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  }
  .home-link { font-size: calc(15px * var(--fs)); padding-right: var(--s2); }
}
@media (max-width: 420px) {
  /* The label goes; the arrow stays. The shop name needs the room. */
  #nav-back-label { display: none; }
  .nav-back { padding: 6px; }
}

/* Back to the landing page. Sits before the shop name, split from it by a rule. */
.home-link {
  font-weight: 700; font-size: calc(17px * var(--fs)); letter-spacing: -0.02em; color: var(--ink);
  text-decoration: none; padding-right: var(--s3); border-right: 1px solid var(--line); flex: none;
}
.home-link:hover { color: var(--brand); }
.who { font-size: calc(12px * var(--fs)); color: var(--ink-soft); }
.topbar .ghost { border-radius: 999px; padding: 7px 13px; font-size: calc(13px * var(--fs)); }
/* Round icon buttons in the bar: help, theme, a sheet's close. */
.icon-btn {
  width: 36px; height: 36px; padding: 0; border-radius: 999px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--line); color: var(--ink-soft);
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand); border-color: var(--fill-line); }

/* Setup progress in the bar: a ring and "3 of 5". */
.setup-btn {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 36px; padding: 0 12px 0 6px; border-radius: 999px;
  background: var(--ok-soft); color: var(--ok); border: 1px solid transparent;
  font-size: calc(13px * var(--fs)); font-weight: 600; white-space: nowrap;
}
.setup-btn:hover { border-color: var(--ok); }
.setup-btn .ring { flex: none; }
@media (max-width: 560px) {
  .setup-label { display: none; }
  .setup-btn { padding: 0 6px; }
}
main { flex: 1; padding: var(--s4); padding-bottom: calc(var(--tabbar-h) + var(--s5)); }

/* Sellers hold the phone one-handed in the evening: primary nav sits at the
   bottom, within thumb reach. */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--tabbar-h);
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--card); box-shadow: 0 -1px 0 var(--line), var(--e2);
  padding-bottom: env(safe-area-inset-bottom); z-index: 20;
}
.tabbar button {
  background: none; border: none; color: var(--ink-soft);
  font-size: calc(10px * var(--fs)); display: grid; gap: 1px; place-items: center;
  position: relative; padding: 0;
}
.tabbar button.active { color: var(--brand); font-weight: 600; }
/* A filled disc behind the active icon. The only cue used to be colour on a
   10px label — the first thing lost on a dim screen outdoors. */
.tabbar .ico {
  display: grid; place-items: center; width: 40px; height: 26px;
  border-radius: 999px; transition: background 0.18s;
}
.tabbar button.active .ico { background: var(--brand-soft); }
.tabbar .ico svg { width: 21px; height: 21px; stroke-width: 1.7; stroke: currentColor; fill: none; }
/* Anchored to the icon, not to the cell. `right: 22%` put it 22% of the
   BUTTON's width away, so on a wide screen the count floated most of a
   column clear of the thing it was counting. */
.tabbar .ico { position: relative; }
.tabbar .badge {
  position: absolute; top: -6px; left: calc(50% + 4px);
  background: var(--danger); color: #fff;
  border-radius: 999px; font-size: calc(10px * var(--fs)); font-weight: 700; padding: 1px 5px;
  min-width: 17px; text-align: center; box-shadow: var(--e1);
  border: 2px solid var(--card); line-height: 1.2;
}

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: var(--s4); margin-bottom: var(--s3);
  box-shadow: var(--e2);
}
.row { display: flex; align-items: center; gap: var(--s2); }
h2 { font-size: calc(20px * var(--fs)); margin: var(--s1) 0 var(--s3); letter-spacing: -0.015em; }
.list { display: grid; gap: var(--s3); }

.empty { text-align: center; padding: var(--s6) var(--s4); color: var(--ink-soft); }
.empty .big {
  width: 72px; height: 72px; border-radius: 999px; background: var(--brand-soft);
  display: grid; place-items: center; margin: 0 auto var(--s3);
}
.empty .big svg { width: 32px; height: 32px; stroke-width: 1.6; stroke: var(--brand); fill: none; }
.empty strong { display: block; color: var(--ink); margin-bottom: 2px; }

/* Status carries a dot as well as a colour. Colour alone fails for the ~8% of
   men with a colour-vision deficiency, and washes out entirely on a phone held
   in sunlight — which is where this product is used. */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: calc(11px * var(--fs)); padding: 3px 10px 3px 8px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-weight: 600; white-space: nowrap;
}
.pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 999px;
  background: currentColor; flex: none;
}
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.plain::before { display: none; }

/* One segmented track rather than four loose chips, so the control reads as a
   single choice with one answer. */
.filters {
  display: flex; gap: 2px; overflow-x: auto; margin-bottom: var(--s4);
  background: var(--card); border-radius: 999px; padding: 3px;
  box-shadow: var(--e1); scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filters button {
  background: transparent; border: none; color: var(--ink-soft);
  padding: 8px 14px; font-size: calc(13px * var(--fs)); font-weight: 600; white-space: nowrap;
  border-radius: 999px; transition: background 0.16s, color 0.16s;
}
.filters button:hover { color: var(--ink); }
.filters button.on { background: var(--brand-soft); color: var(--brand); }

/* An initials disc. Scanning twenty rows by name alone means reading twenty
   times; a disc gives the eye a fixed place to land first. */
.av {
  width: 42px; height: 42px; border-radius: 999px; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: calc(14px * var(--fs));
  background: var(--brand-soft); color: var(--brand); letter-spacing: 0.02em;
}
.av.sm { width: 34px; height: 34px; font-size: calc(12px * var(--fs)); }

/* ---------------------------------------------------------------- inbox */
.conv { display: flex; gap: var(--s3); align-items: center; cursor: pointer; }
.conv:active { transform: scale(0.995); }
.conv .grow { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.conv .name { font-weight: 600; }
.conv .when { margin-left: auto; font-size: calc(12px * var(--fs)); color: var(--ink-soft); flex: none; }
.conv .last {
  color: var(--ink-soft); font-size: calc(13px * var(--fs)); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
/* A conversation waiting on the seller claims its whole left edge, so it
   survives being glanced at from across a table. */
.card.flag { border-left: 3px solid var(--danger); padding-left: calc(var(--s4) - 3px); }
.count {
  background: var(--danger); color: #fff; border-radius: 999px; flex: none;
  font-size: calc(11px * var(--fs)); font-weight: 700; padding: 2px 7px; min-width: 20px; text-align: center;
}

/* ------------------------------------------------------------------ chat */
.thread-head {
  position: sticky; top: 0; z-index: 5; margin: 0 calc(var(--s4) * -1) var(--s3);
  padding: var(--s3) var(--s4); background: var(--card); box-shadow: var(--e1);
  display: flex; align-items: center; gap: var(--s3);
}
.thread-head .grow { min-width: 0; flex: 1; display: grid; gap: 2px; }
.thread-head .nm { font-weight: 700; display: flex; align-items: center; gap: var(--s2); }
.thread-head .sub { font-size: calc(12px * var(--fs)); color: var(--ink-soft); }

.thread { display: grid; gap: var(--s1); margin: var(--s4) 0; }

/* A day marker. A thread spanning three days used to show nothing but clock
   times, so "09:14" could be this morning or last Tuesday. */
.day {
  justify-self: center; font-size: calc(11px * var(--fs)); font-weight: 600; color: var(--ink-soft);
  background: var(--card); border-radius: 999px; padding: 4px 12px;
  margin: var(--s3) 0 var(--s2); box-shadow: var(--e1);
}

.msg {
  max-width: 80%; padding: 9px 13px; border-radius: 16px; white-space: pre-wrap;
  word-break: break-word; box-shadow: var(--e1); position: relative; line-height: 1.45;
}
.msg.in { background: var(--card); justify-self: start; }
.msg.out { background: var(--bubble-out); color: var(--bubble-out-ink); justify-self: end; }
/* Only the last bubble of a run gets a tail, so a burst of four messages reads
   as one turn instead of four separate ones. */
.msg.in.tail { border-bottom-left-radius: 5px; }
.msg.out.tail { border-bottom-right-radius: 5px; }
/* Messages inside a run sit tighter than messages between turns. */
.msg.cont { margin-top: -2px; }
.msg .when { font-size: calc(10px * var(--fs)); opacity: 0.7; display: block; margin-top: 4px; }
.msg .msg-photo { display: block; margin: -4px -6px 6px; }
.msg .msg-photo img { display: block; width: 100%; max-width: 260px; max-height: 320px; object-fit: cover; border-radius: 12px; }
.msg.out .when { text-align: right; }

.by-ai {
  font-size: calc(9px * var(--fs)); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  opacity: 0.75; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 3px;
}
.by-ai::before {
  content: ""; width: 5px; height: 5px; border-radius: 999px; background: currentColor;
}

/* A reply that never reached the customer. Deliberately loud: the whole point
   is that a failed send must not resemble a successful one. */
.msg.failed { box-shadow: 0 0 0 1.5px var(--danger), var(--e1); }
.not-sent {
  display: inline-flex; align-items: center; gap: 4px; margin-top: var(--s2);
  font-size: calc(10px * var(--fs)); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--danger); background: var(--danger-soft); border-radius: 6px;
  padding: 3px 7px; width: fit-content;
}
/* The background used to be a hardcoded #fff, which put white behind red text
   on every dark-theme phone. */

.composer {
  display: flex; gap: var(--s2); align-items: flex-end;
  position: sticky; bottom: calc(var(--tabbar-h) + var(--s2)); z-index: 5;
  background: var(--bg); padding-top: var(--s2);
}
.composer input {
  flex: 1; border-radius: 22px; padding: 12px var(--s4); box-shadow: var(--e1);
  border-color: transparent;
}
.composer input:focus { border-color: var(--brand); }
.composer button {
  width: var(--tap); height: var(--tap); flex: none; border-radius: 999px; padding: 0;
  display: grid; place-items: center;
}
.composer button svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }

/* An AI suggestion waiting on the seller (suggest mode). */
.suggestion {
  background: var(--brand-soft); border-radius: var(--radius-lg);
  padding: var(--s3) var(--s4); margin-bottom: var(--s2);
  border-left: 3px solid var(--brand);
}

/* ------------------------------------------------- packing (section 21.6) */
/* One order fills the screen. Address in large type so it can be copied onto
   a parcel without squinting; the COD amount is the loudest surface on the
   screen, because a rider collecting the wrong amount is a dispute the seller
   has to settle with their own customer. Every size here is deliberate. */
.pack-progress { text-align: center; color: var(--ink-soft); font-size: calc(13px * var(--fs)); margin-bottom: var(--s2); }
.pack-card {
  background: var(--card); border-radius: var(--radius-xl);
  padding: var(--s5); box-shadow: var(--e3);
}
.pack-name { font-size: calc(26px * var(--fs)); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.pack-addr { font-size: calc(22px * var(--fs)); line-height: 1.45; margin: var(--s3) 0; white-space: pre-wrap; }
.pack-phone { font-size: calc(24px * var(--fs)); font-weight: 600; letter-spacing: 0.02em; }
.pack-cod {
  background: var(--cod); color: var(--cod-ink); border: 1px solid var(--cod-line);
  border-radius: var(--radius-lg); padding: var(--s4); text-align: center; margin: var(--s4) 0;
}
.pack-cod .amt { font-size: calc(46px * var(--fs)); font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.pack-cod .lbl { font-size: calc(12px * var(--fs)); letter-spacing: 0.15em; text-transform: uppercase; opacity: 0.92; }
.pack-items {
  border-top: 1px dashed var(--line); padding-top: var(--s4);
  font-size: calc(18px * var(--fs)); margin-top: var(--s4);
}
.pack-item-row { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.pack-item-qty {
  background: var(--fill); color: var(--fill-ink); font-weight: 800;
  padding: 6px 14px; border-radius: 10px; font-size: calc(22px * var(--fs));
  min-width: 54px; text-align: center; flex: none;
}
.pack-item-name { font-weight: 700; line-height: 1.2; }
.pack-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-top: var(--s4); }
.pack-actions button { padding: 17px; font-size: calc(16px * var(--fs)); font-weight: 600; }

/* ---------------------------------------------------------------- orders */
.order-card { cursor: pointer; }
.order-card:active { transform: scale(0.995); }
/* Rows waiting on the seller carry an accent edge — the same grammar the
   inbox uses for "needs you". */
.card.act { border-left: 3px solid var(--accent); padding-left: calc(var(--s4) - 3px); }
.ord-ref { font-size: calc(14px * var(--fs)); font-weight: 600; color: var(--ink-soft); letter-spacing: 0.02em; }
.ord-total { margin-left: auto; font-size: calc(17px * var(--fs)); font-weight: 700; letter-spacing: -0.01em; }
.ord-items { font-size: calc(13px * var(--fs)); font-weight: 600; margin-top: var(--s2); }
.ord-sub { font-size: calc(13px * var(--fs)); color: var(--ink-soft); margin-top: 2px; }

/* ------------------------------------------------------------------ kpis */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s3); }
.kpi {
  background: var(--card); border-radius: var(--radius-lg); padding: var(--s4);
  box-shadow: var(--e2); display: grid; gap: 2px;
}
/* The label sits above the value. A seller reads the big number first either
   way; putting the label first means they know what they are looking at
   before they look at it. */
.kpi .k {
  order: -1; font-size: calc(11px * var(--fs)); font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-soft);
}
.kpi .v { font-size: calc(30px * var(--fs)); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
/* The dashboard's own copy calls this "the number above all others". It was
   set in the same 26px as COD outstanding; now the layout agrees with the
   sentence. */
.kpi.star {
  grid-column: 1 / -1; background: var(--fill); border: 1px solid var(--fill-line);
}
.kpi.star .k { color: var(--fill-ink); opacity: 0.8; }
.kpi.star .v { color: var(--fill-ink); font-size: calc(44px * var(--fs)); }

/* ---------------------------------------------------------------- tables */
table { width: 100%; border-collapse: collapse; font-size: calc(14px * var(--fs)); }
th, td { text-align: left; padding: 10px var(--s2); border-bottom: 1px solid var(--line); }
th {
  font-size: calc(11px * var(--fs)); text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-soft); font-weight: 700;
}
tbody tr:last-child td { border-bottom: none; }
.scroll-x { overflow-x: auto; }

/* ---------------------------------------------------------------- banners */
.banner {
  padding: var(--s3) var(--s4); border-radius: var(--radius); font-size: calc(13px * var(--fs));
  margin-bottom: var(--s3); border-left: 3px solid var(--warn);
  background: var(--card); box-shadow: var(--e1);
}
/* The assistant has stopped sending — louder than a warning, because the shop
   is answering nobody until it is dealt with. */
.banner.danger { border-left-color: var(--danger); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--s4)); background: var(--card); color: var(--ink);
  border: 1px solid var(--line);
  padding: 11px 18px; border-radius: 999px; font-size: calc(14px * var(--fs)); z-index: 50;
  box-shadow: var(--e3); animation: toast-in 0.2s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* A skeleton shows the shape of what is coming, so the screen does not appear
   to jump when it lands. Replaces a centred "Loading…". */
.loading { display: grid; gap: var(--s3); padding: var(--s2) 0; }
.sk {
  background: var(--card); border-radius: var(--radius-lg); padding: var(--s4);
  box-shadow: var(--e2); display: grid; gap: var(--s2);
}
.sk i {
  display: block; height: 12px; border-radius: 6px; background: var(--line);
  position: relative; overflow: hidden;
}
.sk i::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent,
    color-mix(in srgb, var(--card) 70%, transparent), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

.back {
  background: none; border: none; color: var(--brand); font-weight: 600;
  padding: 0 0 var(--s3); display: inline-flex; align-items: center; gap: 6px;
}

/* ------------------------------------------------------------- desktop
   The app is built for a phone and was never given a desktop layout, so on a
   1920px screen six tab icons were strung across the full width with 300px of
   nothing between them, the filter track stretched to 920px holding four
   words, and a dead channel ran down the middle of the page.

   Above 1024px the bottom tab bar becomes a left rail. Same markup, same six
   buttons, same order — CSS grid moves them. A rail is also where a person
   using a mouse expects navigation to be, and it gives back the vertical space
   a fixed bottom bar was taking. */

/* Tablet: the column stops being full-bleed before the rail appears. */
@media (min-width: 720px) {
  main { max-width: 760px; margin: 0 auto; width: 100%; }
  /* A segmented control is as wide as its options, not as wide as its
     container — stretched to 920px it read as a bar that happened to have
     words in it. */
  .filters { width: fit-content; max-width: 100%; }
}

@media (min-width: 1024px) {
  :root { --topbar-h: 61px; }

  .app {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 100dvh;
  }
  .topbar { grid-column: 1 / -1; grid-row: 1; padding-inline: var(--s5); }

  /* The rail. */
  .tabbar {
    position: sticky; top: var(--topbar-h);
    grid-column: 1; grid-row: 2;
    height: calc(100dvh - var(--topbar-h));
    display: flex; flex-direction: column; gap: var(--s1);
    padding: var(--s4) var(--s3); align-content: start;
    box-shadow: 1px 0 0 var(--line);
    left: auto; right: auto; bottom: auto; z-index: 1;
  }
  .tabbar button {
    display: flex; flex-direction: row; align-items: center; gap: var(--s3);
    justify-content: flex-start; width: 100%;
    padding: 10px var(--s3); border-radius: 12px;
    font-size: calc(14px * var(--fs)); text-align: left;
    transition: background 0.16s, color 0.16s;
  }
  .tabbar button:hover { background: var(--brand-soft); color: var(--brand); }
  /* The whole row lights up, not a disc behind the icon — at this size the
     icon is no longer the thing being pointed at, the row is. */
  .tabbar button.active { background: var(--brand-soft); }
  .tabbar .ico { width: auto; height: auto; }
  /* Same specificity as the base rule and later in the file, so it wins on
     order rather than on !important. */
  .tabbar button.active .ico { background: none; }
  .tabbar .ico svg { width: 20px; height: 20px; }
  /* The count stays pinned to the icon rather than drifting to the far end of
     a 252px row, where it would no longer read as belonging to it. */
  .tabbar .badge { top: -7px; left: calc(50% + 3px); }

  /* Anchored to the rail, not centred in what is left of the screen.
     Centring a 1040px column in a 1668px gap parked 314px of nothing between
     the navigation and the content it belongs to — the page read as two
     unrelated things either side of a channel. Left-aligned, the rail and the
     list are one object, and the slack collects at the outer edge where a
     margin is supposed to be. */
  main {
    grid-column: 2; grid-row: 2;
    max-width: 1400px; margin: 0; width: 100%;
    padding: var(--s5) var(--s5) var(--s6);
  }

  /* The thread header spanned the content padding on a phone; on desktop the
     content column is wider than the bar needs to be. */
  .thread-head { margin-inline: calc(var(--s5) * -1); padding-inline: var(--s5); }
  .composer { bottom: var(--s4); }
}

/* Wide screens get more room, not more margin. A list row showing a name, a
   status, a time and a message preview uses width; it does not need to be
   capped like a paragraph. */
@media (min-width: 1440px) {
  main { padding-inline: var(--s6); }
}

/* ---------------------------------------------------------------- products */
.product-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
@media (max-width: 500px) { .product-form-grid { grid-template-columns: 1fr; } }

.product-grid { display: grid; grid-template-columns: 1fr; gap: var(--s3); }
@media (min-width: 560px) { .product-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .product-grid { grid-template-columns: repeat(3, 1fr); } }

.product-card {
  background: var(--card); border: 1px solid transparent; border-radius: var(--radius-lg);
  padding: var(--s4); box-shadow: var(--e2);
  transition: box-shadow 0.18s, transform 0.18s;
}
.product-card:hover { box-shadow: var(--e3); transform: translateY(-1px); }

.pc-header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s2); }
.pc-actions { display: flex; gap: var(--s1); flex-shrink: 0; }
.pc-name { font-weight: 700; font-size: calc(15px * var(--fs)); line-height: 1.3; }
.pc-name-si { font-size: calc(13px * var(--fs)); color: var(--ink-soft); margin-top: 2px; }
.pc-sku { font-size: calc(11px * var(--fs)); color: var(--ink-soft); margin-top: var(--s1); font-family: ui-monospace, monospace; }
.pc-price-row { margin-top: var(--s2); display: flex; align-items: baseline; gap: var(--s2); }
.pc-price { font-size: calc(19px * var(--fs)); font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.pc-price-old { font-size: calc(14px * var(--fs)); color: var(--ink-soft); text-decoration: line-through; }
.pc-price-sale { font-size: calc(19px * var(--fs)); font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.pc-meta { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s2); }
.pc-desc {
  font-size: calc(12px * var(--fs)); color: var(--ink-soft); margin-top: var(--s2); line-height: 1.45;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.pc-stock-select { width: 100%; margin-top: var(--s3); padding: 8px 10px; font-size: calc(12px * var(--fs)); }
.pc-edit { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.pc-edit-head, .pc-edit-actions { display: none; }

/* ---- the product editor as a dialog */
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, .5); backdrop-filter: blur(2px);
  animation: fade-in .15s ease-out;
}
/* A transform on an ancestor makes position:fixed relative to it — the hover
   lift on the card would pin the dialog inside the card. */
.product-card.editing, .product-card.editing:hover { transform: none; }
.product-card.editing .pc-edit {
  position: fixed; z-index: 100; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(720px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow-y: auto;
  background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--e3);
  padding: var(--s4) var(--s5); gap: var(--s3);
  animation: pop-in .16s ease-out;
}
.product-card.editing .pc-edit label { font-size: calc(13px * var(--fs)); }
.product-card.editing .pc-edit input, .product-card.editing .pc-edit select,
.product-card.editing .pc-edit textarea { font-size: calc(14px * var(--fs)); padding: 10px; }
.product-card.editing .pc-edit-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
  grid-column: 1 / -1; position: sticky; top: calc(-1 * var(--s4)); z-index: 1;
  background: var(--card); margin: calc(-1 * var(--s4)) calc(-1 * var(--s5)) 0;
  padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line);
}
.product-card.editing .pc-edit-actions {
  display: flex; position: sticky; bottom: calc(-1 * var(--s4)); z-index: 1;
  background: var(--card); margin: 0 calc(-1 * var(--s5)) calc(-1 * var(--s4));
  padding: var(--s3) var(--s5); border-top: 1px solid var(--line); gap: var(--s2);
}
.modal-x { border-radius: 999px; width: 34px; height: 34px; padding: 0; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translate(-50%, -48%) scale(.98); } }
@media (max-width: 560px) {
  /* On a phone the dialog is the whole screen, with the buttons always in reach. */
  .product-card.editing .pc-edit {
    inset: 0; left: 0; top: 0; transform: none; width: 100%; max-height: none; height: 100dvh;
    border-radius: 0; grid-template-columns: 1fr; padding: var(--s4);
  }
  .product-card.editing .pc-edit-head { margin: calc(-1 * var(--s4)) calc(-1 * var(--s4)) 0; padding: var(--s3) var(--s4); }
  .product-card.editing .pc-edit-actions { margin: 0 calc(-1 * var(--s4)) calc(-1 * var(--s4)); padding: var(--s3) var(--s4); }
  @keyframes pop-in { from { opacity: 0; } }
}
.pc-edit label { font-size: calc(12px * var(--fs)); }
.pc-edit input, .pc-edit select, .pc-edit textarea { font-size: calc(13px * var(--fs)); padding: 9px; }

/* ---------------------------------------------------------------- billing */
/* A row that goes somewhere, so it has to look like one — the rest of the
   settings screen is fields, and a card that is secretly a button is the
   easiest thing on a phone to miss. */
.billing-link { display: flex; align-items: center; gap: var(--s3); cursor: pointer; }
.billing-link .grow { flex: 1; min-width: 0; }
.billing-link .chev { font-size: calc(24px * var(--fs)); color: var(--ink-soft); line-height: 1; }
.billing-link:active { transform: scale(0.995); }

/* Usage against a limit. The bar is the thing a seller reads; the numbers
   underneath are for when they need to act on it. */
.usage-bar {
  height: 8px; border-radius: 999px; background: var(--line);
  overflow: hidden; margin-top: var(--s3);
}
.usage-bar i { display: block; height: 100%; background: var(--on); border-radius: 999px; }
/* Approaching a limit is a warning; past it, the assistant has stopped
   writing, and that has to look different from "nearly there". */
.usage-bar.near i { background: var(--warn); }
.usage-bar.over i { background: var(--danger); }
.usage-note {
  display: flex; justify-content: space-between; gap: var(--s2);
  font-size: calc(13px * var(--fs)); margin-top: 6px; font-variant-numeric: tabular-nums;
}

.feature-list { display: grid; gap: var(--s2); }
.feature-row { display: flex; align-items: center; gap: var(--s3); font-size: calc(14px * var(--fs)); }

.plan-grid { display: grid; gap: var(--s3); grid-template-columns: 1fr; }
@media (min-width: 640px) { .plan-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }
.plan-card { display: grid; gap: 4px; align-content: start; }
.plan-card.current { border-left: 3px solid var(--brand); padding-left: calc(var(--s4) - 3px); }
.plan-price { font-size: calc(26px * var(--fs)); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.plan-card .actions { display: grid; gap: var(--s2); margin-top: var(--s3); }

/* ------------------------------------------------------------ variations */
.variant-editor {
  border: 1px dashed var(--line); border-radius: 10px; padding: 10px; margin-top: 6px;
  display: grid; gap: 8px;
}
.variant-editor .row { gap: 8px; flex-wrap: wrap; }
.ve-quick input { flex: 1; min-width: 180px; }
.ve-rows { display: grid; gap: 6px; }
.ve-row {
  display: grid; gap: 6px; align-items: center;
  grid-template-columns: minmax(110px, 2fr) minmax(80px, 1fr) minmax(80px, 1fr) minmax(110px, 1.2fr) auto;
}
.ve-row input, .ve-row select { margin: 0; }
.ve-remove { padding: 6px 10px; }
@media (max-width: 560px) {
  /* Two lines per variation on a phone: what it is, then its numbers. */
  .ve-row { grid-template-columns: 1fr 1fr auto; }
  .ve-row .ve-label { grid-column: 1 / 3; }
  .ve-row .ve-status { grid-column: 1 / 3; }
}
.variant-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.variant-chips .pill { font-size: calc(11px * var(--fs)); }
input[readonly] { opacity: .75; cursor: not-allowed; }

/* ---------------------------------------------------------------- settings
   One section per job, each with its own Save that wakes up only when
   something in that section changed. */
.settings-nav {
  position: sticky; z-index: 20; width: 100%;
  /* A ring of page colour, so the card scrolling underneath does not peek out
     around the bar's rounded ends. */
  box-shadow: 0 0 0 8px var(--bg), var(--e1);
}
/* minmax(0, …): a long page id or link in a section must wrap, not widen the
   whole page sideways on a phone. */
.settings-sec { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s3); transition: box-shadow 0.3s; }
.settings-sec #channels-body { overflow-wrap: anywhere; }
.settings-sec h2 { margin: 0; }
.settings-sec.flash { box-shadow: 0 0 0 2px var(--brand), var(--e2); }
.sec-sub { font-size: calc(13px * var(--fs)); color: var(--ink-soft); margin: -6px 0 0; }

.save-bar { display: flex; align-items: center; justify-content: flex-end; gap: var(--s3); flex-wrap: wrap; }
.save-bar .primary { padding: 11px 22px; }
.save-state { font-size: calc(13px * var(--fs)); color: var(--ink-soft); }
.save-state.dirty { color: var(--warn); }
.save-state.ok { color: var(--ok); }
.save-state.err { color: var(--danger); }

.opts { display: grid; gap: var(--s2); }
.opts.two { grid-template-columns: 1fr 1fr; }
.opt {
  display: flex; gap: 10px; align-items: flex-start; padding: var(--s3);
  border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
  transition: border-color 0.16s, background 0.16s;
}
.opt input { width: auto; margin: 3px 0 0; accent-color: var(--on); flex: none; }
.opt:has(input:checked) { border-color: var(--on); background: var(--brand-soft); }
.opt strong, .switch-row strong { display: block; font-size: calc(14px * var(--fs)); color: var(--ink); }
.opt small, .switch-row small { display: block; font-size: calc(12px * var(--fs)); color: var(--ink-soft); font-weight: 400; margin-top: 2px; }

.switch-row { display: flex; align-items: center; gap: var(--s3); padding: 2px 0; cursor: pointer; }
.switch-row .grow { flex: 1; min-width: 0; }
/* A real checkbox underneath, so keyboards and screen readers get one. */
.switch {
  appearance: none; -webkit-appearance: none; width: 44px; height: 26px; padding: 0;
  border-radius: 999px; background: var(--line); position: relative; flex: none;
  border: none; cursor: pointer; transition: background 0.16s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: var(--e1); transition: transform 0.16s;
}
.switch:checked { background: var(--on); }
.switch:checked::after { transform: translateX(18px); }
.switch:focus-visible { box-shadow: var(--ring); }

.d-fields.two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.preview {
  background: var(--brand-soft); border-radius: var(--radius); padding: var(--s3);
  font-size: calc(13px * var(--fs)); display: grid; gap: 4px;
}

.faq-list { display: grid; gap: var(--s2); }
.faq-row {
  display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.faq-row.off { opacity: 0.6; }
.faq-row .grow { flex: 1; min-width: 0; }
.faq-a { font-size: calc(13px * var(--fs)); color: var(--ink-soft); margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.faq-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.faq-actions .ghost { padding: 6px 10px; font-size: calc(13px * var(--fs)); }
.faq-add, .pw-box {
  display: grid; gap: var(--s3); border-top: 1px solid var(--line);
  padding-top: var(--s3); margin-top: var(--s1);
}
.tpl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-chips .ghost { font-size: calc(12px * var(--fs)); padding: 6px 10px; border-radius: 999px; }

.team-row { padding: 6px 0; }
.team-row .grow { flex: 1; min-width: 0; }
.team-row .muted { font-size: calc(12px * var(--fs)); overflow-wrap: anywhere; }

@media (max-width: 480px) {
  .d-fields.two { grid-template-columns: 1fr; }
  .faq-row { flex-direction: column; }
  .faq-actions { align-self: flex-end; }
}

/* ---------------------------------------------------------------- sheets
   A side panel on a computer, a sheet from the bottom on a phone. */
.sheet-wrap { position: fixed; inset: 0; z-index: 120; }
.sheet-backdrop {
  position: absolute; inset: 0; background: rgba(12, 22, 20, 0.35);
  backdrop-filter: blur(2px); animation: fade-in 0.15s ease-out;
}
.sheet {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%);
  background: var(--card); box-shadow: var(--e3); overflow-y: auto;
  padding: var(--s5); display: grid; align-content: start; gap: var(--s3);
  animation: sheet-in 0.2s ease-out;
}
@keyframes sheet-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 560px) {
  .sheet {
    top: auto; left: 0; width: 100%; max-height: 86dvh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--s4) var(--s4) calc(var(--s5) + env(safe-area-inset-bottom));
    animation-name: sheet-up;
  }
  @keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
}
body.sheet-open { overflow: hidden; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.sheet-head h2 { margin: 2px 0 0; }
.sheet-kicker {
  font-size: calc(11px * var(--fs)); font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ok);
}
.sheet-sub { margin: 0; color: var(--ink-soft); font-size: calc(14px * var(--fs)); }

.progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ok); border-radius: 999px; transition: width 0.3s; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.step {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s3);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.step .grow { flex: 1; min-width: 0; }
.step strong { display: block; font-size: calc(14px * var(--fs)); }
.step .muted { font-size: calc(12px * var(--fs)); }
.step-mark {
  width: 26px; height: 26px; border-radius: 999px; flex: none;
  border: 2px solid var(--line); display: grid; place-items: center; color: #fff;
}
.step.done .step-mark { background: var(--ok); border-color: var(--ok); }
.step.done { background: color-mix(in srgb, var(--ok-soft) 45%, transparent); }
.step.done strong { color: var(--ink-soft); }
.step-go { padding: 8px 14px; font-size: calc(13px * var(--fs)); white-space: nowrap; }

.guide-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); counter-reset: none; }
.guide-steps li { display: flex; gap: var(--s3); align-items: flex-start; font-size: calc(14px * var(--fs)); }
.guide-steps .num {
  width: 26px; height: 26px; border-radius: 999px; flex: none; display: grid; place-items: center;
  background: var(--fill); color: var(--fill-ink); font-weight: 700; font-size: calc(13px * var(--fs));
}
.guide-tip {
  background: var(--warn-soft); border-radius: var(--radius); padding: var(--s3);
  font-size: calc(13px * var(--fs)); color: var(--ink);
}
.guide-tip strong { color: var(--warn); }

/* ---------------------------------------------------------------- misc */
.field-label { font-size: calc(13px * var(--fs)); color: var(--ink-soft); font-weight: 500; margin-bottom: -4px; }
.opts.four { grid-template-columns: repeat(4, 1fr); }
.size-opt { position: relative; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 10px 6px; }
.size-opt input { position: absolute; opacity: 0; pointer-events: none; }
.size-opt strong { line-height: 1.1; }
.missing { color: var(--danger); font-weight: 600; }
.missing-note {
  margin-top: var(--s2); font-size: calc(12px * var(--fs)); color: var(--danger);
  background: var(--danger-soft); border-radius: 8px; padding: 6px 10px;
}
.pack-fee { font-size: calc(12px * var(--fs)); margin-top: 6px; opacity: 0.85; }

.kpi { min-width: 0; }
.kpi .v { overflow-wrap: anywhere; }
.signout-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); border-top: 1px solid var(--line); padding-top: var(--s3); }

/* ---------------------------------------------------------------- home
   Business overview. Status colours (critical / serious / warning) always
   travel with an icon and a word, never alone. */
.ov-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.ov-title { font-size: calc(24px * var(--fs)); margin: 0; letter-spacing: -0.02em; }
.ov-sub { margin: 2px 0 0; font-size: calc(13px * var(--fs)); }
.ov-period { margin: 0; }
.ov-section { margin-bottom: var(--s4); }
.ov-h { font-size: calc(15px * var(--fs)); margin: 0 0 var(--s2); color: var(--ink-soft); font-weight: 600; }

.bns { display: grid; gap: var(--s2); }
.bn {
  --sev: #fab219; --sev-soft: color-mix(in srgb, #fab219 14%, var(--card));
  display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4);
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--sev);
  border-radius: var(--radius);
}
.bn.critical { --sev: #d03b3b; --sev-soft: color-mix(in srgb, #d03b3b 12%, var(--card)); }
.bn.serious { --sev: #ec835a; --sev-soft: color-mix(in srgb, #ec835a 14%, var(--card)); }
.bn.ok { --sev: var(--ok); --sev-soft: var(--ok-soft); }
.bn-ico {
  width: 34px; height: 34px; border-radius: 999px; flex: none; display: grid; place-items: center;
  background: var(--sev-soft); color: var(--sev);
}
.bn.warning .bn-ico { color: #a86f00; }
.bn .grow { flex: 1; min-width: 0; }
.bn strong { display: block; font-size: calc(14px * var(--fs)); }
.bn .muted { font-size: calc(13px * var(--fs)); }
.bn-sev { font-size: calc(11px * var(--fs)); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.bn-go { flex: none; white-space: nowrap; font-size: calc(13px * var(--fs)); }
@media (max-width: 560px) {
  .bn { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: start; padding: var(--s3); }
  .bn-go { grid-column: 2; justify-self: start; }
}

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s3); }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: var(--s4); display: grid; gap: 2px; min-width: 0;
}
.stat-k { font-size: calc(12px * var(--fs)); color: var(--ink-soft); font-weight: 600; }
.stat-v { font-size: calc(26px * var(--fs)); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere; }
.stat-sub { font-size: calc(12px * var(--fs)); color: var(--ink-soft); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; min-height: 18px; }
.delta { font-weight: 700; border-radius: 999px; padding: 1px 7px; font-size: calc(11px * var(--fs)); }
.delta.up { color: var(--ok); background: var(--ok-soft); }
.delta.down { color: var(--danger); background: var(--danger-soft); }
.delta.flat { color: var(--ink-soft); background: var(--bg); }

.viz { display: grid; gap: var(--s2); min-width: 0; align-content: start; }
.viz-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.viz-head h2 { margin: 0; font-size: calc(16px * var(--fs)); }
.viz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--s3); margin-bottom: var(--s3); }
.viz-grid > .card { margin-bottom: 0; }
.chart-note { margin: 0; font-size: calc(12px * var(--fs)); }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--viz-grid); stroke-width: 1; }
.chart .base { stroke: var(--viz-base); stroke-width: 1; }
.chart .axis-t { fill: var(--ink-soft); font-size: 11px; font-family: inherit; }
.chart .mark { fill: var(--viz-1); transition: opacity 0.12s; }
.chart .hit { cursor: default; outline: none; }
.chart .hit:hover .mark, .chart .hit:focus .mark { opacity: 0.75; }
.chart .hit:focus rect { stroke: var(--viz-1); stroke-width: 1; }

.hbars { display: grid; gap: 10px; }
.hbar { display: grid; gap: 4px; outline: none; border-radius: 6px; }
.hbar:focus-visible { box-shadow: var(--ring); }
.hbar-label { font-size: calc(13px * var(--fs)); color: var(--ink); overflow-wrap: anywhere; }
.hbar-note { color: var(--ink-soft); font-size: calc(12px * var(--fs)); }
.hbar.flagged .hbar-note { color: var(--danger); font-weight: 600; }
.hbar-track { display: flex; align-items: center; gap: 8px; }
.hbar-track i {
  display: block; height: 14px; background: var(--viz-1); border-radius: 0 4px 4px 0; flex: none;
  max-width: calc(100% - 70px); transition: opacity 0.12s;
}
.hbar:hover .hbar-track i { opacity: 0.75; }
.hbar-val { font-size: calc(12px * var(--fs)); font-weight: 600; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }

.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin-top: var(--s2); }
.mini-stats.three { grid-template-columns: repeat(3, 1fr); }
.mini-stats .stat { padding: var(--s3); }
.mini-stats .stat-v { font-size: calc(20px * var(--fs)); }
.ok-line { display: flex; align-items: center; gap: 8px; color: var(--ok); font-size: calc(13px * var(--fs)); margin: 0; }
.ok-line svg { flex: none; }

.heat { display: grid; gap: 2px; overflow-x: auto; }
.heat-row { display: grid; grid-template-columns: 40px repeat(24, minmax(10px, 1fr)); gap: 2px; align-items: center; }
.heat-day { font-size: calc(11px * var(--fs)); color: var(--ink-soft); }
.heat-cell {
  height: 18px; border-radius: 3px;
  background: color-mix(in oklab, var(--viz-1) var(--a), var(--bg));
}
.heat-axis span { font-size: calc(10px * var(--fs)); color: var(--ink-soft); text-align: left; }

.viz-tip {
  position: fixed; z-index: 130; pointer-events: none; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); box-shadow: var(--e3); border-radius: 10px; padding: 8px 10px;
  font-size: calc(12px * var(--fs)); display: grid; gap: 1px; max-width: 240px;
}
.viz-tip strong { font-size: calc(14px * var(--fs)); }
.viz-table summary { cursor: pointer; font-size: calc(12px * var(--fs)); color: var(--ink-soft); }
.viz-table table { margin-top: var(--s2); }

/* ---------------------------------------------------------------- team */
.team-list { display: grid; gap: 2px; }
.team-row { gap: var(--s3); }
.role-select { width: auto; padding: 7px 10px; font-size: calc(13px * var(--fs)); }
.invite-av { background: var(--warn-soft); color: var(--warn); }
.ghost.small { padding: 6px 10px; font-size: calc(12px * var(--fs)); }
.invite-link {
  display: grid; gap: var(--s2); padding: var(--s3); border-radius: var(--radius);
  background: var(--brand-soft); border: 1px solid var(--fill-line);
}
.link-row input { flex: 1; min-width: 0; font-size: calc(12px * var(--fs)); padding: 9px; }
.wa-share { text-align: center; text-decoration: none; border-radius: var(--radius); }
@media (max-width: 480px) {
  .team-row { flex-wrap: wrap; }
  .team-row .grow { flex-basis: calc(100% - 60px); }
}
