/* ============================================================
   REKAP FFS — Modern Design System
   ------------------------------------------------------------
   • Mobile-first, fully responsive
   • Sidebar (desktop) + Bottom-nav (mobile)
   • Glass / gradient surfaces, subtle shadows
   ============================================================ */

/* ---------- 1. Design Tokens ---------- */
:root {
  /* Brand */
  --brand-50:  #ecfdf5;
  --brand-100: #d1fae5;
  --brand-200: #a7f3d0;
  --brand-400: #34d399;
  --brand-500: #10b981;
  --brand-600: #059669;
  --brand-700: #047857;

  /* Accent */
  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;
  --violet-500: #8b5cf6;
  --rose-500:   #f43f5e;
  --amber-500:  #f59e0b;
  --sky-500:    #0ea5e9;

  /* Neutral */
  --bg:        #f6f8fb;
  --surface:   #ffffff;
  --surface-2: #f1f5f9;
  --border:    #e2e8f0;
  --text:      #0f172a;
  --text-2:    #475569;
  --muted:     #94a3b8;

  /* Sidebar */
  --sidebar-bg:   #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-hover: rgba(255,255,255,.06);
  --sidebar-active: rgba(16,185,129,.18);

  /* Radius & Shadow */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-2xl: 28px;

  --shadow-xs: 0 1px 2px rgba(15,23,42,.04);
  --shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,.07), 0 2px 4px rgba(15,23,42,.04);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.10), 0 4px 12px rgba(15,23,42,.04);
  --shadow-xl: 0 24px 56px rgba(15,23,42,.14);

  /* Layout */
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
  --bottomnav-h: 64px;

  /* Motion */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --t-fast: .15s var(--ease);
  --t-base: .25s var(--ease);
}

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Inter', 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background:
    radial-gradient(1100px 600px at -10% -10%, rgba(16,185,129,.08), transparent 60%),
    radial-gradient(900px 500px at 110% 0%, rgba(99,102,241,.07), transparent 60%),
    var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,h2,h3,h4,h5 { color: var(--text); font-weight: 700; letter-spacing: -.01em; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }

/* ---------- 3. App Shell Layout ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  min-height: 100vh;
  transition: grid-template-columns var(--t-base);
}

.app[data-sidebar="collapsed"] {
  grid-template-columns: var(--sidebar-w-collapsed) 1fr;
}

/* ---------- 4. Sidebar ---------- */
.sidebar {
  grid-area: sidebar;
  background: linear-gradient(180deg, #0b1220 0%, #0f172a 100%);
  color: var(--sidebar-text);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1040;
  border-right: 1px solid rgba(255,255,255,.06);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  height: var(--topbar-h);
}
.brand-logo {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand-500), var(--indigo-500));
  display: grid; place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .5px;
  box-shadow: 0 8px 22px rgba(16,185,129,.35);
  flex-shrink: 0;
}
.brand-text {
  display: flex; flex-direction: column;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
}
.brand-text strong {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .3px;
}
.brand-text small {
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-section {
  padding: 14px 14px 6px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(148,163,184,.6);
  font-weight: 600;
}
.app[data-sidebar="collapsed"] .sidebar-section,
.app[data-sidebar="collapsed"] .brand-text,
.app[data-sidebar="collapsed"] .nav-label,
.app[data-sidebar="collapsed"] .nav-badge { display: none; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-weight: 500;
  font-size: 14px;
  position: relative;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.nav-item i { width: 20px; font-size: 17px; text-align: center; flex-shrink: 0; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--indigo-500);
  color: #fff;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--brand-400), var(--indigo-500));
}
.nav-item .nav-label { white-space: nowrap; overflow: hidden; }

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,.06);
  font-size: 11px;
  color: rgba(148,163,184,.6);
  text-align: center;
}
.app[data-sidebar="collapsed"] .sidebar-footer { font-size: 0; }
.app[data-sidebar="collapsed"] .sidebar-footer::before { content: 'v1.0'; font-size: 11px; }

/* ---------- 5. Topbar ---------- */
.topbar {
  grid-area: topbar;
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 1020;
  height: var(--topbar-h);
}
.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.topbar-title small {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-top: 2px;
}

.btn-icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-2);
  display: inline-grid; place-items: center;
  cursor: pointer;
  transition: all var(--t-fast);
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); }
.btn-icon i { font-size: 18px; }

.topbar-spacer { flex: 1; }

.topbar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
}
.topbar-user:hover { background: #e9eef6; }
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--indigo-500));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.user-meta { line-height: 1.15; }
.user-meta strong { display: block; font-size: 12.5px; color: var(--text); }
.user-meta small { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(2px);
  z-index: 1035;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base);
}
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }

/* ---------- 6. Main ---------- */
.main {
  grid-area: main;
  padding: 22px;
  min-width: 0;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}
.page-head h1 {
  font-size: 22px;
  margin: 0;
  font-weight: 700;
}
.page-head h1 small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* ---------- 7. Cards ---------- */
.card-x {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.card-x:hover { box-shadow: var(--shadow-md); }
.card-x .card-x-body { padding: 20px; }
.card-x .card-x-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.card-x .card-x-head h3, .card-x .card-x-head h5 {
  font-size: 15px; margin: 0; font-weight: 700;
}

/* ---------- 8. Stat Cards ---------- */
.stat-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 22px;
}
.stat {
  position: relative;
  border-radius: var(--r-xl);
  padding: 22px;
  color: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat::before {
  content: '';
  position: absolute;
  inset: -40% -10% auto auto;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.22), transparent 70%);
  pointer-events: none;
}
.stat::after {
  content: '';
  position: absolute;
  inset: auto auto -60% -10%;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.12), transparent 70%);
  pointer-events: none;
}
.stat .stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  opacity: .85;
  font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.stat .stat-value {
  font-size: clamp(20px, 2.6vw, 30px);
  font-weight: 800;
  letter-spacing: -.02em;
  margin-top: 8px;
  word-break: break-word;
}
.stat .stat-foot {
  margin-top: 14px;
  font-size: 12px;
  opacity: .9;
  display: flex; align-items: center; gap: 6px;
}
.stat .stat-icon {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: rgba(255,255,255,.18);
  display: grid; place-items: center;
  font-size: 22px;
  position: absolute;
  right: 22px; top: 22px;
  z-index: 1;
}
.stat.income  { background: linear-gradient(135deg, #10b981 0%, #059669 60%, #047857 100%); }
.stat.expense { background: linear-gradient(135deg, #f43f5e 0%, #e11d48 60%, #be123c 100%); }
.stat.balance { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 60%, #4338ca 100%); }
.stat.neutral { background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 60%, #0369a1 100%); }

/* Mini summary cards (filter bar) */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.mini-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}
.mini-stat::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
}
.mini-stat.in::before  { background: var(--brand-500); }
.mini-stat.out::before { background: var(--rose-500); }
.mini-stat.net::before { background: var(--indigo-500); }
.mini-stat small {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); font-weight: 600;
}
.mini-stat strong {
  font-size: 16px; font-weight: 800;
}
.mini-stat.in strong  { color: var(--brand-700); }
.mini-stat.out strong { color: var(--rose-500); }
.mini-stat.net strong { color: var(--indigo-600); }

/* ---------- 9. Buttons ---------- */
.btn-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  line-height: 1;
  font-family: inherit;
}
.btn-x:active { transform: translateY(1px); }
.btn-x i { font-size: 15px; }
.btn-x-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff;
  box-shadow: 0 6px 18px rgba(16,185,129,.30);
}
.btn-x-primary:hover {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  color: #fff;
  box-shadow: 0 10px 26px rgba(16,185,129,.40);
  transform: translateY(-1px);
}
.btn-x-soft {
  background: var(--brand-50);
  color: var(--brand-700);
  border-color: var(--brand-100);
}
.btn-x-soft:hover { background: var(--brand-100); color: var(--brand-700); }
.btn-x-ghost {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--border);
}
.btn-x-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-x-danger {
  background: #fff;
  color: var(--rose-500);
  border-color: #fecdd3;
}
.btn-x-danger:hover { background: var(--rose-500); color: #fff; border-color: var(--rose-500); }
.btn-x-warning {
  background: #fff;
  color: #b45309;
  border-color: #fde68a;
}
.btn-x-warning:hover { background: #f59e0b; color: #fff; border-color: #f59e0b; }

.btn-x-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-x-lg { padding: 13px 22px; font-size: 15px; border-radius: 13px; }
.btn-x-block { width: 100%; }

/* ---------- 10. Forms ---------- */
.form-control-x, .form-select-x {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 11px;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  height: auto;
  min-height: 44px;
}
.form-control-x:focus, .form-select-x:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(16,185,129,.15);
}
.form-select-x {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}
label.form-label-x {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: .2px;
}
.input-group-x {
  position: relative;
}
.input-group-x .input-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  pointer-events: none;
}
.input-group-x .form-control-x { padding-left: 42px; }

/* ---------- 11. Table (desktop) & Card list (mobile) ---------- */
.table-x {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.table-x thead th {
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .8px;
  font-weight: 700;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table-x tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}
.table-x tbody tr:last-child td { border-bottom: 0; }
.table-x tbody tr { transition: background var(--t-fast); }
.table-x tbody tr:hover { background: var(--surface-2); }

.tx-amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.tx-amount.in  { color: var(--brand-600); }
.tx-amount.out { color: var(--rose-500); }

/* Card list (mobile) */
.tx-list { display: none; }
.tx-list-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.tx-list-item:last-child { border-bottom: 0; }
.tx-list-item .tx-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.tx-list-item .tx-icon.in  { background: var(--brand-50); color: var(--brand-600); }
.tx-list-item .tx-icon.out { background: #ffe4e6; color: var(--rose-500); }
.tx-list-item .tx-info { flex: 1; min-width: 0; }
.tx-list-item .tx-info strong {
  display: block; font-size: 13.5px; font-weight: 700;
  color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tx-list-item .tx-info small {
  display: block; font-size: 11.5px; color: var(--muted);
  margin-top: 2px;
}
.tx-list-item .tx-right { text-align: right; flex-shrink: 0; }
.tx-list-item .tx-right .tx-amount { display: block; font-size: 14px; }
.tx-list-item .tx-right .tx-actions {
  display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px;
}
.tx-list-item .tx-right .tx-actions .btn-x { padding: 5px 8px; font-size: 11.5px; }

/* ---------- 12. Badges ---------- */
.badge-x {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .3px;
}
.badge-x.in  { background: var(--brand-50); color: var(--brand-700); }
.badge-x.out { background: #ffe4e6; color: #be123c; }
.badge-x.role-sa { background: #eef2ff; color: var(--indigo-600); }
.badge-x.role-ad { background: #ecfeff; color: #0e7490; }
.badge-x.muted  { background: var(--surface-2); color: var(--text-2); }

/* ---------- 13. Filter bar ---------- */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-xs);
}
.filter-bar .row { row-gap: 10px; }

/* ---------- 14. Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--muted);
}
.empty-state i {
  font-size: 56px;
  display: block;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--brand-100), var(--indigo-100));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.empty-state h5 { color: var(--text); margin: 0 0 6px; font-size: 16px; }
.empty-state p  { margin: 0 0 16px; font-size: 13.5px; }

/* ---------- 15. Flash / Alerts ---------- */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  margin-bottom: 16px;
  animation: slideDown .35s var(--ease);
}
.flash i { font-size: 18px; }
.flash.success { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.flash.danger  { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.flash.warning { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.flash.info    { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.flash .close-flash {
  margin-left: auto;
  background: none; border: 0; color: inherit; opacity: .6; cursor: pointer; font-size: 18px;
}
.flash .close-flash:hover { opacity: 1; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 16. Modal (responsive bottom sheet on mobile) ---------- */
.modal-x {
  position: fixed;
  inset: 0;
  z-index: 1060;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  padding: 20px;
  animation: fadeIn .2s var(--ease);
}
.modal-x.show { display: flex; }
.modal-x .modal-x-dialog {
  background: var(--surface);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  animation: popIn .25s var(--ease);
}
.modal-x .modal-x-head {
  padding: 18px 22px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--brand-50), #fff);
}
.modal-x .modal-x-head h3 { margin: 0; font-size: 16px; }
.modal-x .modal-x-head .modal-x-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--brand-500);
  color: #fff;
  display: grid; place-items: center;
  margin-right: 10px;
}
.modal-x .modal-x-head .head-text { display: flex; align-items: center; }
.modal-x .modal-x-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}
.modal-x .modal-x-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
  background: var(--surface-2);
}
.modal-x .modal-x-close {
  background: transparent; border: 0;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer; color: var(--muted);
  transition: all var(--t-fast);
}
.modal-x .modal-x-close:hover { background: var(--surface-2); color: var(--text); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------- 17. Login page ---------- */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  background:
    radial-gradient(900px 600px at 0% 0%, rgba(16,185,129,.18), transparent 60%),
    radial-gradient(900px 700px at 100% 100%, rgba(99,102,241,.18), transparent 60%),
    linear-gradient(135deg, #0b1220 0%, #0f172a 100%);
  position: relative;
  overflow: hidden;
}
.login-shell::before {
  content: '';
  position: absolute;
  width: 480px; height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16,185,129,.25), transparent 70%);
  top: -120px; right: -120px;
  filter: blur(20px);
}
.login-shell::after {
  content: '';
  position: absolute;
  width: 540px; height: 540px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,.25), transparent 70%);
  bottom: -180px; left: -180px;
  filter: blur(20px);
}
.login-hero {
  display: none;
  position: relative;
  z-index: 1;
  padding: 56px;
  color: #fff;
  flex-direction: column;
  justify-content: space-between;
}
.login-hero h1 { color: #fff; font-size: 36px; line-height: 1.15; }
.login-hero p { color: rgba(255,255,255,.75); font-size: 15px; max-width: 420px; }
.login-hero .login-feature-list {
  display: flex; flex-direction: column; gap: 14px; margin-top: 32px;
}
.login-hero .login-feature-list .feat {
  display: flex; align-items: center; gap: 12px;
  color: rgba(255,255,255,.9); font-size: 14px;
}
.login-hero .login-feature-list .feat i {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,.12);
  display: grid; place-items: center;
  font-size: 17px;
}

.login-pane {
  display: flex; align-items: center; justify-content: center;
  padding: 32px 20px;
  position: relative;
  z-index: 1;
}
.login-card {
  background: rgba(255,255,255,.98);
  border-radius: var(--r-2xl);
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.login-card .login-brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 22px;
}
.login-card .login-brand .brand-logo { width: 44px; height: 44px; font-size: 15px; }
.login-card .login-brand strong { display: block; font-size: 16px; color: var(--text); }
.login-card .login-brand small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.login-card h2 { margin: 0 0 6px; font-size: 22px; }
.login-card .subtitle { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.login-card .form-group { margin-bottom: 14px; }
.login-card .btn-x-primary { margin-top: 8px; }
.login-foot {
  text-align: center; margin-top: 18px; font-size: 12px; color: var(--muted);
}

/* ---------- 18. Bottom Navigation (mobile) ---------- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h);
  background: rgba(255,255,255,.95);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
  z-index: 1030;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around;
  align-items: center;
}
.bn-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: color var(--t-fast);
  text-decoration: none;
}
.bn-item i { font-size: 19px; }
.bn-item.active { color: var(--brand-600); }
.bn-item.active i { transform: scale(1.1); }
.bn-fab {
  flex: 0 0 56px;
  margin: 0 4px;
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff;
  border-radius: 50%;
  display: grid; place-items: center;
  box-shadow: 0 10px 26px rgba(16,185,129,.40);
  font-size: 24px;
  position: relative;
  top: -14px;
  transition: transform var(--t-fast);
  text-decoration: none;
}
.bn-fab:hover { transform: scale(1.05); color: #fff; }

/* ---------- 19. Section title ---------- */
.section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.section-title i {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--brand-50);
  color: var(--brand-600);
  display: grid; place-items: center;
  font-size: 15px;
}
.section-title.muted { color: var(--text-2); }
.section-title.muted i { background: var(--surface-2); color: var(--text-2); }

/* ---------- 20. Avatar (user dropdown) ---------- */
.dropdown-x {
  position: relative;
}
.dropdown-x-menu {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 1080;
  display: none;
  animation: popIn .15s var(--ease);
}
.dropdown-x-menu.show { display: block; }
.dropdown-x-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast);
  text-decoration: none;
}
.dropdown-x-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-x-item.danger { color: var(--rose-500); }
.dropdown-x-item.danger:hover { background: #fee2e2; color: #b91c1c; }
.dropdown-x-divider { height: 1px; background: var(--border); margin: 6px 0; }

/* ---------- 21. Misc ---------- */
.text-muted-x { color: var(--muted); }
.text-2-x { color: var(--text-2); }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; } .mb-4 { margin-bottom: 22px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 22px; }
.gap-1 { gap: 6px; } .gap-2 { gap: 10px; } .gap-3 { gap: 16px; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.text-end { text-align: right; } .text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.hide-mobile { display: initial; }
.show-mobile { display: none; }
.row { display: flex; flex-wrap: wrap; }
.row.g-2 > * { padding: 6px; }
.row.g-3 > * { padding: 8px; }

/* ============================================================
   RESPONSIVE — Tablet & Mobile
   ============================================================ */

/* Tablet & below */
@media (max-width: 991.98px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "main";
  }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform var(--t-base);
    z-index: 1050;
  }
  .sidebar.open { transform: translateX(0); }
  .app[data-sidebar="collapsed"] .sidebar { transform: translateX(-100%); }
  .sidebar-overlay { z-index: 1045; }
  .main { padding: 18px 16px 90px; }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
}

/* Mobile */
@media (max-width: 767.98px) {
  body { font-size: 14px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-title { font-size: 14.5px; }
  .topbar-title small { display: none; }
  .topbar-user .user-meta { display: none; }
  .topbar-user { padding: 4px; }
  .user-avatar { width: 34px; height: 34px; }

  .main { padding: 14px 12px calc(80px + env(safe-area-inset-bottom)); }

  .stat-grid { grid-template-columns: 1fr; gap: 12px; }
  .stat { padding: 18px; }
  .stat .stat-value { font-size: 22px; }
  .stat .stat-icon { width: 40px; height: 40px; font-size: 18px; right: 18px; top: 18px; }

  .mini-stats { grid-template-columns: 1fr; gap: 10px; }

  .hide-mobile { display: none !important; }
  .show-mobile { display: initial; }

  /* Hide desktop table, show mobile card list */
  .table-responsive { display: none; }
  .tx-list { display: block; }

  /* Modal becomes bottom sheet */
  .modal-x { align-items: flex-end; padding: 0; }
  .modal-x .modal-x-dialog {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--r-2xl) var(--r-2xl) 0 0;
    animation: slideUp .3s var(--ease);
  }
  @keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  .modal-x .modal-x-body { padding: 18px; }
  .modal-x .modal-x-foot { padding: 14px 18px; }

  /* Bottom navigation */
  .bottom-nav { display: flex; }

  /* Page head */
  .page-head h1 { font-size: 18px; }
  .page-head h1 small { font-size: 11px; }

  /* Filter bar */
  .filter-bar { padding: 12px; }
  .filter-bar .row > [class*="col-"] { flex: 0 0 50%; max-width: 50%; }
  .filter-bar .row > .col-md-1,
  .filter-bar .row > .col-md-2 { flex: 0 0 50%; max-width: 50%; }

  /* Login */
  .login-card { padding: 26px 22px; border-radius: var(--r-xl); }
  .login-card h2 { font-size: 20px; }

  /* Section title */
  .section-title { font-size: 12.5px; }

  /* Tables in laporan */
  .laporan-tbl th, .laporan-tbl td { font-size: 12px; padding: 10px; }
}

/* Mobile small */
@media (max-width: 380px) {
  .stat .stat-value { font-size: 19px; }
  .topbar-title { font-size: 13px; }
  .page-head h1 { font-size: 16px; }
}

/* Desktop only */
@media (min-width: 992px) {
  .login-hero { display: flex; }
  .login-shell { grid-template-columns: 1fr 1fr; }
}

/* Print */
@media print {
  .sidebar, .topbar, .bottom-nav, .btn-x { display: none !important; }
  .main { padding: 0; }
  .app { grid-template-columns: 1fr; grid-template-areas: "main"; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}