/* =========================================================
   PREMIUM QR CODES — INVOICE MAKER PHASE 2A
   ========================================================= */

.invoice-maker-page {
    background:
        #f6f8fc;
    color:
        #172033;
}


.invoice-shell {
    width:
        min(1500px, calc(100% - 32px));
    margin:
        0 auto;
}


.invoice-hero {
    padding:
        50px 0 42px;
    border-bottom:
        1px solid #e7edf5;
    background:
        linear-gradient(
            145deg,
            #ffffff 0%,
            #f3f7ff 58%,
            #eef5ff 100%
        );
}


.invoice-breadcrumb {
    display:
        flex;
    align-items:
        center;
    flex-wrap:
        wrap;
    gap:
        8px;
    margin-bottom:
        22px;
    color:
        #64748b;
    font-size:
        13px;
    font-weight:
        700;
}


.invoice-breadcrumb a {
    color:
        #2563eb;
    text-decoration:
        none;
}


.invoice-hero-grid {
    display:
        grid;
    grid-template-columns:
        minmax(0, 1.4fr)
        minmax(310px, .6fr);
    gap:
        38px;
    align-items:
        center;
}


.invoice-hero-badge {
    width:
        fit-content;
    display:
        inline-flex;
    align-items:
        center;
    gap:
        8px;
    margin-bottom:
        16px;
    padding:
        8px 12px;
    border:
        1px solid #bfdbfe;
    border-radius:
        999px;
    color:
        #1d4ed8;
    background:
        #eff6ff;
    font-size:
        13px;
    font-weight:
        800;
}


.invoice-hero h1 {
    max-width:
        780px;
    margin:
        0;
    color:
        #0f172a;
    font-size:
        clamp(38px, 6vw, 64px);
    line-height:
        1.02;
    letter-spacing:
        -.045em;
}


.invoice-hero-lead {
    max-width:
        760px;
    margin:
        20px 0 0;
    color:
        #536176;
    font-size:
        18px;
    line-height:
        1.75;
}


.invoice-hero-actions {
    display:
        flex;
    flex-wrap:
        wrap;
    gap:
        12px;
    margin-top:
        28px;
}


.invoice-primary-action,
.invoice-secondary-action {
    min-height:
        46px;
    display:
        inline-flex;
    align-items:
        center;
    justify-content:
        center;
    gap:
        9px;
    padding:
        0 18px;
    border-radius:
        13px;
    font-weight:
        800;
    text-decoration:
        none;
}


.invoice-primary-action {
    color:
        #ffffff;
    background:
        #2563eb;
}


.invoice-secondary-action {
    border:
        1px solid #d8e0eb;
    color:
        #263247;
    background:
        #ffffff;
}


.invoice-hero-card {
    display:
        grid;
    gap:
        14px;
    padding:
        25px;
    border:
        1px solid #dfe7f1;
    border-radius:
        22px;
    background:
        rgba(255,255,255,.92);
    box-shadow:
        0 20px 55px
        rgba(23,43,77,.08);
}


.invoice-hero-card strong {
    margin-bottom:
        2px;
    font-size:
        18px;
}


.invoice-hero-card div {
    display:
        flex;
    align-items:
        center;
    gap:
        10px;
    color:
        #536176;
    font-size:
        14px;
    font-weight:
        700;
}


.invoice-hero-card i {
    width:
        22px;
    color:
        #2563eb;
}


.invoice-main {
    padding:
        34px 0 80px;
}


.invoice-privacy-note {
    display:
        flex;
    gap:
        14px;
    align-items:
        flex-start;
    margin-bottom:
        24px;
    padding:
        16px 18px;
    border:
        1px solid #bfdbfe;
    border-radius:
        15px;
    background:
        #eff6ff;
}


.invoice-privacy-note > i {
    margin-top:
        3px;
    color:
        #2563eb;
}


.invoice-privacy-note div {
    display:
        grid;
    gap:
        4px;
}


.invoice-privacy-note span {
    color:
        #536176;
    font-size:
        13px;
    line-height:
        1.6;
}


.invoice-workspace {
    display:
        grid;
    grid-template-columns:
        minmax(0, 1.08fr)
        minmax(500px, .92fr);
    gap:
        24px;
    align-items:
        start;
}


.invoice-editor {
    display:
        grid;
    gap:
        18px;
}


.invoice-editor-section,
.invoice-preview-column,
.invoice-phase-summary > div {
    border:
        1px solid #dfe6ef;
    border-radius:
        20px;
    background:
        #ffffff;
    box-shadow:
        0 12px 34px
        rgba(15,23,42,.055);
}


.invoice-editor-section {
    padding:
        22px;
}


.invoice-section-heading {
    display:
        flex;
    align-items:
        flex-start;
    justify-content:
        space-between;
    gap:
        18px;
    margin-bottom:
        18px;
}


.invoice-section-heading h2 {
    margin:
        0;
    color:
        #172033;
    font-size:
        19px;
    font-weight:
        850;
}


.invoice-section-heading p {
    margin:
        5px 0 0;
    color:
        #718096;
    font-size:
        13px;
}


.invoice-form-grid {
    display:
        grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap:
        15px;
}


.invoice-field {
    display:
        grid;
    gap:
        7px;
}


.invoice-field-full {
    grid-column:
        1 / -1;
}


.invoice-field label {
    color:
        #334155;
    font-size:
        13px;
    font-weight:
        800;
}


.invoice-field input,
.invoice-field select,
.invoice-field textarea,
.invoice-item-field input,
.invoice-item-field select {
    width:
        100%;
    min-height:
        43px;
    padding:
        10px 12px;
    border:
        1px solid #d8e0ea;
    border-radius:
        11px;
    outline:
        none;
    color:
        #172033;
    background:
        #ffffff;
    font:
        inherit;
    font-size:
        14px;
}


.invoice-field textarea {
    min-height:
        84px;
    resize:
        vertical;
}


.invoice-field input:focus,
.invoice-field select:focus,
.invoice-field textarea:focus,
.invoice-item-field input:focus,
.invoice-item-field select:focus {
    border-color:
        #2563eb;
    box-shadow:
        0 0 0 3px
        rgba(37,99,235,.10);
}


.invoice-logo-row {
    display:
        flex;
    gap:
        16px;
    align-items:
        center;
    margin-bottom:
        18px;
}


.invoice-logo-preview {
    width:
        76px;
    height:
        76px;
    flex:
        0 0 auto;
    display:
        flex;
    align-items:
        center;
    justify-content:
        center;
    overflow:
        hidden;
    border:
        1px dashed #cbd5e1;
    border-radius:
        16px;
    color:
        #94a3b8;
    background:
        #f8fafc;
    font-size:
        26px;
}


.invoice-logo-preview img {
    width:
        100%;
    height:
        100%;
    object-fit:
        contain;
}


.invoice-logo-row > div:last-child {
    display:
        flex;
    flex-wrap:
        wrap;
    align-items:
        center;
    gap:
        8px;
}


.invoice-logo-row small {
    flex-basis:
        100%;
    color:
        #718096;
}


.invoice-file-button,
.invoice-inline-button,
.invoice-add-item {
    min-height:
        38px;
    display:
        inline-flex;
    align-items:
        center;
    justify-content:
        center;
    gap:
        7px;
    padding:
        0 12px;
    border:
        1px solid #d8e0ea;
    border-radius:
        10px;
    color:
        #334155;
    background:
        #ffffff;
    font-size:
        12px;
    font-weight:
        800;
    cursor:
        pointer;
}


.invoice-add-item {
    border-color:
        #2563eb;
    color:
        #ffffff;
    background:
        #2563eb;
}


.invoice-items {
    display:
        grid;
    gap:
        13px;
}


.invoice-item-card {
    padding:
        16px;
    border:
        1px solid #e1e7ef;
    border-radius:
        15px;
    background:
        #fbfcfe;
}


.invoice-item-top {
    display:
        flex;
    align-items:
        center;
    justify-content:
        space-between;
    gap:
        12px;
    margin-bottom:
        13px;
}


.invoice-item-number {
    color:
        #64748b;
    font-size:
        12px;
    font-weight:
        800;
    text-transform:
        uppercase;
    letter-spacing:
        .04em;
}


.invoice-item-remove {
    border:
        0;
    color:
        #dc2626;
    background:
        transparent;
    font-weight:
        800;
    cursor:
        pointer;
}


.invoice-item-grid {
    display:
        grid;
    grid-template-columns:
        minmax(150px, 2fr)
        repeat(3, minmax(90px, 1fr));
    gap:
        10px;
}


.invoice-item-field {
    display:
        grid;
    gap:
        5px;
}


.invoice-item-field label {
    color:
        #64748b;
    font-size:
        11px;
    font-weight:
        800;
}


.invoice-item-grid-secondary {
    display:
        grid;
    grid-template-columns:
        repeat(5, minmax(0,1fr));
    gap:
        10px;
    margin-top:
        10px;
}


.invoice-item-line-result {
    margin-top:
        10px;
    padding-top:
        10px;
    border-top:
        1px solid #e4e9f0;
    color:
        #475569;
    font-size:
        12px;
    font-weight:
        700;
    text-align:
        right;
}


.invoice-template-grid {
    display:
        grid;
    grid-template-columns:
        repeat(3, minmax(0,1fr));
    gap:
        12px;
}


.invoice-template-card {
    display:
        grid;
    gap:
        7px;
    padding:
        13px;
    border:
        1px solid #dce3ec;
    border-radius:
        14px;
    color:
        #334155;
    background:
        #ffffff;
    text-align:
        left;
    cursor:
        pointer;
}


.invoice-template-card.active {
    border-color:
        #2563eb;
    box-shadow:
        0 0 0 3px
        rgba(37,99,235,.08);
}


.invoice-template-card strong {
    font-size:
        13px;
}


.invoice-template-card small {
    color:
        #718096;
    line-height:
        1.4;
}


.invoice-template-swatch {
    height:
        44px;
    display:
        block;
    border-radius:
        8px;
}


.invoice-template-swatch.classic {
    background:
        linear-gradient(
            90deg,
            #1e3a8a 0 16%,
            #f1f5f9 16% 100%
        );
}


.invoice-template-swatch.modern {
    background:
        linear-gradient(
            135deg,
            #2563eb,
            #7c3aed
        );
}


.invoice-template-swatch.minimal {
    border:
        1px solid #e2e8f0;
    background:
        #ffffff;
}


.invoice-template-roadmap {
    margin:
        12px 0 0;
    color:
        #64748b;
    font-size:
        12px;
}


.invoice-editor-actions {
    display:
        flex;
    flex-wrap:
        wrap;
    gap:
        10px;
}


.invoice-action-primary,
.invoice-action-secondary {
    min-height:
        44px;
    display:
        inline-flex;
    align-items:
        center;
    justify-content:
        center;
    gap:
        8px;
    padding:
        0 16px;
    border-radius:
        11px;
    font-weight:
        800;
    cursor:
        pointer;
}


.invoice-action-primary {
    border:
        1px solid #2563eb;
    color:
        #ffffff;
    background:
        #2563eb;
}


.invoice-action-secondary {
    border:
        1px solid #d8e0ea;
    color:
        #334155;
    background:
        #ffffff;
}


.invoice-status {
    min-height:
        22px;
    color:
        #64748b;
    font-size:
        13px;
    font-weight:
        700;
}


.invoice-status[data-type="success"] {
    color:
        #15803d;
}


.invoice-status[data-type="error"] {
    color:
        #dc2626;
}


.invoice-preview-column {
    position:
        sticky;
    top:
        18px;
    overflow:
        hidden;
}


.invoice-preview-toolbar {
    min-height:
        58px;
    display:
        flex;
    align-items:
        center;
    justify-content:
        space-between;
    gap:
        14px;
    padding:
        0 18px;
    border-bottom:
        1px solid #e3e8ef;
}


.invoice-preview-toolbar > div {
    display:
        flex;
    align-items:
        center;
    gap:
        9px;
}


.invoice-preview-toolbar span {
    color:
        #64748b;
    font-size:
        12px;
}


.invoice-preview-badge {
    padding:
        5px 9px;
    border-radius:
        999px;
    color:
        #1d4ed8 !important;
    background:
        #eff6ff;
    font-weight:
        800;
}


.invoice-paper-stage {
    overflow:
        auto;
    padding:
        24px;
    background:
        #eef2f7;
}


.invoice-paper {
    width:
        100%;
    min-height:
        790px;
    margin:
        0 auto;
    padding:
        36px;
    background:
        #ffffff;
    box-shadow:
        0 10px 30px
        rgba(15,23,42,.08);
    font-family:
        Inter,
        system-ui,
        sans-serif;
}


.invoice-document-header {
    display:
        flex;
    align-items:
        flex-start;
    justify-content:
        space-between;
    gap:
        24px;
    padding-bottom:
        26px;
    border-bottom:
        2px solid #172033;
}


.invoice-document-brand {
    display:
        flex;
    gap:
        13px;
    align-items:
        center;
}


.invoice-document-logo {
    width:
        62px;
    height:
        62px;
    display:
        flex;
    align-items:
        center;
    justify-content:
        center;
    overflow:
        hidden;
    border-radius:
        12px;
    color:
        #ffffff;
    background:
        #2563eb;
    font-size:
        23px;
}


.invoice-document-logo img {
    width:
        100%;
    height:
        100%;
    object-fit:
        contain;
    background:
        #ffffff;
}


.invoice-document-company {
    max-width:
        300px;
    color:
        #0f172a;
    font-size:
        18px;
    font-weight:
        900;
}


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


.invoice-document-title h2 {
    margin:
        0 0 6px;
    color:
        #0f172a;
    font-size:
        30px;
    letter-spacing:
        .08em;
}


.invoice-document-title strong {
    color:
        #64748b;
    font-size:
        13px;
}


.invoice-document-muted {
    margin-top:
        4px;
    color:
        #64748b;
    font-size:
        11px;
    line-height:
        1.55;
    white-space:
        pre-line;
}


.invoice-document-meta {
    display:
        grid;
    grid-template-columns:
        1fr auto;
    gap:
        28px;
    padding:
        25px 0;
}


.invoice-document-label {
    display:
        block;
    margin-bottom:
        7px;
    color:
        #64748b;
    font-size:
        10px;
    font-weight:
        900;
    letter-spacing:
        .09em;
}


.invoice-document-meta strong {
    display:
        block;
    font-size:
        14px;
}


.invoice-document-dates {
    min-width:
        175px;
    display:
        grid;
    gap:
        9px;
}


.invoice-document-dates div {
    display:
        flex;
    justify-content:
        space-between;
    gap:
        20px;
    font-size:
        11px;
}


.invoice-document-dates span {
    color:
        #64748b;
}


.invoice-document-table-wrap {
    overflow:
        hidden;
    border:
        1px solid #e2e8f0;
    border-radius:
        10px;
}


.invoice-document-table {
    width:
        100%;
    border-collapse:
        collapse;
    font-size:
        11px;
}


.invoice-document-table th {
    padding:
        10px;
    color:
        #ffffff;
    background:
        #172033;
    font-size:
        10px;
    text-transform:
        uppercase;
    letter-spacing:
        .04em;
}


.invoice-document-table td {
    padding:
        11px 10px;
    border-bottom:
        1px solid #edf1f5;
    color:
        #334155;
}


.invoice-document-table tbody tr:last-child td {
    border-bottom:
        0;
}


.invoice-document-table .num {
    text-align:
        right;
    white-space:
        nowrap;
}


.invoice-document-summary {
    display:
        grid;
    grid-template-columns:
        minmax(0,1fr)
        minmax(220px,.65fr);
    gap:
        30px;
    margin-top:
        25px;
}


.invoice-document-notes {
    display:
        grid;
    align-content:
        start;
    gap:
        18px;
}


.invoice-document-notes p {
    margin:
        0;
    color:
        #64748b;
    font-size:
        11px;
    line-height:
        1.65;
    white-space:
        pre-wrap;
}


.invoice-document-totals {
    display:
        grid;
    gap:
        7px;
}


.invoice-document-totals > div {
    display:
        flex;
    align-items:
        center;
    justify-content:
        space-between;
    gap:
        16px;
    color:
        #475569;
    font-size:
        11px;
}


.invoice-total-row {
    margin-top:
        5px;
    padding-top:
        10px;
    border-top:
        1px solid #cbd5e1;
    color:
        #0f172a !important;
    font-size:
        14px !important;
}


.invoice-balance-row {
    margin-top:
        5px;
    padding:
        11px 12px;
    border-radius:
        8px;
    color:
        #ffffff !important;
    background:
        #2563eb;
    font-size:
        13px !important;
}


.invoice-document-footer {
    margin-top:
        42px;
    padding-top:
        16px;
    border-top:
        1px solid #e2e8f0;
    color:
        #94a3b8;
    font-size:
        9px;
    text-align:
        center;
}


/* MODERN */

.invoice-paper.template-modern {
    border-top:
        8px solid #2563eb;
}


.template-modern
.invoice-document-header {
    border-bottom:
        0;
}


.template-modern
.invoice-document-title h2 {
    color:
        #2563eb;
}


.template-modern
.invoice-document-table th {
    background:
        #2563eb;
}


/* MINIMAL */

.invoice-paper.template-minimal {
    box-shadow:
        none;
}


.template-minimal
.invoice-document-logo {
    border:
        1px solid #e2e8f0;
    color:
        #334155;
    background:
        #ffffff;
}


.template-minimal
.invoice-document-header {
    border-bottom:
        1px solid #cbd5e1;
}


.template-minimal
.invoice-document-table-wrap {
    border:
        0;
    border-radius:
        0;
}


.template-minimal
.invoice-document-table th {
    border-top:
        1px solid #cbd5e1;
    border-bottom:
        1px solid #cbd5e1;
    color:
        #475569;
    background:
        #ffffff;
}


.template-minimal
.invoice-balance-row {
    border:
        1px solid #cbd5e1;
    color:
        #0f172a !important;
    background:
        #ffffff;
}


.invoice-coming-next {
    display:
        grid;
    gap:
        5px;
    padding:
        17px;
    border-top:
        1px solid #e3e8ef;
    color:
        #64748b;
    font-size:
        12px;
}


.invoice-coming-next strong {
    color:
        #334155;
}


.invoice-phase-summary {
    display:
        grid;
    grid-template-columns:
        repeat(3, minmax(0,1fr));
    gap:
        18px;
    margin-top:
        28px;
}


.invoice-phase-summary > div {
    padding:
        22px;
}


.invoice-phase-summary i {
    color:
        #2563eb;
    font-size:
        23px;
}


.invoice-phase-summary h2 {
    margin:
        14px 0 8px;
    font-size:
        17px;
}


.invoice-phase-summary p {
    margin:
        0;
    color:
        #64748b;
    font-size:
        13px;
    line-height:
        1.65;
}


@media (
    max-width: 1180px
) {

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

    .invoice-preview-column {
        position:
            relative;
        top:
            auto;
    }

    .invoice-paper {
        max-width:
            760px;
    }
}


@media (
    max-width: 850px
) {

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

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

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


@media (
    max-width: 680px
) {

    .invoice-shell {
        width:
            min(
                100% - 20px,
                1500px
            );
    }

    .invoice-hero {
        padding:
            34px 0 30px;
    }

    .invoice-hero h1 {
        font-size:
            38px;
    }

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

    .invoice-field-full {
        grid-column:
            auto;
    }

    .invoice-item-grid,
    .invoice-item-grid-secondary {
        grid-template-columns:
            1fr 1fr;
    }

    .invoice-item-grid
    .invoice-item-description {
        grid-column:
            1 / -1;
    }

    .invoice-paper-stage {
        padding:
            10px;
    }

    .invoice-paper {
        min-width:
            620px;
        min-height:
            760px;
        padding:
            28px;
    }
}


/* =========================================================
   PHASE 2B — PROFESSIONAL TEMPLATE VISUAL SYSTEM V1

   PRESENTATION ONLY.
   No monetary, tax, currency or invoice calculation logic.
   ========================================================= */


/* ---------------------------------------------------------
   CORPORATE
   Structured navy business document
   --------------------------------------------------------- */

.invoice-paper.template-corporate {
    border-top: 6px solid #17365d;
}

.template-corporate .invoice-document-header {
    padding-bottom: 22px;
    border-bottom: 3px solid #17365d;
}

.template-corporate .invoice-document-logo {
    border-radius: 4px;
    background: #17365d;
}

.template-corporate .invoice-document-title h2 {
    color: #17365d;
    font-size: 28px;
    letter-spacing: .12em;
}

.template-corporate .invoice-document-label {
    color: #17365d;
}

.template-corporate .invoice-document-meta {
    margin: 20px 0 24px;
    padding: 18px 20px;
    border: 1px solid #d7e0ea;
    background: #f7f9fc;
}

.template-corporate .invoice-document-table-wrap {
    border-radius: 3px;
    border-color: #cbd5e1;
}

.template-corporate .invoice-document-table th {
    background: #17365d;
}

.template-corporate .invoice-document-table td {
    border-color: #dce3eb;
}

.template-corporate .invoice-document-totals {
    border: 1px solid #cbd5e1;
    padding: 14px;
    background: #f8fafc;
}

.template-corporate .invoice-total-row {
    border-top-color: #17365d;
}

.template-corporate .invoice-balance-row {
    background: #17365d;
}


/* ---------------------------------------------------------
   EXECUTIVE
   High-end charcoal professional services
   --------------------------------------------------------- */

.invoice-paper.template-executive {
    padding-top: 0;
}

.template-executive .invoice-document-header {
    margin:
        0 -36px 28px;
    padding:
        30px 36px 28px;
    border-bottom: 0;
    color: #ffffff;
    background: #1f2937;
}

.template-executive .invoice-document-company,
.template-executive .invoice-document-title h2 {
    color: #ffffff;
}

.template-executive .invoice-document-muted,
.template-executive .invoice-document-title strong {
    color: #cbd5e1;
}

.template-executive .invoice-document-logo {
    border: 1px solid #64748b;
    background: #334155;
}

.template-executive .invoice-document-title h2 {
    font-size: 27px;
    font-weight: 600;
    letter-spacing: .16em;
}

.template-executive .invoice-document-meta {
    padding-top: 4px;
}

.template-executive .invoice-document-label {
    color: #475569;
    letter-spacing: .14em;
}

.template-executive .invoice-document-table-wrap {
    border: 0;
    border-radius: 0;
}

.template-executive .invoice-document-table th {
    border-top: 1px solid #334155;
    border-bottom: 1px solid #334155;
    color: #334155;
    background: #ffffff;
}

.template-executive .invoice-document-table td {
    padding-top: 13px;
    padding-bottom: 13px;
}

.template-executive .invoice-total-row {
    border-top: 2px solid #1f2937;
}

.template-executive .invoice-balance-row {
    background: #1f2937;
}


/* ---------------------------------------------------------
   ELEGANT
   Refined typography and soft rules
   --------------------------------------------------------- */

.invoice-paper.template-elegant {
    padding: 42px;
}

.template-elegant .invoice-document-header {
    align-items: center;
    padding-bottom: 30px;
    border-bottom: 1px solid #94a3b8;
}

.template-elegant .invoice-document-logo {
    width: 58px;
    height: 58px;
    border: 1px solid #d6d3d1;
    border-radius: 50%;
    color: #57534e;
    background: #fafaf9;
}

.template-elegant .invoice-document-company {
    color: #292524;
    font-size: 20px;
    font-weight: 600;
}

.template-elegant .invoice-document-title h2 {
    color: #44403c;
    font-size: 25px;
    font-weight: 500;
    letter-spacing: .18em;
}

.template-elegant .invoice-document-meta {
    padding: 30px 0;
}

.template-elegant .invoice-document-label {
    color: #78716c;
    font-weight: 600;
    letter-spacing: .14em;
}

.template-elegant .invoice-document-table-wrap {
    border: 0;
    border-radius: 0;
}

.template-elegant .invoice-document-table th {
    border-top: 1px solid #d6d3d1;
    border-bottom: 1px solid #d6d3d1;
    color: #57534e;
    background: #fafaf9;
    font-weight: 600;
}

.template-elegant .invoice-document-table td {
    padding-top: 14px;
    padding-bottom: 14px;
    border-bottom-color: #e7e5e4;
}

.template-elegant .invoice-total-row {
    border-top-color: #78716c;
}

.template-elegant .invoice-balance-row {
    color: #292524 !important;
    background: #f5f5f4;
}


/* ---------------------------------------------------------
   BOLD
   Strong hierarchy / high-impact invoice
   --------------------------------------------------------- */

.invoice-paper.template-bold {
    border-left: 9px solid #1d4ed8;
}

.template-bold .invoice-document-header {
    border-bottom: 0;
}

.template-bold .invoice-document-logo {
    border-radius: 2px;
    background: #1d4ed8;
}

.template-bold .invoice-document-company {
    font-size: 21px;
}

.template-bold .invoice-document-title h2 {
    color: #1d4ed8;
    font-size: 34px;
    font-weight: 900;
    letter-spacing: .03em;
}

.template-bold .invoice-document-meta {
    padding: 20px;
    border-left: 5px solid #1d4ed8;
    background: #eff6ff;
}

.template-bold .invoice-document-label {
    color: #1d4ed8;
}

.template-bold .invoice-document-table-wrap {
    border: 0;
    border-radius: 0;
}

.template-bold .invoice-document-table th {
    background: #1d4ed8;
    font-weight: 900;
}

.template-bold .invoice-document-table td {
    padding-top: 13px;
    padding-bottom: 13px;
}

.template-bold .invoice-total-row {
    font-size: 14px;
    border-top: 3px solid #1d4ed8;
}

.template-bold .invoice-balance-row {
    padding: 13px;
    background: #1d4ed8;
    font-size: 14px;
}


/* ---------------------------------------------------------
   COMPACT
   Dense layout for invoices with many items
   --------------------------------------------------------- */

.invoice-paper.template-compact {
    min-height: 0;
    padding: 26px 30px;
}

.template-compact .invoice-document-header {
    gap: 16px;
    padding-bottom: 15px;
    border-bottom: 1px solid #475569;
}

.template-compact .invoice-document-logo {
    width: 46px;
    height: 46px;
    border-radius: 5px;
    font-size: 18px;
}

.template-compact .invoice-document-company {
    font-size: 15px;
}

.template-compact .invoice-document-title h2 {
    margin-bottom: 2px;
    font-size: 22px;
}

.template-compact .invoice-document-muted {
    font-size: 9px;
    line-height: 1.35;
}

.template-compact .invoice-document-meta {
    gap: 18px;
    padding: 14px 0;
}

.template-compact .invoice-document-label {
    margin-bottom: 4px;
    font-size: 8px;
}

.template-compact .invoice-document-meta strong {
    font-size: 12px;
}

.template-compact .invoice-document-dates {
    min-width: 155px;
    gap: 5px;
}

.template-compact .invoice-document-dates div {
    font-size: 9px;
}

.template-compact .invoice-document-table-wrap {
    border-radius: 3px;
}

.template-compact .invoice-document-table {
    font-size: 9px;
}

.template-compact .invoice-document-table th {
    padding: 6px 7px;
    font-size: 8px;
}

.template-compact .invoice-document-table td {
    padding: 7px;
}

.template-compact .invoice-document-summary {
    margin-top: 17px;
    gap: 18px;
}

.template-compact .invoice-document-totals > div {
    padding-top: 4px;
    padding-bottom: 4px;
    font-size: 10px;
}

.template-compact .invoice-document-footer {
    margin-top: 24px;
}


/* ---------------------------------------------------------
   PROFESSIONAL
   Balanced universal business invoice
   --------------------------------------------------------- */

.invoice-paper.template-professional {
    border-top: 4px solid #334e68;
}

.template-professional .invoice-document-header {
    border-bottom: 1px solid #bcccdc;
}

.template-professional .invoice-document-logo {
    border-radius: 8px;
    background: #334e68;
}

.template-professional .invoice-document-title h2 {
    color: #243b53;
    font-size: 29px;
}

.template-professional .invoice-document-label {
    color: #486581;
}

.template-professional .invoice-document-table-wrap {
    border-color: #d9e2ec;
    border-radius: 6px;
}

.template-professional .invoice-document-table th {
    color: #243b53;
    background: #eaf0f6;
}

.template-professional .invoice-document-table td {
    border-bottom-color: #e6edf3;
}

.template-professional .invoice-document-totals {
    padding: 16px;
    border-radius: 7px;
    background: #f4f7fa;
}

.template-professional .invoice-total-row {
    border-top-color: #334e68;
}

.template-professional .invoice-balance-row {
    background: #334e68;
}


/* ---------------------------------------------------------
   CREATIVE
   Studio / freelancer asymmetric presentation
   --------------------------------------------------------- */

.invoice-paper.template-creative {
    position: relative;
    overflow: hidden;
}

.invoice-paper.template-creative::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 145px;
    height: 8px;
    background: #7c3aed;
}

.invoice-paper.template-creative::after {
    content: "";
    position: absolute;
    top: 0;
    left: 145px;
    width: 70px;
    height: 8px;
    background: #c4b5fd;
}

.template-creative .invoice-document-header {
    padding-top: 8px;
    border-bottom: 0;
}

.template-creative .invoice-document-logo {
    border-radius: 18px 5px 18px 5px;
    background: #7c3aed;
}

.template-creative .invoice-document-company {
    color: #4c1d95;
}

.template-creative .invoice-document-title h2 {
    color: #7c3aed;
    font-size: 31px;
    letter-spacing: .05em;
}

.template-creative .invoice-document-meta {
    padding: 20px;
    border-radius: 12px;
    background: #f5f3ff;
}

.template-creative .invoice-document-label {
    color: #7c3aed;
}

.template-creative .invoice-document-table-wrap {
    border-color: #ddd6fe;
    border-radius: 12px;
}

.template-creative .invoice-document-table th {
    background: #7c3aed;
}

.template-creative .invoice-document-table tbody tr:nth-child(even) {
    background: #faf5ff;
}

.template-creative .invoice-total-row {
    border-top-color: #7c3aed;
}

.template-creative .invoice-balance-row {
    background: #7c3aed;
}


/* ---------------------------------------------------------
   TECHNICAL
   Precise grid-oriented technical services invoice
   --------------------------------------------------------- */

.invoice-paper.template-technical {
    border: 1px solid #94a3b8;
    box-shadow: none;
}

.template-technical .invoice-document-header {
    padding-bottom: 18px;
    border-bottom: 2px solid #334155;
}

.template-technical .invoice-document-logo {
    border: 1px solid #475569;
    border-radius: 2px;
    color: #334155;
    background: #f8fafc;
}

.template-technical .invoice-document-company {
    font-size: 17px;
    letter-spacing: .02em;
}

.template-technical .invoice-document-title h2 {
    font-size: 25px;
    letter-spacing: .14em;
}

.template-technical .invoice-document-meta {
    gap: 0;
    margin: 18px 0;
    padding: 0;
    border: 1px solid #cbd5e1;
}

.template-technical .invoice-document-meta > div {
    padding: 13px;
}

.template-technical .invoice-document-meta > div + div {
    border-left: 1px solid #cbd5e1;
}

.template-technical .invoice-document-label {
    color: #334155;
}

.template-technical .invoice-document-table-wrap {
    border-color: #94a3b8;
    border-radius: 0;
}

.template-technical .invoice-document-table {
    font-size: 10px;
}

.template-technical .invoice-document-table th {
    border-right: 1px solid #64748b;
    background: #334155;
}

.template-technical .invoice-document-table th:last-child {
    border-right: 0;
}

.template-technical .invoice-document-table td {
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #cbd5e1;
}

.template-technical .invoice-document-table td:last-child {
    border-right: 0;
}

.template-technical .invoice-document-totals {
    border: 1px solid #94a3b8;
    padding: 12px;
}

.template-technical .invoice-total-row {
    border-top: 2px solid #334155;
}

.template-technical .invoice-balance-row {
    border-radius: 0;
    background: #334155;
}


/* ---------------------------------------------------------
   PREMIUM
   High-end dark + warm metallic hierarchy
   --------------------------------------------------------- */

.invoice-paper.template-premium {
    padding-top: 0;
    border-bottom: 5px solid #9a7b35;
}

.template-premium .invoice-document-header {
    margin:
        0 -36px 30px;
    padding:
        32px 36px 30px;
    border-bottom: 4px solid #b5944b;
    background: #111827;
}

.template-premium .invoice-document-company {
    color: #f8fafc;
    font-size: 20px;
}

.template-premium .invoice-document-muted {
    color: #cbd5e1;
}

.template-premium .invoice-document-logo {
    border: 1px solid #b5944b;
    border-radius: 6px;
    color: #f7e7bd;
    background: #1f2937;
}

.template-premium .invoice-document-title h2 {
    color: #e0c57a;
    font-size: 29px;
    font-weight: 700;
    letter-spacing: .16em;
}

.template-premium .invoice-document-title strong {
    color: #e2e8f0;
}

.template-premium .invoice-document-label {
    color: #8a6d2f;
}

.template-premium .invoice-document-meta {
    padding-top: 2px;
}

.template-premium .invoice-document-table-wrap {
    border-color: #d6c69a;
    border-radius: 4px;
}

.template-premium .invoice-document-table th {
    color: #f7e7bd;
    background: #1f2937;
}

.template-premium .invoice-document-table td {
    border-bottom-color: #ebe3cf;
}

.template-premium .invoice-document-totals {
    padding: 16px;
    border: 1px solid #d6c69a;
    background: #fdfbf5;
}

.template-premium .invoice-total-row {
    border-top: 2px solid #9a7b35;
}

.template-premium .invoice-balance-row {
    color: #f7e7bd !important;
    background: #111827;
}

.template-premium .invoice-document-footer {
    border-top-color: #d6c69a;
}


/* ---------------------------------------------------------
   PHASE 2B TEMPLATE PRINT SAFETY
   --------------------------------------------------------- */

@media print {

    .invoice-paper.template-corporate,
    .invoice-paper.template-executive,
    .invoice-paper.template-elegant,
    .invoice-paper.template-bold,
    .invoice-paper.template-compact,
    .invoice-paper.template-professional,
    .invoice-paper.template-creative,
    .invoice-paper.template-technical,
    .invoice-paper.template-premium {
        box-shadow: none;
    }

}


/* ---------------------------------------------------------
   PHASE 2B TEMPLATE MOBILE SAFETY
   --------------------------------------------------------- */

@media (max-width: 620px) {

    .invoice-paper.template-elegant {
        padding: 28px;
    }

    .invoice-paper.template-compact {
        padding: 24px;
    }

    .template-executive .invoice-document-header,
    .template-premium .invoice-document-header {
        margin-left: -24px;
        margin-right: -24px;
        padding-left: 24px;
        padding-right: 24px;
    }

    .template-technical .invoice-document-meta > div + div {
        border-left: 0;
    }

}



/* =========================================================
   PHASE 2B STEP 2E — TEMPLATE SELECTOR POLISH
   + DOCUMENT OVERFLOW SAFETY

   Presentation only.
   No monetary calculations.
   ========================================================= */


/* ---------------------------------------------------------
   TEMPLATE CHOOSER
   --------------------------------------------------------- */

.invoice-template-chooser {
    display: grid;
    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );
    gap: 10px;
}

.invoice-template-chooser button {
    position: relative;
    min-width: 0;
    min-height: 78px;
    display: grid;
    grid-template-columns:
        34px minmax(0, 1fr) 22px;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border:
        1px solid
        #dbe3ed;
    border-radius: 12px;
    color: #172033;
    background: #ffffff;
    text-align: left;
    font: inherit;
    cursor: pointer;
    transition:
        border-color .16s ease,
        box-shadow .16s ease,
        transform .16s ease,
        background .16s ease;
}

.invoice-template-chooser button:hover {
    transform:
        translateY(-1px);
    border-color:
        #94a3b8;
    box-shadow:
        0 8px 22px
        rgba(
            15,
            23,
            42,
            .07
        );
}

.invoice-template-chooser button:focus-visible {
    outline:
        3px solid
        rgba(
            37,
            99,
            235,
            .22
        );
    outline-offset:
        2px;
}

.invoice-template-chooser button.active,
.invoice-template-chooser button[aria-pressed="true"] {
    border-color:
        #2563eb;
    background:
        #f8fbff;
    box-shadow:
        0 0 0 2px
        rgba(
            37,
            99,
            235,
            .10
        );
}

.invoice-template-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.invoice-template-copy strong {
    overflow: hidden;
    color: #172033;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.invoice-template-copy small {
    overflow: hidden;
    color: #64748b;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.invoice-template-selected {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    border-radius: 50%;
    color: transparent;
    background: transparent;
    font-size: 9px;
}

.invoice-template-chooser
button.active
.invoice-template-selected,
.invoice-template-chooser
button[aria-pressed="true"]
.invoice-template-selected {
    color: #ffffff;
    background: #2563eb;
}


/* ---------------------------------------------------------
   TEMPLATE SWATCHES
   --------------------------------------------------------- */

.invoice-template-swatch {
    position: relative;
    width: 34px;
    height: 44px;
    overflow: hidden;
    border:
        1px solid
        rgba(
            15,
            23,
            42,
            .12
        );
    border-radius: 5px;
    background: #ffffff;
    box-shadow:
        0 3px 8px
        rgba(
            15,
            23,
            42,
            .06
        );
}

.invoice-template-swatch::before,
.invoice-template-swatch::after {
    content: "";
    position: absolute;
    left: 5px;
    right: 5px;
}

.invoice-template-swatch::before {
    top: 7px;
    height: 5px;
    border-radius: 2px;
    background: #334155;
}

.invoice-template-swatch::after {
    top: 18px;
    height: 16px;
    border-top:
        3px solid
        #cbd5e1;
    border-bottom:
        3px solid
        #e2e8f0;
}

.invoice-template-swatch-modern {
    border-top:
        5px solid
        #2563eb;
}

.invoice-template-swatch-modern::before {
    background:
        #2563eb;
}

.invoice-template-swatch-minimal {
    background:
        #ffffff;
}

.invoice-template-swatch-minimal::before {
    height: 2px;
    background:
        #64748b;
}

.invoice-template-swatch-corporate {
    border-top:
        5px solid
        #17365d;
}

.invoice-template-swatch-corporate::before {
    background:
        #17365d;
}

.invoice-template-swatch-executive {
    background:
        linear-gradient(
            to bottom,
            #1f2937 0 15px,
            #ffffff 15px 100%
        );
}

.invoice-template-swatch-executive::before {
    background:
        #ffffff;
}

.invoice-template-swatch-elegant {
    background:
        #fafaf9;
}

.invoice-template-swatch-elegant::before {
    height: 2px;
    background:
        #78716c;
}

.invoice-template-swatch-bold {
    border-left:
        5px solid
        #1d4ed8;
}

.invoice-template-swatch-bold::before {
    background:
        #1d4ed8;
}

.invoice-template-swatch-compact::before {
    height: 3px;
}

.invoice-template-swatch-compact::after {
    top: 16px;
    height: 20px;
    border-top-width:
        2px;
    border-bottom-width:
        2px;
}

.invoice-template-swatch-professional {
    border-top:
        4px solid
        #334e68;
}

.invoice-template-swatch-professional::before {
    background:
        #334e68;
}

.invoice-template-swatch-creative {
    border-top:
        5px solid
        #7c3aed;
}

.invoice-template-swatch-creative::before {
    background:
        #7c3aed;
}

.invoice-template-swatch-technical {
    border-radius:
        1px;
}

.invoice-template-swatch-technical::before {
    background:
        #334155;
}

.invoice-template-swatch-technical::after {
    border-top-color:
        #64748b;
    border-bottom-color:
        #94a3b8;
}

.invoice-template-swatch-premium {
    border-top:
        5px solid
        #b5944b;
    background:
        linear-gradient(
            to bottom,
            #111827 0 15px,
            #ffffff 15px 100%
        );
}

.invoice-template-swatch-premium::before {
    background:
        #e0c57a;
}


/* ---------------------------------------------------------
   DOCUMENT LONG-TEXT SAFETY
   --------------------------------------------------------- */

.invoice-paper,
.invoice-document-header,
.invoice-document-brand,
.invoice-document-meta,
.invoice-document-summary,
.invoice-document-notes {
    min-width: 0;
}

.invoice-document-company,
.invoice-document-muted,
.invoice-document-meta strong,
.invoice-document-notes,
.invoice-document-payment,
.invoice-document-footer {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.invoice-document-title {
    min-width: 0;
}

.invoice-document-title h2,
.invoice-document-title strong {
    overflow-wrap: anywhere;
}

.invoice-document-table {
    width: 100%;
    table-layout: fixed;
}

.invoice-document-table th,
.invoice-document-table td {
    min-width: 0;
}

.invoice-document-table th:first-child,
.invoice-document-table td:first-child {
    width: 34%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.invoice-document-table th:not(:first-child),
.invoice-document-table td:not(:first-child) {
    overflow-wrap: normal;
    word-break: normal;
}

.invoice-document-table td:first-child strong,
.invoice-document-table td:first-child span {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}


/* ---------------------------------------------------------
   PREVIEW STAGE SAFETY
   --------------------------------------------------------- */

.invoice-paper-stage {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    overscroll-behavior-inline:
        contain;
}

.invoice-paper {
    margin-left: auto;
    margin-right: auto;
}


/* ---------------------------------------------------------
   MOBILE TEMPLATE CHOOSER
   --------------------------------------------------------- */

@media (max-width: 900px) {

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

}

@media (max-width: 520px) {

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

    .invoice-template-chooser button {
        min-height:
            68px;
    }

}


/* ---------------------------------------------------------
   PRINT SAFETY
   --------------------------------------------------------- */

@media print {

    .invoice-paper-stage {
        overflow:
            visible !important;
    }

    .invoice-paper {
        max-width:
            none !important;
    }

    .invoice-document-table {
        table-layout:
            fixed;
    }

    .invoice-document-table tr,
    .invoice-document-summary,
    .invoice-document-header,
    .invoice-document-meta {
        break-inside:
            avoid;
        page-break-inside:
            avoid;
    }

}



/* =========================================================
   PHASE 2C STEP 3B — PRINT / PDF DOCUMENT CONTRACT

   Browser-native PDF foundation.

   The rendered invoice preview remains the canonical
   document. No monetary calculations occur here.
   ========================================================= */

@page {
    size: A4 portrait;
    margin: 0;
}


@media print {

    html,
    body {
        width: 210mm !important;
        min-width: 210mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
    }


    body {
        -webkit-print-color-adjust:
            exact !important;

        print-color-adjust:
            exact !important;
    }


    /*
     * Hide the entire screen application.
     *
     * The preview branch is explicitly restored below.
     */

    body.invoice-print-mode * {
        visibility:
            hidden !important;
    }


    body.invoice-print-mode
    .invoice-preview-column,

    body.invoice-print-mode
    .invoice-preview-column * {
        visibility:
            visible !important;
    }


    /*
     * Remove preview-only interface.
     */

    body.invoice-print-mode
    .invoice-preview-toolbar {
        display:
            none !important;
    }


    /*
     * Promote the preview container to the physical page.
     */

    body.invoice-print-mode
    .invoice-preview-column {
        position:
            absolute !important;

        inset:
            0 auto auto 0 !important;

        width:
            210mm !important;

        max-width:
            none !important;

        margin:
            0 !important;

        padding:
            0 !important;

        border:
            0 !important;

        border-radius:
            0 !important;

        background:
            #ffffff !important;

        box-shadow:
            none !important;
    }


    body.invoice-print-mode
    .invoice-paper-stage {
        width:
            210mm !important;

        max-width:
            none !important;

        margin:
            0 !important;

        padding:
            0 !important;

        overflow:
            visible !important;

        background:
            #ffffff !important;
    }


    /*
     * Canonical printable document.
     *
     * Do not force a 297mm height because long invoices
     * must be allowed to continue onto subsequent pages.
     */

    body.invoice-print-mode
    #invoicePreview {
        position:
            relative !important;

        box-sizing:
            border-box !important;

        width:
            210mm !important;

        max-width:
            210mm !important;

        min-height:
            297mm !important;

        margin:
            0 !important;

        border:
            0 !important;

        border-radius:
            0 !important;

        box-shadow:
            none !important;

        overflow:
            visible !important;

        -webkit-print-color-adjust:
            exact !important;

        print-color-adjust:
            exact !important;
    }


    /*
     * Pagination protection.
     */

    body.invoice-print-mode
    .invoice-document-header,

    body.invoice-print-mode
    .invoice-document-meta,

    body.invoice-print-mode
    .invoice-document-summary,

    body.invoice-print-mode
    .invoice-document-notes,

    body.invoice-print-mode
    .invoice-document-payment,

    body.invoice-print-mode
    .invoice-document-footer,

    body.invoice-print-mode
    .invoice-document-table tr {
        break-inside:
            avoid !important;

        page-break-inside:
            avoid !important;
    }


    body.invoice-print-mode
    .invoice-document-table {
        width:
            100% !important;

        table-layout:
            fixed !important;
    }


    body.invoice-print-mode
    .invoice-document-table thead {
        display:
            table-header-group;
    }


    /*
     * Uploaded logo is already represented as browser-local
     * image data. Keep it printable without introducing a
     * server dependency.
     */

    body.invoice-print-mode
    #previewLogo img {
        max-width:
            100% !important;

        max-height:
            100% !important;

        object-fit:
            contain !important;
    }

}



/* =========================================================
   R3 OPTIONAL SIGNATURE SYSTEM
   ========================================================= */

.invoice-signature-fields[hidden],
.invoice-document-signature[hidden],
.invoice-document-signature-image[hidden],
.invoice-document-typed-signature[hidden],
.invoice-document-signer-title[hidden] {
    display: none !important;
}

.invoice-signature-fields {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #e5e7eb;
}

.invoice-signature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.invoice-signature-field {
    margin-top: 16px;
}

.invoice-signature-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    cursor: pointer;
}

.invoice-signature-toggle input {
    width: 18px;
    height: 18px;
    margin: 0;
}

.invoice-signature-upload-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.invoice-signature-image-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 190px;
    min-height: 82px;
    padding: 10px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    overflow: hidden;
    color: #94a3b8;
    font-size: 12px;
    text-align: center;
}

.invoice-signature-image-preview img {
    display: block;
    max-width: 100%;
    max-height: 70px;
    object-fit: contain;
}

.invoice-signature-upload-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#invoiceSignatureImage {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.invoice-signature-upload-button,
.invoice-signature-remove-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #fff;
    color: #0f172a;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.invoice-signature-help {
    display: block;
    margin-top: 7px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
}


/* Printable invoice signature */

.invoice-document-signature {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.invoice-document-signature-inner {
    width: min(280px, 100%);
    margin-left: auto;
}

.invoice-document-signature-image {
    min-height: 58px;
    margin-top: 12px;
    margin-bottom: 6px;
}

.invoice-document-signature-image img {
    display: block;
    max-width: 220px;
    max-height: 76px;
    object-fit: contain;
}

.invoice-document-typed-signature {
    margin-top: 14px;
    margin-bottom: 7px;
    font-family:
        "Brush Script MT",
        "Segoe Script",
        cursive;
    font-size: 28px;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.invoice-document-signer-name {
    padding-top: 7px;
    border-top: 1px solid #94a3b8;
    color: #0f172a;
    font-size: 13px;
    font-weight: 700;
}

.invoice-document-signer-title {
    margin-top: 3px;
    color: #64748b;
    font-size: 11px;
    line-height: 1.4;
}

@media (max-width: 720px) {

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

    .invoice-signature-upload-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .invoice-signature-image-preview {
        width: 100%;
    }
}

@media print {

    body.invoice-print-mode
    .invoice-document-signature {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
}



/* =========================================================
   R4B — PNG / JPG EXPORT BUTTONS
   ========================================================= */

#downloadInvoicePng,
#downloadInvoiceJpg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 44px;
    padding: 10px 16px;

    border: 1px solid #dbe3ec;
    border-radius: 10px;

    background: #ffffff;
    color: #172033;

    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;

    cursor: pointer;

    transition:
        transform .15s ease,
        box-shadow .15s ease,
        border-color .15s ease,
        background-color .15s ease;
}


#downloadInvoicePng:hover,
#downloadInvoiceJpg:hover {
    transform: translateY(-1px);

    border-color: #b9c7d8;

    background: #f8fafc;

    box-shadow:
        0 7px 18px rgba(15, 23, 42, .08);
}


#downloadInvoicePng:active,
#downloadInvoiceJpg:active {
    transform: translateY(0);

    box-shadow: none;
}


#downloadInvoicePng:focus-visible,
#downloadInvoiceJpg:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .18);
    outline-offset: 2px;
}


/*
 * PNG gets the stronger primary export treatment.
 */

#downloadInvoicePng {
    border-color: #2563eb;

    background: #2563eb;
    color: #ffffff;

    box-shadow:
        0 7px 16px rgba(37, 99, 235, .18);
}


#downloadInvoicePng:hover {
    border-color: #1d4ed8;

    background: #1d4ed8;

    box-shadow:
        0 9px 20px rgba(37, 99, 235, .24);
}


/*
 * JPG stays secondary.
 */

#downloadInvoiceJpg {
    background: #ffffff;
    color: #25324a;
}


#downloadInvoicePng i,
#downloadInvoiceJpg i {
    font-size: 15px;
}


#downloadInvoicePng:disabled,
#downloadInvoiceJpg:disabled {
    opacity: .55;

    cursor: wait;

    pointer-events: none;

    transform: none;

    box-shadow: none;
}


@media (max-width: 720px) {

    #downloadInvoicePng,
    #downloadInvoiceJpg {
        flex: 1 1 calc(50% - 6px);

        min-width: 0;
    }

}


@media (max-width: 480px) {

    #downloadInvoicePng,
    #downloadInvoiceJpg {
        flex-basis: 100%;
        width: 100%;
    }

}

