/* VRS Invoice: the A4 document. Paper white, ink near-black, one emerald accent.
   Same markup on screen (scaled to fit) and in print / Save as PDF. */

.sheet {
    --ink: #0B0D10;
    --ink-2: #4A5160;
    --ink-3: #7A8191;
    --rule: #E3E6EB;
    --rule-strong: #0B0D10;
    --em: #17A863;
    position: relative;
    width: 210mm;
    min-height: 297mm;
    padding: 12mm 14mm 9mm;
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    color: var(--ink);
    font: 400 9pt/1.45 'Geist', 'Inter', system-ui, sans-serif;
    font-feature-settings: 'tnum', 'ss01';
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 24px 60px -20px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}
.sheet::before { /* emerald index tab, top-left */
    content: '';
    position: absolute; left: 14mm; top: 0;
    width: 18mm; height: 1.6mm;
    background: var(--em);
}
.sheet h3 {
    margin: 0 0 2mm;
    font: 500 6.8pt/1 'Geist Mono', ui-monospace, monospace;
    text-transform: uppercase; letter-spacing: 0.14em;
    color: var(--ink-3);
}
.sheet p { margin: 0; }
.sheet .mono { font-family: 'Geist Mono', ui-monospace, monospace; font-size: 0.95em; }
.sh-muted { color: var(--ink-3) !important; font-weight: 400 !important; }

/* Head */
.sh-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10mm; padding-bottom: 5mm; border-bottom: 0.5mm solid var(--rule-strong); }
.sh-logo { height: 8.5mm; width: auto; display: block; margin-top: 1mm; }
.sh-title { display: flex; flex-direction: column; align-items: flex-end; gap: 1.6mm; text-align: right; }
.sh-kind { font: 600 19pt/1 'Geist', sans-serif; letter-spacing: -0.03em; text-transform: uppercase; }
.sh-no { font: 500 10.5pt/1 'Geist Mono', ui-monospace, monospace; color: var(--ink-2); letter-spacing: -0.02em; }

/* Meta strip */
.sh-meta { display: flex; margin: 0; border-bottom: 0.25mm solid var(--rule); }
.sh-meta > div { flex: 1 1 0; padding: 3mm 4mm 3mm 0; min-width: 0; }
.sh-meta > div + div { padding-left: 4mm; border-left: 0.25mm solid var(--rule); }
.sh-meta dt { font: 500 6.8pt/1 'Geist Mono', ui-monospace, monospace; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-3); margin-bottom: 1.8mm; }
.sh-meta dd { margin: 0; font-weight: 500; font-size: 9.5pt; }
.sh-meta .sh-meta-due { flex: 1.25 1 0; background: #F3FBF7; padding-left: 4mm; border-left: 0.6mm solid var(--em) !important; }
.sh-meta .sh-meta-due dd { font: 600 13pt/1.1 'Geist Mono', ui-monospace, monospace; letter-spacing: -0.03em; color: var(--ink); }

/* Parties */
.sh-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 10mm; padding: 5mm 0 4mm; }
.sh-party p { color: var(--ink-2); }
.sh-party .sh-party-name { color: var(--ink); font-weight: 600; font-size: 10.5pt; margin-bottom: 1mm; letter-spacing: -0.01em; }
.sh-ids { margin: 2mm 0 0; display: grid; grid-template-columns: auto 1fr; gap: 0.6mm 3mm; }
.sh-ids div { display: contents; }
.sh-ids dt { font: 500 6.8pt/1.9 'Geist Mono', ui-monospace, monospace; letter-spacing: 0.1em; color: var(--ink-3); text-transform: uppercase; }
.sh-ids dd { margin: 0; font: 400 8.4pt/1.6 'Geist Mono', ui-monospace, monospace; color: var(--ink); word-break: break-all; }

/* Items */
.sh-items { width: 100%; border-collapse: collapse; margin-top: 1mm; }
.sh-items th {
    font: 500 6.8pt/1 'Geist Mono', ui-monospace, monospace; text-transform: uppercase; letter-spacing: 0.12em;
    color: var(--ink-3); text-align: left; padding: 2.6mm 2mm; border-top: 0.25mm solid var(--rule-strong); border-bottom: 0.25mm solid var(--rule-strong);
}
.sh-items td { padding: 2.4mm 2mm; border-bottom: 0.25mm solid var(--rule); vertical-align: top; }
.sh-items tr { break-inside: avoid; }
.sh-items .c-n { width: 8mm; padding-left: 0; font: 500 8pt/1.5 'Geist Mono', ui-monospace, monospace; color: var(--ink-3); }
.sh-items .c-d strong { font-weight: 600; display: block; }
.sh-items .c-d span { display: block; color: var(--ink-2); font-size: 8.4pt; margin-top: 0.8mm; }
.sh-items .c-s { width: 16mm; font: 400 8pt/1.5 'Geist Mono', ui-monospace, monospace; color: var(--ink-2); }
.sh-items .c-q { width: 16mm; text-align: right; white-space: nowrap; }
.sh-items .c-q small { color: var(--ink-3); font-size: 7.5pt; }
.sh-items .c-r, .sh-items .c-a { width: 27mm; text-align: right; font: 400 8.8pt/1.5 'Geist Mono', ui-monospace, monospace; white-space: nowrap; }
.sh-items thead th[class] { font: 500 6.8pt/1 'Geist Mono', ui-monospace, monospace; color: var(--ink-3); }
.sh-items th.c-q, .sh-items th.c-r, .sh-items th.c-a { text-align: right; }
.sh-items .c-a { padding-right: 0; font-weight: 500; }
.sh-items th.c-n, .sh-items th.c-a { padding-left: 0; padding-right: 0; }

/* Summary */
.sh-sum { display: grid; grid-template-columns: 1fr 74mm; gap: 10mm; padding: 4mm 0 1mm; break-inside: avoid; }
.sh-words p { color: var(--ink); font-weight: 500; }
.sh-words .sh-note { margin-top: 3mm; color: var(--ink-2); font-weight: 400; font-size: 8pt; padding-left: 2.5mm; border-left: 0.5mm solid var(--rule); }
.sh-totals { width: 100%; border-collapse: collapse; }
.sh-totals th { text-align: left; font-weight: 400; color: var(--ink-2); padding: 1.2mm 0; }
.sh-totals td { text-align: right; font: 400 8.8pt/1.5 'Geist Mono', ui-monospace, monospace; padding: 1.2mm 0; white-space: nowrap; }
.sh-totals .sh-total th, .sh-totals .sh-total td { border-top: 0.5mm solid var(--rule-strong); padding-top: 2.6mm; color: var(--ink); }
.sh-totals .sh-total th { font-weight: 600; font-size: 10pt; }
.sh-totals .sh-total th small { font: 500 6.8pt 'Geist Mono', monospace; color: var(--ink-3); margin-left: 1mm; letter-spacing: 0.1em; }
.sh-totals .sh-total td { font-size: 14pt; font-weight: 600; letter-spacing: -0.03em; }
.sh-totals .sh-final th, .sh-totals .sh-final td { padding-top: 2mm; color: var(--ink); font-weight: 600; }
.sh-totals .sh-final th small { font: 500 6.8pt 'Geist Mono', monospace; color: var(--ink-3); margin-left: 1mm; letter-spacing: 0.1em; }
.sh-totals .sh-balance th, .sh-totals .sh-balance td { color: var(--em); font-weight: 600; border-top: 0.25mm solid var(--rule); }

/* Payment */
.sh-pay { display: flex; gap: 8mm; margin-top: 3mm; padding: 3.5mm 4mm; border: 0.25mm solid var(--rule); background: #FAFBFC; break-inside: avoid; }
.sh-bank { flex: 1 1 auto; }
.sh-bank dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.8mm 4mm; }
.sh-bank dl div { display: contents; }
.sh-bank dt { color: var(--ink-3); font-size: 8pt; }
.sh-bank dd { margin: 0; font-weight: 500; }
.sh-upi { display: flex; gap: 4mm; align-items: center; padding-left: 6mm; border-left: 0.25mm solid var(--rule); }
.sh-qr { width: 23mm; height: 23mm; flex: none; }
.sh-qr svg { width: 100%; height: 100%; display: block; }
.sh-upi-amt { font: 600 11pt/1.2 'Geist Mono', monospace; letter-spacing: -0.02em; margin: 0.5mm 0 1mm !important; }
.sh-upi .mono { color: var(--ink-2); font-size: 8pt; }

/* Notes */
.sh-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 10mm; margin-top: 4mm; break-inside: avoid; }
.sh-notes p { color: var(--ink-2); font-size: 8.2pt; }

/* Footer */
.sh-foot { margin-top: auto; padding-top: 5mm; break-inside: avoid; }
.sh-sign { display: flex; flex-direction: column; align-items: flex-end; gap: 1mm; margin-bottom: 3mm; }
.sh-sign p { font-weight: 500; font-size: 8.6pt; }
.sh-sign .sh-sign-line { text-align: right; color: var(--ink-2); font-weight: 400; }
.sh-legal { display: flex; justify-content: space-between; gap: 6mm; padding-top: 3mm; border-top: 0.25mm solid var(--rule); font: 400 6.8pt/1.4 'Geist Mono', ui-monospace, monospace; color: var(--ink-3); letter-spacing: 0.02em; }

/* States */
.sheet-watermark {
    position: absolute; left: 50%; top: 46%;
    transform: translate(-50%, -50%) rotate(-24deg);
    font: 700 120pt/1 'Geist', sans-serif; letter-spacing: 0.08em;
    color: rgba(11, 13, 16, 0.045); pointer-events: none; user-select: none;
}
.sheet-stamp {
    margin: 5mm 0 0 2mm; width: max-content;
    transform: rotate(-6deg);
    display: flex; flex-direction: column; align-items: center;
    padding: 2.5mm 6mm; border: 0.8mm solid currentColor;
    font: 700 20pt/1 'Geist Mono', monospace; letter-spacing: 0.16em;
    opacity: 0.85; pointer-events: none;
}
.sheet-stamp small { font: 500 7pt/1 'Geist Mono', monospace; letter-spacing: 0.1em; margin-top: 1.5mm; color: inherit; }
.sheet-stamp--paid { color: var(--em); }
.sheet-stamp--void { color: #D23B3B; }
.sheet--void .sh-items, .sheet--void .sh-sum { opacity: 0.55; }

/* Screen scaling wrappers (JS sets the scale to fit the column) */
.preview-scale, .paper-scale { transform-origin: top left; width: 210mm; }
.preview-scale .sheet, .paper-scale .sheet { transition: opacity 0.2s; }
.preview-scale.is-stale .sheet { opacity: 0.82; }

/* ── Print / Save as PDF ── */
@page { size: A4; margin: 0; }
@media print {
    html, body { background: #FFFFFF !important; margin: 0 !important; padding: 0 !important; }
    body.app, body.public { display: block !important; }
    .side, .page-head, .invoice-side, .public-bar, .flash, .skip { display: none !important; }
    .main { padding: 0 !important; max-width: none !important; }
    .invoice-layout { display: block !important; }
    .invoice-paper { border: 0 !important; padding: 0 !important; background: none !important; overflow: visible !important; height: auto !important; }
    .paper-scale, .preview-scale { transform: none !important; width: auto !important; height: auto !important; margin: 0 !important; }
    .sheet { box-shadow: none !important; min-height: 296.5mm; margin: 0 !important; }
}
