@page {
    size: 76mm auto;
    margin: 2mm 3mm;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0; padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    color: #000;
    background: #fff;
}

.thermal-invoice {
    width: 72mm;
    margin: 0 auto;
    padding: 2mm 0;
}

/* ---- Separators ---- */
.th-dashed {
    border: none;
    border-top: 1.5px dashed #000;
    margin: 3px 0;
}

/* ---- Text helpers ---- */
.th-center { text-align: center; }
.th-left   { text-align: left; }
.th-small  { font-size: 10.5px; color: #222; font-weight: 600; }

/* ---- Logo ---- */
.th-logo {
    max-width: 42mm;
    max-height: 20mm;
    margin-bottom: 4px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* ---- Company Header ---- */
.th-company {
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 0.8px;
    margin-bottom: 3px;
    text-transform: uppercase;
}
.th-addr {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    color: #111;
}

/* ---- Title (TAX INVOICE / QUOTATION) ---- */
.th-title {
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 1.5px;
    margin: 2px 0;
}

/* ---- Bill info ---- */
.th-info {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin: 1px 0;
}
.th-info td {
    padding: 2px 1px;
    vertical-align: top;
    line-height: 1.3;
}
.th-info td:first-child {
    width: 30%;
    color: #444;
    font-weight: 700;
}
.th-info td:last-child {
    font-weight: 700;
}

/* ---- Items table ---- */
.th-items {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.th-items thead tr {
    border-top: 2px solid #000;
    border-bottom: 2px solid #000;
}
.th-items th {
    padding: 3px 2px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.3px;
}
.th-items td {
    padding: 2px 2px;
    vertical-align: top;
    line-height: 1.4;
    font-weight: 600;
}
.th-items tbody tr:last-child td {
    border-bottom: 2px solid #000;
}

/* Column widths & alignment */
.c-item { text-align: left;  width: 46%; }
.c-qty  { text-align: right; width: 12%; }
.c-rate { text-align: right; width: 21%; }
.c-amt  { text-align: right; width: 21%; }

/* Dotted separator between item rows */
.th-item-sep td {
    padding: 0;
    border-bottom: 1px dashed #999;
}

.th-desc {
    font-size: 10px;
    color: #444;
    font-weight: 600;
    margin-top: 1px;
    line-height: 1.3;
}

/* ---- Totals ---- */
.th-totals {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 2px;
}
.th-totals td {
    padding: 2px 2px;
    line-height: 1.5;
}
.th-totals td:first-child { color: #333; font-weight: 700; }
.th-totals td:last-child  { text-align: right; font-weight: 700; }

.th-grand td {
    border-top: 2.5px solid #000;
    border-bottom: 2.5px solid #000;
    font-size: 15px;
    font-weight: 900;
    padding: 5px 2px;
    color: #000;
    letter-spacing: 0.3px;
}
.th-paid td {
    color: #15803d;
    font-size: 12px;
    font-weight: 800;
}
.th-bal td {
    color: #b91c1c;
    font-size: 13px;
    font-weight: 900;
}
.th-mode td {
    color: #444;
    font-size: 11px;
    font-weight: 600;
}

/* ---- Barcode ---- */
#barcode {
    display: block;
    max-width: 60mm;
    height: 34px;
    margin: 3px auto;
}

/* ---- UPI QR ---- */
#upiQR {
    display: flex;
    justify-content: center;
    margin: 3px auto;
}
#upiQR canvas,
#upiQR img { width: 92px !important; height: 92px !important; }

/* ---- Footer text ---- */
.th-footer-text {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

/* ---- Print media ---- */
@media print {
    .print-toolbar, .sidebar, .topbar, .no-print, nav { display: none !important; }
}
