/* =========================================================
   CIPTA MANDIRI FINANCE SYSTEM
   MOBILE ONLY
   Desktop layout is intentionally untouched.
   ========================================================= */

.mobile-menu-toggle,
.mobile-menu-overlay {
    display: none;
}

@media (max-width: 700px) {

    body {
        display: block;
        overflow-x: hidden;
    }

    /* ===== TOP BAR ===== */

    .mobile-menu-toggle {
        display: flex;
        position: fixed;
        z-index: 1200;
        top: 10px;
        left: 10px;
        width: 42px;
        height: 42px;
        align-items: center;
        justify-content: center;
        border: 0;
        border-radius: 9px;
        background: #1769aa;
        color: #fff;
        font-size: 21px;
        cursor: pointer;
        box-shadow: 0 3px 12px rgba(0,0,0,.18);
    }

    /* ===== SIDEBAR ===== */

    aside {
        position: fixed !important;
        z-index: 1250 !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: min(82vw, 290px) !important;
        min-height: 100vh !important;
        overflow-y: auto;
        transform: translateX(-105%);
        transition: transform .22s ease;
        box-shadow: 8px 0 28px rgba(0,0,0,.25);
    }

    aside.mobile-open {
        transform: translateX(0);
    }

    .mobile-menu-overlay {
        position: fixed;
        z-index: 1240;
        inset: 0;
        background: rgba(0,0,0,.48);
    }

    .mobile-menu-overlay.show {
        display: block;
    }

    .sidebottom {
        position: static !important;
        margin-top: 20px;
        padding-top: 15px;
        border-top: 1px solid #29415d;
    }

    nav a,
    .sidebottom a {
        min-height: 45px;
        display: flex;
        align-items: center;
    }

    /* ===== MAIN ===== */

    main,
    main[style] {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 68px 12px 20px !important;
    }

    header {
        display: block;
        margin-bottom: 17px;
    }

    header h1 {
        font-size: 21px;
        line-height: 1.25;
    }

    header p {
        font-size: 12px;
    }

    .badge {
        display: inline-block;
        margin-top: 7px;
    }

    /* ===== GENERAL LAYOUT ===== */

    .cards,
    .cards.small,
    .grid {
        grid-template-columns: 1fr;
    }

    .cards {
        gap: 11px;
    }

    .grid {
        gap: 12px;
    }

    .panel {
        border-radius: 12px;
        padding: 15px;
    }

    /* ===== FORMS ===== */

    .toolbar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        align-items: stretch;
    }

    .toolbar label {
        width: 100%;
    }

    .form input,
    .form select,
    .form textarea,
    .toolbar input,
    .toolbar select {
        width: 100%;
        min-height: 44px;
    }

    button {
        min-height: 44px;
    }

    /* ===== TABLES ===== */

    .panel {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 620px;
    }

    .finance-report {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

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

    /* ===== LOGIN ===== */

    body:has(.login-scene) .mobile-menu-toggle {
        display: none;
    }

    body:has(.login-scene) main {
        padding: 0 !important;
    }

    /* ===== DASHBOARD ===== */

    .kpi-grid {
        grid-template-columns: 1fr !important;
    }

    .occupancy-grid {
        grid-template-columns: 1fr !important;
    }

    .dashboard-content-grid {
        grid-template-columns: 1fr !important;
    }

    .dashboard-hero {
        flex-direction: column;
        align-items: stretch;
    }

    .period-card {
        min-width: 0;
    }

    .period-row {
        display: flex;
    }

    .period-row input {
        flex: 1;
        min-width: 0;
    }

    .period-row button {
        width: auto;
    }

    .dashboard-table {
        min-width: 620px;
    }

    /* ===== SMALL PHONE ===== */

    @media (max-width: 380px) {
        main,
        main[style] {
            padding-left: 9px !important;
            padding-right: 9px !important;
        }
    }
}

/* =========================================================
   ENTRY DATA - MOBILE ONLY
   ========================================================= */

@media (max-width: 700px) {

    .entry-panel {
        padding: 12px !important;
    }

    .entry-head {
        gap: 12px !important;
        margin-bottom: 12px !important;
    }

    .entry-head h2 {
        font-size: 20px;
        margin-bottom: 6px;
    }

    .entry-head .hint {
        font-size: 12px;
        line-height: 1.5;
    }

    .entry-filter {
        width: 100%;
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px !important;
    }

    .entry-filter label {
        width: 100%;
    }

    .entry-filter select,
    .entry-filter input {
        width: 100%;
        min-height: 44px;
        box-sizing: border-box;
        font-size: 15px;
    }

    .table-scroll {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 6px;
    }

    .entry-table {
        min-width: 900px !important;
    }

    .entry-table th {
        padding: 9px 10px;
        font-size: 12px;
        white-space: nowrap;
    }

    .entry-table td {
        height: 44px;
    }

    .entry-table .unit-cell {
        padding: 6px 9px;
    }

    .unit-cell strong {
        font-size: 14px;
    }

    .unit-cell small {
        font-size: 11px;
        line-height: 1.35;
    }

    .money-input,
    .entry-select {
        height: 44px !important;
        min-height: 44px;
        font-size: 15px;
    }

    .entry-actions {
        width: 100%;
        padding-top: 12px;
    }

    .entry-actions .hint {
        font-size: 12px;
        line-height: 1.5;
    }

    .entry-actions button {
        width: 100%;
        min-height: 48px;
        font-size: 15px;
    }

    .entry-empty {
        padding: 25px 15px;
        font-size: 13px;
        line-height: 1.5;
    }
}

/* =========================================================
   ENTRY DATA - RAPATKAN KOLOM DI MOBILE
   ========================================================= */
/* =========================================================
   ENTRY DATA - LEBAR KOLOM RESPONSIVE MOBILE
   ========================================================= */

@media (max-width: 700px) {
    .entry-table {
        width: 100% !important;
        min-width: 0 !important;
        table-layout: fixed !important;
    }

    .entry-table .unit-col,
    .entry-table .unit-cell {
        width: 50% !important;
    }

    .entry-table .pay-col,
    .entry-table .pay-checkbox-cell {
        width: 15% !important;
    }

    .entry-table .extra-col {
        width: 15% !important;
    }

    .entry-table .amount-col {
        width: 15% !important;
    }

    .entry-table .action-col {
        width: 5% !important;
    }

    .entry-table th {
        white-space: normal !important;
        overflow-wrap: anywhere;
        font-size: 10px !important;
        padding: 5px 3px !important;
    }

    .entry-table td {
        padding-left: 3px !important;
        padding-right: 3px !important;
        font-size: 11px !important;
    }

    .entry-table .entry-select,
    .entry-table .money-input {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        padding-left: 2px !important;
        padding-right: 2px !important;
        font-size: 11px !important;
        box-sizing: border-box !important;
    }

    .entry-table .entry-edit-btn {
        padding: 3px 2px !important;
        font-size: 9px !important;
    }
}

/* =========================================================
   MY STATUS - RAPATKAN TABEL MOBILE
   ========================================================= */

@media (max-width: 700px) {

    .resident-panel {
        padding: 12px !important;
    }

    .payment-year {
        width: 100% !important;
        table-layout: fixed;
    }

    .payment-year th,
    .payment-year td {
        padding: 7px 6px !important;
        font-size: 13px;
    }

    .payment-year th:nth-child(1),
    .payment-year td:nth-child(1) {
        width: 50% !important;
    }

    .payment-year th:nth-child(3),
    .payment-year td:nth-child(3) {
        width: 50% !important;
        text-align: center;
    }

    .payment-year .status {
        white-space: nowrap;
    }

    .inner-panel {
        padding: 12px !important;
    }
}

/* =========================================================
   MY STATUS - FIX KOLOM BULAN & STATUS MOBILE
   ========================================================= */

@media (max-width: 700px) {

    .payment-year {
        width: 100% !important;
        min-width: 0 !important;
        table-layout: fixed !important;
    }

    .payment-year thead th,
    .payment-year tbody td {
        box-sizing: border-box;
        padding: 7px 8px !important;
        font-size: 13px !important;
    }

    /* Bulan */
    .payment-year th:nth-child(1),
    .payment-year td:nth-child(1) {
        display: table-cell !important;
        width: 65% !important;
        white-space: nowrap;
    }

    /* Status */
    .payment-year th:nth-child(3),
    .payment-year td:nth-child(3) {
        display: table-cell !important;
        width: 35% !important;
        text-align: center !important;
        white-space: nowrap;
    }

    /* Pastikan Tagihan dan Sumber tetap tersembunyi */
    .payment-year th:nth-child(2),
    .payment-year td:nth-child(2),
    .payment-year th:nth-child(4),
    .payment-year td:nth-child(4) {
        display: none !important;
    }

    .payment-year .status {
        display: inline-block;
        white-space: nowrap;
    }
}
