/* ── Invoice Styles ─────────────────────────────────────── */

/* Create Form */
.invoice-form-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 24px;
    align-items: start;
}
@media (max-width: 900px) { .invoice-form-grid { grid-template-columns: 1fr; } }

.items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.items-table th { background: #f8fafc; padding: 10px 12px; text-align: left; font-size: 12px; color: #64748b; font-weight: 600; border-bottom: 1px solid #e2e8f0; }
.items-table td { padding: 8px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.items-table input { width: 100%; padding: 6px 8px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 13px; }
.items-table td.item-total { font-weight: 600; color: #0f172a; white-space: nowrap; }

.totals-table { display: flex; flex-direction: column; gap: 10px; }
.totals-row   { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: #475569; }
.totals-total { padding-top: 12px; border-top: 2px solid #0f172a; font-size: 16px; color: #0f172a; }

/* Invoice Preview (show view) */
.invoice-preview {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    max-width: 860px;
    margin: 0 auto;
}

/* Print view */
body.print-body { background: #f1f5f9; }
.print-toolbar  { padding: 16px 24px; background: #fff; border-bottom: 1px solid #e2e8f0; display: flex; gap: 12px; }
.print-invoice  { background: #fff; max-width: 800px; margin: 30px auto; padding: 48px; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
@media print    { .print-invoice { margin: 0; box-shadow: none; padding: 0; } }

/* Shared invoice layout */
.inv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 36px;
    padding-bottom: 24px;
    border-bottom: 2px solid #0f172a;
}

.inv-logo       { max-height: 60px; max-width: 180px; object-fit: contain; }
.inv-brand-name { font-size: 24px; font-weight: 800; color: #0f172a; letter-spacing: -0.5px; }
.inv-from-details { font-size: 13px; color: #64748b; margin-top: 8px; line-height: 1.7; }

.inv-meta       { text-align: right; }
.inv-title      { font-size: 36px; font-weight: 900; color: #0f172a; letter-spacing: -1px; }
.inv-number     { font-size: 15px; color: #64748b; margin-top: 4px; }
.inv-status-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
}
.status-draft   { background: #fef3c7; color: #92400e; }
.status-sent    { background: #dbeafe; color: #1e40af; }
.status-paid    { background: #d1fae5; color: #065f46; }
.status-overdue { background: #fee2e2; color: #991b1b; }

.inv-parties {
    display: flex;
    justify-content: space-between;
    margin-bottom: 32px;
    gap: 24px;
}

.inv-section-label { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: #94a3b8; text-transform: uppercase; margin-bottom: 8px; }
.inv-client-name   { font-size: 16px; font-weight: 700; color: #0f172a; margin-bottom: 4px; }
.inv-bill-to       { font-size: 14px; color: #475569; line-height: 1.7; }

.inv-dates      { text-align: right; }
.inv-date-row   { display: flex; justify-content: flex-end; gap: 20px; font-size: 14px; color: #475569; margin-bottom: 6px; }
.inv-date-row span { color: #94a3b8; }
.inv-date-row code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 12px; }

.inv-items { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.inv-items thead tr { background: #0f172a; color: #fff; }
.inv-items th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .3px; }
.inv-items td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; font-size: 14px; color: #334155; }
.inv-items tbody tr:hover td { background: #f8fafc; }
.inv-items td:nth-child(2), .inv-items td:nth-child(3), .inv-items td:nth-child(4) { text-align: right; }
.inv-items th:nth-child(2), .inv-items th:nth-child(3), .inv-items th:nth-child(4) { text-align: right; }

.inv-totals {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
    margin-left: auto;
    margin-bottom: 32px;
}

.inv-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #475569;
    padding: 4px 0;
}

.inv-grand-total {
    border-top: 2px solid #0f172a;
    padding-top: 12px;
    margin-top: 4px;
    font-size: 18px;
    color: #0f172a;
}

.inv-notes {
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
    font-size: 13px;
    color: #64748b;
    line-height: 1.7;
}

.inv-footer {
    margin-top: 40px;
    text-align: center;
    font-size: 13px;
    color: #94a3b8;
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
}
