/* Fertilizer ERP - screens. No internet resources are used, so it works offline on the LAN. */
:root {
  --bg: #f3f8f7;
  --panel: #ffffff;
  --ink: #14302d;
  --muted: #55706c;
  --line: #dcebe8;
  --line-strong: #c3d9d5;
  --brand: #0f766e;
  --brand-2: #13897f;
  --brand-ink: #ffffff;
  --brand-soft: #e0f2ef;
  --accent: #13897f;
  --gold: #e0a526;
  --info: #1d5fa8;
  --info-soft: #e5eefa;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --warn: #8a5a00;
  --warn-soft: #fff3d6;
  --ok: #1e6b3c;
  --ok-soft: #e3f3e8;
  --focus: #13897f;
  --radius: 12px;
  --top-h: 58px;
  --side-w: 236px;
  --shadow: 0 1px 2px rgba(14,42,39,.06), 0 4px 14px rgba(14,42,39,.05);
  --shadow-lg: 0 12px 40px rgba(14,42,39,.18);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: Consolas, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 21px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 620; }
h3 { font-size: 12px; margin: 0 0 8px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.ic { flex: none; display: block; }

/* ---------- shell: sidebar ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.shell.narrow { --side-w: 64px; }
.side {
  background: linear-gradient(180deg, #0f423c 0%, #0b3631 100%);
  color: var(--brand-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow: hidden; z-index: 40;
}
.side .logo { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; font-weight: 650; font-size: 16px; height: var(--top-h); white-space: nowrap; }
.side .logo img { width: 28px; height: 28px; flex: none; object-fit: contain; }
.side nav { display: flex; flex-direction: column; padding: 6px 10px 10px; gap: 1px; overflow-y: auto; overflow-x: hidden; flex: 1; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.side nav > * { flex: none; }
.side nav a, .side .grp-h {
  color: rgba(255,255,255,.82); padding: 7px 10px; border-radius: 8px; display: flex; align-items: center; gap: 10px;
  white-space: nowrap; min-height: 0; border: 0; background: none; font: inherit; width: 100%; text-align: left; cursor: pointer;
}
.side nav a:hover, .side .grp-h:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.side nav a.top { font-weight: 600; margin-bottom: 4px; }
.side nav a.top.quick-rec { background: rgba(224,165,38,.16); color: #ffe2a3; border: 1px solid rgba(224,165,38,.35); margin: 2px 0 8px; }
.side nav a.top.quick-rec:hover { background: rgba(224,165,38,.26); color: #fff; }
.side nav a.top.quick-rec.active { background: rgba(224,165,38,.3); color: #fff; }
.side nav a.top.quick-rec.active::before { display: none; }
.side .grp { margin-top: 2px; }
.side .grp-h { font-weight: 600; color: rgba(255,255,255,.92); }
.side .grp-h .chev { margin-left: auto; opacity: .6; transition: transform .15s; }
.side .grp.shut .chev { transform: rotate(-90deg); }
.side .grp-b { display: grid; gap: 1px; padding: 2px 0 6px 18px; margin-left: 9px; border-left: 1px solid rgba(255,255,255,.12); }
.side .grp.shut .grp-b { display: none; }
.side .grp.has-active > .grp-h { color: #fff; }
.side .grp-b a { padding: 5px 10px; font-size: 13.5px; color: rgba(255,255,255,.74); }
.side .grp-b a .dot { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.3); flex: none; margin: 0 4px 0 2px; }
.side nav a.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; position: relative; }
.side nav a.active::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.side .grp-b a.active::before { left: -19px; }
.side nav a.active .dot { background: var(--gold); }
.side nav a .plus { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; background: rgba(224,165,38,.22); color: #ffd27a; flex: none; margin-left: -2px; }
.side .side-toggle { margin: 6px 10px 12px; background: rgba(255,255,255,.06); color: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.12); justify-content: flex-start; gap: 10px; font-size: 13px; white-space: nowrap; overflow: hidden; }
.side .side-toggle:hover { background: rgba(255,255,255,.12); color: #fff; }
.shell.narrow .side .lbl, .shell.narrow .side .chev, .shell.narrow .side .grp-b { display: none; }
.shell.narrow .side .logo { padding-left: 18px; }
.shell.narrow .side .grp-h, .shell.narrow .side nav a.top { justify-content: center; padding: 9px 0; }
.shell.narrow .side .side-toggle { justify-content: center; }
.shell.narrow .side .side-toggle .ic { transform: rotate(180deg); }
.side-scrim { display: none; }

/* ---------- shell: top bar ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line);
}
.topbar .icon-btn { display: none; }
.tb-title .t { font-size: 17px; font-weight: 650; line-height: 1.2; }
.tb-title .d { font-size: 12px; color: var(--muted); }
.tb-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tb-quick { color: var(--brand); border-color: #cee2e0; background: #f4fafa; font-weight: 600; }
.tb-quick:hover { background: var(--brand-soft); }
.who { display: flex; align-items: center; gap: 10px; padding-left: 12px; margin-left: 4px; border-left: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.who-name { display: flex; flex-direction: column; line-height: 1.2; font-size: 13px; }
.who-name span { font-size: 12px; color: var(--muted); }
.icon-btn { width: 38px; height: 38px; padding: 0; border-radius: 8px; }
.page { padding: 22px 24px 40px; max-width: 1320px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.loading { color: var(--muted); display: flex; align-items: center; gap: 10px; padding: 20px 0; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- panels, grid ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.grid > .panel, .grid > .panel + .panel { margin-top: 0; }
.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.card .label { color: var(--muted); font-size: 12px; }
.card .value { font-size: 22px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.card a.value { display: block; color: var(--ink); }

/* ---------- forms ---------- */
label.f, div.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
label.f.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; font-weight: 400; }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line-strong); border-radius: 6px; padding: 7px 9px; min-height: 36px; width: 100%;
}
input[type=checkbox] { width: 16px; height: 16px; min-height: 0; accent-color: var(--brand); }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
input[readonly] { background: #f6f8f8; }
input.num { text-align: right; }
.req::after { content: " *"; color: var(--danger); }

/* ---------- buttons: soft depth, lift on hover, press on click ---------- */
button, .btn {
  font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; border-radius: 7px; padding: 7px 14px; min-height: 36px;
  border: 1px solid var(--line-strong); color: var(--ink);
  background: linear-gradient(180deg, #ffffff 0%, #f7f6f4 100%);
  box-shadow: 0 1px 2px rgba(14,38,35,.08), inset 0 1px 0 rgba(255, 255, 255, .7);
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .12s ease, color .15s ease;
  user-select: none; white-space: nowrap; text-decoration: none;
}
button:hover:not([disabled]), .btn:hover:not([disabled]) {
  background: linear-gradient(180deg, #ffffff 0%, #f0ece9 100%); border-color: #98b2af; text-decoration: none;
  transform: translateY(-1px); box-shadow: 0 3px 8px rgba(14,38,35,.10), inset 0 1px 0 rgba(255, 255, 255, .9);
}
button:active:not([disabled]), .btn:active:not([disabled]) { transform: translateY(0) scale(.98); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .12); }
button.primary, .btn.primary {
  background: linear-gradient(180deg, #1c7f73 0%, #115b53 100%); border-color: #0e4b44; color: #fff;
  box-shadow: 0 2px 6px rgba(18,102,92,.28), inset 0 1px 0 rgba(255, 255, 255, .22);
}
button.primary:hover:not([disabled]), .btn.primary:hover:not([disabled]) {
  background: linear-gradient(180deg, #208f82 0%, #13695f 100%); border-color: #0b3b36; color: #fff;
  box-shadow: 0 4px 12px rgba(18,102,92,.36), inset 0 1px 0 rgba(255, 255, 255, .28);
}
button.primary:active:not([disabled]), .btn.primary:active:not([disabled]) { background: #0f4e47; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .25); }
button.soft, .btn.soft { background: linear-gradient(180deg, #f8f2ed 0%, #ddf1ef 100%); border-color: #aadbd5; color: var(--brand); }
button.soft:hover:not([disabled]), .btn.soft:hover:not([disabled]) { background: linear-gradient(180deg, #def3f1 0%, #caeae7 100%); border-color: #7dc9c1; color: var(--brand); }
button.amber, .btn.amber {
  background: linear-gradient(180deg, #f5a524 0%, #d98a06 100%); border-color: #b46f09; color: #fff;
  box-shadow: 0 2px 6px rgba(0,223,197,.25), inset 0 1px 0 rgba(255, 255, 255, .25);
}
button.amber:hover:not([disabled]), .btn.amber:hover:not([disabled]) { background: linear-gradient(180deg, #fbbf24 0%, #d98a06 100%); border-color: #a35f05; color: #fff; }
button.danger, .btn.danger { background: linear-gradient(180deg, #ffffff 0%, #fff5f5 100%); color: var(--danger); border-color: #f0b9b4; }
button.danger:hover:not([disabled]), .btn.danger:hover:not([disabled]) { background: linear-gradient(180deg, #fff0f0 0%, #ffe0e0 100%); border-color: #f06565; color: var(--danger); box-shadow: 0 3px 8px rgba(201, 42, 42, .14); }
button.primary.danger-fill { background: linear-gradient(180deg, #e03131 0%, #b91c1c 100%); border-color: #991b1b; color: #fff; }
button.primary.danger-fill:hover:not([disabled]) { background: linear-gradient(180deg, #f03e3e 0%, #c92a2a 100%); border-color: #991b1b; }
.cost { color: var(--muted); }
.profit-pos { color: var(--ok); }
.profit-neg { color: var(--danger); }
.lock-banner { background: var(--warn-soft); color: var(--warn); padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; border: 1px solid #f0d9a0; }
.row-lock { display: inline-grid; place-items: center; width: 28px; height: 28px; font-size: 13px; opacity: .6; cursor: default; }
.cancelled-banner { background: var(--danger-soft); color: var(--danger); padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-weight: 600; }
/* segmented toggles (Retail / Trade, Cash / Credit, report mode …) */
.seg { display: inline-flex; background: #e9efef; padding: 3px; border: 1px solid var(--line-strong); border-radius: 9px; gap: 2px; }
.seg button { border: 0; border-radius: 6px; min-height: 30px; padding: 4px 12px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; box-shadow: none; }
.seg button:hover:not(.on):not([disabled]) { background: rgba(255, 255, 255, .6); color: var(--ink); transform: none; box-shadow: none; border-color: transparent; }
.seg button.on, .seg button.on:hover { background: var(--brand); color: #fff; box-shadow: 0 1px 3px rgba(14,38,35,.2); transform: none; }
.seg button[disabled] { opacity: .5; }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; }
.seg-box { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
button.ghost, .btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
button.ghost:hover:not([disabled]), .btn.ghost:hover:not([disabled]) { background: rgba(18,102,92,.08); border-color: transparent; box-shadow: none; transform: none; }
button.small, .btn.small { min-height: 28px; padding: 3px 10px; font-size: 12.5px; border-radius: 6px; }
button[disabled], .btn[disabled] { opacity: .52; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
/* keyboard shortcut badges inside buttons */
kbd { font: 600 10.5px/1 var(--mono); padding: 2px 5px; border-radius: 4px; background: rgba(0, 0, 0, .06); color: inherit; border: 1px solid rgba(0, 0, 0, .14); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .12); margin-left: 2px; }
button.primary kbd, .btn.primary kbd, button.amber kbd { background: rgba(255, 255, 255, .18); color: #fff; border-color: rgba(255, 255, 255, .3); box-shadow: none; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.t th { background: #f7f9f9; font-size: 12px; color: var(--muted); font-weight: 600; position: sticky; top: 0; white-space: nowrap; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover { background: #f5f9f9; }
table.t tfoot td { font-weight: 600; background: #f7f9f9; border-top: 1px solid var(--line-strong); border-bottom: 0; }
table.t td.empty { text-align: center; color: var(--muted); padding: 24px; }
table.t th.num, table.t td.num { text-align: right; }
.modal.xl .doc table.t td { padding-top: 5px; padding-bottom: 5px; }
table.lines td { padding: 4px 6px; }
table.lines input, table.lines select { min-height: 32px; padding: 5px 7px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: #f1f0ee; color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); padding: 8px 12px; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.alert { padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; }
.alert.bad { background: var(--danger-soft); color: var(--danger); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--brand-soft); color: var(--brand); font-weight: 600; }   /* Update F39: "loading the rest…" */

/* ---------- typeahead ---------- */
.ta { position: relative; }
.ta-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 2px);
  background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
  max-height: 320px; overflow-y: auto;
}
.ta-item { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.ta-item:last-child { border-bottom: 0; }
.ta-item.on, .ta-item:hover { background: var(--brand-soft); }
.ta-item .sub { color: var(--muted); font-size: 12px; }
.ta-empty { padding: 10px; color: var(--muted); }
.ta-item.ta-add { color: var(--brand); font-weight: 600; position: sticky; bottom: 0; background: #faf8f7; border-top: 1px solid var(--line); }
.ta-item.ta-add.on, .ta-item.ta-add:hover { background: var(--brand-soft); }
.ta-drop input { padding-right: 34px; }
.ta-arrow {
  position: absolute; right: 1px; top: 1px; bottom: 1px; width: 32px; min-height: 0; padding: 0;
  border: 0; border-left: 1px solid var(--line); border-radius: 0 6px 6px 0; background: transparent; color: var(--muted);
}
.ta-arrow:hover { background: #f4f2f1; color: var(--ink); }
input.code-auto { font-family: var(--mono); background: #f6f8f8; color: var(--muted); }

/* ---------- billing ---------- */
.bill { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.bill .totals { position: sticky; top: 16px; }
.totals dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0 0 14px; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.totals .grand { font-size: 24px; font-weight: 700; color: var(--brand); }
.cust-info { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.line-sub { font-size: 12px; color: var(--muted); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); background: var(--bg); }
.login-art { background: radial-gradient(1200px 600px at 10% 10%, #239184 0%, #125d55 45%, #0b3631 100%); color: #fff; display: flex; align-items: center; padding: 48px; position: relative; overflow: hidden; }
.login-art::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(224,165,38,.18); }
.la-inner { max-width: 460px; position: relative; z-index: 1; }
.la-inner .logo { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 650; margin-bottom: 36px; }
.la-inner .logo img { width: 40px; height: 40px; object-fit: contain; }
.la-inner h1 { font-size: 34px; line-height: 1.15; margin-bottom: 14px; }
.la-inner p { color: rgba(255,255,255,.8); font-size: 15px; }
.login .box { align-self: center; justify-self: center; width: 100%; max-width: 380px; padding: 32px; margin: 24px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); }
.login .box h2 { font-size: 22px; margin-bottom: 18px; }
.login .box form { display: grid; gap: 14px; }
.login .box button.primary { min-height: 42px; }
@media (max-width: 800px) {
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 28px 24px; }
  .la-inner h1 { font-size: 24px; }
  .la-inner p { display: none; }
  .la-inner .logo { margin-bottom: 14px; }
}

/* ---------- modal & toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(20,30,29,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 10px; padding: 20px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; box-shadow: 0 16px 48px rgba(0,0,0,.25); }
.modal.wide { max-width: 860px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
/* large popup: fixed header and footer, the middle scrolls only if it must */
.modal.xl { max-width: 1240px; width: 96vw; max-height: 94vh; padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.m-head { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.m-head h2 { margin: 0; }
.m-body { padding: 14px 20px; overflow: auto; flex: 1; min-height: 0; }
.m-foot { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); background: #f8fafa; flex-wrap: wrap; }
.m-close { margin-left: auto; }
.ta-list.ta-fixed { position: fixed; z-index: 80; right: auto; }

/* ---------- vouchers screen ---------- */
.vpage { display: flex; flex-direction: column; height: calc(100vh - var(--top-h) - 42px); gap: 12px; }
.vbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.vbar h1 { margin-right: 8px; align-self: center; }
.vtiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, 1fr)); gap: 10px; }
.vtile { text-align: left; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; min-height: 74px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); cursor: pointer; }
.vtile:hover { border-color: var(--brand); background: var(--brand-soft); }
.vtile .vt-code { font: 700 12px var(--mono); color: #fff; background: var(--brand); border-radius: 4px; padding: 1px 6px; }
.vtile.pay .vt-code { background: #9a4a1a; }
.vtile.jv .vt-code { background: #4a4f8a; }
.vtile .vt-name { font-weight: 600; font-size: 14px; }
.vtile .vt-sub { font-size: 12px; color: var(--muted); }
.vtile.info { cursor: default; background: #f7f9f9; }
.vtile.info:hover { border-color: var(--line); background: #f7f9f9; }
.vtile.info .vt-val { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.vlist { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.vlist table.t th { position: sticky; top: 0; z-index: 1; }
.vsum { display: flex; gap: 18px; justify-content: flex-end; font-size: 13px; color: var(--muted); }
.vsum strong { color: var(--ink); }

/* voucher entry popup */
.vhead { display: grid; grid-template-columns: 150px minmax(200px, 1.4fr) 150px 150px minmax(160px, 1fr); gap: 10px; }
.vhead .wide { grid-column: span 2; }
.vlines { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.vl-row { display: grid; grid-template-columns: 30px minmax(240px, 2.2fr) 150px minmax(150px, 1.5fr) 130px 36px; gap: 8px; align-items: start; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.vlines.jv .vl-row { grid-template-columns: 30px minmax(240px, 2.2fr) 130px 130px minmax(150px, 1.4fr) 130px 36px; }   /* Update F80: amount before line narration */
.vl-row:last-child { border-bottom: 0; }
/* in the entry popup only the lines scroll; header fields and totals stay in view */
.m-body.vform { display: flex; flex-direction: column; overflow: hidden; }
.vform .vlines { flex: 0 1 auto; min-height: 120px; overflow: auto; }
.vform .vl-head { position: sticky; top: 0; z-index: 2; }
.vform > :not(.vlines) { flex-shrink: 0; }
.dbtns { display: flex; gap: 8px; flex-wrap: wrap; }
.dbtns button { min-height: 42px; }
.dbtns button.primary { min-width: 140px; }

/* ---------- sale / purchase popup ---------- */
.modal.xl:has(.dform) { height: 94vh; }
.m-body.dform { display: flex; flex-direction: column; overflow: hidden; gap: 10px; }
.dform > :not(.dlines) { flex-shrink: 0; }
.dhead { display: grid; grid-template-columns: minmax(220px, 2.2fr) repeat(4, minmax(110px, 1fr)) minmax(150px, 1.6fr); gap: 10px; }
.dhead.pur { grid-template-columns: minmax(130px, 1fr) minmax(220px, 2fr) repeat(4, minmax(110px, 1fr)) minmax(150px, 1.4fr); }
/* purchase order header (Update F21): date, supplier, payment, (BG / DCF), company PO no., deliver to, remarks */
.dhead.po { grid-template-columns: minmax(130px, 1fr) minmax(220px, 2.2fr) repeat(3, minmax(110px, 1fr)) minmax(150px, 1.6fr); }
.dhead .f, .dadd .f { margin: 0; }
.dadd { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 1.3fr); gap: 12px; align-items: end; }
.dinfo { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.dinfo .cust-info { margin: 0; }
.dlines { flex: 1 1 auto; min-height: 140px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.dlines table.t th { z-index: 2; }
.dsum { display: flex; gap: 6px 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); flex: 1 1 320px; min-width: 0; }
.dsum strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.vl-row.vl-head { background: #f7f9f9; font-size: 12px; color: var(--muted); font-weight: 600; padding-top: 8px; padding-bottom: 8px; }
.vl-row .vl-n { color: var(--muted); padding-top: 8px; font-size: 12px; text-align: right; }
.vl-row .line-sub { margin-top: 3px; min-height: 16px; }
.vl-row .vl-bal { padding-top: 8px; font-size: 13px; line-height: 1.25; }   /* Update F98: previous balance */
.vtypes { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.vtypes button { border: 0; border-radius: 0; min-height: 32px; padding: 4px 12px; background: #fff; font-size: 13px; }
.vtypes button + button { border-left: 1px solid var(--line-strong); }
.vtypes button.on { background: var(--brand); color: #fff; }
.vtotal { margin-left: auto; text-align: right; }
.vtotal .big { font-size: 22px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.vtotal .bad { color: var(--danger); }
.vwords { font-size: 12px; color: var(--muted); max-width: 520px; }
.kbd { font: 11px var(--mono); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; color: var(--muted); }
@media (max-width: 1100px) {
  .vtiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .vtile.info { grid-column: span 2; min-height: 0; }
}
@media (max-width: 900px) {
  .vpage { height: auto; }
  .vlist { overflow: visible; }
  .m-body.vform, .m-body.dform { overflow: auto; display: block; }
  .dform > * + * { margin-top: 10px; }
  .dhead, .dhead.pur, .dhead.po, .dadd { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dhead > :first-child, .dadd > * { grid-column: 1 / -1; }
  .dlines { overflow: visible; border: 0; }
  .dbtns { width: 100%; }
  .dbtns button { flex: 1; }
  .vform .vlines { overflow: visible; }
  .vtiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vtile.info { grid-column: auto; }
  .vhead { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .vhead select, .vhead input { min-width: 0; width: 100%; }
  .vhead .wide, .vhead .full { grid-column: 1 / -1; }
  .vl-row, .vlines.jv .vl-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .vl-row .vl-n, .vl-row.vl-head { display: none; }
  .vl-row .vl-who, .vl-row .vl-narr { grid-column: 1 / -1; }
  .modal.xl { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .modal-back:has(.modal.xl) { place-items: stretch; }
  .modal.xl:has(.dform) { height: 100dvh; }
  .m-head > .small.muted { display: none; }
  .m-head, .m-foot { padding: 10px 14px; }
  .m-head .m-close { margin-left: auto; }
  .m-foot .vwords { flex-basis: 100%; order: 9; }
  .modal-back:has(.modal.xl) { padding: 0; }
}
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; }
.toast { background: #21312f; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; }
.toast.bad { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* ---------- printed documents ---------- */
.doc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; max-width: 900px; }
.doc .doc-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 14px; }
.doc .company { font-size: 20px; font-weight: 700; }
/* Update F67: company logo before the company name on invoices, ledgers, reports and prints */
.has-logo .doc .company { display: flex; align-items: center; gap: 10px; }
.has-logo .doc .company.no-logo::before { display: none; }
.has-logo .doc .company::before { content: ''; flex: none; width: 52px; height: 52px; background: var(--co-logo) center / contain no-repeat;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc .doc-title { text-align: right; }
.doc .doc-title .t1 { font-size: 18px; font-weight: 700; }
.doc .parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 14px; }
.doc table.t th { position: static; }
.doc .sum { margin-left: auto; width: 300px; margin-top: 12px; }
.doc .sum div { display: flex; justify-content: space-between; padding: 3px 0; }
.doc .sum .grand { border-top: 2px solid var(--ink); font-weight: 700; font-size: 16px; margin-top: 4px; padding-top: 6px; }
.doc .foot-note { margin-top: 28px; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }

@media print {
  body { background: #fff; }
  .side, .topbar, .no-print, #toasts { display: none !important; }
  body:not(.print-office) .cost-col { display: none !important; }
  /* printing a popup: only the popup's document */
  body.print-modal .shell { display: none !important; }
  body.print-modal .modal-back { position: static; background: none; padding: 0; display: block; }
  body.print-modal .modal-back:not(:last-of-type) { display: none !important; }
  body.print-modal .modal { max-height: none; overflow: visible; box-shadow: none; max-width: none; width: auto; padding: 0; display: block; }
  body.print-modal .m-head, body.print-modal .m-foot { display: none !important; }
  body.print-modal .m-body { overflow: visible; padding: 0; }
  .shell { display: block; }
  .page { padding: 0; max-width: none; }
  .doc { border: 0; padding: 0; max-width: none; }
  .panel, .table-wrap { box-shadow: none; }
}


/* ---------- entry lines become cards on phones ---------- */
@media (max-width: 700px) {
  table.lines thead { display: none; }
  table.lines, table.lines tbody { display: block; }
  table.lines tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 12px 10px; border-bottom: 1px solid var(--line); }
  table.lines tbody tr:last-child { border-bottom: 0; }
  table.lines td { display: block; border: 0; padding: 0; min-width: 0; }
  table.lines td:first-child, table.lines td.empty { grid-column: 1 / -1; }
  table.lines td.w2 { grid-column: span 2; }
  table.lines td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
  table.lines td.num { text-align: left; align-self: end; font-weight: 600; }
  table.lines td:last-child { align-self: end; text-align: right; }
}

/* ---------- small screens (phones, folded tablets) ---------- */
@media (max-width: 900px) {
  .shell, .shell.narrow { grid-template-columns: 1fr; --side-w: 260px; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .shell.open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .shell.open .side-scrim { display: block; position: fixed; inset: 0; background: rgba(9,26,24,.4); z-index: 35; }
  .shell.narrow .side .lbl, .shell.narrow .side .chev { display: initial; }
  .shell.narrow .side .grp-b { display: grid; }
  .side .side-toggle { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .icon-btn { display: inline-flex; }
  .tb-quick, .who-name { display: none; }
  .who { border-left: 0; padding-left: 0; }
  .page { padding: 16px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bill { grid-template-columns: minmax(0, 1fr); }
  .bill .totals { position: static; }
  .doc .parties { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .cards { grid-template-columns: 1fr 1fr; }
  .card .value { font-size: 18px; }
  .doc { padding: 16px; }
  .doc .sum { width: 100%; }
}

/* =====================================================================
   Look and feel (Upgrade 4): panels, cards, forms, tables, new screens
   ===================================================================== */
.panel { border-radius: 12px; border-color: var(--line); }
.card { border-radius: 12px; position: relative; overflow: hidden; }
.card .label { font-weight: 500; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: flex-start; color: inherit; }
a.kpi:hover { text-decoration: none; border-color: #b7d5d2; box-shadow: 0 6px 18px rgba(14,42,39,.09); }
.kpi .k-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.kpi.gold .k-ic { background: #fdf3dc; color: #a26b00; }
.kpi.blue .k-ic { background: var(--info-soft); color: var(--info); }
.kpi.red .k-ic { background: var(--danger-soft); color: var(--danger); }
.kpi .k-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi .k-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; letter-spacing: -.01em; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.quick a { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.quick a:hover { text-decoration: none; border-color: var(--brand-2); background: #fbf8f6; }
.quick a .ic { color: var(--brand-2); }
.chart { width: 100%; height: 190px; }
.chart .bar { fill: #9ccec8; }
.chart .bar.on { fill: var(--brand-2); }
.chart text { font-size: 10px; fill: var(--muted); }

input, select, textarea { border-radius: 8px; transition: border-color .12s, box-shadow .12s; }
input:hover, select:hover { border-color: #adbcba; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(24,129,117,.16); }
button, .btn { border-radius: 8px; transition: background .12s, border-color .12s, box-shadow .12s; }
button.primary, .btn.primary { background: linear-gradient(180deg, #188175, #125d55); border-color: #11574f; box-shadow: 0 1px 2px rgba(14,42,39,.25); }
button.primary:hover, .btn.primary:hover { background: linear-gradient(180deg, #157267, #0f4e47); }
.table-wrap { border-radius: 12px; }
table.t th { background: #f6f8f8; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: #657674; padding-top: 9px; padding-bottom: 9px; }
table.t tbody tr:nth-child(even) td { background: #fcfcfb; }
table.t tbody tr.click:hover td { background: #f8f4f1; }
.badge { font-weight: 600; font-size: 11.5px; padding: 2px 9px; }
.badge.info { background: var(--info-soft); color: var(--info); }
.tabs button { font-weight: 500; }
.tabs button:hover { color: var(--ink); }
.toast { border-radius: 10px; box-shadow: var(--shadow-lg); }

/* list pages: filter bar + tiles */
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.filters .f { min-width: 140px; }
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chips button { min-height: 30px; padding: 3px 12px; border-radius: 999px; font-size: 13px; }
.chips button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.stat-row { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 8px 2px 0; justify-content: flex-end; }
.stat-row strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.progress { height: 6px; border-radius: 999px; background: #eceae7; overflow: hidden; min-width: 70px; }
.progress > i { display: block; height: 100%; background: var(--brand-2); border-radius: 999px; }
.progress.done > i { background: var(--ok); }

/* master popups (product, customer, supplier) */
.mform .grid { gap: 12px 14px; }
.mform h3 { margin-top: 6px; }
.mtabs { display: flex; gap: 4px; margin-left: 8px; }
.mtabs button { min-height: 30px; padding: 3px 12px; border-radius: 999px; font-size: 13px; border-color: var(--line); }
.mtabs button.on { background: var(--brand-soft); color: var(--brand); border-color: #b7d5d2; font-weight: 600; }
.inline-add { display: flex; gap: 6px; }
.inline-add select, .inline-add input { flex: 1; min-width: 0; }
.inline-add button { flex: none; min-width: 36px; padding: 0 10px; }

/* import screen */
.imp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.imp-card { text-align: left; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); cursor: pointer; }
.imp-card:hover { border-color: var(--brand-2); }
.imp-card.on { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(24,129,117,.14); }
.imp-card .k-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.imp-card b { display: block; font-size: 14px; }
.imp-card span { font-size: 12.5px; color: var(--muted); }
.drop { display: block; width: 100%; box-sizing: border-box; margin-top: 14px; cursor: pointer; border: 2px dashed var(--line-strong); border-radius: 12px; padding: 26px; text-align: center; background: #fafcfc; color: var(--muted); }
.drop.over { border-color: var(--brand-2); background: var(--brand-soft); }
.drop b { color: var(--ink); }
.drop svg { display: block; margin: 0 auto; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.steps span { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: #eef2f2; color: var(--muted); }
.steps span.on { background: var(--brand); color: #fff; }
tr.row-bad td { background: #fdf1f0 !important; }
.cell-err { color: var(--danger); font-size: 12px; }
/* import preview: a small spreadsheet, every value in its own box */
table.grid-edit { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
table.grid-edit th { position: sticky; top: 0; z-index: 2; background: #f3f0ee; border-right: 1px solid var(--line); white-space: nowrap; }
table.grid-edit td { padding: 3px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: top; background: #fff; }
table.grid-edit tbody tr:nth-child(even) td { background: #fcfcfb; }
table.grid-edit input { width: 100%; min-height: 32px; padding: 5px 8px; font-size: 13px; border: 1px solid #d4e0de; background: #fff; border-radius: 5px; box-shadow: inset 0 1px 1px rgba(14,38,35,.04); }
table.grid-edit input:hover { border-color: #a8bdbb; }
table.grid-edit input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 2px rgba(24,129,117,.15); }
table.grid-edit .ge-rn { position: sticky; left: 0; z-index: 1; background: #f3f0ee; color: var(--muted); font-size: 12px; text-align: center; min-width: 46px; vertical-align: middle; }
table.grid-edit th.ge-rn { z-index: 3; }
table.grid-edit .ge-prob { min-width: 220px; max-width: 320px; white-space: normal; vertical-align: middle; }
table.grid-edit .ge-ok { color: var(--ok); font-weight: 700; }
table.grid-edit .ge-req { color: var(--danger); }
table.grid-edit .ge-del { vertical-align: middle; text-align: center; border-right: 0; }
table.grid-edit tr.row-bad td { background: #fdf1f0 !important; }
table.grid-edit tr.row-bad .ge-rn { background: #f8d9d6 !important; color: var(--danger); font-weight: 700; }
table.grid-edit tr.row-bad input { border-color: #f0b9b4; }

/* reports screen */
.rpt { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.rpt-nav { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; position: sticky; top: calc(var(--top-h) + 12px); max-height: calc(100vh - var(--top-h) - 30px); overflow-y: auto; box-shadow: var(--shadow); }
.rpt-nav input { margin-bottom: 8px; }
.rpt-nav h3 { margin: 10px 6px 4px; font-size: 11px; }
.rpt-nav button { display: block; width: 100%; text-align: left; border: 0; background: none; min-height: 0; padding: 6px 10px; border-radius: 7px; font-size: 13.5px; color: var(--ink); font-weight: 400; }
.rpt-nav button:hover { background: #f1f5f5; }
.rpt-nav button.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.rpt-main .doc { max-width: none; border-radius: 12px; box-shadow: var(--shadow); }
.rpt-tools { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.rpt-tools .spacer { flex: 1; }
.rpt-desc { color: var(--muted); font-size: 13px; margin: -6px 0 12px; }
.bs { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
/* Update F52: balance sheet tree */
.bs-tree .bs-tg { display: inline-block; width: 16px; text-decoration: none; color: var(--muted); }
.bs-tree tr.bs-l0 td { background: #f6f9f9; }
.bs-tree tr.bs-l2 td, .bs-tree tr.bs-l3 td { font-size: 13px; }
/* Update F56: chart of accounts opens and closes like the balance sheet */
.coa-tree .coa-tg { display: inline-block; width: 16px; color: var(--muted); }
.coa-tree tr.coa-h { cursor: pointer; }
.coa-tree tr.coa-h:hover td { background: #eef6f6; }
.coa-tree tr.coa-l0 td { background: #f6f9f9; }
@media (max-width: 1000px) {
  .rpt { grid-template-columns: minmax(0, 1fr); }
  .rpt-main { min-width: 0; }
  .rpt-nav { position: static; max-height: 260px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .imp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bs { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .kpis, .imp-grid { grid-template-columns: 1fr; }
}
@media print {
  .rpt { display: block; }
  .rpt-nav, .rpt-tools { display: none !important; }
  .rpt-main .doc { box-shadow: none; }
  table.t tbody tr:nth-child(even) td { background: none; }
}
.filters:empty { display: none; }

/* ---------- quick recovery ---------- */
.rec-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.rec-form .span2 { grid-column: 1 / -1; }
.rec-bal { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 4px 0 2px; }
.rec-bal > div { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fafcfc; }
.rec-bal .l { font-size: 12px; color: var(--muted); }
.rec-bal .v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rec-bal .v.after { color: var(--brand); }
.rec-amt input { font-size: 22px; font-weight: 700; text-align: right; min-height: 48px; }
.modes { align-self: flex-start; display: inline-flex; background: #e9efef; padding: 3px; border: 1px solid var(--line-strong); border-radius: 9px; gap: 2px; }
.modes button { border: 0; border-radius: 6px; min-height: 32px; padding: 0 14px; background: transparent; color: var(--muted); box-shadow: none; }
.modes button:hover:not(.on):not([disabled]) { background: rgba(255, 255, 255, .6); color: var(--ink); }
.modes button.on, .modes button.on:hover { background: var(--brand); color: #fff; box-shadow: 0 1px 3px rgba(14,38,35,.2); }
.emp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-bottom: 14px; }
.emp-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--panel); box-shadow: var(--shadow); cursor: pointer; text-align: left; }
.emp-card:hover { border-color: var(--brand-2); }
.emp-card.on { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(24,129,117,.14); }
.emp-card .n { font-weight: 650; }
.emp-card .a { font-size: 19px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.emp-card .s { font-size: 12px; color: var(--muted); }
@media (max-width: 640px) {
  .rec-form, .rec-bal { grid-template-columns: 1fr; }
}

/* profit & loss summary */
.pl-sum td { padding: 7px 12px; }
.pl-sum tr.sub td { border-top: 1px solid var(--line-strong); background: #f6fafa; }
.pl-sum tr.grand td { border-top: 2px solid var(--ink); font-size: 15px; }

/* party detail ledger */
.t.led tr.led-doc td { background: #f3f7f7; border-top: 1px solid var(--line-strong); }
.t.led tr.led-item td { font-size: 13px; padding-top: 5px; padding-bottom: 5px; border-top: 0; }
.t.led tr.led-item td:nth-child(3) { padding-left: 22px; }
.t.led tr.led-open td { background: #fafcfc; }
.t.led td:first-child { white-space: nowrap; }
.t.led td.num { white-space: nowrap; }
@media print { .t.led tr.led-doc td { background: #f3f0ee !important; } }

/* buttons drawn flat on purpose (menus, tabs, chips, list items) */
.side button, .rpt-nav button, .tabs button, .mtabs button, .modes button, .vtypes button, .chips button,
.emp-card, .imp-card, .icon-btn, .inline-add button, .ta-item { box-shadow: none; }
.side button:hover:not([disabled]), .rpt-nav button:hover:not([disabled]), .tabs button:hover:not([disabled]), .mtabs button:hover:not([disabled]),
.modes button:hover:not([disabled]), .vtypes button:hover:not([disabled]), .icon-btn:hover:not([disabled]) { transform: none; box-shadow: none; }
.chips button:hover:not([disabled]) { transform: none; }
.emp-card:hover:not([disabled]), .imp-card:hover:not([disabled]) { transform: translateY(-2px); background: var(--panel); }
/* home and report cards: coloured top strip */
.kpi { border-top: 3px solid var(--brand-2); transition: transform .18s ease, box-shadow .18s ease; }
.kpi.gold { border-top-color: var(--gold); }
.kpi.blue { border-top-color: var(--info); }
.kpi.red { border-top-color: var(--danger); }
a.kpi:hover { transform: translateY(-2px); }
@media (max-width: 640px) { button kbd, .btn kbd { display: none; } }

/* sign-in box header */
.login .box-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.login .box-logo { width: 44px; height: 44px; border-radius: 11px; background: linear-gradient(135deg, var(--brand-2), var(--brand)); display: grid; place-items: center; box-shadow: 0 3px 10px rgba(18,102,92,.3); flex: none; }
.login .box-logo img { width: 44px; height: 44px; display: block; object-fit: contain; }
.login .bh-name { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.login .bh-sub { font-size: 12.5px; color: var(--muted); }
.login .box button.primary { min-height: 44px; font-size: 14.5px; width: 100%; }

/* ---------- Excel-like tables (grid.js) ---------- */
table.t tbody tr.g-hide { display: none; }
table.t th.g-th { padding-right: 4px; }
table.t th .g-h { cursor: pointer; }
table.t th .g-h:hover { color: var(--brand); }
table.t th .g-sort { font-size: 9px; color: var(--brand); margin-left: 3px; vertical-align: 1px; }
table.t th .g-btn { min-height: 0; width: 20px; height: 20px; padding: 0; margin-left: 4px; border-radius: 5px; border: 1px solid transparent; background: transparent; box-shadow: none; color: #99aaa8; vertical-align: -5px; opacity: .55; }
table.t th:hover .g-btn, table.t th .g-btn:focus-visible { opacity: 1; }
table.t th .g-btn:hover:not([disabled]) { background: var(--brand-soft); color: var(--brand); border-color: #b6dbd6; transform: none; box-shadow: none; }
table.t th.g-filtered { color: var(--brand); }
table.t th.g-filtered .g-btn { opacity: 1; background: var(--brand); color: #fff; border-color: var(--brand); }
table.t td .g-sum { color: var(--brand); }
.g-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 6px; font-size: 12.5px; color: var(--muted); }
.g-bar .g-sp { flex: 1; }
.g-bar .g-count b { color: var(--ink); }
.g-bar .g-hint { font-size: 12px; color: #99aaa8; }
.g-bar button.small { min-height: 26px; padding: 2px 9px; font-size: 12px; }
.g-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--brand-soft); color: var(--brand); border: 1px solid #b6dbd6; border-radius: 999px; padding: 2px 4px 2px 10px; font-weight: 600; cursor: pointer; }
.g-chip button { min-height: 0; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: transparent; box-shadow: none; color: var(--brand); font-size: 11px; }
.g-chip button:hover:not([disabled]) { background: #fff; transform: none; box-shadow: none; }
.g-menu { position: fixed; z-index: 3000; background: #fff; border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 14px 40px rgba(14,38,35,.22); padding: 10px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.g-m-title { font-weight: 700; font-size: 13px; color: var(--ink); padding: 0 2px; }
.g-m-sort { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.g-m-sort button { min-height: 30px; font-size: 12px; padding: 4px 6px; }
.g-m-range { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.g-m-range input, .g-m-search { min-height: 32px; padding: 5px 8px; font-size: 13px; }
.g-m-all { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.g-m-list { max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.g-m-list label { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.g-m-list label:hover { background: #f7f4f2; }
.g-m-list label span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-m-list label em { font-style: normal; font-size: 11px; color: var(--muted); background: #f4f2f1; border-radius: 999px; padding: 0 7px; }
.g-m-foot { display: flex; gap: 6px; align-items: center; }
.g-m-foot .g-sp { flex: 1; }

/* ---------- reports gallery ---------- */
.rg { --tone: #188175; --tone-soft: #e5f3f1; --tone-ink: #125d55; margin-bottom: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); border-top: 4px solid var(--tone); }
.rg-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.rg-head h2 { margin: 0; color: var(--tone-ink); }
.rg-ic, .rc-ic, .rp-ic { display: grid; place-items: center; border-radius: 12px; background: var(--tone-soft); color: var(--tone); flex: none; }
.rg-ic { width: 42px; height: 42px; background: var(--tone); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--tone) 35%, transparent); }
.rg-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
button.rcard { display: flex; align-items: flex-start; gap: 12px; text-align: left; white-space: normal; justify-content: flex-start; padding: 12px 14px; min-height: 76px; border-radius: 12px; border: 1px solid var(--line); background: linear-gradient(180deg, #fff 0%, #fafcfc 100%); font-weight: 400; }
button.rcard:hover:not([disabled]) { border-color: var(--tone); background: linear-gradient(180deg, #fff 0%, var(--tone-soft) 100%); box-shadow: 0 6px 16px rgba(14,38,35,.10); }
.rc-ic { width: 36px; height: 36px; border-radius: 10px; }
button.rcard:hover .rc-ic { background: var(--tone); color: #fff; }
.rc-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rc-t b { font-size: 14px; color: var(--ink); }
.rc-t span { font-size: 12px; color: var(--muted); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- report popup ---------- */
.modal.rp { --tone: #188175; --tone-soft: #e2f4f2; --tone-ink: #125d55; height: 94vh; }
@media (max-width: 760px) { .modal.rp { height: 100dvh; } }
.rp-head { background: linear-gradient(90deg, var(--tone-soft), #fff 70%); border-bottom: 3px solid var(--tone); }
.rp-ic { width: 42px; height: 42px; background: var(--tone); color: #fff; }
.rp-tt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rp-group { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--tone-ink); }
#rp-pick { font-size: 17px; font-weight: 700; border: 0; background: transparent; padding: 0 22px 0 0; min-height: 0; color: var(--ink); max-width: 70vw; box-shadow: none; }
#rp-pick:focus { box-shadow: none; text-decoration: underline; }
.rp-body { background: #f7f6f4; }
.rp-body .doc { max-width: none; border-radius: 12px; box-shadow: var(--shadow); }
.rp table.t th { background: var(--tone-soft); color: var(--tone-ink); }
.rp table.t tfoot td { background: var(--tone-soft); color: var(--tone-ink); }
.rp .kpi { border-top-color: var(--tone); }
.rp .rpt-tools .chips button:hover { border-color: var(--tone); }
@media print { .rp table.t th, .rp table.t tfoot td { background: #f4f2f1 !important; color: #222 !important; } }

/* report group colours (after the defaults) */
.g-sales, .modal.rp.g-sales { --tone: #188175; --tone-soft: #e2f4f2; --tone-ink: #125d55; }
.g-pur, .modal.rp.g-pur { --tone: #1f6fb2; --tone-soft: #e3effa; --tone-ink: #175a92; }
.g-stock, .modal.rp.g-stock { --tone: #d98a06; --tone-soft: #fdf1da; --tone-ink: #995f00; }
.g-acc, .modal.rp.g-acc { --tone: #7048c2; --tone-soft: #efe9fb; --tone-ink: #57349e; }
@media (max-width: 760px) { .g-bar .g-hint { display: none; } }

/* card-like buttons: text wraps, left aligned, normal weight (the general button style is one centred line) */
button.imp-card, button.emp-card, button.vtile, button.rcard { white-space: normal; justify-content: flex-start; text-align: left; font-weight: 400; font-size: 14px; line-height: 1.4; }
button.imp-card, button.emp-card { min-height: 0; }
button.imp-card > span:last-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
button.imp-card b { color: var(--ink); font-weight: 650; }
button.imp-card span span { line-height: 1.4; }
button.emp-card { display: block; }
button.vtile { align-items: flex-start; }
button.vtile, button.vtile * { white-space: normal; }
.imp-card.on, .imp-card.on:hover:not([disabled]) { border-color: var(--brand); background: #faf6f3; box-shadow: 0 0 0 3px rgba(24,129,117,.14); }
/* the import panel heading: icon and title on one line */
.panel > h2:has(svg) { display: flex; align-items: center; gap: 8px; }

/* document numbers never break across lines */
table.t td .mono, table.t td.mono { white-space: nowrap; }

.login-links { display: flex; justify-content: center; margin-top: 10px; }
.login-links button { color: var(--brand); font-weight: 600; }
.modal .foot .spacer { flex: 1; }

/* ===== First-run setup (setup.html) — styled after the SSMS 2022 Connect dialog ===== */
.setup-body { min-height: 100vh; background: #0b3631 radial-gradient(1200px 700px at 15% 0%, #239184 0%, #125d55 45%, #0b3631 100%) no-repeat; }
.db-item.new .db-txt b { font-family: var(--font); }
.setup-wrap { max-width: 760px; margin: 0 auto; padding: 28px 16px 48px; }
.setup-wrap > .loading { color: #fff; justify-content: center; padding: 80px 0; display: flex; gap: 10px; align-items: center; }
.setup-brand { display: flex; align-items: center; gap: 12px; color: #fff; margin-bottom: 18px; }
.setup-brand img { width: 42px; height: 42px; background: #fff; border-radius: 10px; padding: 5px; }
.setup-brand .sb-name { font-size: 20px; font-weight: 650; }
.setup-brand .sb-sub { opacity: .8; font-size: 13px; }
.setup-steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 16px; flex-wrap: wrap; }
.setup-steps li { display: flex; align-items: center; gap: 6px; color: rgba(255,255,255,.65); font-size: 13px; padding: 4px 10px 4px 4px; border-radius: 999px; background: rgba(255,255,255,.07); }
.setup-steps li b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: rgba(255,255,255,.15); }
.setup-steps li.on { color: #fff; background: rgba(255,255,255,.18); font-weight: 600; }
.setup-steps li.on b { background: var(--gold); color: #3a2a00; }
.setup-steps li.done b { background: #43cbbb; color: #053530; }
.ssms { background: #fff; border: 1px solid #a5a09a; border-radius: 6px; box-shadow: 0 24px 60px rgba(0,0,0,.35); overflow: hidden; max-width: 560px; }
.ssms.wide { max-width: 760px; }
.ssms-title { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: #f3f3f3; border-bottom: 1px solid #dcdcdc; font-size: 13px; color: #1e1e1e; font-weight: 600; }
.ssms-x { min-height: 0; padding: 0 6px; font-size: 14px; }
.ssms-banner { padding: 16px 20px; background: linear-gradient(90deg, #0b3631, #188175); color: #fff; }
.ssms-banner .sb-big { font-size: 26px; font-weight: 300; letter-spacing: .01em; }
.ssms-banner .sb-small { font-size: 12px; opacity: .8; }
.ssms-body { padding: 18px 20px 16px; display: block; }
.ssms-body .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.ssms-grid { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px 12px; align-items: center; }
.ssms-grid > label:not(.f) { font-size: 13px; color: #333; }
.ssms-grid .dim { opacity: .45; }
.ssms-grid .sn { display: flex; gap: 6px; }
.ssms-grid .sn input { flex: 1; min-width: 0; font-family: var(--mono); }
.ssms-grid #user { font-family: var(--mono); }
.ssms .note { margin-top: 12px; padding: 9px 12px; border-left: 3px solid var(--info); background: var(--info-soft); border-radius: 4px; font-size: 12.5px; color: #1d3c63; }
.ssms code { font-family: var(--mono); font-size: 12px; background: #f1f0ee; padding: 0 4px; border-radius: 3px; }
.ssms .proof { margin-top: 12px; padding: 10px 12px; background: var(--warn-soft); border-radius: 6px; }
.ssms .alert { margin: 12px 0 0; }
.ssms .found { margin-top: 12px; display: grid; gap: 6px; }
.ssms .pick-srv { display: flex; justify-content: space-between; gap: 10px; text-align: left; white-space: normal; height: auto; }
.ssms .pick-srv b { font-family: var(--mono); font-weight: 600; }
.ssms .pick-srv span { color: var(--muted); font-size: 12px; }
.setup-ok { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); margin-bottom: 12px; }
.big-tick { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-weight: 700; }
.db-list { display: grid; gap: 8px; margin-top: 12px; }
.db-item { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; transition: border-color .12s, background .12s; }
.db-item:hover:not(.off) { border-color: var(--brand-2); background: #f7fbfb; }
.db-item:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; }
.db-item.off { opacity: .55; cursor: not-allowed; }
.db-item .db-ico { font-size: 18px; width: 24px; text-align: center; }
.db-item .db-txt { display: flex; flex-direction: column; min-width: 0; }
.db-item .db-txt b { font-family: var(--mono); word-break: break-all; }
.db-item .db-txt small { color: var(--muted); font-size: 12px; }
.db-item.new { border-style: dashed; }
.db-item.new input:not([type=radio]) { margin-top: 6px; max-width: 260px; font-family: var(--mono); }
.pbar { height: 14px; border-radius: 999px; background: #e6ecec; overflow: hidden; margin: 8px 0; }
.pbar > div { height: 100%; background: linear-gradient(90deg, var(--brand-2), #43cbbb); transition: width .3s; }
.pbar > div.ok { background: var(--ok); }
.prow { display: flex; justify-content: space-between; gap: 10px; }
.prow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; margin-bottom: 12px; font-size: 13px; }
.kv span { color: var(--muted); }
.kv b { font-family: var(--mono); word-break: break-all; }
.setup-form { display: grid; gap: 12px; margin-top: 8px; }
.setup-form.two { grid-template-columns: 1fr 1fr; }
.setup-form .wide { grid-column: 1 / -1; }
.setup-form .foot { margin-top: 4px; }
.setup-done { text-align: center; padding: 10px 0; }
.setup-done .big-tick { width: 56px; height: 56px; font-size: 28px; margin: 0 auto 8px; }
.setup-done h2 { font-size: 20px; margin-bottom: 6px; }
.db-info { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 16px; }
.db-info > div { display: flex; flex-direction: column; min-width: 0; }
.db-info b { font-family: var(--mono); font-weight: 600; overflow-wrap: anywhere; font-size: 13px; }
.db-info .span-all { grid-column: 1 / -1; }
@media (max-width: 560px) {
  .setup-wrap { padding: 16px 12px 32px; }
  .ssms-grid { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .ssms-grid > label:not(.f) { margin-top: 6px; }
  .ssms-grid > span:empty { display: none; }
  .setup-form.two { grid-template-columns: minmax(0, 1fr); }
  .db-item { grid-template-columns: auto minmax(0, 1fr); }
  .db-item .db-ico { display: none; }
  .db-item > .badge { grid-column: 2; justify-self: start; }
  .setup-steps li span { display: none; }
  .setup-steps li.on span { display: inline; }
}

/* ===== Delete buttons on lists and "Delete all shown" (administrators) ===== */
th.del-col, td.del-col { width: 34px; padding-left: 6px !important; padding-right: 0 !important; text-align: center; }
.row-del { min-height: 0; width: 28px; height: 28px; padding: 0; display: inline-grid; place-items: center; border-radius: 6px; border-color: transparent; background: transparent; box-shadow: none; color: #a5a09a; }
.row-del:hover:not([disabled]) { color: var(--danger); background: var(--danger-soft); border-color: #f0b9b4; box-shadow: none; transform: none; }
tr:not(:hover) .row-del { opacity: .55; }
.g-bar button.danger { margin-left: 4px; }
.toast.warn { background: #a86400; }
.bd-title { display: flex; align-items: center; gap: 8px; color: var(--danger); }
.bd-title svg { flex: none; }
.bd-title.done { color: var(--ok); }
.bd-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.bd-stats > div { flex: 1; min-width: 120px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfafa; display: flex; flex-direction: column; }
.bd-stats span { font-size: 12px; color: var(--muted); }
.bd-stats b { font-size: 20px; font-variant-numeric: tabular-nums; }
.bd-stats .ok { border-color: #b7dcc4; background: var(--ok-soft); } .bd-stats .ok b { color: var(--ok); }
.bd-stats .warn { border-color: #f0d7a0; background: var(--warn-soft); } .bd-stats .warn b { color: var(--warn); }
.bd-stats .bad { border-color: #f0b9b4; background: var(--danger-soft); } .bd-stats .bad b { color: var(--danger); }
.bd-list { margin: 0; padding: 8px 12px 8px 28px; border: 1px solid var(--line); border-radius: 8px; max-height: 190px; overflow: auto; font-size: 13px; }
.bd-list li { margin: 2px 0; }
#bd-word { font-family: var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.bd-fail { border: 1px solid #f0b9b4; background: #fff8f7; border-radius: 8px; padding: 10px 12px; font-size: 13px; max-height: 240px; overflow: auto; }
.bd-fail ul { margin: 6px 0 0; padding-left: 18px; }
.bd .pbar > div { background: linear-gradient(90deg, #e03131, #f06565); }

/* ===== Automatic refresh indicator (top bar) ===== */
.live-ind { gap: 6px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.live-ind svg { transform: scaleX(-1); }
.live-ind .li-dot { width: 7px; height: 7px; border-radius: 50%; background: #2fb36b; box-shadow: 0 0 0 3px rgba(47,179,107,.18); }
/* Update F102: voice command button + language switch in the top bar */
.vc-wrap { display: inline-flex; align-items: center; gap: 2px; }
.vc-btn { font-size: 16px; line-height: 1; padding-left: 8px; padding-right: 8px; }
.vc-btn.vc-on { background: #fde8e8; color: #b42318; box-shadow: 0 0 0 0 rgba(217,45,32,.5); animation: vc-pulse 1.2s infinite; }
.vc-lang { font-weight: 600; min-width: 42px; }
@keyframes vc-pulse { 0% { box-shadow: 0 0 0 0 rgba(217,45,32,.45); } 70% { box-shadow: 0 0 0 9px rgba(217,45,32,0); } 100% { box-shadow: 0 0 0 0 rgba(217,45,32,0); } }
.live-ind.stale .li-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(179,38,30,.15); }
.live-ind.stale { color: var(--danger); }
.live-ind.spinning svg { animation: spin .8s linear infinite; }
@media (max-width: 700px) { .live-ind .li-t { display: none; } }

/* ===== A page opened in its own window (?win=1), e.g. an expense ledger from a report ===== */
body.win-mode .shell { display: block; }
body.win-mode .side, body.win-mode .topbar { display: none; }
body.win-mode .page { max-width: none; padding-top: 16px; }

/* ===== Administrative reports ===== */
.g-admin, .modal.rp.g-admin { --tone: #b4235a; --tone-soft: #fce8f0; --tone-ink: #8c1745; }
/* a report opened in its own window fills the window */
body.win-mode .modal-back { padding: 0; background: var(--bg); }
body.win-mode .modal.xl { width: 100vw; max-width: none; height: 100vh; max-height: 100vh; border-radius: 0; box-shadow: none; }

/* choose several (categories, suppliers, groups) */
.f.mp { min-width: 190px; }
.mp-btn { justify-content: space-between; gap: 10px; min-width: 190px; max-width: 280px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-btn.on { border-color: var(--tone, var(--brand)); background: var(--tone-soft, var(--brand-soft)); color: var(--tone-ink, var(--brand)); }
.mp-btn .mp-car { opacity: .6; font-size: 11px; }
.mp-pop { position: fixed; z-index: 80; width: 280px; background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.mp-pop .mp-s { width: 100%; }
.mp-pop .mp-list { max-height: 280px; overflow: auto; display: flex; flex-direction: column; border-top: 1px solid var(--line); padding-top: 4px; }
.mp-pop label { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.mp-pop label:hover { background: #f6f4f3; }
.mp-pop .mp-foot { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--line); padding-top: 6px; }
.rf-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--tone-ink, var(--muted)); background: var(--tone-soft, #f4f2f1); border-radius: 999px; padding: 3px 12px; margin: 0 0 10px; }

/* cash vs credit */
.cc-bar { display: flex; height: 30px; border-radius: 8px; overflow: hidden; background: #edf1f1; font-size: 12.5px; font-weight: 600; color: #fff; }
.cc-bar span { display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; }
.cc-bar.thin { height: 10px; min-width: 120px; border-radius: 999px; }
.cc-cash { background: #1f8a57; }
.cc-credit { background: #e08a0b; }
.cc-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin: 6px 0 12px; }
.cc-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.kpi.cc-k-cash { --k: #1f8a57; } .kpi.cc-k-credit { --k: #e08a0b; }
.kpi.cc-k-cash .k-ic { background: #e2f4ea; color: #1f8a57; } .kpi.cc-k-credit .k-ic { background: #fdf0da; color: #b66d00; }

/* receivables by amount */
.band-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 4px 0 10px; }
.band { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; white-space: normal; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); border-left: 5px solid var(--b); background: #fff; min-height: 0; font-weight: 400; }
.band:hover:not([disabled]) { border-color: var(--b); background: var(--bs); }
.band.on { background: var(--bs); border-color: var(--b); box-shadow: 0 0 0 2px var(--b) inset; }
.band .bd-name { font-size: 12.5px; font-weight: 650; color: var(--b); text-transform: uppercase; letter-spacing: .03em; }
.band .bd-amt { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.band .bd-meta { font-size: 12.5px; color: var(--muted); }
.band .bd-bar { width: 100%; height: 6px; border-radius: 999px; background: #f1f0ee; overflow: hidden; margin-top: 4px; }
.band .bd-bar i { display: block; height: 100%; background: var(--b); }
.band.red { --b: #c92a2a; --bs: #fdecec; } .band.gold { --b: #c77700; --bs: #fdf3e1; } .band.blue { --b: #1d5fa8; --bs: #e8f0fb; } .band.green { --b: #1f7a50; --bs: #e4f4eb; }
.badge.band-red { background: #fdecec; color: #c92a2a; } .badge.band-gold { background: #fdf3e1; color: #a86400; }
.badge.band-blue { background: #e8f0fb; color: #1d5fa8; } .badge.band-green { background: #e4f4eb; color: #1f7a50; }
.band-total { font-size: 13.5px; margin: 0 0 10px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.band-total b { color: var(--ink); }
@media (max-width: 760px) { .band-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .band { padding: 10px; } .band .bd-amt { font-size: 15.5px; overflow-wrap: anywhere; } .band .bd-name { font-size: 11px; } }
@media print { .cc-cash, .cc-credit, .band .bd-bar i { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ===== Backup & restore (Home) ===== */
.bk-panel { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; border-left: 4px solid #1d5fa8; }
.bk-panel .bk-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--info-soft); color: var(--info); flex: none; }
.bk-panel .bk-t b { font-size: 15px; }
.bad-t { color: var(--danger); font-weight: 600; }
.bk-h { display: flex; align-items: center; gap: 8px; }
.bk-h.ok { color: var(--ok); }
.kv-list { display: grid; gap: 6px; margin: 10px 0; }
.kv-list > div { display: flex; flex-direction: column; }
.kv-list span { font-size: 12px; color: var(--muted); }
.kv-list b { word-break: break-all; }
.bk-rows { display: grid; gap: 6px; max-height: 300px; overflow: auto; }
.bk-row { display: grid; grid-template-columns: auto 170px minmax(0, 1fr) auto 70px; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; }
.bk-row:hover:not(.off) { background: #f7fbfb; }
.bk-row:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.bk-row.off { opacity: .55; cursor: not-allowed; }
.bk-row .bk-d { display: flex; flex-direction: column; }
.bk-row .bk-d small { color: var(--muted); font-size: 11.5px; }
.bk-row .bk-f { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.bk-up { margin-top: 12px; }
.bk-sel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 14px; margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--info-soft); }
.bk-sel.warn { background: var(--warn-soft); }
.bk-sel > div { display: flex; flex-direction: column; min-width: 0; }
.bk-sel span { font-size: 12px; color: var(--muted); }
.bk-sel b { word-break: break-all; }
@media (max-width: 640px) { .bk-row { grid-template-columns: auto minmax(0, 1fr) auto; } .bk-row .bk-f, .bk-row .num { display: none; } .bk-sel { grid-template-columns: 1fr 1fr; } }

/* ===== Customer address in pickers and on the sale ===== */
.ta-addr { color: var(--muted); font-weight: 400; }
.badge.cust-addr { background: var(--info-soft); color: var(--info); white-space: normal; text-align: left; }
.ta-list { min-width: min(480px, 92vw); }

/* ---------- smooth scrolling (Update 22) ----------
   Remote Desktop has no graphics card: blur effects and animated hover colours on hundreds of rows
   are drawn by the processor on every scroll step. Keep big lists cheap to repaint. */
table.t tbody tr, table.t tbody td, table.t tbody button { transition: none !important; }
html { scroll-behavior: auto; }

/* ---------- WhatsApp (Update 23) ---------- */
.wa-btn { color: #048374; border-color: #b4dfda; }
.wa-btn:hover:not([disabled]) { background: #e9f8f6; border-color: #8bcec6; }
.toast-act { display: flex; align-items: center; gap: 10px; }
.toast-act button { flex: none; background: #fff; color: #1a3d39; border: 0; }
.wa-sale { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-right: auto; cursor: pointer; }
.wa-sale input { margin: 0; }
.wa-help code { background: #f3f0ee; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.wa-preview { white-space: pre-wrap; background: #e6f8f6; border: 1px solid #c1e9e4; border-radius: 10px 10px 10px 2px; padding: 10px 12px; font-size: 13px; max-width: 420px; }
/* the copy the PDF is made from: off screen, fixed width, white, like the printed page */
.pdf-host { position: fixed; left: -30000px; top: 0; width: 1000px; padding: 20px 24px; background: #fff; color: #111; z-index: -1; }
.pdf-host .doc { box-shadow: none !important; border: 0 !important; margin: 0 !important; max-width: none !important; padding: 0 !important; }
.pdf-host table.t th { position: static; }
.pdf-host a { color: inherit; text-decoration: none; }

/* ---------- voucher type views + contra report (Update 24) ---------- */
.vtile.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.vtile.on .vt-name::after { content: ' ✓'; color: var(--brand); }
#new-v kbd { margin-left: 6px; }
.contra-pick { max-width: 720px; }
.cp-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.cp-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.cp-row:last-child { border-bottom: 0; }
.cp-row:hover { background: #f5f9f9; }
.cp-row input { width: 18px; height: 18px; margin: 0; }
.cp-row .cp-name { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.contra-banks { align-items: center; margin-bottom: 10px; gap: 6px; }
.contra-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.contra-cards .kpi { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.contra-cards .big { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.contra-tot { display: flex; gap: 22px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; padding: 10px 14px; border-top: 2px solid var(--ink); font-size: 14px; }
@media (max-width: 760px) { .contra-cards { grid-template-columns: 1fr; } }
.contra-banks ~ h3 { margin: 20px 0 8px; }
.contra-cards .kpi { display: flex; flex-direction: column; gap: 2px; }

/* ---------- stock dashboard (Update 25) ---------- */
.dash-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; align-items: center; }
.dl-chip { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; padding: 3px 4px 3px 3px; }
.dl-chip.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.dl-chip.dim { opacity: .5; }
.dl-sw { position: relative; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.dl-sw input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; padding: 0; border: 0; }
.dl-name { border: 0; background: none; box-shadow: none; min-height: 0; padding: 2px 8px; font-size: 13px; font-weight: 500; }
.dl-name span { color: var(--muted); font-weight: 400; margin-left: 2px; }
.dl-reset { border: 0; background: none; box-shadow: none; min-height: 0; padding: 0 6px; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.dcard { background: var(--c); color: var(--ink); border-radius: 12px; padding: 12px 14px 10px; min-height: 118px; display: flex; flex-direction: column; gap: 2px;
  content-visibility: auto; contain-intrinsic-size: 190px 118px; }
.dc-name { font-weight: 650; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dc-code { font: 11px var(--mono); opacity: .75; }
.dc-qty { font-size: 26px; font-weight: 750; margin-top: auto; font-variant-numeric: tabular-nums; line-height: 1.1; }
.dc-qty span { font-size: 13px; font-weight: 500; opacity: .8; }
.dc-foot { display: flex; gap: 6px; align-items: center; font-size: 11.5px; opacity: .92; }
.dc-foot span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-foot b { background: rgba(255, 255, 255, .92); color: #8a1c1c; border-radius: 999px; padding: 0 7px; font-size: 11px; }
.dc-foot b.dc-delta { color: #132220; }
.dcard.zero { opacity: .55; }
.dcard.changed { animation: dc-flash 2.4s ease-out 1; }
@keyframes dc-flash { 0%, 40% { box-shadow: 0 0 0 4px #ffd54f, 0 6px 18px rgba(0, 0, 0, .25); } 100% { box-shadow: none; } }
.dsec { display: flex; gap: 10px; align-items: stretch; margin: 0 0 12px; }   /* Update F63: one row per group */
.dsec-h { flex: 0 0 170px; display: flex; flex-direction: column; gap: 4px; background: var(--c); color: var(--ink); border-radius: 12px; padding: 10px 12px; cursor: pointer; user-select: none; }
.dsec.folded .dsec-h { flex: 1 1 auto; flex-direction: row; align-items: center; gap: 14px; padding: 6px 12px; }
.dsec-top { display: flex; align-items: center; gap: 6px; }
.dsec-tg { width: 12px; }
.dsec-n { font-size: 16px; letter-spacing: .3px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dsec-q { font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.1; }
.dsec-c { font-size: 12px; opacity: .9; font-variant-numeric: tabular-nums; }
.dsec-mv { display: inline-flex; gap: 3px; }
.dsec-mv button { min-height: 0; padding: 0 6px; font-size: 11px; background: rgba(255, 255, 255, .9); color: #1d2a22; border: 0; box-shadow: none; }
.dsec-mv button:disabled { opacity: .35; }
.dash-board { display: block; }   /* Update F64: rows one under the other (it was a grid, which squeezed each row into a tile) */
.dash-row::-webkit-scrollbar { height: 8px; }
.dash-row::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .25); border-radius: 4px; }
.dash-row { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; }   /* Update F66: next line, no sideways scrolling */
.dash-row .dcard { flex: 0 0 190px; min-width: 0; content-visibility: visible; }
@media (max-width: 640px) { .dash-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } .dc-qty { font-size: 22px; } .dsec-h { flex-basis: 120px; } .dash-row .dcard { flex-basis: 150px; } }
.side nav a .win-ic { margin-left: auto; opacity: .55; display: inline-flex; transform: rotate(45deg); }
.shell.narrow .side nav a .win-ic { display: none; }

/* ---------- daily business summary (Update 27) ---------- */
.daily-acts { align-items: center; gap: 6px; margin-bottom: 10px; }
.daily-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.daily-cards .kpi.neg .big { color: var(--danger); }
.daily-t td:first-child { width: 40%; }
/* Update F58: products table of the daily business summary */
.daily-t.ds-prod td:first-child { width: auto; }
.daily-t.ds-prod tr.ds-cat td { background: #eef6f6; }
.daily-t td.neg { color: var(--danger); }
/* Update F61: the small tables after the products sit side by side */
.ds-boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 4px 18px; align-items: start; }
.ds-box h3 { margin-top: 10px; }
.ds-box .daily-t td:first-child { width: auto; }
@media print { .ds-boxes { grid-template-columns: 1fr 1fr; } }
/* Update F61: BG / DCF report month lines */
.bgd-t tr.bgd-mo td { background: #eef6f6; }
.bgd-t tr.bgd-st td { font-weight: 600; border-bottom: 2px solid var(--line-strong); }
.contra-cards ~ h3 { margin: 18px 0 6px; }
@media (max-width: 900px) { .daily-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* BG / DCF report (Update F9) */
.bgd-h { margin: 6px 0 2px; font-size: 18px; }
.bgd-sep { border: 0; border-top: 2px solid var(--line); margin: 22px 0 10px; }


/* ======================================================================
   Teal light theme (Update F11): light menu with dark text, teal highlights,
   soft white cards. Status colours (green paid / profit, red late) unchanged.
   ====================================================================== */
.side { background: #eaf5f3; color: #14302d; border-right: 1px solid #d3e7e3; }
.side .logo { color: #0b4a45; }
.side nav { scrollbar-color: rgba(15,118,110,.25) transparent; }
.side nav a, .side .grp-h { color: #2c4f4b; }
.side nav a:hover, .side .grp-h:hover { background: rgba(19,137,127,.10); color: #0b4a45; }
.side .grp-h { color: #1d3d39; }
.side .grp.has-active > .grp-h { color: #0b4a45; }
.side .grp-b { border-left-color: #cfe5e1; }
.side .grp-b a { color: #3d625e; }
.side .grp-b a .dot { background: #9cc9c2; }
.side nav a.active { background: #13897f; color: #fff; box-shadow: 0 2px 6px rgba(19,137,127,.25); }
.side nav a.active::before { display: none; }
.side nav a.active .dot { background: #fff; }
.side nav a.top.quick-rec { background: #fff4dd; color: #8a5a00; border-color: #f1d79a; }
.side nav a.top.quick-rec:hover, .side nav a.top.quick-rec.active { background: #ffe9b8; color: #6b4600; }
.side nav a .plus { background: #d9efeb; color: #0f766e; }
.side .side-toggle { background: #ffffff; color: #3d625e; border-color: #d3e7e3; }
.side .side-toggle:hover { background: #dff1ee; color: #0b4a45; }
.topbar { background: rgba(255,255,255,.92); backdrop-filter: saturate(1.2) blur(6px); border-bottom: 1px solid #dcebe8; }
button.primary, .btn.primary { background: #13897f; border-color: #0f766e; box-shadow: 0 1px 3px rgba(15,118,110,.25); color: #fff; }
button.primary:hover:not([disabled]), .btn.primary:hover { background: #0f766e; }
.card, .panel { border-radius: 14px; border-color: #dcebe8; box-shadow: 0 1px 2px rgba(20,48,45,.04), 0 6px 18px rgba(20,48,45,.05); }
.card .value { color: #0b4a45; }
table.t th { background: #f1f8f6; color: #4a6b67; }
table.t tbody tr:hover { background: #f5fbfa; }
.badge.info { background: #dff1ee; color: #0b4a45; }
.login-art { background: radial-gradient(1200px 600px at 10% 10%, #2bb3a5 0%, #13897f 45%, #0b4a45 100%); }
.setup-body { background: #0b4a45 radial-gradient(1200px 700px at 15% 0%, #2bb3a5 0%, #13897f 45%, #0b4a45 100%) no-repeat; }
.ssms-banner { background: linear-gradient(90deg, #0b4a45, #13897f); }

/* Clear data popup (Update F12) */
.cl-rows { display: grid; gap: 8px; }
.cl-row { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
.cl-row > span { display: grid; gap: 3px; }
.cl-row small { display: block; line-height: 1.4; }
.cl-row input { margin-top: 3px; }

/* Bank DCF limits with one row per company (Update F16) */
.dcf-lim tr.dcf-bank td { background: var(--brand-soft, #e6f4f2); border-top: 2px solid var(--line-strong); }
.dcf-lim tr.dcf-co td:first-child { padding-left: 22px; }

/* BG / DCF: one box per bank, stacked full width (Update F17 / F18) */
.bank-boxes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.bank-box { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow); }
.bank-box .bb-top { display: grid; grid-template-columns: minmax(180px, 1.1fr) minmax(0, 3fr) auto; gap: 16px; align-items: center; }
.bank-box .bb-name strong { font-size: 15px; }
.bank-box .bb-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.bank-box .bb-figs div { display: flex; flex-direction: column; }
.bank-box .bb-figs span { font-size: 11px; color: var(--muted); }
.bank-box .bb-figs b { font-size: 15px; font-variant-numeric: tabular-nums; }
.bank-box .bb-bar { height: 6px; background: var(--line); border-radius: 3px; margin-top: 6px; overflow: hidden; max-width: 220px; }
.bank-box .bb-bar i { display: block; height: 100%; background: var(--brand); }
.bank-box .bb-bar.over i { background: var(--danger); }
.bank-box .bb-warn { margin-top: 6px; }
.bank-box .bb-t { margin-top: 8px; font-size: 13px; }
.bank-box tr.bb-row { cursor: pointer; }
.bank-box tr.bb-row:hover td { background: var(--brand-soft, #e6f4f2); }
.bb-total { margin: 4px 0 8px; font-size: 13px; color: var(--muted); }
.bb-total b { color: var(--ink); }
@media (max-width: 800px) {
  .bank-box .bb-top { grid-template-columns: 1fr auto; }
  .bank-box .bb-figs { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* total of all banks: gold box above the bank boxes (Update F19) */
.bank-box.bb-sum { background: #fdf6e3; border-color: #ecd9a6; border-left-color: #b7791f; margin-bottom: 10px; }
.bank-box.bb-sum .bb-name strong, .bank-box.bb-sum .bb-figs b:not(.profit-neg) { color: #7a4f0e; }
.bank-box.bb-sum .bb-bar { background: #f1e2b8; }
.bank-box.bb-sum .bb-bar i { background: #b7791f; }
.bank-box .bb-edit { min-width: 52px; text-align: right; }

/* Stock Available / Pending Orders (Update F23): cost line on cards, totals strip */
.dc-cost { font-size: 12px; opacity: .9; font-variant-numeric: tabular-nums; }
.dcard.clickable { cursor: pointer; }
.dash-total { display: flex; flex-wrap: wrap; gap: 10px 28px; background: #fdf6e3; border: 1px solid #ecd9a6; border-left: 4px solid #b7791f;
  border-radius: var(--radius); padding: 8px 14px; margin: 0 0 12px; }
.dash-total div { display: flex; flex-direction: column; }
.dash-total span { font-size: 11px; color: var(--muted); }
.dash-total b { font-size: 16px; color: #7a4f0e; font-variant-numeric: tabular-nums; }

/* ---------- Update 36: lists scroll in their own box, products line, column widths ---------- */
/* the box fills the window down to the bottom: headings stay at the top and the totals row at the bottom */
.table-wrap.g-scroll { max-height: var(--g-max, 70vh); overflow: auto; overscroll-behavior: contain; }
.table-wrap.g-scroll table.t thead th { position: sticky; top: 0; z-index: 3; }
.table-wrap.g-scroll table.t tfoot td { position: sticky; bottom: 0; z-index: 3; box-shadow: 0 -1px 0 var(--line-strong), 0 -6px 10px -8px rgba(16, 36, 24, .25); }
/* first column stays in place when scrolling sideways */
table.t .g-fz { position: sticky; left: var(--g-l0, 0); z-index: 2; background: var(--panel); }
table.t tr > .g-fz:nth-child(2) { left: var(--g-l1, 0); }
table.t thead th.g-fz, table.t tfoot td.g-fz, .table-wrap.g-scroll table.t thead th.g-fz, .table-wrap.g-scroll table.t tfoot td.g-fz { z-index: 5; }
table.t thead th.g-fz { background: #f1f8f6; }
table.t tfoot td.g-fz { background: #f7f9f9; }
.rp table.t thead th.g-fz, .rp table.t tfoot td.g-fz { background: var(--tone-soft); }
.g-sx table.t .g-fz-last { box-shadow: 6px 0 8px -6px rgba(16, 36, 24, .28); }
/* column resize handle on the right edge of each heading (drag; double-click = fit) */
table.t th { position: sticky; }
.doc table.t th:has(.g-rz) { position: relative; }
table.t th .g-rz { position: absolute; top: 0; right: -3px; bottom: 0; width: 8px; cursor: col-resize; z-index: 5; touch-action: none; }
table.t th .g-rz::after { content: ''; position: absolute; top: 25%; bottom: 25%; left: 3px; width: 2px; border-radius: 2px; background: transparent; }
table.t th:hover .g-rz::after { background: #c3d9d5; }
table.t th .g-rz:hover::after, body.g-resizing table.t th .g-rz::after { background: var(--brand); top: 0; bottom: 0; }
body.g-resizing, body.g-resizing * { cursor: col-resize !important; user-select: none !important; }
/* widths set by the user: fixed layout, long text wraps, numbers are cut with … instead of widening the table */
table.t.g-fixed { table-layout: fixed; }
table.t.g-fixed th, table.t.g-fixed td { overflow: hidden; text-overflow: ellipsis; overflow-wrap: break-word; }
table.t.g-fixed tr.g-sub td { overflow: visible; }
table.t.g-fixed th .g-h { overflow: hidden; text-overflow: ellipsis; }
/* products line under each document row */
table.t.has-sub tbody tr td { background: var(--panel); }
table.t.has-sub tbody tr:not(.g-sub):has(+ tr.g-sub) td { border-bottom: 0; padding-bottom: 2px; }
table.t tbody tr.g-sub td { padding: 0 10px 7px; font-size: 12px; color: var(--muted); line-height: 1.45; white-space: normal; }
table.t tbody tr.g-sub .g-sub-in { position: sticky; left: 10px; max-width: var(--g-w, 100%); }
table.t[data-del] tbody tr.g-sub .g-sub-in { padding-left: 30px; }
table.t tbody tr.g-sub b { color: var(--ink); font-weight: 600; }
.g-sub-n { display: inline-block; min-width: 18px; padding: 0 5px; margin-right: 6px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 700; text-align: center; }
.g-sub-dot { margin: 0 7px; color: #b5c2bb; }
.g-sub-it { white-space: nowrap; }
.g-sub-more { margin-left: 8px; color: var(--brand); font-weight: 600; }
table.t.has-sub tbody tr.click:hover td,
table.t.has-sub tbody tr.click:hover + tr.g-sub td,
table.t.has-sub tbody tr.click:has(+ tr.g-sub:hover) td { background: #f5fbfa; }
/* smaller screens: tighter cells so more columns fit without sideways scrolling */
table.t td.g-nw { white-space: nowrap; }
@media (max-width: 1366px) {
  table.t th, table.t td { padding-left: 7px; padding-right: 7px; }
  table.t td { font-size: 13px; }
  table.t th { font-size: 11px; }
  /* headings may wrap ("Bill book / no.") and the filter button floats over the heading instead of taking room */
  table.t th.g-th { white-space: normal; line-height: 1.25; padding-right: 7px; }
  table.t th .g-btn { position: absolute; right: 2px; top: 50%; margin: -10px 0 0; background: inherit; opacity: 0; }
  table.t th.g-th:hover .g-btn, table.t th.g-filtered .g-btn, table.t th .g-btn:focus-visible { opacity: 1; }
  table.t th.num .g-btn { right: auto; left: 2px; }
}
@media (max-width: 1100px) {
  table.t th, table.t td { padding: 6px 5px; }
  table.t td { font-size: 12.5px; }
  table.t th { letter-spacing: .02em; }
  table.t th .g-btn { width: 18px; margin-left: 2px; }
  table.t tbody tr.g-sub td { padding: 0 5px 6px; font-size: 11.5px; }
}
@media print {
  .table-wrap.g-scroll { max-height: none !important; overflow: visible !important; }
  .table-wrap.g-scroll table.t thead th, .table-wrap.g-scroll table.t tfoot td, table.t .g-fz { position: static !important; box-shadow: none !important; }
  table.t.g-fixed { table-layout: auto; width: 100% !important; }
  table.t tbody tr.g-sub .g-sub-in { position: static; max-width: none; }
}

/* ---------- Update F39: which year this copy holds ---------- */
.yr-badge {
  display: inline-flex; align-items: center; white-space: nowrap; font-weight: 800; letter-spacing: .04em;
  font-size: 14px; padding: 6px 12px; border-radius: 8px; border: 2px solid;
}
.yr-badge.live { color: #0b4a45; background: #e3f4f2; border-color: #2f9c92; }
.yr-badge.old { color: #7a3d00; background: #fff1d6; border-color: #e08a00; }
.yr-badge.yr-login { display: flex; justify-content: center; font-size: 15px; margin: -4px 0 14px; }
.side .logo .lbl { line-height: 1.15; }
.side .logo .yr-side { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: .03em; color: #2f9c92; }
body[data-old-year="1"] .side .logo .yr-side { color: #c26e00; }
@media (max-width: 900px) {
  .yr-badge.yr-top { font-size: 12px; padding: 4px 8px; }
}
/* Update F67: company logo box in Settings */
.logo-box { display: flex; gap: 14px; align-items: center; margin-top: 14px; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: 10px; }
.logo-box img { width: 64px; height: 64px; object-fit: contain; flex: none; background: #fff; border-radius: 8px; }

/* ---------- Update F81: Business health (Administrative report, from Pesticide ERP Update 33) ---------- */
.hl-acts { align-items: center; gap: 6px; margin-bottom: 10px; }
.hl-hero { display: grid; grid-template-columns: 190px 1fr; gap: 16px; align-items: stretch; margin-bottom: 12px; }
.hl-score { position: relative; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.hl-ring { width: 160px; height: 160px; }
.hl-ring-bg { fill: none; stroke: #e7ece9; stroke-width: 11; }
.hl-ring-fg { fill: none; stroke-width: 11; stroke-linecap: round; }
.hl-s-green { stroke: #1e7a45; } .hl-s-good { stroke: #5a9a2f; } .hl-s-amber { stroke: #d08a00; } .hl-s-red { stroke: #c0362c; } .hl-s-na { stroke: #b9c2bd; }
.hl-score-in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; }
.hl-score-in b { font-size: 40px; font-variant-numeric: tabular-nums; }
.hl-score-in small { color: var(--muted); font-size: 12px; }
.hl-score-in span { margin-top: 6px; font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.hl-t-green .hl-score-in span { color: #1e7a45; } .hl-t-good .hl-score-in span { color: #4c8a24; }
.hl-t-amber .hl-score-in span { color: #a86f00; } .hl-t-red .hl-score-in span { color: #c0362c; }
.hl-pillars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.hl-pillar { display: flex; flex-direction: column; gap: 3px; background: #fff; border: 1px solid var(--line); border-left: 5px solid #b9c2bd; border-radius: 10px;
  padding: 9px 12px; color: inherit; text-decoration: none; }
.hl-pillar:hover { border-color: var(--line-strong); }
.hl-p-green { border-left-color: #1e7a45; } .hl-p-amber { border-left-color: #d08a00; } .hl-p-red { border-left-color: #c0362c; }
.hl-p-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.hl-p-q { font-size: 12px; color: var(--muted); }
.hl-p-score { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hl-p-score small { font-size: 12px; color: var(--muted); font-weight: 400; }
.hl-p-n { font-size: 11px; color: var(--muted); }
.hl-bar { height: 6px; background: #e7ece9; border-radius: 3px; overflow: hidden; }
.hl-bar i { display: block; height: 100%; background: #b9c2bd; }
.hl-p-green .hl-bar i { background: #1e7a45; } .hl-p-amber .hl-bar i { background: #d08a00; } .hl-p-red .hl-bar i { background: #c0362c; }
.hl-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px 2px 6px; border-radius: 999px; white-space: nowrap; }
.hl-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.hl-green { background: #e3f3e8; color: #1e6b3c; } .hl-amber { background: #fff3d6; color: #8a5a00; } .hl-red { background: #fbe9e7; color: #b3261e; }
.hl-info { background: #e5eefa; color: #1d5fa8; } .hl-na { background: #eef1ef; color: #6d7a73; }
.hl-kfs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 6px; }
.hl-kf { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; }
.hl-kf span { font-size: 12px; color: var(--muted); }
.hl-kf b { font-size: 17px; font-variant-numeric: tabular-nums; }
.hl-kf small { font-size: 11px; color: var(--muted); }
.hl-sec { margin-top: 16px; scroll-margin-top: 12px; }
.hl-sec h3 { display: flex; align-items: baseline; gap: 6px; margin: 0 0 6px; }
.hl-sec-score { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 600; }
.hl-t td:first-child { width: 38%; }
.hl-t td { vertical-align: top; }
.hl-val { font-weight: 700; font-size: 14px; white-space: nowrap; }
.hl-formula { color: #7b8a82; font-style: italic; }
.hl-mnote { color: var(--warn); }
.hl-tr { font-size: 10px; margin-left: 4px; color: var(--muted); }
.hl-tr.up { color: #1e7a45; } .hl-tr.down { color: #c0362c; }
.hl-notes, .hl-ai { margin-top: 18px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; scroll-margin-top: 12px; }
.hl-notes h3, .hl-ai h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; }
.hl-ngs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.hl-ng h4 { margin: 4px 0 4px; font-size: 13.5px; }
.hl-ng ul, .hl-ng ol { margin: 0; padding-left: 20px; }
.hl-ng li { margin: 3px 0; font-size: 13px; line-height: 1.45; }
.hl-ng.ok h4 { color: #1e6b3c; } .hl-ng.bad h4 { color: #b3261e; } .hl-ng.warn h4 { color: #8a5a00; }
.hl-ng.act { grid-column: 1 / -1; background: var(--brand-soft); border-radius: 8px; padding: 6px 12px 8px; }
.hl-ng.act h4 { color: var(--brand); }
.hl-ng.data { grid-column: 1 / -1; } .hl-ng.data h4 { color: var(--muted); } .hl-ng.data li { color: var(--muted); }
.hl-ai { border-color: #d9cfe9; background: #fbf9fe; }
.hl-ai h3 { color: #4b2e83; }
.hl-ai-text h4 { margin: 12px 0 4px; font-size: 14px; color: #4b2e83; }
.hl-ai-text p, .hl-ai-text li { font-size: 13.5px; line-height: 1.55; }
.hl-ai-text ul, .hl-ai-text ol { margin: 0 0 6px; padding-left: 22px; }
.hl-ai-wait { display: flex; align-items: center; gap: 10px; padding: 10px 0; color: var(--muted); }
.hl-ai-meta { margin-bottom: 4px; }
.hl-lim input { width: 100px; text-align: right; }
.hl-lim tr.hl-lim-g td { background: #f3f7f4; font-weight: 700; }
/* Update F95: analysis database line, Refresh now, sales / DMA account ticks */
.hl-src { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 7px 10px; margin-bottom: 8px; border-radius: 8px;
  background: #eef6f6; border: 1px solid #cfe3e3; font-size: 13px; }
.hl-src > span { flex: 1; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hl-ai-asof { margin: 0 0 10px; padding: 6px 10px; border-radius: 6px; background: #fff7e0; border: 1px solid #f0dca0; }
.hl-sa { max-height: 320px; overflow: auto; }
.hl-sa input[type=checkbox] { width: auto; }
.hl-sa td.c, .hl-sa th.c { text-align: center; }
@media (max-width: 1000px) { .hl-pillars { grid-template-columns: repeat(2, minmax(0, 1fr)); } .hl-kfs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .hl-hero { grid-template-columns: 1fr; } .hl-ngs { grid-template-columns: 1fr; } .hl-pillars { grid-template-columns: 1fr; } }
@media print {
  .hl-chip, .hl-bar i, .hl-ring-fg, .hl-pillar, .hl-ng.act, .hl-ai { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .hl-sec, .hl-notes, .hl-ai { break-inside: avoid-page; }
}


/* ===== Update F118: demo mode (the copy shown to buyers) ===== */
.yr-badge.demo { color: #fff; background: #b91c1c; border-color: #991b1b; letter-spacing: .08em; }
#demo-strip {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 9000; pointer-events: none;
  display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); padding: 4px 14px;
  border-radius: 10px 10px 0 0; background: #b91c1c; color: #fff; font-size: 12.5px; line-height: 1.4;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, .18); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#demo-strip b { background: #fbbf24; color: #3b1d00; border-radius: 4px; padding: 0 6px; letter-spacing: .1em; }
#demo-strip .ds-print { display: none; }
@media (max-width: 640px) { #demo-strip { font-size: 11px; } #demo-strip .ds-full { overflow: hidden; text-overflow: ellipsis; } }
body[data-demo="1"] .page { padding-bottom: 40px; }
body[data-demo="1"] [data-hl="claude"], body[data-demo="1"] [data-hl="goto-ai"], body[data-demo="1"] [data-dly="send"] { display: none !important; }
.demo-lock { border-left: 4px solid #b91c1c; }
.demo-locked :is(input, select, textarea, button):disabled, .demo-locked label.btn { background: #f3f4f6; color: #6b7280; cursor: not-allowed; }
.demo-pass { font-family: ui-monospace, Consolas, monospace; font-size: 18px; letter-spacing: .06em; padding: 8px 12px; border: 1px dashed #b91c1c; border-radius: 8px; background: #fff7f7; color: #111; user-select: all; }
.demo-exp { color: #b91c1c; font-weight: 600; }
@media print {
  #demo-strip { position: fixed; bottom: 0; background: none; color: #b91c1c; box-shadow: none; border-top: 1px solid #b91c1c; border-radius: 0; font-weight: 600;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #demo-strip b, #demo-strip .ds-full { display: none; }
  #demo-strip .ds-print { display: inline; }
}

/* Update F120: editions (Standard / Gold / Platinum) - lock labels and the upgrade box (js/edition.js) */
.ed-lock { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; line-height: 17px; white-space: nowrap; background: #fdf3d7; color: #8a5a00; vertical-align: middle; }
.ed-lock.ed-3 { background: #e8e9f3; color: #3b3f73; }
.side nav a[data-lock] .lbl { opacity: .6; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.side nav a .ed-lock { flex: none; }
.side nav a[data-lock] { max-width: 100%; box-sizing: border-box; }
button.rcard .rc-t b .ed-lock { display: inline-block; width: auto; }
.shell.narrow .side nav a .ed-lock { display: none; }
.side .logo .yr-side.ed-side { color: #b08400; }
button.rcard.locked { opacity: .75; }
.ed-box { max-width: 560px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: #fffdf6; }
.ed-box-t { font-size: 16px; font-weight: 650; margin-bottom: 8px; }
.ed-code { display: flex; gap: 8px; align-items: center; }
.ed-code code { flex: 1; font-size: 17px; letter-spacing: 1px; padding: 8px 10px; background: #f1f5f9; border-radius: 8px; user-select: all; }
@media print { .ed-lock { display: none; } }

/* Update F125: supplier ledger – pending order details start on a new page when printed */
@media print { .print-new-page { break-before: page; page-break-before: always; } }

/* Update F126: demo copy – edition labels without a lock */
.ed-lock.ed-info { background: transparent; border: 1px solid currentColor; }
.side nav a .ed-info + .win-ic, .side nav a .ed-info { opacity: .9; }
