.ci-items-table-wrap {
    margin-bottom: 10px;
}

/* Print-specific adjustments */
@media print {
    html, body { -webkit-print-color-adjust: exact; print-color-adjust: exact; color-adjust: exact; }
    .ci-preview-shell, .selected-preview-export { box-shadow: none !important; max-width: 100% !important; }
    .no-print, .invoice-action-btn, .form-section, .preview-section .no-print { display: none !important; }
    .ci-preview-table { page-break-inside: avoid; border-collapse: collapse; }
    .ci-preview-table tr, .ci-preview-table thead, .ci-preview-table tbody { break-inside: avoid; }
    .ci-preview-signature-row { page-break-inside: avoid; }
    #invoice-preview .selected-preview-export { padding: 10px !important; }
    body, #invoice-preview, .ci-preview-shell .selected-preview-export { font-size: 10.5px !important; padding: 10px !important; line-height: 1.25 !important; }
    .ci-preview-title { display: none !important; }
    .ci-preview-table { margin-top: 8px !important; margin-bottom: 10px !important; }
    .ci-preview-notes-block { margin: 8px 0 10px !important; }
    .template-4 .t4-header,
    .template-5 .t5-header-top,
    .template-4 .t4-parties-section,
    .template-4 .t4-meta-grid,
    .template-4 .t4-summary-section,
    .template-5 .t5-two-column,
    .template-5 .t5-summary-section,
    .template-5 .t5-footer-section {
        margin: 0 0 8px 0 !important;
        padding-bottom: 8px !important;
        gap: 8px !important;
    }
    .template-4 .t4-party,
    .template-5 .t5-party-section,
    .template-5 .t5-meta-item,
    .template-4 .t4-meta-box,
    .template-4 .t4-summary-box,
    .template-5 .t5-charges-area,
    .template-5 .t5-balance-area {
        padding: 8px !important;
    }
}

.ci-items-head-row {
    font-size: 14px;
}

.ci-col-desc {
    min-width: 120px;
    width: 50%;
}

.ci-col-qty,
.ci-col-unit {
    min-width: 60px;
    width: 10%;
}

.ci-col-rate {
    min-width: 80px;
    width: 10%;
}

.ci-col-amount {
    min-width: 80px;
    width: 15%;
}

.ci-col-action {
    min-width: 40px;
    width: 5%;
}

.ci-text-right {
    text-align: right;
}

.ci-input-highlight {
    text-align: right;
    font-weight: bold;
    background-color: lightyellow;
}

.ci-cursor-pointer {
    cursor: pointer;
}

.ci-w-30 {
    width: 30%;
}

.ci-w-35 {
    width: 35%;
}

.ci-w-20 {
    width: 20%;
}

.ci-summary-row-end {
    border-bottom: 1px solid lightgray;
}

.ci-preview-title {
    font-size: 1.5rem !important;
}

.ci-preview-shell {
    font-size: 12px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.ci-preview-header,
.ci-preview-parties,
.ci-preview-meta,
.ci-preview-summary-wrap,
.ci-preview-summary-row,
.ci-preview-balance-row,
.ci-preview-signature-row {
    display: flex;
}

.ci-preview-header,
.ci-preview-parties,
.ci-preview-meta,
.ci-preview-summary-row,
.ci-preview-balance-row {
    justify-content: space-between;
}

.ci-preview-header {
    padding-bottom: 15px;
}

.ci-preview-logo-container {
    width: 95px;
    height: auto;
}

.ci-preview-heading-wrap {
    text-align: right;
    padding-top: 20px;
}

.ci-preview-heading {
    margin: 0;
    font-size: 20px;
    font-weight: bold;
}

.ci-preview-parties {
    padding-top: 10px;
    margin-bottom: 20px;
    vertical-align: bottom;
}

.ci-preview-right,
.ci-preview-text-right {
    text-align: right;
}

.ci-preview-muted {
    color: gray;
}

.ci-preview-strong {
    font-weight: bold;
    padding-top: 5px;
}

.ci-preview-city {
    padding-bottom: 5px;
}

.ci-preview-meta {
    vertical-align: bottom;
}

.ci-preview-meta-line {
    padding-bottom: 3px;
}

.ci-preview-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    margin-bottom: 20px;
}

.ci-preview-th {
    border-bottom: 1px solid #ddd;
    padding: 3px;
}

.ci-preview-th-left {
    text-align: left;
}

.ci-preview-th-center {
    text-align: center;
}

.ci-preview-th-right {
    text-align: right;
}

.ci-preview-empty {
    border-bottom: 1px solid #eee;
    padding: 10px;
    text-align: center;
    color: #6c757d;
}

.ci-preview-summary-wrap,
.ci-preview-summary {
    width: 100%;
}

.ci-preview-summary-wrap {
    justify-content: flex-end;
}

.ci-preview-summary-row {
    border-bottom: 1px solid #ddd;
    padding: 5px 0;
}

.ci-preview-summary-row-inline {
    align-items: center;
}

.ci-preview-summary-row-paid {
    padding: 8px 0;
}

.ci-preview-gap-row {
    display: flex;
    gap: 10px;
}

.ci-preview-balance-block,
.ci-preview-notes-block {
    margin-top: 10px;
    margin-bottom: 20px;
}

.ci-preview-balance-row, .ci-preview-summary-row-total {
    font-weight: bold;
}

.ci-preview-signature-row {
    justify-content: flex-end;
    vertical-align: bottom;
    padding-top: 50px;
}

.ci-preview-signature-box {
    width: 75px;
    max-height: 75px;
    padding-bottom: 25px;
}

.ci-preview-footer {
    margin-bottom: 20px;
    border-top: 1px solid #ddd;
    padding-top: 5px;
    text-align: center;
    font-size: 8px;
}

.invoice-action-btn {
    font-size: 12px;
    border: none;
    border-radius: 24px;
    padding: 7px 18px 7px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    transition: background 0.2s, box-shadow 0.2s, color 0.2s;
    outline: none;
    margin-bottom: 6px;
}

.invoice-action-btn i {
    font-size: 15px;
    margin-right: 6px;
}

.btn-print {
    background: #1976d2;
    color: #fff;
}

.btn-print:hover,
.btn-print:focus {
    background: #1256a3;
    color: #fff;
    box-shadow: 0 4px 16px rgba(25, 118, 210, 0.13);
}

.btn-doc {
    background: #4caf50;
    color: #fff;
}

.btn-doc:hover,
.btn-doc:focus {
    background: #357a38;
    color: #fff;
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.13);
}

.btn-pdf {
    background: #e53935;
    color: #fff;
}

.btn-pdf:hover,
.btn-pdf:focus {
    background: #ab2320;
    color: #fff;
    box-shadow: 0 4px 16px rgba(229, 57, 53, 0.13);
}

.btn-send {
    background: #ff9800;
    color: #fff;
}

.btn-send:hover,
.btn-send:focus {
    background: #c66900;
    color: #fff;
    box-shadow: 0 4px 16px rgba(255, 152, 0, 0.13);
}

.ci-preview-notes-block {
    font-size: 10px;
    margin-top: 25px;
}

@media (max-width: 768px) {
    .invoice-action-btn {
        width: 100%;
        justify-content: center;
        font-size: 13px;
    }

    .d-flex.justify-content-center.gap-2.my-3.flex-wrap {
        flex-direction: column;
        align-items: stretch;
    }

    .form-section,
    .preview-section {
        padding: 15px;
    }

    .input-group .form-select,
    .input-group .form-control {
        font-size: 13px !important;
    }

    table {
        font-size: 13px !important;
    }

    th,
    td {
        padding: 6px !important;
    }
}

@media (max-width: 576px) {
    .form-section,
    .preview-section {
        padding: 12px;
    }

    .section-title {
        font-size: 1rem;
        margin-bottom: 10px;
        padding-bottom: 5px;
    }

    .invoice-action-btn {
        font-size: 12px;
        padding: 8px 16px;
    }

    .invoice-action-btn i {
        font-size: 13px;
        margin-right: 4px;
    }

    .form-label {
        font-size: 12px !important;
        margin-bottom: 4px !important;
    }

    .form-control,
    .form-select {
        font-size: 13px !important;
        padding: 6px 10px !important;
    }

    .btn-sm {
        font-size: 0.75rem !important;
        padding: 4px 8px !important;
    }

    .input-group {
        flex-wrap: nowrap;
    }

    .input-group .form-select,
    .input-group .form-control,
    .input-group-text {
        font-size: 12px !important;
    }

    table {
        font-size: 12px !important;
    }

    th {
        min-width: auto !important;
        padding: 5px 3px !important;
    }

    td {
        padding: 5px 3px !important;
    }

    textarea.form-control {
        font-size: 12px !important;
    }

    h1 {
        font-size: 1.3rem !important;
    }
}

@media (max-width: 400px) {
    .form-section,
    .preview-section {
        padding: 10px;
    }

    .section-title {
        font-size: 0.95rem;
        margin-bottom: 8px;
        padding-bottom: 4px;
    }

    .invoice-action-btn {
        font-size: 11px;
        padding: 7px 14px;
    }

    .form-label,
    .optional-label {
        font-size: 11px !important;
    }

    .form-control,
    .form-select {
        font-size: 12px !important;
        padding: 5px 8px !important;
    }

    .btn-sm {
        font-size: 0.7rem !important;
        padding: 3px 6px !important;
    }

    table {
        font-size: 11px !important;
    }

    th,
    td {
        padding: 4px 2px !important;
    }

    h1 {
        font-size: 1.2rem !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   TEMPLATE 2 — Modern Dark Navy
═══════════════════════════════════════════════════════════════════ */

/* Light gray header band that breaks out of the shell padding */
.template-2 .t2-header {
    /*background: #e8e8e8;*/
    color: #333;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    /*align-items: center;*/
    margin: -20px -20px 0 -20px;
    border-radius: 4px 4px 0 0;
}

.template-2 .t2-header-logo {
    width: 85px;
    height: auto;
    flex-shrink: 0;
}

.template-2 .t2-invoice-title {
    color: #333;
    font-size: 22px;
    font-weight: 800;
    margin: 0;
    letter-spacing: 1px;
    text-align: right;
}

.template-2 .t2-invoice-number {
    /*color: #90b4d8;*/
    font-size: 11px;
    text-align: right;
    margin-top: 2px;
}

/* Meta info strip */
.template-2 .t2-meta-strip {
    background: #f5f5f5;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 7px 20px;
    margin: 0 -20px 18px -20px;
    font-size: 10px;
}

.template-2 .t2-meta-item {
    flex: 1;
    min-width: 70px;
    padding: 0 8px;
    border-right: 1px solid #ddd;
}

.template-2 .t2-meta-item:first-child { padding-left: 0; }
.template-2 .t2-meta-item:last-child  { border-right: none; }

/* Address cards */
.template-2 .t2-parties {
    display: flex;
    gap: 10px;
    margin: 10px 0;
}

.template-2 .t2-party-card {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #dce6f0;
    border-radius: 6px;
    background: #f8fafc;
}

.template-2 .t2-bill-to-card {
    background: #ebf2fb;
    border-color: #b4cee8;
    text-align: right;
}

.template-2 .t2-party-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #555;
    font-weight: 700;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #ddd;
}

/* Table */
.template-2 .ci-preview-table thead .t2-table-head th {
    background: #e8e8e8;
    color: #333;
    border-bottom: none;
    padding: 7px 4px;
}

.template-2 .ci-preview-table tbody tr:nth-child(even) {
    background: #f1f6fb;
}

/* Summary panel */
.template-2 .t2-summary-panel {
    margin-top: 16px;
    margin-left: auto;
    /*width: min(100%, 340px);*/
    background: linear-gradient(180deg, #f5f5f5 0%, #efefef 100%);
    color: #333;
    border-radius: 10px;
    overflow: hidden;
    /*box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);*/
}

.template-2 .t2-summary-title {
    padding: 12px 16px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: #666;
    border-bottom: 1px solid #ddd;
}

.template-2 .t2-summary-list {
    padding: 8px 16px 12px;
}

.template-2 .t2-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed #ddd;
}

.template-2 .t2-summary-row:last-child {
    border-bottom: none;
}

.template-2 .t2-summary-label-group {
    display: flex;
    gap: 6px;
    align-items: center;
    min-width: 0;
}

.template-2 .t2-summary-label,
.template-2 .t2-summary-meta {
    color: #333;
}

.template-2 .t2-summary-meta {
    font-size: 10px;
    color: #999;
}

.template-2 .t2-summary-value {
    font-weight: 700;
    color: #333;
    text-align: right;
    white-space: nowrap;
}

/*.template-2 .t2-summary-row-total {*/
/*    margin-top: 6px;*/
/*    padding-top: 12px;*/
/*    border-bottom: none;*/
/*    border-top: 1px solid #ddd;*/
/*}*/

.template-2 .t2-summary-row-total .t2-summary-label,
.template-2 .t2-summary-row-total .t2-summary-value {
    font-size: 13px;
    font-weight: 800;
}

.template-2 .t2-summary-row-paid .t2-summary-label {
    /*color: #666;*/
    font-size: 13px;
    /*font-weight: 800;*/
}

/* Balance block */
/*.template-2 .t2-balance-block {*/
/*    background: #e8e8e8;*/
/*    color: #333;*/
/*    padding: 8px 14px;*/
/*    border-radius: 4px;*/
/*    margin-top: 10px;*/
/*    margin-bottom: 10px;*/
/*}*/

.template-2 .t2-balance-block {
    background: #e8e8e8;
    color: #333;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 800;
}
.template-2 .t2-balance-block .ci-preview-balance-row {
    color: #333;
    display: flex;
    justify-content: space-between;
    font-weight: bold;
}

/* Footer */
.template-2 .t2-footer {
    margin-top: 14px;
    padding-top: 6px;
    border-top: 2px solid #ddd;
    text-align: center;
    font-size: 8px;
    color: #666;
}


/* ═══════════════════════════════════════════════════════════════════
   TEMPLATE 3 — Clean Teal Professional
═══════════════════════════════════════════════════════════════════ */

/* Light gray top accent */
.template-3 {
    border-top: 5px solid #d3d3d3;
}

/* Header */
.template-3 .t3-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 14px;
    border-bottom: 2px solid #e8e8e8;
    margin-bottom: 0;
}

.template-3 .t3-logo {
    width: 85px;
    height: auto;
    flex-shrink: 0;
}

.template-3 .t3-title-block {
    text-align: right;
}

.template-3 .t3-invoice-title {
    font-size: 26px;
    font-weight: 900;
    color: #666;
    margin: 0;
    letter-spacing: 1px;
}

.template-3 .t3-invoice-number {
    color: #555;
    font-size: 11px;
    margin-top: 2px;
}

/* Teal meta strip */
.template-3 .t3-meta-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    background: #f5f5f5;
    border-radius: 0 0 6px 6px;
    margin: 0 0 16px 0;
    padding: 8px 14px;
    font-size: 10px;
}

.template-3 .t3-meta-strip > div {
    padding: 0 8px;
    border-right: 1px solid #ddd;
}

.template-3 .t3-meta-strip > div:first-child { padding-left: 0; }
.template-3 .t3-meta-strip > div:last-child  { border-right: none; }

.template-3 .t3-meta-item {
    color: #666;
    font-size: 10px;
    font-weight: 700;
}

/* Party sections */
.template-3 .t3-parties {
    display: flex;
    gap: 14px;
    margin-bottom: 16px;
}

.template-3 .t3-party {
    flex: 1;
    padding: 10px 12px;
}

.template-3 .t3-party-from {
    border-left: 4px solid #d3d3d3;
}

.template-3 .t3-party-to {
    border-left: 4px solid #e0e0e0;
    background: #fafafa;
    border-radius: 0 6px 6px 0;
}

.template-3 .t3-party-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #666;
    font-weight: 700;
    margin-bottom: 5px;
}

/* Table */
.template-3 .ci-preview-table thead .t3-table-head th {
    background: #d3d3d3;
    color: #333;
    border-bottom: none;
    padding: 7px 4px;
}

.template-3 .ci-preview-table tbody tr:nth-child(even) {
    background: #f9f9f9;
}

.template-3 .ci-preview-table tbody tr td {
    border-bottom: 1px solid #e8e8e8;
    padding: 4px;
}

/* Summary board */
.template-3 .t3-summary-board {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 14px;
    margin-top: 16px;
    align-items: start;
}

.template-3 .t3-summary-card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06);
    border: 1px solid #e8e8e8;
    background: #fff;
}

.template-3 .t3-summary-card-main {
    background: linear-gradient(180deg, #ffffff 0%, #f7fcfb 100%);
}

.template-3 .t3-summary-card-accent {
    background: linear-gradient(180deg, #d3d3d3 0%, #c0c0c0 100%);
    border-color: #d3d3d3;
    color: #333;
}

.template-3 .t3-summary-card-title {
    padding: 12px 14px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border-bottom: 1px solid #e8e8e8;
    color: #666;
}

.template-3 .t3-summary-card-accent .t3-summary-card-title {
    color: #333;
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

.template-3 .t3-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-bottom: 1px solid #e8e8e8;
}

.template-3 .t3-summary-card-accent .t3-summary-row {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

.template-3 .t3-summary-row:last-child {
    border-bottom: none;
}

.template-3 .t3-summary-label-group {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.template-3 .t3-summary-label {
    color: #555;
    font-weight: 600;
}

.template-3 .t3-summary-meta {
    color: #999;
    font-size: 10px;
}

.template-3 .t3-summary-value {
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
    color: #333;
}

.template-3 .t3-summary-card-accent .t3-summary-label,
.template-3 .t3-summary-card-accent .t3-summary-value,
.template-3 .t3-summary-card-accent .t3-summary-meta {
    color: #333;
}

.template-3 .t3-summary-row-total .t3-summary-label,
.template-3 .t3-summary-row-total .t3-summary-value {
    font-size: 14px;
}

.template-3 .t3-summary-row-paid .t3-summary-label {
    opacity: 0.88;
}

/* Balance block */
.template-3 .t3-balance-block {
    border-left: 4px solid #d3d3d3;
    padding-left: 12px;
    margin-top: 8px;
    margin-bottom: 10px;
}

.template-3 .t3-balance-row {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    color: #666;
    font-size: 13px;
}

/* Footer */
.template-3 .t3-footer {
    margin-top: 14px;
    padding-top: 6px;
    border-top: 2px solid #ddd;
    text-align: center;
    font-size: 8px;
    color: #666;
}

/* ═══════════════════════════════════════════════════════════════════
   TEMPLATE 4 — Professional Light
═══════════════════════════════════════════════════════════════════ */

.template-4 {
    border-top: 2px solid #d4d9e1;
    background: #fff;
}

.template-4 .t4-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e6e9ee;
}

.template-4 .t4-logo-title {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
}

.template-4 .t4-logo {
    width: 62px;
    height: auto;
    padding: 5px;
    border-radius: 6px;
    background: #f7f8fa;
    border: 1px solid #e3e7ec;
}

.template-4 .t4-invoice-title {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #1f2937;
}

.template-4 .t4-invoice-number {
    margin-top: 2px;
    font-size: 11px;
    color: #667085;
}

.template-4 .t4-parties-section {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.template-4 .t4-party {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e4e8ee;
    background: #fafbfc;
}

.template-4 .t4-party-label {
    margin-bottom: 6px;
    color: #4b5563;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.template-4 .t4-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.template-4 .t4-meta-box {
    padding: 7px 8px;
    border-radius: 6px;
    border: 1px solid #e4e8ee;
    background: #f8fafc;
    font-size: 10px;
    line-height: 1.35;
    color: #374151;
}

.template-4 .ci-preview-table {
    margin-top: 8px;
    margin-bottom: 10px;
}

.template-4 .ci-preview-table thead .t4-table-head th {
    background: #f1f3f6;
    color: #1f2937;
    border-bottom: 1px solid #dce1e8;
    padding: 7px 6px;
    font-weight: 700;
}

.template-4 .ci-preview-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.template-4 .ci-preview-table tbody tr td {
    border-bottom: 1px solid #eceff3;
    padding: 6px;
}

.template-4 .t4-summary-section {
    margin-top: 8px;
}

.template-4 .t4-summary-box {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e4e8ee;
    background: #fafbfc;
    margin-bottom: 8px;
}

.template-4 .t4-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #eceff3;
}

.template-4 .t4-summary-row:last-child {
    border-bottom: none;
}

.template-4 .t4-summary-row-divider {
    border-top: 1px solid #dce1e8;
    border-bottom: 1px solid #dce1e8;
    margin: 3px 0;
}

.template-4 .t4-summary-label-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.template-4 .t4-summary-label {
    color: #1f2937;
    font-weight: 600;
}

.template-4 .t4-summary-meta {
    color: #8a94a6;
    font-size: 10px;
}

.template-4 .t4-summary-value {
    color: #111827;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.template-4 .t4-balance-box {
    padding: 9px 10px;
    border-radius: 6px;
    border: 1px solid #dce1e8;
    background: #f4f6f9;
}

.template-4 .t4-balance-box .ci-preview-balance-row {
    font-size: 13px;
    font-weight: 800;
    color: #1f2937;
}

.template-4 .t4-notes {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #e6e9ee;
    font-size: 11px;
}

.template-4 .t4-footer-section {
    margin-top: 10px;
}

.template-4 .t4-footer {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #e6e9ee;
    text-align: center;
    font-size: 9px;
    color: #8a94a6;
}

/* ═══════════════════════════════════════════════════════════════════
   TEMPLATE 5 — Elegant Corporate
═══════════════════════════════════════════════════════════════════ */

.template-5 {
    border-top: 2px solid #d4d9e1;
    background: #fff;
}

.template-5 .t5-header-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e6e9ee;
}

.template-5 .t5-logo-name {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
}

.template-5 .t5-logo {
    width: 62px;
    height: auto;
    padding: 5px;
    border-radius: 6px;
    background: #f7f8fa;
    border: 1px solid #e3e7ec;
}

.template-5 .t5-invoice-title {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #1f2937;
}

.template-5 .t5-invoice-number {
    margin-top: 2px;
    font-size: 11px;
    color: #667085;
}

.template-5 .t5-two-column {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e6e9ee;
}

.template-5 .t5-left-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-5 .t5-party-section {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e4e8ee;
    background: #fafbfc;
}

.template-5 .t5-party-label {
    margin-bottom: 6px;
    color: #4b5563;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.template-5 .t5-meta-group {
    display: grid;
    gap: 8px;
}

.template-5 .t5-meta-item {
    padding: 7px 8px;
    border-radius: 6px;
    border: 1px solid #e4e8ee;
    background: #f8fafc;
    font-size: 10px;
    line-height: 1.35;
    color: #374151;
}

.template-5 .ci-preview-table {
    margin-top: 8px;
    margin-bottom: 10px;
}

.template-5 .ci-preview-table thead .t5-table-head th {
    background: #f1f3f6;
    color: #1f2937;
    border-bottom: 1px solid #dce1e8;
    padding: 7px 6px;
    font-weight: 700;
}

.template-5 .ci-preview-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.template-5 .ci-preview-table tbody tr td {
    border-bottom: 1px solid #eceff3;
    padding: 6px;
}

.template-5 .t5-summary-section {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 10px;
    margin-top: 8px;
}

.template-5 .t5-charges-area,
.template-5 .t5-totals-area {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e4e8ee;
    background: #fafbfc;
}

.template-5 .t5-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #eceff3;
}

.template-5 .t5-summary-row:last-child {
    border-bottom: none;
}

.template-5 .t5-summary-row-total {
    border-top: 1px solid #dce1e8;
    border-bottom: 1px solid #dce1e8;
    margin-top: 3px;
}

.template-5 .t5-summary-label-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.template-5 .t5-summary-label {
    color: #1f2937;
    font-weight: 600;
}

.template-5 .t5-summary-meta {
    color: #8a94a6;
    font-size: 10px;
}

.template-5 .t5-summary-value {
    color: #111827;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.template-5 .t5-balance-area {
    padding: 9px 10px;
    border-radius: 6px;
    border: 1px solid #dce1e8;
    background: #f4f6f9;
    margin-top: 6px;
}

.template-5 .t5-balance-area .ci-preview-balance-row {
    font-size: 13px;
    font-weight: 800;
    color: #1f2937;
}

.template-5 .t5-notes {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #e6e9ee;
    font-size: 11px;
}

.template-5 .t5-footer-section {
    margin-top: 10px;
}

.template-5 .t5-footer {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #e6e9ee;
    text-align: center;
    font-size: 9px;
    color: #8a94a6;
}

@media (max-width: 768px) {
    .template-4 .t4-parties-section,
    .template-4 .t4-meta-grid,
    .template-5 .t5-two-column,
    .template-5 .t5-summary-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .template-4 .t4-header,
    .template-5 .t5-header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .template-4 .t4-invoice-title,
    .template-5 .t5-invoice-title {
        font-size: 21px;
    }

    .template-4 .t4-parties-section,
    .template-4 .t4-meta-grid,
    .template-5 .t5-two-column,
    .template-5 .t5-summary-section {
        gap: 8px;
    }
}