/* Shared look with EV Timeclock (same tokens, font, card, buttons, Microsoft button). */
:root {
  --bg: #f4f8f6; --bg-2: #eaf5ef; --card: #ffffff; --ink: #0f1f19; --muted: #6b7c75; --line: #e6eeea;
  --brand: #008345; --brand-2: #00934d; --brand-3: #8ec965; --brand-soft: #e4f4dc;
  --grad: linear-gradient(135deg, #006b38 0%, #008345 50%, #4fae4f 100%);
  --warn: #b45309; --warn-soft: #fef3c7; --bad: #dc2626; --bad-soft: #fee2e2;
  --on-brand: #fff; --red: #b42318; --green: #067647;
  /* Two shadows and one focus ring (design cleanup 2026-11-18): cards, then menus / dialogs / popups. */
  --shadow: 0 1px 2px rgba(15, 31, 25, .04), 0 8px 24px -12px rgba(15, 31, 25, .12);
  --shadow-lg: 0 16px 40px -14px rgba(15, 31, 25, .3);
  --ring: 0 0 0 3px var(--brand-soft);
  /* Four radii: controls and pills, cards / tiles / dialogs, segments and chips, and 50% for avatars. */
  --r-sm: 6px; --r: 10px; --r-pill: 999px;
  /* One control height (inputs, selects, buttons) and the small one (buttons in tables, .small). */
  --ctl-h: 38px; --ctl-h-sm: 30px;
  /* Type scale (15px body; phones 14px) and a 4px spacing scale. */
  --fs-xs: .75rem; --fs-sm: .85rem; --fs-md: 1rem; --fs-lg: 1.125rem; --fs-xl: 1.375rem; --fs-2xl: 1.75rem; --fs-3xl: 2.25rem;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
/* Dark (Will Gordon 2026-11-16: an option, My profile › Appearance): <html data-mode="dark">, or the computer is dark and
   "light" isn't chosen. The [data-look] forms out-rank a company theme's light colors (themes/*.css), so every theme
   goes dark too. */
:root[data-mode="dark"], :root[data-mode="dark"][data-look] {
  --bg: #0a1210; --bg-2: #0e1a16; --card: #121d19; --ink: #d4dfd9; --muted: #8fa39a; --line: #1f2e28;
  --brand: #8ec965; --brand-2: #00934d; --brand-soft: #14321f; --warn: #fbbf24; --warn-soft: #33270b;
  --bad: #f87171; --bad-soft: #3a1414;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6); --shadow-lg: 0 16px 40px -14px rgba(0,0,0,.7);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]), :root:not([data-mode="light"])[data-look] {
    --bg: #0a1210; --bg-2: #0e1a16; --card: #121d19; --ink: #d4dfd9; --muted: #8fa39a; --line: #1f2e28;
    --brand: #8ec965; --brand-2: #00934d; --brand-soft: #14321f; --warn: #fbbf24; --warn-soft: #33270b;
    --bad: #f87171; --bad-soft: #3a1414;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6); --shadow-lg: 0 16px 40px -14px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-mode="light"] { color-scheme: light; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh;
  background: radial-gradient(1200px 500px at 100% -10%, var(--bg-2), transparent 60%), var(--bg); background-attachment: fixed;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.02em; }
h2 { font-size: var(--fs-xl); font-weight: 800; }
.center { display: grid; place-items: center; min-height: 60vh; text-align: center; padding: 16px; }
.muted { color: var(--muted); } .small { font-size: var(--fs-sm); }

.card {
  background: var(--card); border-radius: var(--r); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

button, .btn {
  font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: var(--r-sm); padding: 8px 14px; line-height: 20px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  transition: transform .1s, box-shadow .15s, background .15s;
} /* 20px line + 8px padding + 1px border = --ctl-h (38px) */
button:hover { box-shadow: var(--shadow); }
button:active { transform: scale(.97); }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
button.primary, a.btn.primary { background: var(--grad); border-color: transparent; color: var(--on-brand); box-shadow: 0 1px 2px rgba(15,31,25,.15); } /* no green glow (design review 2026-11-17) */
/* Ghost buttons keep a quiet border in every mode (they read as plain text in light mode before); .link-btn is the borderless one. */
button.ghost { border-color: var(--line); background: transparent; }
button.ghost:hover { background: var(--bg); box-shadow: none; }
button:disabled { opacity: .5; cursor: default; transform: none; }

.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: 700;
  background: var(--bg); color: var(--muted); white-space: nowrap;
}
.pill.ok { background: var(--brand-soft); color: var(--brand); }
.banner { border-radius: var(--r); padding: 8px 12px; margin: 8px 0; font-size: var(--fs-sm); font-weight: 500; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.ok { background: var(--brand-soft); color: var(--brand); }

a { color: var(--brand); }
label { display: block; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); margin-bottom: 12px; }
input {
  display: block; width: 100%; height: var(--ctl-h); margin-top: 4px; font: inherit; font-weight: 500; color: var(--ink);
  background: var(--bg); border: 1.5px solid transparent; border-radius: var(--r-sm); padding: 0 12px; transition: .15s;
}
/* Money and counts: right-aligned, no spinner arrows (.money-in, .w-xs/.w-sm boxes). */
.money-in input, input.w-xs, input.w-sm, .w-xs input, .w-sm input { text-align: right; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.money-in input::-webkit-inner-spin-button, .money-in input::-webkit-outer-spin-button,
input.w-xs::-webkit-inner-spin-button, input.w-sm::-webkit-inner-spin-button, .w-xs input::-webkit-inner-spin-button, .w-sm input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* Short values get short boxes (design review #9): counts, money, PO numbers. */
input.w-xs, .w-xs input, .fld.w-xs { max-width: 90px; }
input.w-sm, .w-sm input, .fld.w-sm { max-width: 140px; }
input.w-po { max-width: 180px; }
/* Text boxes match the inputs (design review 2026-11-17: they showed the browser's monospace default). */
textarea {
  display: block; width: 100%; margin-top: 5px; font: inherit; font-weight: 500; line-height: 1.45; color: var(--ink); resize: vertical; min-height: 64px;
  background: var(--bg); border: 1.5px solid transparent; border-radius: var(--r-sm); padding: 9px 12px; transition: .15s;
}
textarea:focus { outline: none; border-color: var(--brand-2); background: var(--card); box-shadow: var(--ring); }
/* Checkboxes and radios keep their own size (the full-width input rule stretched them: My profile › Email notifications). */
input:where([type=checkbox], [type=radio]) { display: inline-block; width: auto; height: auto; margin: 0; padding: 0; accent-color: var(--brand); }
input:where([type=color]) { padding: 3px; }
input:where([type=file]) { height: auto; padding: 6px 8px; }
/* Numbers right-aligned in the builder's editable cells, like the totals next to them. */
table.builder .ln-qty, table.builder .ln-price, table.builder .ln-dv { text-align: right; font-variant-numeric: tabular-nums; }
input:focus { outline: none; border-color: var(--brand-2); background: var(--card); box-shadow: var(--ring); }

/* section tabs */
.seg {
  display: flex; gap: 2px; padding: 3px; width: fit-content; max-width: 100%; margin: 10px auto 0;
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
}
.seg a { padding: 7px 12px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; }
.seg a:hover { color: var(--ink); }
.seg a.on { background: var(--grad); color: var(--on-brand); box-shadow: none; }

/* order history */
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 12px; align-items: end; }
.filters label, .filters button { margin: 0; }
.filters button { height: var(--ctl-h); justify-content: center; }
/* Facts line up in four even columns (two on phones), not 3-then-4 (design review #14). */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; }
@media (max-width: 700px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.totals { margin: 12px 0 0 auto; max-width: 340px; }
.totals div { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; }
.totals .grand { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; font-size: var(--fs-lg); }
.totals .warnrow { color: var(--warn); }
.totals-wrap { display: flex; flex-wrap: wrap; gap: 16px; justify-content: flex-end; align-items: flex-start; margin-top: 12px; }
.totals-wrap .totals { margin: 0; }
.margin-card { width: 280px; max-width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; font-size: var(--fs-sm); color: var(--muted); }
.margin-card b { color: var(--ink); font-weight: 600; }
.margin-card > div { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; }
.margin-card b { white-space: nowrap; }
.totals .bal-row { background: var(--brand-soft); border-radius: var(--r-sm); padding: 6px 8px; margin-top: 6px; font-weight: 700; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.emp a { white-space: nowrap; }
td[data-label="Date"], td[data-label="Code"], td[data-label="Type"], td[data-label="Type"] .pill { white-space: nowrap; }
/* Dates in the invoice lists: a narrow face (Colin 2026-11-04). */
.date-n { font-family: "Roboto Condensed", "Arial Narrow", sans-serif; font-stretch: condensed; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
@media (max-width: 700px) { .filters { grid-template-columns: 1fr; } .totals { max-width: none; } }

/* app shell */
.top {
  position: sticky; top: 0; z-index: 5; padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 1240px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: var(--fs-lg); letter-spacing: -.02em; }
.brand img { width: 36px; height: 36px; object-fit: contain; }
main { max-width: 1240px; margin: 0 auto; padding: 16px 16px 90px; animation: rise .25s ease-out; }
.page-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.page-h h2 { margin: 0; }
h3 { font-size: var(--fs-lg); font-weight: 700; }
select {
  font: inherit; font-weight: 500; color: var(--ink); background: var(--bg); border: 1.5px solid transparent;
  border-radius: var(--r-sm); height: var(--ctl-h); padding: 0 10px; min-width: 140px;
}
select[multiple], select[size] { height: auto; padding: 4px 6px; }
select:focus { outline: none; border-color: var(--brand-2); background: var(--card); box-shadow: var(--ring); }
select:disabled { opacity: .55; }
.tbl-wrap { overflow-x: auto; margin: 0 -4px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--fs-sm); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 700; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
/* Quieter tables (design review #15): links in cells underline on hover only; phone numbers never wrap. */
td a:not(.btn) { text-decoration: none; }
td a:not(.btn):hover { text-decoration: underline; }
td.phone, td[data-label="Phone"], td a[href^="tel:"] { white-space: nowrap; }

/* Phones: show each table row as a stacked card so no column falls off the screen. Two label-over-value columns
   (design review #7: a row was ~210px tall as one labelled line per column); the first cell and any cell with a
   control span the full width. .hide-sm leaves a low-value column off on phones. */
@media (max-width: 700px) {
  .top-row .small { display: none; }
  .tbl-wrap { overflow: visible; margin: 0; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  tr:last-child { border-bottom: 0; }
  tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 12px; row-gap: 4px; }
  tbody tr > td:first-child, tbody tr > td:only-child, tbody tr > td[colspan], tbody tr > td:has(input:not([type=checkbox]):not([type=radio]), select, textarea, .btn, button:not(.link-btn)) { grid-column: 1 / -1; }
  td { border: 0; padding: 4px 0; min-width: 0; }
  td.emp { font-size: var(--fs-lg); padding-bottom: 6px; }
  td[data-label] { display: block; text-align: left; }
  td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
  td[data-label]:has(input:not([type=checkbox]):not([type=radio]), select, textarea) { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  td[data-label]:has(input:not([type=checkbox]):not([type=radio]), select, textarea)::before { flex: none; }
  td select { flex: 1; max-width: 220px; }
  .hide-sm { display: none !important; }
}
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 12px 16px; border-radius: var(--r-sm); z-index: 30; max-width: 90vw; font-weight: 600; box-shadow: var(--shadow-lg);
}
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.login { width: min(400px, 100%); text-align: left; margin: 0; }
.login-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.login-head img { width: 72px; height: auto; max-height: 72px; flex: none; object-fit: contain; }
.login-head h2 { margin: 0; font-size: var(--fs-xl); line-height: 1.2; font-weight: 400; } /* "Welcome to" not bold (Colin 2026-11-11) */
.login-head h2 .wordmark { font-size: 1.53em; vertical-align: -0.08em; } /* "Jade" bigger */

/* "Sign in with Microsoft" per Microsoft's branding guidelines. */
button.msbtn {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 41px; padding: 10px 12px; margin-top: 4px;
  font: 600 15px/1 "Segoe UI", system-ui, sans-serif; color: #5e5e5e; background: #fff; border: 1px solid #8c8c8c; border-radius: var(--r-sm); box-shadow: none;
}
button.msbtn:hover { background: #f3f3f3; box-shadow: none; }
button.msbtn:focus-visible { outline: 2px solid #0067b8; outline-offset: 2px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) button.msbtn { color: #fff; background: #2f2f2f; border-color: #8c8c8c; }
  :root:not([data-mode="light"]) button.msbtn:hover { background: #3a3a3a; }
}
:root[data-mode="dark"] button.msbtn { color: #fff; background: #2f2f2f; border-color: #8c8c8c; }
:root[data-mode="dark"] button.msbtn:hover { background: #3a3a3a; }
[hidden] { display: none !important; }

/* ---- Sidebar rail: icons only, expands on hover/keyboard focus (tap the logo or ☰ on touch screens) ---- */
:root { --rail: #15213f; --rail-text: #c7d1ea; --rail-w: 64px; --rail-w-open: 224px; }
.rail {
  position: fixed; inset: 0 auto 0 0; z-index: 20; width: var(--rail-w); background: var(--rail); color: var(--rail-text);
  overflow: hidden; transition: width .18s ease; display: flex; flex-direction: column; padding-bottom: 12px;
}
.rail.open { z-index: 50; width: var(--rail-w-open); box-shadow: 8px 0 24px -12px rgba(0,0,0,.45); }
.rail-logo { display: flex; align-items: center; height: 64px; padding: 0 16px; border: 0; border-radius: 0; background: transparent; box-shadow: none; cursor: pointer; }
.rail-logo:hover { box-shadow: none; }
.rail-logo img { width: 32px; height: 32px; object-fit: contain; }
.rail nav { display: flex; flex-direction: column; flex: 1; padding-top: 6px; }
.nav-i {
  display: flex; align-items: center; gap: 16px; padding: 13px 21px; color: var(--rail-text); text-decoration: none; white-space: nowrap;
  border-left: 3px solid transparent; font-weight: 600;
}
.nav-i svg { flex: none; }
.ic-mask { display: inline-block; flex: none; width: 22px; height: 22px; background: currentColor; -webkit-mask: var(--ic) center / 20px no-repeat; mask: var(--ic) center / 20px no-repeat; }
.nav-l { opacity: 0; transition: opacity .12s ease; }
.rail.open .nav-l { opacity: 1; }
a.nav-i:hover { background: rgba(255,255,255,.08); color: #fff; }
a.nav-i:focus-visible { outline: 2px solid #8ec965; outline-offset: -2px; }
.nav-i.here { color: #fff; background: rgba(255,255,255,.12); border-left-color: var(--brand-3); }
.nav-i.off { opacity: .38; cursor: not-allowed; }
.rail-sep { height: 1px; margin: 10px 16px; background: rgba(255,255,255,.14); }
.shell { margin-left: var(--rail-w); min-width: 0; }.menu-btn { display: none; padding: 4px 10px; font-size: var(--fs-xl); line-height: 1; margin-right: 6px; }
label.check { flex-direction: row; align-items: center; gap: 8px; align-self: end; padding-bottom: 10px; font-weight: 500; }
label.check input { width: auto; }
ul.plain { margin: 0; padding-left: 1.2rem; }
ul.plain li { margin: 2px 0; }
button.primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
@media (max-width: 700px) {
  .rail { transform: translateX(-100%); width: var(--rail-w-open); transition: transform .18s ease; }
  .rail .nav-l { opacity: 1; }
  .rail.open { transform: none; box-shadow: 8px 0 24px -12px rgba(0,0,0,.6); }
  .shell { margin-left: 0; }
  .menu-btn { display: inline-flex; }
}
@media (prefers-reduced-motion: reduce) { .rail, .nav-l { transition: none; } }
/* Settings tabs + profile picture */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 16px; overflow-x: auto; }
.tab { padding: 10px 16px; color: inherit; text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; opacity: .7; }
.tab:hover { opacity: 1; }
.tab.here { opacity: 1; border-bottom-color: var(--brand-3); }
.avatar { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--rail); color: #fff; font-size: var(--fs-xs); font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* "Jade" in Sansita Swashed everywhere: the sidebar and the sign-in screen (Colin 2026-11-11: "use the correct Jade font on login screen") */
.wordmark { font-family: 'Sansita Swashed', 'Quicksand', sans-serif; font-weight: 600; letter-spacing: 0; }
.rail-logo .wordmark { margin-left: 6px; font-size: var(--fs-xl); color: #fff; white-space: nowrap; }
/* The sidebar's "Jade" in Sansita Swashed, in every theme, like "Back to Jade" on the QM archive site (Colin 2026-11-05). */
:root .rail .rail-logo .wordmark, :root .login-head .wordmark { font-family: 'Sansita Swashed', 'Quicksand', sans-serif; font-weight: 600; letter-spacing: 0; }
.addr-row { display: grid; grid-template-columns: 1fr 2fr .8fr 1.2fr .6fr auto; gap: 10px; align-items: end; margin-bottom: 10px; }
@media (max-width: 700px) { .addr-row { grid-template-columns: 1fr; } }
/* Search bar, filters panel, chips, saved views */
.searchbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.searchbar input[type=search] { flex: 1 1 220px; max-width: 420px; }
.searchbar .sb-new { margin-left: auto; } /* New contact / New invoice sits at the end of the search row */
.searchbar .sb-new .btn, .searchbar .sb-new button { white-space: nowrap; }
.searchbar input[type=search] { margin: 0; }
.filters-panel { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.filters-grid { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin-bottom: 12px; }
.filters-grid label, .filters-grid fieldset { margin: 0; }
fieldset.multi { border: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
fieldset.multi legend { font-size: var(--fs-sm); font-weight: 600; margin-bottom: 6px; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--brand-soft); border-radius: var(--r-pill); padding: 4px 6px 4px 12px; font-size: var(--fs-sm); font-weight: 600; }
.chip-x { border: 0; background: transparent; box-shadow: none; padding: 0 6px; font-size: var(--fs-md); line-height: 1; cursor: pointer; min-height: 0; }
.views-wrap { position: relative; }
.views-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 240px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; }
.view-row { display: flex; align-items: center; justify-content: space-between; }
.view-row .ghost { flex: 1; text-align: left; justify-content: flex-start; border: 0; box-shadow: none; }
@media (max-width: 700px) { .searchbar input[type=search] { flex-basis: 100%; max-width: none; } .searchbar .sb-new { margin-left: 0; } .fld:not(.w-xs):not(.w-sm) { width: 100% !important; } }
.fld { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.fld-l { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); white-space: nowrap; }
.fld input, .fld select { margin: 0; height: var(--ctl-h); padding: 0 10px; font-size: var(--fs-sm); }
.fw-s { width: 120px; } .fw-m { width: 200px; } .fw-l { width: 280px; } .fw-date { width: 160px; } .fw-auto { width: auto; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-toggle { position: relative; display: inline-flex; margin: 0; cursor: pointer; }
.pill-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.pill-toggle span { display: inline-flex; align-items: center; height: var(--ctl-h); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; background: var(--card); }
.pill-toggle input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.pill-toggle input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.th-sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
/* Sort arrows only on hover / focus or the sorted column (design review #15). */
.th-sort .arr { font-size: .7em; opacity: 0; transition: opacity .12s; }
th:hover .th-sort .arr, .th-sort:focus-visible .arr { opacity: .35; }
.th-sort.on .arr { opacity: 1; }
.th-sort:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--r-sm); }
th.num .th-sort { justify-content: flex-end; width: 100%; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.pager .row { align-items: center; gap: 10px; flex-wrap: wrap; }
.list-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.pager .per { display: inline-flex; align-items: center; gap: 6px; margin: 0 8px 0 0; font-size: var(--fs-sm); font-weight: 500; color: var(--muted); flex-direction: row; }
.pager .per select { width: auto; min-width: 0; height: var(--ctl-h-sm); padding: 0 8px; margin: 0; }
/* Employees + suggestions */
.emp-cell { display: inline-flex; align-items: center; gap: 10px; }
.avatar.sm { width: 28px; height: 28px; font-size: var(--fs-xs); }
.avatar.lg { width: 72px; height: 72px; font-size: var(--fs-xl); }
.emp-head { display: flex; gap: 16px; align-items: center; }
.sg-bubble { position: fixed; right: 20px; bottom: 20px; z-index: 40; width: 52px; height: 52px; border-radius: 50%; font-size: var(--fs-xl); padding: 0; justify-content: center; background: var(--grad); color: var(--on-brand); border: 0; box-shadow: var(--shadow-lg); }
.sg-panel { position: fixed; right: 20px; bottom: 84px; z-index: 40; width: min(340px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 12px; }
.sg-panel textarea { width: 100%; margin: 8px 0 10px; resize: vertical; font: inherit; }
/* "?" help bubbles (help() in core.js) */
button.help-q { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 20px; height: 20px; min-height: 0; padding: 0; margin: 0 0 0 6px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font-size: var(--fs-xs); font-weight: 800; line-height: 1; vertical-align: middle; box-shadow: none; position: relative; }
button.help-q::after { content: ""; position: absolute; inset: -6px; } /* a bigger tap target on phones */
button.help-q:hover, button.help-q[aria-expanded="true"] { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); box-shadow: none; }
button.help-q:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
h2 > button.help-q, h3 > button.help-q { vertical-align: .15em; }
.help-pop { position: fixed; z-index: 60; width: max-content; max-width: min(320px, calc(100vw - 24px)); padding: 10px 12px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); font-size: var(--fs-sm); font-weight: 400; line-height: 1.45; text-transform: none; letter-spacing: normal; text-align: left; white-space: normal; }
.help-pop p { margin: 0; } .help-pop p + p { margin-top: 6px; }
.sugg { border-top: 1px solid var(--line); padding: 10px 0; }
.sugg.done { opacity: .55; }
.sugg-text { white-space: pre-wrap; margin: 4px 0 6px; }
/* Settings > General: compact rows */
.set-list { padding-top: 6px; padding-bottom: 6px; }
.set-h { margin: 12px 0 2px; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.set-h + .set-row { border-top: 0; }
.set-ctl { display: flex; align-items: center; gap: 8px; flex: none; margin: 0; }
/* Settings rows: Save is a plain button until that row changes (design review #5; settings.js marks the form data-dirty). */
form.set-ctl:not([data-dirty]) button.primary[type=submit] { background: var(--card); color: var(--brand); border-color: var(--line); box-shadow: none; }
.money-in { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.money-in input { width: 120px; height: var(--ctl-h); margin: 0; padding: 0 8px; }
@media (max-width: 700px) { .set-row { flex-direction: column; align-items: stretch; } }
main { padding-bottom: 88px; } /* room for the suggestion bubble */
/* Header user menu */
.user-menu { position: relative; }
.user-btn { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: var(--r-pill); border: 1px solid transparent; background: transparent; box-shadow: none; }
.user-btn:hover, .user-btn[aria-expanded="true"] { border-color: var(--line); background: var(--card); }
.user-name { font-weight: 600; font-size: var(--fs-sm); }
.user-drop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 35; min-width: 220px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; }
.user-drop-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-drop a, .user-drop button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: transparent; box-shadow: none; border-radius: var(--r-sm); color: inherit; text-decoration: none; font: inherit; cursor: pointer; }
.user-drop a:hover, .user-drop button:hover { background: var(--brand-soft); }
/* The signed-in person at the bottom of the rail (Colin 2026-11-04): photo when closed, photo + name when open; the menu opens above it */
.rail-user { padding: 8px 10px 0; border-top: 1px solid rgba(255,255,255,.12); margin-top: 6px; }
.rail .user-btn { width: 100%; justify-content: flex-start; gap: 12px; padding: 6px; border-radius: var(--r); border: 0; color: #fff; white-space: nowrap; }
.rail .user-btn:hover, .rail .user-btn[aria-expanded="true"] { background: rgba(255,255,255,.1); border-color: transparent; color: #fff; }
.rail .user-btn .avatar { box-shadow: 0 0 0 2px rgba(255,255,255,.28); }
.rail .user-name { overflow: hidden; text-overflow: ellipsis; }
.rail .user-drop { top: auto; bottom: calc(100% + 6px); left: 10px; right: 10px; min-width: 0; color: var(--ink); }
/* Picker (multi-select with type-to-find) */
.picker { position: relative; width: 340px; }
.picker-box { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: var(--ctl-h); padding: 3px 6px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); }
.picker-box .chip { padding: 2px 4px 2px 10px; font-size: var(--fs-xs); }
.picker-q { flex: 1 1 120px; border: 0 !important; box-shadow: none !important; margin: 0 !important; height: 30px !important; padding: 2px 4px !important; outline: none; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 300px; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 4px; }
.picker-opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin: 0; border-radius: var(--r-sm); cursor: pointer; font-weight: 500; flex-direction: row; }
.picker-opt:hover { background: var(--brand-soft); }
.picker-opt input { width: auto; margin: 0; }
.picker-opt span:first-of-type { flex: 1; }
/* Dashboard */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 4px 0 16px; }
.dash-filters select { width: auto; margin: 0; }
select.snooze { width: auto; min-width: 0; height: var(--ctl-h-sm); margin: 0; padding: 0 6px; font-size: var(--fs-sm); } /* dashboard Snooze… (2026-11-16) */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.tile:hover { border-color: var(--brand); }
.tile-l { font-weight: 600; color: var(--muted); }
.tile-l b { color: inherit; font-weight: 600; }
.tile-v { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.02em; }
.tile.warn .tile-v { color: var(--red); }
/* Quick actions: ordinary buttons in a row, not three full-width bars (design review #13). */
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.quick-btn { flex: 0 0 auto; justify-content: center; text-decoration: none; }
.dash-cols { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; align-items: start; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; }
.feed-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--brand-3); }
.feed-dot.paid { background: var(--brand); }
.top { margin: 0; padding-left: 1.2rem; }
.top li { padding: 6px 0; }
.top li > span { float: right; font-weight: 600; }
.dash-sugg { display: block; margin-bottom: 12px; text-decoration: none; }
.ln-count { text-align: right; margin: 6px 0 2px; }
.count-banner { display: block; margin-bottom: 10px; text-decoration: none; }
body[data-counting1] #dr-post, body[data-counting1] #xf-send, body[data-counting2] #rc-go[data-to-shop="2"], body[data-counting3] #rc-go[data-to-shop="3"] { opacity: .45; pointer-events: none; }
.cr-tiles { margin: 10px 0; } .cr-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 6px 0 12px; }
.cr-charts h4 { margin: 0 0 6px; } .cr-bar { display: grid; grid-template-columns: minmax(90px, 40%) 1fr auto; gap: 8px; align-items: center; font-size: var(--fs-sm); margin: 3px 0; }
.cr-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .cr-bar i { display: block; height: 10px; border-radius: var(--r-sm); } .cr-bar i.neg { background: var(--bad); } .cr-bar i.pos { background: var(--brand); }
.cp-sec { margin-top: 12px; } .cp-sec h3 { margin: 0 0 4px; } .cp-lines { margin: 4px 0 0; padding-left: 16px; }
.cp-item { border-top: 1px solid var(--line); padding: 8px 0; } .cp-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.notify-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 16px; margin: 4px 0 12px; }
/* My profile role list: columns, not 27 lines in one (design review). */
ul.plain.cols { columns: 3 220px; column-gap: 24px; font-size: var(--fs-sm); }
.notify-list .chk { font-size: var(--fs-sm); font-weight: 500; color: var(--ink); margin: 0; }
ul.plain.cols li { break-inside: avoid; }
.notify-list .chk { display: flex; gap: 8px; align-items: flex-start; }
.sg-reply { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sugg-dec { margin: 4px 0; }
.sugg-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(2, 1fr); } .dash-cols { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .tiles { grid-template-columns: 1fr; } }
/* One-page contact editor */
.editor textarea { width: 100%; font: inherit; resize: vertical; }
.editor .set-h:first-of-type { margin-top: 4px; }
.editor-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin: 0 -2px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 -8px 24px -18px rgba(0,0,0,.35); }
/* Dashboard v2: tiles with company + you, segmented All / My sales */
.tile { gap: 8px; }
.tile-main { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; }
.tile-sub, .tile-you { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; font-size: var(--fs-sm); }
.tile-sub b, .tile-you b { font-weight: 700; }
.tile-you > .small.muted { flex-basis: 100%; }
.tile-sub.warn b { color: var(--red); }
.tile-you span:first-child { color: var(--muted); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 2px; }
.seg-b { border: 0; background: transparent; box-shadow: none; border-radius: var(--r-pill); padding: 4px 12px; font-size: var(--fs-sm); font-weight: 600; min-height: 0; height: 28px; }
.seg-b.on { background: var(--brand-soft); color: var(--brand); }
.seg-b:disabled { opacity: .4; cursor: not-allowed; }
/* Accounts */
.acc-totals, .aging-strip { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 10px 0 12px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.acc-totals > div, .aging-strip > div { display: flex; flex-direction: column; gap: 2px; }
.acc-totals b { font-size: var(--fs-lg); }
/* Headline figures in even columns (design review #14), the age buckets as an aging bar, the rest one muted line. */
.acc-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 24px; }
.acc-totals b { font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }
.aging-bar.acc-ages { margin: 4px 0 8px; }
.acc-ages .ab-seg { cursor: default; }
.acc-ages .ab-seg:hover { border-color: transparent; }
.acc-meta { margin: 0 0 4px; } .acc-meta b { color: var(--ink); font-weight: 600; }
@media (max-width: 700px) { .acc-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Tablets / narrow windows (701-1100px): wide tables scroll sideways with the first column pinned, and tighter cells. */
@media (min-width: 701px) and (max-width: 1100px) {
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl-wrap th:first-child, .tbl-wrap td:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); box-shadow: 1px 0 0 var(--line); }
  .tbl-wrap th, .tbl-wrap td { padding-left: 8px; padding-right: 8px; }
  .tbl-wrap td.emp { max-width: 220px; }
}
/* Dropdown with checkboxes (Settings > Customer types) */
.check-drop { position: relative; }
.check-drop summary { list-style: none; cursor: pointer; min-width: 220px; max-width: 320px; height: var(--ctl-h); display: flex; align-items: center; padding: 0 30px 0 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--fs-sm); position: relative; }
.check-drop summary::-webkit-details-marker { display: none; }
.check-drop summary::after { content: "▾"; position: absolute; right: 10px; opacity: .6; }
.check-drop-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 220px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; }
.check-drop-opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin: 0; border-radius: var(--r-sm); cursor: pointer; font-weight: 500; flex-direction: row; }
.check-drop-opt:hover { background: var(--brand-soft); }
.check-drop-opt input { width: auto; margin: 0; }

/* Account history: link-style buttons (sale #, Link invoice) and the sale detail row */
.link-btn { background: none; border: 0; padding: 0; min-height: 0; line-height: inherit; color: var(--brand); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 2px; box-shadow: none; }
.link-btn.small { font-size: var(--fs-xs); }
tr.sale-detail > td { background: var(--brand-soft); }
.sale-box { display: grid; gap: 6px; padding: 4px 2px; }
table.sale-lines { width: 100%; font-size: var(--fs-sm); }
table.sale-lines th, table.sale-lines td { padding: 3px 6px; }
@media (max-width: 700px) { tr.sale-detail > td { display: block; } table.sale-lines thead { display: none; } }

/* Invoice builder: line inputs, popup, pricing settings */
table.builder input { height: var(--ctl-h-sm); margin: 0; padding: 0 8px; text-align: right; }
table.builder .ln-qty { width: 54px; } /* 2 digits + the arrows (Colin 2026-11-07; was 80px) */
table.builder td.ln-note { vertical-align: middle; line-height: 1.3; }
table.builder .ln-price { width: 88px; } /* 9999.99 + the arrows (Colin 2026-11-07; was 100px) */
.disc { display: inline-flex; gap: 4px; align-items: center; }
.disc select { width: 52px; height: var(--ctl-h-sm); margin: 0; padding: 0 4px; }
.disc input { width: 80px; }
.modal-back { position: fixed; inset: 0; background: rgba(10, 18, 16, .45); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--card); color: var(--ink); border-radius: var(--r); box-shadow: var(--shadow-lg); width: min(1000px, 100%); padding: 16px; }
.pp-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pp-cats .seg-b { border: 1px solid var(--line); border-radius: var(--r-pill); padding: 4px 12px; background: var(--card); cursor: pointer; }
.pp-cats .seg-b.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.tier-set { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; margin: 10px 0; }
.tier-tbl input { width: 110px; height: var(--ctl-h-sm); margin: 0; display: inline-block; }
.tier-tbl td { white-space: nowrap; }
@media (max-width: 700px) { table.builder input, .disc input { width: 100% !important; } .modal { padding: 12px; } }
/* Box barcodes dialog (boxBarcodes.js) */
.bc-modal { max-height: 90vh; overflow: auto; }
.bc-tabs, .bc-bar { gap: 6px; margin-bottom: 8px; flex-wrap: wrap; align-items: center; }
.bc-bar .fill { flex: 1; }
.bc-bar #bb-q { max-width: 260px; }
.bc-tbl code { font-size: var(--fs-xs); white-space: nowrap; }
.bc-tbl td { vertical-align: top; }
table.builder td.emp { min-width: 220px; }
tr.pp-group > td { background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: var(--fs-sm); padding: 6px 10px; position: static; }
@media (max-width: 700px) { tr.pp-group > td { display: block; } tr.pp-group > td::before { content: none; } }
.pp-favedit { margin: -4px 0 10px; }
.pp-favedit input { margin: 0 0 6px; }
.pp-more { padding: 10px 4px; text-align: center; }
.pp-favpanel { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; margin: -4px 0 10px; background: var(--card); }
.pp-favscroll { max-height: 260px; overflow-y: auto; margin: 8px 0; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 10px; }
.pp-favopt { display: flex; gap: 8px; align-items: center; padding: 3px 0; font-size: var(--fs-sm); cursor: pointer; }
.pp-favopt input { width: auto; height: auto; margin: 0; }
/* The loading mark is the Jade brush circle painting itself (Colin, 2026-10-28): the logo image under a conic mask whose
   angle sweeps 0→360° (the stroke appears clockwise from six o'clock), holds, then starts over.
   Browsers that can't animate a custom property just show the finished circle. */
@property --paint { syntax: "<angle>"; inherits: false; initial-value: 360deg; }
.spinner {
  display: inline-block; width: 18px; height: 18px; vertical-align: -4px; margin-right: 6px; border: 0; border-radius: 0;
  background: url(jade-logo.png) center / contain no-repeat;
  -webkit-mask: conic-gradient(from 180deg, #000 var(--paint), transparent 0); mask: conic-gradient(from 180deg, #000 var(--paint), transparent 0);
  animation: paint 1.5s cubic-bezier(.4, 0, .6, 1) infinite;
}
@keyframes paint { 0% { --paint: 0deg; } 75% { --paint: 360deg; } 92% { --paint: 360deg; opacity: 1; } 100% { --paint: 360deg; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.busy-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(15, 31, 25, .35); }
.busy-box { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 24px; font-size: var(--fs-md); }
.busy-box .spinner { width: 30px; height: 30px; margin-right: 0; }
.items-h .ghost { margin-left: auto; }
.pp-more { padding: 12px 4px; text-align: center; color: var(--muted); font-size: var(--fs-sm); }
.pp-favbar { margin-top: 8px; flex-wrap: wrap; } .pp-favbar input[type=search] { flex: 1 1 220px; margin: 0; }
/* Add products popup: fixed height; header, search and category buttons stay put, only the product list scrolls */
.modal.pp-modal { display: flex; flex-direction: column; height: 92vh; max-height: 92vh; }
.modal-back:has(.pp-modal) { overflow: hidden; padding-top: 4vh; padding-bottom: 0; }
#pp-res { flex: 1 1 auto; min-height: 160px; overflow-y: auto; overflow-x: hidden; border-top: 1px solid var(--line); }
#pp-res .tbl-wrap { overflow: visible; }
#pp-res thead th { position: sticky; top: 0; background: var(--card); z-index: 1; }
.pp-favscroll { max-height: 30vh; }
#pp-res table { border-collapse: separate; border-spacing: 0; margin-top: 0; } #pp-res thead th { top: 0; box-shadow: 0 1px 0 var(--line); }
#pp-res thead th { z-index: 5; } #pp-res tr.pp-group > td { position: static; }
#pp-res td:first-child { position: static; box-shadow: none; }
tr.ln-group > td { background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: var(--fs-sm); padding: 6px 10px; position: static !important; } @media (max-width: 700px) { tr.ln-group > td { display: block; } tr.ln-group > td::before { content: none; } }
.items-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.modal.pay-modal { width: min(560px, 100%); }
.pay-split-list { margin: 6px 0 4px; padding-left: 0; list-style: none; }
/* Receive payment (design review): two even columns, the split as aligned columns, Cancel then Record payment on the right. */
.pay-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.pay-grid > .fld { width: auto; }
.pay-grid > div, .pay-grid > .fld:has([name=note]), .pay-grid > .fld:has([name=invoice]) { grid-column: 1 / -1; }
.pay-grid .money-in { display: flex; }
.pay-grid .money-in input { width: 100%; max-width: 160px; }
.pay-actions { justify-content: flex-end; padding-top: 4px; }
.pay-actions #pay-msg { margin-right: auto; }
.pay-split-list li { display: grid; grid-template-columns: minmax(90px, max-content) minmax(80px, max-content) 1fr; gap: 12px; align-items: center; }
@media (max-width: 700px) { .pay-grid { grid-template-columns: 1fr; } }
.pay-split-list li { margin: 2px 0; } .modal-back:has(.pay-modal) { align-items: flex-start; padding-top: 10vh; }
.hist-row { margin: 8px 0; padding-bottom: 8px; border-bottom: 1px solid var(--line); } .hist-row:last-child { border-bottom: 0; } .hist-sum { color: var(--ink); } .hist-ch { margin: 4px 0 0 16px; padding: 0; }
/* Builder (Colin 2026-10-25): cells aligned on one line, much smaller $/% discount box */
table.builder td { vertical-align: middle; }
table.builder td.num { white-space: nowrap; }
.disc { gap: 2px; }
.disc select { width: 42px; padding: 0 2px; }
.disc input { width: 50px; } /* one character narrower (Colin 2026-11-07; was 58px) */
.above-card { display: flex; justify-content: flex-end; margin: 0 0 10px; } .title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .title-row h2 { margin: 0; }
.ls-link { font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; margin-left: 4px; } h2 .ls-link { font-size: var(--fs-sm); vertical-align: middle; }
.disc select { min-width: 0; }
.disc input { min-width: 0; }
/* Every cell centred on the row (Colin 2026-11-07: "vertically align the rows"; was top-aligned with line-height tricks) */
table.builder td, table.builder td.ln-note { vertical-align: middle; }
table.builder td.ln-note { white-space: nowrap; }
/* The tier discount shown in a line's Discount box (Colin 2026-11-11): green placeholder, typing replaces it */
table.builder .ln-dv.ln-tierdisc::placeholder { color: #067647; opacity: 1; font-weight: 700; }
/* ⋮ left of each product (Colin 2026-11-07): Rename / Remove */
.ln-name { display: flex; align-items: center; gap: 4px; }
.ln-menu { position: relative; flex: 0 0 auto; }
.ln-more { border: 0; background: transparent; box-shadow: none; min-height: 0; padding: 4px 6px; font-size: var(--fs-lg); line-height: 1; color: var(--muted); cursor: pointer; border-radius: var(--r-sm); }
.ln-more:hover, .ln-more[aria-expanded="true"] { background: var(--brand-soft); color: var(--brand); }
.ln-menu-list { position: fixed; /* placed under the ⋮ by invoices.js; fixed so the table's scroll box can't clip it */ min-width: 190px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; z-index: 30; }
.ln-menu-list[hidden] { display: none; }
.ln-menu-list button { text-align: left; border: 0; background: transparent; box-shadow: none; padding: 8px 12px; border-radius: var(--r-sm); font-weight: 600; color: var(--ink); min-height: 0; white-space: nowrap; }
.ln-menu-list button:hover { background: var(--brand-soft); }
.ln-menu-list button.ab-danger { color: var(--bad); }
/* Bottom control bar on invoice pages: always visible, holds the page's buttons */
.action-bar { position: fixed; left: var(--rail-w); right: 0; bottom: 0; z-index: 40; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 24px; background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px -12px rgba(15, 31, 25, .25); }
.action-bar .ab-gap { flex: 1; }
.action-bar .ab-danger { color: var(--bad); }
main:has(.action-bar) { padding-bottom: 90px; }
body:has(.action-bar) .sg-bubble { bottom: 84px; }
@media (max-width: 700px) { .action-bar { left: 0; padding: 8px 12px; gap: 6px; } }
/* Builder clean-up (Colin 2026-10-25): category headings keep their colour at every width (the tablet sticky-first-column
   rule was painting them white); price box right-aligned under its header with the Default / Last paid note beneath it;
   totals never split an amount over two lines. */
.tbl-wrap tr.ln-group > td, .tbl-wrap tr.pp-group > td { background: var(--brand-soft) !important; color: var(--brand); box-shadow: none; }
table.builder td.num input { display: inline-block; vertical-align: top; }
table.builder th.ln-price-h, table.builder td[data-label="Price"] { width: 1%; } /* by name: Cost may sit before it */
/* Tighter columns on the builder (Colin 2026-11-07) */
table.builder th, table.builder td { padding-left: 4px; padding-right: 4px; }
table.builder th:first-child, table.builder td:first-child { padding-left: 8px; }
.totals b { white-space: nowrap; padding-left: 12px; }
.totals > div > span { flex: 1; }
@media (max-width: 700px) {
  table.builder td[data-label="Price"] { width: auto; }
  table.builder td.num input { width: 120px !important; }
  table.builder td[data-label="Price"] { flex-wrap: wrap; }
  .disc select { width: 56px; }
  .disc input { width: 96px !important; }
  .action-bar .ab-gap { display: none; }
  .action-bar button, .action-bar .btn { padding: 8px 12px; }
}
@media (max-width: 700px) { .disc select { flex: 0 0 56px; min-width: 56px; } .disc input { flex: 0 0 96px; } .action-bar { gap: 6px; } .action-bar button, .action-bar .btn { padding: 8px 10px; font-size: var(--fs-sm); } }
.ship-to select { margin: 2px 0 4px; }
/* Filter panels: labelled groups, each an even grid; switches in a row under their group (Colin 2026-10-25) */
.filters-panel .fgroup { padding: 10px 0; border-bottom: 1px solid var(--line); }
.filters-panel .fgroup:last-of-type { border-bottom: 0; }
.fgroup-h { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.fgroup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 12px; align-items: end; }
.fgroup-grid .fld { width: auto !important; min-width: 0; margin: 0; }
.fgroup-grid .fld input, .fgroup-grid .fld select { width: 100%; min-width: 0; margin: 0; }
.fgroup-grid .fld-wide { grid-column: span 2; }
.fgroup-grid .fld .pills { display: flex; flex-wrap: wrap; gap: 6px; }
.fgroup-checks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.fgroup-grid + .fgroup-checks { margin-top: 10px; }
.fgroup > .fgroup-checks:first-child, .fgroup-h + .fgroup-checks { margin-top: 0; }
@media (max-width: 700px) { .fgroup-grid { grid-template-columns: 1fr 1fr; } .fgroup-grid .fld-wide { grid-column: 1 / -1; } }
@media (min-width: 1000px) {
  .filters-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); column-gap: 32px; }
  .filters-panel > .row { grid-column: 1 / -1; }
  .filters-panel .fgroup { border-bottom: 0; }
}
/* Contact page: one card, sections with headings */
.sect-h { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.card > .page-h + .sect-h { border-top: 0; padding-top: 0; margin-top: 8px; }
.sect-h-row { align-items: center; margin: 0; }
.sect-h-row .sect-h { flex: 1; }
.sect-h-row > span { padding-top: 12px; margin-top: 16px; }
.email-line { overflow-wrap: anywhere; word-break: break-word; }
/* Several addresses side by side (contact list, account header): each its own link, wrapping whole on a phone. */
.email-chips a.email-chip { display: inline-block; margin-right: .6em; overflow-wrap: break-word; max-width: 100%; }
.facts > div { min-width: 0; }
.sect-h-row { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; margin-bottom: 8px; }
.sect-h-row .sect-h { border-top: 0; padding-top: 0; margin: 0; }
.sect-h-row > span { padding-top: 0; margin-top: 0; }
.facts > .fact-wide { grid-column: span 2; } @media (max-width: 700px) { .facts > .fact-wide { grid-column: auto; } } .email-line { overflow-wrap: anywhere; word-break: normal; }
/* Dashboard margin chart (validated colours: light #008345 / #2a78d6, dark #5fa046 / #3987e5) */
:root { --mc-co: #008345; --mc-you: #2a78d6; }
@media (prefers-color-scheme: dark) { :root:not([data-mode="light"]) { --mc-co: #5fa046; --mc-you: #3987e5; } }
:root[data-mode="dark"] { --mc-co: #5fa046; --mc-you: #3987e5; }
.mc-legend { display: flex; gap: 12px; font-size: var(--fs-sm); color: var(--ink); }
.mc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mc-sw { display: inline-block; width: 18px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 4px; }
.mc-co-sw { border-color: var(--mc-co); }
.mc-you-sw { border-color: var(--mc-you); border-top-style: dashed; }
.mc-wrap { position: relative; margin-top: 8px; }
.mc-svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.mc-grid { stroke: var(--line); stroke-width: 1; }
.mc-axis { fill: var(--muted); font-size: var(--fs-xs); }
.mc-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.mc-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.mc-co { stroke: var(--mc-co); }
.mc-you { stroke: var(--mc-you); stroke-dasharray: 6 4; }
.mc-end { font-size: var(--fs-xs); font-weight: 600; fill: var(--ink); }
.mc-co-d { fill: var(--mc-co); stroke: var(--card); stroke-width: 2; }
.mc-you-d { fill: var(--mc-you); stroke: var(--card); stroke-width: 2; }
.mc-tip { position: absolute; top: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow); padding: 8px 10px; font-size: var(--fs-xs); pointer-events: none; white-space: nowrap; }
.mc-table summary { cursor: pointer; margin-top: 6px; }
.ls-under-name { font-size: var(--fs-xs); font-weight: 600; margin-top: 2px; } .facts-more { margin-top: 12px; } .sect-h-row { gap: 12px; }

/* Returns: wide-search candidates (Settings > QuoteMachine returns) */
.wide-c{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:6px 0;border-bottom:1px solid var(--line)}
.wide-c:last-child{border-bottom:0}
.wide-c .wide-ok{margin-left:auto}

/* Add products popup: search on top, then labelled filter rows (Categories / Tobacco tax / Show) aligned in two columns */
.pp-search { width: 100%; margin: 4px 0 10px; font-size: var(--fs-md); }
.pp-filters { display: grid; gap: 8px; margin-bottom: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-2); }
.pp-filters .pp-cats { margin: 0; }
.pp-count { margin-left: auto; }

/* Invoice page bottom bar: statuses on the left (Colin 2026-10-25) */
.action-bar .ab-status { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.action-bar button:disabled { opacity: .5; cursor: not-allowed; }
main:has(.action-bar .ab-status) { padding-bottom: 110px; }
@media (max-width: 700px) { .action-bar .ab-status { flex-basis: 100%; } main:has(.action-bar .ab-status) { padding-bottom: 150px; } }
@media (max-width: 700px) { .action-bar button[disabled][title="Coming soon"] { display: none; } }
/* Add products v3: all categories as bubbles (scroll if many) with a find box; plain checkboxes for Show */
.pp-check { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); cursor: pointer; margin-right: 10px; }
.pp-check input { width: auto; height: auto; margin: 0; }
/* Add products v4: find box + dropdown, picked chips to its right, popular bubbles under it, no row labels */
.pp-filters { gap: 10px; }
/* Add products v5: one card (search + checkboxes on top, no white line between), small bubbles below */
.pp-filters .pp-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.pp-filters .pp-search { flex: 1 1 240px; width: auto; margin: 0; font-size: var(--fs-sm); background: var(--card); }
.pp-filters .pp-top .pp-check { margin: 0; white-space: nowrap; }
.pp-filters .pp-count { margin-left: auto; white-space: nowrap; }
.pp-small { gap: 4px 5px; }
.pp-small .seg-b { height: 22px; padding: 0 9px; font-size: var(--fs-xs); line-height: 20px; font-weight: 600; }
.pp-filters { gap: 8px; padding: 10px 12px; }
/* Invoice/return page: customer block (address, one email per line, phone) and the date in the card's upper right */
.doc-date { text-align: right; line-height: 1.25; }
.doc-head { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.doc-ls { text-align: left; }
.doc-ls .ls-link { margin-left: 0; }
.doc-from { font-size: var(--fs-sm); font-weight: 400; color: var(--muted); margin-left: 12px; }
.doc-date b { font-size: var(--fs-lg); }
/* Breadcrumbs in the header */
.crumbs { min-width: 0; }
.crumbs ol { display: flex; flex-wrap: nowrap; align-items: center; gap: 0; list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0; }
.crumbs li { display: inline-flex; align-items: center; white-space: nowrap; min-width: 0; }
.crumbs li + li::before { content: "›"; margin: 0 8px; color: var(--muted); font-weight: 400; }
.crumbs a { color: var(--muted); text-decoration: none; } .crumbs a:hover { color: var(--brand); text-decoration: underline; }
.crumbs li:last-child span, .crumbs li:last-child a { color: var(--ink); overflow: hidden; text-overflow: ellipsis; max-width: 38vw; }
/* Phones: the page you are on and the one above it (the Back links are gone: the crumbs are the way up; Colin 2026-10-28) */
@media (max-width: 700px) { .crumbs li:not(:last-child):not(:nth-last-child(2)) { display: none; } .crumbs li:nth-last-child(2)::before { content: none; } .crumbs li:last-child span, .crumbs li:last-child a { max-width: 42vw; } }
/* Bigger tags in the bottom bar (Colin 2026-10-25) */
.action-bar .ab-status { gap: 8px; margin-right: 6px; }
.action-bar .ab-status .pill { font-size: var(--fs-sm); padding: 6px 12px; line-height: 1.2; }
/* Add products: picked-category chips + drill-down row ("‹ Back", "in Disposables") */
.pp-picks { margin-bottom: 0; }
.pp-small .seg-b.back { font-weight: 700; }
/* Category breadcrumb (All › Disposables › …) before the sub-category bubbles, and the › in result group headers. */
.pp-crumbs { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: var(--fs-xs); margin-right: 2px; }
.pp-crumb { border: 0; background: none; padding: 0 3px; height: 22px; min-height: 0; line-height: 22px; box-shadow: none; font: inherit; font-weight: 600; color: var(--brand); cursor: pointer; }
.pp-crumb:hover { text-decoration: underline; }
.pp-crumb.here { color: var(--ink); line-height: 22px; }
.pp-crumb.here.on { background: var(--brand-soft); color: var(--brand); border-radius: var(--r-pill); padding: 0 8px; }
.pp-sep { opacity: .45; padding: 0 3px; }
tr.pp-group > td { font-weight: 500; }
tr.pp-group > td b { font-weight: 700; }
.pp-gsame { opacity: .5; }
.pp-picks[hidden] { display: none; }
/* Category filters, cleaner (Colin 2026-11-11): path line with Clear + Favorites, counts on the bubbles */
.pp-path { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 2px 0 4px; }
.pp-path .pp-crumbs { font-size: var(--fs-sm); }
.pp-path .pp-clear { margin-left: auto; border: 0; background: none; padding: 0 4px; height: 26px; min-height: 0; line-height: 26px; box-shadow: none; font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--brand); cursor: pointer; }
.pp-path .pp-clear:hover { text-decoration: underline; }
.pp-path .pp-favbtn { margin-left: auto; }
.pp-path .pp-clear + .pp-favbtn { margin-left: 0; }
.seg-b .pp-n { margin-left: 6px; font-size: .85em; font-weight: 500; opacity: .7; }

/* Invoice/return bottom bar: ⋮ menu for the less-used actions */
.ab-menu { position: relative; }
.ab-more { font-size: var(--fs-xl); line-height: 1; padding: 6px 12px; }
.ab-menu-list { position: absolute; bottom: calc(100% + 8px); right: 0; min-width: 200px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; z-index: 60; }
.ab-menu-list button { text-align: left; border: 0; background: transparent; box-shadow: none; padding: 9px 12px; border-radius: var(--r-sm); font-weight: 600; color: var(--ink); min-height: 0; }
.ab-menu-list button:hover { background: var(--brand-soft); }
.ab-menu-list button.ab-danger { color: var(--bad); }
/* Dashboard on phones: the margin tile is a normal tile; the 12-month chart is its own card below. */
.mc-card { margin-top: 12px; }
.sm-card { margin-top: 12px; }
.cm-head { display: flex; gap: 24px; flex-wrap: wrap; margin: 8px 0 12px; }
.cm-big { font-size: var(--fs-2xl); font-weight: 700; }
.cm-mid { font-size: var(--fs-xl); font-weight: 600; }
.sm-card .page-h { flex-wrap: wrap; gap: 8px; }
.sm-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: start; margin-top: 8px; }
.sm-body td:first-child { white-space: nowrap; }
@media (max-width: 1100px) { .sm-body { grid-template-columns: 1fr; } } /* five columns: the table over the chart */
.sm-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sm-total { stroke-width: 3; stroke: var(--ink); }
@media (max-width: 720px) { .sm-body { grid-template-columns: 1fr; } }
.mc-card .page-h { flex-wrap: wrap; gap: 8px; }
@media (max-width: 520px) { .mc-card .mc-legend { font-size: var(--fs-xs); } .dash-head h2 { font-size: var(--fs-xl); } .tile-v { font-size: var(--fs-xl); } }
/* Margin by salesperson, listed under the margin tile */
.sp-list { list-style: none; margin: 4px 0 0; padding: 6px 0 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; font-size: var(--fs-sm); }
.sp-list li { display: flex; justify-content: space-between; gap: 8px; }
.sp-list li span { color: var(--muted); font-weight: 600; }
/* …in the 12-month chart card: one line of name / margin pairs. */
.sp-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin: 4px 0 8px; }
.sp-row .sp-list { flex-direction: row; flex-wrap: wrap; gap: 4px 16px; border-top: 0; margin: 0; padding: 0; }
.sp-row .sp-list li { gap: 6px; }
/* The Bonus table: three columns don't need the card's full width (design review #13). */
@media (min-width: 701px) { .sm-card .tbl-wrap > table { width: auto; min-width: 360px; } }

/* Dashboard · "Your day" for an account manager (2026-10-28): the lead pills, two to-do cards side by side, the days figure */
.lead-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 12px; }
.lead-row .pill { font-weight: 700; }
/* The two to-do cards never push the page sideways (design review #6): columns may shrink, wide tables scroll inside. */
.todo { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; margin-bottom: 12px; }
.todo .card { margin: 0; min-width: 0; }
.todo td:first-child { min-width: 160px; }
.todo td[data-label="Last paid"], .todo td[data-label="Last order"] { white-space: nowrap; }
/* Side by side only when both tables fit (two columns clipped their buttons at 1366px). */
@media (min-width: 1700px) { .todo { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .todo .card:nth-child(n+3) { grid-column: 1 / -1; } }
@media (max-width: 700px) { .todo td:first-child { min-width: 0; } }
.days { font-weight: 700; color: var(--red); }
.phone { white-space: nowrap; }
.feed-dot.created { background: var(--mc-you); }
.feed-dot.bad { background: var(--red); }
/* A small button beside a heading or in a table row (contact page Edit, dashboard ☎ / New invoice) */
.btn.small, button.small { padding: 4px 10px; line-height: 20px; font-size: var(--fs-sm); border-radius: var(--r-sm); } /* --ctl-h-sm (30px) */
/* Settings rows' own inputs carry inline 36px heights (settings/general.js); bring them to the one control height. */
.set-ctl > input, .set-ctl .money-in input, .set-ctl > select { height: var(--ctl-h) !important; margin: 0; }
/* Jade's own confirm / prompt dialogs (askDialog), the same modal as Receive payment */
.modal.ask-modal { width: min(520px, 100%); } .modal-back:has(.ask-modal) { align-items: flex-start; padding-top: 14vh; z-index: 60; }
.ask-p { margin: 0 0 10px; line-height: 1.45; } .ask-fld { display: block; width: 100%; } .ask-fld textarea { width: 100%; min-height: 72px; resize: vertical; } .ask-row { margin-top: 12px; }
button.danger { background: var(--red); border-color: transparent; color: var(--on-brand); box-shadow: 0 1px 2px rgba(15,31,25,.15); }
/* The per-line "Restock" tick on a return draft: a plain checkbox, not a full-size input (Colin 2026-10-28) */
table.builder input[type=checkbox] { display: inline-block; width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; border: 0; background: transparent; vertical-align: middle; accent-color: var(--brand); cursor: pointer; }

/* Account statement (accounts.js renderStatement) and printing */
.stmt-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.stmt-co { font-weight: 700; line-height: 1.4; } .stmt-co br + * { font-weight: 500; }
.stmt-title { text-align: right; }
.stmt-to { display: grid; grid-template-columns: 1.3fr 1fr 1.3fr; gap: 20px; margin: 16px 0 6px; align-items: start; }
.stmt-sum div { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; } .stmt-sum .grand { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; font-size: var(--fs-lg); }
.stmt-sum .warnrow b { color: var(--red); }
.stmt-t td, .stmt-t th { padding: 6px 8px; } .stmt-open td, .stmt-close td { background: var(--bg); } .stmt-t tr.muted td { color: var(--muted); text-decoration: line-through; }
.stmt-foot { margin: 16px 0 0; color: var(--muted); }
@media (max-width: 700px) { .stmt-to { grid-template-columns: 1fr; } .stmt-head { flex-direction: column; } .stmt-title { text-align: left; } }
@media print {
  .rail, .top, .no-print, .sg-bubble, #toast, .busy-overlay { display: none !important; }
  .shell { margin-left: 0; } body { background: #fff; } main { padding: 0; max-width: none; }
  .card.stmt { box-shadow: none; border: 0; border-radius: 0; padding: 0; }
  .stmt a { color: inherit; text-decoration: none; }
  .tbl-wrap { overflow: visible; } tr { break-inside: avoid; }
}

/* Settings › Templates: brands and the template editor */
.logo-box { display: inline-flex; align-items: center; justify-content: center; min-width: 120px; height: 56px; border: 1px dashed var(--line); border-radius: var(--r-sm); padding: 4px; }
.logo-box img { max-height: 48px; max-width: 160px; }
.tpl-tabs { display: flex; gap: 6px; align-items: flex-end; margin-bottom: 10px; flex-wrap: wrap; }
.tpl-tabs .fill { flex: 1; }
.tpl-tabs .tab { border: 1px solid var(--line); background: transparent; border-radius: var(--r-sm) 8px 0 0; padding: 6px 12px; }
.tpl-tabs .tab.here { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }
#gjs { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.code-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.code-grid textarea { width: 100%; height: 70vh; font: 12px/1.45 ui-monospace, Consolas, monospace; white-space: pre; resize: vertical; }
#t-preview { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
@media (max-width: 800px) { .code-grid { grid-template-columns: 1fr; } .code-grid textarea { height: 40vh; } }

/* Action bar with icons (Colin 2026-10-31): icon + short label; icons only on phones. */
.action-bar .ab-ic { display: inline-flex; align-items: center; gap: 7px; }
.action-bar .ab-ic svg { width: 18px; height: 18px; flex: none; }
.action-bar .ab-more svg { width: 20px; height: 20px; }
@media (max-width: 700px) { .action-bar .ab-ic span { display: none; } .action-bar .ab-ic { padding: 8px 10px; } .action-bar button[disabled][title*="coming soon"] { display: none; } }

/* Settings › Templates › Brands (sectioned form, 2026-10-31) */
.bf-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.bf-pick { display: flex; gap: 8px; align-items: center; }
.bf-pick select { width: 260px; margin: 0; }
.bf { max-width: 880px; }
.bf-sec { padding: 16px 0 6px; border-top: 1px solid var(--line); }
.bf-sec:first-child { border-top: 0; }
.bf-sec h4 { margin: 0 0 12px; font-size: var(--fs-md); letter-spacing: -.01em; }
.bf-grid { display: grid; gap: 12px 12px; margin-bottom: 12px; }
.bf-2 { grid-template-columns: 1fr 1fr; }
.bf-3 { grid-template-columns: 1fr 1.3fr 1.3fr; }
.bf-addr { grid-template-columns: 1fr 2fr .7fr 1fr; }
.bf-colors { grid-template-columns: repeat(2, minmax(0, 220px)); }
.bf-f { display: flex; flex-direction: column; gap: 5px; margin: 0; min-width: 0; }
.bf-f > span:first-child { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.bf-f input, .bf-f select, .bf textarea { width: 100%; min-width: 0; margin: 0; font-size: var(--fs-md); font-weight: 500; color: var(--ink); }
.bf-f input, .bf-f select, .bf-pick select { height: var(--ctl-h); box-sizing: border-box; }
.bf-pick select { font-size: var(--fs-md); }
.bf-pick button { height: var(--ctl-h); }
.bf textarea { display: block; font-family: inherit; font-size: var(--fs-md); line-height: 1.45; font-weight: 500; color: var(--ink); background: var(--bg); border: 1.5px solid transparent; border-radius: var(--r-sm); padding: 10px 12px; resize: vertical; margin-bottom: 12px; }
.bf textarea:focus { outline: none; border-color: var(--brand-2); background: var(--card); box-shadow: var(--ring); }
.bf-ident { display: flex; gap: 16px; align-items: flex-start; }
.bf-grow { flex: 1; min-width: 0; }
.bf-logo { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.bf .logo-box { width: 150px; height: 84px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line); border-radius: var(--r-sm); background: var(--bg); }
.bf .logo-box img { max-width: 134px; max-height: 70px; object-fit: contain; }
.bf-logo-btns { display: flex; gap: 12px; }
.bf-color-row { display: flex; gap: 8px; align-items: center; }
.bf-color-row input[type="color"] { width: 44px; height: var(--ctl-h); padding: 3px; flex: none; cursor: pointer; }
.bf-color-row .bf-hex { font-family: ui-monospace, Consolas, monospace; font-size: var(--fs-sm); text-transform: lowercase; }
.bf-actions { display: flex; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.bf-actions .fill { flex: 1; }
.bf-del { color: var(--bad); }
@media (max-width: 760px) {
  .bf-pick { width: 100%; } .bf-pick select { flex: 1; width: auto; }
  .bf-2, .bf-3 { grid-template-columns: 1fr; }
  .bf-addr { grid-template-columns: 1fr 1fr; }
  .bf-ident { flex-direction: column; align-items: stretch; } .bf-logo { align-items: flex-start; }
  .bf-actions { flex-wrap: wrap; }
}

/* Settings › Templates sub-tabs: one per kind + Brands (2026-10-31) */
.tpl-list-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.tpl-list-head > div { flex: 1; min-width: 0; }
.tpl-list-head .btn { flex: none; }
@media (max-width: 700px) { .tpl-list-head { flex-direction: column; } }
.tpl-actions { white-space: nowrap; text-align: right; }
.tpl-actions .link-btn + .link-btn { margin-left: 12px; }

/* Settings › Templates type tabs: file-folder tabs sitting on the card below (Colin, 2026-10-31: "like file tabs") */
.tpl-subtabs { display: flex; gap: 4px; align-items: flex-end; margin: 0; padding: 0 12px; position: relative; z-index: 1; }
.tpl-subtab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px 8px; margin-bottom: -1px; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r) 9px 0 0; background: var(--bg); color: var(--muted); text-decoration: none; font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; }
.tpl-subtab:hover { color: var(--ink); background: color-mix(in srgb, var(--card) 60%, var(--bg)); }
.tpl-subtab.here { background: var(--card); color: var(--ink); padding-bottom: 9px; box-shadow: inset 0 3px 0 var(--brand); }
.tpl-count { min-width: 20px; padding: 0 6px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--line) 70%, transparent); color: var(--muted); font-size: var(--fs-xs); font-weight: 700; text-align: center; line-height: 1.6; }
.tpl-subtab.here .tpl-count { background: var(--brand-soft); color: var(--brand); }
.tpl-subtabs + .card { border-top-left-radius: 0; border-top: 1px solid var(--line); }
@media (max-width: 700px) { .tpl-subtabs { overflow-x: auto; padding: 0 4px; } .tpl-subtab { padding: 8px 12px 7px; } }

/* Return credits held page (js/accounts.js) */
.rc-tbl .rc-ev > td { background: var(--bg-2); padding: 6px 10px 12px; }
.rc-tbl .rc-ev table { width: 100%; }
/* Invoice Print dialog (js/print.js) */
.modal.print-modal { width: min(1000px, 100%); display: flex; flex-direction: column; max-height: 94vh; }
.modal-back:has(.print-modal) { padding-top: 3vh; }
.print-modal .pr-opts { margin: 4px 0 6px; }
.print-modal #pr-note { min-height: 1.2em; margin-bottom: 8px; }
.print-modal .pr-frame { flex: 1; min-height: 0; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: #fff; }
.print-modal iframe { width: 100%; height: 66vh; border: 0; display: block; background: #fff; }

/* Settings > Checks groups (2026-11-02) */
.chk-more > summary { cursor: pointer; padding: 6px 0; }
.chk-group h4 { font-size: var(--fs-md); }

/* Ask Jade: the read-only assistant (js/assistant.js). Its bubble sits above the suggestion bubble. */
.aj-panel { position: fixed; right: 20px; bottom: 84px; z-index: 41; width: min(440px, calc(100vw - 32px)); height: min(620px, calc(100vh - 120px)); display: flex; flex-direction: column; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 12px; }
.aj-panel[hidden] { display: none; }
.aj-panel textarea { width: 100%; resize: vertical; font: inherit; }
.aj-panel .row .small { flex: 1; }
.aj-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 2px; }
.aj-msg { border-radius: var(--r); padding: 8px 11px; max-width: 92%; overflow-wrap: anywhere; line-height: 1.4; }
.aj-msg p { margin: 0 0 6px; } .aj-msg p:last-child { margin-bottom: 0; }
.aj-msg ul, .aj-msg ol { margin: 4px 0 6px; padding-left: 20px; }
.aj-me { align-self: flex-end; background: var(--bg-2); }
.aj-bot { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); }
.aj-table { overflow-x: auto; margin: 4px 0; } .aj-table table { border-collapse: collapse; font-size: var(--fs-sm); }
.aj-table th, .aj-table td { border-bottom: 1px solid var(--line); padding: 3px 8px 3px 0; text-align: left; white-space: nowrap; }
.aj-hello ul { padding-left: 16px; }
@media (max-width: 700px) {
  .aj-panel { right: 8px; left: 8px; width: auto; bottom: 76px; height: calc(100vh - 100px); }
  .aj-table table { display: table; width: auto; } .aj-table tbody { display: table-row-group; } .aj-table tr { display: table-row; padding: 0; border: 0; } .aj-table td, .aj-table th { display: table-cell; width: auto; padding: 3px 8px 3px 0; border-bottom: 1px solid var(--line); }
}
.aj-sugg { align-self: stretch; border: 1px dashed var(--line); border-radius: var(--r); padding: 8px 11px; background: var(--card); }
.aj-sugg textarea { width: 100%; margin: 6px 0; resize: vertical; font: inherit; }
.aj-panel .page-h button { white-space: nowrap; }
/* Void… dialog (invoices.js openVoidDialog) */
.void-steps { margin: 8px 0 12px; padding-left: 20px; } .void-steps li { margin-bottom: 10px; } .void-steps .btn { margin-top: 8px; display: inline-block; }
.void-effects { margin: 4px 0 10px; padding-left: 16px; } .void-effects li { margin-bottom: 3px; }
.void-banner { margin-top: 0; }

/* Accounts › Receivables (Colin 2026-11-03): quick filters, summary cards, an aging bar, rows with the next action. */
.acc-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 12px; }
.segs { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; background: var(--bg); }
.seg { padding: 6px 12px; border-radius: var(--r-pill); font-weight: 600; font-size: var(--fs-sm); color: var(--muted); text-decoration: none; white-space: nowrap; }
.seg:hover { color: var(--ink); }
.seg.on { background: var(--card); color: var(--brand); box-shadow: var(--shadow); }
.acc-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.acc-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); color: var(--ink); text-decoration: none; }
.acc-card b { font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }
a.acc-card:hover { border-color: var(--brand); }
.acc-card.bad b { color: var(--bad); }
.acc-card.good b { color: var(--brand); }
.aging-bar { display: flex; gap: 3px; margin: 0 0 12px; }
.ab-seg { display: flex; flex-direction: column; min-width: 0; padding: 6px 8px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink); background: var(--bg-2); border: 1px solid transparent; font-size: var(--fs-xs); overflow: hidden; }
.ab-seg span { color: var(--muted); white-space: nowrap; }
.ab-seg b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ab-seg:hover, .ab-seg.on { border-color: var(--brand); }
.ab-d30 { background: color-mix(in srgb, var(--warn-soft) 70%, var(--card)); }
.ab-d60 { background: var(--warn-soft); }
.ab-d90 { background: color-mix(in srgb, var(--bad-soft) 70%, var(--card)); }
.ab-d120 { background: var(--bad-soft); }
.acc-list td.big { font-size: var(--fs-md); }
.acc-list .late { color: var(--warn); }
.acc-list .late-bad { color: var(--bad); }
.acc-list .good-t { color: var(--brand); font-weight: 600; }
.acc-list td.acts { text-align: right; white-space: nowrap; }
.acc-list td.acts .btn { margin-left: 4px; }
/* Accounts › Credits (Colin 2026-11-03): the My accounts / Everyone buttons and each customer's credits in plain words. */
button.seg { border: 0; background: transparent; box-shadow: none; cursor: pointer; min-height: 0; height: auto; padding: 6px 12px; }
.good-t { color: var(--brand); font-weight: 600; }
a.btn.warn-t { color: var(--warn); border-color: var(--warn); }
.cr-lines td { background: var(--bg); }
.cr-ul { margin: 0; padding-left: 16px; line-height: 1.7; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
@media (max-width: 700px) {
  .acc-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .acc-quick .segs { width: 100%; }
  .acc-quick .seg { flex: 1; text-align: center; padding: 6px 8px; }
  .aging-bar { flex-wrap: wrap; }
  .ab-seg { flex: 1 1 30% !important; }
  .acc-list td.acts { text-align: left; padding-top: 8px; }
  .acc-list td.acts .btn { margin: 0 6px 0 0; }
}
/* Print dialog › Email… panel (2026-11-03) */
.print-modal .pr-mail { margin: 0 0 8px; display: grid; gap: 6px; }
.print-modal .pr-mail input, .print-modal .pr-mail textarea { width: 100%; }
.print-modal .pr-mail:not([hidden]) ~ .pr-frame iframe { height: 46vh; }

/* Phones: a denser layout (Colin 2026-11-04: "make the site more condensed on mobile"). Smaller type, tighter cards,
   slimmer stacked table rows. "html[data-look]" copies of a rule beat the themes' own spacing (themes load later). */
@media (max-width: 700px) {
  html, body { font-size: 14px; line-height: 1.4; }
  h2 { font-size: var(--fs-lg); } h3 { font-size: var(--fs-md); }
  .top { padding-top: calc(6px + env(safe-area-inset-top)); padding-bottom: 6px; padding-left: 10px; padding-right: 10px; }
  .brand img { width: 28px; height: 28px; }
  main, html[data-look] main { padding: 10px 8px 80px; }
  html[data-look="rounded"] main { padding: 12px 10px 20px; }
  .page-h { margin-bottom: 8px; gap: 6px; }
  .card, html[data-look]:not([data-look="swiss"]) .card { padding: 12px; margin-bottom: 10px; }
  html[data-look="swiss"] .card { padding-top: .75rem; margin-bottom: 1.25rem; }
  button, .btn { padding: 8px 12px; }
  input { padding: 0 10px; margin-top: 3px; }
  select { padding: 0 8px; }
  label { margin-bottom: 8px; }
  .banner { padding: 8px 10px; margin: 6px 0; }
  /* Segmented switches scroll sideways instead of wrapping into a tall oval (Market Watch sections). */
  .segs { max-width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .segs::-webkit-scrollbar { display: none; }
  .segs .seg { flex: none; }
  .acc-quick .segs .seg { flex: 1; }
  .facts { gap: 8px; }
  .seg a { padding: 6px 10px; }
  /* stacked table rows */
  tr { padding: 7px 0; }
  td, html[data-look="minimal"] tr:not(.ln-group):not(.pp-group) > td { padding: 2px 0; border: 0; }
  td.emp { font-size: var(--fs-md); padding-bottom: 3px; }
  td[data-label] { gap: 10px; min-height: 22px; }
  td[data-label]::before { font-size: var(--fs-xs); }
  .totals div, .margin-card > div { padding: 2px 0; }
  .acc-cards { gap: 6px; } .acc-card { padding: 8px 10px; } .acc-card b { font-size: var(--fs-lg); }
}
/* The Receivables "My accounts / All / Past due" buttons share the .seg name with the section tabs; drop the tabs' top margin. */
.segs .seg { margin: 0; }
@media (max-width: 700px) {
  .acc-quick { gap: 6px; margin-bottom: 8px; }
  .acc-quick .seg { padding: 4px 8px; }
  /* phones: skip a row's empty "—" lines instead of listing them */
  .acc-list td[data-label]:has(> span.muted:only-child) { display: none; }
  .acc-list tr { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
  .acc-list td.emp, .acc-list td.acts { grid-column: 1 / -1; }
  .aging-bar { margin-bottom: 8px; } .ab-seg { padding: 4px 6px; }
}

/* Settings › Users & roles › Roles (js/settings/roles.js, 2026-11-04) */
.tpl-subtabs + #access > .card:first-child { border-top-left-radius: 0; }
.role-pick { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.role-pick .role-b { padding: 6px 12px; }
.role-pick .role-b.on { border-color: var(--brand); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 4px 24px; }
.perm-group { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 8px 0 6px; min-width: 0; }
.perm-group legend { padding: 0 6px 0 0; font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
label.perm { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 5px 0; font-size: var(--fs-sm); font-weight: 400; color: var(--ink); cursor: pointer; }
label.perm input { width: auto; flex: none; margin: 3px 0 0; accent-color: var(--brand); }
label.perm b { font-weight: 600; display: block; }
label.perm .small { display: block; line-height: 1.35; }
label.perm:has(input:disabled) { cursor: default; }
@media (max-width: 700px) { .perm-grid { grid-template-columns: 1fr; } }

/* Settings › Activity (js/settings/activity.js): problem rows tinted. */
table.activity tr.act-err td { background: var(--bad-soft); }
table.activity details summary { cursor: pointer; color: var(--muted); }
/* Barcode check (Products, admins) */

/* Reports (2026-11-07, js/reports.js): landing cards by group, one report's filter row and tables. */
.rp-gh { margin: 16px 0 8px; font-size: var(--fs-md); }
.rp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.rp-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 12px; border: 1px solid var(--line); border-radius: var(--r); color: inherit; text-decoration: none; background: var(--card); }
a.rp-card:hover { border-color: var(--brand); }
.rp-card.off { opacity: .55; cursor: default; }
.rp-card.off .pill { align-self: flex-start; }
.rp-custom { display: contents; }
.rp-custom[hidden] { display: none; }
tr.rp-tot td { border-top: 2px solid var(--line); background: var(--bg); }
.print-only { display: none; }
@media print { .print-only { display: block; margin-bottom: 8px; } .rp-sec { box-shadow: none; border: 0; padding: 0; } .rp-sec a { color: inherit; text-decoration: none; } }
/* Report charts (public/js/charts.js; Colin 2026-11-07). Text and grid follow the theme tokens, so dark mode just works. */
.rp-chart { margin: 4px 0 10px; }
.ch-ctl { gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
.ch-ctl .ch-metric { width: auto; min-width: 140px; height: var(--ctl-h-sm); padding: 0 8px; font-size: var(--fs-sm); }
.ch-svg { width: 100%; height: auto; display: block; touch-action: pan-y; overflow: visible; }
.ch-lab { fill: var(--ink); font-size: var(--fs-xs); }
.ch-val { fill: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
.ch-mid { fill: var(--ink); font-size: var(--fs-md); font-weight: 700; }
.ch-dot { stroke: var(--card); stroke-width: 1.5; opacity: .9; }
.ch-hit:hover rect[rx], .ch-hit:hover path, .ch-hit:hover .ch-dot { filter: brightness(1.12); }
.ch-hit:hover .ch-lab { font-weight: 700; }
.ch-wrap .mc-tip { white-space: normal; max-width: 260px; z-index: 5; }
@media print { .rp-chart:not(.ch-on) { display: none; } .ch-wrap .mc-tip { display: none; } .rp-chart { break-inside: avoid; } }
/* Inventory › Transfers (Colin 2026-11-08): scanner first, big targets for the iPad */
.xf-to { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
/* Several transfers at once (2026-11-09): one button per transfer in progress, the open one highlighted. */
.xf-drafts { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 8px; }
.xf-draft { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 52px; padding: 6px 12px; text-align: left; }
.xf-draft .small { color: var(--muted); font-weight: 500; }
.xf-draft.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 2px var(--brand-soft); }
.xf-draft-new { min-height: 52px; }
.xf-name { max-width: 360px; margin: 0 0 4px; }
/* Receive (2026-11-09): a transfer's state line, the count differences, counted lines. */
.xf-state { margin: 8px 0; line-height: 1.6; }
.xf-diffs { margin: 6px 0 10px; padding-left: 20px; color: var(--bad); }
.xf-table tr.rc-ok td { background: var(--brand-soft); }
.xf-scanrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* Scan row: 44px (was 52px at 1.15rem; design review) - still an easy iPad target. */
.xf-scan { flex: 1 1 320px; height: 44px; font-size: var(--fs-md); padding: 0 12px; margin: 0; }
.xf-add { height: 44px; padding: 0 20px; }
.xf-msg { min-height: 1.4em; margin: 8px 0; font-weight: 600; }
.xf-msg.ok { color: var(--brand); }
.xf-msg.bad { color: var(--bad); }
.xf-picklist { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.xf-table td { vertical-align: middle; }
.xf-table .xf-qty { width: 72px; height: 32px; text-align: right; margin: 0; }
.xf-table tr.xf-warn td { background: var(--warn-soft); }
.xf-table tr.xf-bad td { background: color-mix(in srgb, var(--bad) 10%, transparent); }
.xf-warntext { color: var(--warn); }
@keyframes xfFlash { from { background: var(--brand-soft); } to { background: transparent; } }
.xf-table tr.xf-flash td { animation: xfFlash 1.2s ease-out; }
.xf-actions { margin-top: 12px; align-items: center; }
.xf-boxes { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; margin: 10px 0 16px; background: var(--bg); } /* neutral: the warning banner inside carries the amber */
.xf-boxes.xf-boxes-done { background: var(--brand-soft); }
.xf-boxes tr.xf-done td { opacity: .6; }
@media (max-width: 700px) { .xf-scan { flex-basis: 100%; } }

/* Verify stock checklist (verifyStock.js): iPad-sized tick boxes, a scan box, a sticky count + Done bar. */
.modal.vs-modal { width: min(760px, 100%); display: flex; flex-direction: column; max-height: 92vh; }
.modal-back:has(.vs-modal) { padding-top: 3vh; }
.vs-scan { width: 100%; flex: none; }
.vs-msg { min-height: 1.4em; margin: 8px 0; font-weight: 600; }
.vs-msg.ok { color: var(--brand); } .vs-msg.bad { color: var(--bad); }
.vs-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1 1 auto; }
.vs-row { display: flex; align-items: center; gap: 12px; padding: 12px 10px; border-bottom: 1px solid var(--line); cursor: pointer; min-height: 64px; }
.vs-row.on { background: var(--brand-soft); }
.vs-row.vs-flash { animation: xfFlash 1.2s ease-out; }
.vs-tick { width: 34px; height: 34px; flex: none; margin: 0; accent-color: var(--brand); }
.vs-name { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vs-qty { flex: none; display: flex; flex-direction: column; align-items: flex-end; font-size: var(--fs-xl); }
.vs-bar { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.vs-bar .ab-gap { flex: 1; }

/* Proposal action bar on one line (Colin 2026-11-08): no wrapping; narrower bars drop the long words (.ab-long) and the
   Print / Email labels; phone-width bars move Print / Email into the ⋮ menu (.ab-phone) and hide the status text. */
.action-bar.ab-one { flex-wrap: nowrap; gap: 8px; container: abar / inline-size; }
.action-bar.ab-one > * { flex-shrink: 0; white-space: nowrap; }
.action-bar.ab-one .ab-status { flex-wrap: nowrap; flex-basis: auto; }
.action-bar.ab-one #dr-status { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.action-bar.ab-one .ab-pill { font-size: var(--fs-sm); padding: 5px 10px; white-space: nowrap; }
main:has(.action-bar.ab-one) { padding-bottom: 90px; }
.ab-menu-list .ab-phone { display: none; }
.ab-t-mid, .ab-t-tiny { display: none; }
.ab-one .ab-pill .ab-t-mid { display: inline; } /* "✓ Verified" */
.ab-one .ab-pill .ab-t-long { display: inline; } .ab-one .ab-pill.warn .ab-t-mid { display: none; }
@container abar (max-width: 1080px) { .ab-long { display: none; } .ab-ic span { display: none; } .ab-ic { padding-left: 10px; padding-right: 10px; } }
@container abar (max-width: 900px) { .ab-status { display: none !important; } .ab-pill .ab-t-long { display: none !important; } .ab-pill.warn .ab-t-mid { display: inline !important; } }
@container abar (max-width: 760px) { .ab-wide { display: none !important; } .ab-menu-list .ab-phone { display: block; } }
@container abar (max-width: 560px) {
  #dr-status { display: none !important; }
  .ab-pill .ab-t-mid, .ab-pill.warn .ab-t-mid { display: none !important; } .ab-pill.warn .ab-t-tiny { display: inline !important; }
  .ab-pill { padding: 4px 8px; font-size: var(--fs-xs); }
}
@media (max-width: 700px) { .action-bar.ab-one { gap: 6px; } .action-bar.ab-one .ab-status { flex-basis: auto; } main:has(.action-bar.ab-one) { padding-bottom: 80px; } }

/* Add products: On invoice is a [−][ n ][+] box (Colin 2026-11-11); the trash can takes the product off */
.pp-step { display: inline-flex; align-items: stretch; white-space: nowrap; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--card); }
.pp-step button { min-width: 32px; height: var(--ctl-h-sm); min-height: 0; margin: 0; padding: 0 8px; border: 0; border-radius: 0; font-size: var(--fs-lg); line-height: 1; }
.pp-step button:disabled { opacity: .35; }
.pp-step .pp-n { width: 56px; height: var(--ctl-h-sm); margin: 0; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 0; text-align: center; -moz-appearance: textfield; }
.pp-step .pp-n::-webkit-inner-spin-button, .pp-step .pp-n::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
#pp-body tr.pp-on .pp-n { font-weight: 700; color: var(--brand); }
#pp-body td.pp-btns { white-space: nowrap; width: 1%; }
#pp-body td.pp-btns .pp-rm { height: var(--ctl-h-sm); margin: 0; padding: 0 8px; display: inline-flex; align-items: center; color: var(--red); }
/* Phone: the trash can sits in the card's top-right corner, next to the name, not on a line of its own */
@media (max-width: 700px) {
  #pp-body tr[data-item] { position: relative; }
  #pp-body td.pp-btns { position: absolute; top: 4px; right: 4px; width: auto; padding: 0; border: 0; background: none !important; }
  #pp-body tr.pp-on > td.emp { padding-right: 48px; }
}
/* A product already on the proposal: a lighter tint than the category header rows, with a green bar on the left */
#pp-body tr.pp-on > td { --pp-on: color-mix(in srgb, var(--brand-soft) 55%, var(--card)); background: var(--pp-on); }
/* 8px: the results box hides the table's first 4px on a wide screen, so 4px of bar shows */
#pp-body tr.pp-on > td:first-child { background: linear-gradient(to right, var(--brand) 8px, var(--pp-on) 8px); padding-left: 12px; }
@media (max-width: 700px) { #pp-body tr.pp-on > td, #pp-body tr.pp-on > td:first-child { background: linear-gradient(to right, var(--brand) 4px, var(--pp-on) 4px); padding-left: 12px; } }

/* Reports › Customer map (Colin 2026-11-12) */
.cm-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 10px; }
.cm-bar .cm-f { margin: 0; min-width: 180px; }
.cm-bar .cm-gap { flex: 1; }
.cm-card { padding: 0; overflow: hidden; }
.cm-map { height: 68vh; min-height: 380px; width: 100%; background: var(--bg); }
.cm-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line); }
.cm-key { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.cm-key i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1px solid var(--card); box-shadow: 0 0 0 1px var(--line); }
.cm-pop { min-width: 220px; }
.cm-pop .cm-facts { margin-top: 6px; font-size: var(--fs-sm); border-collapse: collapse; }
.cm-pop .cm-facts td { padding: 2px 8px 2px 0; vertical-align: top; }
.cm-pop .cm-facts td:first-child { color: var(--muted); white-space: nowrap; }
.cm-miss { width: 100%; margin-top: 8px; }
.cm-miss td { padding: 4px 8px 4px 0; }
@media (max-width: 700px) { .cm-map { height: 60vh; } .cm-bar .cm-f { min-width: 0; flex: 1 1 140px; } }
.cm-map path.leaflet-interactive:focus { outline: none; } /* no square box around a clicked dot */
/* Purchase order (Colin 2026-11-15, "its pretty ugly"): labelled field groups like the filter panels, $ beside money
   inputs, a compact invoice drop zone, totals on the right, actions in one row. */
.po-card .fgroup { padding: 12px 0; border-bottom: 1px solid var(--line); }
.po-card .fgroup:last-of-type { border-bottom: 0; padding-bottom: 0; }
.po-card .fgroup-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); align-items: start; }
.po-card .fld textarea { width: 100%; min-height: 60px; margin: 0; padding: 8px 10px; font: inherit; font-size: var(--fs-sm); }
.po-money { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.po-money input { width: 100px; margin: 0; }
.fld .po-money input { width: 100%; }
.po-drop { display: block; border: 2px dashed var(--line); border-radius: var(--r); padding: 24px; text-align: center; cursor: pointer; }
.po-inv { margin: 6px 0 0; }
.po-lines td { vertical-align: middle; }
.po-lines .po-qty { width: 72px; margin: 0; }
.po-lines .po-money input { width: 88px; }
.po-ls { font-size: var(--fs-xs); white-space: nowrap; margin-left: 4px; }
.po-totals { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px 20px; margin: 12px 0 0; font-size: var(--fs-sm); }
.po-total { font-size: var(--fs-lg); }
.po-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.po-actions #po-post { margin-left: auto; }
@media (max-width: 700px) { .po-totals { justify-content: flex-start; } .po-actions { flex-wrap: wrap; } }
.po-card .fld textarea { color: var(--ink); font-weight: 500; background: var(--bg); border: 1.5px solid transparent; border-radius: var(--r-sm); transition: .15s; resize: vertical; }
.po-card .fld textarea:focus { outline: none; border-color: var(--brand-2); background: var(--card); box-shadow: var(--ring); }
.po-card .fld { margin-bottom: 0; }
/* Invoice-first purchase order (2026-11-15): the invoice strip, field hints, invoice lines to fix opened under their row. */
.po-inv { margin: 8px 0 4px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--bg); }
.po-hint { font-weight: 500; color: var(--brand); }
.po-drop.over { background: var(--bg-2); }
.po-fix td { background: var(--bg); }
.po-fix-in { padding: 4px 2px 6px; }
.po-fix .po-per { width: 70px; margin: 0; display: inline-block; }
.po-fix select { width: auto; margin: 0; }
.po-off td { opacity: .6; }
/* Click-a-header sorting on every table (tablesort.js, 2026-11-16): the arrow is drawn by CSS so header text stays clean. */
.ts-btn::after { content: attr(data-arr); font-size: .7em; opacity: 0; margin-left: 4px; transition: opacity .12s; }
th:hover .ts-btn::after, .ts-btn:focus-visible::after { opacity: .35; }
.ts-btn.on::after, th:hover .ts-btn.on::after { opacity: 1; }
/* Purchase Orders list (2026-11-16): the Production Orders tick box sits beside the vendor picker. */
.pa-inhouse { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; white-space: nowrap; }
.pa-inhouse input { width: auto; margin: 0; }
/* A price far from Lightspeed's last cost: a small warning only (2026-11-16). */
.po-warn { font-size: var(--fs-xs); font-weight: 600; color: var(--warn); white-space: nowrap; }
/* Scan beep switch (2026-11-16) beside the scan box. */
.scan-beep { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; white-space: nowrap; }
.scan-beep input { width: auto; margin: 0; }
/* Write-offs (2026-11-16): product search results and the admin's category list. */
.wo-hits table { margin: 6px 0; }
.wo-cats { max-height: 320px; overflow: auto; margin: 8px 0; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.wo-cat { display: flex; align-items: center; gap: 6px; margin: 0; padding: 3px 2px; font-weight: 500; color: var(--ink); }
.wo-cat input { width: auto; margin: 0; }

/* Internal comments on an EWI (2026-11-17) */
.ic-row { padding: 6px 0; border-bottom: 1px solid var(--line); }
.ic-row:last-child { border-bottom: 0; }
.ic-text { white-space: pre-wrap; margin-top: 2px; }
.ic-add { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.ic-add textarea { flex: 1; }

/* Weird fact of the day (2026-11-17, js/facts.js) */
.fact-modal { max-width: 440px; text-align: center; padding: 24px 24px 24px; }
.fact-emoji { font-size: 44px; line-height: 1; margin-bottom: 6px; }
.fact-modal h3 { margin: 4px 0 10px; }
.fact-text { font-size: var(--fs-lg); line-height: 1.5; margin: 0 0 16px; }

/* Phone tables hide empty labelled cells (design review 2026-11-17). */
@media (max-width: 700px) { td[data-label]:empty { display: none; } }

/* Spacing utilities on the 4px scale, for the inline margins pages used to write (design cleanup 2026-11-18). */
.m-0 { margin: 0 !important; } .mt-0 { margin-top: 0 !important; } .mb-0 { margin-bottom: 0 !important; }
.mt-1 { margin-top: var(--s1) !important; } .mt-2 { margin-top: var(--s2) !important; } .mt-3 { margin-top: var(--s3) !important; }
.mb-1 { margin-bottom: var(--s1) !important; } .mb-2 { margin-bottom: var(--s2) !important; } .mb-3 { margin-bottom: var(--s3) !important; }
.page-h h3 { margin: 0; }
/* Phones: list headers and pagers stay on one line where they fit ("Next ›" sat on its own line). */
@media (max-width: 700px) {
  .list-top { gap: 6px; }
  .pager { gap: 8px; }
  .pager .row { gap: 6px; flex-wrap: nowrap; }
  .pager .btn, .pager button, .pager .per, .pager span { padding-left: 10px; padding-right: 10px; white-space: nowrap; }
  .pager .per, .pager span { padding: 0; }
}
