/* Munshi — every printout (cause list, client profile, case summary, receipts, invoices, statements, intake, agreements).
   Look = the app's own theme (client, 24 Nov 2026): Munshi orange #f07a1a with deep orange #c25e0c, soft peach panels,
   the app's system font, rounded tables. Firm letterhead on top; Munshi logo + tagline ONCE, in the footer of every page.
   Text never gets cut: every cell wraps long names and numbers. */
  .doc { --o: #f07a1a; --od: #c25e0c; --ok: #9a4507; --pe: #fdf2e8; --pe2: #fbe6d2; --ln: #efe1d3; --ink: #1f2330; --mu: #666a78;
    color: var(--ink); font: 9.8pt/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, Helvetica, Arial, "Noto Sans Devanagari", sans-serif;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc * { box-sizing: border-box; }
  .doc td, .doc th, .doc p, .doc div, .doc span, .doc b { overflow-wrap: anywhere; word-break: normal; }

  /* ---------- Munshi ribbon (kept for old templates; Munshi now shows only in the footer) ---------- */
  .doc .mrib { display: none; }
  /* ---------- letterhead ---------- */
  .doc .lh2 { display: grid; grid-template-columns: 22mm 1fr 22mm; align-items: center; gap: 4mm; padding: 0 0 3mm; }
  .doc .lh2 .lh-l, .doc .lh2 .lh-r { height: 20mm; display: flex; align-items: center; }
  .doc .lh2 .lh-l { justify-content: flex-start; } .doc .lh2 .lh-r { justify-content: flex-end; }
  .doc .lh2 .lh-l img { max-height: 20mm; max-width: 22mm; object-fit: contain; }
  .doc .lh2 .lh-r img { width: 18mm; height: 18mm; object-fit: cover; border-radius: 50%; border: .5mm solid var(--pe2); }
  .doc .lh2 .lh-c { text-align: center; }
  .doc .lh2 .lh-n { font-weight: 800; font-size: 19pt; line-height: 1.1; letter-spacing: -.2pt; color: var(--ink); }
  .doc .lh2 .lh-t { font-size: 9.6pt; color: var(--mu); margin-top: 1mm; }
  .doc .lh2 .lh-a { font-size: 8.6pt; color: #4a4e5a; margin-top: 1.2mm; }
  .doc .lh2 .lh-ct { font-size: 8.6pt; color: #4a4e5a; }
  .doc .lh-rule { height: 1.6mm; margin: 0 0 5mm; border-radius: 1mm; background: linear-gradient(90deg, var(--o), var(--pe2) 70%, transparent); }

  /* ---------- document title ---------- */
  .doc h2 { text-align: center !important; font-weight: 800; font-size: 13pt; line-height: 1.2; letter-spacing: 1.6pt; text-transform: uppercase; color: var(--ink); margin: 0 0 1.2mm; }
  .doc h2::after { content: ''; display: block; width: 14mm; height: .8mm; border-radius: 1mm; background: var(--o); margin: 1.6mm auto 0; }
  .doc h2 + p, .doc .dh-m { text-align: center; color: var(--mu); font-size: 9pt; margin: 0 0 5mm; }
  .doc .dh-m b { color: var(--ink); }
  .doc h3 { font-weight: 700; font-size: 10.4pt; line-height: 1.3; color: var(--ink); margin: 6mm 0 2mm; padding: 1.6mm 3.2mm; background: var(--pe); border-left: 1.2mm solid var(--o); border-radius: 0 2mm 2mm 0; page-break-after: avoid; }

  /* ---------- tables ---------- */
  .doc table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0 0 4mm; border: .3mm solid var(--ln); border-radius: 2.5mm; overflow: hidden; page-break-inside: auto; }
  .doc table.cl { table-layout: fixed; }
  .doc tr { page-break-inside: avoid; }
  .doc th, .doc td { border: 0; border-bottom: .25mm solid #f3e9df; padding: 1.8mm 2.4mm; vertical-align: top; text-align: left; font-size: 9.2pt; }
  .doc th { background: var(--pe2); color: var(--ok); font-weight: 700; font-size: 8pt; letter-spacing: .4pt; text-transform: uppercase; }
  .doc tr:last-child td { border-bottom: 0; }
  .doc tbody tr:nth-child(even) td, .doc table tr:nth-child(even) td { background: #fffaf5; }
  .doc td small, .doc td .small { display: block; color: var(--mu); font-size: 8.2pt; margin-top: .4mm; }
  .doc table.kv td:first-child, .doc table td[style*="width:30%"], .doc table td[style*="width:35%"] { width: 32%; color: var(--mu); font-weight: 600; font-size: 8.8pt; background: #fffaf5 !important; }
  .doc table.kv td:last-child { font-weight: 500; }
  .doc .tot td, .doc tr.tot th { background: var(--pe) !important; color: var(--ink); font-weight: 800; border-top: .4mm solid var(--o); }
  .doc .num-r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .doc .ourstar { color: var(--o); }

  /* ---------- cause list ---------- */
  .doc .daybar { display: flex; justify-content: space-between; align-items: baseline; margin: 5mm 0 2mm; padding: 2.2mm 3.8mm; background: var(--o); color: #fff; border-radius: 2.5mm; page-break-after: avoid; }
  .doc .daybar b { font-size: 11.5pt; font-weight: 800; } .doc .daybar span { font-size: 8.6pt; opacity: .95; }
  .doc .courtrow td { background: #fff !important; padding: 2.4mm 3mm 1.8mm; border-bottom: .35mm solid var(--pe2); border-top: .35mm solid var(--pe2); page-break-after: avoid; }
  .doc .courtrow .cx-n { font-weight: 800; font-size: 10pt; color: var(--ink); padding-left: 2.4mm; border-left: 1.1mm solid var(--o); }
  .doc .courtrow .cx-w { color: var(--mu); font-size: 8.6pt; margin-left: 2mm; }
  .doc .courtrow .cx-c { float: right; font-size: 8pt; font-weight: 700; color: var(--ok); background: var(--pe); border-radius: 3mm; padding: .3mm 2.2mm; }
  .doc table.cl .c-n { color: var(--mu); }
  .doc table.cl .c-room b { display: block; color: var(--ink); }
  .doc table.cl .c-item { display: inline-block; margin-top: .6mm; font-size: 8pt; font-weight: 700; color: var(--ok); background: var(--pe); border-radius: 2.5mm; padding: .2mm 1.8mm; }

  /* ---------- blocks ---------- */
  .doc .amt-box { display: flex; justify-content: space-between; align-items: center; margin: 4mm 0; padding: 4mm 5mm; border-radius: 3mm; background: var(--pe); border: .3mm solid var(--pe2); }
  .doc .amt-box .l { font-size: 9pt; color: var(--mu); text-transform: uppercase; letter-spacing: .5pt; }
  .doc .amt-box .v { font-size: 17pt; font-weight: 800; line-height: 1; color: var(--ink); }
  .doc .amt-box .w { font-size: 8.8pt; color: #4a4e5a; font-style: italic; }
  .doc .sign { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 16mm; page-break-inside: avoid; }
  .doc .sign div { text-align: center; min-width: 55mm; font-size: 9pt; color: #4a4e5a; }
  .doc .sign div::before { content: ''; display: block; border-top: .3mm solid var(--ink); margin-bottom: 1.5mm; }
  .doc .note { font-size: 8.6pt; color: var(--mu); margin-top: 4mm; }
  .doc .pill-p { display: inline-block; padding: .3mm 2mm; border-radius: 3mm; font-size: 8pt; font-weight: 700; background: var(--pe); color: var(--ok); }
  .doc .fill { border-bottom: .3mm dotted #b9a796; min-height: 6mm; }
  .doc .pb { page-break-before: always; }
  .doc pre { white-space: pre-wrap; font-size: 9.5pt; line-height: 1.5; font-family: inherit; }

  /* ---------- page wrapper (keeps room for the footer on every page) ---------- */
  .doc table.pgw { border: 0 !important; border-radius: 0; overflow: visible; margin: 0; width: 100%; table-layout: auto; }
  .doc table.pgw > tbody > tr > td, .doc table.pgw > tfoot > tr > td { padding: 0 !important; border: 0 !important; background: none !important; font-size: 10pt; }
  .doc table.pgw > tbody > tr { page-break-inside: auto; }
  .doc .pg-sp { height: 20mm; }
  /* ---------- footer on every page: Munshi logo + tagline (left), document label (middle), printed on (right) ---------- */
  .doc .mfoot { position: fixed; left: 0; right: 0; bottom: 0; display: flex !important; align-items: center; justify-content: space-between; gap: 6mm; margin: 0; padding-top: 2.2mm; border-top: .4mm solid var(--pe2); font: 7.6pt -apple-system, "Segoe UI", Arial, sans-serif; color: #8a8e97; }
  .doc .mfoot .mf-b { order: 1; display: flex; flex-direction: column; align-items: flex-start; gap: .6mm; flex: 0 0 auto; }
  .doc .mfoot .mf-s { order: 2; flex: 1; text-align: center; } .doc .mfoot .mf-s:last-child { order: 3; text-align: right; flex: 0 0 auto; }
  .doc .mfoot .wordmark { height: 6mm !important; width: auto; color: var(--ink); display: block; }
  .doc .mfoot .mf-t { line-height: 0; color: #4a4e5a; } .doc .mfoot .mf-t .tagsvg { height: 3.6mm; margin: 1mm 0 0; } /* readable tagline (client, 24 Nov 2026) */

/* printing */
@media print {
  @page { size: A4; margin: 13mm 13mm 6mm 13mm; }
  html, body { background: #fff !important; }
  body::before, body::after, #mload, #app, #modal, #toast, #bottom, #side { display: none !important; }
  #print { display: block !important; }
  #print .mfoot { position: fixed; }
}
/* picture for sharing: an A4-wide page drawn off screen */
.doc.shot { position: fixed; left: -12000px; top: 0; width: 210mm; padding: 12mm 13mm 8mm; background: #fff; z-index: -1; }
.doc.shot .mfoot { position: static !important; margin-top: 8mm; }
.doc.shot .pg-sp { display: none; }
.doc:not(.shot) .mfoot { background: #fff; }
.doc.shot.land { width: 297mm; }
/* signature lines at the same height on every print (agent D5-9) */
.doc .sign { align-items: stretch; }
.doc .sign div { display: flex; flex-direction: column; justify-content: flex-end; }
/* fee agreement: the opening paragraph is body text, not a grey subtitle (agent D5-8) */
.doc h2 + p:not(.dh-m) { text-align: left; color: var(--ink); font-size: 9.8pt; }
