/* =============================================
   RT DIGITAL - MOBILE-FIRST CSS v2.1
   + Sidebar + Inline Logs
   ============================================= */

:root {
  --primary: #4F46E5;
  --primary-light: #818CF8;
  --primary-dark: #3730A3;
  --success: #059669;
  --success-light: #34D399;
  --danger: #DC2626;
  --danger-light: #F87171;
  --warning: #D97706;
  --warning-light: #FBBF24;
  --info: #0891B2;
  --info-light: #22D3EE;
  --bg: #F0F2F5;
  --bg-card: #FFFFFF;
  --bg-sidebar: #1E1B4B;
  --text: #1F2937;
  --text-secondary: #6B7280;
  --text-light: #9CA3AF;
  --text-white: #FFFFFF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --transition: all 0.2s ease;
  --transition-slow: all 0.3s ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --bottom-nav-height: 64px;
  --header-height: 56px;
  --sidebar-width: 280px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--text-light); border-radius: var(--radius-full); }
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.3; color: var(--text); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }

/* ---------- APP LAYOUT ---------- */
.app-layout { display: flex; min-height: 100vh; }
.app-main { flex: 1; padding-bottom: calc(var(--bottom-nav-height) + 16px); min-height: 100vh; }

/* ---------- HEADER ---------- */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
  height: var(--header-height);
}
.app-header .logo { display: flex; align-items: center; gap: 10px; }
.app-header .logo-icon { width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: white; font-weight: 800; font-size: 14px; }
.app-header .logo-text { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.app-header .header-actions { display: flex; align-items: center; gap: 8px; }
.app-header .btn-icon { width: 36px; height: 36px; border-radius: var(--radius-full); border: none; background: var(--bg); color: var(--text); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition); font-size: 18px; position: relative; }
.app-header .btn-icon:hover { background: var(--primary); color: white; }
.app-header .btn-icon .badge-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid white; }

/* ---------- SIDEBAR ---------- */
.sidebar-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); z-index: 9998;
  opacity: 0; visibility: hidden; transition: var(--transition-slow);
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width); max-width: 85vw;
  background: var(--bg-sidebar); color: var(--text-white);
  z-index: 9999; transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column;
}
.sidebar.active { transform: translateX(0); }

.sidebar-header {
  padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-header .s-logo { width: 40px; height: 40px; background: linear-gradient(135deg, var(--primary-light), #A78BFA); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; }
.sidebar-header .s-info { flex: 1; }
.sidebar-header .s-name { font-weight: 700; font-size: .95rem; }
.sidebar-header .s-role { font-size: .7rem; opacity: .7; }

.sidebar-close {
  position: absolute; top: 16px; right: 12px;
  width: 32px; height: 32px; border-radius: var(--radius-full);
  background: rgba(255,255,255,0.1); border: none; color: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px; transition: var(--transition);
}
.sidebar-close:hover { background: rgba(255,255,255,0.2); }

.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav .nav-group-label { padding: 8px 20px 4px; font-size: .65rem; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,0.4); font-weight: 600; }
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; color: rgba(255,255,255,0.7);
  font-size: .85rem; font-weight: 500; transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.sidebar-nav .nav-link:hover, .sidebar-nav .nav-link.active {
  background: rgba(255,255,255,0.1); color: white;
}
.sidebar-nav .nav-link.active { border-right: 3px solid var(--primary-light); }
.sidebar-nav .nav-link .nav-icon { width: 20px; text-align: center; font-size: 16px; }
.sidebar-nav .nav-link .nav-badge {
  margin-left: auto; padding: 2px 8px; border-radius: var(--radius-full);
  background: var(--danger); color: white; font-size: .6rem; font-weight: 700;
}

.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1);
  font-size: .7rem; opacity: .5; text-align: center;
}

/* ---------- MENU TOGGLE BUTTON (bottom-right) ---------- */
.menu-toggle {
  position: fixed; bottom: calc(var(--bottom-nav-height) + 16px); right: 16px;
  width: 48px; height: 48px; border-radius: var(--radius-full);
  background: var(--bg-sidebar); color: white; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 50; transition: var(--transition-slow);
  box-shadow: var(--shadow-lg); -webkit-tap-highlight-color: transparent;
}
.menu-toggle:hover { transform: scale(1.08); box-shadow: var(--shadow-xl); }
.menu-toggle:active { transform: scale(0.95); }
.menu-toggle svg { transition: var(--transition); }
.menu-toggle.active { background: var(--danger); }
.menu-toggle.active svg { transform: rotate(90deg); }

/* ---------- BOTTOM NAV ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--bottom-nav-height);
  background: var(--bg-card); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around; z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom, 0); box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}
.bottom-nav .nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 8px; border-radius: var(--radius); color: var(--text-light);
  font-size: 10px; font-weight: 500; transition: var(--transition);
  text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.bottom-nav .nav-item svg { width: 22px; height: 22px; }
.bottom-nav .nav-item.active { color: var(--primary); }
.bottom-nav .nav-item.active::before {
  content: ''; position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px; background: var(--primary); border-radius: 0 0 3px 3px;
}

/* ---------- PAGE CONTENT ---------- */
.page-content { padding: 16px; max-width: 768px; margin: 0 auto; }
.page-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 8px; }
.page-title h1 { display: flex; align-items: center; gap: 10px; }
.back-btn {
  width: 36px; height: 36px; border-radius: var(--radius-full); background: var(--bg);
  border: none; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text); transition: var(--transition); -webkit-tap-highlight-color: transparent;
}
.back-btn:hover { background: var(--primary); color: white; }

/* ---------- CARDS ---------- */
.card { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; transition: var(--transition); border: 1px solid var(--border-light); }
.card:hover { box-shadow: var(--shadow-md); }
.card-header { padding: 14px 16px; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; justify-content: space-between; }
.card-body { padding: 16px; }
.card-footer { padding: 12px 16px; border-top: 1px solid var(--border-light); background: var(--bg); }

/* ---------- SALDO CARD ---------- */
.saldo-card { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border-radius: var(--radius-xl); padding: 24px; color: white; position: relative; overflow: hidden; margin-bottom: 16px; }
.saldo-card::before { content: ''; position: absolute; top: -50%; right: -20%; width: 200px; height: 200px; background: rgba(255,255,255,0.1); border-radius: 50%; }
.saldo-card::after { content: ''; position: absolute; bottom: -30%; left: -10%; width: 150px; height: 150px; background: rgba(255,255,255,0.05); border-radius: 50%; }
.saldo-card .saldo-label { font-size: .8rem; opacity: .8; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 1px; }
.saldo-card .saldo-amount { font-size: 1.75rem; font-weight: 800; margin-bottom: 16px; position: relative; }
.saldo-card .saldo-stats { display: flex; gap: 12px; position: relative; }
.saldo-card .saldo-stat { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.15); padding: 8px 12px; border-radius: var(--radius); flex: 1; }
.saldo-card .saldo-stat .stat-icon { width: 28px; height: 28px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; font-size: 14px; }
.saldo-card .saldo-stat.income .stat-icon { background: rgba(52,211,153,0.3); }
.saldo-card .saldo-stat.expense .stat-icon { background: rgba(248,113,113,0.3); }
.saldo-card .saldo-stat .stat-info { font-size: .7rem; opacity: .8; }
.saldo-card .saldo-stat .stat-amount { font-size: .9rem; font-weight: 700; }

/* ---------- MODUL GRID ---------- */
.modul-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.modul-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow); transition: var(--transition-slow); cursor: pointer; border: 1px solid var(--border-light); text-decoration: none; color: inherit; position: relative; overflow: hidden; -webkit-tap-highlight-color: transparent; }
.modul-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.modul-card:active { transform: scale(0.97); }
.modul-card .modul-icon { width: 44px; height: 44px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 12px; color: white; }
.modul-card .modul-name { font-weight: 700; font-size: .9rem; margin-bottom: 4px; }
.modul-card .modul-saldo { font-size: 1rem; font-weight: 800; color: var(--text); }
.modul-card .modul-badge { position: absolute; top: 12px; right: 12px; font-size: .65rem; padding: 2px 8px; border-radius: var(--radius-full); font-weight: 600; }

/* ---------- TRANSAKSI LIST ---------- */
.transaksi-list { display: flex; flex-direction: column; gap: 8px; }
.transaksi-item { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border-light); transition: var(--transition); -webkit-tap-highlight-color: transparent; }
.transaksi-item .t-icon { width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.transaksi-item .t-icon.income { background: #ECFDF5; color: var(--success); }
.transaksi-item .t-icon.expense { background: #FEF2F2; color: var(--danger); }
.transaksi-item .t-info { flex: 1; min-width: 0; }
.transaksi-item .t-info .t-kategori { font-weight: 600; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.transaksi-item .t-info .t-keterangan { font-size: .75rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.transaksi-item .t-amount { font-weight: 700; font-size: .85rem; white-space: nowrap; }
.transaksi-item .t-amount.income { color: var(--success); }
.transaksi-item .t-amount.expense { color: var(--danger); }
.transaksi-item .t-date { font-size: .65rem; color: var(--text-light); }

/* ---------- BUTTONS ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border: none; border-radius: var(--radius); font-family: var(--font); font-size: .85rem; font-weight: 600; cursor: pointer; transition: var(--transition); text-decoration: none; white-space: nowrap; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #047857; color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #B91C1C; color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #B45309; color: white; }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: #EEF2FF; }
.btn-sm { padding: 6px 12px; font-size: .75rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-fab {
  position: fixed; bottom: calc(var(--bottom-nav-height) + 72px); right: 16px;
  width: 52px; height: 52px; border-radius: var(--radius-full);
  background: var(--primary); color: white; display: flex; align-items: center; justify-content: center;
  font-size: 24px; box-shadow: var(--shadow-lg); z-index: 49; border: none; cursor: pointer;
  transition: var(--transition); -webkit-tap-highlight-color: transparent;
}
.btn-fab:hover { transform: scale(1.08); box-shadow: var(--shadow-xl); }
.btn-fab:active { transform: scale(0.95); }

/* ---------- FORMS ---------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label .required { color: var(--danger); }
.form-control { width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: var(--radius); font-family: var(--font); font-size: .9rem; color: var(--text); background: var(--bg-card); transition: var(--transition); -webkit-appearance: none; appearance: none; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.form-control::placeholder { color: var(--text-light); }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-text { font-size: .7rem; color: var(--text-light); margin-top: 4px; }
.form-error { font-size: .75rem; color: var(--danger); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-amount { position: relative; }
.input-amount .prefix { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-weight: 700; color: var(--text-secondary); font-size: .9rem; }
.input-amount .form-control { padding-left: 40px; font-weight: 700; font-size: 1.1rem; }

/* ---------- BADGES ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--radius-full); font-size: .7rem; font-weight: 600; }
.badge-success { background: #ECFDF5; color: var(--success); }
.badge-danger { background: #FEF2F2; color: var(--danger); }
.badge-warning { background: #FFFBEB; color: var(--warning); }
.badge-primary { background: #EEF2FF; color: var(--primary); }
.badge-info { background: #ECFEFF; color: var(--info); }

/* ---------- ALERTS ---------- */
.alert { padding: 14px 16px; border-radius: var(--radius); font-size: .85rem; font-weight: 500; display: flex; align-items: center; gap: 10px; margin-bottom: 16px; animation: fadeInDown .3s ease; }
.alert-success { background: #ECFDF5; color: var(--success); border: 1px solid #A7F3D0; }
.alert-danger { background: #FEF2F2; color: var(--danger); border: 1px solid #FECACA; }
.alert-warning { background: #FFFBEB; color: var(--warning); border: 1px solid #FDE68A; }
.alert-info { background: #ECFEFF; color: var(--info); border: 1px solid #A5F3FC; }

/* ---------- TABLE ---------- */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
.table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.table th, .table td { padding: 10px 12px; text-align: left; white-space: nowrap; }
.table th { background: var(--bg); font-weight: 600; color: var(--text-secondary); font-size: .7rem; text-transform: uppercase; letter-spacing: .5px; position: sticky; top: 0; }
.table tr { border-bottom: 1px solid var(--border-light); }
.table tr:hover { background: var(--bg); }

/* ---------- TABS ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg); border-radius: var(--radius); margin-bottom: 16px; overflow-x: auto; }
.tab-btn { flex: 1; padding: 10px 14px; border: none; border-radius: var(--radius-sm); background: transparent; color: var(--text-secondary); font-family: var(--font); font-size: .8rem; font-weight: 600; cursor: pointer; transition: var(--transition); white-space: nowrap; -webkit-tap-highlight-color: transparent; }
.tab-btn.active { background: var(--bg-card); color: var(--primary); box-shadow: var(--shadow-sm); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn .2s ease; }

/* ---------- INLINE LOG (Collapsible) ---------- */
.inline-log { margin-top: 20px; }
.inline-log-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: var(--bg); border-radius: var(--radius);
  cursor: pointer; font-size: .8rem; font-weight: 600;
  color: var(--text-secondary); transition: var(--transition);
  border: 1px solid var(--border-light); width: 100%;
  -webkit-tap-highlight-color: transparent;
}
.inline-log-toggle:hover { background: var(--border-light); }
.inline-log-toggle .toggle-icon { transition: transform .2s ease; font-size: 12px; }
.inline-log-toggle.active .toggle-icon { transform: rotate(90deg); }
.inline-log-toggle .log-count { margin-left: auto; padding: 2px 8px; background: var(--primary); color: white; border-radius: var(--radius-full); font-size: .6rem; }
.inline-log-body {
  max-height: 0; overflow: hidden; transition: max-height .3s ease;
  background: var(--bg-card); border-radius: 0 0 var(--radius) var(--radius);
  border: 1px solid var(--border-light); border-top: none;
}
.inline-log-body.open { max-height: 600px; overflow-y: auto; }
.inline-log-body .log-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border-light);
  font-size: .78rem;
}
.inline-log-body .log-item:last-child { border-bottom: none; }
.inline-log-body .log-item .log-icon { width: 28px; height: 28px; border-radius: 8px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.inline-log-body .log-item .log-info { flex: 1; min-width: 0; }
.inline-log-body .log-item .log-actor { font-weight: 600; }
.inline-log-body .log-item .log-detail { color: var(--text-secondary); font-size: .72rem; margin-top: 2px; }
.inline-log-body .log-item .log-time { font-size: .6rem; color: var(--text-light); white-space: nowrap; flex-shrink: 0; margin-top: 2px; }

/* ---------- FILTER BAR ---------- */
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 4px; }
.filter-chip { padding: 8px 14px; border-radius: var(--radius-full); border: 2px solid var(--border); background: var(--bg-card); font-size: .75rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; transition: var(--transition); white-space: nowrap; -webkit-tap-highlight-color: transparent; }
.filter-chip.active { border-color: var(--primary); background: #EEF2FF; color: var(--primary); }

/* ---------- SEARCH BAR ---------- */
.search-bar { position: relative; margin-bottom: 16px; }
.search-bar .search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-light); }
.search-bar .form-control { padding-left: 40px; border-radius: var(--radius-full); background: var(--bg); border-color: transparent; }
.search-bar .form-control:focus { background: var(--bg-card); border-color: var(--primary); }

/* ---------- SUMMARY STRIP ---------- */
.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.summary-item { background: var(--bg-card); padding: 12px; border-radius: var(--radius); text-align: center; box-shadow: var(--shadow-sm); border: 1px solid var(--border-light); }
.summary-item .summary-label { font-size: .65rem; color: var(--text-light); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.summary-item .summary-value { font-size: .9rem; font-weight: 800; }
.summary-item .summary-value.positive { color: var(--success); }
.summary-item .summary-value.negative { color: var(--danger); }

/* ---------- SECTION DIVIDER ---------- */
.section-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 12px; }
.section-divider span { font-size: .8rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
.section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------- EXPORT ---------- */
.export-group { display: flex; gap: 8px; }
.export-btn { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-card); font-size: .75rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; transition: var(--transition); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.export-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- EMPTY STATE ---------- */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .3; }
.empty-state .empty-title { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.empty-state .empty-text { font-size: .8rem; color: var(--text-light); margin-bottom: 16px; }

/* ---------- TRANSFER VISUAL ---------- */
.transfer-visual { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 20px 0; padding: 20px; background: var(--bg); border-radius: var(--radius-lg); }
.transfer-visual .tv-modul { text-align: center; }
.transfer-visual .tv-icon { width: 52px; height: 52px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 22px; color: white; margin: 0 auto 8px; }
.transfer-visual .tv-name { font-size: .75rem; font-weight: 600; }
.transfer-visual .tv-arrow { font-size: 24px; color: var(--primary); animation: pulse 1.5s infinite; }

/* ---------- LOGIN ---------- */
.login-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: linear-gradient(135deg, var(--primary-dark), var(--primary)); padding: 16px; justify-content: center; }
.login-header { text-align: center; color: white; padding: 16px 0 12px; }
.login-header .login-logo { width: 56px; height: 56px; background: rgba(255,255,255,0.2); border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; color: white; margin: 0 auto 10px; }
.login-header h1 { color: white; font-size: 1.3rem; }
.login-header p { opacity: .8; font-size: .8rem; margin-top: 2px; }
.login-form { background: var(--bg-card); border-radius: var(--radius-xl); padding: 24px 20px; margin-top: 16px; box-shadow: var(--shadow-xl); }

/* ---------- ANIMATIONS ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* ---------- PAGINATION ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 20px 0 8px; flex-wrap: wrap; }
.pagination .page-btn { min-width: 36px; height: 36px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary); font-size: .8rem; font-weight: 600; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition); text-decoration: none; padding: 0 8px; -webkit-tap-highlight-color: transparent; }
.pagination .page-btn:hover { border-color: var(--primary); color: var(--primary); background: #EEF2FF; }
.pagination .page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination .page-btn.disabled { opacity: .4; pointer-events: none; }
.pagination .page-info { font-size: .75rem; color: var(--text-light); margin: 8px 0; text-align: center; }

/* ---------- SKELETON LOADER ---------- */
.skeleton { background: linear-gradient(90deg, var(--border-light) 25%, var(--bg) 50%, var(--border-light) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm); }
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w40 { width: 40%; }
.skeleton-card { height: 80px; border-radius: var(--radius); margin-bottom: 8px; }

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- TOAST NOTIFICATION ---------- */
.toast-container { position: fixed; top: calc(var(--header-height) + 8px); right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { padding: 12px 16px; border-radius: var(--radius); background: var(--bg-card); box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; font-size: .8rem; font-weight: 500; pointer-events: auto; animation: toastIn .3s ease; max-width: 320px; border-left: 4px solid var(--primary); }
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-danger { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-out { animation: toastOut .3s ease forwards; }

@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px); } }

/* ---------- RIPPLE EFFECT ---------- */
.ripple { position: relative; overflow: hidden; }
.ripple::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,0.3); width: 100px; height: 100px; margin-top: -50px; margin-left: -50px; top: 50%; left: 50%; transform: scale(0); opacity: 1; }
.ripple:active::after { animation: rippleAnim .5s ease-out; }
@keyframes rippleAnim { to { transform: scale(4); opacity: 0; } }

/* ---------- ENHANCED SALDO CARD ---------- */
.saldo-card { position: relative; }
.saldo-card .saldo-glow { position: absolute; top: -50%; right: -30%; width: 250px; height: 250px; background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%); border-radius: 50%; animation: glowPulse 4s ease-in-out infinite; }
@keyframes glowPulse { 0%,100% { transform: scale(1); opacity: 0.5; } 50% { transform: scale(1.1); opacity: 0.8; } }

/* ---------- ENHANCED TRANSACTION ITEM ---------- */
.transaksi-item { position: relative; }
.transaksi-item::after { content: ''; position: absolute; bottom: 0; left: 60px; right: 12px; height: 1px; background: var(--border-light); }
.transaksi-item:last-child::after { display: none; }

/* ---------- STAT CARDS ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--border-light); transition: var(--transition); position: relative; overflow: hidden; }
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card .stat-icon-bg { position: absolute; top: -8px; right: -8px; width: 56px; height: 56px; border-radius: 50%; opacity: 0.08; }
.stat-card .stat-label { font-size: .7rem; color: var(--text-light); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.stat-card .stat-value { font-size: 1.1rem; font-weight: 800; }
.stat-card .stat-change { font-size: .65rem; margin-top: 4px; display: flex; align-items: center; gap: 4px; }

/* ---------- QUICK ACTION BAR ---------- */
.quick-actions { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.quick-action { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 16px; background: var(--bg-card); border-radius: var(--radius-lg); border: 1px solid var(--border-light); box-shadow: var(--shadow-sm); min-width: 80px; text-decoration: none; color: var(--text); transition: var(--transition); -webkit-tap-highlight-color: transparent; }
.quick-action:active { transform: scale(0.95); }
.quick-action .qa-icon { width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 18px; color: white; }
.quick-action .qa-label { font-size: .65rem; font-weight: 600; white-space: nowrap; }

/* ---------- COUNT UP ANIMATION ---------- */
.count-up { display: inline-block; }

/* ---------- REFRESH INDICATOR ---------- */
.refresh-indicator { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; font-size: .75rem; color: var(--text-light); cursor: pointer; transition: var(--transition); -webkit-tap-highlight-color: transparent; }
.refresh-indicator:hover { color: var(--primary); }
.refresh-indicator .spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ---------- LOADING OVERLAY ---------- */
.loading-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 99999; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: white; }
.spinner { width: 36px; height: 36px; border: 3px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin .8s linear infinite; }

/* ---------- ENHANCED FORM ---------- */
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.15); }
.form-control.error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,0.1); }
.input-group { display: flex; gap: 8px; }
.input-group .form-control { flex: 1; }
.input-group .btn { flex-shrink: 0; }

/* ---------- BACK TO TOP ---------- */
.back-to-top { position: fixed; bottom: calc(var(--bottom-nav-height) + 72px); left: 16px; width: 40px; height: 40px; border-radius: var(--radius-full); background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 50; opacity: 0; visibility: hidden; transition: var(--transition); box-shadow: var(--shadow); }
.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* ---------- SEARCH BAR (v3) ---------- */
.search-bar { position: relative; }
.search-bar .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-light); pointer-events: none; }
.search-bar .form-control { padding-left: 38px; }

/* ---------- NOTIFICATION UNREAD (v3) ---------- */
.notif-unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); vertical-align: middle; }

/* ---------- CHART CONTAINER (v3) ---------- */
canvas { max-width: 100%; }

/* ---------- ANIMATED ENTRANCE (v3) ---------- */
.fade-in { animation: fadeInUp .3s ease forwards; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- BADGE DOT IMPROVED (v3) ---------- */
.btn-icon .badge-dot { position: absolute; top: 4px; right: 4px; width: 10px; height: 10px; background: var(--danger); border-radius: 50%; border: 2px solid var(--bg-card); animation: pulse 2s infinite; }

/* ---------- RESPONSIVE ---------- */
@media (min-width: 768px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-actions { justify-content: center; }
  .pagination .page-btn { min-width: 40px; height: 40px; }
  .page-content { max-width: 960px; }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav { padding-bottom: env(safe-area-inset-bottom); height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom)); }
}

@media print {
  .app-header, .bottom-nav, .btn-fab, .btn, .filter-bar, .search-bar, .menu-toggle, .sidebar, .sidebar-overlay, .inline-log { display: none !important; }
  .app-main { padding-bottom: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ---------- SPINNER INLINE (v3.1) ---------- */
.spinner-inline { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin .6s linear infinite; vertical-align: middle; margin-right: 6px; }

/* ---------- MODAL BOTTOM SHEET (v3.1) ---------- */
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* =============================================
   V3.2.1 UI/UX FIXES
   ============================================= */

/* Better touch targets for mobile */
.btn, .tab-btn, .page-btn, .nav-link {
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

/* Filter chips: compact, no min-height override */
.filter-chip {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
}

/* Notification items: ensure full clickable area */
.transaksi-item[href] {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.transaksi-item[href]:active {
  background: var(--border-light);
  transform: scale(0.99);
  transition: transform 0.1s ease;
}

/* Better card spacing on mobile */
.card { margin-bottom: 12px; }
.card-body { padding: 14px 16px; }

/* Fix form submit button visibility */
.btn-lg.btn-block {
  min-height: 52px;
  font-size: 1rem;
  font-weight: 700;
  position: sticky;
  bottom: calc(var(--bottom-nav-height) + 8px);
  z-index: 10;
  box-shadow: var(--shadow-lg);
}

/* Fix input-amount on small screens */
.input-amount .form-control {
  font-size: 1.15rem;
  font-weight: 700;
  padding-left: 42px;
}

/* Better saldo card on small screens */
.saldo-card { padding: 20px 16px; }
.saldo-card .saldo-amount { font-size: 1.5rem; word-break: break-all; }
.saldo-card .saldo-stats { flex-wrap: wrap; }
.saldo-card .saldo-stat { min-width: 0; flex: 1 1 40%; }

/* Fix filter bar overflow on mobile */
.filter-bar {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

/* Fix quick actions overflow */
.quick-actions {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.quick-actions::-webkit-scrollbar { display: none; }

/* Better empty state */
.empty-state { padding: 32px 16px; }
.empty-state .empty-icon { font-size: 40px; }

/* Fix table on mobile */
.table td, .table th {
  padding: 8px 10px;
  font-size: .75rem;
}

/* Better page content spacing */
.page-content { padding: 12px 14px 24px; }
.page-title { margin-bottom: 16px; }
.page-title h1 { font-size: 1.25rem; }

/* Fix back button alignment */
.back-btn { display: inline-flex; width: 34px; height: 34px; border-radius: 50%; }

/* Smooth card transitions */
.card {
  animation: fadeInUp .25s ease;
}

/* Better alert spacing */
.alert { font-size: .82rem; padding: 12px 14px; }

/* Fix tabs on mobile */
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn { min-width: 0; padding: 10px 10px; font-size: .78rem; }

/* Make notification items clearly tappable */
.transaksi-item[href]:hover {
  background: var(--bg);
}

/* Ensure bottom nav items are properly spaced */
.bottom-nav .nav-item {
  flex: 1;
  max-width: 25%;
}

/* Fix header badge overlapping on small screens */
.app-header .header-actions { gap: 4px; flex-shrink: 0; }
.app-header .badge { white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

/* Better select styling on mobile */
select.form-control {
  -webkit-appearance: none;
  appearance: none;
  min-height: 48px;
}

/* Fix date input on iOS */
input[type="date"].form-control,
input[type="text"].form-control {
  min-height: 48px;
}

/* Smooth scroll and touch */
body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

/* Fix safe area for modern phones with notch */
@supports (padding: env(safe-area-inset-top)) {
  .app-header {
    padding-top: max(12px, env(safe-area-inset-top));
  }
}
