/* app.css — East Area Carpentry quotation app.
   The classic "workshop" P1 look: a permanent left sidebar at 900px+ that
   collapses to an off-canvas drawer below it, a 4-step wizard with a live
   document preview pane beside the form, and a Price List with a category
   rail — the same structural pattern products/quotation-suite/package-1-ui
   uses (see its app.css), rebuilt here with East Area Carpentry's own
   walnut/brass identity, not Al Noor Auto Workshop's navy/amber, and not
   Al Amoud's cream-editorial single-page layout either. Mobile first tap
   targets are >=44px throughout. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }

:root {
  /* Deep walnut/espresso — the app's primary ink and the sidebar colour.
     Grounded in the client's one real photo (an ornate dark-wood entrance
     door). Checked, not eyeballed: 13.67:1 against white — miles past the
     4.5:1 AA floor for the sidebar's own white nav text. */
  --espresso: #3B2A1E;
  --espresso-hover: #4A3628;
  --espresso-deep: #2A1D14;

  /* Antique brass/gold accent — distinct from Al Amoud's terracotta
     (#84481F) and from AJUZEE's own gold (#C9A24B). Two shades: --brass for
     icons/borders/highlights on light surfaces (dark ink on it clears
     5.09:1), --brass-deep for solid buttons carrying white text (5.25:1) —
     the plain --brass only clears 3.35:1 against white, enough for large
     text/icons but not a filled button label, so buttons use the deeper
     shade instead of lightening the ink. */
  --brass: #AE8636;
  --brass-deep: #8A661F;
  --brass-soft: rgba(174, 134, 54, .14);
  --brass-soft-2: rgba(174, 134, 54, .08);

  --ink: #2A2018;
  --ink-muted: #6B5D4F;
  --ink-faint: #8D8072;
  --bg: #F6F3EE;
  --surface: #FFFFFF;
  --paper: #FDFBF8;
  --line: #E6DFD1;
  --line-2: #EEE9DD;

  /* quote-status colours (draft/sent/approved/declined/invoiced) */
  --st-draft: #6B5D4F;
  --st-sent: #2E5E8C;
  --st-approved: #2F6B3A;
  --st-declined: #9C4B23;
  --st-invoiced: #8A661F;
  /* invoice payment-status colours — checked against white, all >=4.9:1 */
  --pay-due: #9C4B23;
  --pay-partial: #8F6B1E;
  --pay-paid: #2F6B3A;

  --ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --num: "IBM Plex Mono", ui-monospace, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --r: 12px;
  --shadow: 0 2px 10px rgba(42, 29, 20, .07);
  --shadow-l: 0 10px 34px -14px rgba(42, 29, 20, .28);
}

body {
  font-family: var(--ui); background: var(--bg); color: var(--ink);
  line-height: 1.5; -webkit-font-smoothing: antialiased;
}
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
/* Safety-net default for every hand-drawn stroke icon (icons.js emits a
   bare <svg viewBox="0 0 24 24"> with no width/height, so it falls back to
   the browser's native SVG size — ~150px — anywhere a class doesn't set
   one explicitly). Any more specific ".foo svg" rule below still wins. */
svg { width: 18px; height: 18px; flex-shrink: 0; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.muted { color: var(--ink-muted); }
.muted-sm { color: rgba(255, 255, 255, .55); font-size: 12px; }

/* ── shell: sidebar + main ─────────────────────────────────────────── */
.shell { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.side { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0;
  width: 84vw; max-width: 300px; height: 100%; height: 100dvh; background: var(--espresso);
  color: #fff; padding: 18px 14px; gap: 4px; z-index: 95; overflow-y: auto;
  transform: translateX(-105%); transition: transform .28s var(--ease);
  box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
.shell.nav-open .side { transform: translateX(0); }
.navveil { position: fixed; inset: 0; background: rgba(20, 14, 9, .55); z-index: 90;
  opacity: 0; pointer-events: none; transition: opacity .2s; }
.shell.nav-open .navveil { opacity: 1; pointer-events: auto; }

.side-brand { display: flex; align-items: center; gap: 11px; padding: 6px 6px 18px; }
.side-mark { width: 42px; height: 42px; border-radius: 10px; background: rgba(255, 255, 255, .1);
  display: grid; place-items: center; font-weight: 700; font-size: 15px; overflow: hidden; flex: none; }
.side-mark img { width: 100%; height: 100%; object-fit: contain; }
.side-brand-text { flex: 1; min-width: 0; }
.side-brand-text b { display: block; font-size: 14.5px; line-height: 1.25; }
.side-brand-text span { font-size: 12px; color: rgba(255, 255, 255, .55); }
.side-close { width: 40px; height: 40px; border-radius: 10px; background: rgba(255, 255, 255, .1);
  color: #fff; display: grid; place-items: center; flex: none; }
.side-close:active { background: rgba(255, 255, 255, .18); }
.side-close svg { width: 18px; height: 18px; }

.side-cta { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px;
  border-radius: 10px; background: var(--brass-deep); color: #fff; font-weight: 700; font-size: 14.5px;
  margin-bottom: 14px; }
.side-cta:active { background: var(--brass); }
.side-cta svg { width: 18px; height: 18px; }

.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.side-nav button { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px;
  border-radius: 10px; color: rgba(255, 255, 255, .74); font-size: 14.5px; font-weight: 600; text-align: start; }
.side-nav button svg { width: 19px; height: 19px; }
.side-nav button:hover, .side-nav button:active { background: rgba(255, 255, 255, .1); color: #fff; }
.side-nav button.on { background: var(--brass); color: #221805; }
.side-foot { border-top: 1px solid rgba(255, 255, 255, .14); padding-top: 12px; margin-top: 10px;
  font-size: 12px; color: rgba(255, 255, 255, .5); line-height: 1.6; }

/* ── top bar ───────────────────────────────────────────────────────── */
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .ic { width: 42px; height: 42px; border-radius: 10px; border: 1.5px solid var(--line-2);
  display: grid; place-items: center; flex: none; background: var(--surface); }
.topbar .ic:active { background: var(--bg); }
.topbar-mid { flex: 1; min-width: 0; }
.topbar-mid h1 { font-size: 18px; }
.topbar-mid span { font-size: 12.5px; color: var(--ink-muted); }
.topbar-right { flex: none; }
@media (min-width: 900px) { .topbar .navtoggle { display: none; } }

/* ── app scroll area / page ───────────────────────────────────────── */
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.page { padding: 16px; max-width: 1200px; margin: 0 auto; }
.page-narrow { max-width: 640px; }
@media (min-width: 900px) { .page { padding: 22px 28px 32px; } }

/* ── stat cards ────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 22px; }
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px; }
.stat-eyebrow { display: flex; align-items: center; gap: 8px; color: var(--ink-muted); font-size: 12.5px;
  font-weight: 600; margin-bottom: 10px; }
.stat-eyebrow svg { width: 17px; height: 17px; color: var(--brass); }
.stat-val { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.stat-sub { font-size: 11.5px; color: var(--ink-faint); margin-top: 3px; }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 12px; }
.section-title h2 { font-size: 16px; }

/* ── quotes list ───────────────────────────────────────────────────── */
.qlist { display: flex; flex-direction: column; gap: 10px; }
.qrow { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  display: flex; align-items: stretch; overflow: hidden; }
.qrow-open { flex: 1; min-width: 0; display: grid; grid-template-columns: 100px 1fr auto; gap: 14px;
  align-items: center; padding: 14px; text-align: start; }
@media (min-width: 700px) { .qrow-open { grid-template-columns: 110px 1fr 170px 110px 150px 20px; } }
.qrow-ref { font-family: var(--num); font-size: 12px; color: var(--ink-faint); }
.qrow-name { font-weight: 700; font-size: 14.5px; display: block; }
.qrow-sub { font-size: 12px; color: var(--ink-muted); }
.qrow-total { font-weight: 700; font-size: 14.5px; }
.qrow-badges { display: none; gap: 6px; }
@media (min-width: 700px) { .qrow-badges { display: flex; flex-wrap: wrap; } }
.qrow-arrow { display: none; color: var(--ink-faint); }
@media (min-width: 700px) { .qrow-arrow { display: block; } }
.qrow-edit { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; width: 64px; border-left: 1px solid var(--line); color: var(--ink-muted); font-size: 11px; font-weight: 600; }
.qrow-edit:hover { background: var(--bg); color: var(--ink); }
.qrow-edit svg { width: 17px; height: 17px; }

.emptystate { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 20px;
  color: var(--ink-faint); text-align: center; }
.emptystate svg { width: 34px; height: 34px; opacity: .5; }

/* ── badges / pills ────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 700; padding: 4px 9px;
  border-radius: 99px; white-space: nowrap; }
.badge svg { width: 13px; height: 13px; margin-right: 5px; flex: none; }
.badge-draft { background: #EFEBE4; color: var(--st-draft); }
.badge-sent { background: #E4EDF5; color: var(--st-sent); }
.badge-approved { background: #E4F0E8; color: var(--st-approved); }
.badge-declined { background: #F5E6DE; color: var(--st-declined); }
.badge-invoiced { background: var(--brass-soft); color: var(--brass-deep); }
.badge-due { background: #F5E6DE; color: var(--pay-due); }
.badge-partial { background: #F3EBD8; color: var(--pay-partial); }
.badge-paid { background: #E4F0E8; color: var(--pay-paid); }

/* ── tabs (Quotes: All / Quotes / Invoices) ───────────────────────── */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 14px; }
.tab { flex: none; min-height: 44px; padding: 0 16px; border-radius: 99px; border: 1.5px solid var(--line);
  background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--ink-muted); display: flex; align-items: center; gap: 6px; }
.tab i { font-style: normal; opacity: .7; }
.tab.active { background: var(--espresso); border-color: var(--espresso); color: #fff; }
.tab.active i { opacity: .75; }

/* ── search bar ────────────────────────────────────────────────────── */
.searchbar { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 10px; padding: 0 14px; height: 46px; margin-bottom: 14px; }
.searchbar svg { width: 18px; height: 18px; color: var(--ink-faint); flex: none; }
.searchbar input { flex: 1; border: 0; outline: 0; background: none; font-size: 14.5px; height: 100%; }

/* ── cards / panels / fields ───────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px;
  margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-title { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 700; }
.panel-title svg { width: 18px; height: 18px; color: var(--brass); }
.panel-subtitle { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px;
  margin-bottom: 14px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-muted); margin-bottom: 6px; }
.field label span { font-weight: 400; color: var(--ink-faint); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 9px;
  background: var(--surface); font-size: 14.5px; outline: 0; }
.field textarea { min-height: 72px; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brass); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-hint { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }

/* ── buttons ───────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 0 18px; border-radius: 10px; font-size: 14.5px; font-weight: 700; white-space: nowrap;
  background: var(--espresso); color: #fff; transition: background .15s; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover, .btn:active { background: var(--espresso-hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--brass-deep); }
.btn-primary:hover, .btn-primary:active { background: var(--brass); color: #221805; }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost:hover, .btn-ghost:active { background: var(--bg); }
.btn-danger { background: var(--pay-due); }
.btn-danger:hover { background: #8A3F1D; }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: 13px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-block { width: 100%; }

.icon-btn { width: 44px; height: 44px; border-radius: 8px; display: inline-grid; place-items: center;
  color: var(--ink-muted); }
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }

/* ── category chips (wizard step 2) ───────────────────────────────── */
.cat-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.cat-chip { flex: none; min-height: 44px; display: flex; align-items: center; gap: 7px; padding: 0 14px;
  border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); font-size: 13px;
  font-weight: 600; color: var(--ink-muted); }
.cat-chip svg { width: 15px; height: 15px; }
.cat-chip.active { background: var(--espresso); border-color: var(--espresso); color: #fff; }

.pick-list { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto;
  margin-bottom: 18px; border: 1px solid var(--line-2); border-radius: var(--r); padding: 8px; background: var(--bg); }
.pick-row { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line-2); text-align: start; }
.pick-row:hover { border-color: var(--brass); }
.pick-row-name { display: block; font-weight: 700; font-size: 13.5px; }
.pick-row-desc { display: block; font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }
.pick-row-price { flex: none; font-size: 13px; font-weight: 700; color: var(--brass-deep); }
.pick-empty { padding: 20px; text-align: center; color: var(--ink-faint); font-size: 13px; }

.wiz-added-head { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-muted); margin: 4px 0 10px; }
.item-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.item-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.item-cat { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brass-deep); }
.item-name { font-weight: 700; font-size: 14px; margin-top: 2px; }
.item-spec { font-size: 12px; color: var(--ink-muted); margin-top: 3px; }
.item-amt { font-weight: 700; font-size: 14.5px; text-align: right; }
.item-actions { display: flex; gap: 4px; margin-top: 6px; justify-content: flex-end; }
.item-actions button { width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; color: var(--ink-muted); }
.item-actions button:hover { background: var(--bg); color: var(--ink); }
.item-actions svg { width: 16px; height: 16px; }
.item-empty { padding: 20px; text-align: center; color: var(--ink-faint); font-size: 13px;
  border: 1px dashed var(--line); border-radius: var(--r); margin-bottom: 6px; }

/* ── review step ───────────────────────────────────────────────────── */
.revrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.revrow:last-child { border-bottom: 0; }
.revrow-name { min-width: 0; }
.totals-strip { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.tot-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; font-size: 14px; }
.tot-row.grand { border-top: 1.5px solid var(--line); margin-top: 6px; padding-top: 12px; font-size: 16.5px; font-weight: 700; }

/* ── dimensional mini-form ────────────────────────────────────────── */
.dimrow { display: flex; align-items: center; gap: 10px; }
.dimrow.single { justify-content: flex-start; }
.dim-input { flex: 1; }
.dim-input input { text-align: center; font-family: var(--num); }
.dimrow .x { font-size: 15px; color: var(--ink-faint); flex: none; }
.calc-live { display: flex; gap: 16px; background: var(--brass-soft-2); border: 1px solid var(--brass-soft);
  border-radius: 10px; padding: 12px 14px; margin-top: 6px; flex-wrap: wrap; }
.calc-live > div { display: flex; flex-direction: column; gap: 2px; }
.calc-live span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); }
.calc-live b { font-family: var(--num); font-size: 15px; }

/* ── modals ────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(20, 14, 9, .5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 460px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-l); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h3 { font-size: 16px; }
.modal-close { width: 44px; height: 44px; border-radius: 9px; display: grid; place-items: center; color: var(--ink-muted); }
.modal-close:hover { background: var(--bg); }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px;
  border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }

/* ── toast ─────────────────────────────────────────────────────────── */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); z-index: 200;
  background: var(--espresso-deep); color: #fff; padding: 12px 18px; border-radius: 99px; font-size: 14px;
  font-weight: 600; display: flex; align-items: center; gap: 8px; opacity: 0; animation: toastin .25s var(--ease) forwards; }
.toast svg { width: 16px; height: 16px; color: var(--brass); }
@keyframes toastin { to { opacity: 1; transform: translate(-50%, 0); } }

/* ── wizard: progress dots + split (form + live preview) ─────────── */
.prog { display: flex; gap: 6px; padding: 4px 16px 16px; max-width: 1200px; margin: 0 auto; }
@media (min-width: 900px) { .prog { padding: 0 0 20px; } }
.prog i { flex: 1; height: 4px; border-radius: 99px; background: var(--line); font-style: normal; }
.prog i.on { background: var(--brass); }

.wizsplit { display: block; }
.wizform { min-width: 0; }
.wizpreview { display: none; }
@media (min-width: 900px) {
  .wizsplit { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 26px; align-items: start; }
  .wizpreview { display: block; position: sticky; top: 18px; }
}
.wizpreview-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 8px; }
.wizpreview-stage { max-height: calc(100vh - 140px); overflow-y: auto; border-radius: 14px; }
.doc-empty-preview { padding: 60px 20px; text-align: center; color: var(--ink-faint); font-size: 13px;
  border: 1.5px dashed var(--line); border-radius: var(--r); background: var(--surface); }

.wizbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-bottom: 8px; }

.doctabs { display: flex; gap: 8px; margin-bottom: 14px; }
.doctabs button { flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 700; color: var(--ink-muted); }
.doctabs button svg { width: 16px; height: 16px; }
.doctabs button.on { background: var(--espresso); border-color: var(--espresso); color: #fff; }
.wiz-actions-head { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: 10px; }

/* ── price list: category rail + rows ─────────────────────────────── */
.twopane { display: block; }
@media (min-width: 900px) { .twopane { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; } }
.rail { display: flex; overflow-x: auto; gap: 6px; margin-bottom: 16px; }
@media (min-width: 900px) { .rail { flex-direction: column; overflow-x: visible; position: sticky; top: 18px; } }
.rail button { flex: none; display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600;
  color: var(--ink-muted); white-space: nowrap; }
.rail button svg { width: 16px; height: 16px; flex: none; }
.rail .rail-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--brass); flex: none; }
.rail button span { flex: 1; text-align: left; }
.rail button i { font-style: normal; color: var(--ink-faint); font-size: 11.5px; }
.rail button.on { background: var(--espresso); border-color: var(--espresso); color: #fff; }
.rail button.on i { color: rgba(255, 255, 255, .6); }

.llist { display: flex; flex-direction: column; gap: 8px; }
.lrow { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; }
.lrow.hidden-row { opacity: .55; }
.linfo { flex: 1; min-width: 0; }
.linfo b { font-size: 14px; font-weight: 700; }
.lrow-mode { display: block; font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }
.lprice { flex: none; font-weight: 700; font-size: 14px; }
.lprice .unit { font-weight: 400; color: var(--ink-faint); font-size: 12px; }
.lacts { flex: none; display: flex; gap: 4px; }

/* ═══════════════════ THE DOCUMENT — one template, kind swaps ═══════════ */
.doc-sheet { background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; font-size: 13px; line-height: 1.5; box-shadow: var(--shadow-l); }

.doc-mast { background: var(--espresso); color: #fff; padding: 22px 24px 18px; position: relative; overflow: hidden; }
.doc-mast::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px;
  border-radius: 50%; background: rgba(255, 255, 255, .04); }
.doc-mast-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; position: relative; z-index: 1; }
.doc-mark { display: flex; align-items: center; gap: 12px; min-width: 0; }
.doc-mark-chip { width: 46px; height: 46px; border-radius: 11px; background: #fff; display: grid; place-items: center;
  flex: none; overflow: hidden; padding: 6px; }
.doc-mark-chip img { width: 100%; height: 100%; object-fit: contain; }
.doc-bizname { font-size: 16.5px; font-weight: 700; letter-spacing: -.005em; }
.doc-bizaddr { font-size: 11px; color: rgba(255, 255, 255, .68); margin-top: 3px; line-height: 1.5; }
.doc-kind { text-align: right; flex: none; }
.doc-kind-label { font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--brass); }
.doc-kind-ref { font-family: var(--num); font-size: 16.5px; font-weight: 700; margin-top: 4px; }
.doc-metastrip { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 16px; padding-top: 13px;
  border-top: 1px solid rgba(255, 255, 255, .16); position: relative; z-index: 1; }
.doc-metastrip .k { font-size: 9px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .5); }
.doc-metastrip .v { font-size: 12px; font-weight: 600; margin-top: 3px; color: #fff; }

.doc-in { padding: 20px 24px 24px; }

.doc-parties { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 16px; }
.doc-parties .k { font-size: 9px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 5px; }
.doc-parties .nm { font-size: 14.5px; font-weight: 700; }
.doc-parties em { font-style: normal; color: var(--ink-muted); display: block; font-size: 11.5px; margin-top: 2px; }
.doc-statuswrap { flex: none; }
.doc-statusbadge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 99px; }
.doc-badge-ic { width: 14px; height: 14px; margin-right: 6px; }
.doc-statusbadge.due { background: #F5E6DE; color: var(--pay-due); }
.doc-statusbadge.partial { background: #F3EBD8; color: var(--pay-partial); }
.doc-statusbadge.paid { background: #E4F0E8; color: var(--pay-paid); }

.doc-scope { background: var(--brass-soft-2); border: 1px solid var(--brass-soft); border-radius: 9px;
  padding: 10px 12px; font-size: 12px; margin-bottom: 16px; }
.doc-scope b { color: var(--brass-deep); margin-right: 4px; }

.doc-empty { padding: 20px; text-align: center; color: var(--ink-faint); border: 1px dashed var(--line); border-radius: 9px; }

.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 4px; }
.doc-table thead th { font-size: 9.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--espresso); text-align: left; padding: 8px; background: var(--line-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.doc-table thead th.num, .doc-table td.num { text-align: right; }
.doc-table td { padding: 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.doc-table .ln { font-weight: 600; }
.doc-table .spec { font-size: 11px; color: var(--ink-muted); margin-top: 2px; }
.doc-table .muted { color: var(--ink-faint); }
.doc-table .strong { font-weight: 700; }
.doc-catrow td { background: var(--brass-soft-2); font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brass-deep); padding: 6px 8px; border-bottom: 1px solid var(--brass-soft); }

.doc-tail { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 18px; }
.doc-notesbank { flex: 1 1 260px; min-width: 0; }
.doc-box { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px;
  font-size: 11.5px; color: var(--ink-muted); line-height: 1.6; }
.doc-box .lbl { display: block; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink); margin-bottom: 5px; }
.doc-totalsbox { flex: 1 1 240px; max-width: 300px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; padding: 12px 14px; }
.doc-totalsbox .row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 12.5px; }
.doc-totalsbox .row.grand { border-top: 1.5px solid var(--line); margin-top: 4px; padding-top: 9px; font-size: 15px;
  font-weight: 700; color: var(--espresso); }
.doc-totalsbox .row.paidrow { color: var(--pay-paid); }
.doc-totalsbox .row.duerow { font-weight: 700; color: var(--pay-due); border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 8px; }

.doc-sign { display: flex; justify-content: space-between; gap: 24px; margin-top: 30px; }
.doc-sign > div { flex: 1; text-align: center; }
.doc-sign .line { border-bottom: 1px solid var(--ink-faint); height: 34px; }
.doc-sign span { font-size: 11px; color: var(--ink-muted); }

.doc-thanks { text-align: center; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line-2);
  font-size: 11.5px; color: var(--ink-muted); }

/* ═══════════════════ mobile / desktop responsive shell ═══════════════════ */
@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .side { position: sticky; top: 0; width: 260px; flex: none; height: 100vh; height: 100dvh;
    max-width: none; transform: none; transition: none; box-shadow: none; z-index: auto; }
  .side-close { display: none; }
  .navveil { display: none; }
  .main { height: 100vh; height: 100dvh; }
}

/* ═══════════════════ print (PDF export uses the same sheet) ═══════════════ */
@media print {
  .shell > *:not(.main), .topbar, .wizform, .prog, .toast, .modal-overlay { display: none !important; }
  .wizsplit { display: block !important; }
  .doc-sheet { box-shadow: none; border: 0; }
  body { background: #fff; }
}
