/* BanglaBaki: Theme A, Halkhata. See docs/DESIGN.md. Mobile-first. */
:root {
  color-scheme: light;
  --red: #9B1C2C;
  --red-dark: #7E1524;
  --navy: #1E2A44;
  --navy-2: #2C3B5E;
  --paper: #F5F6F1;
  --surface: #FFFFFF;
  --rule: #DFE6EE;
  --rule-strong: #C9D4E0;
  --green: #2E7A50;
  --green-ink: #256742;
  --muted: #5A6478;
  --haldi: #D99A16;
  --red-tint: #F8ECEE;
  --green-tint: #E7F2EC;
  --haldi-tint: #FBF1DC;
  --wash: #EEF1F5;
  --f-display: 'Tiro Bangla', 'Noto Serif Bengali', Georgia, serif;
  --f-ui: 'Hind Siliguri', 'Noto Sans Bengali', 'Segoe UI', system-ui, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(30, 42, 68, .06), 0 6px 18px rgba(30, 42, 68, .07);
  --bottom-nav: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--navy);
  font: 400 16px/1.65 var(--f-ui);
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
h1, h2 { font-family: var(--f-display); font-weight: 400; }
h1 { font-size: clamp(28px, 4vw, 34px); }
h2 { font-size: clamp(22px, 3vw, 27px); }
h3 { font-size: 18px; font-weight: 600; }
p { margin: 0 0 12px; }
a { color: var(--navy); text-underline-offset: 3px; }
a:hover { color: var(--red); }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; border-radius: 4px; }
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: var(--radius); z-index: 100; }
.skip:focus { top: 8px; color: #fff; }
.boot { padding: 40px 16px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.nowrap { white-space: nowrap; }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 600px) { .wrap { padding: 0 24px; } }

/* ---------------------------------------------------------------- demo marking */
.demo-bar {
  background: var(--haldi-tint);
  color: var(--navy);
  border-bottom: 1px solid #EBD9AE;
  font-size: 14px;
  line-height: 1.5;
  padding: 7px 16px;
  text-align: center;
}
.demo-bar b { font-weight: 700; margin-right: 4px; }
.stamp {
  display: inline-block;
  border: 2px solid var(--red);
  color: var(--red);
  border-radius: 6px;
  padding: 0 10px;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.7;
  transform: rotate(-4deg);
  white-space: nowrap;
}
.demo-pill { display: inline-block; background: var(--haldi-tint); color: var(--navy); border-radius: 999px; padding: 0 9px; font-size: 12.5px; font-weight: 600; line-height: 1.8; vertical-align: middle; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px;
  border: 1.5px solid transparent; border-radius: var(--radius);
  background: none; font-weight: 600; font-size: 16px; line-height: 1.2;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); color: #fff; }
.btn-outline { border-color: var(--navy); color: var(--navy); background: var(--surface); }
.btn-outline:hover { background: var(--wash); color: var(--navy); }
.btn-red { border-color: var(--red); color: var(--red); background: var(--surface); }
.btn-red:hover { background: var(--red-tint); color: var(--red); }
.btn-ghost { color: var(--navy); }
.btn-ghost:hover { background: var(--wash); }
.btn-sm { min-height: 40px; padding: 0 12px; font-size: 15px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--radius); background: none; cursor: pointer; color: inherit; }
.icon-btn:hover { background: rgba(30, 42, 68, .07); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.lang { display: inline-flex; border: 1.5px solid currentColor; border-radius: 999px; padding: 2px; }
.lang button { border: 0; background: none; border-radius: 999px; padding: 3px 12px; min-height: 34px; font-size: 14px; font-weight: 600; cursor: pointer; color: inherit; }
.lang button[aria-pressed="true"] { background: currentColor; }
.lang button[aria-pressed="true"] span { color: var(--surface); }
.spine .lang button[aria-pressed="true"] span, .topbar .lang button[aria-pressed="true"] span { color: var(--red); }

/* ---------------------------------------------------------------- forms */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-weight: 600; font-size: 15px; }
.hint { font-size: 14px; color: var(--muted); }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 9px 12px;
  border: 1.5px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--surface); font-size: 16px;
}
.field textarea { min-height: 96px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--navy); outline: 2px solid rgba(30, 42, 68, .18); outline-offset: 0; }
[aria-invalid="true"] { border-color: var(--red) !important; }
.err { color: var(--red); font-size: 14px; min-height: 0; }
.err:empty { display: none; }
.form-error { background: var(--red-tint); color: var(--red); border-radius: var(--radius); padding: 10px 14px; font-size: 15px; }
.form-error:empty { display: none; }
.row-2 { display: grid; gap: 16px; }
@media (min-width: 600px) { .row-2 { grid-template-columns: 1fr 1fr; } }
.radios { display: flex; flex-wrap: wrap; gap: 8px; }
.radios label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1.5px solid var(--rule-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; font-weight: 500; }
.radios input { width: 18px; height: 18px; min-height: 0; accent-color: var(--navy); }
.radios label:has(input:checked) { border-color: var(--navy); background: var(--wash); }
.search { position: relative; }
.search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 40px; }

/* ---------------------------------------------------------------- chips & amounts */
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 1px 10px; font-size: 13px; font-weight: 600; line-height: 1.75; white-space: nowrap; }
.chip .i { width: 14px; height: 14px; }
.chip-due { background: var(--red-tint); color: var(--red); }
.chip-partial { background: var(--haldi-tint); color: var(--navy); }
.chip-settled, .chip-paid, .chip-received { background: var(--green-tint); color: var(--green-ink); }
.chip-reversed { background: var(--wash); color: var(--muted); }
.chip-reversal { background: var(--surface); color: var(--navy); box-shadow: inset 0 0 0 1.5px var(--navy); }
.chip-dispute, .chip-open { background: var(--haldi-tint); color: var(--navy); }
.chip-resolved { background: var(--green-tint); color: var(--green-ink); }
.chip-rejected { background: var(--wash); color: var(--muted); }
.amt-due { color: var(--red); }
.amt-paid { color: var(--green); }
.money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.struck { text-decoration: line-through; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips a, .chips button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--rule-strong); background: var(--surface); color: var(--navy); font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; }
.chips [aria-current="true"], .chips [aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------------------------------------------------------------- ledger tables */
.ledger-wrap { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); overflow: hidden; }
.ledger { width: 100%; border-collapse: collapse; font-size: 15px; }
.ledger th { text-align: left; font-weight: 600; font-size: 14px; color: var(--muted); padding: 10px 14px; border-bottom: 2px solid var(--navy); background: var(--surface); white-space: nowrap; }
.ledger td { padding: 11px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ledger tbody tr:last-child td { border-bottom: 0; }
.ledger .num { text-align: right; white-space: nowrap; }
.ledger .m { border-left: 3px double rgba(155, 28, 44, .42); }
.ledger tbody tr[data-href] { cursor: pointer; }
.ledger tbody tr[data-href]:hover td { background: #FAFBF8; }
.ledger tfoot td { border-top: 1px solid var(--navy); border-bottom: 3px double var(--navy); font-weight: 700; }
.ledger .sub { display: block; font-size: 14px; color: var(--muted); }
.ledger .main-link { font-weight: 600; text-decoration: none; }
.ledger .main-link:hover { text-decoration: underline; }
.row-reversed td { color: var(--muted); }
.row-reversed .money { text-decoration: line-through; }
@media (max-width: 719px) {
  .ledger.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ledger.stack tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--rule); }
  .ledger.stack tbody tr:last-child { border-bottom: 0; }
  .ledger.stack td { border: 0; padding: 0; }
  .ledger.stack td.m { border-left: 0; }
  .ledger.stack .c-main { grid-column: 1; grid-row: 1 / span 3; }
  .ledger.stack .c-amt { grid-column: 2; text-align: right; }
  .ledger.stack .c-bal { grid-column: 2; text-align: right; font-size: 14px; color: var(--muted); }
  .ledger.stack .c-bal::before { content: attr(data-label) ' '; }
  .ledger.stack .c-hide { display: none; }
  .ledger.stack tfoot tr { border-top: 1px solid var(--navy); border-bottom: 3px double var(--navy); }
}

/* ---------------------------------------------------------------- panels, figures */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 18px; }
@media (min-width: 720px) { .panel { padding: 22px 24px; } }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 22px; }
.panel-head a { font-weight: 600; font-size: 15px; }
.stack-gap { display: grid; gap: 20px; }
.dbl { border-bottom: 3px double currentColor; padding-bottom: 2px; }
.hero-figure { font-family: var(--f-display); font-size: clamp(38px, 7vw, 52px); line-height: 1.2; }
.figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); }
.figs > div { padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.figs > div:nth-child(odd) { border-right: 1px solid var(--rule); }
.figs dt, .figs .lbl { font-size: 14px; color: var(--muted); }
.figs dd, .figs .val { margin: 0; font-family: var(--f-display); font-size: 24px; line-height: 1.35; }
.figs .val-note { font-size: 13px; color: var(--muted); }
@media (min-width: 900px) {
  .figs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .figs > div { border-bottom: 0; border-right: 1px solid var(--rule); }
  .figs > div:last-child { border-right: 0; }
}
.equation { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; font-size: 16px; }
.equation .op { color: var(--muted); font-weight: 600; }
.equation .term { display: inline-flex; flex-direction: column; }
.equation .term small { font-size: 13px; color: var(--muted); }
.equation .term b { font-family: var(--f-display); font-weight: 400; font-size: 21px; }
.callout { display: flex; gap: 12px; align-items: flex-start; background: var(--haldi-tint); border-radius: var(--radius-lg); padding: 14px 16px; }
.callout .i { margin-top: 3px; }
.callout a { font-weight: 700; }
.note-box { background: var(--wash); border-radius: var(--radius); padding: 12px 14px; font-size: 15px; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.empty .i { width: 36px; height: 36px; margin: 0 auto 8px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.stock-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.stock-row:last-child { border-bottom: 0; }
.stock-row .name { flex: 1; min-width: 0; }
.meter { width: 84px; height: 8px; border-radius: 4px; background: var(--wash); overflow: hidden; flex: none; }
.meter i { display: block; height: 100%; background: var(--haldi); }
.load-more { display: flex; justify-content: center; padding: 14px; }

/* ---------------------------------------------------------------- dialogs & toasts */
dialog.dlg { border: 0; padding: 0; border-radius: 14px; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--surface); color: var(--navy); box-shadow: 0 20px 60px rgba(30, 42, 68, .3); }
dialog.dlg-wide { width: min(760px, calc(100vw - 24px)); }
dialog.dlg::backdrop { background: rgba(30, 42, 68, .48); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 14px 10px 22px; border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--surface); }
.dlg-head h2 { font-size: 22px; }
.dlg-body { padding: 18px 22px 22px; }
@media (max-width: 599px) {
  dialog.dlg { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 16px 16px 0 0; max-height: 92dvh; }
}
.toasts { position: fixed; left: 50%; bottom: calc(16px + var(--bottom-nav)); transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
@media (min-width: 1024px) { .toasts { bottom: 24px; } }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: var(--radius); box-shadow: var(--shadow); font-weight: 500; transition: opacity .3s, transform .3s; }
.toast-err { background: var(--red); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------------------------------------------------------------- public storefront */
.site-head { background: var(--surface); border-bottom: 1px solid var(--rule); position: relative; z-index: 5; }
.site-head .wrap { display: flex; align-items: center; gap: 16px; min-height: 68px; }
.wordmark { text-decoration: none; display: grid; line-height: 1.15; margin-right: auto; }
.wordmark b { font-family: var(--f-display); font-weight: 400; font-size: 21px; color: var(--red); }
@media (max-width: 599px) {
  .wordmark b { font-size: 17px; }
  .site-head .wrap { gap: 10px; }
  .page-sheet { padding: 16px 12px; }
  .page-sheet .ledger { font-size: 14px; }
  .page-sheet .ledger th, .page-sheet .ledger td { padding: 8px 6px; }
}
.wordmark small { font-size: 12.5px; color: var(--muted); }
.site-nav { display: none; }
.site-nav a { text-decoration: none; font-weight: 500; padding: 8px 10px; border-radius: var(--radius); }
.site-nav a[aria-current="page"] { color: var(--red); box-shadow: inset 0 -2px 0 var(--red); border-radius: 0; }
.site-head .lang { color: var(--navy); }
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 8px; display: grid; min-width: 220px; }
.menu-panel a { padding: 11px 12px; border-radius: var(--radius); text-decoration: none; font-weight: 500; }
.menu-panel a:hover { background: var(--wash); }
.head-login { display: none; }
@media (min-width: 960px) {
  .site-nav { display: flex; gap: 2px; }
  .menu { display: none; }
  .head-login { display: inline-flex; }
}
.hero { padding: 36px 0 24px; }
.hero .wrap { display: grid; gap: 24px; align-items: center; }
.hero h1 { font-size: clamp(34px, 6vw, 56px); line-height: 1.25; color: var(--navy); }
.hero h1 .red { color: var(--red); }
.hero p.lead { font-size: 18px; max-width: 34em; margin: 14px 0 22px; }
.hero-art { width: 100%; max-width: 520px; height: auto; margin: 0 auto; }
@media (min-width: 900px) {
  .hero { padding: 64px 0 40px; }
  .hero .wrap { grid-template-columns: 1.05fr .95fr; gap: 40px; }
}
.section { padding: 40px 0; }
@media (min-width: 900px) { .section { padding: 64px 0; } }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.section-head h2 { font-size: clamp(26px, 3.5vw, 32px); }
.section-head p { margin: 4px 0 0; color: var(--muted); max-width: 40em; }
.band { background: var(--surface); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 720px) { .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
.cat { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: center; padding: 16px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); text-decoration: none; color: var(--navy); transition: border-color .15s; }
.cat:hover { border-color: var(--navy); color: var(--navy); }
.cat-art { width: 48px; height: 48px; grid-row: span 2; fill: none; stroke: var(--navy); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.cat-art .acc { stroke: var(--red); }
.cat b { font-weight: 600; font-size: 17px; line-height: 1.35; }
.cat small { color: var(--muted); font-size: 14px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 40px 1fr; gap: 14px; counter-increment: step; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 700; }
.steps h3 { margin-bottom: 2px; }
.steps p { margin: 0; color: var(--muted); }
.split { display: grid; gap: 28px; }
@media (min-width: 900px) { .split { grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; } }
.page-sheet { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 20px; position: relative; box-shadow: var(--shadow); }
.page-sheet .stamp { position: absolute; right: 16px; top: -12px; background: var(--surface); }
.prod-group { margin-bottom: 28px; scroll-margin-top: 16px; }
.prod-group h2 { font-size: 24px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; }
.prod-group h2 .cat-art { width: 36px; height: 36px; }
.prod-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); }
.prod-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
.prod-list li:last-child { border-bottom: 0; }
.prod-list .alt { font-size: 14px; color: var(--muted); }
.prod-list .price { text-align: right; font-weight: 600; }
.prod-list .avail { grid-column: 2; text-align: right; font-size: 13.5px; }
.info-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.info-list li { display: grid; grid-template-columns: 24px 1fr; gap: 12px; }
.info-list .i { margin-top: 3px; color: var(--red); }
.placeholder-box { border: 2px dashed var(--rule-strong); border-radius: var(--radius-lg); min-height: 200px; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 24px; background: repeating-linear-gradient(0deg, transparent 0 31px, var(--rule) 31px 32px); }
.svc-list { display: grid; gap: 14px; }
@media (min-width: 720px) { .svc-list { grid-template-columns: 1fr 1fr; } }
.svc { background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--red); border-radius: var(--radius); padding: 16px 18px; }
.svc h3 { margin-bottom: 4px; }
.svc p { margin: 0; color: var(--muted); }
.site-foot { background: var(--navy); color: #E7EBF2; padding: 36px 0 28px; margin-top: 24px; }
.site-foot a { color: #fff; }
.site-foot .wrap { display: grid; gap: 20px; }
@media (min-width: 800px) { .site-foot .wrap { grid-template-columns: 1.4fr 1fr 1fr; } }
.site-foot h2 { font-size: 20px; color: #fff; margin-bottom: 8px; }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-foot .fine { grid-column: 1 / -1; border-top: 1px solid rgba(255, 255, 255, .18); padding-top: 16px; font-size: 14px; color: #C5CDDA; }
.auth-wrap { max-width: 460px; margin: 0 auto; padding: 32px 16px 48px; }
.auth-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); }
.auth-card h1 { margin-bottom: 6px; }
.demo-box { margin-top: 18px; border: 1.5px dashed var(--haldi); background: var(--haldi-tint); border-radius: var(--radius); padding: 12px 14px; font-size: 15px; }
.demo-box .actions { margin-top: 8px; }
.store-cards { display: grid; gap: 16px; }
@media (min-width: 720px) { .store-cards { grid-template-columns: 1fr 1fr; } }

/* ---------------------------------------------------------------- owner app */
.app { min-height: 100dvh; }
.spine { display: none; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--red); color: #fff; }
.topbar .bar { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 8px 0 16px; }
.topbar .brand { font-family: var(--f-display); font-size: 19px; margin-right: auto; line-height: 1.2; }
.topbar .brand small { display: block; font-family: var(--f-ui); font-size: 12px; opacity: .85; }
.topbar .lang { color: #fff; }
.app-main { padding: 18px 16px calc(var(--bottom-nav) + 28px); min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 20px; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); margin: 2px 0 0; }
.back { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; text-decoration: none; margin-bottom: 8px; min-height: 40px; }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around; align-items: stretch; height: var(--bottom-nav); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--rule); }
.bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12.5px; font-weight: 500; color: var(--muted); text-decoration: none; background: none; border: 0; cursor: pointer; min-width: 0; }
.bottom-nav [aria-current="page"] { color: var(--red); font-weight: 700; }
.bottom-nav .fab { flex: 0 0 auto; width: 56px; height: 56px; margin: -14px 6px 0; border-radius: 50%; background: var(--navy); color: #fff; box-shadow: var(--shadow); }
.bottom-nav .fab .i { width: 26px; height: 26px; }
.sheet-actions { display: grid; gap: 10px; }
.sheet-actions a { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius-lg); text-decoration: none; font-weight: 600; }
.sheet-actions a small { display: block; font-weight: 400; color: var(--muted); font-size: 14px; }
.sheet-actions a:hover { border-color: var(--navy); }
.grid-2 { display: grid; gap: 20px; }
@media (min-width: 1100px) { .grid-2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.overview-top { display: grid; gap: 16px; }
.owed { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 18px 20px; position: relative; overflow: hidden; }
.owed::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--red); }
.owed .lbl { color: var(--muted); font-size: 15px; }
.owed .hero-figure { color: var(--red); }
.hero-figure .zero { color: var(--navy); }
.only-mobile { display: none; }
@media (max-width: 719px) { .only-mobile { display: inline; } }
.portal-head .store { color: inherit; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
/* Touch screens: compact table buttons still get a full 44px target. Mouse layouts are unchanged. */
@media (pointer: coarse) { .btn-sm { min-height: 44px; } }
.portal-head .lang button[aria-pressed="true"] span { color: var(--red); }
.mt-1 { margin-top: 12px; }
.mt-2 { margin-top: 20px; }
.owed .meta { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 14.5px; color: var(--muted); margin-top: 6px; }
@media (min-width: 1100px) { .overview-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1.9fr); } .overview-top .figs { grid-template-columns: repeat(2, minmax(0, 1fr)); } .overview-top .figs > div { border-right: 0; border-bottom: 1px solid var(--rule); } .overview-top .figs > div:nth-child(odd) { border-right: 1px solid var(--rule); } .overview-top .figs > div:nth-last-child(-n+2) { border-bottom: 0; } }
.cust-head { display: grid; gap: 16px; }
@media (min-width: 900px) { .cust-head { grid-template-columns: 1fr auto; align-items: end; } }
.item-rows { display: grid; gap: 12px; }
/* Phone: product / description full width, then qty | price | remove, then the line total. */
.item-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 8px 10px; align-items: end; padding: 12px; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); }
.item-row > * { min-width: 0; }
.item-row .f-product { order: 1; grid-column: 1 / -1; }
.item-row .f-desc { order: 2; grid-column: 1 / -1; }
.item-row .f-qty { order: 3; }
.item-row .f-price { order: 4; }
.item-row [data-remove] { order: 5; }
.item-row .line-total { order: 6; grid-column: 1 / -1; text-align: right; font-weight: 600; }
.item-row [data-row-error] { order: 7; grid-column: 1 / -1; }
/* Wider: product | qty | price | line total | remove, description on its own row below. */
@media (min-width: 720px) {
  .item-row { grid-template-columns: minmax(0, 2.4fr) 88px 120px 110px 44px; }
  .item-row .f-product { grid-column: auto; }
  .item-row .line-total { order: 4; grid-column: auto; align-self: center; padding-top: 22px; }
  .item-row .f-price { order: 3; }
  .item-row .f-qty { order: 2; }
  .item-row [data-remove] { order: 5; }
  .item-row .f-desc { order: 6; }
}
.totals { display: grid; gap: 8px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 16px 18px; }
.totals .line { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.totals .grand { border-top: 1px solid var(--navy); border-bottom: 3px double var(--navy); padding: 6px 0; font-weight: 700; font-size: 18px; }
.form-grid { display: grid; gap: 20px; }
@media (min-width: 1000px) { .form-grid { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); align-items: start; } .form-grid .sticky { position: sticky; top: 20px; } }
.tx-detail .items { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 15px; }
.tx-detail .items th { text-align: left; font-size: 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--navy); padding: 6px 8px; }
.tx-detail .items td { border-bottom: 1px solid var(--rule); padding: 8px; }
.tx-detail .items .num { text-align: right; white-space: nowrap; }
.tx-detail .items tfoot td { border-bottom: 3px double var(--navy); border-top: 1px solid var(--navy); font-weight: 700; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 15px; }
.timeline li { display: flex; gap: 8px; align-items: baseline; }
.audit-row { display: grid; gap: 2px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.audit-row:last-child { border-bottom: 0; }
.cat-bars { display: grid; gap: 10px; }
.cat-bars .bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
.cat-bars .bar { grid-column: 1 / -1; height: 8px; background: var(--wash); border-radius: 4px; overflow: hidden; }
.cat-bars .bar i { display: block; height: 100%; background: var(--navy); }
.statement { display: grid; gap: 0; }
.statement .line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.statement .line small { grid-column: 1 / -1; color: var(--muted); font-size: 14px; }
.statement .line.total { border-top: 1px solid var(--navy); border-bottom: 3px double var(--navy); font-weight: 700; }
.statement .indent { padding-left: 18px; }

@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: 236px minmax(0, 1fr); }
  .topbar, .bottom-nav { display: none; }
  .spine { display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; overflow-y: auto; background: var(--red); color: #fff; padding: 22px 0 18px 18px; }
  .spine .brand { font-family: var(--f-display); font-size: 23px; line-height: 1.2; }
  .spine .store-name { font-size: 13.5px; opacity: .85; margin: 2px 18px 22px 0; }
  .spine nav { display: grid; gap: 2px; }
  .spine nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; color: rgba(255, 255, 255, .9); text-decoration: none; border-radius: var(--radius) 0 0 var(--radius); font-weight: 500; }
  .spine nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
  .spine nav a[aria-current="page"] { background: var(--paper); color: var(--red); font-weight: 700; }
  .spine nav .sep { height: 1px; background: rgba(255, 255, 255, .22); margin: 10px 18px 10px 0; }
  .spine .count { margin-left: auto; margin-right: 8px; background: var(--haldi-tint); color: var(--navy); border-radius: 999px; padding: 0 8px; font-size: 12.5px; font-weight: 700; }
  .spine .who { margin-top: auto; padding: 16px 18px 0 0; border-top: 1px solid rgba(255, 255, 255, .22); font-size: 14px; display: grid; gap: 10px; }
  .spine .who .lang { color: #fff; justify-self: start; }
  .spine .who button.out { display: inline-flex; align-items: center; gap: 8px; background: none; border: 1.5px solid rgba(255, 255, 255, .6); color: #fff; border-radius: var(--radius); min-height: 40px; padding: 0 12px; cursor: pointer; font-weight: 600; justify-self: start; }
  .spine :focus-visible { outline-color: #fff; }
  .app-main { padding: 28px 36px 48px; max-width: 1240px; width: 100%; }
}

/* ---------------------------------------------------------------- customer portal */
.portal { min-height: 100dvh; padding-bottom: calc(var(--bottom-nav) + 24px); }
.portal-head { background: var(--red); color: #fff; }
.portal-head .inner { max-width: 680px; margin: 0 auto; padding: 14px 16px 18px; }
.portal-head .top { display: flex; align-items: center; gap: 8px; }
.portal-head .top .store { margin-right: auto; font-size: 14px; opacity: .9; }
.portal-head .lang { color: #fff; }
.portal-head h1 { font-size: 25px; margin-top: 6px; }
.portal-tabs { display: none; }
.portal-main { max-width: 680px; margin: 0 auto; padding: 18px 16px; display: grid; gap: 18px; }
.balance-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); }
.balance-card .lbl { color: var(--muted); }
.balance-card .hero-figure { color: var(--red); display: inline-block; }
.balance-card .hero-figure.zero { color: var(--navy); }
.balance-card .equation { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule); }
.verify-note { display: flex; gap: 10px; font-size: 14.5px; color: var(--muted); margin-top: 12px; }
.verify-note .i { margin-top: 3px; color: var(--green); }
.tx-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); }
.tx-list li { border-bottom: 1px solid var(--rule); }
.tx-list li:last-child { border-bottom: 0; }
.tx-list a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 16px; text-decoration: none; color: var(--navy); }
.tx-list a:hover { background: #FAFBF8; }
.tx-list .what { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-list .when { font-size: 14px; color: var(--muted); }
.tx-list .amt { text-align: right; font-weight: 700; }
.tx-list .bal { text-align: right; font-size: 14px; color: var(--muted); }
.tx-list .tags { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
@media (min-width: 1024px) {
  .portal { padding-bottom: 32px; }
  .portal .bottom-nav { display: none; }
  .portal-tabs { display: flex; gap: 4px; max-width: 680px; margin: 0 auto; padding: 0 16px; }
  .portal-tabs a { color: rgba(255, 255, 255, .9); text-decoration: none; font-weight: 600; padding: 10px 14px; border-radius: var(--radius) var(--radius) 0 0; }
  .portal-tabs a[aria-current="page"] { background: var(--paper); color: var(--red); }
  .portal-head .inner { padding-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .demo-bar, .spine, .topbar, .bottom-nav, .site-head, .site-foot, .actions { display: none !important; }
  body { background: #fff; }
}
