/* ══════════════════════════════════════════════════
   MOBILE PATCHES — public/css/mobile-patches.css
   Override app.css untuk layar ≤768px
══════════════════════════════════════════════════ */

@media (max-width: 768px) {

/* ── 1. ROOT SCROLL FIX ─────────────────────────────
   app.css set overflow:hidden di html,body,app-layout,app-main
   Semua harus dibuka agar halaman bisa scroll
────────────────────────────────────────────────── */
html, body {
    overflow: unset !important;
    height: auto !important;
    min-height: 100%;
}

.app-layout {
    display: block !important;
    height: auto !important;
    min-height: 100dvh;
    overflow: visible !important;
}

.app-main {
    margin-left: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: calc(100dvh - 52px);
    overflow: visible !important;
    display: flex;
    flex-direction: column;
}

/* page-content: scrollable */
.page-content {
    flex: 1;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* dash-grid: scrollable */
.dash-grid {
    overflow-y: auto !important;
}

/* ── 2. PAGE-ACTIONS FIX ────────────────────────────
   app.css: position:absolute → hilang di mobile
   Ubah jadi normal flow
────────────────────────────────────────────────── */
.page-actions {
    position: static !important;
    height: auto !important;
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px !important;
    padding: 10px 12px !important;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

/* ── 3. TASKS PAGE ──────────────────────────────────
   tasks-layout overflow:hidden → konten terpotong
────────────────────────────────────────────────── */
.tasks-layout {
    display: block !important;
    overflow: visible !important;
    flex: unset !important;
}

.tasks-main {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    min-height: 300px;
}

/* Toolbar: scroll horizontal, jangan wrap */
.toolbar {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    padding: 8px 12px !important;
    gap: 6px !important;
}
.toolbar > div {
    flex-wrap: nowrap !important;
    min-width: max-content;
}
/* Search box sempit, sembunyikan */
.search-box { display: none !important; }

/* Kolom kecil di task row */
.task-id  { display: none !important; }
.due-date { display: none !important; }

/* Resize handle */
.rp-resizer { display: none !important; }

/* Right panel: bottom sheet */
.right-panel {
    position: fixed !important;
    bottom: 0 !important; left: 0 !important; right: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: unset !important;
    height: 85dvh !important;
    border-left: none !important;
    border-top: 2px solid var(--border) !important;
    border-radius: 16px 16px 0 0;
    z-index: 300;
    box-shadow: 0 -6px 32px rgba(0,0,0,.2);
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
    display: flex !important;   /* override .right-panel { display:none } dari app.css @media */
    flex-direction: column;
    opacity: 1 !important;
    pointer-events: auto !important;
}
.right-panel:not(.hidden) {
    transform: translateY(0) !important;
}
.right-panel.hidden {
    transform: translateY(100%) !important;
    display: flex !important;   /* tetap di DOM, cuma ter-translate */
}
/* Drag handle */
.right-panel::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
}

/* Summary bar */
.summary-bar {
    flex-wrap: wrap !important;
    padding: 6px 12px !important;
    gap: 4px !important;
    font-size: 11px;
}
.prog-wrap { display: none !important; }

/* ── 4. DOCS PAGE ───────────────────────────────────
   dlib-wrap overflow:hidden → konten terpotong
────────────────────────────────────────────────── */
.dlib-wrap {
    flex-direction: column !important;
    height: auto !important;
    overflow: visible !important;
}

.dlib-sidebar {
    width: 100% !important;
    max-height: unset !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
    padding: 8px 10px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.dlib-sidebar-section,
.dlib-divider,
.dlib-view-row { display: none !important; }

.dlib-cat-btn {
    flex-shrink: 0 !important;
    border-radius: 20px !important;
    padding: 5px 10px !important;
    white-space: nowrap;
    width: auto !important;
}
.dlib-cat-btn .dlib-cat-ic { display: none !important; }

.dlib-main {
    width: 100% !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 32px !important;
}

.dlib-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 10px 12px !important;
    gap: 8px !important;
}
.dlib-search { width: 100% !important; min-width: unset !important; }
.dlib-sort   { width: 100% !important; }
.dlib-result-count { display: none !important; }

.dlib-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    padding: 0 12px !important;
}

.dlib-list { padding: 0 12px !important; }
.dlh-ref, .dlh-cat, .dlh-status { display: none !important; }

/* Modal: bottom sheet */
.modal-overlay .modal {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    border-radius: 16px 16px 0 0 !important;
    position: fixed !important;
    bottom: 0 !important; left: 0 !important; right: 0 !important;
    top: auto !important;
    max-height: 92dvh;
    overflow-y: auto;
}

/* ── 5. CALENDAR PAGE ───────────────────────────────
   cal-wrap overflow:hidden
────────────────────────────────────────────────── */
.cal-wrap {
    flex-direction: column !important;
    overflow: visible !important;
    height: auto !important;
}
.cal-main {
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
}
.cal-sidebar {
    max-height: 260px;
    overflow-y: auto !important;
}

/* ── 6. DASHBOARD ───────────────────────────────────*/
.dash-grid {
    grid-template-columns: 1fr !important;
    padding: 12px !important;
    overflow-y: visible !important;
}
.span-2, .span-3 { grid-column: span 1 !important; }
.hero-stats { flex-direction: column; }
.stat-pill { min-width: unset; }

/* ── 7. MISC ────────────────────────────────────────*/
.form-row { grid-template-columns: 1fr !important; }

/* Tabel: horizontal scroll */
table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

} /* end @media */