/* Status badges (used inside order-details strip) */
.status-badge-modern {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    line-height: 1.1;
    font-weight: 600;
    border: 2px solid;
}

.status-badge-modern i { font-size: 0.8125rem; }

.status-badge-modern.status-success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #22c55e;
    color: #16a34a;
}

.status-badge-modern.status-warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #f59e0b;
    color: #d97706;
}

.status-badge-modern.status-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #3b82f6;
    color: #2563eb;
}

.status-badge-modern.status-danger {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #ef4444;
    color: #dc2626;
}

.status-badge-modern.status-primary {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border-color: #9333ea;
    color: #7c3aed;
}

.status-badge-modern.status-secondary {
    background: #f4f1f8;
    border-color: #d6c9e2;
    color: #6b5b7e;
}

/* Invoice document wrapper */
.invoice-document {
    width: 100%;
    max-width: 960px;
    background: #ffffff;
    border: 1px solid #e6e0ee;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(65, 20, 89, 0.07);
    padding: 0.875rem 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0 auto;
}

/* Invoice brand header */
.invoice-brand-header {
    text-align: center;
    padding-bottom: 0;
}

.invoice-brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.4rem;
    color: #411459;
    line-height: 1.1;
}

.invoice-brand-tag {
    font-size: 0.625rem;
    letter-spacing: 0.2rem;
    color: #7a6a8a;
    margin-top: 0.0625rem;
}

.invoice-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.invoice-divider-line {
    flex: 0 0 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #ffca05, transparent);
}

.invoice-divider-title {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.22rem;
    color: #411459;
}

/* Two-column parties */
.invoice-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
}

.invoice-party-card {
    border: 1px solid #e6e0ee;
    border-radius: 6px;
    overflow: hidden;
    background: #ffffff;
}

.invoice-party-header {
    background: linear-gradient(135deg, #411459 0%, #2a0d3d 100%);
    color: #ffffff;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.12rem;
    padding: 0.4rem 0.75rem;
}

.invoice-party-body {
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.75rem;
    color: #2a1a3a;
}

.party-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 0.5rem;
    align-items: baseline;
}

.party-label {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.04rem;
    color: #7a6a8a;
    text-transform: uppercase;
}

.party-value {
    font-size: 0.75rem;
    color: #2a1a3a;
    word-break: break-word;
}

.party-value.strong { font-weight: 700; color: #411459; }
.party-value.muted { color: #999; font-style: italic; }

.party-company-name {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #411459;
    margin-bottom: 0.0625rem;
    line-height: 1.2;
}

.party-company-address {
    font-size: 0.75rem;
    color: #2a1a3a;
    line-height: 1.35;
}

.party-company-contact {
    font-size: 0.75rem;
    color: #2a1a3a;
    margin-top: 0.0625rem;
    line-height: 1.3;
}

/* Invoice section */
.invoice-section {
    border: 1px solid #e6e0ee;
    border-radius: 6px;
    overflow: hidden;
}

.invoice-section-header {
    background: linear-gradient(135deg, #411459 0%, #2a0d3d 100%);
    color: #ffffff;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.18rem;
    padding: 0.4rem 0.75rem;
    text-align: center;
}

.invoice-section-body {
    padding: 0.5rem 0.75rem;
}

.order-details-strip {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 0.4rem 0.875rem;
    overflow: hidden;
}

.order-detail-cell {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1 1 0;
    min-width: 0;
}

.order-detail-cell .status-badge-modern {
    align-self: flex-start;
    width: auto;
    max-width: 100%;
}

/* Items table */
.invoice-items-wrapper {
    border: 1px solid #e6e0ee;
    border-radius: 6px;
    overflow: hidden;
}

.invoice-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    color: #2a1a3a;
}

.invoice-items-table thead th {
    background: linear-gradient(135deg, #411459 0%, #2a0d3d 100%);
    color: #ffffff;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08rem;
    text-transform: uppercase;
    padding: 0.4rem 0.5rem;
    text-align: left;
}

.invoice-items-table thead th.col-id,
.invoice-items-table thead th.col-qty,
.invoice-items-table thead th.col-price,
.invoice-items-table thead th.col-disc,
.invoice-items-table thead th.col-rrp,
.invoice-items-table thead th.col-amount {
    text-align: right;
}

.invoice-items-table tbody td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #f0ebf5;
    vertical-align: middle;
}

.invoice-items-table tbody tr:last-child td { border-bottom: none; }

.invoice-items-table .col-id { width: 36px; text-align: right; }
.invoice-items-table tbody .col-id { color: #7a6a8a; }
.invoice-items-table tbody .col-sku,
.invoice-items-table tbody .col-variant { color: #7a6a8a; font-size: 0.6875rem; }
.invoice-items-table .col-qty { width: 50px; text-align: right; }
.invoice-items-table .col-price { width: 72px; text-align: right; }
.invoice-items-table .col-disc { width: 64px; text-align: right; }
.invoice-items-table .col-rrp { width: 72px; text-align: right; }
.invoice-items-table .col-amount { width: 90px; text-align: right; }
.invoice-items-table tbody .col-amount,
.invoice-items-table tfoot .col-amount { font-weight: 700; color: #411459; }

.invoice-product-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.invoice-product-thumb {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    object-fit: cover;
    background: #f5f0fa;
    border: 1px solid #ece5f4;
    flex: 0 0 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7a6a8a;
}

.invoice-product-thumb.placeholder i { font-size: 0.875rem; }

.invoice-product-name {
    font-weight: 600;
    color: #2a1a3a;
}

.invoice-items-footer td {
    background: #faf7fd;
    font-weight: 700;
    color: #411459;
    padding: 0.4rem 0.5rem;
    border-top: 2px solid #e6d9f0;
}

.invoice-items-footer .footer-label {
    text-align: left;
    letter-spacing: 0.04rem;
}

/* Applied discounts */
.applied-discounts-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.applied-discount-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.5rem;
    border: 1px dashed #efe1f7;
    border-radius: 5px;
    background: #fbf6ff;
}

.applied-discount-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.applied-discount-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: #411459;
}

.applied-discount-type {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.08rem;
    color: #7a6a8a;
}

.applied-discount-date {
    font-size: 0.625rem;
    color: #9988a8;
}

.applied-discount-amount {
    font-size: 0.8125rem;
    font-weight: 800;
    color: #b91c1c;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.applied-discount-row.applied-discount-inline {
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 0.75rem;
}

.applied-discount-row.applied-discount-inline .applied-discount-amount {
    margin-right: 0.5rem;
}

/* Order summary right-aligned */
.invoice-summary-row {
    display: grid;
    grid-template-columns: 1fr minmax(260px, 320px);
    gap: 0.75rem;
    align-items: start;
}

.invoice-summary-card {
    border: 1px solid #e6e0ee;
    border-radius: 6px;
    overflow: hidden;
    background: #ffffff;
}

.invoice-summary-header {
    background: linear-gradient(135deg, #411459 0%, #2a0d3d 100%);
    color: #ffffff;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.18rem;
    padding: 0.4rem 0.75rem;
    text-align: center;
}

.invoice-summary-body {
    padding: 0.375rem 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
}

.summary-row {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 0.75rem;
    padding: 0.3rem 0;
    font-size: 0.75rem;
    color: #2a1a3a;
    border-bottom: 1px dashed #efe7f7;
}

.summary-row > span:first-child { text-align: left; flex: 1 1 auto; }
.summary-row > span:last-child {
    text-align: right;
    flex: 0 0 auto;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.summary-row:last-child { border-bottom: none; }

.summary-row.total {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #411459;
    background: #faf6fe;
    margin: 0.25rem -0.75rem 0;
    padding: 0.45rem 0.75rem;
    border-top: 1px solid #e6d9f0;
    border-bottom: none;
    width: calc(100% + 1.5rem);
    box-sizing: border-box;
}

.summary-row.total > span:last-child,
.summary-row.total-due > span:last-child {
    text-align: right;
    flex: 0 0 auto;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.summary-row.total-due {
    background: linear-gradient(135deg, #411459 0%, #2a0d3d 100%);
    color: #ffca05;
    font-size: 0.875rem;
    font-weight: 800;
    letter-spacing: 0.08rem;
    margin: 0.3rem -0.75rem -0.5rem;
    padding: 0.55rem 0.75rem;
    border-bottom: none;
    width: calc(100% + 1.5rem);
    box-sizing: border-box;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .invoice-document { padding: 0.75rem; }
    .invoice-parties { grid-template-columns: 1fr; }
    .invoice-summary-row { grid-template-columns: 1fr; }
    .invoice-brand-name { font-size: 1.375rem; letter-spacing: 0.35rem; }
    .invoice-divider-line { flex: 0 0 40px; }
    .invoice-items-table { font-size: 0.75rem; }
    .invoice-items-table thead th,
    .invoice-items-table tbody td { padding: 0.5rem 0.4rem; }
    .invoice-product-thumb { width: 28px; height: 28px; flex: 0 0 28px; }
    .order-details-strip { flex-wrap: wrap; }
}
