/* ============================================================
   LOGIN PAGE — Split Layout
============================================================ */
#login-page {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: row;
}
#login-page.hidden { display: none !important; }

/* Left branding panel */
.login-brand {
  flex: 0 0 42%;
  background: linear-gradient(160deg, #0c1a3a 0%, #1e3a8a 55%, #1d4ed8 100%);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-brand::before {
  content: '';
  position: absolute; top: -120px; right: -120px;
  width: 400px; height: 400px; border-radius: 50%;
  background: rgba(255,255,255,0.04); pointer-events: none;
}
.login-brand::after {
  content: '';
  position: absolute; bottom: -80px; left: -80px;
  width: 300px; height: 300px; border-radius: 50%;
  background: rgba(255,255,255,0.03); pointer-events: none;
}
.login-brand-body { position: relative; z-index: 1; }
.login-brand-logo {
  height: 44px; width: auto; object-fit: contain; display: block;
  background: white; border-radius: 9px; padding: 6px 14px;
  margin-bottom: 40px;
}
.login-brand-title {
  font-size: 27px; font-weight: 700; color: white;
  margin-bottom: 8px; line-height: 1.2; letter-spacing: -0.02em;
}
.login-brand-sub {
  font-size: 14px; color: rgba(255,255,255,0.5); margin-bottom: 44px;
}
.login-features { display: flex; flex-direction: column; gap: 20px; }
.login-feature { display: flex; align-items: flex-start; gap: 14px; }
.login-feature-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  background: rgba(255,255,255,0.1); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #93c5fd; font-size: 13px; margin-top: 1px;
}
.login-feature-text { font-size: 13.5px; color: rgba(255,255,255,0.75); line-height: 1.55; }
.login-brand-footer { font-size: 11.5px; color: rgba(255,255,255,0.28); position: relative; z-index: 1; }

/* Right form panel */
.login-form-wrap {
  flex: 1; background: #f1f5f9;
  display: flex; align-items: center; justify-content: center;
  overflow-y: auto; padding: 40px 24px;
}
.login-form-card {
  background: white; border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 28px rgba(0,0,0,0.07);
  padding: 40px; width: 100%; max-width: 380px;
}
.login-form-card-logo {
  height: 32px; width: auto; object-fit: contain;
  display: none; margin-bottom: 24px;
}
.login-form-heading {
  font-size: 22px; font-weight: 700; color: #0f172a;
  margin-bottom: 4px; letter-spacing: -0.02em;
}
.login-form-sub { font-size: 13.5px; color: #64748b; margin-bottom: 28px; }

/* Mobile: stacked */
@media (max-width: 768px) {
  #login-page { flex-direction: column; background: #f1f5f9; overflow-y: auto; position: relative; min-height: 100vh; }
  .login-brand { flex: none; padding: 28px 24px 24px; }
  .login-brand::before, .login-brand::after { display: none; }
  .login-brand-logo { height: 34px; margin-bottom: 12px; }
  .login-brand-title { font-size: 18px; margin-bottom: 4px; }
  .login-brand-sub { margin-bottom: 0; font-size: 13px; }
  .login-features, .login-brand-footer { display: none; }
  .login-form-wrap { padding: 24px 16px; align-items: flex-start; }
  .login-form-card { box-shadow: none; border: none; background: transparent; padding: 20px 0; }
  .login-form-card-logo { display: block; }
  .login-form-heading { font-size: 20px; }
}

/* ============================================================
   GLOBAL
============================================================ */
:root {
  --sidebar-w: 260px;
  --topbar-h: 60px;
  --mobile-nav-h: 58px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: #f0f4f8; color: #1e293b;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.6;
  font-feature-settings: 'cv11', 'ss01';
}
h1,h2,h3,h4,h5 { letter-spacing: -0.02em; font-weight: 600; line-height: 1.3; }
p, span, td, th, label, input, select, textarea, button { font-family: inherit; }
a { color: inherit; }
.font-mono { font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', ui-monospace, monospace; }

/* ============================================================
   SIDEBAR
============================================================ */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #0f172a;
  color: white;
  display: flex;
  flex-direction: column;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1), width 0.28s ease;
  z-index: 50;
  overflow: hidden;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px; font-size: 13.5px;
  color: #94a3b8; text-decoration: none; transition: all 0.15s;
  cursor: pointer; border: none; background: none; width: 100%;
  white-space: nowrap; overflow: hidden; font-weight: 500;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #cbd5e1; }
.nav-item.active {
  background: rgba(59,130,246,0.18); color: #93c5fd;
  font-weight: 600; border-left: 3px solid #3b82f6; padding-left: 9px;
}
.nav-item .nav-icon { width: 18px; flex-shrink: 0; text-align: center; font-size: 13px; }
.nav-section {
  font-size: 10px; font-weight: 700; color: #475569; letter-spacing: 0.11em;
  padding: 16px 12px 5px; text-transform: uppercase;
}

/* Sidebar Overlay (mobile) */
#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 49;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}
#sidebar-overlay.show { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   TOPBAR
============================================================ */
#topbar {
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid #e8edf2;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 1px 0 #e2e8f0, 0 2px 8px rgba(0,0,0,0.04);
  position: sticky;
  top: 0;
  z-index: 30;
}

/* ============================================================
   STAT CARDS
============================================================ */
.stat-card {
  background: white; border-radius: var(--radius); padding: 20px;
  border: 1px solid #e2e8f0; border-top: 3px solid transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s, transform 0.2s;
  position: relative;
}
.stat-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.08); transform: translateY(-1px); }
.stat-card-urgent { border-top-color: #f59e0b !important; }
.stat-card-blue  { border-top-color: #2563eb; }
.stat-card-green { border-top-color: #16a34a; }
.stat-card-indigo { border-top-color: #4f46e5; }
.stat-card-amber  { border-top-color: #d97706; }
.stat-card-purple { border-top-color: #9333ea; }
.stat-card-teal   { border-top-color: #0d9488; }
.stat-card-red    { border-top-color: #dc2626; }

/* ============================================================
   STATUS BADGES
============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
}
.badge-available { background: #dcfce7; color: #16a34a; }
.badge-in_use { background: #dbeafe; color: #2563eb; }
.badge-under_maintenance { background: #fef9c3; color: #ca8a04; }
.badge-disposed { background: #f1f5f9; color: #64748b; }
.badge-lost { background: #fee2e2; color: #dc2626; }
.badge-borrowed { background: #ffedd5; color: #ea580c; }
.badge-pending { background: #fef3c7; color: #d97706; }
.badge-approved { background: #d1fae5; color: #059669; }
.badge-rejected { background: #fee2e2; color: #dc2626; }
.badge-processing { background: #dbeafe; color: #2563eb; }
.badge-completed { background: #dcfce7; color: #16a34a; }
.badge-cancelled { background: #f1f5f9; color: #64748b; }
.badge-draft { background: #f1f5f9; color: #64748b; }
.badge-sent { background: #fef9c3; color: #ca8a04; }
.badge-acknowledged { background: #dcfce7; color: #16a34a; }
.badge-new { background: #ede9fe; color: #7c3aed; }
.badge-good { background: #dcfce7; color: #16a34a; }
.badge-fair { background: #fef9c3; color: #ca8a04; }
.badge-poor { background: #fee2e2; color: #dc2626; }
.badge-damaged { background: #fee2e2; color: #991b1b; }
.badge-low { background: #f0fdf4; color: #16a34a; }
.badge-normal { background: #f0f9ff; color: #0369a1; }
.badge-high { background: #fff7ed; color: #c2410c; }
.badge-urgent { background: #fef2f2; color: #dc2626; }
.badge-scheduled { background: #ede9fe; color: #7c3aed; }
.badge-in_progress { background: #dbeafe; color: #2563eb; }
.badge-overdue { background: #fee2e2; color: #dc2626; font-weight: 700; }
.badge-due-soon { background: #fff7ed; color: #c2410c; }
.badge-on-time { background: #f0fdf4; color: #16a34a; }
.badge-head_approved { background: #d1fae5; color: #059669; }
.badge-purchasing_approved { background: #dbeafe; color: #2563eb; }
.badge-finance_approved { background: #ede9fe; color: #7c3aed; }

/* ============================================================
   SKELETON LOADING
============================================================ */
@keyframes skeleton-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, #f0f4f8 25%, #e2e8f0 50%, #f0f4f8 75%);
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.4s infinite linear;
  border-radius: 6px;
}
.skeleton-text { height: 14px; width: 100%; margin-bottom: 8px; }
.skeleton-text.w-3\/4 { width: 75%; }
.skeleton-text.w-1\/2 { width: 50%; }
.skeleton-text.w-1\/3 { width: 33%; }
.skeleton-card { height: 80px; border-radius: 12px; }
.skeleton-row { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid #f1f5f9; }
.skeleton-row .skeleton-cell { border-radius: 4px; }

/* ============================================================
   MAINTENANCE CALENDAR
============================================================ */
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px; border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden;
}
.cal-header {
  background: #f8fafc; padding: 8px 4px; text-align: center;
  font-size: 11px; font-weight: 700; color: #64748b; letter-spacing: 0.05em;
}
.cal-cell {
  min-height: 80px; padding: 4px; background: #fff;
  border: 1px solid #f1f5f9; transition: background 0.1s;
}
.cal-cell:hover { background: #f8fafc; }
.cal-cell.empty { background: #fafafa; }
.cal-cell.cal-today { background: #eff6ff; }
.cal-cell.cal-has-items { background: #fefce8; }
.cal-cell.cal-today.cal-has-items { background: #eff6ff; }
.cal-day-num {
  font-size: 12px; font-weight: 600; color: #475569;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; margin-bottom: 2px;
}
.cal-event {
  padding: 2px 4px; border-radius: 3px; margin-bottom: 2px;
  font-size: 10px; line-height: 1.3; cursor: pointer; overflow: hidden; display: flex;
}
.cal-event-scheduled   { background: #ede9fe; color: #7c3aed; }
.cal-event-in_progress { background: #dbeafe; color: #1d4ed8; }
.cal-event-completed   { background: #dcfce7; color: #16a34a; }
.cal-event-cancelled   { background: #f1f5f9; color: #64748b; }

/* ============================================================
   DATA TABLE
============================================================ */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.data-table th {
  background: #f8fafc; text-align: left; padding: 10px 14px;
  font-size: 10.5px; font-weight: 700; color: #64748b; letter-spacing: 0.07em;
  text-transform: uppercase; border-bottom: 2px solid #e8edf2;
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.data-table td { padding: 11px 14px; font-size: 13.5px; color: #374151; border-bottom: 1px solid #f0f4f8; vertical-align: middle; }
.data-table tbody tr { transition: background 0.1s; }
.data-table tr:hover td { background: #f8fafc; }
.data-table tr:last-child td { border-bottom: none; }
.data-table td .text-xs { font-size: 11.5px; }

/* ============================================================
   FORM
============================================================ */
.form-input {
  width: 100%; padding: 9px 14px; border: 1.5px solid #d1d5db;
  border-radius: 10px; font-size: 13.5px; transition: border-color 0.15s, box-shadow 0.15s;
  background: white; color: #0f172a; line-height: 1.5; font-family: inherit;
}
.form-input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.12); }
.form-input:disabled { background: #f9fafb; color: #9ca3af; cursor: not-allowed; }
.form-input.input-error { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }
.field-error-msg { font-size: 11.5px; color: #ef4444; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.field-error-msg::before { content: '⚠'; font-size: 11px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; color: #374151; margin-bottom: 5px; letter-spacing: 0.01em; }
.form-hint { font-size: 11.5px; color: #9ca3af; margin-top: 4px; }
.form-group { margin-bottom: 16px; }
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ============================================================
   BUTTONS
============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 18px; border-radius: 10px; font-size: 14px; font-weight: 500;
  cursor: pointer; border: none; transition: all 0.15s; text-decoration: none;
  white-space: nowrap; flex-shrink: 0; line-height: 1;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: #2563eb; color: white; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.btn-secondary { background: #f1f5f9; color: #374151; border: 1.5px solid #e2e8f0; }
.btn-secondary:hover:not(:disabled) { background: #e2e8f0; }
.btn-success { background: #059669; color: white; }
.btn-success:hover:not(:disabled) { background: #047857; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-warning { background: #d97706; color: white; }
.btn-warning:hover:not(:disabled) { background: #b45309; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { padding: 4px 9px; font-size: 11.5px; border-radius: 6px; }
.btn-icon { padding: 7px; min-width: 34px; justify-content: center; aspect-ratio: 1; }
.btn-ghost { background: transparent; color: #6b7280; }
.btn-ghost:hover:not(:disabled) { background: #f3f4f6; color: #374151; }

/* ============================================================
   CARDS
============================================================ */
.card { background: white; border-radius: var(--radius); border: 1px solid #e2e8f0; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.card-header {
  padding: 13px 20px; border-bottom: 1px solid #e8edf2;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; background: #fafbfc;
}
.card-header span.font-semibold { font-size: 14px; color: #0f172a; letter-spacing: -0.01em; }
.card-body { padding: 20px; }

/* ============================================================
   MODAL
============================================================ */
/* Mobile: full-screen modal */
@media (max-width: 640px) {
  #modal-box {
    max-width: 100% !important;
    max-height: 100% !important;
    height: 100%;
    border-radius: 0 !important;
    margin: 0;
  }
  #modal-overlay { padding: 0 !important; align-items: flex-end; }
}

/* ============================================================
   TOAST
============================================================ */
.toast {
  padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease; min-width: 280px; max-width: 380px;
}
.toast-success { background: #059669; color: white; }
.toast-error { background: #dc2626; color: white; }
.toast-warning { background: #d97706; color: white; }
.toast-info { background: #2563eb; color: white; }
@keyframes slideInRight { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(110%); } }

/* ============================================================
   PAGINATION
============================================================ */
.pagination { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.page-btn {
  padding: 6px 12px; border-radius: 8px; font-size: 13px;
  border: 1.5px solid #e2e8f0; background: white; cursor: pointer;
  color: #374151; transition: all 0.15s; min-width: 34px; text-align: center;
}
.page-btn:hover:not(:disabled) { background: #f1f5f9; border-color: #cbd5e1; }
.page-btn.active { background: #2563eb; color: white; border-color: #2563eb; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   TIMELINE
============================================================ */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content:''; position:absolute; left:8px; top:4px; bottom:4px; width:2px; background:#e2e8f0; }
.timeline-item { position: relative; margin-bottom: 18px; }
.timeline-item::before {
  content:''; position:absolute; left:-21px; top:5px;
  width:10px; height:10px; border-radius:50%;
  background:#3b82f6; border:2px solid white; box-shadow:0 0 0 2px #3b82f6;
}

/* ============================================================
   SEARCH & FILTERS
============================================================ */
.search-box { position: relative; }
.search-box .form-input { padding-left: 38px; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #9ca3af; font-size: 13px; }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.filter-bar-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.filter-select {
  padding: 8px 12px; border: 1.5px solid #d1d5db; border-radius: 9px;
  font-size: 13px; background: white; color: #374151; cursor: pointer;
  transition: border-color 0.15s; height: 38px;
}
.filter-select:focus { outline: none; border-color: #3b82f6; }
input[type="date"].filter-select { cursor: pointer; min-width: 140px; }

/* ============================================================
   DETAIL ROWS  (used in BAST, Requests detail modals)
============================================================ */
.detail-row { display: flex; padding: 9px 0; border-bottom: 1px solid #f1f5f9; gap: 12px; align-items: baseline; }
.detail-row:last-child { border-bottom: none; }
.detail-label { width: 130px; flex-shrink: 0; font-size: 11px; color: #64748b; font-weight: 600; padding-top: 1px; text-transform: uppercase; letter-spacing: 0.06em; }
.detail-value { flex: 1; font-size: 13.5px; color: #0f172a; min-width: 0; word-break: break-word; line-height: 1.5; }

/* Info grid: 2-col on desktop, 1-col on mobile */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .info-grid { grid-template-columns: 1fr; gap: 0.75rem; } }

/* Detail grid: 2-col detail-rows on desktop, 1-col on mobile */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
.detail-grid .col-span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .detail-grid { grid-template-columns: 1fr; }
  /* Stack label above value on narrow screens */
  .detail-row { flex-direction: column; gap: 2px; padding: 10px 0; }
  .detail-label { width: auto; font-size: 10px; letter-spacing: 0.08em; }
  .detail-value { font-size: 14px; font-weight: 500; }
}

/* ============================================================
   ASSET DETAIL SECTIONS  (redesigned mobile-first layout)
============================================================ */
.asset-section {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: white;
}
.asset-section-title {
  padding: 8px 14px;
  background: #f8fafc;
  font-size: 10.5px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  border-bottom: 1px solid #e2e8f0;
}
.asset-row {
  display: flex;
  padding: 9px 14px;
  border-bottom: 1px solid #f8fafc;
  gap: 10px;
  align-items: baseline;
}
.asset-row:last-child { border-bottom: none; }
.asset-row-key {
  flex: 0 0 105px;
  font-size: 11.5px;
  font-weight: 500;
  color: #64748b;
  line-height: 1.5;
}
.asset-row-val {
  flex: 1;
  font-size: 13px;
  font-weight: 400;
  color: #0f172a;
  min-width: 0;
  word-break: break-word;
  line-height: 1.5;
}
@media (max-width: 640px) {
  .asset-row {
    flex-direction: column;
    gap: 2px;
    padding: 11px 14px;
  }
  .asset-row-key {
    flex: none;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94a3b8;
  }
  .asset-row-val {
    font-size: 14px;
    font-weight: 500;
    color: #0f172a;
  }
}

/* ============================================================
   EMPTY STATE
============================================================ */
.empty-state { text-align: center; padding: 52px 20px; color: #9ca3af; }
.empty-state i { font-size: 44px; margin-bottom: 14px; display: block; color: #d1d5db; }
.empty-state p { font-size: 15px; margin-bottom: 6px; color: #6b7280; font-weight: 500; }
.empty-state span { font-size: 13px; color: #9ca3af; }

/* ============================================================
   PAGE TRANSITIONS
============================================================ */
#main-content { transition: opacity 0.18s ease; }
/* Cegah konten/seleksi menembus tepi layar (horizontal overflow).
   Flex item butuh min-width:0 agar bisa menyusut; tabel lebar tetap scroll
   di dalam .table-responsive masing-masing. */
#app > .flex-1 { min-width: 0; }
#main-content { min-width: 0; max-width: 100%; overflow-x: hidden; }
.card { max-width: 100%; }
#main-content.page-exit { opacity: 0; }
#main-content.page-enter { animation: pageEnter 0.22s ease forwards; }
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   PERMISSION MATRIX
============================================================ */
.perm-table th, .perm-table td { padding: 10px 12px; }
.perm-module { min-width: 160px; }
.perm-module-key { display: block; font-size: 10px; letter-spacing: .05em; font-family: monospace; }
.perm-sa-col { background: #fefce8; color: #92400e; }
.perm-sa-cell { background: #fefce8; text-align: center; }
.perm-sa-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: #92400e; background: #fef3c7; padding: 3px 10px; border-radius: 20px; border: 1px solid #fde68a; }
.perm-cell { text-align: center; }
.perm-btn-group { display: inline-flex; gap: 3px; border-radius: 8px; overflow: hidden; border: 1px solid #e5e7eb; }
.perm-btn { padding: 4px 9px; font-size: 11px; font-weight: 600; border: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; background: #f8fafc; color: #6b7280; transition: all .15s; white-space: nowrap; }
.perm-btn:hover { filter: brightness(.93); }
.perm-btn-w.active { background: #dcfce7; color: #15803d; }
.perm-btn-r.active { background: #dbeafe; color: #1d4ed8; }
.perm-btn-n.active { background: #fee2e2; color: #b91c1c; }
.perm-legend { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 6px; }
.perm-legend.perm-btn-w { background: #dcfce7; color: #15803d; }
.perm-legend.perm-btn-r { background: #dbeafe; color: #1d4ed8; }
.perm-legend.perm-btn-n { background: #fee2e2; color: #b91c1c; }

/* ============================================================
   LOADING / SKELETON
============================================================ */
.loading { display: flex; align-items: center; justify-content: center; padding: 64px 48px; gap: 14px; color: #94a3b8; flex-direction: column; }
.loading i { font-size: 32px; color: #3b82f6; animation: spin 0.9s linear infinite; }
.loading-text { font-size: 13px; color: #94a3b8; margin-top: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============================================================
   ALERT
============================================================ */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; line-height: 1.5; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #14532d; border: 1px solid #bbf7d0; }

/* ============================================================
   NOTIFICATION
============================================================ */
.notif-item { padding: 12px 16px; cursor: pointer; transition: background 0.15s; }
.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #eff6ff; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: #3b82f6; flex-shrink: 0; margin-top: 5px; }

/* ============================================================
   SCROLLBAR
============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================================
   CHART
============================================================ */
.chart-container { position: relative; height: 240px; }

/* ============================================================
   QR / PRINT
============================================================ */
.qr-preview { text-align: center; }
.qr-preview img { max-width: 200px; margin: 0 auto; border: 2px solid #e2e8f0; padding: 8px; border-radius: 12px; }
.qr-box { display: flex; align-items: center; justify-content: center; border-radius: 8px; overflow: hidden; }

/* ============================================================
   MOBILE BOTTOM NAV
============================================================ */
#mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--mobile-nav-h);
  background: #0f172a;
  z-index: 40;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.mobile-nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; color: #64748b;
  font-size: 10px; font-weight: 500; cursor: pointer;
  text-decoration: none; transition: color 0.15s; padding: 6px 4px;
  border: none; background: none;
}
.mobile-nav-item i { font-size: 18px; }
.mobile-nav-item.active { color: #60a5fa; }
.mobile-nav-item:hover { color: #94a3b8; }

/* ============================================================
   PRINT
============================================================ */
.print-only { display: none; }

@page { size: A4 landscape; margin: 1.5cm; }

@media print {
  /* -- Show print-only elements -- */
  .print-only { display: block !important; }

  /* -- Hide all UI chrome -- */
  #sidebar, #topbar, #mobile-nav, #sidebar-overlay,
  .filter-bar, .filter-bar-actions,
  [id$="-pagination"],
  .card-header > .btn, .card-header > button,
  #toast-container, #modal-overlay, #qr-modal { display: none !important; }

  /* -- Reset layout -- */
  body {
    background: white !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #app { display: block !important; height: auto !important; overflow: visible !important; }
  #app > div { display: block !important; overflow: visible !important; height: auto !important; }
  #main-content {
    overflow: visible !important; height: auto !important;
    padding: 0 !important; max-height: none !important;
    margin-top: 0 !important;
  }
  .max-w-3xl, .max-w-2xl, .max-w-xl { max-width: 100% !important; }
  .space-y-6 > * + *, .space-y-4 > * + * { margin-top: 18px !important; }

  /* -- Cards -- */
  .card {
    box-shadow: none !important; border: 1px solid #d1d5db !important;
  }
  .card-header { padding: 8px 14px !important; border-bottom: 1px solid #e5e7eb !important; }
  .card-body { padding: 12px !important; }

  /* -- Tables -- */
  .table-responsive { overflow: visible !important; }
  .data-table { width: 100%; font-size: 8.5px; min-width: 0 !important; border-collapse: collapse; }
  .data-table th {
    background: #f3f4f6 !important;
    padding: 5px 8px !important; font-size: 8px;
    border: 1px solid #d1d5db !important; color: #374151 !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .data-table td {
    padding: 4px 8px !important; font-size: 8.5px;
    border: 1px solid #e5e7eb !important; color: #1f2937 !important;
  }
  .data-table tr:hover td { background: white !important; }
  thead { display: table-header-group; }
  tr { page-break-inside: avoid; }

  /* -- Badges -- */
  .badge {
    padding: 1px 5px !important; font-size: 7.5px !important;
    border-radius: 4px !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }

  /* -- Stat cards -- */
  .stat-card { box-shadow: none !important; border: 1px solid #e5e7eb !important; }

  /* -- Charts -- */
  canvas { max-height: 200px !important; }

  /* -- Print header -- */
  .print-header {
    display: flex !important;
    justify-content: space-between; align-items: flex-start;
    padding-bottom: 12px; margin-bottom: 16px;
    border-bottom: 2px solid #1e3a8a;
  }
  .print-header-left .co-name {
    font-size: 16px; font-weight: 700; color: #1e3a8a; display: block; margin-bottom: 2px;
  }
  .print-header-left .co-sub { font-size: 10px; color: #64748b; }
  .print-header-right { text-align: right; }
  .print-header-right .rpt-title {
    font-size: 14px; font-weight: 700; color: #1e293b; display: block; margin-bottom: 3px;
  }
  .print-header-right .rpt-date { font-size: 10px; color: #64748b; }
}

/* ============================================================
   RESPONSIVE — TABLET (max 1024px)
============================================================ */
@media (max-width: 1024px) {
  #sidebar { width: 220px; }
  :root { --sidebar-w: 220px; }
}

/* ============================================================
   RESPONSIVE — MOBILE (max 768px)
============================================================ */
@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }

  /* Sidebar: slide-in drawer */
  #sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    height: 100%;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  #sidebar.open { transform: translateX(0); }

  /* App layout: keep flex so main-content can scroll properly */
  #app:not(.app-hidden) { display: flex !important; height: 100vh !important; overflow: hidden !important; }
  #app.app-hidden { display: none !important; }
  /* Wrapper between app and main-content: fill full width (sidebar is fixed/out-of-flow) */
  #app > div.flex-1 { min-width: 0; width: 100%; }
  /* Main content: scrollable, padded bottom for fixed mobile nav */
  #main-content {
    padding: 12px !important;
    padding-bottom: calc(12px + var(--mobile-nav-h)) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Topbar */
  #topbar { padding: 0 14px; }

  /* Show mobile bottom nav */
  #mobile-nav { display: flex; }

  /* Forms: single column */
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr !important; }

  /* Filters: stack vertically */
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .search-box { flex: none; }
  .filter-select { width: 100%; }
  .filter-bar-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  .filter-bar-actions .btn { flex: 1; justify-content: center; }

  /* Cards */
  .card-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .card-header > div:last-child:not(:first-child) { width: 100%; justify-content: flex-start; flex-wrap: wrap; }

  /* Detail rows */
  .detail-label { width: 120px; font-size: 11px; }
  .detail-value { font-size: 13px; }

  /* Pagination: smaller */
  .page-btn { padding: 5px 9px; font-size: 12px; }

  /* Stat cards: 2 per row via grid in page */
  .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }

  /* Toast: full width bottom */
  #toast-container {
    top: auto !important; bottom: calc(var(--mobile-nav-h) + 12px) !important;
    right: 12px !important; left: 12px !important;
  }
  .toast { min-width: unset; max-width: 100%; width: 100%; }

  /* Notification dropdown: full width */
  #notif-dropdown { right: -8px; width: calc(100vw - 24px); }

  /* Tables: horizontal scroll */
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 560px; }
  .data-table th, .data-table td { padding: 9px 10px; }

  /* Modal */
  #modal-overlay { padding: 0 !important; align-items: flex-end !important; }
  #modal-box {
    border-radius: 20px 20px 0 0 !important;
    max-height: 92vh !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  /* Modal footer: wrap buttons */
  #modal-footer { flex-wrap: wrap; gap: 8px; }
  #modal-footer .btn { flex: 1; justify-content: center; min-width: 100px; }

  /* Bulk print bar */
  #bulk-print-bar { flex-wrap: wrap; gap: 6px; }

  /* Pagination row: wrap on mobile */
  .pagination-row { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Pending approval / BAST cards: stack vertically */
  .pending-card { flex-direction: column !important; align-items: flex-start !important; gap: 12px !important; }
  .pending-actions { width: 100%; display: flex; gap: 8px; }
  .pending-actions .btn { flex: 1; justify-content: center; }

  /* BAST item selector row: wrap on mobile */
  .bast-item { flex-wrap: wrap; }
  .bast-item .flex-1 { min-width: 0; width: 100%; flex-basis: 100%; }
  .bast-item .bast-condition { flex: 1; min-width: 100px; width: auto !important; }
  .bast-item .btn { flex-shrink: 0; }

  /* Profile top row: stack avatar + info */
  .profile-top { flex-direction: column !important; align-items: flex-start !important; gap: 14px !important; }

  /* QR preview: full width */
  .qr-preview-card { width: 100%; }

  /* Report tabs: scrollable on mobile */
  .border-b.px-4 > .flex.gap-1 { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .border-b.px-4 > .flex.gap-1 button { white-space: nowrap; flex-shrink: 0; }

  /* Audit / category / location card headers */
  .card-header .flex.gap-2 { flex-wrap: wrap; }

  /* Detail-grid col-span-2: reset on 1-col mobile */
  .detail-grid.grid-cols-1 .col-span-2 { grid-column: auto; }

  /* Info-grid items fill properly on mobile */
  .info-grid > * { min-width: 0; }
}

/* ============================================================
   TEMA BALI — Aksen visual Nusa Penida
   Hanya mengubah elemen struktural/brand.
   Elemen fungsional (badge, tombol status, form) tidak disentuh.
   Palette: teak #150b03 · terracotta #7a3812 · emas #c9922a · prada #f0c878
============================================================ */

/* ── Variabel warna Bali ──────────────────────────────────── */
:root {
  --bali-teak:    #150b03;
  --bali-brown:   #1e0f06;
  --bali-terra:   #7a3812;
  --bali-gold:    #c9922a;
  --bali-prada:   #f0c878;
  --bali-cream:   #f7ede1;
  --bali-stone:   #e8d9c8;
}

/* ── 1. Background halaman: krem hangat seperti paras ─────── */
body { background: var(--bali-cream) !important; }

/* ── 2. Sidebar: kayu teak gelap ─────────────────────────── */
#sidebar {
  background: linear-gradient(180deg,
    var(--bali-teak) 0%,
    var(--bali-brown) 55%,
    #26160a 100%) !important;
}

/* ── 3. Header sidebar: garis emas bawah ─────────────────── */
#sidebar > div:first-child {
  position: relative;
  border-bottom: none !important;
}
#sidebar > div:first-child::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg,
    transparent 5%,
    rgba(201,146,42,.55) 30%,
    rgba(240,200,120,.9) 50%,
    rgba(201,146,42,.55) 70%,
    transparent 95%);
}

/* ── 4. Sidebar clock: emas samar ─────────────────────────── */
#sidebar > div:nth-child(2) {
  border-bottom: 1px solid rgba(201,146,42,.2) !important;
}
#sidebar-clock-time { color: rgba(240,200,120,.88) !important; }
#sidebar-clock-date { color: rgba(240,200,120,.48) !important; }

/* ── 5. Nav aktif: border + teks emas ─────────────────────── */
.nav-item.active {
  background: rgba(201,146,42,.15) !important;
  color: var(--bali-prada) !important;
  border-left-color: var(--bali-gold) !important;
}

/* ── 6. Nav hover: glow emas lembut ───────────────────────── */
.nav-item:hover {
  background: rgba(201,146,42,.07) !important;
  color: #d4aa60 !important;
}

/* ── 7. Nav section label: emas pudar ─────────────────────── */
.nav-section { color: rgba(201,146,42,.42) !important; }

/* ── 8. Sidebar footer border ─────────────────────────────── */
#sidebar > div:last-child {
  border-top-color: rgba(201,146,42,.18) !important;
}

/* ── 9. Topbar: garis bawah hangat ────────────────────────── */
#topbar {
  border-bottom: 1.5px solid var(--bali-stone) !important;
  box-shadow: 0 1px 0 var(--bali-stone), 0 2px 10px rgba(0,0,0,0.045) !important;
}

/* ── 10. Mobile nav: coklat teak + aktif emas ─────────────── */
#mobile-nav {
  background: linear-gradient(180deg, var(--bali-brown), var(--bali-teak)) !important;
  border-top: 1px solid rgba(201,146,42,.28) !important;
}
.mobile-nav-item.active { color: var(--bali-prada) !important; }
.mobile-nav-item:hover  { color: var(--bali-gold)  !important; }

/* ── 11. Login brand: gradasi terracotta Bali ─────────────── */
.login-brand {
  background: linear-gradient(155deg,
    var(--bali-teak) 0%,
    #4a1e08 45%,
    var(--bali-terra) 100%) !important;
}

/* Motif berlian berulang (pola geringsing disederhanakan) */
.login-brand::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='44' height='44' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='22,3 41,22 22,41 3,22' fill='none' stroke='white' stroke-width='0.7'/%3E%3Ccircle cx='22' cy='22' r='2.2' fill='white'/%3E%3Ccircle cx='0' cy='0' r='1.2' fill='white'/%3E%3Ccircle cx='44' cy='0' r='1.2' fill='white'/%3E%3Ccircle cx='0' cy='44' r='1.2' fill='white'/%3E%3Ccircle cx='44' cy='44' r='1.2' fill='white'/%3E%3C/svg%3E");
  background-size: 44px 44px;
  opacity: 0.065;
  pointer-events: none;
}

/* Blob cahaya emas kiri bawah */
.login-brand::after {
  content: '';
  position: absolute; bottom: -80px; left: -60px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle,
    rgba(201,146,42,.22) 0%,
    transparent 68%);
  pointer-events: none;
}

/* Blob cahaya putih atas kanan: override juga */
.login-brand .login-brand-body::before {
  content: '';
  position: absolute; top: -100px; right: -100px;
  width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle,
    rgba(255,255,255,.06) 0%,
    transparent 65%);
  pointer-events: none;
}

/* Icon fitur login: emas hangat */
.login-feature-icon {
  background: rgba(201,146,42,.2) !important;
  color: var(--bali-prada) !important;
}

/* Login form wrap: krem hangat */
.login-form-wrap { background: var(--bali-cream) !important; }

/* ── 12. Card header: krem sangat tipis ───────────────────── */
.card-header {
  background: #fffdf8 !important;
  border-bottom-color: #eedece !important;
}

/* ── 13. Ornamen garis emas di bawah topbar (Bali strip) ──── */
#topbar::after {
  content: '';
  position: absolute; bottom: -3px; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(201,146,42,.18) 20%,
    rgba(201,146,42,.28) 50%,
    rgba(201,146,42,.18) 80%,
    transparent 100%);
  pointer-events: none;
}
/* Pastikan topbar punya position untuk ::after */
#topbar { position: sticky !important; }

/* ── 14. Sidebar overlay: warna hangat ────────────────────── */
#sidebar-overlay {
  background: rgba(21,11,3,.6) !important;
}

/* ── 17. Dashboard welcome banner ────────────────────────── */
.bali-welcome-banner {
  background: linear-gradient(120deg, #fffbf4 0%, #fdf5e8 100%);
  border: 1px solid #e8d5b8;
  border-left: 4px solid var(--bali-gold);
  border-radius: 10px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.bali-welcome-greeting {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--bali-terra);
  line-height: 1.3;
}
.bali-welcome-quote {
  font-size: 0.75rem;
  color: #9a7c60;
  margin-top: 3px;
  font-style: italic;
}
.bali-welcome-icon {
  font-size: 1.8rem;
  color: var(--bali-gold);
  opacity: 0.35;
  flex-shrink: 0;
  margin-left: 12px;
}

/* ── 18. Motif tumpal: pemisah section (pepalihan Bali) ──── */
/* Baris segitiga emas kecil, seperti ukiran pepalihan kayu */

/* Sidebar nav-section: tumpal di bawah label section */
.nav-section {
  padding-bottom: 2px !important;
}
.nav-section::after {
  content: '';
  display: block;
  height: 6px;
  margin-top: 5px;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='5,0 9,6 1,6' fill='%23c9922a'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 10px 6px;
  opacity: 0.45;
}

/* Form aset — section title "Informasi Aset", "Informasi Finansial" */
.asset-section-title {
  border-bottom: none !important;
  padding-bottom: 12px !important;
  position: relative;
}
.asset-section-title::after {
  content: '';
  position: absolute;
  bottom: 3px; left: 0; right: 0;
  height: 6px;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='5,0 9,6 1,6' fill='%23c9922a'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 10px 6px;
  opacity: 0.5;
}

/* Kelas utilitas: sisipkan <hr class="divider-tumpal"> di mana saja */
.divider-tumpal {
  display: block;
  width: 100%;
  height: 7px;
  border: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='7' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='5,0 9,7 1,7' fill='%23c9922a'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 10px 7px;
  margin: 12px 0;
  opacity: 0.6;
}

/* ── 15. Font Playfair Display: judul & header card ─────── */
.card-header span.font-semibold,
.card-header h2,
.card-header h3 {
  font-family: 'Playfair Display', Georgia, serif !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em !important;
}

/* ── 16. Page heading: gradient emas prada ───────────────── */
/* Targets h1 di halaman konten (bukan di modal/form) */
#main-content h1 {
  font-family: 'Playfair Display', Georgia, serif !important;
  font-weight: 700 !important;
  background: linear-gradient(135deg,
    #8a5c12 0%,
    var(--bali-gold) 35%,
    var(--bali-prada) 55%,
    var(--bali-gold) 75%,
    #8a5c12 100%);
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
  text-shadow: none !important;
}

/* Fallback: jika h1 tidak support background-clip */
@supports not (-webkit-background-clip: text) {
  #main-content h1 { color: var(--bali-gold) !important; }
}

/* ============================================================
   MOBILE-SPECIFIC FIXES
============================================================ */

/* ── 1. iOS AUTO-ZOOM PREVENTION ────────────────────────────
   iOS Safari auto-zoom when input font-size < 16px.
   Must apply to ALL interactive inputs globally on mobile. */
@media (max-width: 768px) {
  .form-input,
  .filter-select,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="search"],
  input[type="date"],
  input[type="time"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* ── 2. IOS SAFE AREA (iPhone X+ notch & home indicator) ── */
#topbar {
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}
#mobile-nav {
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom));
}
@media (max-width: 768px) {
  #main-content {
    padding-bottom: calc(12px + var(--mobile-nav-h) + env(safe-area-inset-bottom)) !important;
  }
}

/* ── 3. iOS DYNAMIC VIEWPORT HEIGHT (dvh) ────────────────── */
@supports (height: 100dvh) {
  @media (max-width: 768px) {
    #app:not(.app-hidden) { height: 100dvh !important; }
  }
  @media (max-width: 768px) {
    #login-page:not(.hidden) { min-height: 100dvh; }
  }
}

/* ── 4. MODAL BODY — iOS momentum scroll ─────────────────── */
#modal-body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ── 5. TABLE RESPONSIVE — smooth horizontal scroll ──────── */
.table-responsive {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

/* ── 6. TOUCH FEEDBACK untuk clickable rows/cards ────────── */
[onclick]:not(button):not(a):not(input):not(label) {
  -webkit-tap-highlight-color: rgba(0,0,0,0.05);
}
@media (max-width: 768px) {
  [onclick]:not(button):not(a):not(input):not(label) {
    cursor: pointer;
  }
  /* Active state untuk row/card yang clickable */
  tr[onclick]:active td,
  div[onclick]:active {
    background-color: rgba(0,0,0,0.04) !important;
  }
}

/* ── 7. TOUCH TARGET — minimum 44px untuk aksesibilitas ──── */
@media (max-width: 768px) {
  .btn-xs { padding: 8px 10px !important; min-height: 36px !important; }
  .btn-icon { min-width: 40px !important; min-height: 40px !important; }
  .mobile-nav-item { min-height: 44px !important; }
}

/* ── 8. OFFLINE BANNER — kompensasi topbar ────────────────── */
#offline-banner:not(.hidden) ~ * #topbar,
body:has(#offline-banner:not(.hidden)) #topbar {
  top: 32px;
}

/* ============================================================
   RESPONSIVE — SMALL MOBILE (max 480px)
============================================================ */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  .btn { font-size: 13px; padding: 7px 14px; }
  .btn-sm { padding: 5px 10px; font-size: 12px; }

  /* Stat card number: slightly smaller */
  .stat-card .text-2xl { font-size: 1.4rem; }

  /* QR preview card: horizontal to vertical on very small screens */
  .qr-preview-inner { flex-direction: column; align-items: center; text-align: center; }
  .qr-preview-inner img { width: 100px !important; height: 100px !important; }
}
