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

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

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

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

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

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

/* ---- Logo ---- */
.th-logo {
    max-width: 34mm;
    max-height: 14mm;
    margin-bottom: 1px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* ---- Company Header ---- */
.th-company {
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.5px;
    margin-bottom: 0;
    text-transform: uppercase;
    line-height: 1.2;
}
.th-addr {
    font-size: 9px;
    font-weight: 600;
    line-height: 1.2;
    color: #111;
}

/* ---- Title (TAX INVOICE / QUOTATION) ---- */
.th-title {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 1px;
    margin: 0;
    line-height: 1.3;
}

/* ---- Bill info ---- */
.th-info {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
    margin: 0;
}
.th-info td {
    padding: 0px 1px;
    vertical-align: top;
    line-height: 1.2;
}
.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: 10px;
}
.th-items thead tr {
    border-top: 1.5px solid #000;
    border-bottom: 1.5px solid #000;
}
.th-items th {
    padding: 1px 2px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.2px;
}
.th-items td {
    padding: 0px 2px;
    vertical-align: top;
    line-height: 1.25;
    font-weight: 600;
}
.th-items tbody tr:last-child td {
    border-bottom: 1.5px 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: 9px;
    color: #444;
    font-weight: 600;
    margin-top: 0;
    line-height: 1.1;
}

/* ---- Totals ---- */
.th-totals {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
    margin-top: 0;
}
.th-totals td {
    padding: 0px 2px;
    line-height: 1.25;
}
.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: 2px solid #000;
    border-bottom: 2px solid #000;
    font-size: 13px;
    font-weight: 900;
    padding: 2px 2px;
    color: #000;
    letter-spacing: 0.2px;
}
.th-paid td {
    color: #15803d;
    font-size: 10px;
    font-weight: 800;
}
.th-bal td {
    color: #b91c1c;
    font-size: 11px;
    font-weight: 900;
}
.th-mode td {
    color: #444;
    font-size: 9px;
    font-weight: 600;
}

/* ---- Barcode ---- */
#barcode {
    display: block;
    max-width: 56mm;
    height: 24px;
    margin: 1px auto;
}

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

/* ---- Footer text ---- */
.th-footer-text {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.3px;
    margin-bottom: 0;
}

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