:root {
    --navy-900: #0f172a;
    --navy-800: #1e293b;
    --navy-700: #334155;
    --navy-500: #64748b;
    --navy-200: #e2e8f0;
    --navy-100: #f1f5f9;
    --blue-600: #2563eb;
    --blue-500: #3b82f6;
    --blue-50: #eff6ff;
    --green-600: #16a34a;
    --green-50: #f0fdf4;
    --amber-600: #d97706;
    --amber-50: #fffbeb;
    --red-600: #dc2626;
    --red-50: #fef2f2;
    --violet-600: #7c3aed;
    --violet-50: #f5f3ff;
    --white: #ffffff;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--navy-100);
    color: var(--navy-900);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ===================== LOGIN ===================== */
.login-body {
    background: linear-gradient(135deg, var(--navy-900), var(--blue-600));
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-wrap { width: 100%; max-width: 420px; }
.login-card {
    background: var(--white);
    border-radius: 16px;
    padding: 36px 32px;
    box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-logo {
    width: 56px; height: 56px; border-radius: 14px;
    background: var(--blue-50); color: var(--blue-600);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; margin: 0 auto 14px;
}
.login-brand h1 { font-size: 20px; margin: 0 0 6px; }
.login-brand p { font-size: 13px; color: var(--navy-500); margin: 0; }
.login-form { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--navy-700); }
.login-form input {
    padding: 11px 12px; border: 1px solid var(--navy-200); border-radius: 8px; font-size: 14px;
}
.login-form input:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px var(--blue-50); }

/* ===================== BUTTONS ===================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
    font-size: 13.5px; font-weight: 600; transition: all .15s;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: var(--navy-100); color: var(--navy-800); border-color: var(--navy-200); }
.btn-secondary:hover { background: var(--navy-200); }
.btn-danger { background: var(--red-50); color: var(--red-600); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-ghost { background: transparent; color: var(--navy-500); }
.btn-ghost:hover { background: var(--navy-100); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===================== APP SHELL ===================== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px; background: var(--navy-900); color: #cbd5e1; flex-shrink: 0;
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0;
    transition: transform .2s; z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--blue-600); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.sidebar-brand strong { color: #fff; font-size: 14px; line-height: 1.3; display: block; }
.sidebar-brand span { font-size: 11px; color: #94a3b8; }
.sidebar-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav .nav-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
    font-size: 13.5px; font-weight: 500; color: #cbd5e1; cursor: pointer;
}
.sidebar-nav .nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav .nav-item.active { background: var(--blue-600); color: #fff; }
.sidebar-nav .icon { width: 18px; text-align: center; }
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--blue-600); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.sidebar-user .meta { min-width: 0; flex: 1; }
.sidebar-user .meta strong { display: block; font-size: 12.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .meta span { font-size: 11px; color: #94a3b8; text-transform: capitalize; }
.sidebar-user-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.sidebar-user-actions .btn-ghost { color: #94a3b8; font-size: 14px; }
.sidebar-user-actions .btn-ghost:hover { color: #fff; background: rgba(255,255,255,.08); }

.main {
    flex: 1; margin-left: 240px; display: flex; flex-direction: column; min-height: 100vh; min-width: 0;
}
.topbar {
    display: none; align-items: center; justify-content: space-between; padding: 12px 16px;
    background: #fff; border-bottom: 1px solid var(--navy-200); position: sticky; top: 0; z-index: 30;
}
.topbar .hamburger { font-size: 20px; background: none; border: none; color: var(--navy-800); padding: 6px; }
.content { padding: 24px; flex: 1; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-header h1 { font-size: 21px; margin: 0 0 4px; }
.page-header p { margin: 0; font-size: 13px; color: var(--navy-500); }

.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 39; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar.open + .sidebar-backdrop, .sidebar-backdrop.show { display: block; }
    .main { margin-left: 0; }
    .topbar { display: flex; }
    .content { padding: 16px; }
}

/* ===================== CARDS / GRID ===================== */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 2fr 1fr; }
.grid-2-eq { grid-template-columns: 1fr 1fr; }
.grid-info { grid-template-columns: 30% 70%; align-items: start; }
.stat-grid { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .grid-4, .stat-grid { grid-template-columns: repeat(2, 1fr); } .grid-2, .grid-2-eq, .grid-info { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-4, .grid-3 { grid-template-columns: 1fr; } }
/* stat-grid stays 2-up (not 1) down to phone width for a denser, more scannable KPI strip */
@media (max-width: 600px) { .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }

.chart-box { position: relative; height: 260px; }

.stat-card { display: flex; align-items: center; gap: 14px; }
.stat-card .icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; }
.stat-card .value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-card .label { font-size: 12.5px; color: var(--navy-500); }
.icon-blue { background: var(--blue-50); color: var(--blue-600); }
.icon-green { background: var(--green-50); color: var(--green-600); }
.icon-amber { background: var(--amber-50); color: var(--amber-600); }
.icon-violet { background: var(--violet-50); color: var(--violet-600); }

.section-title { font-size: 14.5px; font-weight: 700; margin: 0 0 14px; }

/* ===================== TABLE ===================== */
.table-wrap { overflow-x: auto; min-width: 0; }
.expense-table-scroll { max-height: 560px; overflow-y: auto; }
.expense-table-scroll thead th { position: sticky; top: 0; z-index: 3; background: #fff; box-shadow: 0 1px 0 var(--navy-200); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; padding: 10px 12px; color: var(--navy-500); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--navy-200); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.clickable:hover { background: var(--navy-100); cursor: pointer; }

/* ===================== MOBILE CARD LIST (replaces wide tables on small screens) =====================
   Two different "table becomes mobile-friendly" patterns exist on purpose, for two different jobs:
   - .data-list / .data-row (this block): for BROWSING a list of entities (Dashboard, Daftar Kasus) -
     each row becomes a scannable card (title + badge + a couple of summary chips), not a full field
     dump. Requires bespoke markup per view (see cases-view/dashboard-view in app.js).
   - table.stack-table (further down, in the RESPONSIVE media query): for DENSE DATA tables with many
     columns that all matter (Pembiayaan, Kelola User, Kelola Status) - a pure CSS transform that turns
     every <td> into a labeled row, no markup duplication beyond adding data-label attributes.
   Rule of thumb: entity list you tap to open something -> .data-list. Data table you scan/edit in place
   -> table.stack-table. Don't invent a third pattern; extend one of these two. */
.data-list { display: none; }
.data-row { padding: 14px 16px; border-bottom: 1px solid #f1f5f9; display: flex; flex-direction: column; gap: 6px; }
.data-row:last-child { border-bottom: none; }
.data-row.clickable:active { background: var(--navy-100); }
.data-row-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.data-row-title { font-weight: 700; font-size: 14px; line-height: 1.35; min-width: 0; flex: 1 1 auto; }
.data-row-sub { font-size: 12px; color: var(--navy-500); }
.data-row-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; background: var(--navy-100); color: var(--navy-700); }
.chip .lbl { font-weight: 600; opacity: .65; }
.chip-blue { background: var(--blue-50); color: var(--blue-600); }
.chip-green { background: var(--green-50); color: var(--green-600); }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; text-transform: capitalize; white-space: nowrap; }
.badge-open { background: var(--blue-50); color: var(--blue-600); }
.badge-investigation { background: var(--amber-50); color: var(--amber-600); }
.badge-prosecution { background: var(--violet-50); color: var(--violet-600); }
.badge-closed { background: var(--green-50); color: var(--green-600); }
.badge-dismissed { background: var(--navy-100); color: var(--navy-500); }
.badge-role-superuser { background: var(--red-50); color: var(--red-600); }
.badge-role-admin { background: var(--blue-50); color: var(--blue-600); }
.badge-role-viewer { background: var(--navy-100); color: var(--navy-700); }
.badge-role-keuangan { background: var(--green-50); color: var(--green-600); }

/* ===================== FORMS ===================== */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group label { font-size: 12.5px; font-weight: 600; color: var(--navy-700); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.form-control {
    padding: 9px 11px; border: 1px solid var(--navy-200); border-radius: 8px; font-size: 13.5px; width: 100%; background: #fff;
}
.form-control:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px var(--blue-50); }
textarea.form-control { resize: vertical; min-height: 80px; }
.hint { font-size: 11.5px; color: var(--navy-500); }

/* ===================== SEARCHABLE SELECT ===================== */
.searchable-select { position: relative; }
.searchable-select .form-control { padding-right: 30px; cursor: text; }
.searchable-caret { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-size: 9px; color: var(--navy-500); pointer-events: none; }
.searchable-dropdown {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50;
    background: #fff; border: 1px solid var(--navy-200); border-radius: 8px; box-shadow: var(--shadow-lg);
    max-height: 260px; overflow-y: auto; padding: 4px;
}
.searchable-option { padding: 8px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.searchable-option:hover { background: var(--navy-100); }
.searchable-option.active { background: var(--blue-50); color: var(--blue-600); font-weight: 600; }
.searchable-empty { padding: 10px; font-size: 12.5px; color: var(--navy-500); text-align: center; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box input { padding-left: 34px; }
.search-box .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--navy-500); font-size: 13px; }

/* ===================== ALERTS / TOAST ===================== */
.alert { padding: 11px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-error { background: var(--red-50); color: var(--red-600); border: 1px solid #fecaca; }
.alert-success { background: var(--green-50); color: var(--green-600); border: 1px solid #bbf7d0; }

.toast-stack { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 16px; border-radius: 8px; font-size: 13.5px; box-shadow: var(--shadow-lg); color: #fff; min-width: 220px; }
.toast-success { background: var(--green-600); }
.toast-error { background: var(--red-600); }

/* ===================== MODAL ===================== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center;
    z-index: 100; padding: 16px; overflow-y: auto;
}
.modal {
    background: #fff; border-radius: 14px; width: 100%; max-width: 560px; box-shadow: var(--shadow-lg);
    max-height: 90vh; display: flex; flex-direction: column;
}
.modal.modal-lg { max-width: 760px; }
.modal.modal-xl { max-width: 980px; }
.quill-wrap .ql-container { min-height: 380px; font-size: 14px; }
.quill-wrap .ql-editor { min-height: 380px; }
.richtext-content :is(h1,h2,h3,h4,h5,h6) { margin: 0.6em 0 0.3em; }
.richtext-content p { margin: 0 0 0.6em; }
.richtext-content ul, .richtext-content ol { margin: 0 0 0.6em; padding-left: 1.4em; }
.richtext-content blockquote { border-left: 3px solid var(--navy-200); margin: 0 0 0.6em; padding-left: 12px; color: var(--navy-700); }
.richtext-content pre { background: var(--navy-100); padding: 10px; border-radius: 8px; overflow-x: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--navy-200); }
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-close { background: none; border: none; font-size: 18px; color: var(--navy-500); padding: 4px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--navy-200); display: flex; justify-content: flex-end; gap: 10px; }

/* ===================== LIGHTBOX (evidence preview) ===================== */
.lightbox-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.85); z-index: 150;
    display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px;
}
.lightbox-topbar {
    position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; color: #fff; font-size: 13px; font-weight: 600; gap: 12px;
}
.lightbox-topbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-body { display: flex; align-items: center; justify-content: center; max-width: 100%; max-height: 100%; }
.lightbox-image { max-width: 90vw; max-height: 85vh; width: auto; height: auto; border-radius: 8px; box-shadow: var(--shadow-lg); display: block; }
.lightbox-pdf { width: 90vw; height: 85vh; border: none; border-radius: 8px; background: #fff; box-shadow: var(--shadow-lg); }
.lightbox-loading { display: flex; flex-direction: column; align-items: center; gap: 14px; color: #e2e8f0; font-size: 13px; }
.spinner-lg { width: 40px; height: 40px; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }

/* ===================== CASE DETAIL ===================== */
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--blue-600); font-weight: 600; margin-bottom: 12px; cursor: pointer; }
.case-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.case-code { font-size: 12.5px; color: var(--navy-500); font-weight: 600; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--navy-200); margin-bottom: 20px; overflow-x: auto; }
.tab-btn { padding: 11px 16px; font-size: 13.5px; font-weight: 600; color: var(--navy-500); border-bottom: 2px solid transparent; white-space: nowrap; background: none; border-left: none; border-right: none; border-top: none; }
.tab-btn.active { color: var(--blue-600); border-bottom-color: var(--blue-600); }

.info-list { display: flex; flex-direction: column; gap: 12px; }
.info-list .row { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; padding-bottom: 12px; border-bottom: 1px solid #f1f5f9; }
.info-list .row:last-child { border-bottom: none; padding-bottom: 0; }
.info-list .row .k { color: var(--navy-500); }
.info-list .row .v { font-weight: 600; text-align: right; }
.info-list .row.row-stack { flex-direction: column; gap: 6px; }
.info-list .row.row-stack .v { text-align: left; }

/* ===================== TIMELINE ===================== */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--navy-200); }
.timeline-item { position: relative; padding-bottom: 26px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -28px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--blue-600); border: 3px solid var(--blue-50); }
.timeline-card { background: var(--navy-100); border-radius: 10px; padding: 14px 16px; }
.timeline-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.timeline-date { font-size: 11.5px; font-weight: 700; color: var(--navy-500); text-transform: uppercase; }
.timeline-title { font-size: 14px; font-weight: 700; margin: 2px 0 4px; }
.timeline-desc { font-size: 13px; color: var(--navy-700); white-space: pre-line; }
.timeline-meta { font-size: 11.5px; color: var(--navy-500); margin-top: 8px; }
.evidence-grid { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.evidence-thumb { width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--navy-200); position: relative; background: #fff; display: flex; align-items: center; justify-content: center; }
.evidence-thumb img { width: 100%; height: 100%; object-fit: cover; }
.evidence-thumb.pdf { flex-direction: column; gap: 4px; font-size: 10px; color: var(--red-600); font-weight: 700; }
.evidence-thumb .del { position: absolute; top: 2px; right: 2px; background: rgba(220,38,38,.9); color: #fff; border: none; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.doc-source-badge { position: absolute; bottom: 2px; left: 2px; background: rgba(37,99,235,.9); color: #fff; width: 16px; height: 16px; border-radius: 50%; font-size: 9px; line-height: 1; display: flex; align-items: center; justify-content: center; }

/* ===================== EXPENSE STAT CHIPS ===================== */
.expense-stats-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.expense-stat-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.expense-stat-chip .value { font-weight: 700; }
.expense-stat-chip.claim { background: var(--green-50); color: var(--green-600); }
.expense-stat-chip.unclaim { background: var(--navy-100); color: var(--navy-700); }
.expense-stat-chip.total { background: var(--blue-50); color: var(--blue-600); }

/* ===================== SUSPECT CARD ===================== */
.suspect-card { display: flex; flex-direction: column; padding: 0; border: 1px solid var(--navy-200); border-radius: 10px; overflow: hidden; background: #fff; }
.suspect-photo { width: 100%; height: 200px; border-radius: 0; object-fit: cover; background: var(--navy-100); flex-shrink: 0; display: block; }
.suspect-photo.placeholder { display: flex; align-items: center; justify-content: center; color: var(--navy-500); font-size: 40px; }
.suspect-info { flex: 1; min-width: 0; padding: 14px; }
.suspect-info h4 { margin: 0 0 2px; font-size: 14px; }
.suspect-info .role { font-size: 11px; font-weight: 700; color: var(--violet-600); text-transform: uppercase; }
.suspect-info p { margin: 6px 0 0; font-size: 12.5px; color: var(--navy-700); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--navy-500); }
.empty-state .icon { font-size: 32px; margin-bottom: 10px; }

.pagination-hint { font-size: 12px; color: var(--navy-500); }

.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: flex; align-items: center; justify-content: center; padding: 60px 0; color: var(--navy-500); font-size: 13.5px; }

/* ===================== RESPONSIVE: PHONE / SMALL TABLET / FOLDABLE ===================== */
@media (max-width: 760px) {
    /* Daftar Kasus: swap the wide table for a compact card list */
    .table-wrap.responsive-table { display: none; }
    .data-list { display: flex; flex-direction: column; }

    /* Dense data tables (expenses, users, status lists): stack each row into a labeled mini-card */
    table.stack-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    table.stack-table, table.stack-table tbody, table.stack-table tr { display: block; width: 100%; }
    table.stack-table tr { border: 1px solid var(--navy-200); border-radius: 10px; padding: 4px 12px; margin-bottom: 10px; background: #fff; }
    table.stack-table tr:last-child { margin-bottom: 0; }
    table.stack-table td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--navy-200); text-align: right; white-space: normal; }
    table.stack-table td:last-child { border-bottom: none; }
    table.stack-table td::before { content: attr(data-label); flex-shrink: 0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--navy-500); text-align: left; }
    table.stack-table td[data-label=""]::before { content: none; }
    table.stack-table td[data-label=""] { justify-content: flex-end; }
    .expense-table-scroll.table-wrap { max-height: none; overflow-y: visible; }
}

@media (max-width: 480px) {
    .content { padding: 12px; }
    .card { padding: 14px; }
    .page-header { gap: 10px; }
    .page-header h1 { font-size: 18px; }
    .page-header > .btn { width: 100%; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .search-box { min-width: 0; }
    .toolbar > div[style*="max-width"] { max-width: none !important; }

    .login-card { padding: 26px 20px; }
    .login-brand h1 { font-size: 18px; }

    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal-overlay .modal { max-width: 100%; width: 100%; border-radius: 14px 14px 0 0; max-height: 92vh; }
    .modal-header, .modal-footer { padding: 14px 16px; }
    .modal-body { padding: 16px; }
    .modal-footer { flex-wrap: wrap; }
    .modal-footer .btn { flex: 1; }

    .stat-card { gap: 10px; }
    .stat-card .icon { width: 38px; height: 38px; font-size: 16px; }
    .stat-card .value { font-size: 18px; }

    .case-title-row h1 { font-size: 18px; }
    .tab-btn { padding: 10px 12px; font-size: 13px; }

    .suspect-photo { height: 160px; }
    .evidence-thumb { width: 62px; height: 62px; }

    table { font-size: 12.5px; }
    th, td { padding: 8px 10px; }

    .info-list .row { flex-direction: column; align-items: flex-start; gap: 4px; }
    .info-list .row .v { text-align: left; }

    .chart-box { height: 210px; }
    .section-title { font-size: 13.5px; margin-bottom: 10px; }
}

@media (max-width: 360px) {
    .sidebar { width: 84vw; }
    .stat-card { flex-direction: column; align-items: flex-start; }
}

@media (hover: none) and (pointer: coarse) {
    .btn, .tab-btn, .nav-item, .searchable-option { min-height: 38px; }
}
