/* RESET */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--bs-body-font-family, Arial, sans-serif);
    font-size: var(--bs-body-font-size, 1rem);
    color: var(--bs-body-color, #212529);
    margin: 0;
    padding: 0;
    line-height: var(--bs-body-line-height, 1.5);
    background-color: var(--bs-body-bg, #fff);
}

img {
    max-width: 100%;
    height: auto;
}

/* HEADER */
.invoice-header {
    text-align: center;
    border-bottom: 2px solid #000;
    margin-bottom: 20px;
    padding-bottom: 10px;
}

.invoice-header h1 {
    margin: 0;
    font-size: 22px;
    letter-spacing: 1px;
}

/* META INFO */
.invoice-meta {
    width: 100%;
    margin-bottom: 20px;
}

.invoice-meta td {
    vertical-align: top;
    padding: 4px;
}

.invoice-meta strong {
    display: inline-block;
    width: 120px;
}

/* BILLING */
.billing {
    width: 100%;
    margin-bottom: 20px;
}

.billing td {
    width: 50%;
    vertical-align: top;
    padding: 6px;
}

.billing h3 {
    margin: 0 0 6px 0;
    font-size: 14px;
    border-bottom: 1px solid #000;
}

/* STATUS */
.status {
    text-align: right;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 10px;
}

/* ITEMS TABLE */
.items {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.items th {
    border: 1px solid #000;
    padding: 6px;
    background: #f2f2f2;
    font-size: 12px;
    text-align: center;
}

.items td {
    border: 1px solid #000;
    padding: 6px;
}

.items td:nth-child(2),
.items td:nth-child(3),
.items td:nth-child(4) {
    text-align: center;
}

/* TOTALS */
.totals {
    width: 40%;
    float: right;
    border-collapse: collapse;
    margin-top: 10px;
}

.totals td {
    border: 1px solid #000;
    padding: 6px;
}

.totals .label {
    font-weight: bold;
}

.totals .grand {
    font-weight: bold;
    font-size: 13px;
}

/* CLEAR FLOAT */
.clear {
    clear: both;
}

/* PAYMENT DETAILS */
.payment-info {
    margin-top: 20px;
}

.payment-info h3 {
    font-size: 14px;
    margin-bottom: 6px;
    border-bottom: 1px solid #000;
}

.payment-info p {
    margin: 4px 0;
}

/* NOTES */
.notes {
    margin-top: 20px;
    font-size: 11px;
}

.notes h4 {
    margin-bottom: 4px;
}

/* PAYMENTS TABLE */
.payments {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.payments th,
.payments td {
    border: 1px solid #000;
    padding: 6px;
    text-align: center;
}

.payments th {
    background: #f2f2f2;
}

/* FOOTER */
.footer {
    margin-top: 25px;
    font-size: 11px;
    border-top: 1px solid #000;
    padding-top: 10px;
    text-align: center;
}

/* PRINT OPTIMIZATION */
@page {
    margin: 20mm;
}

/* ================================
   INVOICE FORM STYLES
   ================================ */

.legacy-form {
    max-width: 900px;
    margin: 30px auto;
    padding: 20px 25px;
    border: 1px solid #000;
    background: #fff;
}

.legacy-form h2 {
    text-align: center;
    margin-top: 20px;
}

.legacy-form h3 {
    margin-top: 20px;
    padding-bottom: 5px;
    border-bottom: 1px solid #000;
    font-size: 14px;
}

.legacy-form input[type="text"],
.legacy-form input[type="date"],
.legacy-form input[type="number"],
.legacy-form select,
.legacy-form textarea {
    width: 100%;
    padding: 8px;
    margin-top: 6px;
    margin-bottom: 12px;
    border: 1px solid #000;
    font-size: 12px;
    font-family: inherit;
}

.legacy-form textarea {
    min-height: 80px;
    resize: vertical;
}

.legacy-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: 6px;
    background: var(--brand-blue);
    color: #fff;
    cursor: pointer;
}

/* ===== BASE ===== */
table {
    width: 100%;
    border-collapse: collapse;
}

.clear {
    clear: both;
}

/* ===== COLORS ===== */
:root {
    --brand-blue: #0e7ba6;
    --light-blue: #e8f3f8;
    --brand-orange: #e07a26;
    --bs-primary: #0e7ba6;
    --bs-primary-rgb: 14, 123, 166;
}

/* ===== HEADER ===== */
.invoice-header {
    width: 100%;
    margin-bottom: 20px;
}

.logo {
    width: 40%;
    float: left;
}

.logo img {
    max-width: 160px;
}

.invoice-title {
    width: 60%;
    float: right;
    text-align: right;
}

.invoice-title h1 {
    margin: 0;
    color: var(--brand-blue);
}

.status {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 3px;
    color: #fff;
    font-size: 11px;
    margin-top: 5px;
}

.status.PAID {
    background: #28a745;
}

.status.UNPAID {
    background: #dc3545;
}

.status.PARTIALLY\ PAID {
    background: #f0ad4e;
}

/* ===== META ===== */
.invoice-meta {
    margin-bottom: 15px;
}

.invoice-meta td {
    padding: 5px 0;
}

/* ===== BILLING ===== */
.billing td {
    width: 50%;
    vertical-align: top;
    padding: 10px;
    background: var(--light-blue);
}

.billing h3 {
    margin-top: 0;
    color: var(--brand-blue);
}

/* ===== ITEMS ===== */
.items th {
    background: var(--brand-blue);
    color: #fff;
    padding: 8px;
    border: 1px solid #ccc;
}

.items td {
    padding: 8px;
    border: 1px solid #ccc;
}

.items td:nth-child(2),
.items td:nth-child(3),
.items td:nth-child(4) {
    text-align: right;
}

/* ===== TOTALS ===== */
.totals {
    width: 40%;
    float: right;
    margin-top: 15px;
}

.totals td {
    padding: 6px;
    border: 1px solid #ccc;
}

.totals .grand {
    background: var(--light-blue);
    font-weight: bold;
}

/* ===== PAYMENTS ===== */
.payments th {
    background: var(--brand-blue);
    color: #fff;
    padding: 6px;
}

.payments td {
    padding: 6px;
    border: 1px solid #ccc;
}

/* ===== FOOTER ===== */
.footer {
    margin-top: 30px;
    font-size: 11px;
    text-align: center;
    color: #555;
}
