.kas2-tabs {
    display: flex;
    gap: 0;
    border: 1px solid rgba(201, 168, 76, 0.2);
    width: fit-content;
    margin-bottom: 2.5rem;
    overflow: hidden;
}

.kas2-tab {
    padding: 0.65rem 1.6rem;
    background: transparent;
    border: none;
    border-right: 1px solid rgba(201, 168, 76, 0.15);
    color: rgba(250, 250, 250, 0.4);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.22s;
    white-space: nowrap;
}

.kas2-tab:last-child {
    border-right: none;
}

.kas2-tab.active {
    background: var(--gold);
    color: #1A1A1A;
    font-weight: 700;
}

.kas2-tab:hover:not(.active) {
    color: var(--gold);
}

.kas2-panel {
    display: none;
}

.kas2-panel.active {
    display: block;
}

.kas2-rekap-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.2rem;
    margin-bottom: 2.5rem;
}

.kas2-card-saldo::before {
    background: #2ecc71;
}

.kas2-card-nama::before {
    background: var(--gold);
}

.kas2-card-masuk::before {
    background: #3498db;
}

.kas2-card-keluar::before {
    background: #e74c3c;
}

.kas2-card {
    position: relative;
    border: 1px solid rgba(250, 250, 250, 0.07);
    padding: 1.2rem 1.4rem;
    background: rgba(250, 250, 250, 0.02);
    border-radius: 12px;
    box-sizing: border-box;
}

.kas2-card::before {
    content: '';
    position: absolute;
    top: 1.1rem;
    left: 1.1rem;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.kas2-card-lbl {
    color: rgba(250, 250, 250, 0.6);
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 1.5px;
    margin-bottom: 0.6rem;
    padding-left: 0.8rem;
}

.kas2-card-val {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    word-wrap: break-word;
}

.kas2-card-sub {
    font-size: 0.78rem;
    color: rgba(250, 250, 250, 0.55);
}

.kas2-progress-wrap {
    margin-top: 1rem;
}

.kas2-progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    font-size: 0.85rem;
    color: rgba(250, 250, 250, 0.7);
}

.kas2-progress-bar {
    width: 100%;
    height: 16px;
    border-radius: 999px;
    background: rgba(250, 250, 250, 0.08);
    overflow: hidden;
}

.kas2-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--gold), #f5e4a0);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.kas2-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kas2-section-total {
    font-size: 1.45rem;
    font-weight: 700;
}

.kas2-add-btn {
    background: transparent;
    border: 1px solid rgba(250, 250, 250, 0.2);
    color: var(--gold);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.kas2-add-btn:hover {
    background: rgba(201, 168, 76, 0.1);
}

.kas2-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
}

.kas2-table-head {
    display: grid;
    grid-template-columns: 120px 2fr 120px 100px;
    gap: 1rem;
    align-items: center;
    padding: 0.9rem 1rem;
    background: rgba(250, 250, 250, 0.03);
    border-radius: 14px;
    color: rgba(250, 250, 250, 0.7);
    font-size: 0.82rem;
    margin-bottom: 1rem;
    min-width: 550px;
}

.kas2-table-body {
    display: grid;
    gap: 0.9rem;
    min-width: 550px;
}

.kas2-row {
    display: grid;
    grid-template-columns: 120px 2fr 120px 100px;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid rgba(250, 250, 250, 0.08);
    border-radius: 16px;
    transition: background 0.2s;
}

.kas2-row:hover {
    background: rgba(250, 250, 250, 0.05);
}

.kas2-tgl,
.kas2-ket,
.kas2-kat,
.kas2-nominal {
    color: rgba(250, 250, 250, 0.85);
}

.kas2-del,
.kas2-edit {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(250, 250, 250, 0.12);
    color: rgba(250, 250, 250, 0.8);
    border-radius: 10px;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
}

.kas2-del:hover,
.kas2-edit:hover {
    background: rgba(201, 168, 76, 0.12);
}

.kas2-empty {
    text-align: center;
    color: rgba(250, 250, 250, 0.4);
    padding: 2rem;
}

.kas2-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999;
    padding: 1rem;
}

.kas2-modal-overlay.open {
    display: flex;
}

.kas2-modal-box {
    background: #1e1e1e;
    border: 1px solid rgba(250, 250, 250, 0.1);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
}

.kas2-modal-sub {
    color: rgba(250, 250, 250, 0.6);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.kas2-modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.kas2-inputs {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.kas2-inputs input,
.kas2-inputs select,
.kas2-inputs textarea {
    background: rgba(250, 250, 250, 0.04);
    border: 1px solid rgba(250, 250, 250, 0.12);
    color: #fff;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.kas2-inputs input:focus,
.kas2-inputs select:focus {
    border-color: rgba(201, 168, 76, 0.5);
}

.kas2-inputs select option {
    background: #1A1A1A;
    color: #fff;
}

.kas2-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.kas2-admin-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

#kas2-admin-btn,
#kas2-report-btn {
    border: 1px solid rgba(250, 250, 250, 0.12);
    background: transparent;
    color: #fff;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s;
    flex: 1;
    text-align: center;
    min-width: 120px;
}

#kas2-report-btn:hover {
    background: rgba(201, 168, 76, 0.14);
}

.ir-summary-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.ir-summary-card {
    background: rgba(250, 250, 250, 0.04);
    border: 1px solid rgba(250, 250, 250, 0.08);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    text-align: center;
}

.ir-summary-val {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-serif, serif);
    margin-bottom: 0.2rem;
}

.ir-summary-lbl {
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(250, 250, 250, 0.4);
}

.ir-card-lunas {
    border-color: rgba(46, 204, 113, 0.25);
}

.ir-card-lunas .ir-summary-val {
    color: #2ecc71;
}

.ir-card-cicil {
    border-color: rgba(201, 168, 76, 0.25);
}

.ir-card-cicil .ir-summary-val {
    color: #C9A84C;
}

.ir-card-belum {
    border-color: rgba(231, 76, 60, 0.25);
}

.ir-card-belum .ir-summary-val {
    color: #e74c3c;
}

.ir-card-total {
    border-color: rgba(52, 152, 219, 0.25);
}

.ir-card-total .ir-summary-val {
    color: #3498db;
    font-size: 1.1rem;
}

.ir-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1rem;
}

.ir-filter-bar input {
    flex: 1;
    min-width: 200px;
    background: rgba(250, 250, 250, 0.05);
    border: 1px solid rgba(250, 250, 250, 0.12);
    border-radius: 10px;
    color: #fafafa;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    outline: none;
    transition: border-color .2s;
}

.ir-filter-bar input:focus {
    border-color: var(--gold);
}

.ir-filter-status {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.ir-filter-btn {
    background: rgba(250, 250, 250, 0.05);
    border: 1px solid rgba(250, 250, 250, 0.1);
    border-radius: 8px;
    color: rgba(250, 250, 250, 0.5);
    padding: 0.45rem 0.85rem;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all .2s;
}

.ir-filter-btn.active,
.ir-filter-btn:hover {
    background: rgba(201, 168, 76, 0.15);
    border-color: rgba(201, 168, 76, 0.4);
    color: #C9A84C;
}

.ir-table-wrap {
    border: 1px solid rgba(250, 250, 250, 0.1);
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ir-table-head,
.ir-table-row {
    display: grid;
    grid-template-columns: 100px 2fr 140px 110px;
    align-items: center;
    font-size: 0.82rem;
    min-width: 600px;
}

.ir-table-head.with-aksi,
.ir-table-row.with-aksi {
    grid-template-columns: 100px 2fr 140px 110px 100px;
}

.ir-table-head>span,
.ir-table-row>span {
    padding: 0.75rem 1rem;
    border-right: 1px solid rgba(250, 250, 250, 0.08);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ir-table-head>span:last-child,
.ir-table-row>span:last-child {
    border-right: none;
}

.ir-table-head {
    background: rgba(201, 168, 76, 0.08);
    border-bottom: 1px solid rgba(201, 168, 76, 0.2);
    color: #C9A84C;
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 600;
}

.ir-table-row {
    border-bottom: 1px solid rgba(250, 250, 250, 0.07);
    transition: background .15s;
}

.ir-table-row:last-child {
    border-bottom: none;
}

.ir-table-row:hover {
    background: rgba(250, 250, 250, 0.04) !important;
}

.ir-table-row.lunas {
    background: rgba(46, 204, 113, 0.05);
}

.ir-table-row.lunas>span {
    border-right-color: rgba(46, 204, 113, 0.1);
}

.ir-table-row.cicil {
    background: rgba(201, 168, 76, 0.05);
}

.ir-table-row.cicil>span {
    border-right-color: rgba(201, 168, 76, 0.1);
}

.ir-table-row.belum {
    background: rgba(250, 250, 250, 0.015);
}

.ir-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.ir-badge.lunas {
    background: rgba(46, 204, 113, 0.18);
    color: #2ecc71;
}

.ir-badge.cicil {
    background: rgba(201, 168, 76, 0.18);
    color: #C9A84C;
}

.ir-badge.belum {
    background: rgba(231, 76, 60, 0.12);
    color: #e74c3c;
}

.ir-edit-btn,
.ir-del-btn {
    border-radius: 7px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all .2s;
}

.ir-edit-btn {
    background: rgba(201, 168, 76, 0.1);
    border: 1px solid rgba(201, 168, 76, 0.25);
    color: #C9A84C;
    padding: 0.3rem 0.65rem;
}

.ir-edit-btn:hover {
    background: rgba(201, 168, 76, 0.22);
}

.ir-del-btn {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.25);
    color: #e74c3c;
    padding: 0.3rem 0.55rem;
}

.ir-del-btn:hover {
    background: rgba(231, 76, 60, 0.22);
}

.ir-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
    padding: 1rem;
}

.ir-modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.ir-modal-box {
    background: #1e1e1e;
    border: 1px solid rgba(250, 250, 250, 0.1);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 380px;
    margin: 1rem;
    box-sizing: border-box;
}

.ir-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: #C9A84C;
}

.ir-modal-box label {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(250, 250, 250, 0.4);
    margin-bottom: 0.3rem;
    margin-top: 0.9rem;
}

.ir-modal-box input {
    width: 100%;
    background: rgba(250, 250, 250, 0.05);
    border: 1px solid rgba(250, 250, 250, 0.12);
    border-radius: 9px;
    color: #fafafa;
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color .2s;
}

.ir-modal-box input:focus {
    border-color: #C9A84C;
}

.ir-modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

.ir-aksi-col {
    display: flex;
    gap: 0.3rem;
}

.ir-summary-sub {
    font-size: 0.65rem;
    color: rgba(250, 250, 250, 0.3);
    margin-top: 0.15rem;
}

@media (max-width: 900px) {
    .kas2-rekap-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .kas2-tabs {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
        width: 100%;
        border: none;
        overflow: visible;
    }
    .kas2-tab {
        width: 100%;
        text-align: center;
        font-size: 0.75rem;
        padding: 0.65rem 0.5rem;
        border: 1px solid rgba(201, 168, 76, 0.2);
        border-radius: 8px;
    }
    .kas2-tab:last-child {
        border-right: 1px solid rgba(201, 168, 76, 0.2);
    }
    .kas2-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .kas2-add-btn {
        width: 100%;
        text-align: center;
    }
    /* ==========================================================================
       PERBAIKAN REKAP GRID & SUMMARY CARD (Ubah ke 1 Kolom agar Angka Tidak Jebol)
       ========================================================================== */
    .kas2-rekap-grid,
    .ir-summary-row {
        grid-template-columns: 1fr !important;
        /* Diubah ke 1 kolom penuh di mobile */
        gap: 0.8rem;
    }
    .kas2-card {
        padding: 1.2rem 1.2rem 1.2rem 2.2rem;
    }
    .kas2-card::before {
        top: 1.3rem;
        left: 1rem;
    }
    .kas2-card-val {
        font-size: 1.5rem;
        /* Ukuran teks nominal disesuaikan */
        white-space: normal;
        word-break: break-all;
    }
    .ir-summary-val {
        font-size: 1.3rem;
    }
    .ir-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .ir-filter-bar input {
        width: 100%;
    }
    .ir-filter-status {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        width: 100%;
    }
    .ir-filter-btn {
        text-align: center;
    }
    /* ==========================================================================
       PERBAIKAN TRANSFORMAST TABEL KAS (PEMASUKAN & PENGELUARAN)
       ========================================================================== */
    .kas2-table-wrap {
        border: none;
        overflow-x: visible;
    }
    .kas2-table-head {
        display: none;
    }
    .kas2-table-body {
        min-width: unset;
        gap: 0.8rem;
    }
    .kas2-row {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.60rem;
        background: rgba(250, 250, 250, 0.02);
        padding: 1.2rem;
        border-radius: 14px;
        min-width: unset;
        box-sizing: border-box;
        width: 100%;
    }
    /* Memaksa elemen di dalam baris berformat Flexbox Kiri-Kanan */
    .kas2-row>div,
    .kas2-row>span {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        font-size: 0.85rem;
        box-sizing: border-box;
        padding: 0 !important;
        border: none !important;
    }
    /* Penataan Teks Label Otomatis (Sisi Kiri) */
    .kas2-tgl::before {
        content: "Tanggal";
        color: rgba(250, 250, 250, 0.4);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .kas2-ket::before {
        content: "Keterangan";
        color: rgba(250, 250, 250, 0.4);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .kas2-kat::before {
        content: "Kategori";
        color: rgba(250, 250, 250, 0.4);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .kas2-nominal::before {
        content: "Nominal";
        color: rgba(250, 250, 250, 0.4);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    /* Bagian tombol aksi di dalam list kas */
    .kas2-row>div:last-child {
        margin-top: 0.6rem;
        padding-top: 0.8rem !important;
        border-top: 1px solid rgba(250, 250, 250, 0.08) !important;
        justify-content: flex-end !important;
        gap: 0.6rem;
    }
    /* ==========================================================================
       PERBAIKAN TABEL IURAN RUMAH (IR SYSTEM)
       ========================================================================== */
    .ir-table-wrap {
        border: none;
        overflow-x: visible;
    }
    .ir-table-head {
        display: none;
    }
    .ir-table-row {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.60rem;
        padding: 1.2rem;
        border-radius: 14px;
        background: rgba(250, 250, 250, 0.02);
        margin-bottom: 0.8rem;
        min-width: unset;
        box-sizing: border-box;
        width: 100%;
        border: 1px solid rgba(250, 250, 250, 0.08);
    }
    .ir-table-row>span {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0 !important;
        border-right: none !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: unset !important;
        font-size: 0.85rem;
    }
    /* Label Otomatis Berdasarkan Posisi Elemen Anak (Sisi Kiri) */
    .ir-table-row>span:nth-child(1)::before {
        content: "No. Rumah";
        color: rgba(250, 250, 250, 0.4);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .ir-table-row>span:nth-child(2)::before {
        content: "Nama Penghuni";
        color: rgba(250, 250, 250, 0.4);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .ir-table-row>span:nth-child(3)::before {
        content: "Periode";
        color: rgba(250, 250, 250, 0.4);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .ir-table-row>span:nth-child(4)::before {
        content: "Status";
        color: rgba(250, 250, 250, 0.4);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .ir-table-row>.ir-aksi-col {
        margin-top: 0.6rem;
        padding-top: 0.8rem !important;
        border-top: 1px solid rgba(250, 250, 250, 0.08) !important;
        justify-content: flex-end !important;
        width: 100% !important;
    }
}


/* Hapus aturan max-width 380px bawaan yang menimpa grid */

@media (max-width: 380px) {
    .kas2-rekap-grid,
    .ir-summary-row {
        grid-template-columns: 1fr !important;
    }
}