/* Buffalo POS — alternative looks (chosen per user in style.php).
   Option A = body.theme-navy: side menu, navy and blue.   Option B = body.theme-green: top menu, green and yellow.
   Light / dark mode (body.mode-light / mode-dark / mode-auto) is at the bottom of this file. */

/* ═════ Option A: navy ═════ */
body.theme-navy {
  color-scheme: light;
  --bg: #F2F5F7; --surface: #FFFFFF; --surface-2: #E8EEF3; --text: #0B1F33; --muted: #51606F; --border: #D5DDE4;
  --brand: #0B6FA4; --brand-2: #084F76; --brand-ink: #FFFFFF; --accent: #36B3E0;
  --info-bg: #DCEEF8; --warn-bg: #FBE9D0; --radius: 14px; --radius-sm: 10px;
  --font: Figtree, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
body.theme-navy .shell { display: flex; min-height: 100vh; }
body.theme-navy .shell-main { flex: 1 1 auto; min-width: 0; }
body.theme-navy .sidenav {
  flex: 0 0 228px; box-sizing: border-box; background: #0B1F33; padding: 18px 12px; display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow-y: auto;
}
body.theme-navy .nav-title { padding: 0 10px 6px; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8FA1B3; }
body.theme-navy .nav-group { display: flex; flex-direction: column; gap: 2px; }
body.theme-navy .sidenav a { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 0 10px; border-radius: 9px; text-decoration: none; font-weight: 600; font-size: .92rem; color: #C3CFDA; }
body.theme-navy .sidenav a:hover { background: #17324D; color: #fff; }
body.theme-navy .sidenav a.on { background: #0B6FA4; color: #fff; }
body.theme-navy .topbar { background: #FFFFFF; color: #0B1F33; border-bottom: 1px solid #DFE5EA; }
body.theme-navy .topbar .brand { color: #0B1F33; }
body.theme-navy .topbar .brand-mark { background: #0B6FA4; color: #fff; }
body.theme-navy .topbar .btn-ghost { color: #0B1F33; border-color: #D5DDE4; }
body.theme-navy .topbar .btn-ghost:hover { background: #F2F5F7; }
body.theme-navy .role-chip { background: #DCE9F1; color: #0B1F33; }
body.theme-navy .tile-icon { background: #DCEEF8; border-radius: 11px; align-self: flex-start; width: 44px; height: 44px; display: grid; place-items: center; }
body.theme-navy .btn-primary { font-weight: 800; }
@media (max-width: 900px) {
  /* narrow screens: the side menu becomes a strip you scroll sideways */
  body.theme-navy .shell { flex-direction: column; }
  body.theme-navy .shell-main { width: 100%; }
  body.theme-navy .sidenav { position: static; height: auto; flex: 0 0 auto; width: 100%; max-width: 100vw; flex-direction: row; gap: 4px; overflow-x: auto; overflow-y: hidden; padding: 8px; }
  body.theme-navy .nav-group { flex-direction: row; align-items: center; gap: 2px; }
  body.theme-navy .nav-title { display: none; }
  body.theme-navy .sidenav a { white-space: nowrap; min-height: 44px; }
}

/* ═════ Option B: green ═════ */
body.theme-green {
  color-scheme: light;
  --bg: #F3F5F1; --surface: #FFFFFF; --surface-2: #E8EEE6; --text: #14201A; --muted: #55635B; --border: #DDE3DC;
  --brand: #0F6B4B; --brand-2: #0A4D36; --brand-ink: #FFFFFF; --accent: #FFD23F;
  --info-bg: #E6F3EC; --warn-bg: #FFF1BF; --success: #0F6B4B; --success-bg: #DFF2E7; --radius: 24px; --radius-sm: 14px;
  --font: 'DM Sans', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
body.theme-green h1, body.theme-green h2, body.theme-green .tile-title, body.theme-green .brand { font-family: 'Space Grotesk', 'DM Sans', system-ui, sans-serif; letter-spacing: -.02em; }
body.theme-green .topbar { background: #FFFFFF; color: #14201A; border-bottom: 1px solid #DDE3DC; position: static; }
body.theme-green .topbar .brand { color: #14201A; }
body.theme-green .topbar .brand-mark { background: #0F6B4B; color: #fff; border-radius: 50%; width: 36px; height: 36px; }
body.theme-green .topbar .btn-ghost { color: #14201A; border-color: #CFD8CF; border-radius: 22px; }
body.theme-green .topbar .btn-ghost:hover { background: #F3F5F1; }
body.theme-green .role-chip { background: #E7ECE6; color: #3A4A41; }
body.theme-green .topnav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px 16px; background: #FFFFFF; border-bottom: 1px solid #DDE3DC; position: sticky; top: 0; z-index: 9; }
body.theme-green .topnav a, body.theme-green .topnav summary { height: 44px; padding: 0 16px; border-radius: 22px; text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; color: #14201A; cursor: pointer; list-style: none; }
body.theme-green .topnav summary::-webkit-details-marker { display: none; }
body.theme-green .topnav a:hover, body.theme-green .topnav summary:hover { background: #EDF1EA; }
body.theme-green .topnav a.on, body.theme-green .topnav summary.on { background: #0F6B4B; color: #FFFFFF; }
body.theme-green .nav-more { position: relative; }
body.theme-green .nav-more-list { position: absolute; right: 0; top: 48px; min-width: 220px; z-index: 20; background: #fff; border: 1px solid #DDE3DC; border-radius: 18px; padding: 6px; box-shadow: 0 8px 24px rgba(20,32,26,.14); display: flex; flex-direction: column; }
body.theme-green .nav-more-list a { height: 44px; border-radius: 12px; }
body.theme-green .btn { border-radius: 22px; }
body.theme-green .btn-primary { background: #0F6B4B; border-color: #0F6B4B; font-weight: 700; }
body.theme-green .btn-primary:hover { background: #0A4D36; }
body.theme-green .card, body.theme-green .tile { border-radius: 24px; }
body.theme-green .tile-icon { background: #E6F3EC; color: #0F6B4B; border-radius: 50%; width: 44px; height: 44px; display: grid; place-items: center; align-self: flex-start; }
body.theme-green a.tile:hover { border-color: #0F6B4B; }
body.theme-green .pill-warn, body.theme-green .soon-badge { background: #FFD23F; color: #14201A; }

/* ═════ New Home ═════ */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin: 0 0 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 3px; }
.kpi-l { font-size: .82rem; color: var(--muted); } .kpi-v { font-size: 1.7rem; line-height: 1.15; } .kpi-s { font-size: .82rem; color: var(--muted); }
.home-two { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 16px; align-items: flex-start; }
.home-two > .card { margin: 0; } .home-attn { flex: 2 1 320px; min-width: 0; } .home-dels { flex: 3 1 440px; min-width: 0; }

/* Merged home: greeting + New sale, a band of live figures, tiles with badges, attention list, today's deliveries */
.home-head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.home-head-row p { margin: 0; }
.home-new { display: inline-flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 26px; border-radius: 14px; background: var(--brand); color: var(--brand-ink); text-decoration: none; font-size: 1.06rem; font-weight: 800; }
.home-new:hover { background: var(--brand-2); color: var(--brand-ink); }
.home-new-plus { display: inline-flex; align-items: center; justify-content: center; }
.kpi-bar { display: block; height: 8px; border-radius: 4px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.kpi-bar i { display: block; height: 100%; border-radius: 4px; background: var(--brand); }
.htiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.htile { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.htile:hover { border-color: var(--brand); }
.htile-body { display: flex; align-items: center; gap: 12px; min-height: 64px; box-sizing: border-box; padding: 10px 14px; text-decoration: none; color: inherit; flex: 1; }
.htile-icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 11px; background: var(--info-bg); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.htile-icon svg { width: 21px; height: 21px; }
.htile-label { flex: 1; min-width: 0; font-weight: 700; line-height: 1.2; }
.htile-flag { min-width: 26px; height: 26px; box-sizing: border-box; padding: 0 8px; border-radius: 8px; font-size: .82rem; font-weight: 800; background: #FBE9D0; color: #7A4300; display: flex; align-items: center; justify-content: center; }
.quick-foot { display: flex; justify-content: flex-end; margin: 6px 0 14px; }
.home-attn h2, .home-dels h2 { margin: 4px 0 10px; }
.attn2 { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 6px 0; border-top: 1px solid var(--border); text-decoration: none; color: inherit; }
.attn-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: var(--muted); }
.attn-warn { background: #B45F06; } .attn-brand { background: var(--brand); }
.attn-txt { flex: 1; min-width: 0; } .attn-txt strong { display: block; } .attn-txt span { display: block; font-size: .85rem; color: var(--muted); }
.attn-chev { color: var(--muted); display: flex; }
.hdel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hdel-head a { font-weight: 700; text-decoration: none; min-height: 44px; display: flex; align-items: center; }
.hdel-scroll { overflow-x: auto; } .hdel-list { min-width: 440px; }
.hdel { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 6px 0; border-top: 1px solid var(--border); }
.hdel-main { flex: 1; min-width: 0; } .hdel-main strong { display: block; } .hdel-main span { display: block; font-size: .85rem; color: var(--muted); }
.hdel-amt { width: 104px; text-align: right; font-weight: 800; }
.hdel-st { width: 100px; flex: 0 0 100px; text-align: center; padding: 4px 0; border-radius: 8px; font-size: .8rem; font-weight: 700; }
.hdel-delivered, .hdel-collected { background: #DDF3EA; color: #0B5C3F; } .hdel-unpaid { background: #FBE9D0; color: #7A4300; }
.hdel-failed { background: #FBE3E1; color: #8A1C14; } .hdel-road { background: #DCEEF8; color: #084F76; } .hdel-planned { background: #E6ECF1; color: #3B4A59; }
/* navy: the first figure is a dark card, the rest white; labels in small capitals */
body.theme-navy .kpis-band .kpi-l { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
body.theme-navy .kpis-band .kpi-hero { background: #0B1F33; border-color: #0B1F33; color: #FFFFFF; }
body.theme-navy .kpis-band .kpi-hero .kpi-l, body.theme-navy .kpis-band .kpi-hero .kpi-s { color: #B4C3D1; }
body.theme-navy .kpis-band .kpi-v { font-weight: 800; letter-spacing: -.02em; }
/* green: one dark band split into four, sales in yellow; round tiles, yellow badges */
body.theme-green .home-new { min-height: 60px; padding: 0 28px 0 8px; border-radius: 30px; gap: 14px; font-size: 1.12rem; font-weight: 700; }
body.theme-green .home-new-plus { width: 44px; height: 44px; border-radius: 50%; background: #FFD23F; color: #14201A; }
body.theme-green .kpis-band { gap: 1px; background: #3A4A41; border-radius: 24px; overflow: hidden; }
body.theme-green .kpis-band .kpi { background: #14201A; color: #FFFFFF; border: 0; border-radius: 0; padding: 18px 22px; }
body.theme-green .kpis-band .kpi-l, body.theme-green .kpis-band .kpi-s { color: #B5C4BA; }
body.theme-green .kpis-band .kpi-v { font-family: 'Space Grotesk', 'DM Sans', system-ui, sans-serif; font-weight: 700; letter-spacing: -.03em; }
body.theme-green .kpis-band .kpi-hero .kpi-v { color: #FFD23F; }
body.theme-green .kpis-band .kpi-bar { background: #3A4A41; } body.theme-green .kpis-band .kpi-bar i { background: #FFD23F; }
body.theme-green .htile { border-radius: 20px; } body.theme-green .htile-icon { border-radius: 50%; width: 44px; height: 44px; flex-basis: 44px; }
body.theme-green .htile-flag { background: #FFD23F; color: #14201A; border-radius: 13px; }
body.theme-green .attn-dot { width: 12px; height: 12px; flex-basis: 12px; } body.theme-green .attn-warn { background: #E0A800; }
body.theme-green .hdel-st { border-radius: 14px; }
body.theme-green .hdel-delivered, body.theme-green .hdel-collected { background: #E6F3EC; color: #0F5A3F; } body.theme-green .hdel-unpaid { background: #FFE9A6; color: #4D3800; }
body.theme-green .hdel-road { background: #14201A; color: #FFFFFF; } body.theme-green .hdel-planned { background: #E7ECE6; color: #3A4A41; }
body.theme-green.mode-dark .hdel-road { background: #FFD23F; color: #14201A; }
body.theme-navy.mode-dark .kpis-band .kpi-hero { background: #17304A; border-color: #24405A; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; margin-top: 8px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar i { display: block; width: 100%; background: var(--brand); border-radius: 6px 6px 0 0; } .bar span { font-size: .7rem; color: var(--muted); }
.attn-row { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-top: 1px solid var(--border); text-decoration: none; color: inherit; min-height: 22px; }
.quick-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.qtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 10px; }
.qtile { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; }
.qtile-body { display: flex; flex-direction: column; gap: 6px; padding: 14px; text-decoration: none; color: inherit; flex: 1; }
.qtile-icon { font-size: 1.5rem; } .qtile-ctl { display: flex; gap: 4px; padding: 0 8px 8px; flex-wrap: wrap; }
.qadd { border-top: 1px dashed var(--border); margin-top: 14px; padding-top: 12px; }

/* ═════ Section tabs (every page of a section shows its tabs) ═════ */
.sectabs { display: flex; flex-wrap: wrap; gap: 2px; margin: 0 0 16px; }
.sectabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; text-decoration: none; font-weight: 600; font-size: .92rem; color: var(--muted); }
body.theme-navy .sectabs { border-bottom: 1px solid var(--border); }
body.theme-navy .sectabs a { border-bottom: 3px solid transparent; margin-bottom: -1px; }
body.theme-navy .sectabs a:hover { color: var(--text); }
body.theme-navy .sectabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
body.theme-green .sectabs { gap: 6px; }
body.theme-green .sectabs a { border-radius: 22px; }
body.theme-green .sectabs a:hover { background: #EDF1EA; }
body.theme-green .sectabs a.on { background: var(--info-bg); color: var(--brand); }
.topbar-new { white-space: nowrap; }
@media (max-width: 700px) { .topbar-new { display: none; } }

/* ═════ Light / dark mode, per user (users.mode: auto follows the phone or PC, light, dark) ═════ */
body { color-scheme: light dark; }
body.mode-light { color-scheme: light; }
body.mode-dark { color-scheme: dark; }
body.mode-light:not(.theme-navy):not(.theme-green):not(.theme-left) {
  --bg:#f2f6f9;--surface:#fff;--surface-2:#e8f1f7;--text:#13222e;--muted:#5b6d7b;--border:#d3dee6;--brand:#0b5f8a;--brand-2:#0e7ab0;--brand-ink:#fff;--success:#1e7a4c;--success-bg:#e3f4ea;--danger:#b3261e;--danger-bg:#fbe9e7;--info-bg:#e6f2fa;--warn-bg:#fff4dc;--shadow:0 1px 2px rgba(16,42,60,.06),0 4px 14px rgba(16,42,60,.06);--series-1:#2a78d6;--c-grid:#e4ebf0;--c-base:#b9c6d0;--delta-good:#1e7a4c;--delta-bad:#b3261e;
}
body.mode-dark:not(.theme-navy):not(.theme-green):not(.theme-left) {
  --bg:#0d1820;--surface:#14232e;--surface-2:#1a2e3b;--text:#e4eef5;--muted:#93a8b7;--border:#274050;--brand:#3aa6dc;--brand-2:#58b8e6;--brand-ink:#06202e;--success:#6fd49f;--success-bg:#173327;--danger:#ff8a80;--danger-bg:#3a1d1b;--info-bg:#16303f;--warn-bg:#3a3017;--shadow:0 1px 2px rgba(0,0,0,.3);--series-1:#3987e5;--c-grid:#22394a;--c-base:#3a5566;--delta-good:#6fd49f;--delta-bad:#ff8a80;
}
body.mode-dark.theme-navy {
  --bg:#0A1622;--surface:#112334;--surface-2:#17304A;--text:#E6EEF5;--muted:#9DB0C2;--border:#24405A;--brand:#3AA6DC;--brand-2:#5BBBE8;--brand-ink:#06202E;--accent:#36B3E0;--success:#6fd49f;--success-bg:#173327;--danger:#ff8a80;--danger-bg:#3a1d1b;--info-bg:#12354D;--warn-bg:#3A3017;--shadow:0 1px 2px rgba(0,0,0,.35);--series-1:#3987e5;--c-grid:#22394a;--c-base:#3a5566;--delta-good:#6fd49f;--delta-bad:#ff8a80;
}
body.mode-dark.theme-green {
  --bg:#0E1612;--surface:#16231C;--surface-2:#1E3026;--text:#E5EFE8;--muted:#9BB0A3;--border:#2B4235;--brand:#3FBF8A;--brand-2:#66D3A5;--brand-ink:#06241A;--accent:#FFD23F;--success:#6fd49f;--success-bg:#173327;--danger:#ff8a80;--danger-bg:#3a1d1b;--info-bg:#17352A;--warn-bg:#3D3512;--shadow:0 1px 2px rgba(0,0,0,.35);--series-1:#3987e5;--c-grid:#22394a;--c-base:#3a5566;--delta-good:#6fd49f;--delta-bad:#ff8a80;
}
@media (prefers-color-scheme: dark) {
  body.mode-auto.theme-navy {
  --bg:#0A1622;--surface:#112334;--surface-2:#17304A;--text:#E6EEF5;--muted:#9DB0C2;--border:#24405A;--brand:#3AA6DC;--brand-2:#5BBBE8;--brand-ink:#06202E;--accent:#36B3E0;--success:#6fd49f;--success-bg:#173327;--danger:#ff8a80;--danger-bg:#3a1d1b;--info-bg:#12354D;--warn-bg:#3A3017;--shadow:0 1px 2px rgba(0,0,0,.35);--series-1:#3987e5;--c-grid:#22394a;--c-base:#3a5566;--delta-good:#6fd49f;--delta-bad:#ff8a80;
}
  body.mode-auto.theme-green {
  --bg:#0E1612;--surface:#16231C;--surface-2:#1E3026;--text:#E5EFE8;--muted:#9BB0A3;--border:#2B4235;--brand:#3FBF8A;--brand-2:#66D3A5;--brand-ink:#06241A;--accent:#FFD23F;--success:#6fd49f;--success-bg:#173327;--danger:#ff8a80;--danger-bg:#3a1d1b;--info-bg:#17352A;--warn-bg:#3D3512;--shadow:0 1px 2px rgba(0,0,0,.35);--series-1:#3987e5;--c-grid:#22394a;--c-base:#3a5566;--delta-good:#6fd49f;--delta-bad:#ff8a80;
}
}
body.mode-dark .pill-warn { color:#f0cf7a; }
body.mode-dark .override { color:#f0cf7a; }
body.mode-dark .variance.over { color:#f0cf7a; }
body.mode-dark .warn-text { color:#f0cf7a; }
body.mode-dark .pill-driver { background:#2c2344;color:#c7b5f2; }
body.mode-dark .pill-manager { background:#16354a;color:#8fd0f2; }
body.mode-dark .pill-viewer { color:#f0cf7a; }
body.mode-dark .tick-wait, body.mode-dark .drv-wait { color:#f1d488; }
@media (prefers-color-scheme: dark) {
body.mode-auto .pill-warn { color:#f0cf7a; }
body.mode-auto .override { color:#f0cf7a; }
body.mode-auto .variance.over { color:#f0cf7a; }
body.mode-auto .warn-text { color:#f0cf7a; }
body.mode-auto .pill-driver { background:#2c2344;color:#c7b5f2; }
body.mode-auto .pill-manager { background:#16354a;color:#8fd0f2; }
body.mode-auto .pill-viewer { color:#f0cf7a; }
body.mode-auto .tick-wait, body.mode-auto .drv-wait { color:#f1d488; }
}
body.mode-dark:not(.theme-navy):not(.theme-green):not(.theme-left) .topbar { background:#0a3a55; }
@media (prefers-color-scheme: dark) { body.mode-auto:not(.theme-navy):not(.theme-green):not(.theme-left) .topbar { background:#0a3a55; } }
body.mode-light:not(.theme-navy):not(.theme-green):not(.theme-left) .topbar { background:var(--brand); }
body.mode-light .pill-warn { color:#7a5a00; }
body.mode-light .override { color:#7a5a00; }
body.mode-light .pill-viewer { color:#7a5a00; }
body.mode-light .pill-manager { background:#dcecf7;color:#0b5f8a; }
body.mode-light .pill-driver { background:#efe6fb;color:#5b3aa7; }

body.mode-dark.theme-navy .sidenav, body.mode-dark.theme-navy .topbar, body.mode-dark.theme-green .topbar, body.mode-dark.theme-green .topnav, body.mode-dark.theme-green .nav-more-list { background: var(--surface); border-color: var(--border); }
body.mode-dark.theme-navy .topbar, body.mode-dark.theme-navy .topbar .brand, body.mode-dark.theme-navy .topbar .btn-ghost, body.mode-dark.theme-green .topbar, body.mode-dark.theme-green .topbar .brand, body.mode-dark.theme-green .topbar .btn-ghost, body.mode-dark.theme-green .topnav a, body.mode-dark.theme-green .topnav summary { color: var(--text); }
body.mode-dark.theme-navy .sidenav { background: #07111B; }
body.mode-dark.theme-navy .sidenav a { color: #B5C5D4; }
body.mode-dark.theme-navy .sidenav a:hover { background: #17324D; color: #fff; }
body.mode-dark.theme-navy .sidenav a.on { background: var(--brand); color: var(--brand-ink); }
body.mode-dark.theme-green .topnav a.on, body.mode-dark.theme-green .topnav summary.on { background: var(--brand); color: var(--brand-ink); }
body.mode-dark.theme-green .topnav a:hover, body.mode-dark.theme-green .topnav summary:hover, body.mode-dark.theme-green .topbar .btn-ghost:hover, body.mode-dark.theme-navy .topbar .btn-ghost:hover { background: var(--surface-2); }
body.mode-dark.theme-navy .topbar .btn-ghost, body.mode-dark.theme-green .topbar .btn-ghost { border-color: var(--border); }
body.mode-dark.theme-navy .topbar .brand-mark { background: var(--brand); color: var(--brand-ink); }
body.mode-dark.theme-green .topbar .brand-mark { background: var(--brand); color: var(--brand-ink); }
body.mode-dark.theme-navy .role-chip, body.mode-dark.theme-green .role-chip { background: var(--surface-2); color: var(--text); }
body.mode-dark.theme-navy .tile-icon, body.mode-dark.theme-green .tile-icon { background: var(--info-bg); }
body.mode-dark.theme-green .btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
body.mode-dark.theme-green .pill-warn, body.mode-dark.theme-green .soon-badge { background: #FFD23F; color: #14201A; }
@media (prefers-color-scheme: dark) {
  body.mode-auto.theme-navy .sidenav, body.mode-auto.theme-navy .topbar, body.mode-auto.theme-green .topbar, body.mode-auto.theme-green .topnav, body.mode-auto.theme-green .nav-more-list { background: var(--surface); border-color: var(--border); }
  body.mode-auto.theme-navy .topbar, body.mode-auto.theme-navy .topbar .brand, body.mode-auto.theme-navy .topbar .btn-ghost, body.mode-auto.theme-green .topbar, body.mode-auto.theme-green .topbar .brand, body.mode-auto.theme-green .topbar .btn-ghost, body.mode-auto.theme-green .topnav a, body.mode-auto.theme-green .topnav summary { color: var(--text); }
  body.mode-auto.theme-navy .sidenav { background: #07111B; }
  body.mode-auto.theme-navy .sidenav a { color: #B5C5D4; }
  body.mode-auto.theme-navy .sidenav a:hover { background: #17324D; color: #fff; }
  body.mode-auto.theme-navy .sidenav a.on { background: var(--brand); color: var(--brand-ink); }
  body.mode-auto.theme-green .topnav a.on, body.mode-auto.theme-green .topnav summary.on { background: var(--brand); color: var(--brand-ink); }
  body.mode-auto.theme-green .topnav a:hover, body.mode-auto.theme-green .topnav summary:hover, body.mode-auto.theme-green .topbar .btn-ghost:hover, body.mode-auto.theme-navy .topbar .btn-ghost:hover { background: var(--surface-2); }
  body.mode-auto.theme-navy .topbar .btn-ghost, body.mode-auto.theme-green .topbar .btn-ghost { border-color: var(--border); }
  body.mode-auto.theme-navy .topbar .brand-mark { background: var(--brand); color: var(--brand-ink); }
  body.mode-auto.theme-green .topbar .brand-mark { background: var(--brand); color: var(--brand-ink); }
  body.mode-auto.theme-navy .role-chip, body.mode-auto.theme-green .role-chip { background: var(--surface-2); color: var(--text); }
  body.mode-auto.theme-navy .tile-icon, body.mode-auto.theme-green .tile-icon { background: var(--info-bg); }
  body.mode-auto.theme-green .btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
  body.mode-auto.theme-green .pill-warn, body.mode-auto.theme-green .soon-badge { background: #FFD23F; color: #14201A; }
  
}
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.detail-grid span { display: block; font-size: .8rem; color: var(--muted); }
body.mode-dark.theme-green .sectabs a:hover { background: var(--surface-2); }
@media (prefers-color-scheme: dark) { body.mode-auto.theme-green .sectabs a:hover { background: var(--surface-2); } }


/* Phone menu: collapsed into one dropdown button */
.navwrap { display: contents; }
.nav-toggle { display: none; }
@media (max-width: 760px) {
  .navwrap { display: block; position: sticky; top: 0; z-index: 20; }
  .nav-toggle { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--border); background: var(--surface, #fff); color: var(--text, #111); font: inherit; font-weight: 700; text-align: left; }
  .nav-toggle span { flex: 1; }
  body.theme-green .navwrap > .topnav, body.theme-navy .navwrap > .sidenav, body.theme-left .navwrap > .sidenav { display: none; }
  body.theme-green .navwrap.open > .topnav, body.theme-navy .navwrap.open > .sidenav, body.theme-left .navwrap.open > .sidenav { display: flex; flex-direction: column; align-items: stretch; position: static; max-height: 70vh; overflow-y: auto; }
  body.theme-navy .navwrap.open > .sidenav .nav-group, body.theme-left .navwrap.open > .sidenav .nav-group { flex-direction: column; align-items: stretch; }
  body.theme-navy .navwrap.open > .sidenav .nav-title, body.theme-left .navwrap.open > .sidenav .nav-title { display: block; }
  body.theme-green .navwrap.open > .topnav .nav-more { display: contents; }
  body.theme-green .navwrap.open > .topnav .nav-more > summary { display: none; }
  body.theme-green .navwrap.open > .topnav .nav-more-list { display: flex; flex-direction: column; position: static; box-shadow: none; border: 0; padding: 0; }
  .sectabs { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; }
}

/* ═════ Driver phone screen (driver.php) — laid out like the design mockup ═════
   Full screen, no menus: a dark band at the top, cards, and a tab bar fixed along the bottom. Colours follow the person's look. */
body.drv-app { --drv-head: #0b3a55; --drv-bar: #36B3E0; background: var(--bg); }
body.drv-app.theme-navy { --drv-head: #0B1F33; --drv-bar: #36B3E0; }
body.drv-app.theme-green { --drv-head: #0F6B4B; --drv-bar: #FFD23F; }
body.drv-app.mode-dark.theme-navy { --drv-head: #06111C; }
body.drv-app.mode-dark.theme-green { --drv-head: #0A3D2B; }
body.drv-app .wrap { max-width: 560px; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
body.drv-app .card { padding: 16px; margin: 0 0 12px; box-shadow: none; }
body.drv-app .btn { min-height: 52px; border-radius: 12px; font-weight: 600; gap: 8px; }
body.drv-app.theme-green .btn { border-radius: 999px; }
body.drv-app .btn-sm { min-height: 40px; }
body.drv-app .btn-lg { min-height: 60px; font-size: 18px; }
body.drv-app .btn-block, body.drv-app #drv > .btn { width: 100%; margin: 0 0 12px; }
body.drv-app .flash, body.drv-app .drv-bar { margin: 0 0 12px; }

.drv-top { background: var(--drv-head); color: #fff; margin: 0 -16px 14px; padding: calc(14px + env(safe-area-inset-top)) 16px 12px; }
.drv-back { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; margin-bottom: 4px; color: #fff; font-size: 14px; text-decoration: none; }
.drv-top-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.drv-kicker { font-size: 12px; opacity: .8; }
.drv-top .drv-title { font-size: 20px; font-weight: 700; line-height: 1.25; margin: 0; }
.drv-net { flex: 0 0 auto; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: rgba(255,255,255,.18); white-space: nowrap; }
.drv-net[data-state="offline"] { background: #b3261e; }
.drv-net[data-state="waiting"] { background: #FFD23F; color: #14201A; }
.drv-prog { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; font-weight: 600; }
.drv-top .drv-pbar { flex: 1; height: 8px; margin: 0; border-radius: 99px; background: rgba(255,255,255,.25); }
.drv-top .drv-pbar i { background: var(--drv-bar); }

/* Next stop */
body.drv-app .stop-card { display: block; }
body.drv-app .stop-next { border: 2px solid var(--brand); }
.stop-pills { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
body.drv-app .pill { font-size: 12px; font-weight: 600; padding: 2px 10px; margin: 0; }
body.drv-app .pill-next { background: var(--info-bg); color: var(--brand-2); display: inline-block; }
body.drv-app.theme-navy .pill-next { color: #084F76; }
body.drv-app .pill-free { background: #fbe9d0; color: #8a4a00; }
body.drv-app.theme-green .pill-free { background: #FFD23F; color: #14201A; }
body.drv-app .stop-name { font-size: 22px; font-weight: 700; margin: 8px 0 0; }
body.drv-app .stop-addr { font-size: 14px; color: var(--muted); margin-top: 2px; }
body.drv-app .stop-items { list-style: none; margin: 12px 0 0; padding: 0; font-size: 17px; line-height: 1.5; }
body.drv-app .stop-note { background: none; padding: 0; margin-top: 6px; font-size: 13px; color: var(--muted); }
.stop-meta { margin-top: 6px; font-size: 13px; color: var(--muted); }
.stop-collect-what { margin-top: 10px; }
body.drv-app .stop-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
body.drv-app .stop-actions .btn-primary { flex: 1; }
body.drv-app .stop-collect { border-left-width: 2px; }
body.drv-app .ib { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; color: var(--brand); text-decoration: none; font: inherit; cursor: pointer; padding: 0; }

/* Lists: still to go, done, more */
body.drv-app .drv-still, body.drv-app .drv-donebox { padding: 0; overflow: hidden; }
body.drv-app .drv-still-head, body.drv-app .drv-donebox summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; list-style: none; }
body.drv-app .drv-donebox summary::-webkit-details-marker { display: none; }
body.drv-app .drv-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 44px; border-top: 1px solid var(--border); color: inherit; text-decoration: none; }
body.drv-app .drv-row > span:nth-child(2), body.drv-app .drv-more .drv-row > span:first-child { flex: 1; }
body.drv-app .drv-row .n { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; background: var(--info-bg); color: var(--brand-2); font-weight: 700; font-size: 15px; }
body.drv-app.theme-navy .drv-row .n { color: #084F76; }
body.drv-app .drv-chev { color: var(--muted); font-size: 1.4rem; }
body.drv-app .drv-recent-box { padding: 0 12px 12px; margin: 0; }
body.drv-app .drv-row .n-ok { background: var(--success-bg); color: var(--success); }
body.drv-app .drv-row .n-bad { background: var(--danger-bg); color: var(--danger); }
.drv-doneline .pill { margin-left: 4px; }
.drv-showhide::after { content: 'Show ▾'; }
.drv-donebox[open] .drv-showhide::after { content: 'Hide ▴'; }
.drv-donehint { margin: 0; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.drv-fixhint { margin: -6px 0 12px; font-size: 13px; color: var(--muted); text-align: center; }

/* Take / collect a payment */
.drv-payform .card { display: grid; gap: 14px; }
.drv-lbl { display: grid; gap: 6px; font-size: 14px; font-weight: 500; color: var(--muted); }
.drv-lbl .input { color: var(--text); }
.drv-fs { border: 0; margin: 0; padding: 0; min-width: 0; }
.drv-fs legend { padding: 0; margin-bottom: 6px; }
body.drv-app .drv-methods { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; }
body.drv-app .drv-methods .pay-m { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; min-height: 72px; padding: 10px 6px; border-radius: 14px; font-size: 1rem; color: var(--text); }
body.drv-app .drv-payform select.input { min-height: 56px; font-size: 18px; font-weight: 600; }
body.drv-app .drv-payform input[type="search"].input { min-height: 56px; font-size: 18px; font-weight: 600; }
.drv-results { display: grid; gap: 6px; }
.drv-results:empty { display: none; }
.drv-result { min-height: 48px; padding: 0 14px; text-align: left; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }
.drv-result:hover, .drv-result:focus-visible { border-color: var(--brand); background: var(--info-bg); }
.drv-results-hint { margin: 0; font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
body.drv-app .drv-methods .pay-m span { font-size: 15px; font-weight: 600; }
body.drv-app .drv-methods .pay-m svg { color: var(--brand); }
body.drv-app .drv-methods .pay-m.on { border-color: var(--brand); background: var(--info-bg); color: var(--brand-2); }
.drv-money { position: relative; display: block; }
.drv-money > span { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 26px; font-weight: 700; color: var(--text); pointer-events: none; }
body.drv-app .drv-money .input-xl { padding-left: 40px; text-align: left; letter-spacing: 0; font-size: 26px; font-weight: 700; }
.drv-load { padding: 14px 16px; border-top: 1px solid var(--border); background: var(--info-bg); }
.drv-maplink { color: var(--brand) !important; }
body.drv-app .drv-change { display: grid; gap: 4px; border: 2px dashed var(--brand); color: inherit; text-decoration: none; }
body.drv-app .drv-change .btn { margin-top: 6px; min-height: 44px; }
body.drv-app .drv-banner { background: var(--info-bg); color: var(--brand-2); border: 0; border-radius: var(--radius); padding: 12px 16px; font-weight: 600; margin: 0 0 12px; }

/* Done / delivered */
body.drv-app .drv-done { text-align: center; padding: 24px 16px; }
body.drv-app .drv-done .done-tick { width: 72px; height: 72px; margin: 0 auto; }
body.drv-app .drv-done h2, .drv-done-h { font-size: 22px; font-weight: 700; margin: 12px 0 0; }
.drv-amt { font-size: 30px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
body.drv-app .drv-done .muted { margin: 4px 0 0; }
body.drv-app .drv-failed .drv-done-h { margin-top: 0; color: var(--danger); }
.drv-card-h { font-weight: 700; font-size: 16px; margin: 0 0 10px; }
.drv-card-h .muted { float: right; font-weight: 500; }
.drv-amount { display: grid; gap: 4px; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
.pay-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pay-tile { min-height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 2px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.pay-tile:hover, .pay-tile:focus-visible { border-color: var(--brand); background: var(--info-bg); color: var(--brand-2); }
.drv-paid { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; }
.drv-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 12px; }
body.drv-app .btn-wa-text { color: #0b6a41; }
.drv-book { margin: 0 0 12px; }
.drv-book .btn { position: relative; margin: 0; }
.drv-book p { margin: 6px 0 0; text-align: center; }
.drv-nextline { font-size: 14px; color: var(--muted); }
.drv-nextline strong { color: var(--text); }
.drv-alldone { text-align: center; }
body.drv-app .drv-alldone .done-tick { width: 72px; height: 72px; margin: 0 auto 10px; }

/* Deliver a stop */
body.drv-app .drv-list { padding: 12px 16px; }
.qty-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 0; border-top: 1px solid var(--border); }
.stepper { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
body.drv-app .stepper .ib { flex-basis: 48px; width: 48px; height: 48px; font-size: 24px; color: var(--text); }
.stepper-in.input { width: 58px; min-height: 48px; padding: 0 2px; text-align: center; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
body.drv-app .free-box { background: var(--info-bg); color: var(--text); margin: 0 -16px; border-radius: 0; padding: 12px 16px; }
body.drv-app .tot-big { padding-top: 12px; font-weight: 700; font-size: 18px; }
body.drv-app .sticky-actions { padding: 0; background: none; position: static; margin: 0 0 12px; }
.drv-notdeliv { margin: 0 0 12px; }
.drv-notdeliv > summary { list-style: none; color: var(--danger); font-size: 15px; }
.drv-notdeliv > summary::-webkit-details-marker { display: none; }
.drv-notdeliv[open] > summary { margin-bottom: 12px; }
.drv-notdeliv form { display: grid; gap: 10px; }
.drv-hint { font-size: 13px; color: var(--muted); text-align: center; margin: 0 0 12px; }

/* Office messages */
body.drv-app .drv-chat { gap: 10px; margin: 0 0 12px; }
body.drv-app .drv-bub { max-width: 85%; padding: 10px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
body.drv-app .drv-bub.me { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
body.drv-app .drv-bub.me a { color: inherit; }
.drv-bub-at { font-size: 11px; opacity: .75; margin-top: 4px; }
.drv-bub-photo { display: inline-flex; align-items: center; gap: 4px; }
body.drv-app .drv-bub-who { display: none; }
.drv-gotit { min-height: 44px !important; margin: 0 0 12px; }
.drv-noteform { display: grid; gap: 10px; }
.drv-noteform .btn { position: relative; margin: 0; }

/* Tabs along the bottom */
body.drv-app .drv-tabbar { position: fixed; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; display: flex; gap: 0; padding: 0 0 calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); z-index: 20; }
body.drv-app .drv-tabbar a { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; min-height: 44px; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; }
body.drv-app .drv-tabbar a.on { color: var(--brand); }
body.drv-app .drv-dot { position: absolute; top: 4px; right: 26%; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; border-radius: 99px; background: #b3261e; color: #fff; font-size: 11px; }
@media print { .drv-top, .drv-tabbar { display: none !important; } }
/* On a PC or tablet: the header and tabs run the full width of the screen; the stops stay in a centred column */
@media (min-width: 600px) {
  body.drv-app { overflow-x: clip; }
  body.drv-app .wrap { max-width: 640px; }
  body.drv-app .drv-top { margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); padding-left: calc(50vw - 50%); padding-right: calc(50vw - 50%); }
  body.drv-app .drv-tabbar { max-width: none; justify-content: center; }
  body.drv-app .drv-tabbar a { flex: 0 1 200px; }
}
@media (prefers-color-scheme: dark) {
  body.theme-green.mode-auto .hdel-road { background: #FFD23F; color: #14201A; }
  body.theme-navy.mode-auto .kpis-band .kpi-hero { background: #17304A; border-color: #24405A; }
}
@media (max-width: 600px) {
  /* phones: figures two by two, tiles two across, each delivery's amount and status on its own line */
  .kpis-band { grid-template-columns: 1fr 1fr; gap: 10px; }
  body.theme-green .kpis-band { gap: 1px; }
  .kpis-band .kpi { padding: 14px; } .kpis-band .kpi-v { font-size: 1.3rem; }
  .htiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .htile-body { gap: 8px; padding: 8px 10px; } .htile-label { font-size: .92rem; }
  .htile-icon, body.theme-green .htile-icon { width: 36px; height: 36px; flex-basis: 36px; }
  .hdel-list { min-width: 0; } .hdel { flex-wrap: wrap; row-gap: 4px; padding: 10px 0; }
  .hdel-main { flex-basis: 100%; } .hdel-amt { width: auto; text-align: left; flex: 1; }
  .home-new { width: 100%; justify-content: center; }
}
.home-chart .bars { height: 150px; }
.bar i { min-height: 2px; }
a.kpi-link { text-decoration: none; color: inherit; } a.kpi-link:hover .kpi-s { text-decoration: underline; }
.kpis-band { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpis-band .kpi-v { font-size: 1.55rem; }
.drv-top-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.drv-logout { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 0 12px; border-radius: 99px; border: 1px solid rgba(255,255,255,.45); color: #fff; font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.drv-logout:hover { background: rgba(255,255,255,.12); color: #fff; }

/* Redesign: simple Home tiles and the Admin page */
.home-big { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 760px; margin: 0 0 18px; }
.home-big-tile { min-height: 190px; box-sizing: border-box; padding: 20px; border-radius: 18px; background: var(--surface, #fff); border: 1px solid var(--border, #DFE5EA); color: inherit; text-decoration: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.home-big-tile:hover { border-color: var(--brand, #0B6FA4); }
.hb-ico { width: 72px; height: 72px; border-radius: 36px; background: var(--info-bg, #E3EFF7); color: var(--brand, #0B6FA4); display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.hb-ico svg { width: 36px; height: 36px; }
.hb-title { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.hb-sub { font-size: 14.5px; color: var(--muted, #51606F); }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; max-width: 980px; }
.admin-card { display: flex; align-items: center; gap: 14px; min-height: 84px; padding: 14px 18px; border-radius: 16px; background: var(--surface, #fff); border: 1px solid var(--border, #DFE5EA); color: inherit; text-decoration: none; }
.admin-card:hover { border-color: var(--brand, #0B6FA4); }
.admin-ico { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px; background: var(--info-bg, #E3EFF7); color: var(--brand, #0B6FA4); display: flex; align-items: center; justify-content: center; }
.admin-txt { display: flex; flex-direction: column; min-width: 0; }
.admin-txt strong { font-size: 16.5px; }
.admin-txt span { font-size: 13.5px; color: var(--muted, #51606F); }
body.theme-navy .sidenav .nav-group a[href="admin.php"] { margin-top: 18px; }
@media (max-width: 560px) { .home-big { grid-template-columns: 1fr; } .home-big-tile { min-height: 140px; } }

/* Deliveries overview */
.page-head .spacer { flex: 1; }
.ov-grid { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.ov-list { flex: 3 1 460px; min-width: 0; }
.ov-unpaid { flex: 2 1 340px; min-width: 0; }
.ov-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.ov-tab { min-height: 44px; padding: 0 18px; border-radius: 24px; border: 1.5px solid var(--border, #D5DDE4); display: inline-flex; align-items: center; gap: 6px; font-weight: 700; text-decoration: none; color: inherit; }
.ov-tab span { opacity: .75; font-weight: 600; }
.ov-tab.on { background: var(--brand, #0B1F33); border-color: var(--brand, #0B1F33); color: #fff; }
.ov-none { padding: 24px 0; text-align: center; }
.ov-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; min-height: 68px; padding: 8px 0; border-top: 1px solid var(--border, #EDF1F4); }
.ov-main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.ov-when { flex: 0 0 150px; color: var(--muted, #3B4A59); }
.ov-amt { flex: 0 0 96px; text-align: right; font-weight: 800; }
.ov-open { font-weight: 700; font-size: .85rem; }
.ov-wide { margin-top: 10px; width: 100%; justify-content: center; }
.st { flex: 0 0 120px; text-align: center; padding: 4px 0; border-radius: 8px; font-size: 12.5px; font-weight: 700; background: #E6ECF1; color: #3B4A59; }
.st-road { background: #DCEEF8; color: #084F76; } .st-trip { background: #E4EEF5; color: #0B1F33; } .st-free, .st-unpaid { background: #FBE9D0; color: #7A4300; }
.st-done { background: #DDF3EA; color: #0B5C3F; } .st-plan { background: #E6ECF1; color: #3B4A59; } .st-fail { background: #FBE3E1; color: #8C1D18; }
.ov-uh { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ov-uh h2 { margin: 0; }
.warn-text { font-size: 15px; color: #B26A00; }
.ov-cust { border-top: 1px solid var(--border, #EDF1F4); }
.ov-cust > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; cursor: pointer; list-style: none; }
.ov-cust > summary::-webkit-details-marker { display: none; }
.ov-cn { display: flex; flex-direction: column; min-width: 0; }
.ov-form { display: flex; flex-direction: column; gap: 6px; padding: 0 0 12px 8px; }
.ov-inv { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.ov-inv span { flex: 1; min-width: 0; }

/* Create a delivery */
.dn-title { margin: 0 0 12px; }
.dn-grid { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.dn-left { flex: 3 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.dn-sec h2, .dn-sum h2 { margin: 0 0 8px; font-size: 16px; }
.dn-sum { flex: 2 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.dn-chosen { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; background: var(--surface-2, #F2F5F7); border: 1px solid var(--border, #DFE5EA); }
.dn-chosen-t { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.dn-list { border: 1px solid var(--border, #DFE5EA); border-radius: 12px; overflow: hidden; margin-top: 8px; max-height: 340px; overflow-y: auto; }
.dn-row { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px 12px; border: 0; border-top: 1px solid var(--border, #EDF1F4); background: transparent; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.dn-row:first-child { border-top: 0; }
.dn-row > span:not(.dn-tick) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dn-row.on { background: var(--surface-2, #F2F5F7); }
.dn-tick { min-width: 30px; font-weight: 800; color: var(--brand, #0B6FA4); }
.dn-none { padding: 14px; text-align: center; }
.dn-plabel { margin: 10px 0 0; font-weight: 700; }
.dn-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.chip { height: 44px; padding: 0 18px; border-radius: 22px; font-size: 15px; font-weight: 700; border: 1.5px solid var(--border, #D5DDE4); background: transparent; color: inherit; cursor: pointer; }
.chip.on { background: var(--brand, #0B1F33); border-color: var(--brand, #0B1F33); color: #fff; }
.dn-date { max-width: 260px; }
.dn-line { padding: 6px 0; border-bottom: 1px solid var(--border, #EDF1F4); }
.dn-l1 { display: flex; align-items: center; gap: 8px; }
.dn-l1 strong:first-child { flex: 1; min-width: 0; }
.dn-x { width: 44px; height: 44px; border: 0; background: transparent; font-size: 20px; color: inherit; cursor: pointer; }
.dn-l2 { display: flex; align-items: center; gap: 10px; }
.dn-step { display: inline-flex; align-items: center; border: 1px solid var(--border, #D5DDE4); border-radius: 10px; height: 44px; }
.dn-step button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 20px; color: inherit; cursor: pointer; }
.dn-step b { min-width: 34px; text-align: center; }
.dn-disc { margin-left: auto; height: 44px; padding: 0 10px; border: 0; background: transparent; font-size: 13.5px; font-weight: 700; color: var(--brand, #0B6FA4); cursor: pointer; }
.dn-l3 { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 4px 0; }
.dn-l3 .chip { height: 44px; padding: 0 14px; font-size: 14px; }
.dn-dv { width: 110px; }
.dn-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; border-top: 1px solid var(--border, #DFE5EA); }
.dn-total strong { font-size: 26px; }
.dn-paynote { font-weight: 700; padding: 10px 12px; border-radius: 10px; background: var(--surface-2, #F2F5F7); }
.dn-fold > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 8px; }
.dn-pays { display: grid; gap: 8px; margin-top: 8px; }
.dn-pay { min-height: 48px; padding: 6px 14px; border-radius: 12px; text-align: left; border: 2px solid var(--border, #DFE5EA); background: transparent; color: inherit; display: flex; flex-direction: column; cursor: pointer; font: inherit; }
.dn-pay.on { border-color: var(--brand, #0B1F33); background: var(--surface-2, #F2F5F7); }

/* Drivers and trips */
.pl-stops { flex: 2 1 380px; min-width: 0; }
.pl-trips { flex: 3 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.pl-driver { height: auto; min-height: 52px; padding: 6px 18px; border-radius: 14px; display: inline-flex; flex-direction: column; align-items: flex-start; justify-content: center; text-decoration: none; }
.pl-driver span { font-weight: 600; font-size: 12.5px; opacity: .8; }
.pl-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.pl-opts .chip { min-width: 72px; height: 40px; padding: 0 12px; font-size: 14px; }
.pl-stop { display: flex; align-items: center; gap: 12px; min-height: 52px; border-top: 1px solid var(--border, #EDF1F4); }
.pl-n { width: 28px; height: 28px; border-radius: 14px; background: var(--brand, #0B1F33); color: #fff; font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; flex: 0 0 28px; }
.pl-mv { display: flex; gap: 2px; }
.pl-note { margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2, #F2F5F7); font-size: 13.5px; }
.pl-note.ok { background: #DDF3EA; color: #0B5C3F; }
a.chip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: inherit; }
a.chip.on { color: #fff; }

/* On the road */
.rd-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0 0 16px; }
.rd-tile { background: var(--surface, #fff); border: 1px solid var(--border, #DFE5EA); border-radius: 14px; padding: 14px 16px; }
.rd-tile span { display: block; font-size: 13px; font-weight: 700; color: var(--muted, #51606F); }
.rd-tile strong { font-size: 24px; font-weight: 800; }
.rd-trips { flex: 3 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.rd-side { flex: 2 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.rd-alert { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-top: 1px solid var(--border, #EDF1F4); }

/* Driver phone: the redesign (light, navy header, white cards) whatever the phone's dark/light setting */
body.drv-app, body.drv-app.mode-auto, body.drv-app.mode-dark, body.drv-app.mode-light {
  --bg: #F2F5F7 !important; --surface: #FFFFFF !important; --surface-2: #E6ECF1 !important; --text: #0B1F33 !important; --muted: #51606F !important; --border: #DFE5EA !important;
  --brand: #0B6FA4 !important; --brand-2: #0B6FA4 !important; --brand-ink: #FFFFFF !important; --accent: #0B6FA4 !important;
  --info-bg: #DCEEF8 !important; --success: #0B5C3F !important; --success-bg: #DDF3EA !important; --danger: #B3261E !important; --danger-bg: #FBE3E1 !important; --warn-bg: #FBE9D0 !important;
  background: #F2F5F7 !important; color: #0B1F33 !important; font-family: Figtree, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-variant-numeric: tabular-nums;
}
body.drv-app .drv-top { background: #0B1F33; color: #fff; margin: 0 -16px 14px; padding: 16px 16px 12px; border-radius: 0; }
body.drv-app .drv-kicker { font-size: 13px; color: #B4C3D1; }
body.drv-app .drv-title { font-size: 22px; font-weight: 800; color: #fff; }
.drv-top .drv-me { display: inline-block; color: inherit; text-decoration: none; background: rgba(255,255,255,.16); border-radius: 999px; padding: 1px 10px; font-weight: 700; line-height: 1.5; }   /* the driver's name: looks like a button, opens "My phone" */
.drv-top .drv-me span { opacity: .8; }
body.drv-app .drv-top .drv-back, body.drv-app .drv-logout { color: #DCEEF8; border-color: #35516B; background: transparent; }
body.drv-app .drv-net { background: #1E3A52; color: #DCEEF8; border-radius: 10px; font-weight: 700; font-size: 12.5px; padding: 3px 10px; }
body.drv-app .drv-net[data-state="offline"], body.drv-app .drv-net[data-state="waiting"] { background: #FBE9D0; color: #7A4300; }
body.drv-app .drv-pbar { background: #1E3A52; }
body.drv-app .drv-pbar i { background: #4FB3E8; }
body.drv-app .drv-prog span { color: #DCEEF8; }
body.drv-app .card, body.drv-app .stop-card { background: #fff; border: 1px solid #DFE5EA; border-radius: 14px; box-shadow: none; }
body.drv-app .stop-next { border: 2px solid #0B6FA4; }
body.drv-app .pill-next { background: #DCEEF8; color: #084F76; }
body.drv-app .stop-name { font-size: 17px; font-weight: 800; }
body.drv-app .stop-actions { grid-template-columns: auto 1fr 1fr; }
body.drv-app .stop-actions:not(:has(.ib)) { grid-template-columns: 1fr 1fr; }
body.drv-app .stop-actions .btn-lg { min-height: 52px; border-radius: 12px; font-weight: 800; justify-content: center; }
body.drv-app .btn { background: #fff; color: #0B1F33; border: 1px solid #D5DDE4; border-radius: 12px; font-weight: 700; }
body.drv-app .btn-primary { background: #0B6FA4; border-color: #0B6FA4; color: #fff; font-weight: 800; }
body.drv-app .btn-danger { background: #B3261E; border-color: #B3261E; color: #fff; }
body.drv-app .input { background: #fff; border: 1px solid #D5DDE4; color: #0B1F33; border-radius: 11px; }
body.drv-app .drv-tabbar { background: #fff; border-top: 1px solid #DFE5EA; }
body.drv-app .drv-tabbar a { color: #51606F; font-size: 13px; font-weight: 700; }
body.drv-app .drv-tabbar a.on { color: #0B6FA4; }
body.drv-app .drv-row .n { background: #0B1F33; color: #fff; }
body.drv-app .drv-row .n-ok { background: #0B5C3F; }
body.drv-app .muted, body.drv-app .small.muted { color: #51606F; }
body.drv-app #done-card { display: grid; grid-template-columns: 56px 1fr; column-gap: 14px; align-items: center; text-align: left; padding: 14px 16px; }
body.drv-app #done-card .done-tick { grid-row: 1 / span 3; width: 56px; height: 56px; margin: 0; font-size: 1.6rem; background: #DDF3EA; color: #0B5C3F; }
body.drv-app #done-card .done-tick svg { width: 28px; height: 28px; }
body.drv-app #done-card .drv-done-h { font-size: 20px; font-weight: 800; }
body.drv-app #done-card .drv-amt { font-size: 18px; font-weight: 800; }

body.drv-app .drv-quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
body.drv-app .drv-quick .chip { height: 40px; padding: 0 14px; font-size: 14px; background: #fff; border: 1.5px solid #D5DDE4; color: #0B1F33; }
body.drv-app .drv-noteform { display: flex; gap: 8px; align-items: center; }
body.drv-app .drv-noteform .input { flex: 1; min-width: 0; height: 48px; }
body.drv-app .drv-photo-btn { width: 48px; min-width: 48px; height: 48px; padding: 0; justify-content: center; }
body.drv-app .drv-noteform .btn-primary { height: 48px; padding: 0 20px; }

body.drv-app .drv-noteform { margin: 0 0 14px; }

/* Master and detail pages: Customers, Items, Price lists, Driver chat */
.md-grid { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.md-list { flex: 2 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.md-detail { flex: 3 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.md-search { display: flex; gap: 8px; align-items: center; }
.md-search .input { flex: 1; min-width: 0; }
.md-row { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--border, #DFE5EA); color: inherit; text-decoration: none; }
.md-row:hover { border-color: var(--brand, #0B6FA4); }
.md-row.on { border-color: var(--brand, #0B1F33); border-width: 2px; background: var(--surface-2, #F2F5F7); }
.md-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.md-none { padding: 22px 0; text-align: center; }
.tag { font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 8px; white-space: nowrap; }
.tag-warn { background: #FBE9D0; color: #7A4300; } .tag-neutral { background: #E6ECF1; color: #3B4A59; }
.md-form { display: flex; flex-direction: column; gap: 12px; }
.md-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; }
.md-form label.chip { flex-direction: row; font-size: 15px; align-items: center; }
.md-kv { display: flex; flex-direction: column; gap: 2px; }
.md-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.md-box { border: 1px solid var(--border, #DFE5EA); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; }
.md-box strong { font-size: 18px; }
.md-stock { display: flex; justify-content: space-between; padding: 10px 14px; border-radius: 10px; background: var(--surface-2, #F2F5F7); }
.pl-table { display: flex; flex-direction: column; }
.pl-th, .pl-tr { display: grid; grid-template-columns: 1.6fr .8fr 1fr; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border, #EDF1F4); }
.pl-th { font-size: 12px; font-weight: 700; color: var(--muted, #51606F); border-top: 0; }
.pl-tr .input { height: 40px; text-align: right; }
.chat-grid .md-list { max-height: 70vh; overflow-y: auto; }
.chat-pane .chat-thread { max-height: 52vh; overflow-y: auto; }
.chat-pane .drv-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-pane .drv-quick .chip { height: 40px; padding: 0 14px; font-size: 14px; }
.chat-pane .chat-compose { position: static; }

/* The ⋯ menu on a stop */
.ov-more { position: relative; }
.ov-more > summary { list-style: none; cursor: pointer; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--border, #D5DDE4); font-weight: 800; font-size: 18px; }
.ov-more > summary::-webkit-details-marker { display: none; }
.ov-menu { position: absolute; right: 0; top: 44px; z-index: 30; min-width: 220px; display: flex; flex-direction: column; padding: 6px; border-radius: 12px; background: var(--surface, #fff); border: 1px solid var(--border, #DFE5EA); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.ov-menu form { display: block; }
.ov-act { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: inherit; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.ov-act:hover { background: var(--surface-2, #F2F5F7); }

/* Overview rows: name and items on the left; status, amount and menu on one line */
.ov-row { flex-wrap: nowrap; }
.ov-row .st { flex: 0 0 auto; min-width: 96px; padding: 4px 10px; }
.ov-amt { flex: 0 0 auto; min-width: 84px; }
@media (max-width: 560px) { .ov-row { flex-wrap: wrap; } .ov-row .ov-main { flex: 1 1 100%; } .ov-amt { margin-left: auto; } }

/* Phones: list first, detail once something is chosen */
.md-back { display: none; font-weight: 700; text-decoration: none; }
@media (max-width: 760px) {
  .md-grid.has-sel .md-list { display: none; }
  .md-grid:not(.has-sel) .md-detail { display: none; }
  .md-back { display: inline-block; margin: 0 0 4px; }
  .md-grid { gap: 12px; }
}

/* Secondary menu: pills in a card on computers, one drop-down on phones */
.sectabs-m { display: none; }
.sectabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; padding: 6px; background: var(--surface, #fff); border: 1px solid var(--border, #DFE5EA); border-radius: 14px; }
body.theme-navy .sectabs, body.theme-green .sectabs { border-bottom: 1px solid var(--border, #DFE5EA); }
.sectabs a, body.theme-navy .sectabs a, body.theme-green .sectabs a { min-height: 40px; padding: 0 14px; border: 0; margin: 0; border-radius: 10px; font-weight: 700; font-size: .9rem; color: var(--muted, #51606F); }
.sectabs a:hover, body.theme-navy .sectabs a:hover, body.theme-green .sectabs a:hover { background: var(--surface-2, #F2F5F7); color: var(--text, #0B1F33); }
.sectabs a.on, body.theme-navy .sectabs a.on, body.theme-green .sectabs a.on { background: var(--brand, #0B6FA4); color: #fff; }
@media (max-width: 760px) {
  .sectabs, body.theme-navy .sectabs, body.theme-green .sectabs { display: none; }
  .sectabs-m { display: block; margin: 0 0 14px; }
  .sectabs-m-t { display: block; font-size: 12px; font-weight: 700; color: var(--muted, #51606F); margin: 0 0 4px; }
  .sectabs-select { width: 100%; height: 48px; padding: 0 40px 0 14px; border-radius: 12px; border: 1px solid var(--border-strong, #C5D0D8); background: var(--surface, #fff); color: var(--text, #0B1F33); font: inherit; font-size: 16px; font-weight: 700; appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2351606F' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6l6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
}

.ov-amtrow { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.ov-amtrow .input { flex: 1; min-width: 0; text-align: right; }
.ov-form select.input { width: 100%; }

.dn-donewrap { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2, #F2F5F7); }

.pl-x { font-size: 16px; min-width: 40px; height: 40px; }

.pl-send { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border, #EDF1F4); }

/* Book number under the book photo: plain small grey text like the line above it; the box only shows when opened */
body.drv-app .drv-bookno { margin: 0; border: 0; background: transparent; }
body.drv-app .drv-bookno > summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; padding: 0; font-size: .85rem; font-weight: 400; color: var(--muted, #51606F); }
body.drv-app .drv-bookno > summary::marker { color: var(--muted, #51606F); }
body.drv-app .drv-bookno-row { display: flex; gap: 8px; margin-top: 6px; }
body.drv-app .drv-bookno-row .input { flex: 1; min-width: 0; height: 44px; }
body.drv-app .drv-bookno-row .btn { height: 44px; padding: 0 16px; }

.dn-step .dn-qty { width: 56px; height: 36px; text-align: center; padding: 0 4px; font-weight: 700; }

.edit-lines .el-desc { margin-top: 6px; font-size: 13px; }
.edit-lines .el-disc { width: 70px; }

.dn-l3 .dn-desc { flex: 1 1 100%; width: 100%; margin-bottom: 6px; }

.pl-driverblock { margin-top: 18px; padding-top: 6px; border-top: 2px solid var(--border, #DFE5EA); }
.pl-dh { margin: 0; font-size: 20px; }
.pl-delivered > summary { cursor: pointer; padding: 4px 0; }
.pl-delivered[open] > summary { margin-bottom: 8px; }
.pl-driverblock .card { margin-top: 10px; }

/* Deliveries and Drivers & trips: compact, neat rows */
.ov-tabs { gap: 6px; margin-bottom: 6px; }
.ov-tab { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 18px; }
.ov-row { min-height: 0; padding: 6px 0; gap: 4px 10px; }
.ov-main strong { font-size: 14.5px; line-height: 1.25; }
.ov-main .small { font-size: 12.5px; line-height: 1.3; }
.ov-main > .muted.small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ov-row .st { min-width: 0; padding: 2px 8px; font-size: 11.5px; border-radius: 6px; white-space: nowrap; }
.ov-amt { min-width: 0; font-size: 14px; white-space: nowrap; }
.ov-more > summary { width: 32px; height: 32px; font-size: 16px; border-radius: 8px; }
.ov-menu { top: 36px; }
.pl-opts { gap: 4px; }
.pl-opts .chip { min-width: 0; height: 30px; padding: 0 10px; font-size: 13px; }
.pl-stop { min-height: 0; padding: 5px 0; gap: 8px; }
.pl-n { width: 22px; height: 22px; flex-basis: 22px; font-size: 12px; }
.pl-x { min-width: 32px; height: 32px; font-size: 14px; }
.pl-trips { gap: 10px; }
.plan-trip h2, .pl-driverblock h3 { font-size: 16px; margin: 0 0 6px; }
.dn-chips .chip, .pl-driver { min-height: 40px; }
.pl-driver { padding: 4px 14px; }
@media (max-width: 640px) {
  .ov-row { flex-wrap: wrap; }
  .pl-stops .ov-row .ov-main { flex: 1 1 0; min-width: 0; }
  .ov-row > .pl-opts { flex-basis: 100%; }
  .ov-uh { flex-wrap: wrap; }
  .pl-dh .small { display: block; }
}
.trip-board .btn-row { gap: 6px; }
.trip-board .btn-row .btn, .trip-board .btn-row .inline-form .btn { min-height: 36px; height: auto; padding: 6px 12px; font-size: 14px; width: auto; flex: 0 0 auto; }
.trip-board .pl-note { padding: 6px 10px; font-size: 13px; margin: 6px 0; }

.pl-stack { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
.pl-stack > .pl-stops, .pl-stack > .pl-trips { flex: 0 0 auto; width: 100%; }

/* Create / edit delivery: compact */
.dn-title { margin-bottom: 8px; }
.dn-grid { gap: 10px; }
.dn-left { gap: 8px; }
.dn-sec.card, .dn-sum.card { padding: 10px 12px; }
.dn-sec h2, .dn-sum h2 { font-size: 15px; margin-bottom: 6px; }
.dn-sec .small { font-size: 12.5px; }
.dn-chosen { padding: 6px 10px; }
.dn-chips { gap: 6px; margin-bottom: 4px; }
.dn-sec .chip { height: 34px; padding: 0 14px; font-size: 14px; border-radius: 17px; }
.dn-list { max-height: 240px; margin-top: 6px; }
.dn-row { min-height: 38px; padding: 4px 10px; gap: 8px; }
.dn-row strong { font-size: 14px; }
.dn-plabel { margin-top: 6px; }
.dn-line { padding: 4px 0; }
.dn-x { width: 34px; height: 34px; font-size: 18px; }
.dn-step { height: 36px; border-radius: 8px; }
.dn-step button { width: 36px; height: 36px; font-size: 18px; }
.dn-disc { height: 36px; font-size: 13px; }
.dn-l3 .chip { height: 34px; padding: 0 10px; font-size: 13px; }
.dn-total { padding-top: 6px; }
.dn-total strong { font-size: 22px; }
.dn-paynote { padding: 6px 10px; font-size: 14px; }
.dn-fold > summary { min-height: 36px; }
.dn-pay { min-height: 40px; padding: 4px 12px; }
.dn-pays { gap: 6px; margin-top: 6px; }
.dn-sec .input, .dn-sum .input { min-height: 38px; height: 38px; }

.var-note { color: #8A4B00; background: #FFF1DA; border-radius: 6px; padding: 2px 8px; margin-top: 3px; font-size: 12.5px; font-weight: 700; align-self: flex-start; }
.var-sum { margin: 4px 0 6px; padding: 6px 10px; border-radius: 8px; background: #FFF1DA; color: #8A4B00; font-size: 13px; font-weight: 700; }

.pl-grip { cursor: grab; touch-action: none; user-select: none; font-size: 20px; line-height: 1; padding: 6px 4px; color: var(--muted, #51606F); }
.pl-stop.dragging { opacity: .6; background: var(--surface-2, #F2F5F7); box-shadow: 0 4px 14px rgba(0,0,0,.18); position: relative; z-index: 5; }

.ex-clist { max-height: 220px; overflow-y: auto; margin-top: 8px; border: 1px solid var(--border, #DFE5EA); border-radius: 10px; padding: 4px 8px; }
.ex-c { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.ex-c[hidden] { display: none; }
.srow-wrap { display: flex; align-items: stretch; }
.srow-wrap > .srow { flex: 1; min-width: 0; }
.srow-sel { display: flex; align-items: center; padding: 0 10px 0 4px; }
.srow-sel input { width: 20px; height: 20px; }
.sel-bar { align-items: center; margin: 0 0 8px; }

.bv-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.bv-filters label { display: flex; flex-direction: column; font-size: 12.5px; font-weight: 700; gap: 2px; }
.bv-filters .input { height: 38px; min-width: 0; }
.bv-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.bv-grid { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.bv-photo { flex: 3 1 340px; min-width: 0; }
.bv-info { flex: 2 1 300px; min-width: 0; }
.bv-img { display: flex; justify-content: center; overflow: auto; max-height: 75vh; }
.bv-img img { max-width: 100%; height: auto; border-radius: 8px; transition: transform .2s; }
.bv-none { padding: 30px 10px; text-align: center; }
.bv-lines td, .bv-lines th { padding: 4px 6px; }

.ov-side { flex: 2 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.ov-side > .card { flex: none; }
.ov-acctform { padding-top: 8px; }

.dc-gh { margin: 12px 0 2px; font-size: 15px; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 28px; }
.dc-gh .dc-tick { margin: 0; font-weight: 400; flex: none; }
.dc-gh .dc-tick input { margin: 0; }
.dc-group .unpaid-row:first-of-type { border-top: 1px solid var(--border, #EDF1F4); }
.dc-row[hidden], .dc-group[hidden] { display: none; }
.dc-foot { display: grid; gap: 8px; margin-top: 12px; position: sticky; bottom: 70px; background: var(--surface, #fff); padding: 8px 0; }
.dc-hand { border-top: 1px solid var(--border, #EDF1F4); padding: 4px 0; }
.dc-hand > summary { cursor: pointer; list-style: none; }
.dc-hand > summary::-webkit-details-marker { display: none; }
.dc-item { padding-left: 12px; }

/* Unpaid page */
.cf-row { padding: 10px 0; border-top: 1px solid var(--border, #EDF1F4); }
.cf-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cf-head .spacer { flex: 1; }
.cf-form { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 6px; align-items: end; margin-top: 8px; }
.cf-form label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; font-weight: 700; min-width: 0; }
.cf-form .input { height: 40px; min-width: 0; width: 100%; padding: 0 8px; }
.cf-form .btn { grid-column: 1 / -1; }
.cf-no { margin-top: 6px; }
@media (min-width: 700px) { .cf-form { grid-template-columns: 110px 120px 150px auto; } .cf-form .btn { grid-column: auto; } }
.unpaid-cust { margin-top: 10px; }
.unpaid-cust h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 17px; margin: 0 0 6px; }
.unpaid-cust h2 .spacer { flex: 1; }
.unpaid-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border, #EDF1F4); min-height: 0; }
.unpaid-row > span { flex: 1; min-width: 0; }
.unpaid-row > strong { white-space: nowrap; }
.unpaid-actions { margin-top: 10px; display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .unpaid-actions { grid-template-columns: 1fr 1fr; } }
.unpaid-actions .u-form { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--border, #DFE5EA); border-radius: 12px; background: var(--surface-2, #F7F9FB); }
.unpaid-actions .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.unpaid-actions .input { height: 40px; min-width: 0; width: 100%; }
.unpaid-actions .btn { width: 100%; justify-content: center; }

.cp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cp-grid label { display: flex; flex-direction: column; font-size: 12.5px; font-weight: 700; gap: 2px; min-width: 0; }
.cp-grid .cp-wide { grid-column: 1 / -1; }
.cp-grid .check { flex-direction: row; align-items: center; }
.cp-grid .input { min-width: 0; width: 100%; }
#dn-cust-pick .btn-row .input { flex: 1; min-width: 0; }

.pay-tile { position: relative; }
.pay-tile.on { border-color: var(--brand); background: var(--info-bg); color: var(--brand-2); box-shadow: 0 0 0 2px var(--brand) inset; }
.pay-exp { position: absolute; top: 4px; right: 8px; font-size: 10.5px; font-weight: 700; opacity: .75; text-transform: uppercase; letter-spacing: .03em; }

.bm-box { margin-top: -6px; background: var(--surface-2, #F7F9FB); }
.bm-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border, #EDF1F4); }
.bm-row > span { flex: 1; min-width: 0; }
.bm-row > strong { white-space: nowrap; }

/* Money to check */
.mc-help { margin: 0 0 10px; padding: 10px 14px; border-radius: 10px; background: var(--surface-2, #F7F9FB); border: 1px solid var(--border, #E3E9EE); font-size: .92rem; }
.mc-card { padding: 0; overflow: hidden; }
.mc-tools { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border, #E3E9EE); }
.mc-tools .input { flex: 1 1 260px; min-width: 0; min-height: 36px; width: auto; }
.mc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mc-chip { min-height: 34px; padding: 0 12px; border-radius: 18px; border: 1.5px solid var(--border, #D5DDE4); background: transparent; color: inherit; font: inherit; font-weight: 600; font-size: .9rem; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none; }
.mc-chip span { opacity: .7; font-weight: 500; }
.mc-chip.on { background: var(--brand, #0B1F33); border-color: var(--brand, #0B1F33); color: #fff; }
.mc-tick { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border, #E3E9EE); }
.mc-tick .btn { min-height: 32px; padding: 0 12px; }
.mc-tbl td { vertical-align: middle; }
.mc-r[hidden], .mc-more-r[hidden] { display: none; }
.mc-r:hover td { background: var(--surface-2, #F7F9FB); }
.mc-tbl .mc-pick, #mc-all { width: 20px; height: 20px; }
.mc-act-h { text-align: right !important; }
.mc-act { text-align: right; white-space: nowrap; }
.mc-act .btn { min-height: 34px; padding: 0 12px; }
.mc-warn { display: inline-block; margin-top: 2px; color: #8A4B00; background: #FFF1DA; border-radius: 6px; padding: 1px 6px; font-weight: 600; }
.mc-more { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; padding: 6px 0 4px; }
.mc-more label { display: grid; gap: 2px; font-size: .85rem; flex: 1 1 200px; }
.mc-more .input { min-height: 38px; }
.mc-more .btn { min-height: 38px; }
.mc-note { max-width: 260px; overflow-wrap: anywhere; }
.mc-bar { position: sticky; bottom: 70px; z-index: 5; margin-top: 10px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--surface, #fff); border: 1px solid var(--border, #E3E9EE); border-radius: 12px; box-shadow: 0 -2px 12px rgba(0,0,0,.08); }
.mc-bar-info { font-weight: 600; }
.mc-bar .btn[disabled] { opacity: .5; }
@media (max-width: 760px) {
  body.theme-left .mc-tbl thead { display: none; }
  body.theme-left .mc-tbl, .mc-tbl tbody { display: block; }
  body.theme-left .mc-tbl tr.mc-r { display: grid; grid-template-columns: 28px 1fr auto; gap: 2px 10px; padding: 10px 12px; border-bottom: 1px solid var(--border, #E3E9EE); }
  body.theme-left .mc-tbl tr.mc-r td { display: block; padding: 0; border: 0; background: none; }
  body.theme-left .mc-tbl tr.mc-r td.sel-col { grid-row: 1 / span 4; width: auto; padding: 0; align-self: center; }
  body.theme-left .mc-tbl tr.mc-r td:nth-child(2) { grid-column: 2; font-size: .85rem; color: var(--muted); }
  body.theme-left .mc-tbl tr.mc-r td:nth-child(3), .mc-tbl tr.mc-r td:nth-child(4) { grid-column: 2; }
  body.theme-left .mc-tbl tr.mc-r td:nth-child(5) { grid-column: 2; font-size: .85rem; color: var(--muted); }
  body.theme-left .mc-tbl tr.mc-r td.num { grid-column: 3; grid-row: 1 / span 2; text-align: right; }
  body.theme-left .mc-tbl tr.mc-r td.mc-act { grid-column: 1 / -1; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 6px; margin-top: 8px; }
  body.theme-left .mc-tbl tr.mc-r td.mc-act .btn { min-height: 40px; justify-content: center; padding: 0 6px; }
  body.theme-left .mc-tbl tr.mc-more-r { display: block; padding: 0 12px 10px; border-bottom: 1px solid var(--border, #E3E9EE); }
  body.theme-left .mc-tbl tr.mc-more-r td { display: block; padding: 0; border: 0; }
  body.theme-left .mc-tbl tr.mc-more-r td:first-child { display: none; }
}


/* ═════ Option C: everything in the left menu — compact, charcoal and green ═════ */
body.theme-left {
  color-scheme: light;
  --bg: #F4F4F2; --surface: #FFFFFF; --surface-2: #ECECE8; --text: #1D1F21; --muted: #6B6F73; --border: #DCDCD8;
  --brand: #2F6F5E; --brand-2: #24584A; --brand-ink: #FFFFFF; --accent: #D9A21B;
  --info-bg: #E3EFEA; --warn-bg: #FBE9D0; --success: #2F6F5E; --success-bg: #DFF0E8; --radius: 8px; --radius-sm: 6px;
  --font: 'IBM Plex Sans', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-variant-numeric: tabular-nums; font-size: 14.5px;
}
body.mode-dark.theme-left, body.mode-dark.theme-left .shell-main {
  color-scheme: dark;
  --bg: #161718; --surface: #1F2123; --surface-2: #292C2F; --text: #E6E6E3; --muted: #9A9EA2; --border: #33363A;
  --brand: #58B79D; --brand-2: #7CCDB5; --brand-ink: #08201A; --accent: #D9A21B; --info-bg: #1F2F2A; --warn-bg: #3A2C12;
  --success: #6fd49f; --success-bg: #173327; --danger: #ff8a80; --danger-bg: #3a1d1b;
}
@media (prefers-color-scheme: dark) {
  body.mode-auto.theme-left {
    color-scheme: dark;
    --bg: #161718; --surface: #1F2123; --surface-2: #292C2F; --text: #E6E6E3; --muted: #9A9EA2; --border: #33363A;
    --brand: #58B79D; --brand-2: #7CCDB5; --brand-ink: #08201A; --accent: #D9A21B; --info-bg: #1F2F2A; --warn-bg: #3A2C12;
    --success: #6fd49f; --success-bg: #173327; --danger: #ff8a80; --danger-bg: #3a1d1b;
  }
}
body.theme-left .shell { display: flex; min-height: 100vh; }
body.theme-left .shell-main { flex: 1 1 auto; min-width: 0; }
body.theme-left .wrap { padding-top: 22px; }
body.theme-left h1 { font-size: 1.5rem; letter-spacing: -.01em; }
body.theme-left .card { box-shadow: none; padding: 14px 16px; }
body.theme-left .btn { border-radius: 6px; }
body.theme-left .btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 700; }
body.theme-left .btn-primary:hover { background: var(--brand-2); }
body.theme-left .sidenav.leftnav {
  flex: 0 0 214px; box-sizing: border-box; background: #2A2D31; padding: 12px 8px 16px; display: flex; flex-direction: column; gap: 10px;
  position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow-y: auto;
}
body.mode-dark.theme-left .sidenav.leftnav { background: #101112; }
@media (prefers-color-scheme: dark) { body.mode-auto.theme-left .sidenav.leftnav { background: #101112; } }
body.theme-left .ln-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 8px; color: #F1F1EE; text-decoration: none; font-weight: 700; font-size: 1.02rem; min-height: 0; }
body.theme-left .ln-brand:hover { background: transparent; }
body.theme-left .ln-brand .brand-mark { background: var(--brand); color: var(--brand-ink); border-radius: 6px; width: 28px; height: 28px; display: grid; place-items: center; }
body.theme-left .nav-group { display: flex; flex-direction: column; gap: 1px; }
body.theme-left .nav-title { padding: 6px 10px 3px; font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #8C9094; }
body.theme-left .sidenav.leftnav a { display: flex; align-items: center; gap: 10px; min-height: 33px; padding: 0 10px; border-radius: 5px; text-decoration: none; font-weight: 500; font-size: .9rem; color: #D9D9D5; }
body.theme-left .sidenav.leftnav a svg { width: 17px; height: 17px; flex: none; opacity: .85; }
body.theme-left .sidenav.leftnav a:hover { background: #393D42; color: #fff; }
body.theme-left .sidenav.leftnav a.on { background: #3D4348; color: #fff; box-shadow: inset 3px 0 0 var(--brand); font-weight: 600; }
body.theme-left .ln-badge { margin-left: auto; font-style: normal; font-size: .72rem; font-weight: 700; background: #D9822B; color: #fff; border-radius: 99px; padding: 0 7px; line-height: 18px; }
body.theme-left .ln-me { margin-top: auto; padding-top: 10px; border-top: 1px solid #3A3E43; }
body.theme-left .ln-who { padding: 4px 10px 6px; color: #F1F1EE; font-size: .85rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
body.theme-left .role-chip { background: #3D4348; color: #D9D9D5; }
body.theme-left .tile-icon { background: var(--info-bg); }
@media (max-width: 760px) {
  body.theme-left .shell { flex-direction: column; }
  body.theme-left .shell-main { width: 100%; }
  /* phone: the menu hides behind the ☰ button and opens as a list under it */
  body.theme-left .navwrap > .sidenav.leftnav { display: none; position: static; height: auto; flex: 0 0 auto; width: 100%; max-width: 100vw; }
  body.theme-left .navwrap.open > .sidenav.leftnav { display: flex; max-height: 70vh; overflow-y: auto; }
  body.theme-left .nav-toggle { background: #2A2D31; color: #F1F1EE; border-bottom-color: #3A3E43; }
  body.theme-left .wrap { padding-left: 14px; padding-right: 14px; padding-bottom: 90px; }
  body.theme-left .kpis, body.theme-left .stat-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  body.theme-left .kpis .kpi, body.theme-left .stat { padding: 10px 12px; min-width: 0; }
  body.theme-left .kpis .kpi-v, body.theme-left .stat strong { font-size: 1.15rem; overflow-wrap: anywhere; }
  body.theme-left h1 { font-size: 1.3rem; }
  body.theme-left .table-wrap, body.theme-left .slist-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  body.theme-left .page-head { flex-wrap: wrap; gap: 8px; }
  body.theme-left .page-head .btn { white-space: nowrap; min-height: 38px; padding: 0 12px; }
  body.theme-left .sales-filters { padding: 8px 10px; gap: 8px; }
  body.theme-left .sales-filters .quick-dates { flex: 1 1 100%; display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
  body.theme-left .sales-filters .quick-dates a { flex: none; white-space: nowrap; min-height: 32px; padding: 0 12px; font-size: .85rem; }
  body.theme-left .sales-filters .date-row { flex: 1 1 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  body.theme-left .sales-filters .date-row label { flex-direction: column; align-items: stretch; gap: 2px; text-align: left; min-width: 0; }
  body.theme-left .sales-filters .date-row .input { width: 100%; }
  body.theme-left .sales-filters .filter-row .input { flex: 1 1 140px; }
}
@media (min-width: 761px) and (max-width: 1000px) {
  body.theme-left .sidenav.leftnav { flex-basis: 184px; }
  body.theme-left .wrap { padding-left: 16px; padding-right: 16px; }
}
body.theme-left .ln-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin: 2px 4px 6px; padding: 2px; background: #202327; border-radius: 7px; }
body.theme-left .ln-mode button { border: 0; background: transparent; color: #B7B9B5; font: inherit; font-size: .8rem; font-weight: 600; min-height: 30px; border-radius: 5px; cursor: pointer; }
body.theme-left .ln-mode button.on { background: #3D4348; color: #fff; box-shadow: inset 0 -2px 0 var(--brand); }
body.theme-left .ln-mode button:hover:not(.on) { color: #fff; }

/* Option C: Invoices — what is shown, filter tags, and the invoice beside the list */
body.theme-left .sales-summary { margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
body.theme-left .ftag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--text); text-decoration: none; font-size: .82rem; font-weight: 600; }
body.theme-left .ftag:hover { border-color: var(--brand); color: var(--brand); }
body.theme-left .split-view { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(400px, 1fr); gap: 12px; align-items: start; }
body.theme-left .split-list { min-width: 0; }
body.theme-left .split-detail { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; padding: 14px 16px; margin-bottom: 0; }
body.theme-left .split-detail.loading { opacity: .55; }
body.theme-left .split-bar { display: flex; justify-content: flex-end; margin-bottom: 6px; }
body.theme-left .split-detail .page-head .back { display: none; }
body.theme-left .split-detail .page-head { margin-bottom: 8px; }
body.theme-left .split-detail h1 { font-size: 1.2rem; }
body.theme-left .srow.sel { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--brand); }
@media (max-width: 999px) { body.theme-left .split-view { grid-template-columns: 1fr; } body.theme-left .split-detail { display: none; } }

/* The invoice page has its own two columns; inside the side panel everything stacks in one. */
body.theme-left .split-detail .sale-grid, body.theme-left .split-detail .detail-grid, body.theme-left .split-detail .form-grid { grid-template-columns: minmax(0, 1fr); }
body.theme-left .split-detail .sale-totals { max-width: none; margin-left: 0; }
body.theme-left .split-detail .page-head { flex-wrap: wrap; gap: 8px; }
body.theme-left .split-detail .page-head .btn { white-space: nowrap; }
body.theme-left .split-detail .card { padding: 12px 14px; }
body.theme-left .split-detail .table-wrap { overflow-x: auto; }
body.theme-left .split-detail input.input, body.theme-left .split-detail select.input { max-width: 100%; }

/* Option C: wider pages, no back arrows (the menu does that), a compact filter bar, and the short invoice summary in the panel */
body.theme-left .wrap { max-width: 1680px; padding-left: 28px; padding-right: 28px; }
body.theme-left .wrap:has(.split-view) { max-width: none; }
body.theme-left .page-head .back { display: none; }
body.theme-left .sales-filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 12px; }
body.theme-left .sales-filters .quick-dates { order: 1; }
body.theme-left .sales-filters .date-row { order: 2; display: flex; gap: 10px; }
body.theme-left .sales-filters .date-row label { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
body.theme-left .sales-filters .date-row .input { width: auto; min-height: 32px; }
body.theme-left .sales-filters .filter-row { order: 3; flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 8px; }
body.theme-left .sales-filters .filter-row .input { width: auto; min-height: 32px; }
body.theme-left .sales-filters .filter-row input[type=search] { flex: 1 1 240px; }
body.theme-left .sales-filters .filter-row .btn-primary { flex: none; width: auto; min-height: 32px; padding: 0 16px; }
body.theme-left .stat-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
body.theme-left .pn-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
body.theme-left .pn-top h2 { margin: 0 0 2px; font-size: 1.15rem; }
body.theme-left .pn-li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
body.theme-left .pn-tot { margin-top: 8px; display: grid; gap: 4px; }
body.theme-left .pn-tot > div { display: flex; justify-content: space-between; gap: 10px; }
body.theme-left .pn-tot .big { font-weight: 700; font-size: 1.1rem; padding-top: 4px; border-top: 1px solid var(--border); }
body.theme-left .pn-tot .due { color: var(--warn, #b45f06); }
body.theme-left .pn-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* Option C: Invoices as a table with columns */
body.theme-left .slist-table { padding: 0; overflow: hidden; }
body.theme-left .stable { width: 100%; border-collapse: collapse; }
body.theme-left .stable th { text-align: left; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 600; }
body.theme-left .stable td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
body.theme-left .stable .num { text-align: right; font-variant-numeric: tabular-nums; }
body.theme-left .stable .sel-col { width: 30px; padding-right: 0; }
body.theme-left .stable .day-row td { background: var(--surface-2); font-weight: 700; font-size: .8rem; padding: 5px 10px; }
body.theme-left .srow-tr { cursor: pointer; }
body.theme-left .srow-tr:hover td { background: var(--surface-2); }
body.theme-left .srow-tr.sel td { background: var(--surface-2); }
body.theme-left .srow-tr.sel td:first-child, body.theme-left .srow-tr.sel td.sel-col + td { box-shadow: inset 3px 0 0 var(--brand); }
body.theme-left .srow-tr.voided td { opacity: .6; }
body.theme-left .srow-link { color: inherit; text-decoration: none; }
body.theme-left .pill-ok { background: var(--success-bg); color: var(--success); }

/* Option C: Customers — a table on the left, the chosen customer beside it */
body.theme-left .sectabs { padding: 3px; margin-bottom: 12px; gap: 2px; border-radius: 8px; }
body.theme-left .sectabs a { min-height: 32px; padding: 0 12px; border-radius: 6px; font-size: .85rem; }
body.theme-left .sectabs a.on { background: var(--brand); color: var(--brand-ink); }
body.theme-left .cu-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(340px, 1fr); gap: 12px; align-items: start; }
body.theme-left .cu-list { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
body.theme-left .cu-bar { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
body.theme-left .cu-pm { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
body.theme-left .cu-bar .input { flex: 1 1 220px; min-width: 0; min-height: 34px; width: auto; }
body.theme-left .cu-bar .btn { min-height: 34px; padding: 0 14px; margin-left: auto; }
body.theme-left .ftag.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
body.theme-left .cu-owes { color: var(--warn, #b45f06); }
body.theme-left .cu-grid .md-detail { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; padding: 14px 16px; gap: 10px; }
body.theme-left .cu-grid .md-detail h2 { margin: 0; font-size: 1.2rem; }
body.theme-left .md-box { border-radius: var(--radius); padding: 8px 12px; background: var(--surface-2); border-color: transparent; }
body.theme-left .md-box strong { font-size: 1.05rem; }
body.theme-left .cu-grid .ageing { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
body.theme-left .cu-grid .ageing > div { padding: 6px 8px; border-radius: var(--radius-sm); background: var(--surface-2); display: flex; flex-direction: column; font-size: .8rem; }
body.theme-left .cu-grid .ageing .aged { background: var(--warn-bg); }
/* Option C: forms — fields start at the top of each cell, so a long help line doesn't push its neighbours around */
body.theme-left .form-grid { gap: 28px 14px; align-items: start; }
body.theme-left .form-grid > label { position: relative; display: flex; flex-direction: column; justify-content: flex-start; gap: 4px; min-width: 0; }
body.theme-left .form-grid > label > .input, body.theme-left .form-grid > label > select, body.theme-left .form-grid > label > textarea { width: 100%; box-sizing: border-box; }
/* a note under a box sits in the flow under it, so a long note (3-4 lines) pushes the next row down instead of running over it */
body.theme-left .form-grid > label > .input ~ .help, body.theme-left .form-grid > label > select ~ .help { font-size: .75rem; line-height: 1.25; }
body.theme-left .form-grid { row-gap: 16px; }
body.theme-left .form-grid > label.check { flex-direction: row; align-items: center; justify-content: flex-start; min-height: 38px; gap: 8px; }
body.theme-left .form-grid > label.check input { margin: 0; }
body.theme-left .form .card h2 { font-size: 1.05rem; margin: 0 0 10px; }
body.theme-left .cu-show { display: none; }
@media (max-width: 760px) {
  body.theme-left .cu-hide { display: none; }
  body.theme-left .cu-show { display: inline; }
  body.theme-left .cu-list .srow-tr.sel td { background: transparent; box-shadow: none; }
  body.theme-left .cu-list .srow-tr.sel td:first-child { box-shadow: none; }
  body.theme-left .cu-bar .btn { flex: 1 1 100%; margin-left: 0; }
  body.theme-left .cu-list .stable td { padding: 10px; }
}
/* A credit note's own screen: three steps (what came back, where the credit goes, reasons) and one bar with the total and Save */
.cn-sub { margin: -4px 0 12px; }
.cn-form { display: grid; gap: 12px; padding-bottom: 8px; }
.cn-step { margin: 0; }
.cn-step h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 1.05rem; }
.cn-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-size: .8rem; font-weight: 700; }
.cn-lines { display: grid; }
.cn-line { display: grid; grid-template-columns: minmax(0, 1fr) auto 110px; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.cn-line:first-child { border-top: 0; }
.cn-what { display: grid; gap: 2px; min-width: 0; }
.cn-step-qty { display: flex; align-items: center; gap: 6px; }
.cn-step-qty button { width: 36px; height: 36px; border-radius: var(--radius, 8px); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.cn-step-qty button:hover { border-color: var(--brand); color: var(--brand); }
.cn-qty { width: 70px; text-align: center; min-height: 36px; }
.cn-line.on .cn-qty { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.cn-amt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cn-added { display: grid; gap: 8px; margin-top: 6px; }
.cn-add-row { display: grid; grid-template-columns: minmax(0, 2fr) 80px minmax(110px, 1fr) auto 100px auto; gap: 8px; align-items: center; padding: 8px; border-radius: var(--radius, 8px); background: var(--surface-2); }
.cn-add-row .input { width: 100%; box-sizing: border-box; min-height: 36px; background: var(--surface); }
.cn-a-price-wrap { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.cn-add-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cn-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cn-tile { position: relative; display: grid; gap: 2px; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--radius, 8px); background: var(--surface-2); cursor: pointer; }
.cn-tile input { position: absolute; opacity: 0; pointer-events: none; }
.cn-tile span { font-size: .8rem; color: var(--muted); }
.cn-tile.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.cn-tile.on span { color: inherit; opacity: .85; }
.cn-tile.off { opacity: .45; cursor: not-allowed; }
.cn-tile:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.cn-pick { margin-top: 12px; max-width: 520px; }
.cn-pick[hidden] { display: none; }
.cn-pick label, .cn-two label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.cn-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cn-bar { position: sticky; bottom: 0; z-index: 6; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -6px 14px rgba(0,0,0,.05); margin: 0 -2px; }
.cn-total strong { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.cn-bar .spacer { flex: 1; }
.btn-danger-o { background: var(--surface); color: #A32D2D; border: 1.5px solid #A32D2D; font-weight: 600; }
.btn-danger-o:hover { background: #A32D2D; color: #fff; }
.cn-dialog { border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; max-width: 460px; width: calc(100% - 32px); background: var(--surface); color: var(--text); }
.cn-dialog::backdrop { background: rgba(0,0,0,.45); }
@media (max-width: 900px) { .cn-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cn-two { grid-template-columns: 1fr; } .cn-add-row { grid-template-columns: minmax(0, 1fr) 80px; } .cn-add-row > :first-child { grid-column: 1 / -1; } }
@media (max-width: 760px) { .cn-line { grid-template-columns: minmax(0, 1fr) auto; } .cn-line .cn-amt { grid-column: 1 / -1; text-align: left; } body.theme-left .cn-bar { bottom: 70px; } }

/* Option C: Credit notes list */
body.theme-left .cn-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; margin-bottom: 12px; }
body.theme-left .cn-filters > .input[type=search] { flex: 1 1 260px; min-width: 0; }
body.theme-left .cn-filters .input, body.theme-left .cn-filters select.input { width: auto; min-height: 34px; }
body.theme-left .cn-filters > .input[type=search] { width: auto; }
body.theme-left .cn-filters label { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); }
body.theme-left .cn-filters .btn { width: auto; min-height: 34px; padding: 0 16px; flex: none; }
body.theme-left .stat-row .stat:nth-child(n+2) { background: var(--surface); }
body.theme-left .stable td.num { white-space: nowrap; }

/* Option C: Commission and sales reps */
body.theme-left .cm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 10px; }
body.theme-left .cm-bar label { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
body.theme-left .cm-bar .input { width: auto; min-height: 34px; }
body.theme-left .cm-act { text-align: right; white-space: nowrap; width: 1%; }
body.theme-left .cm-act .btn { min-height: 30px; padding: 0 12px; }
body.theme-left .cm-h { font-size: 1.05rem; margin: 18px 0 8px; }
body.theme-left .cm-grid { display: grid; grid-template-columns: minmax(0, 2.6fr) minmax(280px, 1fr); gap: 12px; align-items: start; }
body.theme-left .cm-grid table.list.small { font-size: .82rem; }
body.theme-left .cm-grid table.list.small td, body.theme-left .cm-grid table.list.small th { padding-left: 5px; padding-right: 5px; }
body.theme-left .cm-grid > .card { margin: 0; }
body.theme-left .cm-grid > .filters { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 12px; }
body.theme-left .cm-grid > .filters .input { width: auto; min-height: 34px; }
body.theme-left .cm-grid > section.card { grid-column: 1; grid-row: 2; min-width: 0; }
body.theme-left .cm-grid > #com-pay { grid-column: 2; grid-row: 2; }
body.theme-left .cm-grid table.list.small td, body.theme-left .cm-grid table.list.small th { white-space: nowrap; }
body.theme-left .cm-grid > #com-pay { position: sticky; top: 12px; }
body.theme-left .cm-grid .form-grid { grid-template-columns: minmax(0, 1fr); }
body.theme-left .cm-grid h2 { font-size: 1.05rem; margin: 0 0 8px; }
body.theme-left table.list { width: 100%; border-collapse: collapse; }
body.theme-left table.list th { text-align: left; font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 7px 8px; border-bottom: 1px solid var(--border); }
body.theme-left table.list td { padding: 8px; border-bottom: 1px solid var(--border); }
body.theme-left table.list th.num, body.theme-left table.list td.num { text-align: right; }
body.theme-left table.list tr:last-child td { border-bottom: 0; }
@media (max-width: 1000px) { body.theme-left .cm-grid { grid-template-columns: 1fr; } body.theme-left .cm-grid > #com-pay, body.theme-left .cm-grid > section.card { position: static; grid-column: 1; grid-row: auto; } }

/* Choose a product, give its amount, add another product (reps and customers' own amounts) */
.item-rows { display: grid; gap: 8px; margin: 6px 0 10px; }
.item-list { display: grid; gap: 8px; }
.item-list:not(:empty) + .item-empty { display: none; }
.item-empty { margin: 0; }
.item-row { display: grid; grid-template-columns: minmax(160px, 1.4fr) minmax(110px, .7fr) auto auto; gap: 8px; align-items: center; }
.item-row .item-sel, .item-row .item-amt { width: 100%; box-sizing: border-box; }
.item-amt-wrap { display: flex; align-items: center; gap: 6px; }
.item-per { white-space: nowrap; }
.item-add { justify-self: start; }
@media (max-width: 640px) { .item-row { grid-template-columns: minmax(0, 1fr) auto; } .item-row .item-sel, .item-per { grid-column: 1 / -1; } .item-per { white-space: normal; grid-row: 3; } .item-amt-wrap { grid-row: 2; grid-column: 1; } .item-del { grid-row: 2; grid-column: 2; } }

/* A rep's own screen: customers chosen one by one, and a single Save along the bottom */
.rep-edit .card { margin-bottom: 12px; }
.rep-edit h2 .help { font-weight: 400; font-size: .8rem; margin-left: 6px; }
.cust-pick { display: flex; flex-direction: column; gap: 4px; max-width: 420px; margin: 8px 0 12px; font-size: .85rem; font-weight: 600; }
.cust-cards { display: grid; gap: 10px; }
.cust-card { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius, 8px); background: var(--surface-2, #F2F5F7); }
.cust-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.cust-card-head .cc-del { margin-left: auto; }
.cust-card .item-sel, .cust-card .item-amt { background: var(--surface, #fff); }
.rep-save { position: sticky; bottom: 0; z-index: 6; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin: 0 -2px; background: var(--surface, #fff); border-top: 1px solid var(--border); box-shadow: 0 -6px 14px rgba(0,0,0,.05); }
@media (max-width: 760px) { body.theme-left .rep-save { bottom: 70px; } }

/* Option C: reps — pick any customer and set their amounts per item */
body.theme-left .rep-cust-find { margin: 14px 0 6px; }
body.theme-left .rep-cust-find .input { max-width: 360px; min-height: 34px; }
body.theme-left .rep-cust-list tr.sel td { background: var(--surface-2); }
body.theme-left .rep-cust-list td, body.theme-left .rep-cust-list th { vertical-align: middle; }
body.theme-left .rep-cust-form { padding: 12px 14px; margin: 8px 0 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
body.theme-left .rep-cust-form .btn-row { margin-top: 14px; }
body.theme-left .rep-cust-form h3 { margin: 0 0 6px; font-size: 1rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
body.theme-left .rep-cust-form .form-grid > label > .input { background: var(--surface); }

/* Option C: Payments tab — one wide panel: how, how much, with the balance after beside it, and past payments underneath */
body.theme-left .ct-stack[data-tab=pay] [data-pane=pay].pay-new { max-width: none; width: 100%; display: block; }
body.theme-left .pay-form { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr); gap: 12px; align-items: stretch; }
body.theme-left .pay-main, body.theme-left .pay-side, body.theme-left .pay-hist { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
body.theme-left .pay-main { display: flex; flex-direction: column; gap: 14px; }
body.theme-left .pay-main h2, body.theme-left .pay-hist h3 { margin: 0; font-size: 1.05rem; }
body.theme-left .pay-methods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
body.theme-left .pay-m { position: relative; display: grid; place-items: center; min-height: 52px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface-2); font-weight: 600; cursor: pointer; }
body.theme-left .pay-m input { position: absolute; opacity: 0; pointer-events: none; }
body.theme-left .pay-m.on { border-color: var(--brand); background: var(--brand); color: var(--brand-ink); }
body.theme-left .pay-m:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
body.theme-left .pay-amount { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); font-weight: 600; }
body.theme-left .pay-money { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 0 14px; }
body.theme-left .pay-money:focus-within { border-color: var(--brand); }
body.theme-left .pay-money > span { font-size: 1.5rem; color: var(--muted); }
body.theme-left .pay-money .input { border: 0; box-shadow: none; background: transparent; font-size: 1.9rem; font-weight: 600; min-height: 60px; padding: 0; color: var(--text); width: 100%; }
body.theme-left .pay-quick { display: flex; flex-wrap: wrap; gap: 8px; }
body.theme-left .chip-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 99px; padding: 6px 14px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
body.theme-left .chip-btn:hover { border-color: var(--brand); color: var(--brand); }
body.theme-left .pay-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
body.theme-left .pay-two label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); font-weight: 600; }
body.theme-left .pay-two .help { font-weight: 400; }
body.theme-left .pay-side { display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
body.theme-left .pay-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
body.theme-left .pay-line span { color: var(--muted); }
body.theme-left .pay-line strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
body.theme-left .pay-after { padding-top: 10px; border-top: 1px solid var(--border); }
body.theme-left .pay-after strong { font-size: 1.6rem; }
body.theme-left .pay-side .btn { width: 100%; justify-content: center; margin-top: auto; }
body.theme-left .pay-hist { margin-top: 12px; padding: 14px 0 0; }
body.theme-left .pay-hist h3, body.theme-left .pay-hist > p { padding: 0 18px; }
body.theme-left .pay-hist h3 { margin-bottom: 8px; }
@media (max-width: 900px) { body.theme-left .pay-form { grid-template-columns: 1fr; } body.theme-left .pay-two { grid-template-columns: 1fr; } }

/* Option C: no orange or salmon for money owed — amounts stay in the ink colour; what is overdue is shown by a darker tile and bolder text */
body.theme-left .o-bal .neg, body.theme-left .o-bal .big-num.neg, body.theme-left .cu-owes { color: var(--text); }
body.theme-left .o-bal .neg:not(.big-num) { font-weight: 600; }
body.theme-left .o-bal .ageing .aged { background: var(--border); color: var(--text); box-shadow: inset 3px 0 0 var(--text); }
body.theme-left .o-bal .ageing .aged span { color: var(--text); }
body.mode-dark.theme-left .o-bal .ageing .aged { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--text); }

/* Option C: a customer's own page — balance header, then tabs, one panel at a time */
body.theme-left .ct-acts { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
body.theme-left .ct-acts .btn { min-height: 34px; padding: 0 14px; font-size: .88rem; }
body.theme-left .ct-tabs { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--border); margin: 0 0 12px; overflow-x: auto; }
body.theme-left .ct-tabs button, body.theme-left .ct-tabs a { flex: none; border: 0; background: none; font: inherit; font-size: .9rem; color: var(--muted); padding: 9px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; text-decoration: none; cursor: pointer; white-space: nowrap; }
body.theme-left .ct-tabs button:hover, body.theme-left .ct-tabs a:hover { color: var(--text); }
body.theme-left .ct-tabs button[aria-selected=true] { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
body.theme-left .ct-tabs .spacer { flex: 1; }
body.theme-left .ct-tabs a { font-size: .82rem; padding: 9px 10px; }
body.theme-left .ct-stack { display: block; max-width: none; width: 100%; }
body.theme-left .wrap:has(.ct-stack) { max-width: none; }
body.theme-left .ct-stack > div { display: contents; }
body.theme-left .ct-stack .o-bal { order: -1; }
body.theme-left .ct-stack [data-pane] { display: none; }
body.theme-left .ct-stack[data-tab=inv] [data-pane=inv], body.theme-left .ct-stack[data-tab=stm] [data-pane=stm],
body.theme-left .ct-stack[data-tab=pay] [data-pane=pay], body.theme-left .ct-stack[data-tab=det] [data-pane=det], body.theme-left .ct-stack[data-tab=txn] [data-pane=txn], body.theme-left .ct-stack[data-tab=itm] [data-pane=itm] { display: block; }
.txn-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0; }
.txn-tools .input { flex: 1 1 220px; max-width: 320px; }
.txn-row[hidden] { display: none; }
.txn-row.voided td { opacity: .55; }
.txn-receipt, .txn-payment { background: #e4f1ea; color: #1e5b3a; } .txn-credit { background: #f6ecd9; color: #7a5316; } .txn-opening, .txn-journal { background: #e7e9f2; color: #3a4170; }
body.theme-left .ct-stack[data-tab=pay] [data-pane=pay] { max-width: 480px; }
body.theme-left .ct-stack .o-bal { margin-bottom: 12px; }
@media (max-width: 760px) { body.theme-left .ct-tabs a { display: none; } body.theme-left .ct-acts .btn { flex: 1 1 auto; justify-content: center; } }

/* Option C: a customer's own page */
body.theme-left .cust-grid { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 12px; align-items: start; }
body.theme-left .cust-grid .card { margin-bottom: 12px; }
body.theme-left .cust-grid h2 { font-size: 1.05rem; margin: 0 0 8px; }
body.theme-left .o-bal .big-num { font-size: 1.9rem; letter-spacing: -.01em; }
body.theme-left .o-pay .seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
body.theme-left .o-pay .seg-btn { justify-content: center; border: 0; border-radius: 0; min-height: 36px; background: var(--surface); }
body.theme-left .o-pay .seg-btn.on { background: var(--brand); color: var(--brand-ink); }
body.theme-left .o-stmt .btn-row { gap: 6px; }
body.theme-left .o-stmt .btn-row .btn { min-height: 34px; padding: 0 12px; font-size: .85rem; }
body.theme-left .o-stmt .btn-wa { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
body.theme-left .stmt-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
body.theme-left .stmt-head h2 { margin: 0; }
body.theme-left .stmt-range { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
body.theme-left .stmt-range .input { min-height: 32px; width: auto; }
@media (max-width: 1000px) { body.theme-left .cust-grid { grid-template-columns: 1fr; } }
body.theme-left .cu-full { grid-template-columns: minmax(0, 1fr); }
body.theme-left .cu-full .srow-tr { cursor: pointer; }
@media (max-width: 1000px) {
  body.theme-left .cu-grid { grid-template-columns: 1fr; }
  body.theme-left .cu-grid:not(.cu-full).has-sel .cu-list, body.theme-left .cu-grid:not(.cu-full):not(.has-sel) .md-detail { display: none; }
  body.theme-left .cu-grid .md-detail { position: static; max-height: none; }
}

/* Driver screen: what was delivered, with each item's price and line total */
.drv-items { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--border); text-align: left; }
.drv-li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-variant-numeric: tabular-nums; }
.drv-li:last-child { border-bottom: 0; }
.drv-li strong { white-space: nowrap; }
body.drv-app #done-card .drv-items { grid-column: 1 / -1; width: 100%; margin-top: 14px; }
body.drv-app #done-card .drv-li { font-size: 15px; }
body.drv-app #done-card .drv-li > span { min-width: 0; }

/* New sale: the chooser and the line-items form */
.ns-choose { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; max-width: 760px; }
.ns-card { display: flex; flex-direction: column; gap: 8px; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; }
.ns-card:hover { border-color: var(--brand); }
.ns-card strong { font-size: 1.35rem; }
.ns-ico { width: 44px; height: 44px; border-radius: 11px; background: var(--info-bg); color: var(--brand); display: grid; place-items: center; }
.ns-go { margin-top: auto; padding-top: 6px; font-weight: 700; color: var(--brand); }
.sl-head { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px; align-items: start; }
.sl-head label, .sl-pay label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); align-content: start; }
.sl-head .lbl, .sl-pay .lbl { display: block; }
.sl-pay label#sl-tend { max-width: 340px; margin-top: 10px; }
.sl-cust, .sl-item { position: relative; }
.sl-note { grid-column: 1 / -1; }
.sl-sug { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.sl-sug[hidden] { display: none; }
.sl-sug button { display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; color: var(--text); font: inherit; cursor: pointer; }
.sl-sug button:hover { background: var(--surface-2); }
.sl-sug small { color: var(--muted); }
.sl-line { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) 80px 110px 110px 36px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.sl-lh { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.sl-line .n, .sl-lh .n { text-align: right; }
.sl-lt { font-weight: 700; font-variant-numeric: tabular-nums; }
.sl-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.sl-totals { text-align: right; display: grid; gap: 2px; }
.sl-total { display: flex; gap: 14px; justify-content: flex-end; font-size: 1.3rem; }
.sl-vat { color: var(--muted); font-size: .85rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-r input { position: absolute; opacity: 0; pointer-events: none; }
.chip-r span { display: inline-block; padding: 8px 18px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); cursor: pointer; font-weight: 600; color: var(--text); }
.chip-r input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip-r input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.chip-r.off span { opacity: .4; cursor: not-allowed; }
@media (max-width: 800px) {
  .sl-head { grid-template-columns: 1fr 1fr; } .sl-cust { grid-column: 1 / -1; }
  .sl-lh { display: none; }
  .sl-line { grid-template-columns: minmax(0, 1fr) 70px 100px 36px; }
  .sl-item, .sl-line > label:nth-child(2) { grid-column: 1 / -1; }
  .sl-lt { grid-column: 1 / 4; text-align: right; }
}
@media (max-width: 760px) {
  .cn-add-row { grid-template-columns: 90px minmax(0, 1fr); }
  .cn-add-row > :first-child, .cn-add-row .cn-a-vat { grid-column: 1 / -1; }
  .cn-add-row .cn-a-amt { text-align: left; }
  .cn-add-row .cn-a-del { justify-self: end; }
  .cn-bar { padding: 8px 12px; gap: 8px; }
  .cn-total strong { font-size: 1.2rem; }
  .cn-bar .btn-lg { min-height: 42px; padding: 0 16px; }
}
/* Credit note lines: each can be taken off (faded and struck through, with a Put back button) */
.cn-line { grid-template-columns: minmax(0, 1fr) auto 110px auto; }
.cn-line.removed { opacity: .5; }
.cn-line.removed .cn-what strong { text-decoration: line-through; }
.cn-line .cn-remove { min-height: 34px; white-space: nowrap; }
.cn-h-btns { margin-left: auto; display: inline-flex; gap: 6px; }
.cn-hint { margin: -4px 0 8px; }
@media (max-width: 760px) { .cn-line { grid-template-columns: minmax(0, 1fr) auto; } .cn-line .cn-remove { justify-self: end; } }
/* Option C: list pages (invoices, customers, credit notes…) use the whole width of the screen */
body.theme-left .wrap:has(.slist-table) { max-width: none; }

/* Option C: an invoice — header with the key facts, then tabs (Invoice, Credit notes, Paper and photos, Settings), one pane at a time */
body.theme-left .inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap; margin: 0 0 12px; }
body.theme-left .inv-back { font-size: .85rem; }
body.theme-left .inv-title h1 { margin: 2px 0 0; font-size: 1.5rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
body.theme-left .inv-title h1 .pill { font-size: .75rem; font-weight: 600; }
body.theme-left .inv-sub { margin-top: 3px; }
body.theme-left .inv-date { color: var(--text); font-weight: 600; }
body.theme-left .inv-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
body.theme-left .inv-acts .btn { min-height: 36px; }
body.theme-left .inv-acts .btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
body.theme-left .inv-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 0 0 12px; overflow-x: auto; }
body.theme-left .inv-tabs button { flex: none; border: 0; background: none; font: inherit; color: var(--muted); padding: 9px 16px; margin-bottom: -1px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
body.theme-left .inv-tabs button:hover { color: var(--text); }
body.theme-left .inv-tabs button[aria-selected=true] { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
body.theme-left .inv-count { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 99px; background: var(--surface-2); color: var(--text); font-size: .72rem; font-weight: 600; line-height: 18px; }
body.theme-left .inv-stack { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 12px; align-items: start; max-width: none; }
body.theme-left .inv-stack > div { display: contents; }
body.theme-left .inv-stack [data-pane] { display: none; margin: 0; }
body.theme-left .inv-stack[data-tab=inv] [data-pane=inv], body.theme-left .inv-stack[data-tab=cn] [data-pane=cn],
body.theme-left .inv-stack[data-tab=paper] [data-pane=paper], body.theme-left .inv-stack[data-tab=set] [data-pane=set] { display: block; }
body.theme-left .inv-stack[data-tab=inv] > section[data-pane=inv] { grid-column: 1; grid-row: 1 / span 12; }
body.theme-left .inv-stack[data-tab=inv] > div > [data-pane=inv] { grid-column: 2; }
body.theme-left .inv-stack[data-tab=cn] { grid-template-columns: minmax(0, 1fr); }
body.theme-left .inv-stack[data-tab=paper], body.theme-left .inv-stack[data-tab=set] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.theme-left .inv-cn-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
body.theme-left .inv-cn-head h2 { margin: 0; font-size: 1.05rem; }
body.theme-left .inv-stack h2 { font-size: 1.05rem; }
body.theme-left .inv-stack .card .btn-danger { background: var(--surface); color: #A32D2D; border: 1.5px solid #A32D2D; font-weight: 600; }
body.theme-left .inv-stack .card .btn-danger:hover { background: #A32D2D; color: #fff; }
@media (max-width: 900px) {
  body.theme-left .inv-stack, body.theme-left .inv-stack[data-tab=paper], body.theme-left .inv-stack[data-tab=set] { grid-template-columns: minmax(0, 1fr); }
  body.theme-left .inv-stack[data-tab=inv] > section[data-pane=inv], body.theme-left .inv-stack[data-tab=inv] > div > [data-pane=inv] { grid-column: 1; grid-row: auto; }
  body.theme-left .inv-acts .btn { flex: 1 1 auto; justify-content: center; }
}
body.theme-left .inv-stack .neg { color: var(--text); font-weight: 600; }

/* Commission: every item on an invoice, shown under it */
.com-tg { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 99px; padding: 1px 10px; font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; }
.com-tg:hover, .com-tg[aria-expanded=true], .com-tg[aria-pressed=true] { border-color: var(--brand); color: var(--brand); }
.com-explain { margin: 4px 0 10px; }
.com-items > td { background: var(--surface-2); padding: 6px 10px 10px; }
.com-sub { width: 100%; border-collapse: collapse; font-size: .92em; }
.com-sub th { text-align: left; font-weight: 600; color: var(--muted); font-size: .75rem; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.com-sub td { padding: 5px 6px; border-bottom: 1px solid var(--border); }
.com-sub tr:last-child td { border-bottom: 0; }
.com-sub .num, .com-sub th.num { text-align: right; white-space: nowrap; }
.com-ck { width: 34px; text-align: center; }
.com-ck input { width: 17px; height: 17px; accent-color: var(--brand, #2F6F5E); cursor: pointer; }
.com-sub tr.com-done td { opacity: .5; }
.com-selrow td { background: var(--surface-2); }
#com-pay button.is-off { opacity: .45; }
.com-print { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 0 8px; }

/* "Columns": the button above a table, and its list of tick boxes */
.colpick { position: relative; display: inline-block; }
.colpick > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 1px solid var(--border, #DCDCD8); border-radius: var(--radius-sm, 6px); background: var(--surface, #fff); color: var(--text, #111); font-size: .85rem; font-weight: 600; }
.colpick > summary::-webkit-details-marker { display: none; }
.colpick > summary::before { content: "▦"; font-size: .9em; color: var(--muted, #666); }
.colpick[open] > summary { border-color: var(--brand, #2F6F5E); color: var(--brand, #2F6F5E); }
.colpick-menu { position: absolute; z-index: 30; right: 0; top: calc(100% + 4px); min-width: 220px; padding: 10px 12px; background: var(--surface, #fff); border: 1px solid var(--border, #DCDCD8); border-radius: var(--radius, 8px); box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.colpick-menu form { display: grid; gap: 4px; }
.colpick-menu label { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: .9rem; cursor: pointer; }
.colpick-menu input { width: 16px; height: 16px; accent-color: var(--brand, #2F6F5E); }
.colpick-title { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted, #666); margin-bottom: 4px; }
.colpick-reset { justify-self: start; margin-top: 6px; }
.colpick-bar { display: flex; justify-content: flex-end; margin: 0 0 6px; }
.cm-colbar { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.colpick-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.colpick-row label { flex: 1; }
.colpick-mv { display: inline-flex; gap: 2px; }
.colpick-mv button { border: 1px solid var(--border, #DCDCD8); background: var(--surface, #fff); color: var(--muted, #666); border-radius: 5px; width: 26px; height: 24px; font-size: .62rem; line-height: 1; cursor: pointer; padding: 0; }
.colpick-mv button:hover { border-color: var(--brand, #2F6F5E); color: var(--brand, #2F6F5E); }
.colpick-list { display: grid; gap: 1px; }

/* Customer: items bought */
.itm-tbl td { vertical-align: top; }
.itm-tbl summary { cursor: pointer; }
.itm-hist { width: 100%; margin-top: 6px; font-size: .88em; }
.itm-hist th, .itm-hist td { padding: 3px 6px; border-bottom: 1px solid var(--line, #dde3e8); }
.itm-add { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.itm-add .itm-price { width: 92px; text-align: right; min-height: 34px; margin: 0; }
.itm-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ci-head td { background: var(--soft, rgba(127,140,150,.10)); }
.ci-head label { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.ci-fill { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.ci-fill .input { width: auto; margin: 0; }
.ci-save { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: flex-end; padding: 10px 14px; background: var(--card, #fff); border: 1px solid var(--line, #dde3e8); border-radius: 10px; }
