/* =====================================================
   فاکتور قابل چاپ
===================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Vazirmatn", "Segoe UI", "Noto Sans Arabic", "Noto Naskh Arabic", Tahoma, sans-serif;
    background: #eef1ee;
    color: #1f2937;
    line-height: 1.9;
    padding: 24px 16px 40px;
}

.invoice-toolbar {
    max-width: 820px;
    margin: 0 auto 14px;
    display: flex;
    gap: 10px;
}

.invoice-print-btn,
.invoice-back-btn {
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    border-radius: 10px;
    padding: 10px 18px;
    cursor: pointer;
}

.invoice-print-btn {
    border: 0;
    background: #16a34a;
    color: #fff;
}

.invoice-print-btn:hover {
    background: #15803d;
}

.invoice-back-btn {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
}

.invoice {
    max-width: 820px;
    margin: 0 auto;
    background: #fff;
    border-radius: 14px;
    padding: 32px 34px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.invoice-loading {
    text-align: center;
    color: #6b7280;
    padding: 40px 0;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 18px;
    border-bottom: 2px solid #16a34a;
}

.invoice-logo {
    font-size: 24px;
    font-weight: 800;
    color: #172018;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 2px 12px;
    display: inline-block;
    margin-bottom: 6px;
}

.invoice-logo span {
    color: #16a34a;
}

.invoice-brand p {
    font-size: 12px;
    color: #6b7280;
}

.invoice-title h1 {
    font-size: 20px;
    color: #172018;
    margin-bottom: 6px;
    text-align: left;
}

.invoice-meta th,
.invoice-meta td {
    font-size: 12px;
    padding: 1px 6px;
    text-align: right;
}

.invoice-meta th {
    color: #6b7280;
    font-weight: 500;
}

.invoice-section {
    margin-top: 20px;
}

.invoice-section h2 {
    font-size: 14px;
    color: #172018;
    margin-bottom: 8px;
}

.invoice-customer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 20px;
    font-size: 13px;
    background: #f8faf8;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 14px;
}

.invoice-customer .wide {
    grid-column: 1 / -1;
}

.invoice-customer span {
    color: #6b7280;
}

.invoice-items {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.invoice-items th,
.invoice-items td {
    border: 1px solid #e5e7eb;
    padding: 8px 6px;
    text-align: center;
    vertical-align: middle;
}

.invoice-items thead th {
    background: #f0fdf4;
    color: #166534;
    font-weight: 700;
}

.invoice-items .text-start {
    text-align: right;
}

.invoice-items td small {
    display: block;
    color: #6b7280;
    font-size: 11px;
}

.invoice-totals {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.invoice-totals table {
    min-width: 300px;
    border-collapse: collapse;
    font-size: 13px;
}

.invoice-totals th,
.invoice-totals td {
    padding: 6px 10px;
    border-bottom: 1px solid #e5e7eb;
}

.invoice-totals th {
    text-align: right;
    color: #6b7280;
    font-weight: 500;
}

.invoice-totals td {
    text-align: left;
    font-weight: 600;
}

.invoice-totals .grand th,
.invoice-totals .grand td {
    color: #15803d;
    font-size: 15px;
    font-weight: 800;
    background: #f0fdf4;
}

.invoice-totals .due td {
    color: #c2410c;
}

.invoice-footer {
    margin-top: 28px;
    text-align: center;
    font-size: 12px;
    color: #6b7280;
}

@media (max-width: 640px) {

    .invoice {
        padding: 20px 14px;
    }

    .invoice-header {
        flex-direction: column;
    }

    .invoice-title h1 {
        text-align: right;
    }

    .invoice-customer {
        grid-template-columns: 1fr;
    }

    .invoice-section {
        overflow-x: auto;
    }

    .invoice-items {
        min-width: 520px;
    }

    .invoice-totals table {
        min-width: 0;
        width: 100%;
    }

}

@media print {

    @page {
        size: A4;
        margin: 12mm;
    }

    body {
        background: #fff;
        padding: 0;
    }

    .invoice-toolbar {
        display: none;
    }

    .invoice {
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        max-width: none;
    }

    .invoice-items thead th,
    .invoice-totals .grand th,
    .invoice-totals .grand td {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

}
