/* Rice Order Hub — a packing desk for the family, a dashboard for the owner.
   Neutral paper and ink; paddy green is the only accent (main buttons, selected item, good figures);
   husk gold for "waiting to pack"; amber and red only in badges and dots. */
:root {
  --paper: #F7F8F6;
  --sheet: #FFFFFF;
  --ink: #1A1F1C;
  --muted: #6B736E;
  --line: #E3E6E1;
  --line-soft: #EEF0EC;
  --paddy: #1E4D2B;
  --paddy-soft: #EAF1EA;
  --husk: #B8901C;
  --husk-soft: #FBF1D2;
  --sky: #2F5D8A;
  --sky-soft: #E2ECF5;
  --red: #B3261E;
  --red-soft: #FBE4E1;
  --radius-lg: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(29, 36, 32, .06), 0 6px 18px -10px rgba(29, 36, 32, .25);
  --shadow-card: 0 1px 2px rgba(16, 24, 20, .05);
  --font: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111412; --sheet: #181C1A; --ink: #E6EAE7; --muted: #9BA39E; --line: #2A302C; --line-soft: #222724;
    --paddy: #7CC08C; --paddy-soft: #1E2E23; --husk: #E2BC4E; --husk-soft: #3A3218;
    --sky: #8DB7E0; --sky-soft: #1C2B3A; --red: #F08B82; --red-soft: #3D2120;
    --shadow: 0 1px 0 rgba(0,0,0,.4); --shadow-card: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font);
  font-size: 16px; line-height: 1.5; min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--paddy); }
:focus-visible { outline: 3px solid var(--husk); outline-offset: 2px; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px 120px; }
.hidden { display: none !important; }

/* top bar */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--paper);
  display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; max-width: 720px; margin: 0 auto;
}
.top h1 { font-size: 1.125rem; font-weight: 600; margin: 0; flex: 1; letter-spacing: -.01em; }
.sync-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--paddy); flex: none; }
.sync-dot.warn { background: var(--husk); }
.sync-dot.err { background: var(--red); }
.iconbtn {
  border: 1px solid var(--line); background: var(--sheet); border-radius: 999px; padding: 6px 12px;
  font-size: .875rem; cursor: pointer;
}

.testbar {
  background: var(--husk-soft); border: 1px dashed var(--husk); border-radius: var(--radius-sm);
  padding: 10px 12px; margin: 4px 0 14px; font-size: .9rem; display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap;
}
.testbar strong { font-weight: 600; }

/* the one bold thing: the packing queue headline */
.queue { display: flex; align-items: baseline; gap: 14px; margin: 8px 0 16px; }
.queue .n { font-size: 4.5rem; line-height: .9; font-weight: 600; color: var(--husk); font-variant-numeric: tabular-nums; }
.queue .n.zero { color: var(--paddy); }
.queue .what { font-size: 1.125rem; font-weight: 500; }
.queue .sub { color: var(--muted); font-size: .9rem; }

/* filters */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.chip {
  border: 1px solid var(--line); background: var(--sheet); border-radius: 999px; padding: 6px 14px;
  white-space: nowrap; cursor: pointer; font-size: .9rem;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .c { opacity: .7; margin-left: 4px; font-variant-numeric: tabular-nums; }
.search {
  width: 100%; border: 1px solid var(--line); background: var(--sheet); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 14px;
}

/* packing slips */
.slip {
  display: block; width: 100%; text-align: left; background: var(--sheet); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 12px; cursor: pointer; box-shadow: var(--shadow);
  position: relative;
}
.slip.s-new { border-left: 6px solid var(--husk); }
.slip.s-packed { border-left: 6px solid var(--paddy); }
.slip-head { display: flex; justify-content: space-between; gap: 8px; font-size: .875rem; color: var(--muted); }
.channel { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 500; }
.channel i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--muted); }
.ch-shopee i { background: #EE4D2D; } .ch-lazada i { background: #0F146D; } .ch-tiktok i { background: #25F4EE; box-shadow: 2px 0 0 #FE2C55; }
.ch-facebook i { background: #1877F2; } .ch-line i { background: #06C755; } .ch-web i { background: var(--husk); }
.bags { margin: 10px 0 6px; display: grid; gap: 4px; }
.bag { display: grid; grid-template-columns: 3.2rem 1fr; align-items: baseline; }
.bag b { font-size: 1.75rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.bag b small { font-size: 1rem; font-weight: 500; margin-left: 1px; }
.bag span { font-size: 1rem; }
.slip-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .9rem; }
.who { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 500; white-space: nowrap; }
.p-unpaid { background: var(--line); color: var(--muted); }
.p-new { background: var(--husk-soft); color: #7A5C00; }
.p-packed { background: var(--paddy-soft); color: var(--paddy); }
.p-shipped { background: var(--sky-soft); color: var(--sky); }
.p-delivered { background: var(--paddy-soft); color: var(--paddy); }
.p-cancelled, .p-returned { background: var(--red-soft); color: var(--red); }
@media (prefers-color-scheme: dark) { .p-new { color: var(--husk); } }
.flag { color: var(--red); font-size: .85rem; margin-top: 6px; }

.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.empty b { display: block; color: var(--ink); font-size: 1.125rem; margin-bottom: 4px; }

/* sections & forms */
.panel { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 14px;
  box-shadow: var(--shadow-card); }
.panel h2 { font-size: 1.05rem; margin: 0 0 4px; font-weight: 600; }
.panel p.help { color: var(--muted); font-size: .9rem; margin: 0 0 12px; }
h2.page { font-size: 1.375rem; font-weight: 600; margin: 6px 0 14px; letter-spacing: -.01em; }
label.f { display: block; font-size: .875rem; color: var(--muted); margin: 10px 0 4px; }
.in {
  width: 100%; border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius-sm);
  padding: 10px 12px;
}
textarea.in { min-height: 70px; resize: vertical; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 120px; }
.btn {
  border: 0; border-radius: 8px; padding: 12px 16px; font-weight: 600; cursor: pointer;
  background: var(--paddy); color: #fff; min-height: 48px;
}
@media (prefers-color-scheme: dark) { .btn { color: #0F1A12; } }
@media (min-width: 1024px) { .btn { min-height: 40px; } .btn.small { min-height: 36px; } }
.btn.wide { width: 100%; }
.btn.quiet { background: var(--sheet); color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
.btn.danger { background: var(--sheet); color: var(--red); border: 1px solid var(--red-soft); font-weight: 500; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: wait; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: var(--sheet); padding: 10px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* order detail */
.back { border: 0; background: none; padding: 4px 0; color: var(--paddy); cursor: pointer; font-weight: 500; }
.detail-id { font-size: 1.35rem; font-weight: 600; margin: 4px 0 2px; word-break: break-all; }
.kv { margin: 0; display: grid; grid-template-columns: 7.5rem 1fr; gap: 6px 10px; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.actions { display: grid; gap: 8px; margin-bottom: 14px; }
.notice { background: var(--red-soft); color: var(--red); border-radius: var(--radius-sm); padding: 10px 12px; font-size: .9rem; margin-bottom: 12px; }
.ok-notice { background: var(--paddy-soft); color: var(--paddy); }

/* stock */
.prod { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.prod .stock { font-size: 2.5rem; font-weight: 600; line-height: 1; text-align: right; font-variant-numeric: tabular-nums; }
.prod .stock.low { color: var(--red); }
.prod .unit { font-size: .85rem; color: var(--muted); text-align: right; }
.prod .name { font-weight: 600; }
.prod .meta { color: var(--muted); font-size: .875rem; }
.listing-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.tag { border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; font-size: .8rem; }
.tag.bad { border-color: var(--red); color: var(--red); }
.tag.warn { border-color: var(--husk); color: var(--husk); }

/* qty stepper (add order) */
.line-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.line-item:first-of-type { border-top: 0; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stepper button { width: 44px; height: 44px; border: 0; background: var(--paper); font-size: 1.25rem; cursor: pointer; }
.stepper output { width: 44px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.total { display: flex; justify-content: space-between; font-size: 1.25rem; font-weight: 600; margin: 12px 0; }

/* settings list */
.shop { padding: 12px 0; border-top: 1px solid var(--line); }
.shop > .row { margin-top: 8px; }
.shop:first-of-type { border-top: 0; }
.shop .st { font-size: .875rem; color: var(--muted); }
.shop .st.err { color: var(--red); }
.url { font-size: .8rem; color: var(--muted); word-break: break-all; }
.log { font-size: .85rem; max-height: 320px; overflow: auto; }
.log div { padding: 6px 0; border-top: 1px solid var(--line); }
.log .lvl-error { color: var(--red); } .log .lvl-warn { color: #8A6A00; }
@media (prefers-color-scheme: dark) { .log .lvl-warn { color: var(--husk); } }

/* bottom navigation */
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; background: var(--sheet); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs .inner { display: flex; width: 100%; max-width: 720px; }
nav.tabs a {
  flex: 1; text-align: center; padding: 10px 4px 12px; text-decoration: none; color: var(--muted); font-size: .8rem;
  display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative;
}
nav.tabs a svg { width: 24px; height: 24px; }
nav.tabs a[aria-current="page"] { color: var(--paddy); font-weight: 600; }
nav.tabs .badge {
  position: absolute; top: 4px; left: calc(50% + 6px); background: var(--husk); color: #fff; border-radius: 999px;
  font-size: .7rem; min-width: 18px; padding: 0 5px; line-height: 18px; font-weight: 600;
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 9;
  background: var(--ink); color: var(--paper); border-radius: 14px; padding: 12px 16px; max-width: min(92vw, 520px);
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); transition: opacity .2s, transform .2s; white-space: pre-line;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.alert { background: var(--husk); color: #1D1600; font-weight: 500; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ================================================================ money */
a.chip { text-decoration: none; color: var(--ink); }
.neg { color: var(--red) !important; }

/* headline figure for each money page (net profit, money to receive, cash on hand) */
.profit-hero { margin: 4px 0 16px; }
.ph-label { color: var(--muted); font-size: .95rem; }
.ph-num { font-size: 3.25rem; line-height: 1.05; font-weight: 600; color: var(--paddy); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ph-delta { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.ph-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.ph-row > div { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; min-width: 0; }
.ph-row b { display: block; font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ph-row span { display: block; color: var(--muted); font-size: .8rem; line-height: 1.3; }

/* one line: label left, figure right */
.mline { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 6px 0; font-size: .95rem; }
.mline > span:last-child, .mline > b { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* target / budget progress: the tick shows how much of the month has gone */
.mbar { position: relative; height: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; margin: 0 0 8px; overflow: visible; }
.mbar .fill { position: absolute; inset: 0 auto 0 0; background: var(--paddy); border-radius: 999px; }
.mbar .fill.over { background: var(--red); }
.mbar .tick { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); opacity: .55; border-radius: 1px; }

/* profit statement, read top to bottom like a receipt */
.stmt > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: .95rem; }
.stmt > div:first-child { border-top: 0; }
.stmt b { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stmt small { color: var(--muted); }
.stmt .minus b { color: var(--muted); }
.stmt .sum { border-top: 1.5px solid var(--ink); font-weight: 600; }
.stmt .sum b { font-weight: 600; }
.stmt .total { font-size: 1.15rem; color: var(--paddy); }

/* KPI tiles */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--paper); min-width: 0;
  box-shadow: var(--shadow-card); }
.tile .tl { font-size: .85rem; font-weight: 500; }
.tile .tv { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; margin: 2px 0; overflow-wrap: anywhere; }
.tile .tv small { font-size: .8rem; font-weight: 500; color: var(--muted); }
.tile .th { font-size: .78rem; color: var(--muted); line-height: 1.35; }
.tile.neg .tv { color: var(--red); }

/* by-channel table */
.tbl-wrap { overflow-x: auto; margin: 0 -4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.tbl th { text-align: right; font-weight: 500; color: var(--muted); font-size: .8rem; padding: 6px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { text-align: right; padding: 8px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl td.u-best { background: var(--paddy-soft); box-shadow: inset 3px 0 0 var(--paddy); }      /* unit economics: best cell */
.tbl td.u-worst { background: var(--red-soft); box-shadow: inset 3px 0 0 var(--red); }        /* and worst cell */

/* 6-month chart */
.trend { width: 100%; height: auto; display: block; }
.trend .b-sales { fill: var(--husk); }
.trend .b-profit { fill: var(--paddy); }
.trend .b-loss { fill: var(--red); }
.trend .b-target { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 3 2; }
.trend .b-axis { stroke: var(--line); stroke-width: 1; }
.trend .b-lab { fill: var(--muted); font-size: 9px; font-family: var(--font); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend i.b-sales { background: var(--husk); }
.legend i.b-profit { background: var(--paddy); }
.legend i.b-target { height: 0; border-top: 2px dashed var(--ink); border-radius: 0; width: 14px; }

/* expense / plan / payment rows */
.exp { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.exp:first-child { border-top: 0; }
.exp > div:first-child { min-width: 0; }
.exp .em { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.exp .ea { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.exp .ea b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.big-in { font-size: 1.75rem; font-weight: 600; padding: 8px 12px; font-variant-numeric: tabular-nums; }
.budget-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
.budget-grid label.f { margin-top: 8px; }
.budget-grid .in { margin-top: 4px; color: var(--ink); }

/* ================================================================ lots, history, customers, campaigns, costing */
nav.tabs a { font-size: .72rem; padding-left: 2px; padding-right: 2px; min-width: 0; }
nav.tabs a span[data-t] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* which lot to pick up when packing */
.use-lot { display: block; margin-top: 4px; font-size: .9rem; background: var(--husk-soft); color: #6A5100; border-radius: 8px; padding: 4px 8px; width: fit-content; }
.bag .use-lot b { font-size: inherit; font-weight: 600; letter-spacing: .02em; line-height: inherit; }
.use-lot.quiet { background: none; color: var(--muted); padding: 0; }
@media (prefers-color-scheme: dark) { .use-lot { color: var(--husk); } }

.history { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.history li { padding: 6px 0 6px 14px; border-left: 2px solid var(--line); position: relative; }
.history li::before { content: ""; position: absolute; left: -5px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--paddy); }
.history li span { display: block; color: var(--muted); font-size: .8rem; }

/* lots on the shelf */
.lots { margin: 12px 0; border-top: 1px solid var(--line); padding-top: 8px; }
.lots-h { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.lot { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.lot:last-child { border-bottom: 0; }
.lot .code { font-weight: 600; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.lot .em { color: var(--muted); font-size: .82rem; }
.lot-n { text-align: right; line-height: 1; }
.lot-n b { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.lot-n span { display: block; font-size: .75rem; color: var(--muted); }
.lot-acts { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.lot-acts .btn { text-decoration: none; display: inline-flex; align-items: center; }
.lot.old .code, .lot.soon .code { color: var(--red); }
.fresh-tag { display: inline-block; font-size: .75rem; border-radius: 999px; padding: 1px 8px; margin-top: 3px; font-weight: 500; }
.fresh-tag.old { background: var(--red-soft); color: var(--red); }
.fresh-tag.soon { background: var(--husk-soft); color: #7A5C00; }
@media (prefers-color-scheme: dark) { .fresh-tag.soon { color: var(--husk); } }
.pack-form { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 12px 12px; margin-top: 10px; }

/* add order */
.consent { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 4px; font-size: .9rem; line-height: 1.4; cursor: pointer; }
.consent input { width: 20px; height: 20px; flex: none; margin-top: 1px; accent-color: var(--paddy); }
.returning { background: var(--paddy-soft); color: var(--paddy); border-radius: var(--radius-sm); padding: 6px 10px; margin-top: 6px; font-size: .88rem; }

/* customers */
.due-card .em { color: var(--muted); font-size: .85rem; margin: 2px 0 8px; }
.due-card .msg { font-size: .92rem; line-height: 1.45; min-height: 0; }
.due-acts { margin-top: 8px; gap: 6px; }
.due-acts .btn { text-decoration: none; display: inline-flex; align-items: center; }
a.cu-row { text-decoration: none; color: inherit; }
a.cu-row:hover b { color: var(--paddy); }
.back { display: inline-block; text-decoration: none; }

/* campaigns */
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .92rem; }
.checks label { display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; }
.checks input { width: 18px; height: 18px; accent-color: var(--paddy); }
.camp-name { font-size: 1.1rem; }
.camp .em { color: var(--muted); font-size: .85rem; }
.camp-net { font-size: 2rem; font-weight: 600; color: var(--paddy); margin: 8px 0 4px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.camp-net span { display: block; font-size: .8rem; font-weight: 400; color: var(--muted); }

/* cost per bag */
.cost-grid { display: grid; gap: 14px; }
.cost-grid > * { min-width: 0; }
@media (min-width: 700px) { .cost-grid { grid-template-columns: 1fr 1fr; align-items: start; } .cost-grid #costOut { position: sticky; top: 64px; } }
.cost-grid form h2 { margin-top: 10px; }
.cost-grid form h2:first-child { margin-top: 0; }
.cost-out .ph-num { font-size: 2.6rem; }

/* settings */
.person.off b { opacity: .55; }
.notice.warn { background: var(--husk-soft); color: #6A5100; }
@media (prefers-color-scheme: dark) { .notice.warn { color: var(--husk); } }
.ok-text { color: var(--paddy) !important; }
.add-user { border-top: 1px solid var(--line); margin-top: 8px; }
.cost-out .tbl { font-size: .85rem; }
.cost-out .tbl th { white-space: normal; vertical-align: bottom; line-height: 1.25; }
.cost-out .tbl td, .cost-out .tbl th { padding-left: 3px; padding-right: 3px; }

/* ================================================================ payments, shipping, pack plan, subscriptions */
.ship-link { display: block; text-align: center; text-decoration: none; background: var(--sky-soft); color: var(--sky); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 12px; font-weight: 600; }
.pay-box.slip { border-color: var(--husk); }
.pay-box.done .mline span:first-child { color: var(--paddy); font-weight: 600; }
.slip-img { display: block; max-width: 100%; max-height: 360px; border-radius: var(--radius-sm); border: 1px solid var(--line); margin-top: 8px; }
.buyer summary { cursor: pointer; color: var(--paddy); font-size: .9rem; margin-top: 6px; }
.scan-box { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; padding: 16px; }
.scan-inner { width: 100%; max-width: 420px; text-align: center; color: #fff; }
.scan-inner video { width: 100%; border-radius: 14px; background: #000; aspect-ratio: 3 / 4; object-fit: cover; }
.ship-row .em { color: var(--muted); font-size: .85rem; }
.ship-row select { flex: 0 0 auto; max-width: 42%; }
.plan-card { border-left: 6px solid var(--husk); }
.plan-head { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.plan-n { font-size: 2.6rem; font-weight: 600; color: var(--husk); line-height: 1; font-variant-numeric: tabular-nums; }
.plan-n.zero { color: var(--paddy); }
.plan-head .em, .plan-row .em { color: var(--muted); font-size: .85rem; }
.plan-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.plan-pack { text-align: right; line-height: 1; }
.plan-pack span { display: block; font-size: .75rem; color: var(--muted); }
.plan-pack b { font-size: 1.6rem; font-weight: 600; color: var(--husk); font-variant-numeric: tabular-nums; }
.plan-pack.zero b { color: var(--muted); }
.sub .em { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.sub.cancelled { opacity: .6; }
.op-link { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin: 10px 0; }
.op-link b { display: block; word-break: break-all; margin: 2px 0 8px; }
.op-link .btn { text-decoration: none; display: inline-flex; align-items: center; }
.car-row { margin-bottom: 6px; }
a.btn.small { text-decoration: none; display: inline-flex; align-items: center; }

/* ================================================================ computer screens (1024 px and wider)
   Bottom tabs become a sidebar, pages get wider, and each screen uses columns where it helps.
   Phones and small tablets keep the one-column layout above. */
@media (min-width: 1024px) {
  :root { --side: 228px; }
  body { padding-left: var(--side); }

  /* sidebar */
  nav.tabs { top: 0; bottom: 0; right: auto; width: var(--side); border-top: 0; border-right: 1px solid var(--line);
    padding: 72px 12px 16px; justify-content: flex-start; flex-direction: column; }
  nav.tabs::before { content: ""; position: absolute; top: 18px; left: 22px; width: 34px; height: 34px;
    background: url(/static/icon.svg) center / contain no-repeat; }
  nav.tabs .inner { flex-direction: column; gap: 2px; max-width: none; }
  nav.tabs a { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: 12px;
    font-size: .95rem; color: var(--ink); }
  nav.tabs a span[data-t] { overflow: visible; }
  nav.tabs a svg { width: 22px; height: 22px; color: var(--muted); }
  nav.tabs a:hover { background: var(--paper); }
  nav.tabs a[aria-current="page"] { background: var(--paddy-soft); color: var(--paddy); font-weight: 500; }
  nav.tabs a[aria-current="page"] svg { color: var(--paddy); }
  nav.tabs .badge { position: static; margin-left: auto; }

  .top { max-width: none; padding: 18px 32px 10px; }
  .top h1 { font-size: 1.25rem; }
  .wrap { max-width: 1240px; margin: 0; padding: 0 32px 64px; }
  .toast { left: calc(50% + var(--side) / 2); bottom: 32px; }

  /* orders: packing slips as a grid of cards */
  #view[data-page="orders"] { max-width: 1240px; }
  #view[data-page="orders"] .search { max-width: 520px; }
  #list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; align-items: start; }
  #list .slip { margin: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-start; }
  #list .slip .slip-foot { margin-top: auto; padding-top: 4px; }
  #list .empty { grid-column: 1 / -1; }
  .queue .n { font-size: 5rem; }

  /* one order: what to do on the left, details on the right */
  .od-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  .od-side { position: sticky; top: 16px; }
  #view[data-page="order"] .detail-id { font-size: 1.6rem; }

  /* stock, add order, shipping: two columns of cards */
  #view[data-page="stock"] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; align-items: start; }
  #view[data-page="stock"] > :not(.panel), #view[data-page="stock"] > #packPlan { grid-column: 1 / -1; }
  #view[data-page="stock"] > .panel:has(.line-item) { grid-column: 1 / -1; }   /* items to link */
  #view[data-page="add"] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 18px; align-items: start; }
  #view[data-page="add"] > :not(.panel) { grid-column: 1 / -1; }
  #view[data-page="ship"] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; align-items: start; }
  #view[data-page="ship"] > :not(.ship-row) { grid-column: 1 / -1; }
  #view[data-page="ship"] > a.btn.wide { max-width: 420px; }

  /* money, customers, settings: panels flow into two columns like a newspaper */
  #view[data-page="money"], #view[data-page="customers"], #view[data-page="settings"] { column-count: 2; column-gap: 18px; }
  #view[data-page="money"] > *, #view[data-page="customers"] > *, #view[data-page="settings"] > * { break-inside: avoid; }
  #view[data-page="money"] > :is(h2, .page-row, .dash-tabs, .chips, .profit-hero, .tiles, .help, .empty, p, select),
  #view[data-page="customers"] > :is(h2, .page-row, .dash-tabs, .chips, .profit-hero, .tiles, .help, .empty, p, .row, .back, .detail-id, .em),
  #view[data-page="settings"] > :is(h2, p, form) { column-span: all; }
  #view[data-page="settings"] #settingsExtra, #view[data-page="settings"] #settingsMore { display: contents; }
  #view[data-page="settings"] > form { max-width: 420px; }
  #view[data-page="money"] .panel, #view[data-page="customers"] .panel, #view[data-page="settings"] .panel { display: inline-block; width: 100%; }
  /* pages that work better in one wide column */
  #view[data-page="money"][data-sub="costing"], #view[data-page="money"][data-sub="receipts"],
  #view[data-page="customers"]:has(.cu-row) { column-count: 1; }
  #view[data-page="customers"]:has(.cu-row) > :not(h2):not(.chips) { max-width: 900px; }
  /* expenses, plan, owner money: the form stays on the left, the list on the right */
  #view[data-page="money"]:is([data-sub="expenses"], [data-sub="owner"]) { column-count: 1; display: grid;
    grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); gap: 0 18px; align-items: start; }
  #view[data-page="money"]:is([data-sub="expenses"], [data-sub="owner"]) > :nth-child(-n+3) { grid-column: 1 / -1; }
  #view[data-page="money"][data-sub="expenses"] > :nth-child(4) { grid-column: 1; grid-row: 4 / span 40; position: sticky; top: 16px; }
  #view[data-page="money"][data-sub="expenses"] > :nth-child(n+5) { grid-column: 2; }
  #view[data-page="money"][data-sub="owner"] > .profit-hero { grid-column: 1 / -1; }
  #view[data-page="money"][data-sub="owner"] > .panel:has(form) { grid-column: 1; }
  #view[data-page="money"] .profit-hero .ph-row { max-width: 720px; }
  /* equipment: the list on the left, the add / change form on the right */
  #view[data-page="money"][data-sub="equipment"] { column-count: 1; display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); gap: 0 18px; align-items: start; }
  #view[data-page="money"][data-sub="equipment"] > :nth-child(-n+5) { grid-column: 1 / -1; }
  #view[data-page="money"][data-sub="equipment"] > :nth-child(7) { grid-column: 2; grid-row: 6; position: sticky; top: 16px; }
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .panel .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cost-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

  /* forms read better a little narrower than the page */
  .in { font-size: .97rem; }
  .actions { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

@media (min-width: 1500px) {
  .wrap { max-width: 1440px; }
  #view[data-page="money"]:not([data-sub="costing"]):not([data-sub="receipts"]), #view[data-page="settings"] { column-count: 3; }
}

/* ===================================================================== family parts (family.js) */
/* menu: phones show 4 + More, computers show everything */
@media (max-width: 1023px) { nav.tabs a.phone-hide { display: none; } }
@media (min-width: 1024px) { nav.tabs a.phone-only { display: none; } }
.more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.more-item { display: flex; align-items: center; gap: 10px; padding: 16px 14px; border-radius: var(--radius-lg); background: var(--sheet);
  border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 500; }
.more-item svg { width: 22px; height: 22px; color: var(--paddy); }

/* Today */
.kicker { color: var(--muted); margin: 14px 0 0; font-size: .95rem; }
h3.sec { font-size: 1rem; margin: 22px 0 10px; }
h3.sub-h { font-size: .95rem; margin: 14px 0 6px; }
.jobs { display: grid; gap: 10px; }
@media (min-width: 1024px) { .jobs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.job { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--sheet); border: 1px solid var(--line);
  border-radius: var(--radius-lg); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.job.urgent { border-color: var(--husk); box-shadow: inset 4px 0 0 var(--husk), var(--shadow); }
.job-n { font-size: 1.9rem; font-weight: 600; min-width: 3.2rem; color: var(--paddy); font-variant-numeric: tabular-nums; line-height: 1.1; }
.job.urgent .job-n { color: #7A5C00; }
@media (prefers-color-scheme: dark) { .job.urgent .job-n { color: var(--husk); } }
.job.late { border-color: var(--red); box-shadow: inset 4px 0 0 var(--red), var(--shadow); }
.job.late .job-n { color: var(--red); }
.job-t b { display: block; font-weight: 600; }
.job-t small { color: var(--muted); }

/* sacks in Bangkok */
.sacks-n b { font-size: 2.6rem; font-weight: 600; color: var(--paddy); font-variant-numeric: tabular-nums; }
.sacks-n span { margin-left: 6px; color: var(--muted); }
.sacks.low .sacks-n b { color: var(--red); }
details summary { cursor: pointer; color: var(--paddy); font-weight: 500; }

/* mill */
.big-acts { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.big-acts .btn { min-height: 54px; font-size: 1.02rem; display: inline-flex; align-items: center; gap: 8px; }
.big-acts .btn svg { width: 20px; height: 20px; }
@media (max-width: 560px) { .big-acts .btn { flex: 1 1 100%; justify-content: center; } }

/* messages, content */
.quote { margin: 8px 0 12px; padding: 10px 12px; border-left: 4px solid var(--husk); background: var(--paper); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; white-space: pre-wrap; }
.post-row, .agent-row, .person-pay { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.date-chip { min-width: 4.6rem; font-weight: 600; color: var(--paddy); font-size: .9rem; }
.clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.grow { flex: 1; min-width: 0; }

/* AI agents */
.agent-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--husk-soft); color: #7A5C00; flex: none; }
.agent-mark svg { width: 22px; height: 22px; }
.chip.pick { cursor: pointer; }
.chip.pick input { position: absolute; opacity: 0; pointer-events: none; }
.chip.pick:has(input:checked) { background: var(--paddy); color: #fff; border-color: var(--paddy); }
.chip.pick:has(input:focus-visible) { outline: 2px solid var(--husk); outline-offset: 2px; }
.draft.pending { border: 1px solid var(--husk); }
.draft-text { font-size: .97rem; line-height: 1.65; margin-top: 6px; }
.draft-read { white-space: pre-wrap; background: var(--paper); border-radius: var(--radius-sm); padding: 10px 12px; max-height: 420px; overflow-y: auto; margin-top: 6px; }

/* pay */
.month-bar { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.month-bar b { min-width: 9rem; text-align: center; }
.pp-amt { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.pay-now { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 6px; }
.pay-qr { width: 220px; height: 220px; display: block; margin: 8px 0; background: #fff; padding: 8px; border-radius: var(--radius-sm); }
@media (min-width: 1024px) { .pay-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0 18px; align-items: start; } }

/* who can open what */
.access-dlg { border: 0; border-radius: var(--radius-lg); padding: 20px; width: min(640px, calc(100vw - 20px)); max-height: calc(100vh - 30px);
  background: var(--sheet); color: var(--ink); box-shadow: var(--shadow); }
.access-dlg::backdrop { background: rgba(0, 0, 0, .4); }
.perm-grid { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 10px; margin-top: 12px; }
.perm-row { display: grid; grid-template-columns: 1fr repeat(3, 3.6rem); align-items: center; gap: 4px; padding: 8px 0; border-top: 1px solid var(--line); }
.perm-row.head { border-top: 0; font-size: .8rem; color: var(--muted); font-weight: 600; text-align: center; padding: 4px 0; }
.perm-row small { display: block; color: var(--muted); font-size: .8rem; }
.perm-row label { display: grid; place-items: center; min-height: 40px; cursor: pointer; }
.perm-row input[type=radio], .checks input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--paddy); }
.btn svg { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.btn { gap: 6px; }

/* equipment */
.eq { padding: 12px 0; border-top: 1px solid var(--line); }
.eq:first-child { border-top: 0; }
.eq-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 6px; }
.eq-top .ea { text-align: right; }
.eq.gone { opacity: .75; }
.eq-ret { margin-top: 10px; background: var(--paper); border-radius: var(--radius-sm); padding: 10px 12px; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: .95rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--paddy); flex: none; }

/* supply plan */
.lead { font-size: 1.05rem; margin: 4px 0 12px; }
.pipe { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (min-width: 720px) { .pipe { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stage { position: relative; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.stage .tl { font-size: .82rem; color: var(--muted); }
.stage .tv { font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; margin: 2px 0; }
.stage .th { font-size: .82rem; color: var(--muted); line-height: 1.4; }
.stage.warn { border-color: var(--red); background: var(--red-soft); }
.stage.warn .tv { color: var(--red); }
@media (min-width: 720px) { .stage:not(:last-child)::after { content: "›"; position: absolute; right: -9px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 1.3rem; } }
.steps { display: flex; flex-direction: column; }
.step { display: grid; grid-template-columns: 7.5rem 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; }
.step.urgent .step-d b { color: var(--red); }
.step-d { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.step-t { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.step-t svg { width: 22px; height: 22px; flex: none; color: var(--paddy); margin-top: 1px; }
.step-t small { display: block; color: var(--muted); font-size: .85rem; }
@media (max-width: 520px) { .step { grid-template-columns: 1fr auto; } .step-d { grid-column: 1 / -1; flex-direction: row; align-items: center; } }
.trend .b-line { stroke: var(--paddy); stroke-width: 2.2; }
.legend i.b-line-k { height: 0; border-top: 2.5px solid var(--paddy); border-radius: 0; width: 14px; }

/* investment */
.iv-curve { width: 100%; height: auto; display: block; }
.iv-curve .b-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.iv-curve .b-axis { stroke: var(--muted); stroke-width: 1.2; }
.iv-curve .iv-lab { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.iv-curve .iv-pb-t { fill: var(--ink); font-weight: 600; }
.iv-line { fill: none; stroke: var(--paddy); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.iv-dash { stroke-dasharray: 6 5; opacity: .8; }
.iv-pb { stroke: var(--husk); stroke-width: 1.5; stroke-dasharray: 4 4; }
.iv-dot { fill: var(--paddy); stroke: var(--sheet); stroke-width: 2; }
.legend i.iv-k { height: 0; width: 18px; border-radius: 0; border-top: 2.5px solid var(--paddy); }
.legend i.iv-k.dash { border-top-style: dashed; }
.iv-verdict { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm); font-weight: 600; }
.iv-verdict.good { background: var(--paddy-soft); color: var(--paddy); }
.iv-verdict.meh { background: var(--husk-soft); color: var(--ink); }
.iv-verdict.bad { background: var(--red-soft); color: var(--red); }
@media (min-width: 1024px) {
  #view[data-page="money"][data-sub="invest"] { column-count: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 18px; align-items: start; }
  #view[data-page="money"][data-sub="invest"] > :is(h2, .chips, .help, .notice, .tiles, .iv-wide) { grid-column: 1 / -1; }
}

/* cost per bag by step (fin.js) */
.cstep { padding: 8px 0; border-bottom: 1px solid var(--line); }
.cstep-h { display: flex; justify-content: space-between; gap: 12px; font-size: .95rem; }
.cstep-h b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cstep-bar { display: block; height: 8px; border-radius: 999px; background: var(--paddy); margin: 6px 0 4px; }
.cstep-bar.credit { background: var(--husk); }
.cstep-total { border-bottom: 1px solid var(--line); font-weight: 600; }

/* spreadsheet import (extras.js) */
.imp-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.imp-col { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; min-width: 0; }
.imp-col > span { font-weight: 600; overflow-wrap: anywhere; }

/* offline (outbox.js) */
.offline-bar { background: var(--husk-soft); color: var(--ink); font-size: .85rem; padding: 6px 16px; text-align: center; }
.outbox-badge { background: var(--husk-soft); color: var(--ink); text-decoration: none; margin-left: auto; margin-right: 8px; }
.outbox-item { border-bottom: 1px solid var(--line); padding: 4px 0 8px; }
.ob-form { padding: 6px 0; }

/* module hubs (family.js OH.hubPage) */
.hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 10px 0; }
.hub-card { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--sheet); border: 1px solid var(--line); box-shadow: var(--shadow-card); color: var(--ink); text-decoration: none; min-width: 0; }
.hub-card:hover { border-color: var(--paddy); }
.hub-t { font-weight: 600; font-size: .95rem; padding-right: 16px; }
.hub-v { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.hub-s { font-size: .8rem; color: var(--muted); }
.hub-card .hub-dot { position: absolute; top: 12px; right: 12px; }
.hub-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--line); vertical-align: middle; }
.hub-dot.red { background: var(--red); } .hub-dot.amber { background: var(--husk); } .hub-dot.green { background: var(--paddy); }
.hub-legend { font-size: .8rem; }

/* dashboard kit */
.page-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dash-tabs { display: flex; flex-wrap: nowrap; gap: 18px; border-bottom: 1px solid var(--line); margin: 0 0 16px;
  overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.dash-tabs::-webkit-scrollbar { display: none; }
.dash-tabs a { flex: none; white-space: nowrap; padding: 10px 2px; color: var(--muted); text-decoration: none; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.dash-tabs a:hover { color: var(--ink); }
.dash-tabs a:focus-visible { outline-offset: -3px; }
.dash-tabs a[aria-current] { color: var(--paddy); border-bottom-color: var(--paddy); }
.dash-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.dash-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.dash-hero, .dash-kpi, .dash-att { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); padding: 16px; min-width: 0; }
.dash-hero .hero-label, .dash-kpi .kpi-label { color: var(--muted); font-size: .875rem; font-weight: 500; }
.hero-n { font-size: 2.75rem; line-height: 1.1; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere; }
.hero-sub, .kpi-sub { color: var(--muted); font-size: .875rem; }
.dash-kpi { display: block; color: var(--ink); text-decoration: none; }
a.dash-kpi:hover { border-color: var(--paddy); }
.kpi-n { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; margin: 2px 0; overflow-wrap: anywhere; }
.dash-att h3 { font-size: 1rem; font-weight: 600; margin: 0 0 8px; }
.dash-att ul { list-style: none; margin: 0; padding: 0; }
.dash-att li + li { border-top: 1px solid var(--line-soft); }
.dash-att li a { display: flex; align-items: center; gap: 8px; padding: 10px 0; color: var(--ink); text-decoration: none; min-height: 44px; }
.dash-att .att-label { flex: 1; min-width: 0; }
.dash-att .att-value { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dash-att .dot, .dash-kpi .dot, .dash-hero .dot { display: inline-block; margin-right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.dash-att .dot.red, .dash-kpi .dot.red, .dash-hero .dot.red { background: var(--red); }
.dash-att .dot.amber, .dash-kpi .dot.amber, .dash-hero .dot.amber { background: var(--husk); }
.dash-att .dot.green, .dash-kpi .dot.green, .dash-hero .dot.green { background: var(--paddy); }
.dash-att .dot.grey, .dash-kpi .dot.grey, .dash-hero .dot.grey { background: var(--line); }
a.dash-hero { display: block; color: var(--ink); text-decoration: none; }
a.dash-hero:hover { border-color: var(--paddy); }
.dash-clear { color: var(--paddy); font-weight: 500; padding: 8px 0; }
.dash-line, .dash-bars { display: block; width: 100%; height: auto; margin-top: 10px; overflow: visible; }
.dash-line { height: 72px; }
.dash-line path { fill: none; stroke: var(--paddy); stroke-width: 2px; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.dash-line .pt { stroke: var(--paddy); stroke-width: 6px; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.dash-bars rect { fill: var(--paddy); }
.dash-bars text { fill: var(--muted); font-size: 11px; }
@media (min-width: 1024px) { .dash-top { grid-template-columns: 2fr 1fr; } .dash-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1500px) { .dash-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* support bot: chat thread in Customers → Messages and the "Try a question" box */
.sp-thread-box { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; max-height: 360px; overflow-y: auto; }
.sp-b { max-width: 88%; padding: 8px 12px; border-radius: 14px; background: var(--sheet); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; align-self: flex-start; }
.sp-b small { display: block; color: var(--muted); font-size: .75rem; }
.sp-b.bot { background: var(--paper); }
.sp-b.team { align-self: flex-end; background: var(--paddy-soft); border-color: var(--paddy-soft); }
.sp-thumb { display: block; max-width: 160px; max-height: 160px; margin-top: 6px; border-radius: 8px; border: 1px solid var(--line); }

/* management: scorecard tiles, all-performance rows, goals (plan 04b) */
.sc-tile { display: flex; flex-direction: column; gap: 4px; }
.sc-tile details { font-size: .85rem; }
.sc-tile .row, .mg-kr .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.sc-tile .in, .mg-kr .in { max-width: 130px; }
.mg-perf-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.mg-perf-row .dash-line { grid-column: 1 / -1; height: 36px; width: 100%; }
.mg-perf-row .em:last-child { grid-column: 1 / -1; }
.mg-n { font-weight: 600; font-variant-numeric: tabular-nums; }
.mg-goal .mbar { margin: 6px 0; }
.mg-kr { padding: 8px 0; border-top: 1px solid var(--line-soft); }
.mg-panel { margin-top: 14px; }
.mg-grid { border-collapse: collapse; margin: 8px 0 14px; }
.mg-grid th, .mg-grid td { border: 1px solid var(--line); padding: 8px 12px; text-align: center; min-width: 44px; font-variant-numeric: tabular-nums; }
.mg-grid th { background: var(--paper); color: var(--muted); font-weight: 500; }
.mg-risk { padding: 10px 0; border-top: 1px solid var(--line-soft); }
.mg-risk details { margin-top: 6px; }
.mg-work th, .mg-work td { padding: 6px 10px; text-align: right; }
.mg-work th:first-child, .mg-work td:first-child { text-align: left; }
.mg-grid td.red { background: var(--red-soft); }
.mg-grid td.amber { background: color-mix(in srgb, var(--husk) 22%, transparent); }
.mg-grid td.green { background: var(--paddy-soft); }
