/* Karobix Billing v1.0 — self-contained UI (no CDN, works offline) */
:root {
  --brand: #0f4c81; --brand-dark: #0b3a63; --accent: #e8711a;
  --bg: #f2f5f8; --card: #ffffff; --line: #dbe2e8;
  --text: #1d2a35; --muted: #64748b; --ok: #15803d; --err: #b91c1c;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Tahoma, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.app { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--brand-dark); color: #e8eef5; flex-shrink: 0; }
.sidebar .logo { padding: 16px; font-size: 17px; font-weight: 700; color: #fff; background: var(--brand); letter-spacing: .3px; }
.sidebar .logo span { color: #ffd9b3; }
.sidebar .group { padding: 10px 16px 4px; font-size: 11px; text-transform: uppercase; color: #9fb4c8; letter-spacing: .8px; }
.sidebar a.nav { display: block; padding: 8px 16px; color: #dce7f2; font-size: 13.5px; }
.sidebar a.nav:hover, .sidebar a.nav.active { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; }
.topbar .title { font-size: 16px; font-weight: 600; }
.topbar .user { color: var(--muted); font-size: 13px; }
.content { padding: 20px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 8px; padding: 12px 14px; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 20px; font-weight: 700; margin-top: 2px; }
.stat.warn { border-left-color: var(--accent); }

table.grid { width: 100%; border-collapse: collapse; background: var(--card); }
table.grid th { background: #eef2f6; text-align: left; padding: 8px 10px; border: 1px solid var(--line); font-size: 12.5px; }
table.grid td { padding: 7px 10px; border: 1px solid var(--line); }
table.grid tr:hover td { background: #f8fafc; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.btn { display: inline-block; background: var(--brand); color: #fff; border: none; padding: 8px 14px; border-radius: 6px; font-size: 13.5px; cursor: pointer; }
.btn:hover { background: var(--brand-dark); color: #fff; text-decoration: none; }
.btn.secondary { background: #e2e8f0; color: var(--text); }
.btn.secondary:hover { background: #cbd5e1; }
.btn.danger { background: var(--err); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }

form.inline { display: inline; }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 8px 0 3px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=email], input[type=time], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font-size: 13.5px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #bcd3e8; border-color: var(--brand); }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 160px; }
.check { display: flex; align-items: center; gap: 6px; margin: 8px 0; }
.check input { width: auto; }
.check label { margin: 0; color: var(--text); }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 13.5px; }
.alert.ok { background: #dcfce7; color: var(--ok); border: 1px solid #86efac; }
.alert.err { background: #fee2e2; color: var(--err); border: 1px solid #fca5a5; }
.alert.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; }
.badge.ok { background: #dcfce7; color: var(--ok); }
.badge.err { background: #fee2e2; color: var(--err); }
.badge.muted { background: #e2e8f0; color: var(--muted); }
.badge.warn { background: #ffedd5; color: #c2410c; }

.toolbar { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar > div { min-width: 140px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.page-head h2 { margin: 0; font-size: 18px; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--brand-dark), var(--brand)); }
.login-box { background: #fff; border-radius: 10px; padding: 30px; width: 360px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.login-box h1 { font-size: 20px; margin: 0 0 4px; color: var(--brand-dark); }
.login-box .sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

/* Invoice print (IRD format) */
.invoice-print { background: #fff; padding: 26px; max-width: 820px; margin: 0 auto; border: 1px solid var(--line); }
.invoice-print .doc-title { text-align: center; font-size: 17px; font-weight: 700; text-decoration: underline; margin: 6px 0; }
.invoice-print .copy-tag { text-align: center; font-size: 12px; font-weight: 600; color: #444; }
.invoice-print .co-name { text-align: center; font-size: 19px; font-weight: 700; }
.invoice-print .co-sub { text-align: center; font-size: 12.5px; color: #333; }
.invoice-print table.inv { width: 100%; border-collapse: collapse; margin-top: 10px; }
.invoice-print table.inv th, .invoice-print table.inv td { border: 1px solid #333; padding: 5px 8px; font-size: 12.5px; }
.invoice-print table.inv th { background: #f1f5f9; }
.invoice-print .totals td { font-weight: 600; }
.invoice-print .meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; }
.invoice-print .sign { display: flex; justify-content: space-between; margin-top: 48px; font-size: 12.5px; }
.invoice-print .sign div { border-top: 1px dashed #333; padding-top: 4px; width: 180px; text-align: center; }
.cancelled-stamp { position: absolute; font-size: 48px; color: rgba(185,28,28,.35); transform: rotate(-20deg); font-weight: 800; margin: 120px 0 0 180px; }

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }
  .invoice-print { border: none; }
}

/* v1.1 keyboard hints */
.keys { font-size: 11.5px; color: var(--muted); background: #eef2f6; border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; }
.hintbar { font-size: 12px; color: var(--muted); background: #f8fafc; border: 1px dashed var(--line); border-radius: 6px; padding: 6px 10px; margin-bottom: 10px; }
.hintbar b { color: var(--brand); }

/* v1.3 — top bar modules + sidebar submenus */
.topnav { display: flex; align-items: center; background: var(--brand-dark); color: #e8eef5; padding: 0 16px 0 0; position: sticky; top: 0; z-index: 20; }
.topnav .logo { padding: 13px 18px; font-size: 16px; font-weight: 700; color: #fff; background: var(--brand); letter-spacing: .3px; }
.topnav .logo span { color: #ffd9b3; }
.topnav .modules { display: flex; flex: 1; }
.topnav a.module { color: #cfdded; padding: 14px 16px; font-size: 13.5px; font-weight: 600; }
.topnav a.module:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.topnav a.module.active { color: #fff; background: var(--brand); border-bottom: 3px solid var(--accent); padding-bottom: 11px; }
.topnav .user { color: #b9c9da; font-size: 12.5px; white-space: nowrap; }
.topnav .user a { color: #ffd9b3; }

.app { min-height: calc(100vh - 48px); }
.sidebar { display: flex; flex-direction: column; }
.sidebar a.nav.active { background: rgba(255,255,255,.14); color: #fff; border-left: 3px solid var(--accent); padding-left: 13px; }
.sidebar-bottom { margin-top: auto; padding-bottom: 14px; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar a.nav.recent { font-size: 12.5px; color: #b9c9da; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumb { color: var(--muted); font-size: 12.5px; }

/* v1.4 — no sidebar; submenu bar under main menu */
a.logo { text-decoration: none; }
.topnav a.logo:hover { text-decoration: none; filter: brightness(1.1); }
.subnav { display: flex; gap: 2px; background: #fff; border-bottom: 2px solid var(--line); padding: 0 14px; position: sticky; top: 48px; z-index: 19; overflow-x: auto; }
.subnav a.subitem { padding: 10px 14px; font-size: 13px; color: var(--text); font-weight: 500; white-space: nowrap; border-bottom: 3px solid transparent; }
.subnav a.subitem:hover { color: var(--brand); text-decoration: none; background: #f4f7fa; }
.subnav a.subitem.active { color: var(--brand); border-bottom-color: var(--accent); font-weight: 700; }
.main { display: block; }
@media print { .subnav { display: none !important; } }

/* v1.5 — 80mm thermal roll print */
.roll-print { background: #fff; width: 300px; margin: 0 auto; padding: 10px 12px; border: 1px solid var(--line); font-family: "Courier New", monospace; font-size: 12px; color: #000; }
.roll-print .r-center { text-align: center; }
.roll-print .r-bold { font-weight: 700; }
.roll-print .r-lg { font-size: 14px; }
.roll-print .r-line { border-top: 1px dashed #000; margin: 5px 0; }
.roll-print .r-row { display: flex; justify-content: space-between; }
.roll-print table.r-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.roll-print table.r-table th { border-bottom: 1px dashed #000; font-weight: 700; padding: 1px 2px; }
.roll-print table.r-table td { padding: 1px 2px; vertical-align: top; }
@media print {
  .roll-print { border: none; width: 72mm; padding: 0; }
  @page { margin: 4mm; }
}

/* v1.6 — barcode labels */
.label-sheet { display: grid; gap: 0; background: #fff; margin: 0 auto; }
.label { box-sizing: border-box; overflow: hidden; padding: 1mm 1.5mm; display: flex; flex-direction: column; justify-content: space-between; text-align: center; border: 1px dotted #ccc; }
.label .lbl-co { font-size: .95em; font-weight: 700; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label .lbl-name { font-size: 1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label .lbl-bar { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.label .lbl-bar svg { width: 100%; height: 100%; max-height: 9mm; }
.label .lbl-foot { display: flex; justify-content: center; gap: 2.5mm; line-height: 1; }
.label .lbl-price { font-weight: 800; font-size: 1.55em; line-height: 1; }
.label .lbl-code { text-align: center; font-size: .85em; letter-spacing: .4px; line-height: 1; white-space: nowrap; overflow: hidden; }
@media print {
  .label { border: none; }
  .label-sheet { margin: 0; }
  @page { margin: 0; }
}

/* v1.10 — company letterhead on printed reports */
.report-head { display: none; }
@media print {
  .report-head { display: block; text-align: center; margin-bottom: 12px; border-bottom: 2px solid #000; padding-bottom: 6px; }
  .report-head .rh-name { font-size: 18px; font-weight: 700; color: #000; }
  .report-head .rh-sub { font-size: 11px; color: #333; }
  .report-head .rh-title { font-size: 14px; font-weight: 700; margin-top: 5px; text-transform: uppercase; letter-spacing: .4px; }
}

/* v1.10 — redesigned billing page */
.bill-main { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.bill-lines { flex: 3; min-width: 540px; }
.paybox { flex: 1; min-width: 300px; position: sticky; top: 60px; }
.bill-grid td { padding: 5px 6px; }
.bill-grid input, .bill-grid select { font-size: 15px; padding: 9px 10px; }
.bill-grid input[name$=".Qty"] { font-size: 17px; font-weight: 700; text-align: right; background: #fffbeb; }
.bill-grid input[name$=".Rate"] { text-align: right; }
.bill-grid td.lineAmt { font-size: 15px; font-weight: 600; }
#scanBox { font-size: 16px; padding: 11px 12px; background: #f0f7ff; border-color: #9ec3e6; }
.paybox .pay-row { display: flex; justify-content: space-between; align-items: center; margin: 7px 0; font-size: 14px; }
.paybox .pay-row .val { font-weight: 600; }
.paybox .pay-grand { background: var(--brand-dark); color: #fff; border-radius: 8px; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; margin: 10px 0 8px; }
.paybox .pay-grand .val { font-size: 26px; font-weight: 800; letter-spacing: .3px; }
.paybox .pay-change { background: #dcfce7; color: #14532d; border-radius: 8px; padding: 9px 14px; display: flex; justify-content: space-between; align-items: center; font-size: 16px; font-weight: 700; }
.paybox input#tTendered { font-size: 20px; font-weight: 700; text-align: right; }
.paybox .duo { display: flex; gap: 8px; }
.btn.xl { font-size: 16px; padding: 12px 18px; width: 100%; margin-top: 10px; text-align: center; }

/* v1.11 — direct print page with IRD copies */
body.print-only-page { background: #e8ecf0; margin: 0; padding: 12px; }
.printbar { display: flex; gap: 10px; align-items: center; max-width: 820px; margin: 0 auto 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; font-size: 13.5px; }
.printbar span { flex: 1; }
.inv-copy { margin-bottom: 14px; }
.roll-print .r-cut { text-align: center; margin: 10px 0 4px; color: #000; }
@media print {
  body.print-only-page { background: #fff; padding: 0; }
  .inv-copy { margin: 0; page-break-after: always; break-after: page; }
  .inv-copy:last-child { page-break-after: auto; break-after: auto; }
  .roll-print.inv-copy { page-break-after: auto; break-after: auto; }   /* roll: continuous paper, cut line instead */
}

/* v1.11 — billing page: searchable pickers, header strip, paper choice */
.muted { color: var(--muted); font-size: 12px; }
.bill-head { display: flex; gap: 18px; align-items: flex-start; padding: 12px 16px; }
.bill-no { min-width: 150px; border-right: 1px solid var(--line); padding-right: 16px; }
.bill-no .lbl { font-size: 11.5px; color: var(--muted); }
.bill-no .val { font-size: 26px; font-weight: 800; color: var(--brand-dark); line-height: 1.1; margin: 2px 0 4px; }
.bill-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.row-hint { font-size: 11.5px; color: var(--muted); margin-top: 2px; min-height: 14px; }
.row-hint.low { color: var(--err); font-weight: 600; }
.bill-grid .itemSearch { font-weight: 600; background: #f0f7ff; border-color: #9ec3e6; }
.suggest { position: absolute; z-index: 60; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); max-height: 320px; overflow-y: auto; }
.suggest .sg { padding: 7px 12px; cursor: pointer; border-bottom: 1px solid #f1f5f9; font-size: 13.5px; }
.suggest .sg small { color: var(--muted); font-size: 11.5px; }
.suggest .sg.on, .suggest .sg:hover { background: #e8f1fb; }
.paper-pick { display: flex; gap: 12px; align-items: center; margin: 12px 0 2px; font-size: 13px; }
.paper-pick label { display: inline-flex; align-items: center; gap: 4px; margin: 0; color: var(--text); font-size: 13px; }
.paper-pick input { width: auto; }
.btn.xl small { font-weight: 400; opacity: .8; font-size: 12px; }

/* v1.12 — dashboard */
.rolepill { display: inline-block; background: #e8f1fb; color: var(--brand-dark); border-radius: 12px; padding: 1px 9px; font-size: 11.5px; font-weight: 600; }
.topnav .rolepill { background: rgba(255,255,255,.18); color: #fff; }
.dash-hero { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.dash-greet { font-size: 22px; font-weight: 700; color: var(--brand-dark); }
.dash-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-actions .btn small { font-weight: 400; opacity: .75; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; border-top: 4px solid var(--line); }
.kpi.brand { border-top-color: var(--brand); } .kpi.warn { border-top-color: var(--accent); } .kpi.err { border-top-color: var(--err); } .kpi.ok { border-top-color: var(--ok); }
.kpi .k-label { color: var(--muted); font-size: 12px; }
.kpi .k-value { font-size: 22px; font-weight: 800; margin-top: 3px; letter-spacing: -.2px; }
.kpi .k-foot { color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.kpi .up { color: var(--ok); font-weight: 600; } .kpi .down { color: var(--err); font-weight: 600; }
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 4px; }
.dash-grid .card { margin-bottom: 0; }
.dash-grid .span2 { grid-column: span 2; }
.chart-card h3 { margin-bottom: 8px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .dash-grid { grid-template-columns: 1fr; } .dash-grid .span2 { grid-column: span 1; } }
/* v1.12 — role editor */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 6px 14px; margin-top: 8px; }
.perm { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; margin: 0; padding: 5px 6px; border-radius: 6px; cursor: pointer; }
.perm:hover { background: #f4f7fa; }
.perm input { width: auto; margin-top: 3px; }
.perm small { color: var(--muted); font-size: 11px; }
.perm.risky span { color: #7a3b00; }

/* v1.13 — top bar context + user menu + avatars */
.topnav .user { display: flex; align-items: center; gap: 12px; }
.topnav .ctx { color: #dbe7f3; font-size: 12.5px; background: rgba(255,255,255,.12); padding: 4px 10px; border-radius: 14px; white-space: nowrap; }
.topnav .ctx:hover { background: rgba(255,255,255,.22); }
.topnav .ctx-k { opacity: .7; font-size: 11px; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 7px; color: #fff; white-space: nowrap; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu .uname { font-size: 13px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 64px; height: 64px; font-size: 26px; }
.usermenu .menu { position: absolute; right: 0; top: 36px; background: #fff; color: var(--text); min-width: 240px; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 28px rgba(0,0,0,.18); z-index: 80; padding: 6px 0; }
.usermenu .menu a { display: block; padding: 8px 14px; color: var(--text); font-size: 13.5px; }
.usermenu .menu a:hover { background: #f1f5f9; }
.usermenu .menu-head { padding: 8px 14px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.usermenu .menu-sep { border-top: 1px solid var(--line); margin: 4px 0; }
.item-thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); vertical-align: middle; }
.item-photo { max-width: 100%; max-height: 220px; border: 1px solid var(--line); border-radius: 6px; }
.suggest .sg { display: flex; gap: 10px; align-items: center; }
.suggest .sg img { width: 30px; height: 30px; object-fit: cover; border-radius: 4px; }

/* v1.14 */
.topnav .logo { display:flex; align-items:center; gap:8px; }
.logo-mark { width: 26px; height: 26px; border-radius: 6px; }

/* v1.15 — login page */
.login-body { margin: 0; min-height: 100vh; background: #e9eef3; }
.login-split { display: flex; min-height: 100vh; }
.login-brand { flex: 1.1; background: linear-gradient(160deg, #0b3a63 0%, #0f4c81 60%, #146aa8 100%); color: #e8eef5; padding: 48px 52px; display: flex; flex-direction: column; justify-content: space-between; }
.lb-logo { max-height: 90px; max-width: 320px; display: block; }
.lb-logo.own { background: #fff; padding: 10px 14px; border-radius: 10px; }
.lb-company { font-size: 26px; font-weight: 800; margin-top: 18px; color: #fff; }
.lb-np { font-size: 16px; color: #dbe7f3; }
.lb-addr { font-size: 13px; color: #b9cce0; margin-top: 6px; line-height: 1.5; }
.lb-points { list-style: none; padding: 0; margin: 30px 0; }
.lb-points li { padding: 7px 0 7px 26px; position: relative; font-size: 14.5px; }
.lb-points li::before { content: "✓"; position: absolute; left: 0; color: #e8711a; font-weight: 800; }
.lb-foot { font-size: 12.5px; color: #b9cce0; display: flex; align-items: center; gap: 8px; }
.login-form { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; }
.lf-box { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 30px 32px; box-shadow: 0 12px 40px rgba(15,76,129,.12); }
.lf-box h1 { margin: 0 0 4px; font-size: 24px; color: var(--brand-dark); }
.lf-box label { margin-top: 12px; }
.lf-box .btn.xl { margin-top: 18px; }
@media (max-width: 860px) { .login-split { flex-direction: column; } .login-brand { padding: 28px 24px; } .lb-points { display: none; } }
/* letterhead / invoice logo */
.report-head .rh-logo, .invoice-print .inv-logo { max-height: 60px; max-width: 220px; display: block; margin: 0 auto 4px; }

/* ===== v1.16 reports: filters, tiles, interactive grid, hub, statement ===== */
.topnav .datemode { display: inline-flex; border: 1px solid rgba(255,255,255,.35); border-radius: 14px; overflow: hidden; margin-right: 8px; font-size: 12px; }
.topnav .datemode a { color: #dbe7f3; padding: 3px 9px; text-decoration: none; }
.topnav .datemode a.on { background: #fff; color: var(--brand); font-weight: 700; }
.rpt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.rpt-head h2 { margin: 0 0 2px; font-size: 20px; }
.rf { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.rf-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end; }
.rf-row + .rf-row { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.rf-presets { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.chip { display: inline-block; padding: 5px 11px; border-radius: 16px; border: 1px solid var(--line); background: #f8fafc; font-size: 12.5px; color: var(--text); text-decoration: none; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.rf-dates { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.rf-dates label, .rf-more label { margin: 0; display: inline-flex; flex-direction: column; gap: 3px; font-size: 12px; }
.rf-dates input, .rf-more input, .rf-more select { padding: 6px 8px; font-size: 13px; }
.rf-more select.wide { min-width: 220px; }
.rf-actions { display: flex; justify-content: space-between; align-items: center; margin: 0 0 8px; gap: 8px; flex-wrap: wrap; }
.rf-actions input[type=search] { padding: 6px 9px; width: 180px; }
.rpt-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 8px; padding: 10px 12px; }
.tile .k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tile .v { font-size: 20px; font-weight: 700; margin-top: 2px; }
.tile .v.small { font-size: 15px; }
.tile .v.warn, .tile .h.warn { color: var(--accent); }
.tile .h { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.rpt-grid-wrap { overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
table.rpt-grid { width: 100%; border: 0; margin: 0; }
table.rpt-grid thead th { position: sticky; top: 0; background: #eef2f6; z-index: 1; white-space: nowrap; }
table.rpt-grid th.sortable { cursor: pointer; user-select: none; }
table.rpt-grid th.sortable:hover { color: var(--brand); }
table.rpt-grid th .arrow { font-size: 10px; color: var(--brand); }
table.rpt-grid tbody tr.link { cursor: pointer; }
table.rpt-grid tbody tr:hover td { background: #eaf2fb; }
table.rpt-grid tbody tr.link:hover td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
table.rpt-grid tfoot td { font-weight: 700; background: #eef2f6; border-top: 2px solid #cbd5e1; position: sticky; bottom: 0; }
table.rpt-grid td.rt, table.rpt-grid th:last-child.num { background: #f8fafc; }
table.rpt-grid td { white-space: nowrap; }
.rpt-hub { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.hub-item { display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--text); border: 1px solid transparent; }
.hub-item:hover { background: #f1f5f9; border-color: var(--line); }
.hub-item b { display: block; color: var(--brand); }
.hub-item small { color: var(--muted); }
.stmt-head { display: flex; justify-content: space-between; border-bottom: 2px solid var(--brand); padding-bottom: 10px; margin-bottom: 10px; }
.stmt-to { margin-bottom: 10px; }
.stmt-foot { margin-top: 28px; font-size: 12px; color: var(--muted); }
.statement .rpt-tiles { grid-template-columns: repeat(4, 1fr); }
@media print {
  .rf, .rf-actions, .datemode { display: none !important; }
  .rpt-grid-wrap { overflow: visible; border: 0; }
  table.rpt-grid thead th, table.rpt-grid tfoot td { position: static; }
  table.rpt-grid td { white-space: normal; }
  .tile { border-left-width: 2px; }
  .statement .rpt-head h2, .statement .rpt-head .muted, .statement h3 { display: none; }
}

/* ===== v1.17 server-side paging + sticky header / first column on every grid ===== */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 2px; font-size: 13px; }
.pager .pages a, .pager .size a { display: inline-block; min-width: 28px; text-align: center; padding: 4px 7px; margin: 0 1px; border: 1px solid var(--line); border-radius: 5px; text-decoration: none; color: var(--text); background: var(--card); }
.pager .pages a.on, .pager .size a.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pager .pages a.dis { opacity: .4; pointer-events: none; }
.pager .size { color: var(--muted); }
.grid-wrap { overflow: auto; max-height: calc(100vh - 210px); background: var(--card); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.grid-wrap table.grid { margin: 0; border: 0; width: 100%; }
.grid-wrap table.grid thead th, .grid-wrap table.grid > tr:first-child th, .grid-wrap table.grid > tbody > tr:first-child th { position: sticky; top: 0; z-index: 2; background: #eef2f6; box-shadow: inset 0 -1px 0 #cbd5e1; }
.grid-wrap table.grid td:first-child, .grid-wrap table.grid th:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); box-shadow: inset -1px 0 0 var(--line); }
.grid-wrap table.grid th:first-child { z-index: 3; background: #eef2f6; }
.grid-wrap table.grid tr:hover td:first-child { background: #f8fafc; }
.grid-wrap table.grid tfoot td { position: sticky; bottom: 0; background: #eef2f6; z-index: 2; }
.grid-wrap table.grid tfoot td:first-child { z-index: 3; }
table.rpt-grid td:first-child, table.rpt-grid th:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); box-shadow: inset -1px 0 0 var(--line); }
table.rpt-grid thead th:first-child, table.rpt-grid tfoot td:first-child { z-index: 3; background: #eef2f6; }
table.rpt-grid tbody tr:hover td:first-child { background: #eaf2fb; }
.rpt-grid-wrap { max-height: calc(100vh - 300px); }
.grid-count { font-size: 12.5px; color: var(--muted); margin: 4px 0; }
.items-filters label { margin: 0; display: inline-flex; flex-direction: column; font-size: 12px; }
.items-filters input, .items-filters select { padding: 6px 8px; font-size: 13px; }
@media print {
  .grid-wrap, .rpt-grid-wrap { max-height: none; overflow: visible; border: 0; }
  .grid-wrap table.grid th, .grid-wrap table.grid td, table.rpt-grid th, table.rpt-grid td { position: static !important; box-shadow: none; }
  .pager { display: none; }
}
.isug { position: absolute; left: 0; top: 100%; z-index: 50; min-width: 100%; max-height: 320px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.isug-row { padding: 7px 10px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 13px; border-bottom: 1px solid #f1f5f9; }
.isug-row.on, .isug-row:hover { background: #eaf2fb; }
.isug-row b { grid-column: 1; }
.isug-code { grid-column: 1; font-size: 11.5px; color: var(--muted); }
.isug-meta { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 12px; color: var(--muted); white-space: nowrap; }
/* top-bar quick search */
.topnav .qsearch { position: relative; margin-right: 10px; }
.topnav .qsearch input { width: 200px; padding: 5px 10px; border-radius: 14px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.14); color: #fff; font-size: 12.5px; outline: none; }
.topnav .qsearch input::placeholder { color: #c7d6e6; }
.topnav .qsearch input:focus { background: #fff; color: var(--text); width: 300px; }
.qs-box { position: absolute; right: 0; top: 34px; width: 420px; max-height: 70vh; overflow: auto; background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); z-index: 100; text-align: left; }
.qs-group { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 12px 2px; background: #f8fafc; }
.qs-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 12px; text-decoration: none; color: var(--text); border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.qs-row small { display: block; color: var(--muted); font-size: 11.5px; }
.qs-row.on, .qs-row:hover { background: #eaf2fb; }
.qs-right { white-space: nowrap; color: var(--muted); font-size: 12px; }
.qs-all { justify-content: center; color: var(--brand); font-weight: 600; }

/* =====================================================================
   v1.17 FINAL THEME — one consistent professional look across the system
   (loaded last on purpose: refines the base rules above without renaming classes)
   ===================================================================== */
:root { --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08); --shadow-lg: 0 10px 30px rgba(16,24,40,.14); --focus: 0 0 0 3px rgba(15,76,129,.18); --brand-50: #eaf2fb; --brand-100: #d7e6f6; }
html { scroll-behavior: smooth; }
body { font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", Arial, sans-serif; line-height: 1.45; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { letter-spacing: -.01em; color: #0f1f2e; }
h2 { font-size: 20px; margin: 0 0 10px; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
::selection { background: var(--brand-100); }
*::-webkit-scrollbar { width: 10px; height: 10px; } *::-webkit-scrollbar-thumb { background: #c6d0db; border-radius: 10px; border: 2px solid #f2f5f8; } *::-webkit-scrollbar-thumb:hover { background: #a9b7c6; }

/* top bar: gradient, cleaner spacing */
.topnav { background: linear-gradient(90deg, #0b3a63 0%, #0f4c81 70%, #145a94 100%); box-shadow: 0 2px 8px rgba(0,0,0,.18); min-height: 48px; }
.topnav .logo { font-weight: 800; letter-spacing: .02em; }
.topnav .modules .module { border-radius: 6px 6px 0 0; transition: background .15s; }
.subnav { box-shadow: 0 2px 6px rgba(16,24,40,.05); }
.subnav .subitem { border-radius: 6px 6px 0 0; }
.topbar { background: transparent; border-bottom: 0; padding: 10px 20px 0; }
.topbar .crumb { font-size: 12px; color: var(--muted); }
.topbar .crumb a { color: var(--muted); } .topbar .crumb a:hover { color: var(--brand); }
.topbar .crumb .cur { color: var(--text); font-weight: 600; }
.content { padding: 18px 20px 28px; max-width: 1600px; width: 100%; margin-left: auto; margin-right: auto; box-sizing: border-box; }
.page-head { margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.page-head h2 { margin: 0; }

/* surfaces */
.card, .rf, .tile, .stat, .grid-wrap, .rpt-grid-wrap, .login-box { border-radius: var(--radius); box-shadow: var(--shadow); }
.card { padding: 16px 18px; }
.card h3 { padding-bottom: 8px; border-bottom: 1px solid #eef2f6; margin-bottom: 12px; }

/* buttons: same height everywhere, focus ring, subtle motion */
.btn { font-weight: 600; line-height: 1.2; padding: 8px 14px; border-radius: 8px; transition: background .15s, transform .05s, box-shadow .15s; box-shadow: 0 1px 1px rgba(16,24,40,.08); white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn.secondary { background: #fff; color: var(--brand-dark); border: 1px solid #cbd5e1; }
.btn.secondary:hover { background: var(--brand-50); border-color: #9fb9d4; }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.danger:hover { background: #991b1b; }

/* inputs: consistent height, hover + focus states */
input[type=text], input[type=password], input[type=number], input[type=date], input[type=email], input[type=time], input[type=search], select, textarea { border-radius: 8px; transition: border-color .15s, box-shadow .15s; min-height: 36px; }
input:hover, select:hover, textarea:hover { border-color: #b4c2d1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
input[type=search] { width: 100%; padding: 7px 9px; border: 1px solid var(--line); font-size: 13.5px; }
select:not([multiple]):not([size]) { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%); background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 26px; }
label { font-weight: 500; }

/* old-style toolbars get the same card look as report filters */
form.toolbar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; gap: 10px 14px; }
form.toolbar label { margin: 0 0 3px; font-size: 12px; }
form.toolbar > div { min-width: 150px; }

/* tables */
table.grid { border-radius: var(--radius); overflow: hidden; }
table.grid th { font-weight: 600; color: #334155; text-transform: uppercase; font-size: 11.5px; letter-spacing: .04em; }
table.grid td { font-size: 13.5px; }
table.grid tbody tr:nth-child(even) td, table.grid tr:nth-child(even) td { background: #fbfcfd; }
table.grid tr:hover td, table.grid tbody tr:hover td { background: #f1f6fb; }
table.rpt-grid tbody tr:hover td { background: #e7f0fa; }
table.grid td a:not(.btn) { font-weight: 500; }
.grid-wrap table.grid, table.rpt-grid { border-radius: 0; overflow: visible; }

/* alerts, badges */
.alert { display: flex; align-items: center; gap: 10px; border-radius: 8px; box-shadow: var(--shadow); }
.alert.ok::before { content: "✓"; font-weight: 800; }
.alert.err::before { content: "!"; font-weight: 800; background: var(--err); color: #fff; border-radius: 50%; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.badge { letter-spacing: .02em; }

/* chips, pager, tiles */
.chip { transition: all .12s; }
.tile { transition: box-shadow .15s; } .tile:hover { box-shadow: var(--shadow-lg); }
.hub-item { transition: background .12s; }
.pager .pages a:hover, .pager .size a:hover { border-color: var(--brand); color: var(--brand); }

/* empty state */
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* footer */
.app-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; padding: 12px 20px; margin-top: auto; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); background: #fff; }
.app-foot a { color: var(--brand); }
.main { min-height: calc(100vh - 48px); display: flex; flex-direction: column; }

@media print { .topbar, .app-foot { display: none !important; } body { background: #fff; } .card, .tile { box-shadow: none; } }

.topnav .qs-row, .topnav .qs-row b { color: var(--text); } .topnav .qs-all { color: var(--brand); }
table.grid td:first-child, table.rpt-grid td:first-child { white-space: nowrap; }

/* F1 help popup */
.help-modal { position: fixed; inset: 0; background: rgba(10,25,41,.55); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 24px; backdrop-filter: blur(2px); }
.help-box { width: min(1100px, 100%); height: min(88vh, 900px); background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; animation: helpIn .15s ease-out; }
@keyframes helpIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.help-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.help-head input[type=search] { width: 200px; min-height: 30px; padding: 4px 8px; margin-left: 8px; display: inline-block; }
.help-box iframe { flex: 1; border: 0; width: 100%; }

/* =====================================================================
   v1.18 RESPONSIVE — phones, tablets, small laptops
   ===================================================================== */
.grid-wrap:not(.tall) { max-height: none; }
.grid-wrap.entry table.grid td:first-child, .grid-wrap.entry table.grid th:first-child { position: static; box-shadow: none; }
.grid-wrap.entry table.grid thead th, .grid-wrap.entry table.grid tr:first-child th { position: static; }
.card, .tile, .stat { min-width: 0; }
canvas { max-width: 100%; }
img { max-width: 100%; }
.bill-lines { min-width: 0; flex-basis: 540px; }
@media (max-width: 1180px) {
  .topnav { flex-wrap: wrap; padding-right: 8px; }
  .topnav .logo { padding: 11px 14px; }
  .topnav .modules { order: 3; flex: 0 0 100%; overflow-x: auto; scrollbar-width: none; border-top: 1px solid rgba(255,255,255,.12); }
  .topnav .modules::-webkit-scrollbar { display: none; }
  .topnav a.module { padding: 10px 14px; white-space: nowrap; }
  .topnav a.module.active { padding-bottom: 7px; }
  .topnav .user { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; white-space: normal; }
  .topnav .qsearch input { width: 150px; } .topnav .qsearch input:focus { width: 220px; } .qs-box { width: min(420px, 92vw); }
  .subnav { position: static; }
  .content { padding: 12px 14px 24px; }
}
@media (max-width: 900px) {
  .topnav .ctx { display: none; }
  .bill-main { flex-direction: column; } .bill-lines, .paybox { flex: none; width: 100%; min-width: 0; max-width: none; }
  .bill-head { flex-wrap: wrap; }
  .rpt-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rpt-head { flex-direction: column; }
  .rf-dates { flex-wrap: wrap; }
  .rf-more select.wide { min-width: 0; width: 100%; }
  .rf-more label, .items-filters label { width: 100%; }
  .rf-more input[type=text], .rf-more select, .rf-more input[type=search], .items-filters input, .items-filters select { width: 100%; }
  .pager { justify-content: center; }
  .dash-hero { flex-direction: column; align-items: stretch; }
  .dash-hero .dash-greet { font-size: 20px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head { flex-direction: column; align-items: flex-start; }
  form.toolbar > div { min-width: 0; flex: 1 1 45%; }
  .rpt-hub { grid-template-columns: 1fr; }
  .app-foot { flex-direction: column; font-size: 11.5px; }
  .help-modal { padding: 8px; } .help-box { height: 94vh; } .help-head input[type=search] { width: 110px; }
}
@media (max-width: 560px) {
  body { font-size: 13.5px; }
  .topnav .qsearch { flex: 1 1 100%; margin: 6px 0 0; order: 4; } .topnav .qsearch input, .topnav .qsearch input:focus { width: 100%; }
  .topnav .user { flex: 1 1 auto; justify-content: flex-end; }
  .kpis, .rpt-tiles { grid-template-columns: 1fr; }
  .statement .rpt-tiles { grid-template-columns: 1fr 1fr; }
  .stat .value, .tile .v { font-size: 18px; }
  .rf-presets .chip { padding: 4px 9px; font-size: 12px; }
  .rf-dates label { width: auto; }
  .btn { padding: 8px 12px; }
  .pager .pages a { min-width: 24px; padding: 4px 5px; }
  .rpt-head h2, h2 { font-size: 18px; }
  .login-box { padding: 20px 16px; }
  .bill-grid input, .bill-grid select { font-size: 14px; padding: 7px 6px; }
  .grid-wrap.tall { max-height: 70vh; }
}
@media (max-width: 900px) {
  .paybox { position: static; }
  .bill-grid .itemSearch { min-width: 170px; } .bill-grid input[name$=".Description"] { min-width: 130px; } .bill-grid input[name$=".Qty"] { min-width: 64px; } .bill-grid input[name$=".Rate"] { min-width: 90px; } .bill-grid input[name$=".Discount"] { min-width: 60px; }
}
@media (max-width: 560px) { .topnav { position: static; } .subnav { position: static; } }
@media (max-width: 900px) {
  .rf-row:first-child { flex-direction: column; align-items: stretch; }
  .rf-dates { display: flex; flex-direction: row; align-items: flex-end; gap: 8px; }
  .rf-dates label { width: auto; flex: 1; } .rf-dates input { width: 100%; }
  .rf-more label, .items-filters label { width: calc(50% - 7px); }
  .rf-more button, .rf-more .btn { align-self: flex-end; }
}
@media (max-width: 560px) { .rf-more label, .items-filters label { width: 100%; } }
@media (max-width: 900px) { .rf-dates { flex-wrap: nowrap; } .rf-dates label { flex: 0 0 auto; width: auto; } .rf-dates input { flex: 1 1 0; width: auto; min-width: 0; } }
.credit-box { margin-top: 4px; font-size: 12.5px; padding: 5px 9px; border-radius: 6px; background: #eaf2fb; color: var(--brand-dark); }
.credit-box.bad { background: #fee2e2; color: var(--err); }
.row-hint .sch { color: var(--ok); font-style: normal; font-weight: 600; }
/* v1.20.1 — centre the page on wide screens (breadcrumb lines up with the content) */
.topbar { padding-left: 0; padding-right: 0; }
.topbar .crumb { max-width: 1600px; margin-left: auto; margin-right: auto; padding-left: 20px; padding-right: 20px; box-sizing: border-box; width: 100%; }
@media (max-width: 900px) { .topbar .crumb { padding-left: 14px; padding-right: 14px; } }
/* v1.21 — page opened from the mobile app: the app has its own menu, so hide the top bar */
body.in-app .topnav { display: none; }
body.in-app .subnav { top: 0; }
body.in-app .content { padding-top: 10px; }
/* v1.20.3 — A4 invoice / quotation: one copy per page, signatures and "Printed …" line at the bottom of the page */
.invoice-print.fill-page { display: flex; flex-direction: column; }
.invoice-print.fill-page .inv-foot { margin-top: auto; }
@page a4doc { size: A4 portrait; margin: 12mm 12mm 10mm 12mm; }
@media print {
  .invoice-print.fill-page { page: a4doc; box-sizing: border-box; max-width: none; width: 100%; padding: 0; margin: 0;
    min-height: 272mm; /* 297mm − 22mm page margins, minus a little slack so rounding never spills onto a blank page */ }
  .invoice-print.fill-page .inv-foot { break-inside: avoid; page-break-inside: avoid; padding-top: 10px; }
  .invoice-print.fill-page .inv-foot .sign { margin-top: 28px; }
  .invoice-print.fill-page table.inv tr { break-inside: avoid; page-break-inside: avoid; }
}
@media print {
  body:has(.fill-page) .content { padding: 0 !important; max-width: none; }
  body:has(.fill-page) .main { min-height: 0 !important; display: block; }
}
.qs-empty { padding: 10px 12px; color: var(--muted); font-size: 13px; }
.qs-box { max-height: 70vh; overflow-y: auto; }
/* v1.20.4 — user menu icons as inline SVG (the old emoji / ⏻ glyphs were missing in some Windows fonts) */
.usermenu .menu a { display: flex; align-items: center; gap: 10px; }
.usermenu .menu a svg { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.usermenu .menu a.logout { color: #b91c1c; }
/* v1.20.4 — stable pages: in-place refresh of lists / reports, and a smooth hand-over on full page loads */
.content.soft-loading { opacity: .55; pointer-events: none; transition: opacity .12s; }
.pager .pager-print { text-decoration: none; color: var(--brand); border: 1px solid var(--line); border-radius: 5px; padding: 4px 9px; background: var(--card); font-size: 12.5px; }
.pager .pager-print:hover { border-color: var(--brand); }

/* ================= v1.20.4 — print format for every list and report =================
   Printing a list / report gives: company letterhead + period line + the table only (no summary boxes, filters, buttons, pager),
   A4 landscape, ruled grid, header row repeated on every page, rows never split. */
/* v1.36.3 — the landscape page is set for the WHOLE print job by a small script in the layout (kbxPageSize). A named page on .content alone
   made browsers mix portrait and landscape sheets in one printout, with the table not filling the sheet and an empty last page. */
@media print {
  body:has(.content .grid, .content .rpt-grid) .content { padding: 0 !important; max-width: none !important; }
  body:has(.content .grid, .content .rpt-grid) .main { min-height: 0 !important; display: block; }
  body:has(.content .grid, .content .rpt-grid) :is(.rpt-tiles, .tiles, .kpis, .stats, .rf, .rf-more, .rf-actions, .pager, .page-head .btn, .page-head form,
      form.toolbar, .items-filters, .period-chips, .chips, .alert, .btn, .datemode, .rpt-head .btn) { display: none !important; }
  /* the letterhead already carries the page title: keep only the period / note line of reports, drop list page titles */
  body:has(.content .grid, .content .rpt-grid) .rpt-head h2, body:has(.content .grid, .content .rpt-grid) .page-head h2 { display: none !important; }
  body:has(.content .grid, .content .rpt-grid) .rpt-head { display: block; text-align: center; margin: -6px 0 8px; }
  body:has(.content .grid, .content .rpt-grid) .rpt-head .muted { font-size: 9.5pt; color: #222; }
  body:has(.content .grid, .content .rpt-grid) .page-head { margin: 0; min-height: 0; }
  body:has(.content .grid, .content .rpt-grid) .card { border: 0 !important; box-shadow: none !important; padding: 0 !important; background: none !important; }
  .grid-wrap, .rpt-grid-wrap { max-height: none !important; overflow: visible !important; border: 0 !important; box-shadow: none !important; }
  table.grid, table.rpt-grid { width: 100% !important; border-collapse: collapse !important; font-size: 9pt; color: #000; }
  table.grid th, table.grid td, table.rpt-grid th, table.rpt-grid td {
    border: 0.6pt solid #888 !important; padding: 3px 5px !important; white-space: normal !important; position: static !important; box-shadow: none !important;
    background: none !important; color: #000 !important; }
  table.grid thead th, table.rpt-grid thead th { background: #e9edf2 !important; font-weight: 700; text-transform: none; letter-spacing: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.grid thead, table.rpt-grid thead { display: table-header-group; }
  table.grid tfoot, table.rpt-grid tfoot { display: table-row-group; }
  table.grid tfoot td, table.rpt-grid tfoot td, table.grid tr.total td { font-weight: 700; border-top: 1.2pt solid #000 !important; }
  table.grid tr, table.rpt-grid tr { break-inside: avoid; page-break-inside: avoid; }
  table.grid td .btn, table.grid td form, table.grid td button, table.grid .row-actions, table.rpt-grid .arrow { display: none !important; }
  table.grid a, table.rpt-grid a { color: #000 !important; text-decoration: none !important; }
  table.grid .badge, table.grid .pill { border: 0; background: none !important; padding: 0; color: #000 !important; }
}
@media print {
  table.grid td.num, table.grid th.num, table.grid td.nw, table.grid td:first-child, table.rpt-grid td.num { white-space: nowrap !important; }
  table.grid.wide, table.rpt-grid.wide { font-size: 7.8pt; }
  table.grid.wide th, table.grid.wide td { padding: 2px 3px !important; }
}
/* v1.20.4 — clickable breadcrumb trail + Back button */
.topbar .crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.topbar .crumb a { color: var(--brand); text-decoration: none; border-radius: 4px; padding: 1px 3px; }
.topbar .crumb a:hover { text-decoration: underline; background: rgba(15,76,129,.06); }
.topbar .crumb a.cur { color: var(--text); font-weight: 600; }
.topbar .crumb .sep { color: var(--muted); }
.topbar .crumb .crumb-back { display: inline-flex; align-items: center; gap: 3px; border: 1px solid var(--line); background: var(--card); padding: 2px 9px 2px 5px; margin-right: 6px; color: var(--text); font-weight: 500; }
.topbar .crumb .crumb-back:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.topbar .crumb .crumb-back svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
/* v1.20.4 — sortable columns on every list */
table.grid thead th.sortable { cursor: pointer; user-select: none; }
table.grid thead th.sortable:hover { color: var(--brand); }
table.grid thead th.sorted { color: var(--brand); }
table.grid thead th .sort-arrow { font-size: 10px; }
@media print { table.grid thead th .sort-arrow { display: none; } }
/* v1.21.1 — line entry (doclines.js) and BS hints */
.lp-wrap { position: relative; }
.lp-wrap .lp-input { width: 100%; }
.lp-box { position: absolute; left: 0; right: 0; top: 100%; z-index: 60; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 26px rgba(0,0,0,.14); max-height: 300px; overflow-y: auto; }
.lp-row { padding: 7px 10px; cursor: pointer; font-size: 13.5px; display: flex; justify-content: space-between; gap: 10px; }
.lp-row small { color: var(--muted); white-space: nowrap; }
.lp-row.on, .lp-row:hover { background: #eef5fc; }
table[data-lines] td.line-amt { font-weight: 600; white-space: nowrap; vertical-align: middle; }
.grid .line-x { border: 0; background: none; color: #b91c1c; font-size: 15px; cursor: pointer; padding: 4px 6px; border-radius: 5px; }
.grid .line-x:hover { background: #fee2e2; }
.lines-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 2px 2px; }
.lines-foot .lines-sum { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13.5px; }
.bs-hint { font-size: 11.5px; color: var(--muted); margin-top: 3px; min-height: 14px; }
@media print { .lines-foot .lines-add, .line-x, .bs-hint { display: none !important; } }
table.grid[data-lines] { overflow: visible; }
.label.label-skip { border-color: transparent; }
.label .lbl-mrp { text-decoration: line-through; font-size: 5.5pt; color: #555; }
/* v1.21.4 — barcode label desk (POS style) */
.lbl-desk { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
.lbl-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.lbl-main .card, .lbl-side { margin: 0; }
.lbl-scan-row { display: flex; gap: 12px; align-items: stretch; }
.lbl-scan { position: relative; flex: 1; display: flex; align-items: center; }
.lbl-scan > svg { position: absolute; left: 14px; width: 24px; height: 24px; stroke: var(--brand); stroke-width: 2; fill: none; pointer-events: none; }
.lbl-scan input { width: 100%; font-size: 18px; padding: 14px 14px 14px 48px; border: 2px solid #9ec3e6; background: #f0f7ff; border-radius: 10px; }
.lbl-scan input:focus { border-color: var(--brand); outline: none; background: #fff; }
.lbl-scan .lp-box { top: calc(100% + 4px); max-height: 420px; }
.lbl-scan .lp-row { padding: 9px 12px; font-size: 14px; align-items: center; }
.lbl-step { display: flex; flex-direction: column; justify-content: center; font-size: 12px; color: var(--muted); }
.lbl-step input { width: 80px; font-size: 16px; text-align: center; padding: 8px; }
.lbl-quick { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.lbl-quick select { width: auto; max-width: 320px; font-size: 13px; padding: 6px 8px; }
.lbl-hint { font-size: 13px; font-weight: 600; }
.lbl-hint.ok { color: #15803d; } .lbl-hint.err { color: #b91c1c; }
.lbl-queue-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.lbl-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.lbl-tools input { width: 70px; padding: 5px 6px; }
.danger-text { color: #b91c1c !important; }
.lbl-queue tr.flash td { animation: lblflash 1.2s ease-out; }
@keyframes lblflash { from { background: #dcfce7; } to { background: transparent; } }
.lbl-queue .nobc, .lbl-total .nobc { color: #b45309; font-size: 12px; }
.lbl-queue td.neg { color: #b91c1c; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; vertical-align: middle; }
.stepper button { border: 0; background: #f1f5f9; width: 30px; height: 32px; font-size: 17px; cursor: pointer; color: var(--text); }
.stepper button:hover { background: #e2e8f0; }
.stepper input { width: 58px; border: 0; text-align: center; font-weight: 700; font-size: 15px; padding: 0; height: 32px; border-radius: 0; }
.link-btn { border: 0; background: none; color: var(--brand); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.link-btn:hover { text-decoration: underline; }
.lbl-empty { display: flex; gap: 16px; align-items: center; justify-content: center; padding: 40px 20px; color: var(--muted); text-align: left; }
.lbl-empty svg { width: 54px; height: 54px; stroke: #9ec3e6; stroke-width: 2; fill: none; flex: 0 0 auto; }
.lbl-total { display: flex; gap: 20px; justify-content: flex-end; padding: 10px 4px 0; font-size: 14px; }
.lbl-side h3 { margin: 0 0 8px; font-size: 15px; }
.lbl-side label { display: block; font-size: 12.5px; color: var(--muted); margin: 10px 0 4px; }
.lbl-checks label { display: flex; align-items: center; gap: 8px; color: var(--text); margin: 6px 0; font-size: 13.5px; }
.lbl-checks input { width: auto; }
.lbl-preview-wrap { background: repeating-conic-gradient(#f1f5f9 0% 25%, #fff 0% 50%) 50% / 14px 14px; border: 1px solid var(--line); border-radius: 8px; padding: 18px; display: flex; justify-content: center; }
.lbl-preview { background: #fff; border: 1px solid #94a3b8 !important; box-shadow: 0 2px 8px rgba(0,0,0,.08); transform: scale(1.6); transform-origin: center; margin: 18px 0; max-width: 100%; }
.lbl-preview .lbl-bar img { width: 100%; height: 100%; max-height: 9mm; object-fit: fill; }
.lbl-side .btn.xl { margin-top: 14px; }
@media (max-width: 1100px) { .lbl-desk { grid-template-columns: 1fr; } .lbl-preview { transform: none; } }
.lbl-custom { display: flex; gap: 8px; margin-top: 6px; } .lbl-custom label { flex: 1; margin: 0; font-size: 11.5px; } .lbl-custom input { width: 100%; padding: 6px; }
/* v1.21.5 — custom label designer + rendered designs */
.kl-label { position: relative; background: #fff; overflow: hidden; color: #000; font-family: Arial, Helvetica, sans-serif; }
.kl-label .kl-el { position: absolute; display: flex; align-items: center; overflow: hidden; white-space: nowrap; line-height: 1.05; box-sizing: border-box; }
.kl-label .kl-el > span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.kl-label .kl-barcode { flex-direction: column; align-items: stretch; }
.kl-label .kl-barcode .bc-bars { flex: 1; min-height: 0; } .kl-label .kl-barcode img { width: 100%; height: 100%; display: block; object-fit: fill; }
.kl-label .kl-barcode .bc-hr { text-align: center; line-height: 1; font-size: .8em; padding-top: 1px; letter-spacing: .5px; }
.kl-label .kl-qr img { width: 100%; height: 100%; object-fit: contain; display: block; }
.kl-label .kl-box { border: 1px solid #000; }
.kl-label .mrp-strike { text-decoration: line-through; }
.kd-top { margin-bottom: 14px; }
.kd-top-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.kd-top-row label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.kd-top-row .kd-name { flex: 1; min-width: 220px; } .kd-top-row .kd-open select { min-width: 220px; }
.kd-top-row .kd-def { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 13px; padding-bottom: 8px; } .kd-def input { width: auto; }
.kd-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.kd-presets { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.kd-presets .chip { cursor: pointer; border: 1px solid var(--line); background: #f8fafc; border-radius: 14px; padding: 4px 10px; font-size: 12.5px; }
.kd-presets .chip:hover { border-color: var(--brand); color: var(--brand); }
.kd { display: grid; grid-template-columns: 250px minmax(0, 1fr) 270px; gap: 14px; align-items: start; }
.kd .card { margin: 0; }
.kd h3 { margin: 0 0 8px; font-size: 14px; }
.kd label { display: block; font-size: 12px; color: var(--muted); margin: 6px 0 2px; }
.kd label input, .kd label select { margin-top: 2px; }
.kd-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.kd-add { display: flex; flex-wrap: wrap; gap: 5px; } .kd-add .btn { font-size: 11.5px; padding: 4px 7px; }
.kd-check { display: flex !important; align-items: center; gap: 6px; color: var(--text) !important; font-size: 13px !important; } .kd-check input { width: auto; }
.kd-btns { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.kd-zoom { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font-size: 12.5px; margin-bottom: 10px; }
.kd-zoom label { display: flex; align-items: center; gap: 6px; margin: 0; } .kd-zoom input[type=checkbox] { width: auto; } .kd-zoom input[type=range] { width: 120px; }
.kd-stage { background: #e2e8f0; border-radius: 8px; padding: 30px 20px; overflow: auto; display: flex; justify-content: center; align-items: flex-start; min-height: 320px; }
.kd-canvas { outline: 1px dashed #64748b; box-shadow: 0 4px 18px rgba(0,0,0,.15); touch-action: none; }
.kd-canvas.grid-on { background-image: linear-gradient(to right, rgba(15,76,129,.07) 1px, transparent 1px), linear-gradient(to bottom, rgba(15,76,129,.07) 1px, transparent 1px); }
.kd-canvas .kl-el { cursor: move; outline: 1px dotted rgba(15,76,129,.35); }
.kd-canvas .kl-el:hover { outline: 1px solid rgba(15,76,129,.6); }
.kd-canvas .kl-el.sel { outline: 2px solid #e8711a; z-index: 5; overflow: visible; }
.kd-canvas .kl-line.sel, .kd-canvas .kl-line { min-height: 4px; }
.kd-handle { position: absolute; right: -6px; bottom: -6px; width: 11px; height: 11px; background: #e8711a; border: 2px solid #fff; border-radius: 3px; cursor: nwse-resize; }
.kd-tips { font-size: 12px; margin: 10px 0 0; }
@media (max-width: 1250px) { .kd { grid-template-columns: 1fr; } }
/* v1.21.6 — BS date box + calendar (bsdate.js) */
.bs-wrap { position: relative; display: block; }
.bs-wrap .bs-input { width: 100%; padding-right: 34px; font-variant-numeric: tabular-nums; letter-spacing: .3px; }
.bs-wrap .bs-input.bad { border-color: #dc2626; background: #fef2f2; }
.bs-wrap .bs-ic { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; padding: 4px; cursor: pointer; color: var(--muted); line-height: 0; }
.bs-wrap .bs-ic:hover { color: var(--brand); }
.bs-wrap .bs-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
td .bs-wrap .bs-input { min-width: 120px; }
.bs-pop { position: absolute; z-index: 300; width: 282px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 34px rgba(0,0,0,.18); padding: 10px; font-size: 13px; }
.bs-pop .bs-head { display: flex; gap: 4px; align-items: center; margin-bottom: 8px; }
.bs-pop .bs-head select { flex: 1; padding: 5px 6px; font-size: 13px; width: auto; }
.bs-pop .bs-head .bs-y { flex: 0 0 76px; }
.bs-pop .bs-head button { border: 1px solid var(--line); background: #f8fafc; border-radius: 6px; width: 30px; height: 30px; font-size: 18px; cursor: pointer; line-height: 1; }
.bs-pop .bs-head button:hover { border-color: var(--brand); color: var(--brand); }
.bs-pop .bs-wd, .bs-pop .bs-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.bs-pop .bs-wd span { font-size: 11px; color: var(--muted); padding: 2px 0; font-weight: 600; }
.bs-pop .bs-wd span:last-child { color: #b91c1c; }
.bs-pop .bs-days button { border: 0; background: none; height: 32px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text); }
.bs-pop .bs-days button:hover { background: #eef5fc; }
.bs-pop .bs-days button.sat { color: #b91c1c; }
.bs-pop .bs-days button.today { box-shadow: inset 0 0 0 1.5px var(--brand); font-weight: 700; }
.bs-pop .bs-days button.sel { background: var(--brand); color: #fff; font-weight: 700; }
.bs-pop .bs-foot { display: flex; gap: 6px; align-items: center; margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.bs-pop .bs-foot button { border: 1px solid var(--line); background: #f8fafc; border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 12.5px; }
.bs-pop .bs-foot button:hover { border-color: var(--brand); color: var(--brand); }
.bs-pop .bs-foot .muted { margin-left: auto; font-size: 11.5px; }
@media print { .bs-ic, .bs-pop { display: none !important; } }
/* v1.21.9 — invoice scan box (wireless barcode reader, scanning away from the counter) */
.scanbar { display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 8px 14px; align-items: center; background: #f0f7ff; border: 2px solid #9ec3e6; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.scanbar-in { position: relative; display: flex; align-items: center; }
.scanbar-in svg { position: absolute; left: 12px; width: 24px; height: 24px; stroke: var(--brand); stroke-width: 2; fill: none; pointer-events: none; }
.scanbar-in input { width: 100%; font-size: 19px; font-weight: 600; letter-spacing: .5px; padding: 12px 12px 12px 46px; border: 2px solid #9ec3e6; border-radius: 9px; background: #fff; }
.scanbar-in input:focus { border-color: var(--brand); outline: 3px solid rgba(15,76,129,.15); }
.scanbar-in input::placeholder { font-size: 14px; font-weight: 500; letter-spacing: 0; }
.scan-lock { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; color: var(--text); }
.scan-lock input { width: auto; }
.scan-last { grid-column: 1 / -1; display: flex; gap: 18px; align-items: baseline; flex-wrap: wrap; min-height: 30px; font-size: 15px; }
.scan-last.ok .sl-name { font-size: 22px; font-weight: 800; color: #15803d; }
.scan-last.err { font-size: 19px; color: #b91c1c; font-weight: 600; }
.scan-last .sl-qty { font-size: 22px; font-weight: 800; color: var(--text); }
.scan-last .sl-tot { font-size: 16px; color: var(--muted); }
.scan-last .sl-warn { font-size: 14px; color: #b45309; font-weight: 700; }
.scanbar.flash-ok { animation: scanok .6s ease-out; }
.scanbar.flash-err { animation: scanerr .9s ease-out; }
@keyframes scanok { from { background: #bbf7d0; } to { background: #f0f7ff; } }
@keyframes scanerr { 0%, 40% { background: #fecaca; border-color: #dc2626; } to { background: #f0f7ff; } }
#lines tr.row-flash td, table[data-lines] tr.row-flash td { animation: lblflash 1.2s ease-out; }
table[data-lines] tr.row-flash-err td, #lines tr.row-flash-err td { animation: scanerr .9s ease-out; }
@media (max-width: 760px) { .scanbar { grid-template-columns: 1fr; } }
@media print { .scanbar { display: none; } }
#scanBar #scanBox { padding-left: 48px !important; height: auto; }

/* ================= v1.22 — one input behaviour everywhere (ux.js) ================= */
/* typeable drop-downs */
.ux-hidden { display: none !important; }
.ux-wrap { position: relative; display: block; min-width: 0; }
label > .ux-wrap, .rf label > .ux-wrap { display: inline-block; vertical-align: middle; min-width: 150px; }
.ux-wrap .ux-input { width: 100%; padding-right: 28px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 14px; }
.ux-wrap .ux-input::placeholder { color: #475569; font-style: normal; opacity: 1; }   /* the "All / — choose —" entry of a list reads as a value */
.ux-wrap .ux-input:focus::placeholder { color: #a3b0c2; }
td .ux-wrap { min-width: 120px; }
.ux-drop { position: absolute; z-index: 400; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 30px rgba(15,23,42,.18); overflow-y: auto; font-size: 13.5px; }
.ux-row { padding: 7px 11px; cursor: pointer; display: flex; justify-content: space-between; gap: 14px; align-items: baseline; }
.ux-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ux-row small { color: var(--muted); white-space: nowrap; font-size: 11.5px; flex: 0 0 auto; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.ux-row.cur span { font-weight: 700; }
.ux-row.on, .ux-row:hover { background: #eaf2fb; }
.ux-row.none { color: var(--muted); cursor: default; background: none; }
input.ux-locked { background: #f1f5f9; color: #475569; }
/* every suggestion list in the system looks the same */
.isug, .lp-box, .suggest, .qs-box { border: 1px solid var(--line) !important; border-radius: 8px !important; box-shadow: 0 12px 30px rgba(15,23,42,.18) !important; font-size: 13.5px; }
.isug-row.on, .isug-row:hover, .lp-row.on, .lp-row:hover, .suggest .sg.on, .suggest .sg:hover { background: #eaf2fb !important; }
/* hints inside empty boxes must not look like entered values */
.content input::placeholder, .content textarea::placeholder { color: #a3b0c2; font-style: italic; font-weight: 400; opacity: 1; }
/* required-field and line messages */
.content input:user-invalid, .content textarea:user-invalid { border-color: #dc2626; background: #fef2f2; }
.ux-need-line { margin: 0 0 10px; }
table.ux-flash { outline: 2px solid #dc2626; outline-offset: 2px; transition: outline-color .3s; }
/* filter bars: every box on one baseline */
form.toolbar { align-items: flex-end; }
form.toolbar > div { display: flex; flex-direction: column; justify-content: flex-end; }
form.toolbar > div.check { flex-direction: row; align-items: center; justify-content: flex-start; gap: 6px; min-width: 0; height: 38px; padding: 0; margin: 0; align-self: flex-end !important; }
form.toolbar > div.check label { margin: 0; font-size: 13px; }
form.toolbar > div:has(> button), form.toolbar > div:has(> .btn) { min-width: 0; }
form.toolbar input, form.toolbar select, form.toolbar .ux-input, form.toolbar .bs-input { height: 38px; box-sizing: border-box; }
form.toolbar .btn { height: 38px; display: inline-flex; align-items: center; }
select.discMode { min-width: 64px; padding-left: 6px; padding-right: 4px; }
@media print { .ux-drop { display: none !important; } .ux-wrap .ux-input { background-image: none; } }

/* ================= v1.22.1 — the same pattern for the same kind of form ================= */
/* one control height and shape everywhere */
.content input[type=text], .content input[type=password], .content input[type=number], .content input[type=email], .content input[type=url], .content input[type=tel],
.content input[type=search], .content input[type=time], .content input[type=date], .content select, .content .ux-input, .content .bs-input, .content .lp-input {
  height: 38px; box-sizing: border-box; padding: 7px 10px; font-size: 13.5px; border: 1px solid var(--line); border-radius: 8px; background-color: #fff; width: 100%; }
.content .ux-input, .content .lp-input { padding-right: 28px; }
.content .bs-input { padding-right: 34px; }
.content textarea { box-sizing: border-box; padding: 8px 10px; font-size: 13.5px; border: 1px solid var(--line); border-radius: 8px; width: 100%; }
.content input[type=number] { text-align: right; }
.content td input[type=text], .content td input[type=number], .content td select, .content td .ux-input, .content td .lp-input, .content td .bs-input { height: 36px; }
/* item pickers of line tables look like every other drop-down */
.lp-wrap .lp-input { text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 14px; }
/* special screens keep their own large boxes */
.content .scanbar-in input, .content .lbl-scan input { height: auto; padding-left: 48px; font-size: 18px; }
.content .paybox input, .content .bill-grid td input, .content .stepper input, .content .lbl-tools input, .content .lbl-step input, .content .kd input, .content .kd select, .content .kd .ux-input { height: auto; }
.content .stepper input { height: 32px; border: 0; padding: 0; width: 58px; }
.content .discVal { width: 70px !important; display: inline-block; } .content select.discMode { width: 68px !important; display: inline-block; height: 36px; }
/* labels */
.content label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.content label.req::after { content: " *"; color: #dc2626; font-weight: 700; }
/* buttons: one height; the same button bar at the foot of every entry form */
.content .btn:not(.small):not(.xl) { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; box-sizing: border-box; vertical-align: middle; }
.content .btn.small { min-height: 30px; display: inline-flex; align-items: center; gap: 4px; box-sizing: border-box; vertical-align: middle; }
.btn small.kbd { font-weight: 500; font-size: 10.5px; opacity: .8; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; line-height: 15px; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid #eef2f6; }
/* page title bar */
.content > h2, .page-head h2 { font-size: 19px; font-weight: 700; margin: 0; color: var(--text); }
.content > h2 { margin-bottom: 14px; }
.page-head { min-height: 38px; }
/* line tables: same remove button, same add-line row */
#lines .line-x, .grid .line-x { border: 0; background: none; color: #b91c1c; font-size: 15px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
#lines .line-x:hover, .grid .line-x:hover { background: #fee2e2; }
#lines thead th, table[data-lines] th { white-space: nowrap; }
/* filter bars (lists and reports) share one look */
form.toolbar, form.rf { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
form.rf label, form.toolbar label { font-size: 12px; color: var(--muted); }
/* messages */
.content .alert { border-radius: 8px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 12px; }
table[data-lines] td:first-child, #lines td:first-child { min-width: 260px; }
table[data-lines] th:first-child { width: 30%; }

/* ================= v1.23 — one colour language + "needs your attention" ================= */
/* Colours carry meaning and are used the same way everywhere:
   blue = brand / primary action · green = done / money in / good · amber = due / needs attention · red = urgent / error / destructive · slate = neutral */
:root {
  --ok: #15803d; --ok-bg: #e7f6ec; --ok-line: #b7e3c5;
  --warn: #b45309; --warn-bg: #fff4e0; --warn-line: #f6d79a;
  --err: #b91c1c; --err-bg: #fdecec; --err-line: #f5b5b5;
  --info: #0f4c81; --info-bg: #eaf2fb; --info-line: #c5dbf2;
  --bg: #f3f5f8; --line: #dde3ea; --text: #17212b; --muted: #5f6f82;
}
.badge { padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.badge.err { background: var(--err-bg); color: var(--err); border-color: var(--err-line); }
.badge.muted { background: #eef1f5; color: #516173; border-color: #dde3ea; }
.content .alert { border: 1px solid var(--info-line); background: var(--info-bg); color: #12365a; border-left-width: 4px; }
.content .alert.ok { background: var(--ok-bg); color: #14532d; border-color: var(--ok-line); border-left-color: var(--ok); }
.content .alert.err { background: var(--err-bg); color: #7f1d1d; border-color: var(--err-line); border-left-color: var(--err); }
.content .alert.warn { background: var(--warn-bg); color: #7c3a06; border-color: var(--warn-line); border-left-color: var(--warn); }
.kpi.warn { border-top-color: #d97706; } .kpi.err { border-top-color: var(--err); } .kpi.ok { border-top-color: var(--ok); } .kpi.brand { border-top-color: var(--brand); }
.kpi { box-shadow: var(--shadow); } .card { box-shadow: var(--shadow); border-radius: var(--radius); }
.btn.danger { background: var(--err); color: #fff; }
.content td.num, .content th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid th { background: #f1f4f8; border-color: var(--line); } table.grid td { border-color: #e6ebf1; }
table.grid td a:not(.btn) { font-weight: 600; }
a { color: #0d5a9c; }

/* needs your attention */
.work { border-left: 4px solid #d97706; padding: 14px 16px; margin-bottom: 16px; }
.work.clear { border-left-color: var(--ok); }
.work:has(.work-item.urgent) { border-left-color: var(--err); }
.work-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.work-head h3 { margin: 0; padding: 0; border: 0; font-size: 15px; flex: 0 0 auto; }
.work-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); gap: 8px; }
.work-item { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--text); text-decoration: none !important; transition: border-color .12s, box-shadow .12s; }
.work-item:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.work-item .w-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--info); }
.work-item.due .w-dot { background: #d97706; } .work-item.urgent .w-dot { background: var(--err); box-shadow: 0 0 0 3px var(--err-bg); }
.work-item.urgent { background: #fffafa; border-color: var(--err-line); }
.work-item .w-text { display: flex; flex-direction: column; min-width: 0; }
.work-item .w-text b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-item .w-text small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-item .w-area { font-size: 11px; color: var(--muted); background: #eef1f5; border-radius: 999px; padding: 1px 8px; }
.work-item .w-go { font-size: 12.5px; font-weight: 700; color: var(--brand); white-space: nowrap; }
@media (max-width: 560px) { .work-list { grid-template-columns: 1fr; } .work-item { grid-template-columns: 10px minmax(0, 1fr) auto; } .work-item .w-area { display: none; } .work-item .w-text b, .work-item .w-text small { white-space: normal; } }
@media print { .work { display: none; } }
/* v1.24 — dark theme switch in the user menu */
.usermenu .menu .theme-switch { display: flex; align-items: center; gap: 10px; padding: 8px 14px; margin: 0; cursor: pointer; font-size: 13.5px; font-weight: 400; color: var(--text); }
.usermenu .menu .theme-switch:hover { background: #f1f5f9; }
.usermenu .menu .theme-switch svg { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.usermenu .menu .theme-switch span { flex: 1; }
.usermenu .menu .theme-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.usermenu .menu .theme-switch i { width: 36px; height: 20px; border-radius: 999px; background: #cbd5e1; position: relative; transition: background .15s; flex: 0 0 36px; }
.usermenu .menu .theme-switch i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
.usermenu .menu .theme-switch input:checked + i { background: #2f6fb0; }
.usermenu .menu .theme-switch input:checked + i::after { transform: translateX(16px); }
.usermenu .menu .theme-switch input:focus-visible + i { outline: 2px solid #4b93d6; outline-offset: 2px; }
table[data-lines] td input[type=number], #lines td input[type=number] { min-width: 76px; }
/* v1.24.1 — filter bars: buttons always side by side (Search · Clear), never stacked */
form.toolbar > div:has(> button), form.toolbar > div:has(> .btn), form.rf > div:has(> button), form.rf > div:has(> .btn), .rf-actions {
  flex-direction: row !important; align-items: center; justify-content: flex-start; gap: 8px; flex-wrap: nowrap; min-width: 0; flex: 0 0 auto; }
form.toolbar > button, form.toolbar > a.btn { align-self: flex-end; }
/* v1.24.2 — From / To period boxes get the calendar too */
.bs-wrap.bs-inline { display: inline-block; vertical-align: middle; }
.bs-wrap.bs-inline .bs-input { width: 148px; }
.rf-dates input[type=date] { width: 150px; }
/* v1.24.3 — Categories & Units: two full-width panels, add box on top, rename in place */
.mst { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .mst { grid-template-columns: 1fr; } }
.mst-card { margin: 0; }
.mst-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.mst-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.mst-head .mst-find { width: 220px; max-width: 50%; }
.mst-add { display: flex; gap: 8px; margin-bottom: 14px; }
.mst-add input[type=text] { flex: 1; min-width: 0; }
.mst-add .btn { white-space: nowrap; }
.mst-grid td { padding-top: 9px; padding-bottom: 9px; vertical-align: middle; }
.mst-grid .mst-name { font-weight: 500; }
.mst-edit { display: flex; gap: 6px; align-items: center; }
.mst-edit[hidden] { display: none; }
.mst-edit input[type=text] { flex: 1; min-width: 0; }
.mst-act { text-align: right; white-space: nowrap; }
.mst-act form.inline { display: inline; }
/* v1.30.2 — Daily report: plain table (months down, days 1–32 across); ▲ / ▼ and % stay as small coloured text */
.dg-sep { display: inline-block; width: 1px; height: 22px; background: var(--line); margin: 0 6px; vertical-align: middle; }
.dg-up { color: #15803d; font-style: normal; } .dg-down { color: #dc2626; font-style: normal; }
.dg-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--card); }
table.rpt-grid.dg-grid { border-collapse: collapse; width: auto; min-width: 100%; font-variant-numeric: tabular-nums; }
table.rpt-grid.dg-grid th, table.rpt-grid.dg-grid td { border: 1px solid var(--line); padding: 5px 7px; white-space: nowrap; font-size: 12px; text-align: right; background: var(--card); vertical-align: top; }
table.rpt-grid.dg-grid thead th { background: #eef2f6; font-weight: 700; color: #334155; text-align: right; position: static; }
table.rpt-grid.dg-grid .dg-m { position: sticky; left: 0; z-index: 2; text-align: left; background: #eef2f6; font-weight: 700; color: var(--text); min-width: 96px; }
table.rpt-grid.dg-grid .dg-m a { color: var(--brand); text-decoration: none; } table.rpt-grid.dg-grid .dg-m a:hover { text-decoration: underline; }
table.rpt-grid.dg-grid .dg-m small { font-weight: 400; color: var(--muted); margin-left: 4px; }
table.rpt-grid.dg-grid thead .dg-m { z-index: 3; }
table.rpt-grid.dg-grid td.dg-x { background: #f1f5f9; }
table.rpt-grid.dg-grid td.dg-v a { color: inherit; text-decoration: none; display: block; } table.rpt-grid.dg-grid td.dg-v a:hover b { text-decoration: underline; color: var(--brand); }
table.rpt-grid.dg-grid td.dg-v b, table.rpt-grid.dg-grid .dg-t b { display: block; font-weight: 600; font-size: 12px; }
table.rpt-grid.dg-grid .dg-chg { display: block; font-size: 10.5px; line-height: 1.2; font-weight: 600; color: var(--muted); }
table.rpt-grid.dg-grid .dg-chg i { font-style: normal; font-size: 8.5px; }
table.rpt-grid.dg-grid .dg-chg.none { display: none; }
table.rpt-grid.dg-grid td.up .dg-chg { color: #15803d; } table.rpt-grid.dg-grid td.down .dg-chg { color: #dc2626; }
table.rpt-grid.dg-grid td.dg-today { outline: 2px solid var(--accent); outline-offset: -2px; }
table.rpt-grid.dg-grid td.dg-t, table.rpt-grid.dg-grid thead th.dg-t { position: sticky; right: 0; z-index: 2; background: #eef2f6; font-weight: 700; min-width: 92px; }
table.rpt-grid.dg-grid tfoot td, table.rpt-grid.dg-grid tfoot th { background: #eef2f6; font-weight: 700; border-top: 2px solid #94a3b8; }
table.rpt-grid.dg-grid tbody tr:hover td:not(.dg-x) { background: #f8fafc; }
.dg-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 12px; color: var(--muted); }
@media print {
  .dg-wrap { overflow: visible !important; border: 0 !important; padding: 0 !important; }
  table.rpt-grid.dg-grid { border-collapse: collapse !important; border-spacing: 0; width: 100% !important; min-width: 0; }
  table.rpt-grid.dg-grid th, table.rpt-grid.dg-grid td { border: .5pt solid #777 !important; border-radius: 0 !important; box-shadow: none !important; position: static !important; min-width: 0 !important; height: auto !important;
    padding: 2px 1.5px !important; background: #fff !important; color: #000 !important; opacity: 1 !important; outline: 0 !important; text-align: right; }
  table.rpt-grid.dg-grid .dg-m { text-align: left; font-size: 6.6pt !important; } table.rpt-grid.dg-grid .dg-m a { color: #000 !important; } table.rpt-grid.dg-grid .dg-m small { display: none; }
  table.rpt-grid.dg-grid thead th { background: #e9edf2 !important; font-size: 6.6pt !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.rpt-grid.dg-grid td.dg-v a { padding: 0 !important; color: #000 !important; }
  table.rpt-grid.dg-grid td.dg-v b, table.rpt-grid.dg-grid .dg-t b, table.rpt-grid.dg-grid tfoot td { font-size: 6.2pt !important; color: #000 !important; }
  table.rpt-grid.dg-grid .dg-chg { font-size: 5.2pt !important; padding: 0 !important; margin: 0 !important; background: none !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.rpt-grid.dg-grid .dg-chg.none { display: none; }
  table.rpt-grid.dg-grid td.up .dg-chg { color: #15803d !important; } table.rpt-grid.dg-grid td.down .dg-chg { color: #b91c1c !important; }
  table.rpt-grid.dg-grid td.dg-x { background: #ddd !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* v1.25.2 — sub menu with ‹ › arrows */
.subnav { overflow: visible; padding: 0 6px; align-items: stretch; }
.subnav-track { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; scroll-behavior: auto; padding: 0 8px; }
.subnav-track::-webkit-scrollbar { display: none; }
.subnav-arrow { flex: 0 0 auto; align-self: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--brand); cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(16, 24, 40, .12); }
.subnav-arrow[hidden] { display: none; }
.subnav-arrow svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.subnav-arrow:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
/* v1.26 — split payment, payment QR, manager approval, unit picker on the invoice */
.pay-tools { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.pay-tools .btn.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.pm-off { opacity: .45; pointer-events: none; }
.split-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 6px 0 8px; background: #f8fafc; }
.split-row { display: grid; grid-template-columns: minmax(0, 1fr) 98px 26px; gap: 4px 6px; align-items: center; padding: 4px 0; border-top: 1px dashed #e2e8f0; }
.split-row:first-child { border-top: 0; }
.split-row .sp-l { font-size: 12.5px; font-weight: 600; color: #334155; line-height: 1.25; min-width: 0; }
.split-row .sp-l { order: 1; } .split-row .sp-amt { order: 2; } .split-row .sp-fill { order: 3; }
.split-row .sp-ref { order: 4; grid-column: 1 / -1; display: none; } .split-row.used .sp-ref { display: block; }
.split-row .sp-avail { display: block; }
.split-row .sp-avail { font-weight: 500; color: #15803d; font-size: 11px; }
.split-row input { height: 32px !important; padding: 4px 8px !important; font-size: 13px; min-width: 0 !important; width: 100% !important; box-sizing: border-box; }
.split-row .sp-amt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.split-row.used .sp-l { color: var(--brand); } .split-row.used .sp-amt { border-color: var(--brand); background: #fff; }
.split-row .sp-fill { border: 1px solid var(--line); background: #fff; border-radius: 6px; height: 28px; cursor: pointer; color: var(--brand); font-weight: 700; padding: 0; }
.split-row .sp-fill:hover { background: var(--brand); color: #fff; }
.split-sum { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; padding: 7px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; background: #e2e8f0; color: #334155; }
.split-sum b { font-size: 17px; font-variant-numeric: tabular-nums; }
.split-sum.ok { background: #dcfce7; color: #166534; } .split-sum.due { background: #fef3c7; color: #92400e; } .split-sum.chg { background: #dbeafe; color: #1e40af; }
.mgr-box { margin: 8px 0; border: 1px dashed var(--line); border-radius: 8px; padding: 6px 10px; }
.mgr-box summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: #475569; }
.mgr-box[open] { border-style: solid; border-color: var(--accent); background: #fffbeb; }
.qr-modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .6); z-index: 80; align-items: center; justify-content: center; }
.qr-card { background: #fff; color: #0f172a; border-radius: 16px; padding: 22px 26px; width: 360px; max-width: 92vw; text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.qr-card .qr-title { font-size: 18px; font-weight: 800; color: #0f4c81; margin-bottom: 8px; }
.qr-card img { width: 250px; height: 250px; display: block; margin: 0 auto 8px; background: #fff; }
.qr-card .qr-amt { font-size: 22px; margin-bottom: 6px; } .qr-card .qr-amt b { font-size: 30px; font-variant-numeric: tabular-nums; }
#lines select.unitSel { display: block; margin: 4px 0 0; height: 28px; padding: 2px 24px 2px 8px; font-size: 12px; font-weight: 600; width: auto; min-width: 120px; max-width: 100%; border-color: var(--accent); color: #9a3412; background-color: #fff7ed; }
/* v1.26 — small management pages (salespeople, wallet, approvals) */
.xt-add { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.xt-add > div { flex: 1; min-width: 130px; } .xt-add > .btn { flex: 0 0 auto; height: 38px; white-space: nowrap; }
.xt-bar { height: 8px; border-radius: 99px; background: #e2e8f0; overflow: hidden; } .xt-bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; } .xt-bar i.full { background: #16a34a; }
.xt-edit { position: relative; display: inline-block; text-align: left; } .xt-edit summary { list-style: none; cursor: pointer; } .xt-edit summary::-webkit-details-marker { display: none; }
.xt-edit[open] form { position: absolute; right: 0; top: 34px; z-index: 12; width: 260px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, .18); }
.xt-edit form .btn { margin-top: 8px; }
.xt-tabs { display: flex; gap: 6px; margin: 14px 0; }
.xt-code { font-family: ui-monospace, Consolas, monospace; letter-spacing: .5px; }
.xt-appr { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.xt-appr:first-of-type { border-top: 0; } .xt-appr-main { flex: 1; min-width: 260px; } .xt-appr-amt { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.xt-appr-act { display: flex; gap: 6px; align-items: center; } .xt-appr-act input { width: 200px; }
.inv-extras { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; font-size: 12.5px; margin: 6px 0; }
.inv-extras p { margin: 3px 0; } .inv-extras:empty { display: none; }
.inv-pay { border-collapse: collapse; margin-bottom: 6px; min-width: 260px; } .inv-pay th { text-align: left; border-bottom: 1px solid #333; padding: 2px 6px 2px 0; }
.inv-pay td { padding: 2px 6px 2px 0; border-bottom: 1px dotted #999; } .inv-pay td.num { text-align: right; padding-right: 0; }
.inv-qr { text-align: center; font-size: 11.5px; } .inv-qr img { width: 30mm; height: 30mm; display: block; margin: 0 auto 2px; }
.tds-box { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px; margin: 10px 0; }

.paybox { overflow: visible; } .split-box { overflow: hidden; }
/* v1.27 — warranty, variants */
.wr-hit { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 10px; padding: 12px 14px; border: 1px solid var(--line); border-left: 5px solid #94a3b8; border-radius: 10px; }
.wr-hit.in { border-left-color: #16a34a; background: #f0fdf4; } .wr-hit.out { border-left-color: #dc2626; background: #fef2f2; }
.wr-main { flex: 1; min-width: 260px; } .wr-state { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; min-width: 170px; } .wr-state small { color: var(--muted); }
.wr-claim { display: flex; gap: 6px; align-items: center; flex: 1 1 100%; } .wr-claim input[name=problem] { flex: 1; }
table.vr-matrix td.num a { display: block; font-weight: 700; } table.vr-matrix td.zero a { color: #dc2626; } table.vr-matrix td.none { background: repeating-linear-gradient(135deg, #f1f5f9 0 4px, #e2e8f0 4px 5px); }
table.vr-matrix tbody th { text-align: left; background: #eef2f6; }
/* v1.27.2 — steady sub menu: the arrows float over the ends instead of pushing the items sideways */
.subnav { position: sticky; }
.subnav-track { padding: 0 14px; }
.subnav-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.subnav-arrow.prev { left: 6px; } .subnav-arrow.next { right: 6px; }
.subnav::before, .subnav::after { content: ""; position: absolute; top: 0; bottom: 0; width: 46px; pointer-events: none; z-index: 1; opacity: 0; transition: opacity .12s; }
.subnav::before { left: 0; background: linear-gradient(90deg, #fff 55%, rgba(255,255,255,0)); } .subnav::after { right: 0; background: linear-gradient(270deg, #fff 55%, rgba(255,255,255,0)); }
.subnav:has(.subnav-arrow.prev:not([hidden]))::before, .subnav:has(.subnav-arrow.next:not([hidden]))::after { opacity: 1; }
/* the current item is marked without changing its width (no bold face), so nothing in the sub menu moves when another item becomes current */
.subnav a.subitem.active { font-weight: 500; text-shadow: 0.4px 0 0 currentColor, -0.4px 0 0 currentColor; }
/* v1.27.2 — report tool line: row count · Find in rows · Print · PDF · Excel on one line */
div.rf-actions { display: flex !important; flex-direction: row !important; align-items: center; justify-content: space-between !important; gap: 12px; flex-wrap: wrap !important; margin: 10px 0; }
div.rf-actions > span:last-child { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; margin-left: auto; }
div.rf-actions #rfind { width: 260px !important; max-width: 40vw; flex: 0 1 260px; display: block; margin: 0; height: 36px; }
div.rf-actions .btn { white-space: nowrap; flex: 0 0 auto; height: 36px; display: inline-flex; align-items: center; }
@media (max-width: 640px) { div.rf-actions > span:last-child { flex-wrap: wrap; margin-left: 0; } }
/* v1.28 — compact report header (reportbar.js) */
@media screen {
  .rpt.rb-on > .rpt-head { display: none; }
  .rpt.rb-on form.rf { padding: 8px 12px; margin-bottom: 8px; }
  .rpt.rb-on form.rf .rf-row { margin: 0; padding: 0; border: 0; }
  .rpt.rb-on form.rf .rf-more { display: none; }
  .rpt.rb-on form.rf.rb-open .rf-more { display: flex; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
  .rb-bar { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; min-height: 36px; }
  .rb-title { font-size: 17px; font-weight: 700; color: var(--text); white-space: nowrap; margin-right: 4px; }
  .rb-i { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: #e2e8f0; color: #475569; font: 700 11px/1 Georgia, serif; font-style: italic; vertical-align: 2px; cursor: help; }
  .rb-btn { height: 36px; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 8px; padding: 0 12px; font: 600 13px/1 inherit; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
  .rb-btn:hover { border-color: var(--brand); color: var(--brand); }
  .rb-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .rb-btn b { font-size: 10px; opacity: .7; }
  .rb-btn em { font-style: normal; background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 6px; line-height: 17px; }
  .rb-btn.on { background: var(--brand); color: #fff; border-color: var(--brand); }
  .rb-period { position: relative; }
  .rb-menu { position: absolute; left: 0; top: 40px; z-index: 30; min-width: 190px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 12px 32px rgba(15, 23, 42, .18); }
  .rb-menu[hidden] { display: none; }
  .rb-menu a { display: block; padding: 8px 12px; border-radius: 6px; color: var(--text); font-size: 13px; text-decoration: none; white-space: nowrap; }
  .rb-menu a:hover { background: #f1f5f9; } .rb-menu a.on { background: var(--brand); color: #fff; font-weight: 600; }
  .rb-bar .rf-dates { display: flex; align-items: center; gap: 6px; margin: 0; }
  .rb-bar .rf-dates label { font-size: 11px; margin: 0; line-height: 1.1; color: var(--muted); }
  .rb-bar .rf-dates .bs-input, .rb-bar .rf-dates input[type=date], .rb-bar .rf-dates input[type=text] { height: 36px !important; width: 136px !important; }
  .rb-grow { flex: 1 1 10px; }
  .rb-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
  .rb-bar #rfind { width: 200px !important; height: 36px; flex: 0 1 200px; min-width: 110px; margin: 0; }
  .rb-bar > .btn { height: 36px; display: inline-flex; align-items: center; white-space: nowrap; flex: 0 0 auto; }
  .rb-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0 0 8px; }
  .rb-chips span { background: #e8eef5; color: #1e293b; border-radius: 99px; padding: 3px 6px 3px 11px; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
  .rb-chips span i { font-style: normal; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #64748b; cursor: pointer; font-size: 11px; }
  .rb-chips span i:hover { background: #dc2626; color: #fff; }
  .rb-chips a { font-size: 12px; margin-left: 4px; }
  /* summary: one slim strip */
  .rpt.rb-on .rpt-tiles { display: flex; gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin: 0 0 8px; overflow: hidden; }
  .rpt.rb-on .rpt-tiles .tile { flex: 1 1 0; min-width: 0; border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 7px 14px; background: none; }
  .rpt.rb-on .rpt-tiles .tile:last-child { border-right: 0; }
  .rpt.rb-on .rpt-tiles .tile .k { font-size: 10.5px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rpt.rb-on .rpt-tiles .tile .v { font-size: 16px; line-height: 1.25; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rpt.rb-on .rpt-tiles .tile .h { display: none; }
}
@media screen and (max-width: 760px) { .rpt.rb-on .rpt-tiles { flex-wrap: wrap; } .rpt.rb-on .rpt-tiles .tile { flex: 1 1 45%; border-bottom: 1px solid var(--line); } .rb-grow { display: none; } }
@media print { .rb-bar, .rb-chips { display: none !important; } }
@media screen { .rpt.rb-on form.rf .rf-row.rb-keep { margin-top: 8px; } .rpt.rb-on form.rf .rf-row[hidden] { display: none; } }
@media screen {
  form.rf > div.rb-bar { flex-wrap: wrap !important; flex: 1 1 100% !important; }
  .rb-title { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; }
  div.rf-actions[hidden] { display: none !important; }
}
/* v1.29 — Sign out is a button inside a form (POST) but looks like the other menu lines */
.usermenu .menu .logout-form { margin: 0; }
.usermenu .menu button.logout { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 14px; border: 0; background: none; font: inherit; font-size: 13.5px; color: #b91c1c; cursor: pointer; text-align: left; }
.usermenu .menu button.logout:hover { background: #f1f5f9; }
.usermenu .menu button.logout svg { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
/* v1.30 — Categories · Brands · Units side by side */
.mst.mst-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.mst.mst-3 .mst-head .mst-find { width: 130px; }
.mst.mst-3 .mst-add .btn { padding-left: 10px; padding-right: 10px; }
@media (max-width: 1250px) { .mst.mst-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) { .mst.mst-3 { grid-template-columns: 1fr; } }
/* v1.30.1 — large photo on hover */
img.item-thumb, img[data-zoom] { cursor: zoom-in; transition: box-shadow .12s; }
img.item-thumb:hover, img[data-zoom]:hover { box-shadow: 0 0 0 2px var(--brand); }
.img-zoom { position: fixed; z-index: 90; display: none; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: 0 18px 48px rgba(15, 23, 42, .32); }
.img-zoom img { display: block; max-width: min(360px, 70vw); max-height: min(360px, 70vh); min-width: 160px; min-height: 120px; object-fit: contain; border-radius: 6px; background: #f8fafc; }
.img-zoom span { display: block; max-width: 360px; margin-top: 6px; font-size: 12.5px; font-weight: 600; color: #0f172a; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media print { .img-zoom { display: none !important; } }
/* v1.30.3 — report columns only as wide as their content; the widest text column takes the spare room (set by reportbar.js) */
table.rpt-grid:not(.dg-grid) th.rb-tight { width: 1%; }
table.rpt-grid tfoot td.rpt-foot-label { text-align: left; }
/* v1.31 — professional A4 document style for every document that uses .invoice-print (tax invoice, sales order, challan,
   credit / debit note, purchase order, payment / journal / adjustment vouchers): same look as the new quotation.
   Markup is unchanged: company block left, document title top-right, brand rule, clean item table, signature lines. */
.invoice-print { position: relative; background: #fff; color: #1f2937; max-width: 210mm; margin: 0 auto; padding: 14mm 14mm 12mm; border: 0; box-shadow: 0 2px 14px rgba(15, 23, 42, .12);
  font-family: "Segoe UI", Inter, Arial, sans-serif; font-size: 13px; line-height: 1.45; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.invoice-print .inv-logo { display: block; margin: 0 0 6px; max-height: 20mm; max-width: 40mm; }
.invoice-print .co-name { text-align: left; font-size: 22px; line-height: 1.15; font-weight: 800; color: #0f4c81; padding-right: 86mm; min-height: 30px; letter-spacing: .1px; }
.invoice-print .co-sub { text-align: left; font-size: 12px; color: #6b7280; padding-right: 86mm; line-height: 1.5; }
.invoice-print .co-sub b { color: #1f2937; }
.invoice-print .doc-title { position: absolute; top: 14mm; right: 14mm; max-width: 84mm; margin: 0; text-align: right; text-decoration: none; font-size: 21px; line-height: 1.12; font-weight: 300; letter-spacing: 1.8px; color: #0f4c81; text-transform: uppercase; }
.invoice-print .copy-tag { position: absolute; top: calc(14mm + 30px); right: 14mm; max-width: 76mm; text-align: right; font-size: 10.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: #fff; background: #e8711a; padding: 2px 10px; border-radius: 3px; }
.invoice-print .copy-tag:empty { display: none; }
.invoice-print .meta { position: relative; display: flex; justify-content: space-between; gap: 10mm; margin-top: 26px; padding-top: 16px; font-size: 12.5px; line-height: 1.65; }
.invoice-print .meta::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; border-radius: 3px; background: linear-gradient(90deg, #0f4c81 0 78%, #e8711a 78% 100%); }
.invoice-print .meta b { color: #6b7280; font-weight: 600; }
.invoice-print .meta > div:last-child { text-align: right; white-space: nowrap; }
.invoice-print table.inv { width: 100%; border-collapse: collapse; margin-top: 14px; }
.invoice-print table.inv th, .invoice-print table.inv td { border: 0; border-bottom: 1px solid #e5e7eb; padding: 7px 10px; font-size: 12.5px; vertical-align: top; }
.invoice-print table.inv th { background: #0f4c81; color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; text-align: left; border-bottom: 0; }
.invoice-print table.inv th.num, .invoice-print table.inv td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.invoice-print table.inv tr:not(.totals):nth-child(even) td { background: #f8fafc; }
.invoice-print table.inv tr.totals td { border-bottom: 0; padding: 4px 10px; font-weight: 500; color: #6b7280; background: none; }
.invoice-print table.inv tr.totals td:last-child { color: #1f2937; font-weight: 600; }
.invoice-print table.inv tr.totals:has(b) td { color: #0f4c81; font-size: 14px; padding-top: 8px; }
.invoice-print table.inv tr.totals:has(b) td:last-child { background: #0f4c81; color: #fff; border-radius: 3px; padding: 7px 10px; }
.invoice-print table.inv tr.totals:has(b) td:last-child b { color: #fff; }
.invoice-print table.inv tr:not(.totals) + tr.totals td { padding-top: 10px; }
.invoice-print p { color: #374151; }
.invoice-print .sign { display: flex; justify-content: space-between; gap: 16mm; margin-top: 54px; font-size: 12px; color: #374151; }
.invoice-print .sign div { flex: 1 1 0; max-width: 62mm; width: auto; border-top: 1px solid #9ca3af; padding-top: 5px; text-align: center; }
.invoice-print .inv-extras { margin-top: 10px; }
.invoice-print .inv-pay th { color: #6b7280; font-size: 10.5px; letter-spacing: .8px; text-transform: uppercase; border-bottom-color: #cbd5e1; }
@media screen and (max-width: 760px) { .invoice-print { padding: 6mm; } .invoice-print .doc-title, .invoice-print .copy-tag { position: static; text-align: left; max-width: none; display: inline-block; margin: 6px 8px 0 0; } .invoice-print .co-name, .invoice-print .co-sub { padding-right: 0; } }
@media print {
  .invoice-print { box-shadow: none; max-width: none; padding: 0; }
  .invoice-print .doc-title { top: 0; right: 0; } .invoice-print .copy-tag { top: 30px; right: 0; }
}
/* v1.31.1 — action bar above a printable document: one tidy bar as wide as the sheet — Back on the left, paper choice, Print on the right */
.docbar { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; max-width: 210mm; margin: 0 auto 14px; padding: 8px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 1px 3px rgba(15, 23, 42, .06); }
.docbar .btn { height: 36px; display: inline-flex; align-items: center; margin: 0; white-space: nowrap; }
.docbar form.inline { display: inline-flex; margin: 0; }
.docbar > button[onclick*="print"] { order: 99; margin-left: auto; padding-left: 18px; padding-right: 18px; font-weight: 700; }
.docbar > .btn[onclick*="print"].secondary { background: var(--brand); color: #fff; border-color: var(--brand); }
.docbar-lab { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-left: 8px; }
.docbar-info { font-size: 13px; color: var(--muted); margin-left: 4px; } .docbar-info b { color: var(--text); }
.docbar .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #f1f5f9; padding: 2px; gap: 2px; }
.docbar .seg a { padding: 6px 14px; font-size: 13px; font-weight: 600; color: #475569; border-radius: 6px; text-decoration: none; white-space: nowrap; }
.docbar .seg a:hover { color: var(--brand); }
.docbar .seg a.on { background: #fff; color: var(--brand); box-shadow: 0 1px 2px rgba(15, 23, 42, .18); }
body:has(.docbar) .content > .page-head { max-width: 210mm; margin-left: auto; margin-right: auto; }
@media (max-width: 560px) { .docbar > button[onclick*="print"] { margin-left: 0; flex: 1 1 100%; justify-content: center; } }
.docbar > a.back { order: -1; }
.docbar .badge { margin: 0 2px; }
.docwrap { max-width: 210mm; margin: 0 auto 14px; }
.docwrap > .page-head { align-items: center; gap: 10px; flex-wrap: wrap; }
.docwrap-act { display: flex; gap: 8px; margin-left: auto; } .docwrap-act .btn { height: 36px; display: inline-flex; align-items: center; margin: 0; }
.docwrap-act button { padding-left: 18px; padding-right: 18px; font-weight: 700; }
/* v1.32 — form validation: one look for a wrong field on every page */
.kv-bad, .ux-wrap .kv-bad, input.kv-bad, select.kv-bad, textarea.kv-bad { border-color: #dc2626 !important; background-color: #fff5f5 !important; box-shadow: 0 0 0 3px rgba(220, 38, 38, .13) !important; }
.kv-msg { color: #b91c1c; font-size: 12px; font-weight: 600; line-height: 1.35; margin: 4px 0 6px; display: flex; gap: 5px; align-items: flex-start; text-align: left; white-space: normal; }
.kv-msg::before { content: "!"; flex: none; width: 14px; height: 14px; border-radius: 50%; background: #dc2626; color: #fff; font-size: 10px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
td .kv-msg { font-size: 11px; margin: 2px 0 0; max-width: 220px; }
label.kv-req::after { content: " *"; color: #dc2626; font-weight: 700; }
.alert.kv-sum { margin-bottom: 12px; }
/* v1.32 — pop-up for small entry forms (movable by its title bar) */
.kbx-modal { position: fixed; inset: 0; z-index: 480; background: rgba(10, 25, 41, .48); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 16px; animation: kbxFade .14s ease-out; }
.kbx-modal-box { width: 100%; max-width: 580px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--card); border-radius: 14px; overflow: hidden; box-shadow: 0 28px 70px rgba(10, 25, 41, .42), 0 2px 6px rgba(10, 25, 41, .2); animation: kbxPop .16s ease-out; }
.kbx-modal-box.dragging { box-shadow: 0 36px 90px rgba(10, 25, 41, .5); user-select: none; }
.kbx-modal-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; background: linear-gradient(135deg, #0f3d6b, #164f85); color: #fff; cursor: move; touch-action: none; flex: none; border-bottom: 3px solid #f08a24; }
.kbx-modal-ico { width: 30px; height: 30px; border-radius: 8px; background: rgba(255, 255, 255, .14); display: inline-flex; align-items: center; justify-content: center; font-size: 15px; flex: none; }
.kbx-modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; flex: 1; border: 0; padding: 0; color: #fff; letter-spacing: .2px; }
.kbx-modal-x { border: 0; background: rgba(255, 255, 255, .1); color: #fff; font-size: 15px; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; flex: none; }
.kbx-modal-x:hover { background: #dc2626; }
.kbx-modal-body { padding: 16px 20px 0; overflow-y: auto; flex: 1; }
.kbx-modal-body form { margin: 0; max-width: none !important; box-shadow: none; border: 0; padding: 0 0 18px; background: transparent; }
.kbx-modal-body form:has(.kbx-modal-foot) { padding-bottom: 0; }
.kbx-modal-body h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 6px; margin: 18px 0 8px; }
.kbx-modal-foot { position: sticky; bottom: 0; display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: 8px; margin: 18px -20px 0; padding: 12px 20px; background: #f6f8fb; border-top: 1px solid var(--line); z-index: 2; }
.kbx-modal-foot .btn { margin: 0; }
html.kbx-modal-open { overflow: hidden; }
@keyframes kbxFade { from { opacity: 0; } } @keyframes kbxPop { from { margin-top: 14px; opacity: 0; } }
@media (max-height: 560px) { .kbx-modal { padding: 6px; } .kbx-modal-box { max-height: calc(100vh - 12px); } }
/* v1.32.1 — the fixed first column drew its right line twice (cell border + the line that travels with it when scrolling sideways): keep one */
.grid-wrap:not(.entry) table.grid td:first-child, .grid-wrap:not(.entry) table.grid th:first-child, table.rpt-grid td:first-child, table.rpt-grid th:first-child { border-right: 0; }
.grid-wrap:not(.entry) table.grid td:nth-child(2), .grid-wrap:not(.entry) table.grid th:nth-child(2), table.rpt-grid td:nth-child(2), table.rpt-grid th:nth-child(2) { border-left: 0; }
.grid-wrap:not(.entry) table.grid thead th:first-child { box-shadow: inset -1px 0 0 var(--line), inset 0 -1px 0 #cbd5e1; }
/* v1.32.2 — printed documents: light column header and a Total without fill (easy on the eye and on ink) */
.invoice-print table.inv th { background: #eef3f8; color: #0f3d6b; border-top: 2px solid #0f4c81; border-bottom: 1px solid #9fb4c8; }
.invoice-print table.inv tr:not(.totals):nth-child(even) td { background: transparent; }
.invoice-print table.inv tr.totals:has(b) td { color: #0f3d6b; border-top: 2px solid #0f4c81; border-bottom: 2px solid #0f4c81; }
.invoice-print table.inv tr.totals:has(b) td:last-child { background: transparent; color: #0f172a; border-radius: 0; }
.invoice-print table.inv tr.totals:has(b) td:last-child b { color: #0f172a; }
/* v1.32.3 — lists and calendars open above a pop-up form (they were hidden behind it) */
.ux-drop, .bs-pop, .suggest { z-index: 620; }
/* v1.33 — F1 help: "This page" card + guide tab, always centred above pop-up forms */
.help-modal { z-index: 700; }
.help-box { width: min(760px, 100%); height: min(84vh, 820px); }
.help-head { flex-wrap: wrap; }
.help-tabs { display: inline-flex; background: #eef2f6; border-radius: 8px; padding: 2px; gap: 2px; margin-right: auto; margin-left: 8px; }
.help-tabs button { border: 0; background: transparent; padding: 6px 14px; font-size: 13px; font-weight: 600; color: #475569; border-radius: 6px; cursor: pointer; }
.help-tabs button.on { background: #fff; color: var(--brand); box-shadow: 0 1px 2px rgba(15, 23, 42, .18); }
.help-keys { font-size: 12px; }
.help-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.help-pane[hidden] { display: none; }
.help-page { overflow-y: auto; padding: 4px 26px 22px; }
.help-find { padding: 8px 14px; border-bottom: 1px solid var(--line); } .help-find input { width: 260px; max-width: 100%; margin: 0; }
.hp-card h3 { font-size: 20px; color: var(--brand); margin: 18px 0 6px; border: 0; padding: 0; }
.hp-what { font-size: 14.5px; line-height: 1.55; margin: 0 0 6px; padding: 10px 14px; background: #f1f6fb; border-left: 3px solid #f08a24; border-radius: 0 8px 8px 0; }
.hp-card h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 18px 0 6px; }
.hp-card ol, .hp-card ul { margin: 0; padding-left: 22px; font-size: 14px; line-height: 1.65; } .hp-card li { margin-bottom: 3px; }
.hp-card ol li::marker { color: var(--brand); font-weight: 700; }
.hp-more { margin-top: 18px; font-size: 13.5px; }
/* v1.34 — stock ledger: per-godown stock links */
.chip-link { display: inline-block; margin: 0 6px 4px 0; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; color: var(--text); text-decoration: none; background: var(--card); } .chip-link:hover { border-color: var(--brand); color: var(--brand); }

/* v1.35 — "showing FY · branch" line under lists */
.ctx-note{margin:10px 0 0;padding:6px 10px;font-size:12.5px;color:#5b6472;background:#f4f6fa;border:1px dashed #d5dbe6;border-radius:6px}
.ctx-note a{margin-left:10px}

/* v1.36 — fiscal year · branch line on every printed page and document */
.report-head .rh-ctx{font-size:11.5px;font-weight:600;color:#222;margin-top:2px}
.doc-ctx{font-weight:600}

/* v1.37 — company logo on the LEFT of every letterhead (documents, lists, reports), company text beside it */
.lh { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lh > .lh-text { flex: 1; min-width: 0; }
.lh .inv-logo, .invoice-print .lh .inv-logo { flex: none; display: block; margin: 0; max-height: 22mm; max-width: 38mm; object-fit: contain; }
.lh.lh-c { display: grid; grid-template-columns: 1fr auto 1fr; } .lh.lh-c > :first-child:not(img) { grid-column: 2; }
.invoice-print .lh .co-name, .invoice-print .lh .co-sub { padding-right: 0; }
.invoice-print .lh { padding-right: 72mm; }                      /* room for the document title at the top right */
.roll-print .r-logo { max-width: 34mm; max-height: 14mm; object-fit: contain; margin: 0 auto 2px; display: block; filter: grayscale(1) contrast(1.15); }
@media print {
  .report-head { display: grid; grid-template-columns: 42mm minmax(0, 1fr) 42mm; align-items: center; column-gap: 8px; text-align: center; }
  .report-head .rh-mid { min-width: 0; overflow-wrap: anywhere; }
  .report-head .rh-right { justify-content: flex-end; text-align: right; } .report-head .rh-printed { font-size: 8.5px; line-height: 1.35; color: #444; overflow-wrap: anywhere; min-width: 0; }
  .report-head .rh-side { min-width: 0; display: flex; align-items: center; }
  .report-head .rh-logo { margin: 0; max-height: 20mm; max-width: 42mm; object-fit: contain; }
}
@media screen and (max-width: 760px) { .invoice-print .lh { padding-right: 0; } }

/* v1.43 — grouped sub menu (sub menu under sub menu) */
.subgroup { position: relative; flex: 0 0 auto; }
.subgroup > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; padding: 10px 14px; font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; border-bottom: 3px solid transparent; }
.subgroup > summary:hover { color: var(--brand); background: #f4f7fa; }
.subgroup.active > summary { color: var(--brand); border-bottom-color: var(--accent); font-weight: 700; }
.subgroup > summary::-webkit-details-marker { display: none; }
.subgroup .caret { width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: .7; }
.subgroup[open] .caret { transform: rotate(225deg) translateY(-2px); }
.subdrop { position: absolute; top: 100%; left: 0; z-index: 30; min-width: 240px; background: #fff; border: 1px solid var(--line); border-radius: 0 0 8px 8px; box-shadow: 0 8px 24px rgba(16,24,40,.12); padding: 6px; display: flex; flex-direction: column; }
.subdrop a { padding: 8px 12px; font-size: 13px; color: var(--text); border-radius: 6px; white-space: nowrap; }
.subdrop a:hover { background: #f4f7fa; color: var(--brand); text-decoration: none; }
.subdrop a.active { color: var(--brand); font-weight: 700; background: #eef3f9; }
.subnav.grouped .subnav-track { overflow: visible; flex-wrap: wrap; }
.subnav.grouped .subnav-arrow { display: none; }
