body {
    font-family: Arial, sans-serif;
    background: #f2f2f2;
}

.container {
    max-width: 900px;
    margin: 20px auto;
    background: #fff;
    padding: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(220px,1fr));
    gap: 10px;
}

.form-grid input {
    padding: 7px;
    border: 1px solid #ccc;
}

.buttons {
    text-align: center;
    margin: 20px 0;
}

button {
    padding: 8px 16px;
    margin: 5px;
    cursor: pointer;
}

.invoice-preview-content {
    border: 2px solid #000;
    padding: 15px;
    font-size: 13px;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.invoice-table th,
.invoice-table td {
    border: 1px solid #000;
    padding: 6px;
    vertical-align: top;
}

.invoice-table th {
    color: red;
    font-weight: bold;
    text-align: center;
}

.right {
    text-align: right;
}

.footer {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

@media print {
    body * { visibility: hidden; }
    .invoice-preview-content, .invoice-preview-content * {
        visibility: visible;
    }
}
/* ===== TWO COLUMN PROFESSIONAL INFO GRID ===== */

.info-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    border: 1px solid #000;
    margin-top: 8px;
    margin-bottom: 12px;
    font-size: 13px;
}

.info-left,
.info-right {
    padding: 8px 10px;
}

.info-left {
    border-right: 1px solid #000;
}

.info-grid p {
    margin: 4px 0;
}
/* ===== PDF / PRINT SAFE FIX ===== */

.invoice-preview-content {
    width: 210mm;
    max-width: 210mm;
    margin: 0 auto;
    box-sizing: border-box;
}

.invoice-table {
    width: 100%;
    table-layout: fixed;
}

.invoice-table th,
.invoice-table td {
    word-wrap: break-word;
}

@media print {
    body {
        margin: 0;
        padding: 0;
    }

    .invoice-preview-content {
        border: none;
        width: 210mm;
    }
}
/* ===== FINAL PDF LOCK ===== */

#pdfContainer .invoice-preview-content {
    width: 150mm !important;
    min-height: 297mm;
    margin: 0;
    padding: 12mm;
    box-sizing: border-box;
    background: #fff;
}

#pdfContainer table {
    width: 90%;
    table-layout: fixed;
    border-collapse: collapse;
}

#pdfContainer th,
#pdfContainer td {
    word-break: break-word;
}
/* ===== PDF HARD LOCK ===== */

#pdfContainer * {
    box-sizing: border-box;
}

#pdfContainer .invoice-preview-content {
    width: 210mm !important;
    min-height: 297mm;
    padding: 10mm;
    margin: 0;
    background: #fff;
    border: none;
}

#pdfContainer table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

#pdfContainer th,
#pdfContainer td {
    word-break: break-word;
    font-size: 12px;
}

#pdfContainer img {
    max-width: 100%;
    height: auto;
}
/* ===== FINAL A4 PDF LOCK (DO NOT CHANGE) ===== */

.invoice-preview-content {
    width: 210mm;
    max-width: 210mm;
    margin: 0 auto;
    padding: 10mm;
    box-sizing: border-box;
    background: #fff;
}

.invoice-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.invoice-table th,
.invoice-table td {
    word-break: break-word;
    font-size: 12px;
}

body.pdf-mode {
    margin: 0;
    padding: 0;
    background: white;
}
/* ===== FINAL A4 LOCK – DO NOT CHANGE ===== */

.invoice-preview-content {
    width: 210mm;
    max-width: 210mm;
    margin: 0 auto;
    padding: 10mm;
    box-sizing: border-box;
    background: #ffffff;
}

.invoice-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.invoice-table th,
.invoice-table td {
    word-break: break-word;
    font-size: 12px;
    padding: 5px;
}

.invoice-table th {
    text-align: center;
}

img {
    max-width: 100%;
    height: auto;
}
body.pdf-mode {
    margin: 0;
    padding: 0;
    background: white;
}