* {
    box-sizing: border-box
}

/* ================= PAGE ================= */
.inv-page {
    padding: 14px;
}

/* ================= HEAD ================= */
.inv-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.inv-title {
    font-size: 22px;
    font-weight: 800;
    margin: 0;
    line-height: 1.3;
}

.inv-sub {
    color: #64748b;
    font-size: 13px;
    margin-top: 4px;
    line-height: 1.5;
}

/* ================= SECTIONS ================= */
.inv-section {
    margin: 16px 0;
}

.inv-section h4 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 800;
    color: #334155;
}

/* ================= GRIDS ================= */
.inv-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

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

/* ================= CARDS ================= */
.card {
    border-radius: 16px;
    padding: 14px;
    color: #fff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .08);
    transition: .2s ease;
    cursor: pointer;
    min-width: 0;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, .15);
}

.card small {
    font-size: 12px;
    opacity: .85;
    line-height: 1.5;
}

.card b {
    font-size: 18px;
    display: block;
    margin-top: 6px;
    font-weight: 800;
    line-height: 1.4;
    word-break: break-word;
}

/* ========= COLORS ========= */
.card-primary {
    background: linear-gradient(135deg, #2563eb, #1e3a8a);
}

.card-success {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.card-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.card-danger {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.card-purple {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
}

.card-payment {
    background: #1e293b;
}

/* ================= FILTERS ================= */
.inv-filters {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: end;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .04);
}

.inv-filters .f {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 160px;
    flex: 1 1 180px;
}

.inv-filters label {
    font-size: 12px;
    color: #475569;
    font-weight: 700;
}

.inv-filters input,
.inv-filters select {
    height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 0 12px;
    background: #fff;
    outline: none;
    width: 100%;
}

.inv-filters .actions {
    display: flex;
    gap: 8px;
    min-width: 220px;
    flex-wrap: wrap;
}

.btnx {
    height: 42px;
    border-radius: 12px;
    padding: 0 14px;
    border: 1px solid #0f172a;
    background: #0f172a;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    white-space: nowrap;
}

.btnx.secondary {
    background: #fff;
    color: #0f172a;
    border: 1px solid #cbd5e1;
}

.btnx:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* ================= TABLE ================= */
.inv-table-wrap {
    margin-top: 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
}

.inv-table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.inv-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

.inv-table th,
.inv-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #eef2f7;
    font-size: 13px;
    vertical-align: middle;
    white-space: nowrap;
}

.inv-table th {
    background: #f1f5f9;
    color: #334155;
    font-weight: 800;
    text-align: right;
    position: sticky;
    top: 0;
    z-index: 1;
}

.inv-table td {
    color: #0f172a;
}

.muted {
    color: #64748b;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    font-size: 12px;
    background: #fff;
    white-space: nowrap;
}

.row-actions {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    white-space: nowrap;
    flex-wrap: nowrap;
}

.a-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
    cursor: pointer;
    text-decoration: none;
    font-size: 12px;
    transition: .15s;
    white-space: nowrap;
}

.a-btn.primary {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
}

.a-btn.danger {
    background: #fff;
    color: #b91c1c;
    border-color: #fecaca;
}

.a-btn:hover {
    transform: translateY(-1px);
}

.inv-foot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 18px 12px 70px;
    background: #fff;
    position: relative;
    z-index: 1;
}

.pager {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.pager button {
    height: 36px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #fff;
    cursor: pointer;
    padding: 0 12px;
}

.pager button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.right-summary {
    color: #475569;
    font-size: 13px;
    text-align: center;
}

/* ================= MODAL ================= */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, .45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
    z-index: 9999;
}

.modal {
    width: min(560px, 100%);
    max-height: 90vh;
    overflow: auto;
    background: #fff;
    border-radius: 18px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 22px 60px rgba(2, 6, 23, .25);
}

.modal .m-head {
    padding: 14px;
    background: #f8fafc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.modal .m-head b {
    font-size: 14px;
    line-height: 1.4;
}

.modal .m-body {
    padding: 16px;
    display: grid;
    gap: 12px;
}

.modal .m-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.modal .m-row .f {
    flex: 1 1 180px;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal input,
.modal select,
.modal textarea {
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 10px;
    outline: none;
    width: 100%;
}

.modal textarea {
    min-height: 80px;
    resize: vertical;
}

.modal .m-foot {
    padding: 14px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    border-top: 1px solid #eef2f7;
    flex-wrap: wrap;
}

.xclose {
    cursor: pointer;
    border: 0;
    background: transparent;
    font-size: 18px;
    flex: 0 0 auto;
}

/* ================= RESPONSIVE ================= */
@media (max-width:1200px) {
    .inv-grid-5 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    table.inv-table {
        min-width: 900px;
    }
}

@media (max-width:900px) {
    .inv-page {
        padding: 12px;
    }

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

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

    .inv-filters .f {
        flex: 1 1 calc(50% - 10px);
        min-width: unset;
    }

    .inv-filters .actions {
        width: 100%;
        min-width: unset;
    }

    .btnx {
        flex: 1 1 auto;
    }

    table.inv-table {
        min-width: 820px;
    }
}

@media (max-width:640px) {
    .inv-page {
        padding: 10px;
    }

    .inv-head {
        align-items: stretch;
        flex-direction: column;
    }

    .inv-title {
        font-size: 19px;
    }

    .inv-sub {
        font-size: 12px;
    }

    .card {
        padding: 12px;
        border-radius: 14px;
    }

    .card b {
        font-size: 16px;
    }

    .inv-grid-4,
    .inv-grid-5 {
        grid-template-columns: 1fr;
    }

    .inv-filters {
        padding: 12px;
        border-radius: 14px;
    }

    .inv-filters .f {
        flex: 1 1 100%;
    }

    .inv-filters .actions {
        flex-direction: column;
        width: 100%;
    }

    .btnx {
        width: 100%;
    }

    table.inv-table {
        min-width: 760px;
    }

    .inv-table th,
    .inv-table td {
        font-size: 12px;
        padding: 10px 8px;
    }

    .a-btn {
        height: 30px;
        padding: 0 10px;
        font-size: 11px;
    }

    .pill {
        font-size: 11px;
        padding: 4px 8px;
    }

    .modal {
        width: 100%;
        border-radius: 16px;
    }

    .modal .m-body {
        padding: 12px;
    }

    .modal .m-row {
        flex-direction: column;
    }

    .modal .m-row .f {
        min-width: 100%;
    }

    .modal .m-foot {
        justify-content: stretch;
        flex-direction: column;
    }

    .modal .m-foot .btnx {
        width: 100%;
    }

    .right-summary {
        font-size: 12px;
    }
}

@media (max-width:420px) {
    .inv-page {
        padding: 8px;
    }

    .card {
        padding: 10px;
    }

    .card b {
        font-size: 15px;
    }

    .inv-title {
        font-size: 17px;
    }

    table.inv-table {
        min-width: 700px;
    }

    .inv-table th,
    .inv-table td {
        font-size: 11.5px;
        padding: 9px 7px;
    }
}


.invoice-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    min-width: 260px;
    max-width: 420px;
    width: fit-content;
    padding: 14px 18px;
    border-radius: 14px;
    color: #fff;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 14px 35px rgba(0, 0, 0, .18);
    z-index: 100001;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all .25s ease;
    line-height: 1.7;
}

.invoice-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.invoice-toast.success {
    background: linear-gradient(135deg, #16a34a, #22c55e);
}

.invoice-toast.error {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

.invoice-toast.warning {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

.invoice-toast.info {
    background: linear-gradient(135deg, #0f4c81, #2563eb);
}

.invoice-msg-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    padding: 20px;
    backdrop-filter: blur(3px);
}

.invoice-msg-modal.show {
    display: flex;
}

.invoice-msg-box {
    width: 100%;
    max-width: 460px;
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, .22);
    overflow: hidden;
    animation: invoicePopIn .2s ease;
}

@keyframes invoicePopIn {
    from {
        transform: scale(.96) translateY(8px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.invoice-msg-head {
    padding: 18px 20px 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.invoice-msg-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.invoice-msg-confirm .invoice-msg-icon {
    background: #fff7ed;
    color: #ea580c;
}

.invoice-msg-alert .invoice-msg-icon {
    background: #eff6ff;
    color: #2563eb;
}

.invoice-msg-danger .invoice-msg-icon {
    background: #fef2f2;
    color: #dc2626;
}

.invoice-msg-title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
}

.invoice-msg-body {
    padding: 0 20px 10px;
    color: #475569;
    font-size: 15px;
    line-height: 1.9;
}

.invoice-msg-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 20px 20px;
}

.invoice-msg-btn {
    border: none;
    border-radius: 12px;
    padding: 11px 18px;
    font-weight: 800;
    cursor: pointer;
    min-width: 96px;
    transition: .2s ease;
}

.invoice-msg-btn:hover {
    transform: translateY(-1px);
}

.invoice-msg-btn.primary {
    background: linear-gradient(135deg, #0f4c81, #2563eb);
    color: #fff;
}

.invoice-msg-btn.danger {
    background: linear-gradient(135deg, #b91c1c, #ef4444);
    color: #fff;
}

.invoice-msg-btn.secondary {
    background: #eef2f7;
    color: #334155;
}

@media (max-width:640px) {
    .invoice-msg-actions {
        flex-direction: column;
    }

    .invoice-msg-btn {
        width: 100%;
    }
}