@font-face { font-family: "Samaa Sans"; font-weight: 400; font-display: swap; src: url("../vendor/fonts/noto-sans-latin-400-normal.b35fac17d244.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Samaa Sans"; font-weight: 700; font-display: swap; src: url("../vendor/fonts/noto-sans-latin-700-normal.90894e9e092a.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Samaa Sans"; font-weight: 400; font-display: swap; src: url("../vendor/fonts/noto-sans-arabic-arabic-400-normal.cb524c4794c6.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Samaa Sans"; font-weight: 700; font-display: swap; src: url("../vendor/fonts/noto-sans-arabic-arabic-700-normal.3f642d07de8c.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }

/* =====================================================================
   "liquid glass" — layout and look follow DIA's app.css.
   Every colour is a token below. These defaults come from the Sama'a logo; a company's own colours
   replace the brand tokens through /brand/theme.css (core/theme.py works them out for every theme):
     blue #0056B8 · green #62C331 · dark green #4A8B30 · grey #868A8A
   Themes: light (default) · dark · contrast · auto (follows the device).
   ===================================================================== */
:root {
  /* brand (logo) */
  --logo-blue: #0056B8;
  --logo-green: #62C331;
  --logo-dgreen: #4A8B30;
  --logo-grey: #868A8A;
  --brand-1: #62C331;
  --brand-2: #0056B8;
  --brand-3: #3B7D23;
  --brand-grad: linear-gradient(135deg, #62C331 0%, #2E8F6E 45%, #0056B8 100%);
  --brand-glow: rgba(0, 86, 184, .30);
  /* buttons carry text: gradients stay inside AA for white text */
  --primary-grad: linear-gradient(135deg, #1C60B4 0%, #0056B8 55%, #00468F 100%);
  --success-grad: linear-gradient(135deg, #3B7D23 0%, #2F6B1C 100%);
  --on-brand: #FFFFFF;
  --on-accent: #FFFFFF;
  /* solid button colours (company colours override --primary*, see core/theme.py) */
  --primary: #0056B8;
  --primary-active: #00468F;
  --primary-disabled: #6E8FB8;
  --success-solid: #3B7D23;
  --success-active: #2F6B1C;
  --success-glow: rgba(59, 125, 35, .25);
  --danger-solid: #B42323;

  /* text and lines */
  --ink: #14233A;
  --ink-2: #2B3A50;
  --muted: #526070;
  --line: rgba(20, 35, 58, .09);
  --line-strong: rgba(20, 35, 58, .16);
  --link: #0050AD;
  --link-hover: #003F8A;

  /* surfaces */
  --page-1: #F7FAFE;
  --page-2: #EEF5FC;
  --page-3: #F1F8EC;
  --orb-1: rgba(0, 86, 184, .30);
  --orb-2: rgba(98, 195, 49, .30);
  --orb-3: rgba(46, 143, 110, .22);
  --glass: rgba(255, 255, 255, .60);
  --glass-strong: rgba(255, 255, 255, .74);
  --glass-edge: rgba(255, 255, 255, .88);
  --glass-hi: rgba(255, 255, 255, .9);
  --glass-blur: blur(14px) saturate(150%);
  --pop: #FFFFFF;
  --pop-2: #F6FAFE;
  --mix-base: #FFFFFF;
  --input-bg: rgba(255, 255, 255, .86);
  --input-border: rgba(20, 35, 58, .16);
  --input-focus: #1C60B4;
  --focus-ring: rgba(0, 86, 184, .22);
  --thead-bg: rgba(242, 247, 252, .7);
  --hover-bg: rgba(0, 86, 184, .06);
  --btn-light-bg: rgba(255, 255, 255, .78);
  --btn-light-fg: #2B3A50;
  --kbd-bg: rgba(255, 255, 255, .7);
  --backdrop: rgba(20, 35, 58, .26);
  --shadow-c: 31, 52, 85;
  --shadow-sm: 0 1px 2px rgba(var(--shadow-c), .06), 0 1px 5px rgba(var(--shadow-c), .05);
  --shadow: 0 1px 3px rgba(var(--shadow-c), .06), 0 6px 18px rgba(var(--shadow-c), .07);
  --shadow-lg: 0 24px 60px rgba(var(--shadow-c), .18);

  /* status (semantic) — green/blue/grey from the logo, red & amber only for warnings and errors */
  --ok-bg: #E3F3DA;   --ok-fg: #2A6119;   --ok-line: rgba(59, 125, 35, .35);
  --info-bg: #E0ECF9; --info-fg: #003F8A; --info-line: rgba(0, 86, 184, .30);
  --warn-bg: #FFF1D6; --warn-fg: #8A4B00; --warn-line: rgba(176, 106, 0, .35);
  --err-bg: #FDE4E4;  --err-fg: #A11B1B;  --err-line: rgba(200, 40, 40, .32);
  --neutral-bg: #EBEFF3; --neutral-fg: #3F4A57;
  --danger: #B42323;
  --danger-grad: linear-gradient(135deg, #C42F2F, #A11B1B);

  /* radius */
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;

  /* area colours (menu pills, tiles, pop-ups) — logo blue/green/grey family; >= 4.5:1 on white */
  --c-home: #1D4F91;
  --c-purchasing: #0B6E8A;
  --c-stock: #3B7D23;
  --c-sales: #0056B8;
  --c-vans: #2A7356;
  --c-reports: #2B4C7E;
  --c-money: #1E6B45; --c-hr: #3A4E8C; --c-assets: #586A2B; --c-ledger: #5A3F7A; --c-service: #0E6A7C;
  --c-settings: #5B6363;
  --on-c: #FFFFFF;

  --bs-primary: #0056B8;
  --bs-primary-rgb: 0, 86, 184;
  --bs-success: #3B7D23;
  --bs-success-rgb: 59, 125, 35;
  --bs-link-color: var(--link);
  --bs-link-color-rgb: 0, 80, 173;
  --bs-link-hover-color: var(--link-hover);
  --bs-link-hover-color-rgb: 0, 63, 138;
  --bs-body-font-family: "Samaa Sans", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --bs-body-color: var(--ink);
  --bs-secondary-color: var(--muted);
  --bs-border-color: var(--line-strong);
  --bs-border-radius: var(--r-sm);
  --bs-border-radius-sm: 5px;
  --bs-border-radius-lg: 8px;
  --bs-emphasis-color: var(--ink);
  color-scheme: light;
}

/* ---------------------------------------------------------------- dark (night) */
:root[data-theme="dark"] {
  --brand-1: #7BD14F;
  --brand-2: #4D9BFF;
  --brand-3: #7BD14F;
  --brand-glow: rgba(77, 155, 255, .28);
  --primary-grad: linear-gradient(135deg, #1C60B4 0%, #0056B8 100%);
  --success-grad: linear-gradient(135deg, #3B7D23 0%, #2F6B1C 100%);
  --ink: #E6EDF7; --ink-2: #CBD6E6; --muted: #A3B1C6;
  --line: rgba(200, 220, 255, .10); --line-strong: rgba(200, 220, 255, .18);
  --link: #8CC0FF; --link-hover: #B6D7FF;
  --page-1: #0A1322; --page-2: #0D1A2E; --page-3: #0B1A1A;
  --orb-1: rgba(28, 96, 180, .30); --orb-2: rgba(74, 139, 48, .22); --orb-3: rgba(46, 143, 110, .16);
  --glass: rgba(20, 32, 54, .62); --glass-strong: rgba(20, 32, 54, .80); --glass-edge: rgba(160, 190, 230, .14); --glass-hi: rgba(255, 255, 255, .06);
  --pop: #15233A; --pop-2: #122036; --mix-base: #15233A;
  --input-bg: rgba(10, 19, 34, .7); --input-border: rgba(160, 190, 230, .22); --input-focus: #4D9BFF; --focus-ring: rgba(77, 155, 255, .28);
  --thead-bg: rgba(10, 19, 34, .45); --hover-bg: rgba(77, 155, 255, .09);
  --btn-light-bg: rgba(30, 45, 72, .8); --btn-light-fg: #DCE6F4; --kbd-bg: rgba(10, 19, 34, .6);
  --backdrop: rgba(0, 0, 0, .5); --shadow-c: 0, 0, 0;
  --ok-bg: #173521; --ok-fg: #9BE07A; --ok-line: rgba(123, 209, 79, .35);
  --info-bg: #12294A; --info-fg: #9CC8FF; --info-line: rgba(77, 155, 255, .35);
  --warn-bg: #3A2A0E; --warn-fg: #F5C46B; --warn-line: rgba(245, 196, 107, .35);
  --err-bg: #3D1618; --err-fg: #FF9C9C; --err-line: rgba(255, 156, 156, .35);
  --neutral-bg: #243246; --neutral-fg: #C9D3E0;
  --danger: #FF8A8A; --danger-grad: linear-gradient(135deg, #B42323, #8E1A1A);
  --c-home: #7FB2FF; --c-purchasing: #38B2CC; --c-stock: #7BD14F; --c-sales: #5AA2FF;
  --c-vans: #4CC59A; --c-reports: #9DB8E8; --c-settings: #A7B0B0; --on-c: #0A1322; --on-accent: #0A1322;
  --c-money: #57D08E; --c-hr: #A9B8F5; --c-assets: #B9CF6E; --c-ledger: #CDB4F0; --c-service: #5CC9DD;
  --bs-primary: #4D9BFF; --bs-primary-rgb: 77, 155, 255; --bs-success: #7BD14F; --bs-success-rgb: 123, 209, 79;
  --bs-link-color-rgb: 140, 192, 255; --bs-link-hover-color-rgb: 182, 215, 255;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --brand-1: #7BD14F;
    --brand-2: #4D9BFF;
    --brand-3: #7BD14F;
    --brand-glow: rgba(77, 155, 255, .28);
    --primary-grad: linear-gradient(135deg, #1C60B4 0%, #0056B8 100%);
    --success-grad: linear-gradient(135deg, #3B7D23 0%, #2F6B1C 100%);
    --ink: #E6EDF7; --ink-2: #CBD6E6; --muted: #A3B1C6;
    --line: rgba(200, 220, 255, .10); --line-strong: rgba(200, 220, 255, .18);
    --link: #8CC0FF; --link-hover: #B6D7FF;
    --page-1: #0A1322; --page-2: #0D1A2E; --page-3: #0B1A1A;
    --orb-1: rgba(28, 96, 180, .30); --orb-2: rgba(74, 139, 48, .22); --orb-3: rgba(46, 143, 110, .16);
    --glass: rgba(20, 32, 54, .62); --glass-strong: rgba(20, 32, 54, .80); --glass-edge: rgba(160, 190, 230, .14); --glass-hi: rgba(255, 255, 255, .06);
    --pop: #15233A; --pop-2: #122036; --mix-base: #15233A;
    --input-bg: rgba(10, 19, 34, .7); --input-border: rgba(160, 190, 230, .22); --input-focus: #4D9BFF; --focus-ring: rgba(77, 155, 255, .28);
    --thead-bg: rgba(10, 19, 34, .45); --hover-bg: rgba(77, 155, 255, .09);
    --btn-light-bg: rgba(30, 45, 72, .8); --btn-light-fg: #DCE6F4; --kbd-bg: rgba(10, 19, 34, .6);
    --backdrop: rgba(0, 0, 0, .5); --shadow-c: 0, 0, 0;
    --ok-bg: #173521; --ok-fg: #9BE07A; --ok-line: rgba(123, 209, 79, .35);
    --info-bg: #12294A; --info-fg: #9CC8FF; --info-line: rgba(77, 155, 255, .35);
    --warn-bg: #3A2A0E; --warn-fg: #F5C46B; --warn-line: rgba(245, 196, 107, .35);
    --err-bg: #3D1618; --err-fg: #FF9C9C; --err-line: rgba(255, 156, 156, .35);
    --neutral-bg: #243246; --neutral-fg: #C9D3E0;
    --danger: #FF8A8A; --danger-grad: linear-gradient(135deg, #B42323, #8E1A1A);
    --c-home: #7FB2FF; --c-purchasing: #38B2CC; --c-stock: #7BD14F; --c-sales: #5AA2FF;
    --c-vans: #4CC59A; --c-reports: #9DB8E8; --c-settings: #A7B0B0; --on-c: #0A1322; --on-accent: #0A1322;
    --c-money: #57D08E; --c-hr: #A9B8F5; --c-assets: #B9CF6E; --c-ledger: #CDB4F0; --c-service: #5CC9DD; --c-ledger: #CDB4F0; --c-service: #5CC9DD;
    --bs-primary: #4D9BFF; --bs-primary-rgb: 77, 155, 255; --bs-success: #7BD14F; --bs-success-rgb: 123, 209, 79;
    --bs-link-color-rgb: 140, 192, 255; --bs-link-hover-color-rgb: 182, 215, 255;
    color-scheme: dark;
  }
}

/* ---------------------------------------------------------------- high contrast (sunlight / warehouse) */
:root[data-theme="contrast"] {
  --brand-1: #2A6119; --brand-2: #003F8A; --brand-3: #2A6119;
  --brand-glow: transparent;
  --primary-grad: linear-gradient(#003F8A, #003F8A);
  --success-grad: linear-gradient(#245416, #245416);
  --ink: #000000; --ink-2: #000000; --muted: #2E2E2E;
  --line: #000000; --line-strong: #000000;
  --link: #00347A; --link-hover: #001F4D;
  --page-1: #FFFFFF; --page-2: #FFFFFF; --page-3: #FFFFFF;
  --orb-1: transparent; --orb-2: transparent; --orb-3: transparent;
  --glass: #FFFFFF; --glass-strong: #FFFFFF; --glass-edge: #000000; --glass-hi: #FFFFFF; --glass-blur: none;
  --pop: #FFFFFF; --pop-2: #FFFFFF; --mix-base: #FFFFFF;
  --input-bg: #FFFFFF; --input-border: #000000; --input-focus: #003F8A; --focus-ring: rgba(0, 63, 138, .45);
  --thead-bg: #E8E8E8; --hover-bg: #E6EEF8;
  --btn-light-bg: #FFFFFF; --btn-light-fg: #000000; --kbd-bg: #FFFFFF;
  --backdrop: rgba(0, 0, 0, .55);
  --shadow-sm: none; --shadow: none; --shadow-lg: 0 0 0 2px #000000;
  --ok-bg: #FFFFFF; --ok-fg: #1E4A12; --ok-line: #1E4A12;
  --info-bg: #FFFFFF; --info-fg: #002C66; --info-line: #002C66;
  --warn-bg: #FFFFFF; --warn-fg: #5C3200; --warn-line: #5C3200;
  --err-bg: #FFFFFF; --err-fg: #7A0E0E; --err-line: #7A0E0E;
  --neutral-bg: #FFFFFF; --neutral-fg: #000000;
  --danger: #7A0E0E; --danger-grad: linear-gradient(#7A0E0E, #7A0E0E);
  --c-home: #00347A; --c-purchasing: #004A5E; --c-stock: #1E4A12; --c-sales: #003F8A;
  --c-vans: #144A35; --c-reports: #1B2F52; --c-settings: #303535; --on-c: #FFFFFF;
  --c-money: #0F4A2C; --c-hr: #22336B; --c-assets: #3A4719; --c-ledger: #3B2557; --c-service: #084654;
  --bs-primary: #003F8A; --bs-primary-rgb: 0, 63, 138; --bs-success: #245416; --bs-success-rgb: 36, 84, 22;
  --bs-link-color-rgb: 0, 52, 122; --bs-link-hover-color-rgb: 0, 31, 77;
  color-scheme: light;
}
:root[data-theme="contrast"] .orbs { display: none; }
:root[data-theme="contrast"] .glass, :root[data-theme="contrast"] .card, :root[data-theme="contrast"] .dropdown-menu,
:root[data-theme="contrast"] .sticky-actions, :root[data-theme="contrast"] .doc-bar, :root[data-theme="contrast"] .appbar, :root[data-theme="contrast"] .tabbar { border-width: 2px; }
:root[data-theme="contrast"] .btn-primary::after, :root[data-theme="contrast"] .btn-success::after,
:root[data-theme="contrast"] .btn-danger::after { display: none; }
:root[data-theme="contrast"] .btn { border: 2px solid #000000; }
:root[data-theme="contrast"] a:not(.btn):not(.tile):not(.mod-pill):not(.tab):not(.pal-item):not(.dropdown-item) { text-decoration: underline; }

html { background: var(--page-1); }
body { color: var(--ink); font-size: .92rem; background: transparent; min-height: 100vh; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background: linear-gradient(160deg, var(--page-1) 0%, var(--page-2) 52%, var(--page-3) 100%); }
.orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.orbs i { position: absolute; width: 58vmax; height: 58vmax; border-radius: 50%; will-change: transform; animation: drift 40s ease-in-out infinite alternate; }
.orbs i:nth-child(1) { background: radial-gradient(circle, var(--orb-1), transparent 62%); top: -24vmax; left: -16vmax; }
.orbs i:nth-child(2) { background: radial-gradient(circle, var(--orb-2), transparent 62%); bottom: -30vmax; left: 20vw; animation-duration: 48s; animation-delay: -14s; }
.orbs i:nth-child(3) { background: radial-gradient(circle, var(--orb-3), transparent 62%); top: -12vmax; right: -22vmax; animation-duration: 56s; animation-delay: -26s; }
@keyframes drift { 0% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(6vw, 5vh, 0) scale(1.08); } 100% { transform: translate3d(-5vw, 9vh, 0) scale(.95); } }
h1, h2, h3, h4, h5, h6 { color: var(--ink); }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
.text-secondary, .text-muted, .muted { color: var(--muted) !important; }
.text-brand { color: var(--brand-2) !important; }
.text-danger { color: var(--err-fg) !important; }
.text-success { color: var(--ok-fg) !important; }
.text-warning { color: var(--warn-fg) !important; }
hr { border-color: var(--line-strong); opacity: 1; }

/* --------------------------------------------------------------- glass */
.glass, .card, .dropdown-menu, .sticky-actions, .doc-bar {
  background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .card, .dropdown-menu, .sticky-actions, .doc-bar { background: var(--pop); }
}

/* --------------------------------------------------------------- top bar with area menus */
.appbar { position: sticky; top: 12px; z-index: 1030; width: calc(100% - 24px); max-width: 1480px; margin: 12px auto 0;
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 22px; background: var(--glass-strong); }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; flex: none; padding-inline-start: 2px; }
.brand:hover { color: var(--ink); }
.brand b { font-size: 1.1rem; letter-spacing: .02em; }
.logo { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--pop);
  box-shadow: 0 8px 20px var(--brand-glow), inset 0 0 0 1px var(--line); overflow: hidden; }
.logo img { width: 70%; height: 82%; object-fit: contain; }
.modnav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; margin-inline: 6px; }
.mod { position: relative; }
.mod-pill { display: inline-flex; align-items: center; gap: .45rem; height: 40px; padding-inline: 6px 11px; border: 0; border-radius: 14px;
  background: transparent; color: var(--ink-2); font-weight: 600; font-size: .87rem; white-space: nowrap; text-decoration: none;
  transition: background .15s, color .15s, box-shadow .15s; }
.mod-pill .ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-size: .92rem; color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, var(--mix-base)); }
.mod-pill .chev { font-size: .66rem; opacity: .6; transition: transform .2s; }
.mod-pill:hover, .mod.open .mod-pill { background: var(--pop); color: var(--ink); box-shadow: var(--shadow-sm); }
.mod.open .chev { transform: rotate(180deg); }
.mod-pill.active, .mod.open .mod-pill.active { color: var(--on-c); background: var(--c);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--c) 34%, transparent), inset 0 1px 0 rgba(255, 255, 255, .25); }
.mod-pill.active .ic { background: rgba(255, 255, 255, .2); color: var(--on-c); }
.mega { position: absolute; top: calc(100% + 12px); inset-inline-start: -4px; z-index: 1040; min-width: 360px; max-width: calc(100vw - 24px); padding: 12px;
  border-radius: 20px; background: linear-gradient(180deg, var(--pop) 0%, var(--pop-2) 100%); border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.985); transform-origin: top center;
  transition: opacity .16s, transform .16s, visibility .16s; }
.mega::before { content: ""; position: absolute; inset: -14px 0 auto 0; height: 14px; }
.mod.open .mega { opacity: 1; visibility: visible; transform: none; }
.mod:nth-last-child(-n+2) .mega { inset-inline-start: auto; inset-inline-end: -4px; }
.mega-head, .sheet-sec h6 { display: flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--ink); }
.mega-head { padding: 2px 4px 10px; font-size: .95rem; }
.mega-head .ic, .sheet-sec h6 .ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: .82rem; color: var(--on-c); background: var(--c); }
.mega-grid { display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: 4px; }
.tile { display: flex; align-items: center; gap: .6rem; padding: 8px 10px; border-radius: 14px; color: var(--ink-2); text-decoration: none;
  font-weight: 500; font-size: .88rem; line-height: 1.2; transition: background .12s; }
.tile .ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: .95rem; color: var(--c);
  background: color-mix(in srgb, var(--c) 13%, var(--mix-base)); }
.tile:hover { background: color-mix(in srgb, var(--c) 9%, var(--mix-base)); color: var(--ink); }
.tile.active { background: color-mix(in srgb, var(--c) 14%, var(--mix-base)); color: var(--ink); font-weight: 700; }
.tile.active .ic { color: var(--on-c); background: var(--c); }

.tools { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; flex: none; }
.search-pill { display: inline-flex; align-items: center; gap: .55rem; height: 40px; padding-inline: 12px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--btn-light-bg); color: var(--muted); font-size: .86rem; box-shadow: var(--shadow-sm); }
.search-pill:hover { background: var(--pop); color: var(--ink); }
.search-pill .kbd { margin-inline-start: 1.2rem; }
.btn-round { height: 40px; border-radius: 14px; display: inline-flex; align-items: center; gap: .35rem; padding-inline: 14px; }
.btn-icon { width: 40px; height: 40px; border-radius: 14px; display: inline-grid; place-items: center; padding: 0; position: relative; font-size: 1.05rem; }
.btn-user { height: 40px; border-radius: 14px; display: inline-flex; align-items: center; gap: .45rem; padding-inline: 5px; }
.search-pill .cap { display: none; }
@media (min-width: 1600px) { .search-pill .cap { display: inline; } }
.avatar { width: 30px; height: 30px; border-radius: 10px; display: inline-grid; place-items: center; font-weight: 700; font-size: .82rem;
  color: var(--on-brand); background: var(--primary-grad); }
.badge-dot { position: absolute; top: -5px; inset-inline-end: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  display: grid; place-items: center; font-size: .68rem; font-weight: 700; color: #FFFFFF; background: var(--danger-grad);
  box-shadow: 0 0 0 2px var(--pop); }
.badge-dot[hidden] { display: none; }
.btn-user .uname { display: none; }
@media (min-width: 1500px) { .btn-user .uname { display: inline; } .btn-user { padding-inline: 5px 12px; } }

.content { width: 100%; max-width: 1480px; margin: 0 auto; padding: 20px 18px 3rem; }

/* theme switcher inside the user menu */
.theme-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px 6px 6px; }
.theme-row button { border: 1px solid var(--line-strong); background: var(--btn-light-bg); color: var(--ink-2); border-radius: 10px;
  font-size: .72rem; font-weight: 600; padding: 6px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.theme-row button i { font-size: 1rem; }
.theme-row button[aria-pressed="true"] { background: var(--brand-2); color: var(--on-accent, #FFFFFF); border-color: var(--brand-2); }
.theme-row button[aria-pressed="true"] { color: var(--on-accent, #FFFFFF); }
.menu-label { font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 6px 10px 0; }

/* bell panel */
.notif-menu { width: 360px; max-width: calc(100vw - 24px); padding: 0; overflow: hidden; }
.notif-head { display: flex; align-items: center; gap: .5rem; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; }
.notif-list { max-height: 58vh; overflow-y: auto; padding: 6px; }
.notif-item, .toast-card, .pal-item { --c: var(--c-home); }
.notif-item { display: flex; gap: .65rem; align-items: center; padding: 9px 10px; border-radius: 14px; color: var(--ink); text-decoration: none; }
.notif-item:hover { background: color-mix(in srgb, var(--c) 8%, var(--mix-base)); color: var(--ink); }
.notif-item .ic, .toast-card .ic, .pal-item .ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none;
  font-size: .95rem; color: var(--on-c); background: var(--c); }
.notif-item .tx { flex: 1; min-width: 0; font-weight: 600; font-size: .86rem; }
.notif-item .n { font-weight: 700; color: var(--c); }

/* toasts */
.toasts { position: fixed; top: 84px; inset-inline-end: 18px; z-index: 1090; display: flex; flex-direction: column; gap: 10px;
  width: min(390px, calc(100vw - 24px)); pointer-events: none; }
.toast-card { pointer-events: auto; display: flex; gap: .7rem; align-items: center; padding: 11px 10px 11px 12px; border-radius: 18px;
  color: var(--ink); background: var(--pop); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-10px) scale(.97); transition: transform .32s cubic-bezier(.2, .9, .3, 1.25), opacity .2s; }
.toast-card.in { opacity: 1; transform: none; }
.toast-card .tx { flex: 1; min-width: 0; font-size: .88rem; }
.toast-card .x { border: 0; background: transparent; color: var(--muted); font-size: 1.3rem; line-height: 1; padding: 0 4px; }
.toast-card.t-success { --c: var(--c-stock); } .toast-card.t-error { --c: var(--danger); } .toast-card.t-warning { --c: var(--warn-fg); }

/* command palette */
.palette { position: fixed; inset: 0; z-index: 1080; display: flex; justify-content: center; align-items: flex-start; padding: 10vh 12px 12px;
  background: var(--backdrop); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.palette[hidden] { display: none; }
.palette-box { width: min(660px, 100%); max-height: 76vh; display: flex; flex-direction: column; overflow: hidden; border-radius: 22px; background: var(--pop); }
.palette-input { display: flex; align-items: center; gap: .65rem; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.palette-input > i { color: var(--muted); font-size: 1.1rem; }
.palette-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 1.05rem; color: var(--ink); }
.palette-body { overflow-y: auto; padding: 8px; }
.palette-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.pal-item { display: flex; align-items: center; gap: .6rem; padding: 7px 10px; border-radius: 12px; color: var(--ink); text-decoration: none; font-size: .9rem; min-width: 0; }
.pal-item .ic { width: 28px; height: 28px; border-radius: 9px; font-size: .82rem; }
.pal-item span:not(.ic) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-item small { margin-inline-start: auto; color: var(--muted); font-size: .7rem; white-space: nowrap; }
.pal-item[hidden] { display: none; }
.pal-item:hover, .pal-item.sel { background: var(--hover-bg); color: var(--ink); }
.results h6 { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 10px 10px 4px; }
body.palette-open, body.sheet-open { overflow: hidden; }

/* phone: tab bar + sheet */
.tabbar, .sheet, .sheet-backdrop { --c: var(--c-home); }
.tabbar { position: fixed; z-index: 1035; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex; justify-content: space-around; padding: 6px; border-radius: 22px; background: var(--glass-strong); }
.tab { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 3px 2px; border: 0; border-radius: 16px;
  background: transparent; color: var(--ink-2); font-size: .68rem; font-weight: 600; text-decoration: none; }
.tab > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab .ic { width: 38px; height: 30px; border-radius: 11px; display: grid; place-items: center; font-size: 1.1rem; color: var(--c); }
.tab.active { color: var(--ink); }
.tab.active .ic { color: var(--on-c); background: var(--c); }
.sheet-backdrop { position: fixed; inset: 0; z-index: 1036; background: var(--backdrop); opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }
.sheet { position: fixed; z-index: 1037; left: 8px; right: 8px; bottom: 8px; max-height: 80vh; overflow-y: auto; border-radius: 26px;
  padding: 4px 14px calc(18px + env(safe-area-inset-bottom)); background: var(--pop); transform: translateY(115%);
  visibility: hidden; transition: transform .32s cubic-bezier(.2, .9, .3, 1), visibility .32s; }
body.sheet-open .sheet { transform: none; visibility: visible; }
body.sheet-open .sheet-backdrop { opacity: 1; visibility: visible; }
.sheet-grip { width: 46px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 8px auto 10px; }
.sheet-sec { padding: 4px 0 12px; }
.sheet-sec h6 { font-size: .86rem; margin: 6px 2px 8px; }
.sheet-sec.focus .tile { background: color-mix(in srgb, var(--c) 6%, var(--mix-base)); }
.sheet .mega-grid { grid-template-columns: 1fr 1fr; }

/* area colours: any element can carry m-<area> */
.m-home { --c: var(--c-home); } .m-purchasing { --c: var(--c-purchasing); } .m-stock { --c: var(--c-stock); }
.m-sales { --c: var(--c-sales); } .m-vans { --c: var(--c-vans); } .m-reports { --c: var(--c-reports); } .m-settings { --c: var(--c-settings); }
.m-money { --c: var(--c-money); } .m-hr { --c: var(--c-hr); } .m-assets { --c: var(--c-assets); } .m-ledger { --c: var(--c-ledger); } .m-service { --c: var(--c-service); } .m-agents { --c: var(--c-money); }

/* --------------------------------------------------------------- page */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 6px 0 1.1rem; }
.page-head h1 { font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: -.01em; overflow-wrap: anywhere; }
.page-head .actions { margin-inline-start: auto; display: flex; flex-wrap: wrap; gap: .45rem; }
.page-head .search { flex: 1 1 220px; max-width: 380px; }
.back { display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem; text-decoration: none; margin-bottom: .2rem; }

/* --------------------------------------------------------------- cards */
.card { --bs-card-bg: transparent; --bs-card-color: var(--ink); --bs-card-border-color: var(--glass-edge); --bs-card-cap-bg: transparent;
  --bs-card-border-radius: var(--r); --bs-card-inner-border-radius: calc(var(--r) - 1px); border-radius: var(--r); color: var(--ink); }
.card-header { font-weight: 700; border-bottom: 1px solid var(--line); padding: .8rem 1.1rem; color: var(--ink); }
.card-body { padding: 1.1rem; }
.card .table thead tr:first-child > :first-child { border-start-start-radius: calc(var(--r) - 1px); }
.card .table thead tr:first-child > :last-child { border-start-end-radius: calc(var(--r) - 1px); }
.card .card-header + * .table thead tr:first-child > * { border-radius: 0; }
a.card { transition: transform .18s, box-shadow .18s; text-decoration: none; }
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* --------------------------------------------------------------- tables */
.table { --bs-table-bg: transparent; --bs-table-color: var(--ink); --bs-table-hover-bg: var(--hover-bg); --bs-table-hover-color: var(--ink);
  --bs-table-border-color: var(--line); margin-bottom: 0; color: var(--ink); }
.table > :not(caption) > * > * { padding: .55rem .75rem; background: transparent; color: inherit; }
.table-sm > :not(caption) > * > * { padding: .42rem .65rem; }
.table thead th { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; white-space: nowrap;
  background: var(--thead-bg); border-bottom: 1px solid var(--line); }
.table td, .table th { vertical-align: middle; }
tr[data-href] { cursor: pointer; }
.table tbody tr:last-child > * { border-bottom: 0; }
.num, .money { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; border-radius: var(--r); }

/* --------------------------------------------------------------- buttons */
.btn { border-radius: 11px; font-weight: 600; transition: transform .15s, box-shadow .15s, filter .15s, background-color .15s; }
.btn-sm { border-radius: 9px; }
.btn:active { transform: translateY(1px); }
.btn-primary, .btn-success, .btn-danger { position: relative; overflow: hidden; border-color: transparent; }
.btn-primary::after, .btn-success::after, .btn-danger::after { content: ""; position: absolute; inset: 0 0 50% 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0)); }
.btn-primary { --bs-btn-color: var(--on-brand); --bs-btn-bg: var(--primary); --bs-btn-border-color: transparent; --bs-btn-hover-color: var(--on-brand);
  --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: transparent; --bs-btn-active-color: var(--on-brand); --bs-btn-active-bg: var(--primary-active);
  --bs-btn-disabled-bg: var(--primary-disabled); --bs-btn-disabled-color: #FFFFFF; background-image: var(--primary-grad);
  box-shadow: 0 8px 20px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn-success { --bs-btn-color: #FFFFFF; --bs-btn-bg: var(--success-solid); --bs-btn-hover-color: #FFFFFF; --bs-btn-hover-bg: var(--success-solid); --bs-btn-active-bg: var(--success-active);
  --bs-btn-active-color: #FFFFFF; background-image: var(--success-grad); box-shadow: 0 6px 16px var(--success-glow); }
.btn-danger { --bs-btn-color: #FFFFFF; --bs-btn-bg: var(--danger-solid); --bs-btn-hover-color: #FFFFFF; --bs-btn-hover-bg: var(--danger-solid); background-image: var(--danger-grad); }
.btn-primary:hover, .btn-success:hover, .btn-danger:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-light, .btn-glass, .btn-outline-secondary { --bs-btn-color: var(--btn-light-fg); --bs-btn-bg: var(--btn-light-bg); --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-color: var(--ink); --bs-btn-hover-bg: var(--pop); --bs-btn-hover-border-color: var(--line-strong);
  --bs-btn-active-color: var(--ink); --bs-btn-active-bg: var(--pop); --bs-btn-active-border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn-outline-danger { --bs-btn-color: var(--err-fg); --bs-btn-border-color: var(--err-line); --bs-btn-bg: var(--btn-light-bg);
  --bs-btn-hover-color: #FFFFFF; --bs-btn-hover-bg: var(--danger-solid); --bs-btn-hover-border-color: var(--danger-solid); }
.btn-outline-primary { --bs-btn-color: var(--link); --bs-btn-border-color: var(--info-line); --bs-btn-bg: var(--btn-light-bg);
  --bs-btn-hover-color: #FFFFFF; --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary); }
.btn-link { --bs-btn-color: var(--link); font-weight: 600; }
.btn-close { filter: var(--btn-close-filter, none); }
:root[data-theme="dark"] .btn-close { filter: invert(1); }

/* --------------------------------------------------------------- forms */
.form-control, .form-select { background-color: var(--input-bg); border-color: var(--input-border); color: var(--ink); border-radius: var(--r-sm); }
.form-control::placeholder { color: var(--muted); opacity: 1; }
.form-control:focus, .form-select:focus { background-color: var(--pop); color: var(--ink); border-color: var(--input-focus); box-shadow: 0 0 0 4px var(--focus-ring); }
.form-control:disabled, .form-select:disabled { background-color: var(--neutral-bg); color: var(--muted); }
.form-check-input { background-color: var(--input-bg); border-color: var(--input-border); }
.form-check-input:checked { background-color: var(--brand-2); border-color: var(--brand-2); }
.form-label { font-weight: 600; font-size: .8rem; margin-bottom: .25rem; color: var(--ink-2); }
.form-text { font-size: .75rem; color: var(--muted); }
.errorlist, .invalid { color: var(--err-fg); list-style: none; padding: 0; margin: .2rem 0 0; font-size: .8rem; }
select option { background: var(--pop); color: var(--ink); }

/* scan box (barcode scanner / camera) */
.scanbox { border: 2px dashed color-mix(in srgb, var(--brand-2) 45%, transparent); border-radius: var(--r); padding: 1rem; background: var(--glass); margin-bottom: 1rem; }
.scanbox input[name=q] { font-size: 1.1rem; }
#scanner { max-width: 420px; }
.scan-wrap { position: relative; }
.scan-suggest { position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 1040; max-height: min(52vh, 380px); overflow-y: auto;
  border-radius: 16px; padding: 6px; border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg);
  background: linear-gradient(180deg, var(--pop) 0%, var(--pop-2) 100%); }
.scan-opt { display: flex; align-items: center; gap: .6rem; width: 100%; text-align: start; border: 0; background: transparent;
  color: var(--ink); border-radius: 10px; padding: .55rem .7rem; min-height: 48px; }
.scan-opt:hover, .scan-opt.active { background: var(--hover-bg); }
.scan-opt.active { outline: 2px solid var(--brand-2); outline-offset: -2px; }
.scan-opt .so-main { flex: 1 1 auto; min-width: 0; }
.scan-opt .so-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-opt .so-sub { display: block; font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-opt .so-unit { flex: none; }
.scan-empty { padding: .7rem; color: var(--muted); font-size: .9rem; }
.scan-opt .so-facts { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .25rem; }
.scan-opt .so-facts .badge, .scan-opt .so-hist .badge { font-weight: 600; font-size: .72rem; }
.scan-opt .so-hist { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin-top: .25rem; }
.scan-opt .so-hist-label { font-size: .72rem; color: var(--muted); font-weight: 600; }
.scan-create { display: flex; align-items: center; gap: .4rem; padding: .6rem .7rem; border-radius: 10px; font-weight: 600; text-decoration: none; }
.scan-create:hover { background: var(--hover-bg); }

/* --------------------------------------------------------------- menus, alerts, badges */
.dropdown-menu { --bs-dropdown-color: var(--ink); --bs-dropdown-link-color: var(--ink); --bs-dropdown-link-hover-color: var(--ink);
  --bs-dropdown-link-hover-bg: var(--hover-bg); --bs-dropdown-link-active-bg: var(--brand-2); --bs-dropdown-divider-bg: var(--line);
  border-radius: 16px; padding: 6px; background: linear-gradient(180deg, var(--pop) 0%, var(--pop-2) 100%); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: none; backdrop-filter: none; }
.dropdown-item { border-radius: 10px; padding: .45rem .7rem; font-weight: 500; color: var(--ink); }
.dropdown-item i { color: var(--brand-2); }
.dropdown-item-text { color: var(--ink); }
.alert { border-radius: 14px; border: 1px solid transparent; box-shadow: var(--shadow-sm); }
.alert-info { background: var(--info-bg); border-color: var(--info-line); color: var(--info-fg); }
.alert-success { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-fg); }
.alert-warning { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-fg); }
.alert-danger { background: var(--err-bg); border-color: var(--err-line); color: var(--err-fg); }
.badge { border-radius: 999px; font-weight: 600; padding: .38em .7em; }
.st-ok, .badge-green { background: var(--ok-bg); color: var(--ok-fg); }
.st-info, .badge-soft { background: var(--info-bg); color: var(--info-fg); }
.st-warn, .badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.st-err, .badge-red { background: var(--err-bg); color: var(--err-fg); }
.st-neutral { background: var(--neutral-bg); color: var(--neutral-fg); }
:root[data-theme="contrast"] .badge { border: 1.5px solid currentColor; }
.kbd { font-size: .68rem; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; padding: 0 .35rem; color: var(--muted); background: var(--kbd-bg); font-weight: 600; }
.nav-pills { --bs-nav-pills-link-active-bg: var(--brand-2); --bs-nav-pills-link-active-color: var(--on-accent, #FFFFFF); --bs-nav-link-color: var(--link); }
details > summary { cursor: pointer; }
pre { color: var(--ink); }

/* --------------------------------------------------------------- dashboard */
.kpi { padding: 1.05rem 1.15rem; display: flex; gap: .9rem; align-items: center; height: 100%; text-decoration: none; color: var(--ink); }
.kpi:hover { color: var(--ink); }
.kpi .v { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; overflow-wrap: anywhere; }
.kpi .l { color: var(--muted); font-size: .8rem; }
.kpi > div { min-width: 0; }
.kpi-ic { --c: var(--c-home); width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none; font-size: 1.25rem;
  color: var(--on-c); background: var(--c); box-shadow: 0 8px 18px color-mix(in srgb, var(--c) 30%, transparent); }
@media (max-width: 575.98px) { .kpi { padding: .8rem .85rem; } .kpi .v { font-size: clamp(1rem, 4.6vw, 1.5rem); } }

/* --------------------------------------------------------------- document editor */
.sticky-actions { position: sticky; bottom: 12px; border-radius: var(--r); padding: .65rem .8rem; margin-top: 1rem; z-index: 5;
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.totals td { padding: .32rem .55rem; }
.totals tr.grand td { font-size: 1.15rem; font-weight: 700; border-top: 2px solid var(--brand-2); }
.line-form { display: flex; gap: .35rem; align-items: center; }
.line-form .form-control { min-width: 0; }
.w-qty { max-width: 110px; } .w-price { max-width: 130px; }

/* --------------------------------------------------------------- sign-in */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; border-radius: 28px; padding: 2.1rem 2rem 1.8rem; }
.auth-card .auth-logo { display: block; height: 120px; margin: 0 auto 1rem; }
.logo-letter { color: var(--on-brand); background: var(--primary-grad); font-weight: 800; font-size: 1.15rem; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: .7rem; margin: 0 auto 1.25rem; }
.auth-brand .logo { width: 48px; height: 48px; font-size: 1.4rem; }
.auth-card .btn-primary { height: 48px; border-radius: 14px; font-size: 1rem; }
.auth-foot { margin-top: 1.2rem; text-align: center; font-size: .75rem; color: var(--muted); }

/* --------------------------------------------------------------- responsive */
@media (max-width: 1299.98px) { .mod-pill .lbl { display: none; } .mod-pill { padding-inline: 6px; } .mod-pill .chev { display: none; } }
@media (max-width: 991.98px) {
  .appbar { top: 8px; width: calc(100% - 16px); margin-top: 8px; padding: 6px 8px; border-radius: 18px; }
  .tools { gap: 6px; }
  .content { padding: 14px 8px calc(96px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 1.25rem; }
  .toasts { top: 70px; inset-inline-end: 12px; }
  /* phones/tablets: the tab bar already floats at the bottom, so the action bar sits at the end of the page */
  .sticky-actions { position: static; }
  .card:has(> .table) { overflow-x: auto; }
}
@media (max-width: 420px) { .tools .btn-round .d-none { display: none !important; } .brand b { display: none; } }
@media (min-width: 992px) { .tabbar, .sheet, .sheet-backdrop { display: none !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media print {
  :root { color-scheme: light; }
  body::before, .orbs, .appbar, .tabbar, .sheet, .toasts, .palette, .page-head .actions, .no-print, .sticky-actions { display: none !important; }
  html, body { background: #FFFFFF !important; color: #000000 !important; }
  .content { padding: 0; max-width: none; }
  .card, .glass { border: none; box-shadow: none; background: #FFFFFF; color: #000000; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* the top bar compacts itself step by step until every area fits (fitAppbar in app.js) */
.appbar.fit-1 .search-pill .cap { display: none; }
.appbar.fit-1 .btn-user .uname { display: none; }
.appbar.fit-2 .modnav { margin-inline: 2px; }
.appbar.fit-2 .mod-pill { padding-inline: 5px 8px; gap: .35rem; }
.appbar.fit-2 .mod-pill .chev { display: none; }
.appbar.fit-3 .mod-pill:not(.active) .lbl { display: none; }
.appbar.fit-3 .mod-pill:not(.active) { padding-inline: 6px; }
.appbar.fit-4 .mod-pill .lbl { display: none; }
.appbar.fit-4 .mod-pill { padding-inline: 6px; }
.appbar.fit-4 .brand b { display: none; }

/* KPI cards are .card (Bootstrap makes cards columns): keep icon + text side by side */
.card.kpi { flex-direction: row; }
/* wide tables scroll inside their card on small screens instead of squashing */
@media (max-width: 991.98px) {
  .table-wrap .table th, .table-wrap .table td { white-space: nowrap; }
}
.line-form .form-control { min-width: 4.5rem; }
.line-form .w-price { min-width: 5.5rem; }

/* --------------------------------------------------------------- home: app launcher */
.launcher-wrap { max-width: 1080px; margin: 4px auto 0; }
.launcher-search { position: relative; margin: 0 auto 1.6rem; max-width: 720px; }
.launcher-search i { position: absolute; z-index: 1; inset-inline-start: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.1rem; pointer-events: none; }
.launcher-search input { width: 100%; height: 54px; padding-inline: 50px 16px; border-radius: 16px; border: 1px solid var(--glass-edge);
  background: var(--glass-strong); color: var(--ink); font-size: 1.05rem; box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); outline: none; }
.launcher-search input::placeholder { color: var(--muted); opacity: 1; }
.launcher-search input:focus { border-color: var(--input-focus); box-shadow: 0 0 0 4px var(--focus-ring), var(--shadow); }
.launcher { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 1.4rem .75rem; }
.app { display: flex; flex-direction: column; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); border-radius: 18px; padding: 6px 2px; }
.app[hidden] { display: none; }
.app:hover, .app:focus-visible { color: var(--ink); }
.app-ic { position: relative; width: 92px; height: 92px; border-radius: 22px; display: grid; place-items: center;
  background: var(--pop); border: 1px solid var(--glass-edge); box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s; }
.app:hover .app-ic, .app:focus-visible .app-ic { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.app-glyph { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; font-size: 1.75rem; color: var(--on-c);
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 78%, var(--logo-green)) 0%, var(--c) 60%);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--c) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, .3); }
:root[data-theme="contrast"] .app-glyph { background: var(--c); box-shadow: none; }
.app-badge { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px;
  display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: #FFFFFF; background: var(--danger-grad); box-shadow: 0 0 0 2px var(--pop); }
.app-lbl { font-weight: 600; font-size: .92rem; line-height: 1.25; text-align: center; max-width: 100%; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.launcher-empty { text-align: center; padding: 2rem 0; }
.small-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
@media (max-width: 575.98px) {
  .launcher { grid-template-columns: repeat(4, 1fr); gap: 1.1rem .25rem; }
  .app-ic { width: 70px; height: 70px; border-radius: 18px; }
  .app-glyph { width: 46px; height: 46px; border-radius: 13px; font-size: 1.35rem; }
  .app-lbl { font-size: .78rem; }
  .launcher-search input { height: 48px; }
}
@media (max-width: 374.98px) { .launcher { grid-template-columns: repeat(3, 1fr); } }

/* --------------------------------------------------------------- process flow (branched flowchart) */
.flow { display: flex; flex-direction: column; align-items: center; width: 100%; --fl: var(--line-strong); }
.fnode { display: flex; align-items: center; gap: .55rem; width: 100%; max-width: 280px; padding: .5rem .7rem; border-radius: 14px;
  background: var(--pop); border: 1px solid var(--glass-edge); border-inline-start: 4px solid var(--c); box-shadow: var(--shadow-sm);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: .85rem; line-height: 1.25; }
.fnode:hover { color: var(--ink); box-shadow: var(--shadow); transform: translateY(-1px); }
.fnode .ic { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; color: var(--on-c); background: var(--c); }
.fnode .tx { min-width: 0; overflow-wrap: anywhere; }
.fnode small { display: block; font-weight: 400; font-size: .74rem; color: var(--muted); }
.fq { display: inline-flex; align-items: center; gap: .4rem; max-width: 280px; padding: .4rem .85rem; border-radius: 999px; text-align: center;
  font-weight: 700; font-size: .82rem; color: var(--ink); background: color-mix(in srgb, var(--c) 12%, var(--mix-base));
  border: 1.5px dashed color-mix(in srgb, var(--c) 70%, transparent); }
.fq i { color: var(--c); }
.farrow { position: relative; width: 2px; height: 20px; background: var(--fl); flex: none; }
.farrow::after { content: ""; position: absolute; bottom: -1px; left: 50%; width: 8px; height: 8px; transform: translateX(-50%) rotate(45deg);
  border-right: 2px solid var(--fl); border-bottom: 2px solid var(--fl); }
.fbranches { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
.fbranch { position: relative; display: flex; flex-direction: column; align-items: center; padding: 0 .3rem; min-width: 0; }
.ftop, .fbot { position: relative; align-self: stretch; height: 18px; flex: none; }
.ftop::before, .fbot::before { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--fl); }
.ftop::before { top: 0; } .fbot::before { bottom: 0; }
.fbranch:first-child > .ftop::before, .fbranch:first-child > .fbot::before { inset-inline-start: 50%; }
.fbranch:last-child > .ftop::before, .fbranch:last-child > .fbot::before { inset-inline-end: 50%; }
.ftop::after, .fbot::after { content: ""; position: absolute; left: calc(50% - 1px); width: 2px; height: 100%; background: var(--fl); top: 0; }
.fbranch > .fbot { margin-top: auto; }
.fcap { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 2px 6px 4px; }
.fgap { flex: 1 1 auto; width: 2px; min-height: 20px; background: var(--fl); }
@media (max-width: 575.98px) {
  .fnode { font-size: .78rem; padding: .45rem .5rem; gap: .4rem; }
  .fnode .ic { width: 24px; height: 24px; font-size: .8rem; }
  .fq { font-size: .76rem; padding: .35rem .6rem; }
  .fbranch { padding: 0 .15rem; }
}
/* flowchart keeps a readable width; on small screens it scrolls sideways inside its card */
.card-body:has(> .flow) { overflow-x: auto; }
.flow { min-width: 540px; }
@media (min-width: 576px) { .flow { min-width: 0; } }
.ftag { display: inline-block; margin-top: 3px; padding: 0 .45rem; border-radius: 999px; font-size: .68rem; font-weight: 700;
  background: var(--warn-bg); color: var(--warn-fg); }
.fpill { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--on-c); background: var(--c); flex: none; }
.flow-wide { max-width: 1100px; margin-inline: auto; }
.flow-wide .fnode { max-width: 300px; }
@media (max-width: 575.98px) { .flow-wide { min-width: 720px; } }
.scen-ic { width: 32px; height: 32px; border-radius: 10px; font-size: .95rem; }
.scen { margin: 0; padding-inline-start: 1.3rem; display: flex; flex-direction: column; gap: .45rem; }
.scen-step { color: var(--ink); text-decoration: none; }
.scen-step:hover { color: var(--link); }
.scen .badge { margin-inline-end: .25rem; }

/* launcher grouped by area: one glass panel per area */
.launcher-wrap { max-width: 1240px; }
/* columns pack the panels without gaps and keep the process order top-to-bottom, left-to-right */
.launcher-groups { columns: 3 330px; column-gap: 1rem; }
.lgroup { break-inside: avoid; margin-bottom: 1rem; display: block; border-radius: var(--r-lg); padding: .9rem .9rem 1.1rem; border-top: 3px solid var(--c); }
.lgroup[hidden] { display: none; }
.lgroup-head { display: flex; align-items: center; gap: .55rem; font-size: .95rem; font-weight: 700; margin: 0 0 .9rem; color: var(--ink); }
.lgroup-head .ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-size: .85rem; color: var(--on-c); background: var(--c); }
.lgroup .launcher { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 1rem .4rem; }
.lgroup .app-ic { width: 72px; height: 72px; border-radius: 19px; }
.lgroup .app-glyph { width: 46px; height: 46px; border-radius: 13px; font-size: 1.35rem; }
.lgroup .app-lbl { font-size: .84rem; }
@media (max-width: 575.98px) {
  .launcher-groups { columns: 1; }
  .lgroup { margin-bottom: .75rem; }
  .lgroup .launcher { grid-template-columns: repeat(4, 1fr); gap: .9rem .2rem; }
  .lgroup .app-ic { width: 64px; height: 64px; border-radius: 17px; }
  .lgroup .app-glyph { width: 42px; height: 42px; font-size: 1.2rem; }
  .lgroup .app-lbl { font-size: .76rem; }
}
@media (max-width: 374.98px) { .lgroup .launcher { grid-template-columns: repeat(3, 1fr); } }

/* document flow: quotation → order → picking → invoice → note · RFQ → PO → GRN → return */
.doc-flow .card-body { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; font-size: .85rem; padding: .6rem .9rem; }
.flow-step { display: inline-flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.flow-sep { color: var(--muted); font-size: .7rem; }
.flow-name { color: var(--muted); }
.flow-doc { padding: .1rem .55rem; border-radius: 999px; background: color-mix(in srgb, var(--brand-2) 12%, var(--mix-base)); color: var(--link); text-decoration: none; font-weight: 600; }
.flow-doc.current { background: var(--brand-2); color: var(--on-accent, #FFFFFF); }
:root[data-theme="dark"] .flow-doc.current { color: var(--on-accent); }


/* --------------------------------------------------------------- document lines on phones: one card per line */
.line-pending { margin-top: .15rem; white-space: normal; }
.table-wrap .table td.li-item { white-space: normal; }
.line-pending a, .line-pending b { white-space: nowrap; }
@media (max-width: 575.98px) {
  .lines-table thead { display: none; }
  .lines-table, .lines-table tbody, .lines-table tfoot, .lines-table tr, .lines-table td { display: block; width: 100%; }
  .lines-table tbody tr { padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
  .lines-table tbody td { border: 0; padding: .15rem 0; }
  .table-wrap .lines-table tbody td.li-item { white-space: normal; overflow-wrap: anywhere; }
  .lines-table tbody td.li-item { font-weight: 600; }
  .lines-table tbody td.li-item .small { font-weight: 400; }
  .lines-table tbody td.li-edit { padding: .4rem 0; }
  .lines-table .line-form { width: 100%; }
  .lines-table .line-form .form-control, .lines-table .line-form .w-qty, .lines-table .line-form .w-price { flex: 1 1 0; max-width: none; min-width: 0; }
  .lines-table tbody td.num[data-label] { display: flex; justify-content: space-between; gap: 1rem; text-align: end; }
  .lines-table tbody td.num[data-label]::before { content: attr(data-label); color: var(--muted); font-weight: 500; }
  .lines-table tbody td[colspan] { text-align: center; }
  .lines-table tfoot tr { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem .9rem; }
  .lines-table tfoot td { border: 0; padding: 0; width: auto; }
}


/* --------------------------------------------------------------- pop-up (quick add customer / supplier) */
.modal-content { background: linear-gradient(180deg, var(--pop) 0%, var(--pop-2) 100%); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 20px; box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border-color: var(--line); }
.modal-backdrop.show { opacity: .45; }
:root[data-theme="dark"] .btn-close { filter: invert(1) grayscale(1) brightness(2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .btn-close { filter: invert(1) grayscale(1) brightness(2); } }
.quick-group > .form-select { flex: 1 1 auto; min-width: 0; }
.quick-group > .quick-add { flex: none; }


/* --------------------------------------------------------------- next steps bar (every way a document moves on) */
.next-steps .next-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.next-steps form { margin: 0; }
.next-btn { display: inline-flex; align-items: center; gap: .5rem; text-align: start; min-height: 44px; max-width: 100%; }
.next-btn .nb-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.next-btn .nb-l { font-weight: 600; }
.next-btn small { font-size: .72rem; opacity: .85; font-weight: 400; }
@media (max-width: 575.98px) { .next-steps .next-row > * { flex: 1 1 100%; } .next-steps .next-row .next-btn { width: 100%; } }

/* ---------------------------------------------------------------- product cards (Stock → Products) */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: .75rem; }
.pcard { position: relative; display: flex; gap: .8rem; align-items: flex-start; padding: .8rem; padding-inline-end: 2.6rem;
  border-radius: var(--r); background: var(--glass-strong); border: 1px solid var(--line); box-shadow: var(--shadow-sm); min-width: 0; }
.pcard-img { width: 64px; height: 64px; flex: none; border-radius: 12px; display: grid; place-items: center; overflow: hidden;
  background: var(--neutral-bg); color: var(--neutral-fg); font-size: 1.6rem; text-decoration: none; }
.pcard-img img { width: 100%; height: 100%; object-fit: cover; }
.pcard-body { min-width: 0; flex: 1; }
.pcard-name { display: block; font-weight: 700; line-height: 1.3; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.pcard-name:hover { color: var(--link); }
.pcard-code { color: var(--muted); font-size: .85rem; margin-top: .1rem; }
.pcard-line { color: var(--ink-2); font-size: .88rem; margin-top: .2rem; }
.pcard-star { position: absolute; top: .4rem; inset-inline-end: .4rem; margin: 0; }
.pcard-star .btn { padding: .2rem .35rem; color: var(--muted); font-size: 1.15rem; line-height: 1; }
.pcard-star .btn[aria-pressed="true"] { color: #C98A00; }
:root[data-theme="dark"] .pcard-star .btn[aria-pressed="true"] { color: #F5C542; }
:root[data-theme="contrast"] .pcard { border-width: 2px; box-shadow: none; }
:root[data-theme="contrast"] .pcard-star .btn[aria-pressed="true"] { color: #000000; }

/* document line changed but not saved yet (saved automatically before the page's other buttons) */
.line-dirty input:not([type=hidden]), .line-dirty select { border-color: #f59e0b !important; box-shadow: 0 0 0 .15rem rgba(245, 158, 11, .25); }

/* --------------------------------------------------------------- live document screens (lines without page reloads) */
/* total + last added item + Post: stays in view while lines are added (phones: above the tab bar) */
.doc-bar { position: sticky; bottom: 12px; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem .9rem; margin-top: 1rem; padding: .6rem .8rem; border-radius: var(--r); }
.doc-bar-info { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .9rem; flex: 1 1 12rem; min-width: 0; }
.doc-bar-total { white-space: nowrap; color: var(--muted); }
.doc-bar-total b { color: var(--ink); font-size: 1.3rem; }
.doc-bar-last { font-size: .85rem; color: var(--ok-fg, var(--muted)); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-bar-btns { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-inline-start: auto; }
@media (max-width: 991.98px) { .doc-bar { bottom: calc(86px + env(safe-area-inset-bottom)); } }
/* the line just added: flashes, and keeps a mark on the start edge when animations are off */
tr.line-new { animation: line-new 2.4s ease-out; }
tr.line-new > td:first-child { box-shadow: inset 4px 0 0 var(--brand-2); }
:root[dir="rtl"] tr.line-new > td:first-child { box-shadow: inset -4px 0 0 var(--brand-2); }
@keyframes line-new { 0%, 40% { background: color-mix(in srgb, var(--brand-2) 22%, transparent); } 100% { background: transparent; } }
.scan-status { margin-top: .6rem; font-size: .95rem; color: var(--muted); }
.scan-status b { color: var(--ink); }
[data-camera-scan][aria-pressed="true"] { background: var(--brand-2); color: var(--on-accent, #FFFFFF); }
#scanner video { border-radius: 12px; }

/* customer / supplier picker: type to search instead of a list of everyone */
.pick { position: relative; flex: 1 1 auto; min-width: 0; }
.pick .pick-native { position: absolute; inset-inline-start: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.pick .scan-suggest { top: calc(100% + 4px); }
.quick-group > .pick { flex: 1 1 auto; min-width: 0; }
.pick-sub { font-size: .8rem; color: var(--muted); }

/* unit dropdown under the item of an editable document line (catalog/_line_unit.html) */
.line-unit-form { margin: .25rem 0 0; }
.line-unit-form .form-select { width: auto; max-width: 100%; font-weight: 400; }
/* =====================================================================
   DIMENSION SCALE — standard business-app sizes (13.6px text, 30px controls, 32px list rows).
   Look, colours and page structure are unchanged; only sizes, padding and radii come from these tokens.
   The user's density setting only moves the tokens: normal (default) · compact (tighter).
   Phones (<= 575px) add 40px tap targets; see "phones" at the end.
   ===================================================================== */
:root {
  --fs: .85rem;            /* body text */
  --lh: 1.4;
  --cy: .3rem;             /* control padding, vertical  -> 30px inputs and buttons */
  --cx: .6rem;
  --td-y: .4rem;           /* table cell padding         -> 32px rows */
  --td-x: .6rem;
  --gap: .75rem;           /* space between blocks (cards, sections) */
  --pad-card: .8rem;
  --ic: 1rem;              /* icon size in buttons and menus */
  --touch: 40px;
}
:root[data-density="compact"] {
  --fs: .8rem; --cy: .2rem; --cx: .5rem; --td-y: .26rem; --td-x: .5rem; --gap: .5rem; --pad-card: .6rem;
}
html { font-size: 16px; }
body { font-size: var(--fs); line-height: var(--lh); }
h1, .h1 { font-size: 1.3rem; } h2, .h2 { font-size: 1.15rem; } h3, .h3 { font-size: 1.05rem; }
h4, .h4 { font-size: 1rem; } h5, .h5 { font-size: .95rem; } h6, .h6 { font-size: .88rem; }
h1, h2, h3, h4, h5, h6 { line-height: 1.25; }
.small, small { font-size: .78rem; }
.bi { line-height: 1; vertical-align: -.125em; }
.btn .bi, .dropdown-item .bi, .tile .bi, .badge .bi { font-size: .95em; }

/* ---- top bar */
.appbar { top: 6px; width: calc(100% - 16px); margin-top: 6px; gap: 8px; padding: 4px 8px; border-radius: 14px; }
.brand { gap: .45rem; }
.brand b { font-size: .98rem; }
.logo { width: 30px; height: 30px; border-radius: 9px; box-shadow: 0 3px 10px var(--brand-glow), inset 0 0 0 1px var(--line); }
.logo-letter { font-size: .95rem; }
.modnav { gap: 1px; margin-inline: 4px; }
.mod-pill { height: 32px; gap: .35rem; padding-inline: 4px 9px; border-radius: 10px; font-size: .82rem; }
.mod-pill .ic { width: 24px; height: 24px; border-radius: 7px; font-size: .8rem; }
.mod-pill .chev { font-size: .6rem; }
.mod-pill.active, .mod.open .mod-pill.active { box-shadow: 0 3px 10px color-mix(in srgb, var(--c) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, .25); }
.mega { top: calc(100% + 8px); min-width: 340px; padding: 8px; border-radius: 14px; }
.mega-head { padding: 2px 4px 6px; font-size: .88rem; }
.mega-head .ic, .sheet-sec h6 .ic { width: 22px; height: 22px; border-radius: 7px; font-size: .75rem; }
.mega-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); gap: 2px; }
.tile { gap: .5rem; padding: 5px 8px; border-radius: 9px; font-size: .84rem; }
.tile .ic { width: 26px; height: 26px; border-radius: 8px; font-size: .82rem; }
.tools { gap: 6px; }
.search-pill { height: 32px; padding-inline: 10px; border-radius: 10px; font-size: .82rem; }
.btn-round { height: 32px; border-radius: 10px; padding-inline: 11px; }
.btn-icon { width: 32px; height: 32px; border-radius: 10px; font-size: .95rem; }
.btn-user { height: 32px; border-radius: 10px; padding-inline: 4px; }
.avatar { width: 24px; height: 24px; border-radius: 7px; font-size: .72rem; }
.badge-dot { top: -4px; inset-inline-end: -4px; min-width: 16px; height: 16px; padding: 0 4px; font-size: .62rem; box-shadow: 0 0 0 1.5px var(--pop); }
.content { padding: 12px 14px 2rem; }
.theme-row button { font-size: .68rem; padding: 4px 2px; border-radius: 7px; }
.theme-row button i { font-size: .9rem; }
.menu-label { font-size: .66rem; }
.notif-head { padding: 8px 12px; font-size: .88rem; }
.notif-item { padding: 6px 8px; border-radius: 9px; gap: .55rem; }
.notif-item .ic, .toast-card .ic, .pal-item .ic { width: 26px; height: 26px; border-radius: 8px; font-size: .82rem; }
.notif-item .tx { font-size: .82rem; }
.toasts { top: 56px; gap: 6px; }
.toast-card { padding: 8px 8px 8px 10px; border-radius: 12px; gap: .55rem; }
.toast-card .tx { font-size: .84rem; }
.palette-box { border-radius: 14px; }
.palette-input { padding: 10px 12px; }
.palette-input input { font-size: .95rem; }
.pal-item { padding: 5px 8px; border-radius: 9px; font-size: .84rem; }
.pal-item .ic { width: 24px; height: 24px; }

/* ---- page head, cards */
.page-head { gap: .5rem; margin: 2px 0 var(--gap); }
.page-head h1 { font-size: 1.25rem; }
.back { font-size: .8rem; margin-bottom: 0; }
/* search / filter fields in the page head sit on one line, at their own width, not one under the other */
.page-head form.d-flex > .form-control, .page-head form.d-flex > .form-select { width: auto; flex: 0 1 11rem; }
.page-head form.d-flex { align-items: center; }
@media (min-width: 576px) { .page-head form.d-flex { flex-wrap: nowrap !important; } }
.card { --bs-card-border-radius: var(--r); --bs-card-inner-border-radius: calc(var(--r) - 1px); }
.card-header { padding: .45rem var(--pad-card); font-size: .88rem; }
.card-body { padding: var(--pad-card); }
.card.p-4 { padding: 1rem !important; }
.card.p-3 { padding: var(--pad-card) !important; }
.card .table thead tr:first-child > :first-child { border-start-start-radius: calc(var(--r) - 1px); }
.card .table thead tr:first-child > :last-child { border-start-end-radius: calc(var(--r) - 1px); }
a.card:hover { transform: none; }

/* ---- lists and tables: 32px rows, numbers on the end edge in tabular figures */
.table > :not(caption) > * > * { padding: var(--td-y) var(--td-x); }
.table-sm > :not(caption) > * > * { padding: calc(var(--td-y) - .1rem) calc(var(--td-x) - .1rem); }
.table thead th { font-size: .68rem; letter-spacing: .04em; padding-block: calc(var(--td-y) - .05rem); }
.table .text-end, .table .num, .table .money, .table th.text-end { font-variant-numeric: tabular-nums; }
.table tfoot td, .table tfoot th { font-weight: 700; border-top: 1px solid var(--line-strong); }
.totals td { padding: .2rem .5rem; }
.totals tr.grand td { font-size: 1.05rem; }
.table-wrap { border-radius: var(--r); }

/* ---- buttons and inputs: one control height everywhere */
.btn { --bs-btn-padding-y: var(--cy); --bs-btn-padding-x: .75rem; --bs-btn-font-size: var(--fs); --bs-btn-line-height: var(--lh);
  --bs-btn-border-radius: 7px; border-radius: 7px; }
.btn-sm { --bs-btn-padding-y: calc(var(--cy) - .12rem); --bs-btn-padding-x: .55rem; --bs-btn-font-size: .78rem; --bs-btn-border-radius: 6px; border-radius: 6px; }
.btn-lg { --bs-btn-padding-y: calc(var(--cy) + .12rem); --bs-btn-padding-x: .9rem; --bs-btn-font-size: .95rem; --bs-btn-border-radius: 8px; border-radius: 8px; }
.btn-primary, .btn-success { box-shadow: 0 3px 8px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn-success { box-shadow: 0 3px 8px var(--success-glow); }
.btn-primary:hover, .btn-success:hover, .btn-danger:hover { transform: none; }
.btn-light, .btn-glass, .btn-outline-secondary { box-shadow: none; }
.form-control, .form-select { padding: var(--cy) var(--cx); font-size: var(--fs); line-height: var(--lh); border-radius: var(--r-sm); }
.form-select { padding-inline-end: 1.9rem; background-size: 14px 10px; }
.form-control-sm, .form-select-sm { padding: calc(var(--cy) - .1rem) .5rem; font-size: .78rem; border-radius: 5px; }
.form-select-sm { padding-inline-end: 1.7rem; }
.form-control-lg, .form-select-lg { padding: calc(var(--cy) + .12rem) .75rem; font-size: .95rem; border-radius: 8px; }
.form-control:focus, .form-select:focus { box-shadow: 0 0 0 3px var(--focus-ring); }
textarea.form-control { min-height: 3.6rem; }
.form-label { font-size: .78rem; margin-bottom: .15rem; }
.form-text { font-size: .72rem; margin-top: .15rem; }
.form-check { min-height: 1.3rem; margin-bottom: 0; }
.form-check-input { width: 1em; height: 1em; margin-top: .22em; }
.input-group-text { padding: var(--cy) var(--cx); font-size: var(--fs); }
.row.g-3 { --bs-gutter-x: .75rem; --bs-gutter-y: .6rem; }
.row.g-2 { --bs-gutter-x: .5rem; --bs-gutter-y: .5rem; }
.errorlist, .invalid { font-size: .76rem; margin-top: .1rem; }

/* ---- menus, alerts, badges, tabs */
.dropdown-menu { --bs-dropdown-font-size: var(--fs); border-radius: 10px; padding: 4px; }
.dropdown-item { padding: .3rem .6rem; border-radius: 6px; font-size: var(--fs); }
.dropdown-item i { font-size: .95rem; }
.alert { padding: .5rem .75rem; margin-bottom: var(--gap); border-radius: 8px; font-size: var(--fs); }
.badge { padding: .28em .6em; font-size: .72em; }
.nav-pills .nav-link, .nav-tabs .nav-link { padding: .3rem .7rem; font-size: var(--fs); }
.breadcrumb { font-size: .8rem; margin-bottom: .4rem; }
.pagination { --bs-pagination-padding-x: .6rem; --bs-pagination-padding-y: .2rem; --bs-pagination-font-size: .82rem; }
.kbd { font-size: .64rem; }
.modal-content { border-radius: 12px; }
.modal-header { padding: .6rem 1rem; }
.modal-body { padding: .8rem 1rem; }
.modal-footer { padding: .5rem 1rem; }
.modal-title { font-size: 1rem; }

/* ---- dashboard and app launcher */
.kpi { padding: .65rem .8rem; gap: .65rem; }
.kpi .v { font-size: 1.2rem; }
.kpi .l { font-size: .76rem; }
.kpi-ic { width: 34px; height: 34px; border-radius: 10px; font-size: 1rem; box-shadow: 0 3px 8px color-mix(in srgb, var(--c) 28%, transparent); }
.launcher-wrap { margin-top: 0; }
.launcher-search { margin-bottom: 1rem; }
.launcher-search input { height: 40px; border-radius: 10px; font-size: .95rem; padding-inline: 40px 12px; }
.launcher-search i { inset-inline-start: 14px; font-size: .95rem; }
.app { gap: .35rem; padding: 4px 2px; }
.app-ic { width: 60px; height: 60px; border-radius: 16px; }
.app-glyph { width: 40px; height: 40px; border-radius: 11px; font-size: 1.15rem; box-shadow: 0 4px 10px color-mix(in srgb, var(--c) 28%, transparent), inset 0 1px 0 rgba(255, 255, 255, .3); }
.app-badge { min-width: 20px; height: 20px; font-size: .66rem; top: -4px; inset-inline-end: -4px; }
.app-lbl { font-size: .8rem; }
.launcher-groups { columns: 3 300px; column-gap: .75rem; }
.lgroup { margin-bottom: .75rem; border-radius: var(--r); padding: .6rem .7rem .75rem; }
.lgroup-head { font-size: .88rem; margin-bottom: .6rem; gap: .45rem; }
.lgroup-head .ic { width: 24px; height: 24px; border-radius: 7px; font-size: .78rem; }
.lgroup .launcher { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: .7rem .3rem; }
.lgroup .app-ic { width: 52px; height: 52px; border-radius: 14px; }
.lgroup .app-glyph { width: 36px; height: 36px; border-radius: 10px; font-size: 1.05rem; }
.lgroup .app-lbl { font-size: .76rem; }

/* ---- documents: lines, bars, next steps, product cards */
.sticky-actions, .doc-bar { padding: .45rem .7rem; margin-top: var(--gap); border-radius: var(--r); }
.sticky-actions { bottom: 8px; }
.doc-bar { bottom: 8px; }
.doc-bar-total b { font-size: 1.1rem; }
.doc-bar-last { font-size: .8rem; }
.next-btn { min-height: 34px; }
.next-btn small { font-size: .7rem; }
.scanbox { padding: .7rem; margin-bottom: var(--gap); border-radius: var(--r); }
.scanbox input[name=q] { font-size: .95rem; }
.scan-opt { min-height: 40px; padding: .35rem .6rem; }
.pgrid { gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.pcard { padding: .6rem; padding-inline-end: 2.2rem; gap: .65rem; border-radius: var(--r); }
.pcard-img { width: 52px; height: 52px; border-radius: 9px; font-size: 1.3rem; }
.pcard-line { font-size: .82rem; }
.pcard-code { font-size: .78rem; }
.flow-doc { padding: .05rem .5rem; }
.doc-flow .card-body { padding: .45rem .7rem; font-size: .8rem; }
.w-qty { max-width: 96px; } .w-price { max-width: 116px; }
.line-form .form-control { min-width: 4rem; }

/* ---- tablets and phones: the tab bar floats at the bottom, so everything that must stay in reach sits above it */
:root { --tabbar-h: 62px; }
.tabbar { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); padding: 3px 4px; border-radius: 16px; }
.tab { gap: 1px; padding: 2px; font-size: .64rem; border-radius: 12px; }
.tab .ic { width: 34px; height: 26px; border-radius: 9px; font-size: 1rem; }
.sheet { border-radius: 18px; padding: 2px 12px calc(14px + env(safe-area-inset-bottom)); }
.sheet-grip { margin: 6px auto 8px; height: 4px; }
.sheet-sec { padding: 2px 0 8px; }
.sheet-sec h6 { font-size: .82rem; }
@media (max-width: 991.98px) {
  .appbar { top: 6px; width: calc(100% - 12px); margin-top: 6px; padding: 4px 6px; border-radius: 14px; }
  .content { padding: 10px 8px calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 1.15rem; }
  .toasts { top: 52px; }
  .sticky-actions, .doc-bar { position: sticky; bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom)); z-index: 6; }
}

/* ---- phones */
@media (max-width: 575.98px) {
  .content { padding-inline: 8px; }
  .btn, .form-control, .form-select, .input-group-text { min-height: var(--touch); }
  .btn-sm, .form-control-sm, .form-select-sm { min-height: 36px; }
  .btn-close { min-width: var(--touch); min-height: var(--touch); }
  .btn-icon, .btn-round, .btn-user, .search-pill { height: 38px; min-height: 0; }
  .btn-icon { width: 38px; }
  .table > :not(caption) > * > * { padding-block: .5rem; }
  .dropdown-item, .tile, .pal-item { min-height: 40px; }
  .page-head > form, .page-head .search, .page-head > .actions { flex: 1 1 100%; max-width: none !important; }
  .page-head .form-control, .page-head .form-select { max-width: 100% !important; }
  .page-head form.d-flex { flex: 1 1 100%; }
  .page-head form.d-flex > .form-control, .page-head form.d-flex > .form-select { flex: 1 1 8rem; }
  .page-head .btn.ms-auto { margin-inline-start: 0 !important; }
  .card.p-4 { padding: .8rem !important; }
  .row.g-3 > [class*="col-md"], .row.g-3 > [class*="col-sm"] { flex: 0 0 100%; max-width: 100%; }
  .app-glyph { width: 38px; height: 38px; font-size: 1.1rem; } .app-ic { width: 56px; height: 56px; }
  .lgroup .app-ic { width: 52px; height: 52px; } .lgroup .app-glyph { width: 36px; height: 36px; font-size: 1.05rem; }
  .lgroup .app-lbl, .app-lbl { font-size: .72rem; }
  .launcher-search input { height: 42px; }
  .kpi { padding: .6rem .7rem; } .kpi .v { font-size: clamp(.95rem, 4.4vw, 1.2rem); }
  /* lists: tables scroll inside their own card, the first column (number / name) stays in view */
  .table-wrap .table:not(.lines-table) > :is(thead, tbody, tfoot) > tr > :first-child {
    position: sticky; inset-inline-start: 0; z-index: 1; background: var(--pop); white-space: nowrap; max-width: 44vw; overflow: hidden; text-overflow: ellipsis; }
  .table-wrap .table:not(.lines-table) > thead > tr > :first-child { background: var(--pop); }
  .table-wrap { overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
  /* the scan / add row of document screens: item on its own line, then qty + Add + camera, then New product */
  .scanbox .row { display: grid; grid-template-columns: minmax(64px, 1fr) 2fr auto; gap: .5rem; margin: 0; align-items: end; }
  .scanbox .row > * { padding: 0; margin: 0; width: auto; max-width: none; flex: none; }
  .scanbox .row > .col-12 { grid-column: 1 / -1; }
  .scanbox .row > .d-flex { display: contents !important; }
  .scanbox .row > .d-flex > [data-quick-product] { grid-column: 1 / -1; }
  .scanbox .row > .d-flex > .btn { min-width: 0; }
  /* full-screen pop-ups */
  .modal-dialog { margin: 0; max-width: none; width: 100%; min-height: 100%; }
  .modal-dialog:not(.modal-dialog-scrollable) .modal-content { min-height: 100dvh; }
  .modal-content { border-radius: 0; border: 0; }
  .modal-dialog-scrollable .modal-content { max-height: 100dvh; }
  .form-actions { position: sticky; bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom)); z-index: 6; display: flex; gap: .5rem; padding: .5rem .7rem;
    margin-top: var(--gap); border-radius: var(--r); background: var(--glass-strong); border: 1px solid var(--glass-edge); box-shadow: var(--shadow);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
  .form-actions .btn { flex: 1 1 auto; }
}
@media (max-width: 575.98px) and (pointer: coarse) {
  .form-control, .form-select, .scanbox input[name=q] { font-size: 16px; }  /* below 16px phones zoom the page when a field is tapped */
}
@media print { .form-actions { display: none !important; } }
