/* An invoice's page (Components/Pages/Billing/InvoiceView.razor), outside the app shell: a slim top bar, the invoice
   number with its actions, the payment panel of an unpaid invoice, the invoice as a sheet of paper (always light, in
   the same layout as the emailed copy and the PDF) and its payments. Printing shows the paper alone. */

/* ========
     page
   ======== */

.ivw {
    min-height: 100vh;
    min-height: 100dvh;
    background:
        radial-gradient(48% 40% at 100% 0%, rgba(118, 61, 232, 0.07), transparent 70%),
        radial-gradient(40% 36% at 0% 100%, rgba(255, 183, 165, 0.1), transparent 70%),
        var(--app-bg-soft);
}

[data-theme="dark"] .ivw {
    background:
        radial-gradient(48% 40% at 100% 0%, rgba(156, 116, 255, 0.1), transparent 70%),
        var(--app-bg);
}

.ivw-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 920px;
    margin: 0 auto;
    padding: 22px 24px 0;
}

.ivw-logo {
    display: inline-flex;
    border-radius: 10px;
}

.ivw-logo img {
    width: auto;
    height: 34px;
}

.ivw-logo-dark,
[data-theme="dark"] .ivw-logo-light {
    display: none;
}

[data-theme="dark"] .ivw-logo-dark {
    display: block;
}

.ivw-top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ivw-main {
    max-width: 920px;
    margin: 0 auto;
    padding: 24px 24px 56px;
}

.ivw-skel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ---------- number, status and actions ---------- */

.ivw-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    margin-bottom: 18px;
}

.ivw-bar-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    min-width: 0;
}

.ivw-title {
    margin: 0;
    font-size: clamp(22px, 2.4vw, 28px);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--app-text-strong);
    overflow-wrap: anywhere;
}

.ivw-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ivw-icon-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
}

.ivw-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 18px;
    padding: 12px 16px;
    border-radius: 14px;
    background: var(--app-warning-soft);
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--app-text);
}

.ivw-notice .bx {
    flex: none;
    margin-top: 1px;
    font-size: 18px;
    color: var(--app-warning);
}

/* ---------- payment panel ---------- */

.ivw-pay {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px 20px;
    margin-bottom: 20px;
    padding: 20px 22px;
    border: 1px solid color-mix(in srgb, var(--app-accent) 30%, var(--app-line));
    border-radius: 22px;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-soft);
}

.ivw-pay-amount {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ivw-pay-label,
.ivw-pay-due {
    font-size: 13px;
    color: var(--app-text-muted);
}

.ivw-pay-amount strong {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--app-text-strong);
    overflow-wrap: anywhere;
}

.ivw-pay-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.ivw-secure {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 12.5px;
    color: var(--app-text-muted);
}

.ivw-secure .bx {
    font-size: 16px;
    color: var(--app-success);
}

/* ========
     page
   ======== */


/* =========
     paper
   ========= */

/* The invoice always reads as a light sheet of paper, in dark mode too (app-keep-light) */
.ivw-paper {
    padding: 36px 40px;
    border: 1px solid var(--app-line);
    border-radius: 20px;
    background: #FFFFFF;
    box-shadow: var(--app-shadow-card);
    color: var(--app-text);
}

.ivw-paper-skel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ivw-paper-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.ivw-paper-logo {
    width: 150px;
    height: auto;
}

.ivw-company {
    margin: 0;
    font-size: 11.5px;
    line-height: 1.6;
    text-align: right;
    color: var(--app-text-muted);
}

.ivw-company strong {
    color: var(--app-text-strong);
}

.ivw-paper-bar {
    height: 4px;
    margin: 20px 0 22px;
    border-radius: 4px;
    background: var(--app-gradient-brand);
}

.ivw-doc-title {
    margin: 0 0 18px;
    font-size: 22px;
    font-weight: 700;
    color: var(--app-text-strong);
}

.ivw-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px 32px;
    margin-bottom: 26px;
}

.ivw-meta-label {
    margin: 0 0 6px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--app-text-muted);
}

.ivw-billed-name {
    margin: 0 0 2px;
    font-size: 15px;
    font-weight: 600;
    color: var(--app-text-strong);
}

.ivw-billed-line {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.ivw-facts {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
}

.ivw-facts > div,
.ivw-totals > div,
.ivw-bank-rows > div {
    display: flex;
    justify-content: space-between;
    gap: 24px;
}

.ivw-facts dt {
    font-size: 13px;
    font-weight: 400;
    color: var(--app-text-muted);
}

.ivw-facts dd {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    color: var(--app-text-strong);
}

/* ---------- lines ---------- */

.ivw-lines {
    border-top: 1px solid var(--app-line);
}

.ivw-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    padding: 14px 0;
    border-bottom: 1px solid var(--app-line);
}

.ivw-line-head {
    padding: 10px 0;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--app-text-muted);
}

.ivw-line-text {
    display: block;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--app-text-strong);
}

.ivw-line-meta {
    display: block;
    margin-top: 2px;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--app-text-muted);
    white-space: pre-line;
}

.ivw-num {
    font-size: 14px;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
    color: var(--app-text-strong);
}

.ivw-line-head .ivw-num {
    font-size: 11.5px;
    color: var(--app-text-muted);
}

.ivw-totals {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
    margin: 18px 0 0 auto;
}

.ivw-totals dt {
    font-size: 13px;
    font-weight: 500;
    color: var(--app-text-muted);
}

.ivw-totals dd {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--app-text-strong);
}

.ivw-total {
    padding-top: 10px;
    border-top: 1px solid var(--app-line);
}

.ivw-total dt,
.ivw-total dd {
    font-size: 17px;
    font-weight: 700;
    color: var(--app-text-strong);
}

/* ---------- bank transfer ---------- */

.ivw-bank {
    margin-top: 28px;
    padding: 18px 20px;
    border-radius: 14px;
    background: var(--app-bg-soft);
}

.ivw-bank-title {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--app-text-strong);
}

.ivw-bank-note {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.6;
}

.ivw-bank-rows {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 420px;
    margin: 0;
}

.ivw-bank-rows dt {
    font-size: 13px;
    font-weight: 400;
    color: var(--app-text-muted);
}

.ivw-bank-rows dd {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    color: var(--app-text-strong);
}

/* =========
     paper
   ========= */


/* ============
     payments
   ============ */

.ivw-payments {
    margin-top: 24px;
}

.ivw-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    font-size: 17px;
    font-weight: 600;
    color: var(--app-text-strong);
}

.ivw-section-title .bx {
    font-size: 20px;
    color: var(--app-accent);
}

.ivw-payment-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ivw-payment {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px 16px;
    margin: 0;
    padding: 14px 18px;
    border: 1px solid var(--app-line);
    border-radius: 16px;
    background: var(--app-surface);
}

.ivw-payment dt {
    font-size: 12px;
    font-weight: 500;
    color: var(--app-text-muted);
}

.ivw-payment dd {
    margin: 2px 0 0;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--app-text-strong);
}

.ivw-break {
    overflow-wrap: anywhere;
}

/* ============
     payments
   ============ */


/* ==============
     responsive
   ============== */

@media (max-width: 767.98px) {
    .ivw-top {
        padding: 16px 16px 0;
    }

    .ivw-main {
        padding: 18px 16px 40px;
    }

    .ivw-pay {
        grid-template-columns: minmax(0, 1fr);
        padding: 18px 16px;
    }

    .ivw-pay-actions {
        justify-content: stretch;
    }

    .ivw-pay-actions .app-btn {
        flex: 1 1 auto;
    }

    .ivw-paper {
        padding: 22px 18px;
        border-radius: 16px;
    }

    .ivw-paper-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .ivw-company {
        text-align: left;
    }

    .ivw-meta {
        grid-template-columns: minmax(0, 1fr);
    }

    .ivw-totals {
        max-width: none;
    }

    .ivw-payment {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Printing shows the invoice alone, as on paper */
@media print {
    .ivw-top,
    .app-back,
    .ivw-bar-actions,
    .ivw-pay,
    .ivw-notice {
        display: none !important;
    }

    .ivw,
    [data-theme="dark"] .ivw {
        background: #FFFFFF;
    }

    .ivw-main {
        max-width: none;
        padding: 0;
    }

    .ivw-title {
        color: #29075C;
    }

    .ivw-paper {
        padding: 0;
        border: 0;
        box-shadow: none;
    }

    .ivw-payment {
        border-color: #E7DFF0;
        background: #FFFFFF;
    }

    .app-enter {
        animation: none !important;
        opacity: 1 !important;
    }
}

/* ==============
     responsive
   ============== */
