/*
 * Receipt Book document template (preview + future PDF).
 * Deliberately PDF-renderer friendly: tables, fixed px sizes, no CSS
 * variables, no flex/grid. Always printed on white "paper", in any theme.
 */

.doc {
    position: relative;
    box-sizing: border-box;
    width: 794px;
    min-height: 1123px;
    padding: 56px 60px;
    background: #ffffff;
    color: #0f172a;
    font-family: "DejaVu Sans", sans-serif;
    font-size: 13px;
    line-height: 20px; /* always px — DocumentPdf rescales these for Dompdf */
}

.doc [hidden] { display: none !important; }
/* Self-contained: don't rely on the app's base.css (the PDF doesn't load it) */
.doc *, .doc *::before, .doc *::after { box-sizing: border-box; }
.doc th, .doc td { box-sizing: content-box; } /* Dompdf ignores box-sizing on cells */

.doc table { width: 100%; border-collapse: collapse; }
.doc td, .doc th { vertical-align: top; padding: 0; }

.doc-muted { color: #64748b; }
.doc-pre { white-space: pre-line; }

.doc-label {
    font-size: 10.5px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 4px;
}

/* Header */
.doc-head__meta { width: 45%; text-align: right; }
.doc-logo { display: block; max-width: 180px; max-height: 64px; margin-bottom: 12px; }
.doc-from-name { font-size: 17px; line-height: 24px; font-weight: bold; margin-bottom: 2px; }
.doc-cancelled { display: inline-block; margin: 6px 0 2px; padding: 2px 10px; border: 2px solid #dc2626; color: #dc2626; font-size: 13px; font-weight: bold; letter-spacing: 3px; }
.doc-title { font-size: 26px; line-height: 32px; font-weight: bold; letter-spacing: 3px; color: #4f46e5; }

.doc .doc-meta { width: auto; margin: 14px 0 0 auto; }
.doc-meta th { font-weight: normal; color: #64748b; text-align: right; padding: 2px 14px 2px 0; }
.doc-meta td { text-align: right; padding: 2px 0; font-weight: bold; white-space: nowrap; }

/* Parties */
.doc .doc-parties { margin-top: 32px; border-top: 1px solid #e5e7eb; }
.doc-parties td { padding-top: 24px; }
.doc-to-name { font-size: 15px; line-height: 22px; font-weight: bold; }
.doc-due { width: 40%; text-align: right; }
.doc-due__amount { font-size: 24px; line-height: 32px; font-weight: bold; }

/* Items */
.doc .doc-items { margin-top: 32px; }
.doc-items th {
    font-size: 10.5px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #64748b;
    text-align: left;
    padding: 8px;
    border-bottom: 2px solid #0f172a;
}
.doc-items td { padding: 10px 8px; border-bottom: 1px solid #e5e7eb; }
.doc-items .doc-num { text-align: right; white-space: nowrap; }
.doc-items .doc-items__hsn { width: 72px; white-space: nowrap; }
.doc-items .doc-items__qty { width: 64px; }
.doc-items .doc-items__rate { width: 120px; }
.doc-items .doc-items__amount { width: 130px; }
.doc-items__desc { word-wrap: break-word; overflow-wrap: anywhere; }

/* Totals */
.doc .doc-totals { width: 300px; }
.doc-totals th { font-weight: normal; color: #64748b; text-align: left; padding: 5px 8px; }
.doc-totals td { text-align: right; padding: 5px 8px; white-space: nowrap; }
.doc-totals__grand th, .doc-totals__grand td {
    border-top: 2px solid #0f172a;
    padding-top: 10px;
    font-size: 16px;
    line-height: 22px;
    font-weight: bold;
    color: #0f172a;
}

/* Packing slip etc.: no prices */
.doc--no-prices .doc-price { display: none !important; }

.doc .doc-summary { margin-top: 16px; }
.doc .doc-summary__stamp { vertical-align: middle; padding-left: 40px; }
.doc .doc-pay { width: auto; }
.doc-pay td { vertical-align: middle; }
.doc-pay__qr-cell { width: 112px; padding-right: 14px; }
.doc-pay__qr { display: block; width: 112px; height: 112px; }
.doc-pay__text { font-size: 12px; line-height: 18px; }
.doc-pay__id { font-weight: bold; white-space: nowrap; }
.doc .doc-summary__stamp--pay { padding-left: 0; vertical-align: top; padding-top: 6px; }
.doc-summary__totals { width: 300px; }
.doc-stamp {
    display: inline-block;
    padding: 4px 18px;
    border: 3px solid #059669;
    border-radius: 6px;
    color: #059669;
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 4px;
    transform: rotate(-12deg);
    opacity: .85;
}

.doc-notes { margin-top: 28px; }

/* GST tax summary, grouped by rate */
.doc .doc-taxsum { margin-top: 28px; }
.doc .doc-taxsum__table { margin-top: 6px; font-size: 12px; }
.doc-taxsum__table th {
    font-size: 10.5px; font-weight: bold; letter-spacing: 1px; text-transform: uppercase; color: #64748b;
    text-align: left; padding: 6px 8px; border-bottom: 1px solid #0f172a;
}
.doc-taxsum__table td { padding: 6px 8px; border-bottom: 1px solid #e5e7eb; }
.doc-taxsum__table .doc-num { text-align: right; white-space: nowrap; }
.doc-taxsum__table .doc-taxsum__total td { font-weight: bold; border-bottom: 0; }

/* Custom fields (P13): extra rows under Number and Date */
.doc-meta__custom td { font-weight: normal; }

/*
 * Designs (P13). Each is a modifier on .doc, so every document type gets it
 * on screen and in the PDF. No class = Classic, the approved default.
 * Same Dompdf rules as above: tables, px sizes, plain colours.
 */

/* Modern: coloured header band, tinted table heading, filled total */
.doc--modern { padding-top: 0; }
.doc--modern .doc-head { background: #4f46e5; color: #ffffff; }
.doc--modern .doc-head td.doc-head__from, .doc--modern .doc-head td.doc-head__meta { padding: 36px 28px 28px; }
.doc--modern .doc-head .doc-muted, .doc--modern .doc-meta th { color: #c7d2fe; }
.doc--modern .doc-title { color: #ffffff; }
.doc--modern .doc-logo { background: #ffffff; padding: 6px; }
.doc--modern .doc-parties { border-top: 0; }
.doc--modern .doc-due__amount { color: #4f46e5; }
.doc--modern .doc-items th { background: #eef2ff; color: #4338ca; border-bottom: 0; }
.doc--modern .doc-totals__grand th, .doc--modern .doc-totals__grand td { background: #4f46e5; color: #ffffff; border-top: 0; padding-bottom: 10px; }
.doc--modern .doc-taxsum__table th { background: #eef2ff; color: #4338ca; border-bottom: 0; }

/* Minimal: black and grey only, thin rules, quiet title */
.doc--minimal .doc-title { color: #0f172a; font-size: 20px; font-weight: normal; letter-spacing: 6px; }
.doc--minimal .doc-from-name { font-weight: normal; letter-spacing: 1px; }
.doc--minimal .doc-parties { border-top: 0; }
.doc--minimal .doc-due__amount { font-size: 20px; font-weight: normal; }
.doc--minimal .doc-items th { border-bottom: 1px solid #94a3b8; color: #475569; }
.doc--minimal .doc-items td { border-bottom: 1px solid #f1f5f9; }
.doc--minimal .doc-totals__grand th, .doc--minimal .doc-totals__grand td { border-top: 1px solid #94a3b8; font-weight: normal; }
.doc--minimal .doc-stamp { border-color: #0f172a; color: #0f172a; }

/* Bold: teal top bar, big title, dark table heading, highlighted total */
.doc--bold { border-top: 14px solid #0d9488; }
.doc--bold .doc-title { font-size: 36px; line-height: 42px; color: #0d9488; letter-spacing: 1px; }
.doc--bold .doc-parties { border-top: 2px solid #0f172a; }
.doc--bold .doc-due__amount { color: #0d9488; font-size: 28px; line-height: 36px; }
.doc--bold .doc-items th { background: #0f172a; color: #ffffff; border-bottom: 0; }
.doc--bold .doc-items td { border-bottom: 1px solid #cbd5e1; }
.doc--bold .doc-totals__grand th, .doc--bold .doc-totals__grand td { background: #ccfbf1; color: #134e4a; border-top: 0; padding-bottom: 10px; }
.doc--bold .doc-taxsum__table th { background: #0f172a; color: #ffffff; }

/* Boxed: ruled grid and serif type, like a printed GST bill book */
.doc--boxed { font-family: "DejaVu Serif", serif; }
.doc--boxed .doc-head { border: 1px solid #0f172a; }
.doc--boxed .doc-head td.doc-head__from, .doc--boxed .doc-head td.doc-head__meta { padding: 14px 16px; }
.doc--boxed .doc-head td.doc-head__meta { border-left: 1px solid #0f172a; }
.doc--boxed .doc-title { color: #0f172a; font-size: 22px; line-height: 28px; letter-spacing: 4px; }
.doc--boxed .doc-parties { margin-top: 0; border: 1px solid #0f172a; border-top: 0; }
.doc--boxed .doc-parties td { padding: 14px 16px; }
.doc--boxed .doc-parties td.doc-due { border-left: 1px solid #0f172a; }
.doc--boxed .doc-items { margin-top: 16px; }
.doc--boxed .doc-items th, .doc--boxed .doc-items td { border: 1px solid #0f172a; }
.doc--boxed .doc-items th { background: #f1f5f9; color: #0f172a; }
.doc--boxed .doc-totals { border: 1px solid #0f172a; }
.doc--boxed .doc-totals th, .doc--boxed .doc-totals td { border-bottom: 1px solid #cbd5e1; }
.doc--boxed .doc-totals__grand th, .doc--boxed .doc-totals__grand td { border-top: 1px solid #0f172a; background: #f1f5f9; }
.doc--boxed .doc-taxsum__table th, .doc--boxed .doc-taxsum__table td { border: 1px solid #0f172a; }
.doc--boxed .doc-label, .doc--boxed .doc-muted, .doc--boxed .doc-meta th { color: #334155; }
