/* Gbr ERP — layout concept: a timber-yard ledger. Right-hand sidebar (RTL) on desktop, bottom tab bar on phones,
   dense ledger tables with tabular numerals; pine green for actions, walnut for money-owed accents. */
:root {
  --bg: #f1f2ee; --surface: #ffffff; --surface-2: #f7f8f4; --sunken: #e9ebe5; --line: #dcdfd6; --line-2: #c5cabe;
  --fg: #17201b; --muted: #59645e; --faint: #87918b;
  --accent: #1f5c47; --accent-fg: #ffffff; --accent-soft: #e0ede6; --accent-ink: #164534;
  --wood: #9a5b29; --wood-soft: #f4e8dc;
  --ok: #23774a; --ok-soft: #dff1e6; --warn: #9a6210; --warn-soft: #faeed6; --bad: #b0322a; --bad-soft: #fae3df; --info: #2b5a96; --info-soft: #e2ebf7;
  --usd: #2b5a96; --iqd: #8a5a24;
  --overlay: rgba(14, 22, 18, 0.48);
  --shadow: 0 1px 2px rgba(18, 28, 22, 0.06), 0 6px 20px rgba(18, 28, 22, 0.06);
  --shadow-lg: 0 18px 50px rgba(10, 18, 14, 0.22);
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", system-ui, sans-serif;
  --font-d: "Noto Kufi Arabic", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --r: 12px; --r-s: 8px;
  --side: 248px;
  --tab-h: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1311; --surface: #161c19; --surface-2: #1b221f; --sunken: #111714; --line: #29322d; --line-2: #39443e;
    --fg: #e6ece8; --muted: #a0aba5; --faint: #77827c;
    --accent: #4fae88; --accent-fg: #07130e; --accent-soft: #1a3329; --accent-ink: #8fd6b8;
    --wood: #d79a62; --wood-soft: #33251a;
    --ok: #5cc28a; --ok-soft: #173325; --warn: #e0a54a; --warn-soft: #382a14; --bad: #f07b6f; --bad-soft: #3a1c19; --info: #79a8e6; --info-soft: #172840;
    --usd: #86b0ea; --iqd: #dcaa6c;
    --overlay: rgba(0, 0, 0, 0.62);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1311; --surface: #161c19; --surface-2: #1b221f; --sunken: #111714; --line: #29322d; --line-2: #39443e;
  --fg: #e6ece8; --muted: #a0aba5; --faint: #77827c;
  --accent: #4fae88; --accent-fg: #07130e; --accent-soft: #1a3329; --accent-ink: #8fd6b8;
  --wood: #d79a62; --wood-soft: #33251a;
  --ok: #5cc28a; --ok-soft: #173325; --warn: #e0a54a; --warn-soft: #382a14; --bad: #f07b6f; --bad-soft: #3a1c19; --info: #79a8e6; --info-soft: #172840;
  --usd: #86b0ea; --iqd: #dcaa6c;
  --overlay: rgba(0, 0, 0, 0.62);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 14.5px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; text-rendering: optimizeLegibility;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-family: var(--font-d); font-weight: 700; margin: 0; line-height: 1.35; text-wrap: balance; }
a { color: var(--accent); }
.ic { width: 20px; height: 20px; flex: none; }
.num, .money, td, .kpi-v { font-variant-numeric: tabular-nums; }
.money { display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap; direction: rtl; }
.money b { font-weight: 600; }
.money i { font-style: normal; font-size: 0.78em; color: var(--muted); }
.money.neg b { color: var(--ok); }
.cur-USD i { color: var(--usd); }
.cur-IQD i { color: var(--iqd); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; }
span.ltr, b.ltr, a.ltr { display: inline-block; }
div.ltr, dd.ltr, td.ltr { text-align: right; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- App shell ---------- */
#app { display: flex; min-height: 100%; }
.sidebar {
  width: var(--side); flex: none; background: var(--surface); border-inline-start: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: calc(14px + env(safe-area-inset-top, 0px)) 12px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-mark { width: 40px; height: 40px; border-radius: 10px; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 26px; height: 26px; }
.brand-t b { display: block; font-family: "Poppins", var(--font-d); font-size: 17px; letter-spacing: 0.02em; }
.brand-t span { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-sep { font-size: 11px; color: var(--faint); padding: 14px 12px 4px; letter-spacing: 0.04em; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--fg); }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav a .badge { margin-inline-start: auto; }
.nav a.nav-cta { background: var(--accent); color: var(--accent-fg); margin-bottom: 8px; justify-content: center; font-weight: 600; }
.nav a.nav-cta:hover { filter: brightness(1.06); }
.side-foot { border-top: 1px solid var(--line); padding: 12px 6px 0; display: grid; gap: 8px; font-size: 12.5px; }
.rate-pill { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; cursor: pointer; }
.rate-pill b { font-size: 14px; }
.store-pill { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.sync-ind.s-ok { color: var(--ok); } .sync-ind.s-warn { color: var(--warn); } .sync-ind.s-bad { color: var(--bad); }
.sync-ind.s-sync { color: var(--info); animation: syncpulse 1.2s ease-in-out infinite; }
@keyframes syncpulse { 50% { opacity: 0.35; } }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.9em; background: var(--sunken); padding: 1px 5px; border-radius: 5px; direction: ltr; unicode-bidi: isolate; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; gap: 10px; min-height: 60px;
  padding-block: 10px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar h1 { font-size: 19px; }
.topbar .sub { color: var(--muted); font-size: 12.5px; }
.top-actions { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; }
.view { padding-block: 6px 40px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); max-width: 1320px; width: 100%; }
.mobile-brand { display: none; }
.tabbar { display: none; }

@media (max-width: 600px) {
  .top-actions .btn:not(:last-child) { font-size: 0; gap: 0; width: 34px; padding: 0; }
  .top-actions .btn:not(:last-child) .ic { width: 18px; height: 18px; }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .topbar { min-height: 54px; padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px)); }
  .topbar h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar > div:nth-child(2) { flex: 1; }
  .topbar .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }
  .top-actions { gap: 6px; }
  .view { padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px)); padding-bottom: calc(var(--tab-h) + 28px + env(safe-area-inset-bottom, 0px)); }
  .mobile-brand { display: grid; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--accent-fg); place-items: center; flex: none; }
  .mobile-brand svg { width: 22px; height: 22px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
  }
  .tabbar a { height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500; }
  .tabbar a.active { color: var(--accent); }
  .tabbar a.tab-cta .tab-cta-in { width: 46px; height: 46px; border-radius: 14px; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); margin-top: -18px; }
  .tabbar a.tab-cta .tab-cta-in .ic { width: 24px; height: 24px; }
}

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--fg); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .inp:focus-visible, .icon-btn:focus-visible, .seg-i input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.07); }
.btn-wood { background: var(--wood); border-color: var(--wood); color: #fff; }
.btn-wood:hover { background: var(--wood); filter: brightness(1.07); }
.btn-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.btn-soft:hover { background: var(--accent-soft); filter: brightness(0.97); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--fg); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger-soft { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15.5px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.icon-btn { vertical-align: middle; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); display: inline-grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.icon-btn.sm { width: 32px; height: 32px; }
.inp {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--fg); min-width: 0;
}
.inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); outline: none; }
.inp::placeholder { color: var(--faint); }
textarea.inp { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
select.inp { padding-inline-end: 8px; }
.inp.num, input[inputmode="decimal"].inp, input[inputmode="numeric"].inp { font-variant-numeric: tabular-nums; }
.inp[readonly] { background: var(--surface-2); color: var(--muted); }
.inp-sm { height: 34px; font-size: 13.5px; border-radius: 8px; padding: 0 9px; }
.fld { display: grid; gap: 5px; min-width: 0; }
.fld > span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.fld > small { color: var(--faint); font-size: 12px; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
@media (max-width: 640px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g2.stack-sm { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; min-height: 34px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.seg { display: inline-flex; background: var(--sunken); border-radius: 10px; padding: 3px; gap: 2px; border: 1px solid var(--line); }
.seg-i { position: relative; }
.seg-i input { position: absolute; opacity: 0; pointer-events: none; }
.seg-i span { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); white-space: nowrap; font-size: 13.5px; }
.seg-i input:checked + span { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.seg.cur-seg .seg-i span { min-width: 92px; justify-content: center; }
.seg.big .seg-i span { height: 40px; font-size: 15px; padding: 0 18px; }
.seg.full { display: flex; } .seg.full .seg-i { flex: 1; } .seg.full .seg-i span { justify-content: center; }

/* ---------- Cards & KPIs ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; flex-wrap: wrap; }
.card-h h3 { font-size: 15px; }
.card-h .muted { font-size: 12.5px; }
.card-b { padding: 14px 16px 16px; }
.section { display: grid; gap: 16px; margin-top: 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.kpi-l { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi-l .ic { width: 16px; height: 16px; }
.kpi-v { font-size: 21px; font-weight: 700; line-height: 1.25; display: grid; gap: 1px; }
.kpi-v .money b { font-weight: 700; }
.kpi-v .sub-line { font-size: 15px; font-weight: 600; }
.kpi-s { font-size: 12px; color: var(--faint); }
.kpi.k-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.kpi.k-accent .kpi-l, .kpi.k-accent .kpi-s, .kpi.k-accent .money i { color: color-mix(in srgb, var(--accent-fg) 78%, transparent); }
.kpi.k-wood { border-color: color-mix(in srgb, var(--wood) 40%, var(--line)); background: var(--wood-soft); }
@media (max-width: 520px) { .kpi { padding: 12px 13px; } .kpi-v { font-size: 17px; } .kpi-v .sub-line { font-size: 13.5px; } }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: start; font-weight: 600; color: var(--muted); font-size: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: var(--surface-2); }
.tbl tfoot td { background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--line-2); border-bottom: 0; }
.tbl .t-end { text-align: end; }
.tbl .t-c { text-align: center; }
.tbl td.actions { white-space: nowrap; text-align: end; }
.tbl tr.void td { color: var(--faint); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--faint) 60%, transparent); }
.tbl tr.void td .pill { text-decoration: none; }
.card > .tbl-wrap { border-radius: 0 0 var(--r) var(--r); }
.card > .tbl-wrap:first-child { border-radius: var(--r); }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 8px; }
.empty .ic { width: 34px; height: 34px; color: var(--faint); }
.empty b { color: var(--fg); font-size: 15px; }

/* mobile list rows (tables become cards) */
@media (max-width: 760px) {
  .tbl.rwd thead { display: none; }
  .tbl.rwd, .tbl.rwd tbody, .tbl.rwd tr, .tbl.rwd td, .tbl.rwd tfoot { display: block; width: 100%; }
  .tbl.rwd tr { padding: 10px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; }
  .tbl.rwd tbody tr:last-child { border-bottom: 0; }
  .tbl.rwd td { padding: 0; border: 0; }
  .tbl.rwd td[data-l]::before { content: attr(data-l) ": "; color: var(--faint); font-size: 12px; }
  .tbl.rwd td.m-main { grid-column: 1; font-weight: 600; }
  .tbl.rwd td.m-side { grid-column: 2; grid-row: 1 / span 2; text-align: end; align-self: center; }
  .tbl.rwd td.m-hide { display: none; }
  .tbl.rwd td.actions { grid-column: 1 / -1; text-align: start; margin-top: 6px; }
  .tbl.rwd tfoot tr { background: var(--surface-2); }
  .tbl.rwd tfoot td { background: none; border: 0; }
}

/* ---------- Pills / badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--sunken); color: var(--muted); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.pill.nodot::before { display: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.wood { background: var(--wood-soft); color: var(--wood); }
.pill.cur { font-family: "Poppins", var(--font); letter-spacing: 0.03em; }
.pill.cur.USD { background: var(--info-soft); color: var(--usd); }
.pill.cur.IQD { background: var(--wood-soft); color: var(--iqd); }
.badge { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--wood); color: #fff; font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }

/* ---------- Toolbar / filters / tabs ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .inp { width: auto; }
.search { position: relative; flex: 1 1 220px; min-width: 0; max-width: 420px; }
.search .ic { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.search .inp { padding-inline-start: 38px; width: 100%; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; padding: 10px 14px; color: var(--muted); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--fg); border-color: var(--fg); color: var(--bg); }

/* ---------- Banners ---------- */
.banner { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--r); background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); font-weight: 500; flex-wrap: wrap; }
.banner .grow { min-width: 120px; }
.banner.info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.banner.demo { background: var(--wood-soft); color: var(--wood); border-color: color-mix(in srgb, var(--wood) 30%, transparent); }

/* ---------- Modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: var(--overlay); opacity: 0; transition: opacity 0.18s; }
.modal {
  position: relative; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column; transform: translateY(10px) scale(0.985); opacity: 0; transition: transform 0.18s, opacity 0.18s;
}
.modal-wrap.show .modal-backdrop { opacity: 1; }
.modal-wrap.show .modal { transform: none; opacity: 1; }
.modal-sm { max-width: 420px; } .modal-md { max-width: 600px; } .modal-lg { max-width: 860px; } .modal-xl { max-width: 1080px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px 10px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16.5px; flex: 1; min-width: 0; }
.modal-body { padding: 16px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.confirm-msg { margin: 0 0 6px; line-height: 1.8; }
body.has-modal { overflow: hidden; }
@media (max-width: 640px) {
  .modal-wrap { padding: 0; place-items: end stretch; }
  .modal { border-radius: 18px 18px 0 0; max-height: calc(100% - 24px - env(safe-area-inset-top, 0px)); transform: translateY(30px); }
  .modal-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .modal-foot .btn { flex: 1 1 auto; }
  .modal-foot .grow { display: none; }
}

/* ---------- Toast ---------- */
#toast-root { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100% - 32px); }
@media (max-width: 900px) { #toast-root { bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom, 0px)); } }
.toast { display: flex; align-items: center; gap: 10px; background: var(--fg); color: var(--bg); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; opacity: 0; transform: translateY(8px); transition: 0.2s; max-width: 520px; }
.toast.show { opacity: 1; transform: none; }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.toast-warn .toast-dot { background: var(--warn); }
.toast-bad .toast-dot { background: var(--bad); }

/* ---------- Dashboard ---------- */
.dash-hello { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.dash-hello h2 { font-size: 22px; }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) { .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.quick button { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; text-align: start; min-width: 0; }
.quick button:hover { border-color: var(--line-2); background: var(--surface-2); }
.quick .q-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.quick .q-ic.w { background: var(--wood-soft); color: var(--wood); }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .bar-usd { fill: var(--accent); }
.chart .bar-iqd { fill: var(--wood); }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; vertical-align: -1px; }
.mini-list { display: grid; }
.mini-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); min-width: 0; }
.mini-row:first-child { border-top: 0; }
.mini-row .t { min-width: 0; flex: 1; }
.mini-row .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.mini-row .t small { color: var(--faint); font-size: 12px; }
.mini-row.click { cursor: pointer; }
.mini-row.click:hover { background: var(--surface-2); }
.meter { height: 8px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meter.wood > i { background: var(--wood); }
.aging { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.aging > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; display: grid; gap: 2px; min-width: 0; }
.aging small { color: var(--muted); font-size: 11.5px; }
.aging .a3 { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.aging .a2 { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
@media (max-width: 520px) { .aging { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Invoice editor ---------- */
.inv-top { display: grid; grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 0.7fr) minmax(0, 0.6fr); gap: 12px; align-items: end; }
@media (max-width: 1000px) { .inv-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .inv-top .fld-cust, .inv-top .fld-curr { grid-column: 1 / -1; } .inv-top .fld-curr .seg { display: flex; } .inv-top .fld-curr .seg-i { flex: 1; } .inv-top .fld-curr .seg-i span { justify-content: center; } }
.cust-pick { position: relative; }
.cust-pick .inp { padding-inline-end: 40px; }
.cust-pick .add { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); }
.ac { position: absolute; z-index: 30; top: calc(100% + 4px); inset-inline: 0; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 290px; overflow-y: auto; }
.ac-i { padding: 9px 12px; cursor: pointer; display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--line); }
.ac-i:first-child { border-top: 0; }
.ac-i:hover, .ac-i.on { background: var(--accent-soft); }
.ac-i .t { flex: 1; min-width: 0; }
.ac-i small { color: var(--faint); display: block; font-size: 12px; }
.cust-bal { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; }
.lines { margin-top: 16px; }
.lines-head, .line { display: grid; grid-template-columns: 30px minmax(150px, 1.7fr) minmax(90px, 1fr) 70px 80px 80px 82px 106px 120px 34px; gap: 6px; align-items: center; }
.lines-head { font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 8px 6px; }
.line { padding: 6px 8px; border-radius: 10px; }
.line:nth-child(even) { background: var(--surface-2); }
.line .idx { color: var(--faint); font-size: 12.5px; text-align: center; font-variant-numeric: tabular-nums; }
.line .inp { height: 38px; padding: 0 8px; }
.line .calc { height: 38px; display: flex; align-items: center; padding: 0 8px; border-radius: 8px; background: var(--sunken); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; overflow: hidden; }
.line .calc.total { background: var(--accent-soft); color: var(--accent-ink); }
.line .lbl { display: none; }
.line .pick { position: relative; }
.line .stock-hint { font-size: 11px; color: var(--faint); margin-top: 2px; }
@media (max-width: 1100px) {
  .lines-head { display: none; }
  .line { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px 8px; padding: 12px; border: 1px solid var(--line); background: var(--surface) !important; margin-bottom: 10px; position: relative; }
  .line .idx { position: absolute; top: 8px; inset-inline-end: 44px; }
  .line .c-model { grid-column: span 4; } .line .c-color { grid-column: span 2; }
  .line .c-qty, .line .c-len, .line .c-wid { grid-column: span 2; }
  .line .c-area { grid-column: span 2; } .line .c-price { grid-column: span 2; } .line .c-total { grid-column: span 2; }
  .line .c-del { position: absolute; top: 6px; inset-inline-end: 6px; }
  .line .lbl { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
}
.inv-bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); gap: 16px; margin-top: 16px; align-items: start; }
@media (max-width: 900px) { .inv-bottom { grid-template-columns: minmax(0, 1fr); } }
.totals { display: grid; gap: 0; }
.totals .tr { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.totals .tr:last-child { border-bottom: 0; }
.totals .tr.grand { font-size: 19px; font-weight: 700; padding: 12px 0; }
.totals .tr.grand .money b { font-weight: 800; }
.totals .tr.due .money b { color: var(--bad); }
.totals .tr .inp { width: 150px; height: 36px; }
.pay-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.save-bar { position: sticky; bottom: 0; z-index: 15; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px)); background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--line); margin-top: 12px; }
.view input, .view select, .view textarea { scroll-margin-bottom: 96px; scroll-margin-top: 80px; }
@media (max-width: 900px) { .save-bar { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: 10px; } .save-bar .btn { flex: 1 1 auto; } }
.sum-strip { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.sum-strip b { color: var(--fg); }

/* ---------- Detail panels ---------- */
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }
.bal-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.bal-card { border-radius: var(--r); padding: 12px 14px; border: 1px solid var(--line); background: var(--surface-2); display: grid; gap: 3px; }
.bal-card.has-debt { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.bal-card.credit { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.bal-card .l { font-size: 12px; color: var(--muted); }
.bal-card .v { font-size: 20px; font-weight: 700; }
.calc-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 6px; font-size: 13.5px; }
.calc-box .row { display: flex; justify-content: space-between; gap: 10px; }
.calc-box .row.big { font-size: 16px; font-weight: 700; border-top: 1px dashed var(--line-2); padding-top: 8px; margin-top: 2px; }
.je-lines { display: grid; gap: 4px; margin-top: 6px; }
.je-line { display: grid; grid-template-columns: minmax(0, 1fr) 120px 120px; gap: 8px; font-size: 12.5px; padding: 4px 8px; border-radius: 6px; background: var(--surface-2); }
.je-line .cr { padding-inline-start: 22px; }
.ml-lines .ml { display: grid; grid-template-columns: minmax(0, 2fr) 90px minmax(0, 1fr) minmax(0, 1fr) 34px; gap: 6px; margin-bottom: 6px; }
@media (max-width: 600px) { .ml-lines .ml { grid-template-columns: minmax(0, 1fr) 80px; } .je-line { grid-template-columns: minmax(0, 1fr) 90px 90px; } }

/* ---------- Settings ---------- */
.set-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }
.set-nav { position: sticky; top: 76px; display: grid; gap: 2px; }
.set-nav button { text-align: start; background: none; border: 0; padding: 9px 12px; border-radius: 9px; color: var(--muted); font-weight: 600; cursor: pointer; display: flex; gap: 9px; align-items: center; }
.set-nav button.on { background: var(--surface); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }
.set-nav .ic { width: 18px; height: 18px; }
@media (max-width: 900px) { .set-layout { grid-template-columns: minmax(0, 1fr); } .set-nav { position: static; display: flex; overflow-x: auto; gap: 4px; scrollbar-width: none; } .set-nav button { white-space: nowrap; } }
.set-sec { display: grid; gap: 16px; }
.set-group { display: grid; gap: 12px; }
.set-group h4 { font-size: 14px; color: var(--muted); font-family: var(--font); font-weight: 700; }
.img-pick { display: flex; align-items: center; gap: 12px; }
.img-pick .ph { width: 72px; height: 72px; border-radius: 12px; border: 1px dashed var(--line-2); display: grid; place-items: center; overflow: hidden; background: var(--surface-2); flex: none; }
.img-pick .ph img { max-width: 100%; max-height: 100%; object-fit: contain; }
.col-cfg { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; align-items: center; }
.cols.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .cols.even { grid-template-columns: minmax(0, 1fr); } }
.inv-live { background: var(--sunken); border-radius: var(--r); padding: 12px; border: 1px solid var(--line); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; }
.swatches button.on { box-shadow: 0 0 0 2px var(--fg); }
.tagbox { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 6px 0 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.tag button { border: 0; background: none; color: var(--faint); cursor: pointer; display: grid; place-items: center; padding: 0; }
.tag button .ic { width: 15px; height: 15px; }
.storage-bar { height: 10px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.storage-bar i { display: block; height: 100%; background: var(--accent); }

/* ---------- Lock screen ---------- */
.lock { position: fixed; inset: 0; z-index: 300; background: var(--bg); display: grid; place-items: center; padding: 24px; }
.lock-box { width: 100%; max-width: 330px; display: grid; gap: 16px; justify-items: center; text-align: center; }
.lock .dots { display: flex; gap: 12px; direction: ltr; }
.lock .dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); }
.lock .dots i.on { background: var(--accent); border-color: var(--accent); }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 12px; direction: ltr; }
.keypad button { height: 60px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); font-size: 22px; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums; }
.keypad button:active { background: var(--accent-soft); }
.shake { animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* ---------- Preview modal ---------- */
.modal-preview .modal-body { background: var(--sunken); padding: 14px; }
.pv-pages { display: grid; gap: 14px; justify-items: center; }
.pv-page { overflow: hidden; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18); background: #fff; }
.pv-page > .a4 { transform-origin: top right; }
.pv-hint { font-size: 12px; color: var(--faint); }
@media (max-width: 640px) { .pv-hint { display: none; } }

/* ======================================================================
   A4 DOCUMENTS — paper is always white; colours below are fixed print inks.
   ====================================================================== */
.print-host.measuring { position: absolute; left: -10000px; top: 0; visibility: hidden; pointer-events: none; }
.a4 {
  width: 210mm; height: 297mm; background: #fff; color: #1b1f1d; padding: var(--pm, 10mm); display: flex; flex-direction: column;
  font-family: var(--font); font-size: var(--fs, 12px); line-height: 1.5; direction: rtl; overflow: hidden; position: relative;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.a4-body { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 4mm; }
.a4-foot-slot { flex: none; padding-top: 3mm; }
.d-block { display: flex; flex-direction: column; gap: 4mm; }
.d-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8mm; padding-bottom: 4mm; border-bottom: 2.5px solid var(--acc); }
.d-head.centered { flex-direction: column; align-items: center; text-align: center; }
.d-head.centered .d-brand { flex-direction: column; }
.d-brand { display: flex; align-items: center; gap: 4mm; min-width: 0; }
.d-logo { width: var(--logo); height: var(--logo); object-fit: contain; flex: none; }
.d-logo-ph { width: calc(var(--logo) * 0.8); height: calc(var(--logo) * 0.8); border-radius: 12px; background: var(--acc); color: #fff; display: grid; place-items: center; font-size: calc(var(--logo) * 0.42); font-weight: 800; font-family: var(--font-d); }
.d-brand.compact .d-logo { width: 34px; height: 34px; }
.d-shop { font-family: var(--font-d); font-weight: 800; font-size: 1.75em; color: var(--acc); line-height: 1.25; }
.d-brand.compact .d-shop { font-size: 1.15em; }
.d-slogan { color: var(--acc2); font-weight: 600; font-size: 0.95em; margin-top: 1mm; }
.d-contact { color: #4c5651; font-size: 0.9em; margin-top: 1mm; }
.d-doc { text-align: start; flex: none; min-width: 58mm; }
.d-title { font-family: var(--font-d); font-weight: 800; font-size: 1.45em; color: #fff; background: var(--acc); padding: 1.6mm 5mm; border-radius: 2mm; display: inline-block; margin-bottom: 2mm; }
.d-meta { border-collapse: collapse; font-size: 0.95em; }
.d-meta th { text-align: start; color: #5f6a64; font-weight: 500; padding: 0.6mm 0 0.6mm 4mm; white-space: nowrap; }
.d-meta td { padding: 0.6mm 0; font-variant-numeric: tabular-nums; }
.d-mute { color: #7a847f; }
.d-party { display: flex; flex-wrap: wrap; align-items: center; gap: 2mm 7mm; padding: 3mm 4mm; background: #f5f6f3; border-radius: 2mm; border: 1px solid #e3e6e0; }
.d-party > div { display: flex; gap: 2mm; align-items: baseline; }
.d-lbl { color: #6a746f; font-size: 0.88em; display: inline-block; }
.d-party-name { font-weight: 700; font-size: 1.15em; }
.d-status { margin-inline-start: auto; font-weight: 700; padding: 0.8mm 3.5mm; border-radius: 99px; font-size: 0.9em; }
.d-status.st-paid { background: #e2f2e8; color: #1f6b41; }
.d-status.st-partial { background: #fbefd8; color: #8d5a0c; }
.d-status.st-unpaid { background: #fae3df; color: #a2302a; }
.d-status.st-void { background: #eee; color: #777; }
.d-bals { margin-inline-start: auto; display: flex; gap: 6mm; }
.d-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.d-table caption { text-align: start; font-weight: 700; color: var(--acc); padding: 1mm 0 2mm; font-size: 1.05em; }
.d-table th { background: var(--acc); color: #fff; font-weight: 600; padding: 2mm 1.6mm; text-align: center; font-size: 0.92em; white-space: nowrap; }
.d-table th:first-child { border-radius: 0 1.5mm 0 0; }
.d-table th:last-child { border-radius: 1.5mm 0 0 0; }
.d-table td { padding: 1.9mm 1.6mm; text-align: center; border-bottom: 1px solid #e5e8e2; }
.d-table tbody tr:nth-child(even) td { background: #f8f9f6; }
.d-table td.t-start, .d-items td.c-model { text-align: start; }
.d-items td.c-model small { display: block; color: #7a847f; font-size: 0.85em; font-weight: 400; }
.d-items td.c-idx { color: #7a847f; width: 7mm; }
.d-items td.c-total { font-weight: 700; }
.d-items td.c-area { color: var(--acc2); font-weight: 600; }
.d-table tfoot td, .d-tf td { background: #eef1ec; font-weight: 700; border-bottom: 0; border-top: 1.5px solid var(--acc); }
.d-empty { color: #888; padding: 6mm !important; }
.d-sum { display: grid; grid-template-columns: minmax(0, 1fr) 72mm; gap: 6mm; align-items: start; position: relative; }
.d-sum-side { display: grid; gap: 3mm; }
.d-words { background: #f5f6f3; border-inline-start: 3px solid var(--acc2); padding: 2.5mm 3.5mm; font-weight: 600; display: grid; gap: 1mm; }
.d-notes { display: grid; gap: 1mm; font-size: 0.95em; }
.d-terms { font-size: 0.85em; color: #5f6a64; border-top: 1px dashed #d5d9d2; padding-top: 2mm; }
.d-totals { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.d-totals th { text-align: start; font-weight: 500; color: #4c5651; padding: 1.4mm 2.5mm; }
.d-totals td { text-align: end; padding: 1.4mm 2.5mm; font-weight: 600; white-space: nowrap; }
.d-totals td small { display: block; font-weight: 400; color: #7a847f; font-size: 0.82em; }
.d-totals tr { border-bottom: 1px solid #ebeee8; }
.d-totals tr.grand th, .d-totals tr.grand td { background: var(--acc); color: #fff; font-size: 1.2em; font-weight: 800; }
.d-totals tr.due td { color: #a2302a; }
.d-totals tr.bal th, .d-totals tr.bal td { background: #f4e9de; color: #6d3f15; font-weight: 800; }
.d-totals tr.eq td { color: #5f6a64; font-weight: 500; }
.d-stampmark { position: absolute; left: 76mm; top: 6mm; transform: rotate(-14deg); border: 3px solid #2a8a54; color: #2a8a54; font-family: var(--font-d); font-weight: 800; font-size: 1.9em; padding: 1mm 6mm; border-radius: 3mm; opacity: 0.5; pointer-events: none; }
.d-stampmark.void { border-color: #b3261e; color: #b3261e; left: 40%; }
.d-sign { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10mm; margin-top: 6mm; align-items: end; }
.d-sign > div { border-top: 1px solid #9aa39e; padding-top: 1.5mm; text-align: center; color: #4c5651; font-size: 0.92em; }
.d-sign > div:nth-child(2):empty { border: 0; }
.d-sign.small { margin-top: 8mm; grid-template-columns: 1fr 1fr; }
.d-stamp { width: 30mm; height: 30mm; object-fit: contain; opacity: 0.9; }
.d-foot { display: flex; justify-content: space-between; gap: 4mm; font-size: 0.82em; color: #6a746f; padding-top: 2mm; border-top: 1px solid #e3e6e0; }
.d-foot.bar { border-top: 2px solid var(--acc); }
.d-brandmark { font-family: "Poppins", var(--font); letter-spacing: 0.04em; }
.d-cont { display: flex; justify-content: space-between; align-items: center; padding-bottom: 2mm; border-bottom: 1.5px solid var(--acc); }
.d-cont-t { color: #4c5651; }
.d-note-end { color: #6a746f; font-size: 0.88em; }
.d-receipt { position: relative; height: 131mm; display: flex; flex-direction: column; gap: 3mm; overflow: hidden; }
.d-receipt .d-head { padding-bottom: 2.5mm; }
.r-grid { display: grid; gap: 2.4mm; }
.r-row { display: flex; gap: 3mm; align-items: baseline; flex-wrap: wrap; border-bottom: 1px dotted #c9cec6; padding-bottom: 1.6mm; }
.r-row .d-lbl { min-width: 30mm; }
.r-name { font-size: 1.2em; }
.r-amt b { font-size: 1.35em; color: var(--acc); }
.r-words { flex-basis: 100%; padding-inline-start: 33mm; color: #4c5651; font-weight: 600; }
.r-bal { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3mm; margin-top: 1mm; }
.r-bal > div { background: #f5f6f3; border-radius: 2mm; padding: 2mm 3mm; display: grid; gap: 0.5mm; }
.r-bal .r-after { background: var(--acc); color: #fff; }
.r-bal .r-after .d-lbl { color: rgba(255, 255, 255, 0.8); }
.r-foot { font-size: 0.85em; color: #6a746f; margin-top: auto; }
.d-receipt .d-sign.small { margin-top: 5mm; }
.d-voucher { margin-top: 2mm; }
.r-cut { border-top: 1.5px dashed #9aa39e; margin: 2mm 0; position: relative; }
.doc-receipt .a4-body { gap: 0; }

#print-root { display: none; }
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; height: auto; }
  body::before { display: none; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; }
  #print-root .print-host { position: static; visibility: visible; }
  #print-root .a4 { page-break-after: always; break-after: page; margin: 0; box-shadow: none; }
  #print-root .a4:last-child { page-break-after: auto; break-after: auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
