:root { --line:#999; --head:#eee; }
body { font: 15px system-ui, sans-serif; margin: 0; padding: 16px; }
#bar { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:8px; }
button.danger { color:#b00; }
table.grid { border-collapse: collapse; font: 15px/1.4 ui-monospace, monospace; }
table.grid th, table.grid td { border: 1px solid var(--line); padding: 4px 8px; }
table.grid th { background: var(--head); position: sticky; top: 0; }
table.grid td:focus { outline: 2px solid #06c; background: #eef; }
table.grid tbody tr:nth-child(even) { background:#fafafa; }
/* Deleted rows stay visible but struck through — the ledger never loses a line. */
table.grid tr.deleted td { text-decoration: line-through; color:#6b7280; background:#f3f3f3; }
table.grid td.ro { color:#2f3746; background:#f8f8f8; cursor:default; }
/* Expenses: same grid idiom as entries, reused bar layout, right-aligned money. */
h3 { margin:22px 0 4px; }
#xbar { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin:8px 0; }
table.grid td.num, table.grid th:nth-child(4) { text-align:right; }
#xsum { color:#2f3746; }
/* Admin profit columns: derived, read-only, tinted to read as "not part of the
   editable sheet" — right-aligned like the money they are. */
table.grid th.px { color:#1F4E79; background:#eef4fa; }
table.grid td.px { background:#f7fbff; color:#1F4E79; cursor:default; }
table.grid td.px.neg { color:#b00; }
/* Item master: a click toggles booleans; inactive rows grey out. */
table.grid td.bool { text-align:center; cursor:pointer; user-select:none; }
table.grid td.bool:hover { background:#eef; }
table.grid tr.inactive td { color:#aaa; font-style:italic; }
#err, .err { color:#b00; }
#newBox { border:1px solid var(--line); padding:8px; margin:8px 0; background:#fcfcfc; }
#newBox input { margin:1px; }
#sel { color:#06c; font-weight:600; }
.muted { color:#4a5568; font-size:13px; }

/* Page nav: the three portal pages are peers, so each links to the others. */
.pagenav { margin:0 0 12px; font-size:13px; display:flex; gap:14px; align-items:baseline; }
.pagenav a { color:#1F4E79; text-decoration:none; }
.pagenav a:hover { text-decoration:underline; }
.pagenav b { color:#111; }

/* Stock alerts — mirrors the app's _alertSection cards */
.card { border:1px solid #ddd; border-radius:8px; padding:10px 12px; margin:12px 0; background:#fff; }
.card.out { border-color:#e0b4b4; }
.card.low { border-color:#e8d5a8; }
.hd { font-size:14px; font-weight:700; margin:0 0 6px; display:flex; align-items:center; gap:8px; }
.hd.out { color:#bb0000; }
.hd.low { color:#b06d00; }
.pill { font-size:12px; font-weight:700; border-radius:10px; padding:1px 8px; background:rgba(0,0,0,.08); }
.hd.out .pill { background:rgba(187,0,0,.14); color:#bb0000; }
.hd.low .pill { background:rgba(176,109,0,.16); color:#b06d00; }
ul.alerts { list-style:none; margin:0; padding:0; }
ul.alerts li { display:flex; align-items:center; gap:8px; padding:3px 0; font-size:13px; border-top:1px solid #f2f2f2; }
ul.alerts li:first-child { border-top:0; }
ul.alerts li.ok { color:#1a7f37; }
.sz { font-size:11px; font-weight:700; border-radius:50%; width:26px; height:26px; display:inline-flex;
      align-items:center; justify-content:center; flex:0 0 auto; }
.sz.out { background:#ffd9d9; color:#bb0000; }
.sz.low { background:#ffeac2; color:#b06d00; }
.nm { flex:1 1 auto; }
ul.alerts b.out { color:#bb0000; font-size:11px; }
ul.alerts b.low { color:#b06d00; font-size:11px; }
.muted { color:#4a5568; font-size:13px; }

/* Add variant page */
fieldset.box { border:1px solid #ddd; border-radius:8px; padding:10px 12px; margin:12px 0; background:#fff; }
fieldset.box legend { font-weight:700; font-size:13px; padding:0 6px; }
fieldset.box label { display:block; margin:6px 0; font-size:13px; }
fieldset.box input, fieldset.box select { margin-left:6px; padding:3px 6px; font-size:13px; }
ul.brands { list-style:none; margin:0; padding:0; }
ul.brands li { border-top:1px solid #f2f2f2; padding:8px 0; }
ul.brands li:first-child { border-top:0; }
.bline { display:flex; gap:8px; align-items:baseline; flex-wrap:wrap; }
.bline b { font-size:13px; }
p.msg.ok, p.ok { color:#1a7f37; }
/* brand filter type-ahead: green when the typed text is an existing item */
#qhint { min-height:1.1em; margin:.3em 0; }
#qhint.okhint { color:#1a7f37; font-weight:600; }
p.msg.bad, p.bad, p.warn { color:#bb0000; }
p.msg.warn { color:#b06d00; }

/* PDF report page */
ul.inc { margin:4px 0; padding-left:18px; font-size:12px; }
ul.inc li { margin:3px 0; }
#msg.ok { color:#1a7f37; }
#msg.bad { color:#bb0000; }

/* Add variant — category section header (app's ExpansionTile title, flat) */
li.catHdr { background:#1F4E79; color:#fff; font-weight:600; font-size:12.5px;
  padding:5px 10px !important; border-top:0 !important; margin-top:6px; }
li.catHdr:first-child { margin-top:0; }

/* Daily sheet — category section row (same #1F4E79 band as the app's sheet) */
tr.catrow td { background:#1F4E79; color:#fff; font-weight:600; font-size:12.5px;
  padding:5px 10px; }

/* ── CRM shell (one address, tabbed workspace) ─────────────────────────── */
body.shell { max-width:none; margin:0; padding:0; height:100vh; display:flex;
  flex-direction:column; }
body.shell #loginView { margin:60px auto; }
#wsView { flex:1; display:flex; flex-direction:column; min-height:0; }
#wsView[hidden] { display:none; }
.tabbar { display:flex; gap:3px; background:#1F4E79; padding:5px 10px;
  align-items:center; flex-wrap:wrap; }
.tabbar .brand { color:#fff; font-weight:700; font-size:13px; margin-right:8px; }
.tabbar .flex1 { flex:1; }
.tabbar .tab { background:transparent; border:0; color:#cdd9e8; font-size:13px;
  padding:7px 12px; cursor:pointer; border-radius:6px 6px 0 0; }
.tabbar .tab:hover { background:rgba(255,255,255,.14); color:#fff; }
.tabbar .tab[aria-current="true"] { background:#fff; color:#1F4E79; font-weight:700; }
#ws { flex:1; border:0; width:100%; min-height:0; background:#fff; }
/* Framed pages shed their own nav + logout: the shell owns both. */
html.framed .pagenav, html.framed #kickout { display:none !important; }

/* Icons (Sam 2026-10-24) — inline SVG from js/icons.js, injected by shell.js.
   The anchor gets the flex row so SVG + label align on one baseline; a
   `<button>`/`<b>` is inline-block-safe and just needs the vertical nudge. */
.pagenav a[data-icon], .pagenav b[data-icon], .pagenav button[data-icon] {
  display:inline-flex; align-items:center; gap:6px; }
.tabbar svg, .pagenav svg { flex:0 0 auto; }
.pagenav svg { margin-top:-1px; opacity:.9; }
.pagenav a[data-icon] svg { color:#1F4E79; }
.pagenav b[data-icon] svg { color:#111; }
.pagenav button[data-icon] { background:none; border:0; padding:0; font:inherit;
  color:#1F4E79; cursor:pointer; }
.tabbar .tab[aria-current="true"] svg { color:#1F4E79; }

/* Daily sheet — category TOTAL rows + grand summary strip (Sam) */
tr.totalrow td.tot { background:#eceff3; font-weight:700; border-top:2px solid #1F4E79; }
table.grid tr.totalrow td { color:#111827; }
/* Sam 2026-10-24: summary strip is exactly as wide as the item table (#grid).
   Sam 2026-10-25: measured at 1400px viewport the strip landed at 526.8px while
   the item table is 660.8px — `max-content` sizes to the CONTENT, not the table,
   so the strip drifted narrower and would grow past the table as soon as the
   figures got long. #dsum is now pinned to the measured table width (660.8px,
   the 8 shop_user columns) x1.5 (Sam 2026-10-25: "1 into 1 1/2" — half again
   longer), and the flex row spreads its cells across it.
   The item table is `width:auto`, so #dsum carries the authoritative number. */
/* Was 660.8 x 1.5 = 991.2px; Sam 2026-10-25 revised it down to the 900px
   range. max-width:100% keeps it inside the viewport on narrow screens
   instead of forcing a horizontal scrollbar. */
#dsum { width:900px; max-width:100%; }
#xgrid { width:max-content; max-width:100%; }
#dsum .sumbox { width:100%; box-sizing:border-box; justify-content:space-between; }
.sumbox { display:flex; gap:6px; align-items:center; border:2px solid #1F4E79;
  background:#D6E4F0; padding:4px 8px; margin:10px 0 4px; flex-wrap:nowrap; }
.sumbox .st { color:#1F4E79; font-size:12px; margin-right:6px; flex:0 0 auto; }
/* was min-width:86px — the strip now sets the width, so the cells flex to fill
   it instead of forcing it wider than the table they sit under. */
.sumbox > div { flex:0 1 auto; min-width:0; text-align:center; padding:0 6px;
  white-space:nowrap; }
.sumbox .sv { display:block; font-weight:700; font-size:13px; color:#111827; }
.sumbox .sl { display:block; font-size:10px; color:#334155; }

/* note column — at least 5 words of room (Sam 2026-10-24) */
#xgrid th:nth-child(4), #xgrid td:nth-child(4) { min-width:32ch; }

/* Popup alert (Sam 2026-10-26). #msg under the toolbar is easy to miss, so a
   REJECTED entry ALSO pops a toast dead-centre of the screen — dark card, thick
   red left edge, above everything. Click anywhere (or Esc, or 4s) to dismiss.
   Only for things the user must not miss (stock / whole-number rejections); the
   routine "N active" status stays in #msg. */
#toast { position:fixed; z-index:9999; left:50%; top:38%; transform:translate(-50%,-50%);
  display:none; max-width:min(560px,90vw); box-sizing:border-box;
  background:#fff; color:#000; border:2px solid #000; border-left:8px solid #dc2626;
  border-radius:8px; padding:16px 20px; font-size:15px; line-height:1.45;
  box-shadow:0 12px 40px rgba(0,0,0,.45); }
#toast.on { display:block; }
#toast b { display:block; font-size:17px; margin-bottom:6px; color:#b91c1c; }

/* Unsaved-changes dialog (Sam 2026-10-26): moving to another date while the
   current day has unsaved edits must ask Save / Don't save / Cancel instead of
   silently dropping the edits. Same white-card language as #toast, but it needs
   BUTTONS, so it is its own element — and unlike the toast it is modal-ish:
   a scrim blocks the page until he answers. z-index above the toast. */
#askScrim { position:fixed; inset:0; z-index:10000; display:none;
  background:rgba(0,0,0,.45); }
#askScrim.on { display:block; }
#askBox { position:fixed; z-index:10001; left:50%; top:38%; transform:translate(-50%,-50%);
  display:none; max-width:min(560px,90vw); box-sizing:border-box;
  background:#fff; color:#000; border:2px solid #000; border-left:8px solid #d97706;
  border-radius:8px; padding:16px 20px; font-size:15px; line-height:1.45;
  box-shadow:0 12px 40px rgba(0,0,0,.45); }
#askBox.on { display:block; }
#askBox b { display:block; font-size:17px; margin-bottom:6px; color:#b91c1c; }
#askBox .askBtns { display:flex; gap:10px; justify-content:flex-end; margin-top:16px; }
#askBox button { font-size:14px; padding:8px 16px; border-radius:6px; cursor:pointer;
  border:2px solid #000; background:#fff; color:#000; }
#askBox button.primary { background:#111; color:#fff; }
#askBox button:hover { filter:brightness(.92); }
