
/* ============================================================
   CHIFRANDO INVOICE - MAIN STYLES
   ============================================================ */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    background: #f4f6fa;
    color: #1f2937;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.app {
    min-height: 100vh;
}


/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    padding: 20px 14px;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 800;
}

.logo-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #204da7;
    color: #fff;
}

.nav {
    margin-top: 30px;
}

.nav button {
    width: 100%;
    margin-bottom: 4px;
    padding: 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #667085;
    text-align: left;
}

.nav button:hover,
.nav button.active {
    background: #edf3ff;
    color: #204da7;
}

.nav i {
    display: inline-block;
    width: 25px;
}


/* ============================================================
   MAIN CONTENT AND HEADER
   ============================================================ */

.main {
    min-width: 0;
    min-height: 100vh;
    margin-left: 240px;
}

.top {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    padding: 0 28px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.hamb {
    display: none;
    border: 0;
    background: none;
    font-size: 25px;
}

.content {
    width: 100%;
    max-width: 1500px;
    min-width: 0;
    margin: auto;
    padding: 28px;
}

h1,
h2,
h3 {
    margin: 0;
}

.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
}

.muted {
    color: #667085;
}


/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    padding: 9px 14px;
    border: 1px solid #d7dce5;
    border-radius: 8px;
    background: #fff;
}

.primary {
    border-color: #204da7;
    background: #204da7;
    color: #fff;
}

.danger {
    color: #b42318;
}


/* ============================================================
   BASIC CARDS AND SECTIONS
   ============================================================ */

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.card {
    min-width: 0;
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
}

.stat strong {
    display: block;
    margin-top: 7px;
    font-size: 22px;
}

.grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
}

.section {
    min-width: 0;
    margin-bottom: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 18px;
    border-bottom: 1px solid #edf0f4;
    font-weight: 700;
}

.section-body {
    padding: 18px;
}


/* ============================================================
   FORMS
   ============================================================ */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    min-width: 0;
    padding: 9px;
    border: 1px solid #d7dce5;
    border-radius: 7px;
    background: #fff;
}

textarea {
    resize: vertical;
}


/* ============================================================
   INVOICE FORM ITEMS
   ============================================================ */

.items-head,
.item {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        90px
        150px
        150px
        44px;
    align-items: end;
    gap: 8px;
}

.items-head {
    margin-bottom: 7px;
    color: #667085;
    font-size: 12px;
}

.item {
    margin-bottom: 10px;
}

.amount {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 40px;
    padding: 0 9px;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    background: #f8fafc;
    font-weight: 650;
}

.add-wrap {
    padding-top: 6px;
    text-align: center;
}


/* ============================================================
   INVOICE PREVIEW
   ============================================================ */

.preview {
    max-width: 850px;
    margin: auto;
    padding: 42px;
    background: #fff;
    box-shadow: 0 5px 25px #10182812;
}

.invoice-head {
    display: flex;
    justify-content: space-between;
    padding-bottom: 20px;
    border-bottom: 3px solid #204da7;
}

.invoice-head h2 {
    margin: 8px 0 3px;
    font-size: 24px;
}

.invoice-label {
    color: #204da7;
    font-size: 30px;
    font-weight: 800;
}

.invoice-table {
    width: 100%;
    margin-top: 20px;
    border-collapse: collapse;
    table-layout: fixed;
}

.invoice-table th {
    padding: 10px;
    background: #204da7;
    color: #fff;
    font-size: 12px;
    text-align: left;
}

.invoice-table th:nth-child(1) {
    width: 52%;
}

.invoice-table th:nth-child(2) {
    width: 12%;
    text-align: center;
}

.invoice-table th:nth-child(3),
.invoice-table th:nth-child(4) {
    width: 18%;
    text-align: right;
}

.invoice-table td {
    padding: 10px;
    border-bottom: 1px solid #edf0f4;
    overflow-wrap: anywhere;
}

.invoice-table td:nth-child(2) {
    text-align: center;
}

.invoice-table td:nth-child(3),
.invoice-table td:nth-child(4) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.totals {
    width: 310px;
    margin-top: 20px;
    margin-left: auto;
}

.totals div {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid #eee;
}

.totals .grand {
    padding-top: 12px;
    border: 0;
    color: #204da7;
    font-size: 18px;
    font-weight: 800;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mobile-drawer {
    display: none;
}


/* ============================================================
   INVOICE STATUS
   ============================================================ */

.status {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.paid {
    background: #e8f7ee;
    color: #147a42;
}

.unpaid {
    background: #fff5dc;
    color: #946200;
}

.partial {
    background: #e8f0ff;
    color: #285bb5;
}

.overdue {
    background: #fdecec;
    color: #b42318;
}


/* ============================================================
   ORIGINAL TABLE STYLES
   ============================================================ */

.table-wrap {
    overflow: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px;
    border-bottom: 1px solid #edf0f4;
    text-align: left;
    white-space: nowrap;
}

.data-table th {
    background: #fafbfc;
    color: #667085;
    font-size: 12px;
}

.empty {
    padding: 40px;
    color: #667085;
    text-align: center;
}


/* ============================================================
   MODERN DASHBOARD HEADER
   ============================================================ */

.cf-dashboard-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 22px;
}

.cf-dashboard-heading h2 {
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -0.6px;
}

.cf-create-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 43px;
    padding: 11px 19px;
    border-radius: 11px;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 5px 14px rgba(32, 77, 167, 0.14);
}


/* ============================================================
   MODERN DASHBOARD SUMMARY CARDS
   ============================================================ */

.cards.cf-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    width: 100%;
}

.cf-stat-grid .cf-stat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    min-height: 155px;
    padding: 20px;
    border: 1px solid #e8edf5;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(17, 38, 77, 0.045);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.cf-stat-grid .cf-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 24px rgba(17, 38, 77, 0.09);
}

.cf-stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.cf-stat-label {
    color: #64748b;
    font-size: 13px;
    font-weight: 650;
}

.cf-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-size: 20px;
    font-weight: 800;
}

.cf-stat-grid .cf-stat-card strong {
    display: block;
    min-width: 0;
    margin: 15px 0 9px;
    color: #17243c;
    font-size: clamp(17px, 1.8vw, 25px);
    font-weight: 800;
    letter-spacing: -0.7px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cf-stat-count {
    color: #8995a7;
    font-size: 12px;
    font-weight: 500;
}


/* TOTAL INVOICED CARD */

.cf-stat-grid .cf-stat-total {
    border-color: transparent;
    background: linear-gradient(
        135deg,
        #204da7 0%,
        #3265c3 100%
    );
}

.cf-stat-total .cf-stat-label,
.cf-stat-total .cf-stat-count {
    color: rgba(255, 255, 255, 0.82);
}

.cf-stat-grid .cf-stat-total strong {
    color: #fff;
}

.cf-stat-total .cf-stat-icon {
    background: rgba(255, 255, 255, 0.17);
    color: #fff;
}


/* PAID CARD */

.cf-stat-grid .cf-stat-paid {
    border-top: 3px solid #16a34a;
}

.cf-stat-paid .cf-stat-icon {
    background: #dcfce7;
    color: #15803d;
}


/* UNPAID CARD */

.cf-stat-grid .cf-stat-unpaid {
    border-top: 3px solid #f59e0b;
}

.cf-stat-unpaid .cf-stat-icon {
    background: #fef3c7;
    color: #b45309;
}


/* OVERDUE CARD */

.cf-stat-grid .cf-stat-overdue {
    border-top: 3px solid #ef4444;
}

.cf-stat-overdue .cf-stat-icon {
    background: #fee2e2;
    color: #dc2626;
}


/* ============================================================
   RECENT INVOICES AND INVOICE HISTORY
   ============================================================ */

.cf-invoice-section {
    min-width: 0;
    overflow: visible;
}

.cf-recent-section {
    margin-top: 22px;
}

.cf-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cf-section-heading > span {
    font-size: 16px;
    font-weight: 750;
}

.cf-view-all {
    border: 0;
    background: transparent;
    color: #204da7;
    font-size: 13px;
    font-weight: 700;
}

.cf-view-all:hover {
    text-decoration: underline;
}


/* INVOICE LIST CONTAINER */

/*
   No fixed minimum width.
   This prevents the list itself from forcing
   horizontal scrolling on mobile.
*/

.invoice-list,
.cf-invoice-list {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
}


/* ============================================================
   INDIVIDUAL INVOICE ROW
   ============================================================ */

.cf-invoice-row {
    position: relative;
    display: grid;

    grid-template-columns:
        minmax(0, 34%)
        minmax(0, 26%)
        minmax(0, 1fr)
        32px;

    align-items: start;
    column-gap: 10px;

    width: 100%;
    min-width: 0;
    padding: 18px 16px;

    border-bottom: 1px solid #edf0f5;
    background: #fff;

    transition: background 0.2s ease;
}

.cf-invoice-row:last-child {
    border-bottom: 0;
}

.cf-invoice-row:hover {
    background: #f8faff;
}


/* INVOICE NUMBER, NAME AND DATE */

.cf-invoice-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    gap: 5px;
}

.cf-invoice-number {
    display: block;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: transparent;

    color: #204da7;
    font-family: inherit;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.35;
    text-align: left;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cf-invoice-number:hover {
    text-decoration: underline;
}

.cf-invoice-customer {
    display: block;
    max-width: 100%;
    color: #374151;
    font-size: 14px;
    font-weight: 550;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.cf-invoice-date {
    display: block;
    color: #94a3b8;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.4;
}


/* INVOICE AMOUNT */

.cf-invoice-amount {
    min-width: 0;
    padding-top: 1px;

    color: #17243c;
    font-size: 16px;
    font-weight: 750;
    letter-spacing: -0.35px;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* INVOICE STATUS */

.cf-invoice-status {
    min-width: 0;
    padding-top: 1px;
}

.cf-invoice-status .status {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    max-width: 100%;
    padding: 6px 10px;
    border-radius: 8px;

    font-size: 12px;
    font-weight: 750;
    line-height: 1.3;
    white-space: nowrap;
}


/* ============================================================
   THREE-DOT MENU
   ============================================================ */

.cf-invoice-actions {
    position: relative;
    display: flex;
    justify-content: flex-end;
    min-width: 0;
}

.cf-dots-btn {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 32px;
    height: 32px;
    padding: 0;

    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;

    color: #64748b;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
}

.cf-dots-btn:hover,
.cf-dots-btn[aria-expanded="true"] {
    background: #edf3ff;
    color: #204da7;
}


/* DROPDOWN */

.cf-invoice-dropdown {
    display: none;

    position: absolute;
    top: 35px;
    right: 0;
    z-index: 100;

    min-width: 145px;
    padding: 6px;

    border: 1px solid #e6eaf1;
    border-radius: 11px;
    background: #fff;

    box-shadow: 0 12px 30px rgba(17, 38, 77, 0.14);
}

.cf-invoice-dropdown.open {
    display: flex;
    flex-direction: column;
}

.cf-invoice-dropdown button {
    display: block;
    width: 100%;
    padding: 10px 12px;

    border: 0;
    border-radius: 7px;
    background: transparent;

    color: #344054;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
}

.cf-invoice-dropdown button:hover {
    background: #f0f5ff;
    color: #204da7;
}

.cf-invoice-dropdown .cf-delete-action {
    color: #dc2626;
}

.cf-invoice-dropdown .cf-delete-action:hover {
    background: #fef2f2;
    color: #b91c1c;
}


/* ============================================================
   SEARCH AND EMPTY STATE
   ============================================================ */

.cf-search-area {
    min-width: 0;
}

.cf-search-area input {
    width: 100%;
    min-width: 0;
}

.cf-invoice-empty {
    padding: 35px 15px;
    color: #94a3b8;
    font-size: 14px;
    text-align: center;
}


/* ============================================================
   TABLET RESPONSIVENESS
   ============================================================ */

@media (max-width: 1050px) {

    .cards.cf-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}


/* ============================================================
   MOBILE LAYOUT
   ============================================================ */

@media (max-width: 800px) {

    .sidebar {
        display: none;
    }

    .main {
        margin-left: 0;
    }

    .top {
        height: 64px;
        padding: 0 14px;
    }

    .hamb {
        display: block;
    }

    .top-title {
        display: flex;
        align-items: center;
        gap: 9px;
    }

    .content {
        padding: 14px;
    }

    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .page-title {
        align-items: flex-start;
        gap: 12px;
    }

    .page-title .primary {
        white-space: nowrap;
    }


    /* MOBILE DRAWER */

    .mobile-drawer {
        position: fixed;
        inset: 0;
        z-index: 200;
        display: none;
    }

    .mobile-drawer.open {
        display: block;
    }

    .drawer-overlay {
        position: absolute;
        inset: 0;
        background: #0006;
    }

    .drawer {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;

        width: min(82vw, 300px);
        padding: 20px;

        background: #fff;
        box-shadow: 5px 0 20px #0002;
    }

    .drawer-close {
        float: right;
        border: 0;
        background: none;
        font-size: 25px;
    }

    .drawer .nav {
        clear: both;
        padding-top: 25px;
    }

    .drawer .nav button {
        font-size: 15px;
    }


    /* MOBILE FORMS */

    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .items-head {
        display: none;
    }

    .item {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 9px;
        padding: 12px;

        border: 1px solid #e5e7eb;
        border-radius: 9px;
        background: #fafbfc;
    }

    .item .desc {
        grid-column: 1 / -1;
    }

    .item .remove {
        grid-column: 2;
    }

    .item .amount {
        justify-content: flex-start;
    }


    /* MOBILE PREVIEW */

    .preview {
        padding: 22px 14px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        box-shadow: none;
    }

    .invoice-head {
        gap: 12px;
    }

    .invoice-head h2 {
        font-size: 17px;
    }

    .invoice-label {
        font-size: 22px;
    }

    .invoice-table {
        font-size: 11px;
    }

    .invoice-table th,
    .invoice-table td {
        padding: 7px 5px;
    }

    .totals {
        width: 100%;
        max-width: 310px;
    }

    .actions .btn {
        flex: 1;
    }

}


/* ============================================================
   SMALL PHONE LAYOUT
   ============================================================ */

@media (max-width: 600px) {

    .cf-dashboard-heading {
        align-items: flex-start;
        gap: 12px;
    }

    .cf-dashboard-heading h2 {
        font-size: 22px;
    }

    .cf-create-btn {
        min-height: 40px;
        padding: 10px 12px;
        font-size: 13px;
    }


    /* SUMMARY CARDS */

    .cards.cf-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .cf-stat-grid .cf-stat-card {
        min-height: 132px;
        padding: 14px;
        border-radius: 13px;
    }

    .cf-stat-label {
        font-size: 12px;
    }

    .cf-stat-icon {
        width: 29px;
        height: 29px;
        border-radius: 8px;
        font-size: 17px;
    }

    .cf-stat-grid .cf-stat-card strong {
        margin: 12px 0 8px;
        font-size: clamp(15px, 4vw, 19px);
        letter-spacing: -0.5px;
    }

    .cf-stat-count {
        font-size: 11px;
    }


    /* COMPACT INVOICE ROW */

    .cf-invoice-row {
        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 33%)
            max-content
            26px;

        column-gap: 6px;
        padding: 15px 10px;
    }

    .cf-invoice-number {
        font-size: 14px;
    }

    .cf-invoice-customer {
        font-size: 13px;
    }

    .cf-invoice-date {
        font-size: 12px;
    }

    .cf-invoice-amount {
        font-size: 13px;
    }

    .cf-invoice-status .status {
        padding: 5px 7px;
        font-size: 11px;
    }

    .cf-dots-btn {
        width: 26px;
        height: 28px;
        font-size: 22px;
    }

    .cf-invoice-dropdown {
        top: 30px;
    }

}


/* ============================================================
   EXTRA-SMALL PHONE LAYOUT
   ============================================================ */

@media (max-width: 370px) {

    .cards {
        gap: 8px;
    }

    .card {
        padding: 13px;
    }

    .stat strong {
        font-size: 17px;
    }

    .page-title h2 {
        font-size: 20px;
    }

    .page-title .muted {
        font-size: 12px;
    }

    .preview {
        padding: 16px 9px;
    }

    .invoice-table {
        font-size: 10px;
    }

    .invoice-table th,
    .invoice-table td {
        padding: 6px 3px;
    }

    .cf-invoice-row {
        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 32%)
            max-content
            22px;

        column-gap: 4px;
        padding: 13px 8px;
    }

    .cf-invoice-number {
        font-size: 13px;
    }

    .cf-invoice-amount {
        font-size: 12px;
    }

    .cf-invoice-status .status {
        padding: 5px;
        font-size: 10px;
    }

    .cf-dots-btn {
        width: 22px;
    }

    .cf-stat-grid .cf-stat-card {
        padding: 12px;
    }

}


/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {

    .sidebar,
    .top,
    .no-print,
    .mobile-drawer {
        display: none !important;
    }

    .main {
        margin: 0;
    }

    .content {
        padding: 0;
    }

    .preview {
        max-width: none;
        border: 0;
        box-shadow: none;
    }

    .print-only {
        display: block !important;
    }

    @page {
        size: A4;
        margin: 10mm;
    }

}


/* ============================================================
   CHIFRANDO INVOICE - UPDATE 0.0.03
   ============================================================ */


/* ------------------------------------------------------------
   FULL-WIDTH CREATE INVOICE BUTTON
   ------------------------------------------------------------ */

.cf-create-full {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;

    width: 100%;
    min-height: 48px;
    margin-top: 17px;
    margin-bottom: 22px;
    padding: 12px 18px;

    border-radius: 12px;

    font-size: 15px;
    font-weight: 750;

    box-shadow: 0 4px 13px rgba(32, 77, 167, 0.12);

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.cf-create-full:hover {
    background: #183e8e;
    transform: translateY(-1px);
}

.cf-create-plus {
    font-size: 22px;
    font-weight: 500;
    line-height: 1;
}


/* ------------------------------------------------------------
   RECENT INVOICES SPACING
   ------------------------------------------------------------ */

.cf-recent-section {
    margin-top: 0;
}


/* ------------------------------------------------------------
   EDITABLE STATUS
   ------------------------------------------------------------ */

.cf-status-wrap {
    display: inline-flex;
    align-items: center;
    position: relative;
    max-width: 100%;
}

.cf-status-wrap::after {
    content: "";
    position: absolute;
    right: 9px;
    top: 50%;

    width: 6px;
    height: 6px;

    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;

    transform: translateY(-70%) rotate(45deg);

    pointer-events: none;
}

.cf-status-select {
    display: block;

    width: auto;
    max-width: 100%;
    min-width: 0;

    padding: 6px 23px 6px 10px;

    border: 1px solid transparent;
    border-radius: 8px;

    font-family: inherit;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.3;

    appearance: none;
    -webkit-appearance: none;

    cursor: pointer;
}

.cf-status-select:focus {
    outline: 2px solid #204da7;
    outline-offset: 2px;
}

.cf-status-select.paid {
    color: #147a42;
    background: #e8f7ee;
}

.cf-status-select.unpaid {
    color: #946200;
    background: #fff5dc;
}

.cf-status-select.partial {
    color: #285bb5;
    background: #e8f0ff;
}

.cf-status-select.overdue {
    color: #b42318;
    background: #fdecec;
}


/* ------------------------------------------------------------
   THREE-DOT MENU WITH ICONS
   ------------------------------------------------------------ */

.cf-invoice-dropdown {
    min-width: 165px;
    padding: 6px;
}

.cf-invoice-dropdown button {
    display: flex;
    align-items: center;
    gap: 11px;

    width: 100%;
    padding: 11px 12px;

    border: 0;
    border-radius: 7px;

    background: transparent;

    color: #344054;
    font-size: 13px;
    font-weight: 600;
    text-align: left;

    cursor: pointer;
}

.cf-menu-icon {
    display: block;
    flex-shrink: 0;

    width: 17px;
    height: 17px;
}

.cf-menu-divider {
    height: 1px;
    margin: 5px 4px;
    background: #edf0f4;
}

.cf-invoice-dropdown .cf-delete-action {
    color: #dc2626;
}


/* ------------------------------------------------------------
   MOBILE RESPONSIVENESS
   ------------------------------------------------------------ */

@media (max-width: 600px) {

    .cf-create-full {
        min-height: 44px;
        margin-top: 14px;
        margin-bottom: 19px;
        padding: 11px 14px;
        font-size: 14px;
    }

    .cf-status-select {
        padding: 5px 18px 5px 7px;
        font-size: 11px;
    }

    .cf-status-wrap::after {
        right: 6px;
        width: 5px;
        height: 5px;
    }

    .cf-invoice-dropdown {
        min-width: 150px;
    }

    .cf-invoice-dropdown button {
        padding: 10px;
        gap: 9px;
        font-size: 12px;
    }

}


/* ------------------------------------------------------------
   EXTRA-SMALL PHONES
   ------------------------------------------------------------ */

@media (max-width: 370px) {

    .cf-status-select {
        padding: 5px 16px 5px 5px;
        font-size: 10px;
    }

    .cf-status-wrap::after {
        right: 5px;
    }

}


/* ============================================================
   CHIFRANDO INVOICE - UPDATE 0.0.09
   ============================================================ */


/* BUSINESS LOGO UPLOAD */

.cf-upload-field {
    margin-top: 22px;
}

.cf-upload-field input[type="file"] {
    margin: 12px 0;
}

.cf-upload-box {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 120px;
    padding: 16px;

    border: 1px dashed #c8d3e5;
    border-radius: 10px;

    background: #f8faff;
}

.cf-upload-preview {
    display: block;
    max-width: 100%;
    max-height: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
}


/* INVOICE IMAGE UPLOAD */

.cf-invoice-image-preview {
    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 80px;
    margin: 12px 0;
    padding: 12px;

    border: 1px dashed #d7dce5;
    border-radius: 9px;

    background: #fafbfc;
}


/* BUSINESS HEADER ON INVOICE */

.cf-business-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.cf-business-details {
    min-width: 0;
    overflow-wrap: anywhere;
}

.cf-invoice-logo {
    display: block;
    flex-shrink: 0;

    width: 65px;
    max-height: 65px;

    object-fit: contain;
}

.cf-invoice-heading {
    text-align: right;
}


/* CUSTOMER INFORMATION */

.cf-invoice-customer-block {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin: 22px 0;
}

.cf-invoice-customer-block > div {
    min-width: 0;
    overflow-wrap: anywhere;
}


/* OPTIONAL INVOICE PHOTO */

.cf-invoice-photo {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    margin: 18px 0;
}

.cf-invoice-photo img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 240px;
    height: auto;

    object-fit: contain;
    border-radius: 6px;
}


/* PAYMENT METHOD AND NOTES */

.cf-invoice-extra {
    margin-top: 35px;
    font-size: 12px;
}

.cf-invoice-text-block {
    margin-bottom: 17px;
}

.cf-invoice-text-block p {
    margin: 7px 0 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}


/* FOOTER TEXT */

.cf-invoice-footer {
    margin-top: 35px;
    padding-top: 15px;

    border-top: 1px solid #eeeeee;

    color: #98a2b3;
    font-size: 11px;
    text-align: center;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}


/* MOBILE */

@media (max-width: 600px) {

    .cf-business-header {
        gap: 8px;
    }

    .cf-invoice-logo {
        width: 45px;
        max-height: 45px;
    }

    .cf-invoice-photo img {
        max-height: 180px;
    }

}


/* PRINT */

@media print {

    .cf-invoice-logo {
        max-height: 18mm;
    }

    .cf-invoice-photo img {
        max-height: 60mm;
    }

    .cf-invoice-photo,
    .cf-invoice-text-block,
    .cf-invoice-footer {
        break-inside: avoid;
        page-break-inside: avoid;
    }

}
/* ============================================================
   CHIFRANDO INVOICE - TEMPLATE SYSTEM
   Version: 0.0.11
   ============================================================ */


/* ============================================================
   SIDEBAR ICON ALIGNMENT
   ============================================================ */

.cf-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 25px;

    margin-right: 4px;

    font-size: 17px;
}


/* ============================================================
   TEMPLATE PAGE
   ============================================================ */

.cf-template-page-title {
    margin-bottom: 16px;
}

.cf-template-intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;

    margin-bottom: 22px;
    padding: 16px 18px;

    border: 1px solid #dce5f2;
    border-radius: 12px;

    background: #f8faff;
}

.cf-template-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 20px;
}

.cf-template-card {
    min-width: 0;

    padding: 18px;

    border: 1px solid #e4e8ef;
    border-radius: 16px;

    background: #ffffff;

    box-shadow:
        0 5px 18px
        rgba(16, 24, 40, 0.04);

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.cf-template-card:hover {
    transform: translateY(-2px);

    box-shadow:
        0 10px 25px
        rgba(16, 24, 40, 0.08);
}

.cf-template-card.selected {
    border: 2px solid #204da7;

    box-shadow:
        0 8px 24px
        rgba(32, 77, 167, 0.12);
}

.cf-template-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;

    margin-bottom: 15px;
}

.cf-template-card h3 {
    margin: 0 0 5px;

    font-size: 17px;
}

.cf-template-card p {
    margin: 0;

    color: #667085;

    font-size: 12px;
    line-height: 1.5;
}

.cf-template-selected-badge {
    flex-shrink: 0;

    padding: 5px 8px;

    border-radius: 20px;

    background: #eaf2ff;
    color: #204da7;

    font-size: 11px;
    font-weight: 700;
}

.cf-template-select-btn {
    width: 100%;

    margin-top: 15px;
}

.cf-template-current-btn {
    border-color: #b9ccef;

    background: #edf3ff;
    color: #204da7;
}


/* ============================================================
   MINI INVOICE TEMPLATE PREVIEWS
   ============================================================ */

.cf-template-preview {
    padding: 18px;

    border-radius: 12px;

    background: #eef1f6;
}

.cf-template-paper {
    width: 100%;
    min-height: 360px;

    padding: 24px;

    background: #ffffff;

    box-shadow:
        0 5px 18px
        rgba(16, 24, 40, 0.08);

    font-size: 8px;
}

.cf-mini-invoice-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;

    padding-bottom: 12px;

    border-bottom: 2px solid #204da7;
}

.cf-mini-brand {
    font-size: 13px;
    font-weight: 800;
}

.cf-mini-small {
    margin-top: 3px;

    color: #8490a3;

    font-size: 7px;
}

.cf-mini-invoice-label {
    color: #204da7;

    font-size: 15px;
    font-weight: 800;

    text-align: right;
}

.cf-mini-invoice-label small {
    display: block;

    margin-top: 4px;

    color: #334155;

    font-size: 7px;
}

.cf-mini-customer {
    display: flex;
    justify-content: space-between;
    gap: 12px;

    margin: 18px 0;
}

.cf-mini-customer div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cf-mini-customer span {
    color: #94a3b8;

    font-size: 6px;
}

.cf-mini-table {
    width: 100%;

    border-bottom: 1px solid #e5e7eb;
}

.cf-mini-table-head,
.cf-mini-table-row {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        35px
        72px;

    gap: 6px;

    padding: 7px;
}

.cf-mini-table-head {
    background: #204da7;
    color: #ffffff;

    font-weight: 700;
}

.cf-mini-table-row {
    border-bottom: 1px solid #edf0f4;

    color: #475569;
}

.cf-mini-table-head span:nth-child(2),
.cf-mini-table-row span:nth-child(2) {
    text-align: center;
}

.cf-mini-table-head span:last-child,
.cf-mini-table-row span:last-child {
    text-align: right;
}

.cf-mini-total {
    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 120px;

    margin-top: 18px;
    margin-left: auto;

    padding-top: 8px;

    border-top: 2px solid #204da7;
}

.cf-mini-total strong {
    color: #204da7;

    font-size: 10px;
}

.cf-mini-footer {
    margin-top: 45px;
    padding-top: 10px;

    border-top: 1px solid #edf0f4;

    color: #98a2b3;

    font-size: 7px;
    text-align: center;
}


/* ============================================================
   MINI PREVIEW - MODERN
   ============================================================ */

.cf-template-preview-modern
.cf-template-paper {
    border-radius: 10px;
}

.cf-template-preview-modern
.cf-mini-invoice-head {
    padding: 15px;

    border: 0;
    border-radius: 8px;

    background: #f0f5ff;
}

.cf-template-preview-modern
.cf-mini-table-head {
    border-radius: 5px;

    background: #172b4d;
}

.cf-template-preview-modern
.cf-mini-total {
    padding: 9px;

    border: 0;
    border-radius: 5px;

    background: #204da7;
    color: #ffffff;
}

.cf-template-preview-modern
.cf-mini-total strong {
    color: #ffffff;
}


/* ============================================================
   MINI PREVIEW - MINIMAL
   ============================================================ */

.cf-template-preview-minimal
.cf-mini-invoice-head {
    border-bottom: 1px solid #111827;
}

.cf-template-preview-minimal
.cf-mini-invoice-label {
    color: #111827;
}

.cf-template-preview-minimal
.cf-mini-table-head {
    border-top: 1px solid #111827;
    border-bottom: 1px solid #111827;

    background: transparent;
    color: #111827;
}

.cf-template-preview-minimal
.cf-mini-total {
    border-color: #111827;
}

.cf-template-preview-minimal
.cf-mini-total strong {
    color: #111827;
}


/* ============================================================
   MINI PREVIEW - PROFESSIONAL
   ============================================================ */

.cf-template-preview-professional
.cf-mini-invoice-head {
    margin: -24px -24px 18px;
    padding: 22px 24px;

    border: 0;

    background: #204da7;
    color: #ffffff;
}

.cf-template-preview-professional
.cf-mini-small,
.cf-template-preview-professional
.cf-mini-invoice-label,
.cf-template-preview-professional
.cf-mini-invoice-label small {
    color: rgba(
        255,
        255,
        255,
        0.85
    );
}

.cf-template-preview-professional
.cf-mini-table-head {
    background: #204da7;
}


/* ============================================================
   ACTUAL INVOICE - COMMON
   ============================================================ */

.cf-invoice-template {
    overflow: hidden;
}

.cf-invoice-template .invoice-head {
    transition: none;
}

.cf-invoice-document-number {
    display: block;

    margin: 3px 0;
}

.cf-bill-name {
    margin: 3px 0;
}


/* ============================================================
   CLASSIC TEMPLATE
   ============================================================ */

.cf-template-classic .invoice-head {
    border-bottom:
        3px solid #204da7;
}

.cf-template-classic .invoice-label {
    color: #204da7;
}

.cf-template-classic
.invoice-table th {
    background: #204da7;
    color: #ffffff;
}

.cf-template-classic
.totals .grand {
    color: #204da7;
}


/* ============================================================
   MODERN TEMPLATE
   ============================================================ */

.cf-template-modern {
    border-radius: 8px;
}

.cf-template-modern .invoice-head {
    padding: 22px;

    border: 0;
    border-radius: 10px;

    background:
        linear-gradient(
            135deg,
            #f4f7ff,
            #edf3ff
        );
}

.cf-template-modern
.invoice-label {
    color: #204da7;
}

.cf-template-modern
.cf-invoice-customer-block {
    padding: 17px;

    border: 1px solid #e5ebf5;
    border-radius: 10px;

    background: #fafcff;
}

.cf-template-modern
.invoice-table {
    border-radius: 8px;

    overflow: hidden;
}

.cf-template-modern
.invoice-table th {
    background: #172b4d;
    color: #ffffff;
}

.cf-template-modern
.totals .grand {
    margin-top: 5px;
    padding: 12px;

    border-radius: 8px;

    background: #204da7;
    color: #ffffff;
}

.cf-template-modern
.cf-invoice-footer {
    border-top:
        2px solid #edf2fb;
}


/* ============================================================
   MINIMAL TEMPLATE
   ============================================================ */

.cf-template-minimal {
    color: #111827;
}

.cf-template-minimal
.invoice-head {
    border-bottom:
        1px solid #111827;
}

.cf-template-minimal
.invoice-label {
    color: #111827;

    font-weight: 700;
}

.cf-template-minimal
.invoice-table th {
    border-top:
        1px solid #111827;

    border-bottom:
        1px solid #111827;

    background: transparent;
    color: #111827;
}

.cf-template-minimal
.invoice-table td {
    border-bottom:
        1px solid #e5e7eb;
}

.cf-template-minimal
.totals .grand {
    color: #111827;

    border-top:
        2px solid #111827;
}

.cf-template-minimal
.status {
    border:
        1px solid currentColor;

    background: transparent;
}

.cf-template-minimal
.cf-invoice-footer {
    color: #6b7280;

    border-color: #111827;
}


/* ============================================================
   PROFESSIONAL TEMPLATE
   ============================================================ */

.cf-template-professional {
    padding-top: 0;
}

.cf-template-professional
.invoice-head {
    margin:
        -42px
        -42px
        0;

    padding:
        34px
        42px
        28px;

    border: 0;

    background:
        linear-gradient(
            135deg,
            #173c82,
            #204da7
        );

    color: #ffffff;
}

.cf-template-professional
.invoice-head .muted {
    color:
        rgba(
            255,
            255,
            255,
            0.78
        );
}

.cf-template-professional
.invoice-label {
    color: #ffffff;
}

.cf-template-professional
.cf-invoice-logo {
    padding: 4px;

    border-radius: 6px;

    background: #ffffff;
}

.cf-template-professional
.cf-invoice-customer-block {
    padding: 20px 0;

    border-bottom:
        1px solid #e5e7eb;
}

.cf-template-professional
.invoice-table th {
    background: #204da7;
    color: #ffffff;
}

.cf-template-professional
.totals {
    padding: 14px;

    border-radius: 8px;

    background: #f5f8ff;
}

.cf-template-professional
.totals .grand {
    color: #204da7;

    border-top:
        2px solid #204da7;
}

.cf-template-professional
.cf-invoice-footer {
    border-top:
        2px solid #204da7;
}


/* ============================================================
   MOBILE TEMPLATE PAGE
   ============================================================ */

@media (max-width: 800px) {

    .cf-template-grid {
        grid-template-columns:
            minmax(0, 1fr);
    }

    .cf-template-intro {
        flex-direction: column;
    }

}


/* ============================================================
   SMALL MOBILE
   ============================================================ */

@media (max-width: 450px) {

    .cf-template-card {
        padding: 12px;
    }

    .cf-template-preview {
        padding: 10px;
    }

    .cf-template-paper {
        min-height: 300px;

        padding: 16px;
    }

    .cf-template-preview-professional
    .cf-mini-invoice-head {
        margin:
            -16px
            -16px
            16px;

        padding:
            18px
            16px;
    }

}


/* ============================================================
   PRINT TEMPLATE COLORS
   ============================================================ */

@media print {

    .cf-invoice-template,
    .cf-invoice-template * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .cf-template-professional
    .invoice-head {
        margin:
            -42px
            -42px
            0;
    }

}

/* ============================================================
   CHIFRANDO INVOICE - MOBILE FOOTER MENU
   Version: 0.0.12
   ============================================================ */

/* Hidden on desktop */

.cf-bottom-nav {
    display: none;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 800px) {

    /* Give page enough space above footer */

    .content {
        padding-bottom:
            calc(
                100px +
                env(safe-area-inset-bottom)
            );
    }


    /* FOOTER BAR */

    .cf-bottom-nav {
        position: fixed;

        left: 0;
        right: 0;
        bottom: 0;

        z-index: 180;

        display: grid;

        grid-template-columns:
            repeat(5, minmax(0, 1fr));

        align-items: end;

        min-height: 68px;

        padding:
            7px
            5px
            calc(
                7px +
                env(safe-area-inset-bottom)
            );

        border-top:
            1px solid #e6eaf0;

        background:
            rgba(255, 255, 255, 0.97);

        box-shadow:
            0 -5px 20px
            rgba(16, 24, 40, 0.08);

        backdrop-filter:
            blur(12px);

        -webkit-backdrop-filter:
            blur(12px);
    }


    /* FOOTER ITEM */

    .cf-bottom-nav-item {
        position: relative;

        display: flex;
        flex-direction: column;

        align-items: center;
        justify-content: center;

        gap: 4px;

        min-width: 0;
        min-height: 53px;

        padding: 5px 2px;

        border: 0;

        background: transparent;

        color: #7b8798;

        font-family: inherit;

        transition:
            color 0.2s ease,
            transform 0.2s ease;
    }


    /* LABEL */

    .cf-bottom-nav-item > span:last-child {
        display: block;

        width: 100%;

        font-size: 10px;
        font-weight: 600;

        line-height: 1.15;

        text-align: center;

        white-space: nowrap;

        overflow: hidden;
        text-overflow: ellipsis;
    }


    /* ICON */

    .cf-bottom-icon {
        display: block;

        flex-shrink: 0;

        width: 22px;
        height: 22px;
    }


    /* ACTIVE PAGE */

    .cf-bottom-nav-item.active {
        color: #204da7;
    }


    .cf-bottom-nav-item.active::after {
        content: "";

        position: absolute;

        bottom: 0;

        width: 20px;
        height: 2px;

        border-radius: 5px;

        background: #204da7;
    }


    /* ========================================================
       CENTER CREATE BUTTON
       ======================================================== */

    .cf-bottom-create {
        margin-top: -20px;
    }


    .cf-bottom-create-icon {
        display: flex !important;

        align-items: center;
        justify-content: center;

        width: 48px !important;
        height: 48px;

        margin-bottom: 1px;

        border: 4px solid #ffffff;

        border-radius: 50%;

        background: #204da7;

        color: #ffffff;

        box-shadow:
            0 5px 15px
            rgba(32, 77, 167, 0.3);
    }


    .cf-bottom-create-icon
    .cf-bottom-icon {
        width: 24px;
        height: 24px;

        stroke-width: 2.2;
    }


    .cf-bottom-create.active
    .cf-bottom-create-icon {
        background: #173d87;
    }


    .cf-bottom-create.active::after {
        display: none;
    }


    /* PRESS EFFECT */

    .cf-bottom-nav-item:active {
        transform: scale(0.94);
    }

}


/* ============================================================
   VERY SMALL PHONES
   ============================================================ */

@media (max-width: 360px) {

    .cf-bottom-nav {
        padding-left: 2px;
        padding-right: 2px;
    }


    .cf-bottom-nav-item > span:last-child {
        font-size: 9px;
    }


    .cf-bottom-icon {
        width: 20px;
        height: 20px;
    }


    .cf-bottom-create-icon {
        width: 45px !important;
        height: 45px;
    }

}


/* ============================================================
   PRINT
   ============================================================ */

@media print {

    .cf-bottom-nav {
        display: none !important;
    }

}