/* ================================================================
   Nabung v2 — Modern UI (Linear/Mercury inspired)
   ================================================================ */

:root {
  /* ====== Light theme palette ====== */
  --bg:            #f8f9fb;
  --bg-2:          #f1f3f8;
  --surface:       #ffffff;
  --surface-2:     #fafbfc;
  --surface-3:     #f4f5f9;
  --border:        #e8eaef;
  --border-2:      #eef0f4;
  --text:          #0f172a;
  --text-2:        #475569;
  --text-3:        #94a3b8;

  /* Brand */
  --brand:         #6366f1;
  --brand-2:       #8b5cf6;
  --brand-3:       #4f46e5;
  --brand-soft:    rgba(99, 102, 241, .10);
  --brand-soft-2:  rgba(99, 102, 241, .15);

  /* Status */
  --success:       #059669;
  --success-soft:  rgba(5, 150, 105, .10);
  --danger:        #dc2626;
  --danger-soft:   rgba(220, 38, 38, .10);
  --warning:       #d97706;
  --warning-soft:  rgba(217, 119, 6, .10);
  --info:          #0891b2;
  --info-soft:     rgba(8, 145, 178, .10);

  /* Effects */
  --shadow-xs:     0 1px 2px rgba(15, 23, 42, .04);
  --shadow-sm:     0 1px 3px rgba(15, 23, 42, .04), 0 1px 2px rgba(15, 23, 42, .03);
  --shadow-md:     0 4px 12px rgba(15, 23, 42, .06), 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-lg:     0 12px 32px rgba(15, 23, 42, .08), 0 4px 8px rgba(15, 23, 42, .04);
  --radius-sm:     8px;
  --radius:        12px;
  --radius-lg:     16px;
  --radius-xl:     20px;

  --transition:    180ms cubic-bezier(.4, 0, .2, 1);
}

[data-theme="dark"] {
  --bg:            #0a0e1a;
  --bg-2:          #0d121f;
  --surface:       #0f1525;
  --surface-2:     #131a2e;
  --surface-3:     #1a2238;
  --border:        #1f2a44;
  --border-2:      #243150;
  --text:          #f1f5f9;
  --text-2:        #cbd5e1;
  --text-3:        #64748b;

  --brand:         #818cf8;
  --brand-2:       #a78bfa;
  --brand-3:       #6366f1;
  --brand-soft:    rgba(129, 140, 248, .15);
  --brand-soft-2:  rgba(129, 140, 248, .25);

  --success:       #34d399;
  --success-soft:  rgba(52, 211, 153, .15);
  --danger:        #f87171;
  --danger-soft:   rgba(248, 113, 113, .15);
  --warning:       #fbbf24;
  --warning-soft:  rgba(251, 191, 36, .15);
  --info:          #22d3ee;
  --info-soft:     rgba(34, 211, 238, .15);

  --shadow-xs:     0 1px 2px rgba(0, 0, 0, .25);
  --shadow-sm:     0 1px 3px rgba(0, 0, 0, .3);
  --shadow-md:     0 4px 12px rgba(0, 0, 0, .35);
  --shadow-lg:     0 12px 32px rgba(0, 0, 0, .45);
}

/* ============== RESET / BASE ============== */
* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  letter-spacing: -0.01em;
}

a { color: var(--brand); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: .85; color: var(--brand); }

::selection { background: var(--brand-soft-2); color: var(--text); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* Lucide icons sizing */
[data-lucide], .lucide {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  flex-shrink: 0;
}
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }
.icon-xl { width: 24px; height: 24px; }
.icon-2xl { width: 32px; height: 32px; }

/* ============== TYPOGRAPHY ============== */
h1, h2, h3, h4, h5, h6 { letter-spacing: -0.02em; font-weight: 600; }
.text-muted { color: var(--text-2) !important; }
.text-faint { color: var(--text-3) !important; }
small { font-size: 12.5px; }

.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-3);
}

/* ============== AUTH PAGES (split-screen) ============== */
.auth-body {
  background: var(--bg);
  min-height: 100vh;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-pane-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px clamp(24px, 6vw, 80px);
  background: var(--surface);
}

.auth-form-container {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.auth-pane-art {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
  color: #f1f5f9;
  padding: 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-pane-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 0%, rgba(139, 92, 246, .25) 0%, transparent 50%),
              radial-gradient(circle at 90% 80%, rgba(99, 102, 241, .25) 0%, transparent 50%);
  pointer-events: none;
}

.auth-art-content { position: relative; z-index: 1; }
.auth-art-bottom  { position: relative; z-index: 1; }

.auth-art-title {
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 24px 0 16px;
}
.auth-art-subtitle {
  color: rgba(241, 245, 249, .7);
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 40px;
}

.auth-feature-list { display: flex; flex-direction: column; gap: 18px; }
.auth-feature {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.auth-feature-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .15);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.auth-feature-icon [data-lucide] { color: #c7d2fe; width: 18px; height: 18px; }
.auth-feature h6 { font-size: 14px; font-weight: 600; margin: 0 0 2px; }
.auth-feature p  { font-size: 13px; color: rgba(241, 245, 249, .65); margin: 0; }

.auth-art-footer {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: rgba(241, 245, 249, .55);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.brand-mark-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: grid; place-items: center;
  color: white;
  box-shadow: 0 4px 16px rgba(99, 102, 241, .4);
}
.brand-mark-icon [data-lucide] { width: 20px; height: 20px; }

@media (max-width: 992px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-pane-art { display: none; }
}

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

.app-sidebar {
  width: 248px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 18px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .brand-mark-icon { width: 32px; height: 32px; border-radius: 9px; }
.sidebar-brand .brand-mark-icon [data-lucide] { width: 18px; height: 18px; }
.sidebar-brand-text { line-height: 1.2; }
.sidebar-brand-text strong { font-size: 14.5px; font-weight: 600; }
.sidebar-brand-text small { color: var(--text-3); font-size: 11px; }

.sidebar-section {
  margin-top: 16px;
  padding: 0 8px 4px;
}
.sidebar-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  font-weight: 600;
}

.sidebar-link {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  margin: 1px 0;
  transition: all var(--transition);
  position: relative;
}
.sidebar-link:hover {
  background: var(--surface-3);
  color: var(--text);
}
.sidebar-link [data-lucide] {
  color: var(--text-3);
  width: 17px; height: 17px;
}
.sidebar-link:hover [data-lucide] { color: var(--brand); }

.sidebar-link.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}
.sidebar-link.active [data-lucide] { color: var(--brand); }
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -12px; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--brand);
  border-radius: 2px;
}

.sidebar-spacer { flex: 1; }
.sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Main content area */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex; flex-direction: column;
}

/* Topbar */
.app-topbar {
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky; top: 0;
  z-index: 30;
}
[data-theme="dark"] .app-topbar { background: rgba(15, 21, 37, .85); }

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.topbar-search {
  flex: 1;
  max-width: 360px;
  position: relative;
  display: none;
}
.topbar-search input {
  width: 100%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px 8px 34px;
  border-radius: 8px;
  font-size: 13px;
  transition: all var(--transition);
}
.topbar-search input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.topbar-search [data-lucide] {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  width: 14px; height: 14px;
}
@media (min-width: 768px) {
  .topbar-search { display: block; }
}

.topbar-actions {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
}

/* Avatar */
.avatar-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
  border: 1px solid var(--border);
}
.avatar-fallback {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center;
  color: white;
  font-weight: 600;
  font-size: 13px;
}

.app-content {
  padding: 28px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
}

/* Page header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}
.page-header h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
}
.page-header .subtitle {
  color: var(--text-2);
  font-size: 13.5px;
  margin-top: 4px;
}

/* ============== CARDS ============== */
.card-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition);
}
.card-panel:hover { box-shadow: var(--shadow-sm); }

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.card-header-row h6 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

/* Stat card (modern fintech style) */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.stat-card:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.stat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.stat-card-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
}
.stat-card-icon [data-lucide] { width: 18px; height: 18px; }
.stat-card-icon.success { background: var(--success-soft); color: var(--success); }
.stat-card-icon.danger  { background: var(--danger-soft);  color: var(--danger); }
.stat-card-icon.warning { background: var(--warning-soft); color: var(--warning); }
.stat-card-icon.info    { background: var(--info-soft);    color: var(--info); }

.stat-label {
  font-size: 12.5px;
  color: var(--text-2);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 4px 0 8px;
  font-variant-numeric: tabular-nums;
}
.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 99px;
}
.stat-trend.up   { background: var(--danger-soft); color: var(--danger); }
.stat-trend.down { background: var(--success-soft); color: var(--success); }
.stat-trend [data-lucide] { width: 12px; height: 12px; }

/* Category icon (round colored box) */
.cat-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}
.cat-icon-sm { width: 28px; height: 28px; border-radius: 8px; }
.cat-icon-lg { width: 44px; height: 44px; border-radius: 12px; }
.cat-icon [data-lucide] {
  width: 17px; height: 17px;
}
.cat-icon-sm [data-lucide] { width: 14px; height: 14px; }
.cat-icon-lg [data-lucide] { width: 20px; height: 20px; }

/* Soft backgrounds */
.bg-brand-soft   { background: var(--brand-soft); color: var(--brand); }
.bg-success-soft { background: var(--success-soft); color: var(--success); }
.bg-danger-soft  { background: var(--danger-soft); color: var(--danger); }
.bg-warning-soft { background: var(--warning-soft); color: var(--warning); }
.bg-info-soft    { background: var(--info-soft); color: var(--info); }
.bg-primary-soft { background: var(--brand-soft); color: var(--brand); }

/* ============== BUTTONS ============== */
.btn {
  font-weight: 500;
  font-size: 13.5px;
  border-radius: 9px;
  padding: 8px 14px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
  letter-spacing: -0.005em;
  cursor: pointer;
  line-height: 1.4;
}
.btn:focus { box-shadow: 0 0 0 3px var(--brand-soft); outline: none; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { padding: 10px 18px; font-size: 14.5px; }

.btn-primary {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
.btn-primary:hover {
  background: var(--brand-3);
  border-color: var(--brand-3);
  color: white;
}
.btn-primary:active { transform: translateY(1px); }

.btn-light, .btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-light:hover, .btn-secondary:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-2);
}
[data-theme="dark"] .btn-light { background: var(--surface-2); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .btn-light:hover { background: var(--surface-3); color: var(--text); }

.btn-outline-primary {
  background: transparent;
  color: var(--brand);
  border-color: var(--border);
}
.btn-outline-primary:hover { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.btn-check:checked + .btn-outline-primary {
  background: var(--brand-soft); color: var(--brand); border-color: var(--brand);
}

.btn-outline-success { background: transparent; color: var(--success); border-color: var(--border); }
.btn-outline-success:hover { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.btn-check:checked + .btn-outline-success {
  background: var(--success-soft); color: var(--success); border-color: var(--success);
}

.btn-outline-danger  { background: transparent; color: var(--danger); border-color: var(--border); }
.btn-outline-danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.btn-check:checked + .btn-outline-danger {
  background: var(--danger-soft); color: var(--danger); border-color: var(--danger);
}

.btn-warning { background: var(--warning); color: white; border-color: var(--warning); }
.btn-warning:hover { background: #b45309; border-color: #b45309; color: white; }

.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: white; }

/* Icon-only button */
.btn-icon {
  padding: 6px;
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
}

/* ============== FORMS ============== */
.form-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 5px;
  letter-spacing: -0.005em;
}

.form-control, .form-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  transition: all var(--transition);
  width: 100%;
}
.form-control::placeholder { color: var(--text-3); }
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  background: var(--surface);
  color: var(--text);
}

.input-group-text {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 9px;
}

.form-check-input {
  border: 1.5px solid var(--border-2);
  background: var(--surface);
}
.form-check-input:checked { background: var(--brand); border-color: var(--brand); }

/* Progress */
.progress {
  background: var(--surface-3);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}
.progress-bar {
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 99px;
}
.progress-bar.bg-danger  { background: var(--danger) !important; }
.progress-bar.bg-success { background: var(--success) !important; }
.progress-bar.bg-warning { background: var(--warning) !important; }

/* ============== TABLES ============== */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text);
}
.table thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-3);
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.table tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-2);
  vertical-align: middle;
  background: transparent;
  color: var(--text);
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface-3); }
.table tbody tr:last-child td { border-bottom: none; }

/* Badge */
.badge {
  display: inline-flex; align-items: center;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text-2);
  letter-spacing: -0.005em;
}

/* Dropdown */
.dropdown-menu {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 180px;
}
.dropdown-item {
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--text);
  font-size: 13.5px;
  display: flex; align-items: center; gap: 8px;
  transition: background var(--transition);
}
.dropdown-item:hover { background: var(--surface-3); color: var(--text); }
.dropdown-item.text-danger { color: var(--danger); }
.dropdown-item.text-danger:hover { background: var(--danger-soft); color: var(--danger); }
.dropdown-divider { border-top: 1px solid var(--border); margin: 6px 0; }
.dropdown-toggle::after { display: none !important; }
.dropdown-item [data-lucide] { width: 14px; height: 14px; color: var(--text-3); }

/* Modal */
.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}
.modal-header {
  border-bottom: 1px solid var(--border);
  padding: 18px 22px;
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 8px;
}
.modal-body { padding: 20px 22px; }
.modal-footer {
  border-top: 1px solid var(--border);
  padding: 14px 22px;
  gap: 8px;
}
.btn-close {
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z'/%3E%3C/svg%3E") no-repeat center/16px;
  opacity: .6;
  width: 16px; height: 16px;
  padding: 4px;
  box-sizing: content-box;
  border: none;
  border-radius: 6px;
}
.btn-close:hover { opacity: 1; background-color: var(--surface-3); }

/* Alert */
.alert {
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13.5px;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: var(--success-soft); color: var(--success); border-color: var(--success-soft); }
.alert-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger-soft); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-soft); }
.alert-info    { background: var(--info-soft);    color: var(--info);    border-color: var(--info-soft); }

/* ============== FAB ============== */
.fab {
  position: fixed;
  right: 26px; bottom: 26px;
  width: 52px; height: 52px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .15);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(99, 102, 241, .4), 0 2px 6px rgba(99, 102, 241, .2);
  z-index: 40;
  transition: all var(--transition);
  cursor: pointer;
}
.fab:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(99, 102, 241, .5), 0 4px 8px rgba(99, 102, 241, .3); color: white; }
.fab:active { transform: translateY(0); }
.fab [data-lucide] { width: 22px; height: 22px; stroke-width: 2.5; }

/* ============== LIST GROUP (recent transactions) ============== */
.list-group-flush { padding: 0; margin: 0; list-style: none; }
.list-group-item {
  display: flex; align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-2);
  background: transparent;
  color: var(--text);
}
.list-group-item:last-child { border-bottom: none; }

/* ============== SETTINGS ============== */
.settings-tabs {
  list-style: none;
  padding: 0; margin: 0;
}
.settings-tabs li { margin: 0; }
.settings-tabs .nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all var(--transition);
}
.settings-tabs .nav-link:hover { background: var(--surface-3); color: var(--text); }
.settings-tabs .nav-link.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}
.settings-tabs .nav-link [data-lucide] { color: inherit; opacity: .8; }
.settings-tabs .nav-link.active [data-lucide] { opacity: 1; }
.settings-tabs .nav-link.text-danger:hover { background: var(--danger-soft); color: var(--danger); }

.avatar-preview {
  width: 88px; height: 88px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--surface-3);
}
.avatar-placeholder {
  width: 88px; height: 88px;
  border-radius: 18px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--text-3);
}
.avatar-placeholder [data-lucide] { width: 38px; height: 38px; }

.danger-zone {
  border: 1px solid rgba(220, 38, 38, .25);
  background: rgba(220, 38, 38, .04);
  border-radius: var(--radius);
  padding: 18px;
}
[data-theme="dark"] .danger-zone {
  border-color: rgba(248, 113, 113, .3);
  background: rgba(248, 113, 113, .06);
}

/* ============== CHARTS ============== */
canvas { max-width: 100%; }

/* Trend indicators */
.trend-up   { color: var(--danger); }
.trend-down { color: var(--success); }

/* ============== UTILITY ============== */
.h-100 { height: 100%; }
.fw-bold { font-weight: 600; }
.fw-semibold { font-weight: 600; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-primary { color: var(--brand) !important; }
.text-info { color: var(--info) !important; }
.text-warning { color: var(--warning) !important; }
hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }
code { background: var(--surface-3); padding: 2px 6px; border-radius: 5px; font-size: 12px; color: var(--brand); border: 1px solid var(--border); }

/* Bootstrap padding utility tweaks */
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }

/* Sticky-top adjust for new topbar */
.sticky-top { z-index: 20; }

/* ============== RESPONSIVE ============== */
@media (max-width: 768px) {
  .app-sidebar {
    position: fixed;
    left: -270px; top: 0;
    z-index: 50;
    transition: left var(--transition);
  }
  .app-sidebar.open { left: 0; box-shadow: var(--shadow-lg); }
  .app-content { padding: 18px; }
  .app-topbar { padding: 12px 16px; }
  .topbar-title { font-size: 15px; }
  .fab { right: 16px; bottom: 16px; width: 48px; height: 48px; border-radius: 14px; }
  .modal-dialog { margin: 8px; }
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .4);
  backdrop-filter: blur(2px);
  z-index: 45;
}
.sidebar-overlay.show { display: block; }

/* Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.app-content > * { animation: fadeIn .3s ease-out; }



/* ================================================================
   ADDITIONS — Categories, Calendar, Pagination, Donut, Idle warn
   ================================================================ */

/* ============== CATEGORIES PAGE ============== */
.cat-list {
  display: flex; flex-direction: column;
  gap: 4px;
}
.cat-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background var(--transition);
}
.cat-row:hover { background: var(--surface-3); }
.cat-info { flex: 1; min-width: 0; }
.cat-name { font-weight: 500; font-size: 13.5px; }

/* Color picker grid */
.color-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 8px;
}
@media (max-width: 576px) { .color-grid { grid-template-columns: repeat(5, 1fr); } }
.color-swatch {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform var(--transition), border-color var(--transition);
}
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.selected {
  border-color: var(--text);
  transform: scale(1.08);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text);
}

/* Icon picker grid */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
  background: var(--surface-3);
  border-radius: 10px;
  border: 1px solid var(--border);
}
@media (max-width: 768px) { .icon-grid { grid-template-columns: repeat(7, 1fr); } }
@media (max-width: 480px) { .icon-grid { grid-template-columns: repeat(5, 1fr); } }
.icon-swatch {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1.5px solid transparent;
  background: var(--surface);
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--text-2);
  transition: all var(--transition);
}
.icon-swatch:hover {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand-soft-2);
}
.icon-swatch.selected {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}
.icon-swatch [data-lucide], .icon-swatch svg {
  width: 18px; height: 18px;
}

/* ============== CALENDAR ============== */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--border-2);
  gap: 1px;
}
.cal-dow {
  background: var(--surface);
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: center;
}
.cal-cell {
  background: var(--surface);
  min-height: 96px;
  padding: 8px 10px;
  display: flex; flex-direction: column;
  text-decoration: none;
  color: var(--text);
  transition: background var(--transition);
  position: relative;
}
.cal-cell:hover { background: var(--surface-3); color: var(--text); }
.cal-cell-empty {
  background: var(--surface-2);
  pointer-events: none;
}
.cal-day-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
}
.cal-today .cal-day-num {
  background: var(--brand);
  color: white;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 600;
}
.cal-has-data { font-weight: 500; }
.cal-day-content {
  font-size: 11px;
  display: flex; flex-direction: column;
  gap: 2px;
}
.cal-amt {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 11px;
}
.cal-inc { color: var(--success); }
.cal-exp { color: var(--danger); }
.cal-day-count {
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: auto;
  font-weight: 500;
}

@media (max-width: 768px) {
  .cal-cell { min-height: 70px; padding: 6px; }
  .cal-day-num { font-size: 12px; }
  .cal-amt { font-size: 10px; }
  .cal-day-count { display: none; }
}

/* ============== PAGINATION ============== */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.pagination-buttons {
  display: flex; gap: 4px;
}
.pagination-buttons .btn.disabled {
  opacity: .4;
  pointer-events: none;
}

/* Sortable column headers */
.th-sort {
  color: inherit !important;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  letter-spacing: inherit;
}
.th-sort:hover { color: var(--brand) !important; }
.th-sort [data-lucide] { color: var(--brand); }

/* ============== DONUT CHART LEGEND ============== */
.donut-legend {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12.5px;
}
.donut-legend-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0;
}
.donut-dot {
  width: 8px; height: 8px;
  border-radius: 99px;
  flex-shrink: 0;
}
.donut-name { flex: 1; color: var(--text-2); }
.donut-pct { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }

/* ============== IDLE WARNING TOAST (#23) ============== */
.idle-warning {
  position: fixed;
  bottom: 22px; left: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  z-index: 1050;
  max-width: 360px;
  animation: slideUp .25s ease-out;
}
.idle-warning [data-lucide] {
  color: var(--warning);
  width: 22px; height: 22px;
}
.idle-warning strong { font-size: 14px; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 576px) {
  .idle-warning {
    left: 12px; right: 12px; bottom: 12px;
    max-width: none;
  }
}

/* ============== INBOX / EMPTY STATE ============== */
td .icon-2xl { color: var(--text-3); }

/* ============== DROPDOWN MENU IMPROVEMENTS ============== */
.dropdown-item form { margin: 0; padding: 0; }
.dropdown-item form button.dropdown-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
}



/* ================================================================
   RESPONSIVE & MOBILE OPTIMIZATIONS
   Target: iPhone SE (375), iPhone (390-430), iPad (768/1024), Desktop
   ================================================================ */

/* ----- Touch optimizations (iOS / Android) ----- */
* { -webkit-tap-highlight-color: transparent; }
button, a, .form-control, .form-select, [role="button"], .sidebar-link {
  touch-action: manipulation;
}
html { -webkit-text-size-adjust: 100%; -webkit-overflow-scrolling: touch; }
img, svg { max-width: 100%; height: auto; }

/* ----- Prevent iOS zoom on input focus (font-size >= 16px) ----- */
@media (max-width: 768px) {
  .form-control, .form-select,
  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="search"], input[type="date"],
  input[type="tel"], input[type="url"], textarea, select {
    font-size: 16px !important;
  }
}

/* ----- Hover states only on devices that actually hover ----- */
@media (hover: none) {
  .stat-card:hover, .card-panel:hover {
    transform: none;
    box-shadow: var(--shadow-xs);
  }
  .fab:hover { transform: none; }
  .color-swatch:hover, .icon-swatch:hover { transform: none; }
}

/* ----- Bigger touch targets on mobile (min 40px) ----- */
@media (max-width: 768px) {
  .btn { min-height: 40px; padding: 9px 14px; }
  .btn-sm { min-height: 34px; padding: 7px 11px; }
  .btn-icon { min-height: 38px; min-width: 38px; }
  .btn-lg { min-height: 46px; }
  .sidebar-link { padding: 11px 12px; }
  .form-control, .form-select { padding: 10px 12px; }
  .dropdown-item { padding: 10px 12px; min-height: 40px; }
  .form-check-input { width: 18px; height: 18px; }
  .nav-link { min-height: 40px; }
  .icon-swatch { min-height: 40px; }
  .color-swatch { min-height: 40px; }
}

/* ----- iPhone safe area (notch/home indicator) ----- */
@supports (padding: max(0px)) {
  .fab {
    bottom: max(22px, calc(env(safe-area-inset-bottom) + 16px));
    right:  max(22px, calc(env(safe-area-inset-right) + 16px));
  }
  .app-content {
    padding-bottom: max(28px, calc(env(safe-area-inset-bottom) + 24px));
  }
  .app-sidebar {
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }
  .auth-pane-form, .auth-pane-art {
    padding-top: max(40px, env(safe-area-inset-top));
    padding-bottom: max(40px, env(safe-area-inset-bottom));
  }
  .idle-warning {
    bottom: max(22px, calc(env(safe-area-inset-bottom) + 16px));
  }
}

/* ----- Prevent body scroll when sidebar drawer is open (mobile) ----- */
body.no-scroll { overflow: hidden; touch-action: none; }

/* ===================================================
   BREAKPOINT: < 576px (iPhone SE / older small phones)
   =================================================== */
@media (max-width: 575.98px) {
  body { font-size: 14px; }
  .topbar-title { font-size: 15px; }
  .page-header h2 { font-size: 18px; }
  .page-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-header .d-flex { flex-wrap: wrap; gap: 8px; }
  .page-header .d-flex > * { flex: 1; }
  .page-header .btn { justify-content: center; }

  .stat-value { font-size: 19px; }
  .stat-card { padding: 14px; }
  .stat-card-icon { width: 32px; height: 32px; }

  .card-panel { padding: 14px; }
  .card-header-row { margin-bottom: 12px; }

  .app-content { padding: 14px; }
  .app-topbar { padding: 10px 14px; gap: 8px; }

  .modal-dialog { margin: 6px; max-width: calc(100vw - 12px); }
  .modal-header, .modal-footer { padding: 14px 16px; }
  .modal-body { padding: 16px; }

  .table { font-size: 13px; }
  .table thead th { padding: 9px 10px; font-size: 10.5px; }
  .table tbody td { padding: 11px 10px; }

  .auth-pane-form { padding: 28px 20px; }

  /* Stat cards: 1 col on very small phones for readability */
  .stat-card-mobile-stack .col-6 { width: 100%; }
}

/* ===================================================
   BREAKPOINT: 576-768px (Bigger phones, small tablets)
   =================================================== */
@media (min-width: 576px) and (max-width: 767.98px) {
  .app-content { padding: 18px; }
  .stat-value { font-size: 22px; }
}

/* ===================================================
   BREAKPOINT: 768-991px (iPad portrait)
   =================================================== */
@media (min-width: 768px) and (max-width: 991.98px) {
  .app-sidebar { width: 220px; }
  .app-content { padding: 22px; }
}

/* ===================================================
   BREAKPOINT: 992-1199px (iPad Pro landscape, small laptop)
   =================================================== */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .app-content { padding: 26px; }
}

/* ===================================================
   PAGINATION (mobile)
   =================================================== */
@media (max-width: 575.98px) {
  .pagination-bar {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    text-align: center;
  }
  .pagination-buttons { justify-content: center; }
}

/* ===================================================
   TABLE: hide less-important columns on small screens
   =================================================== */
@media (max-width: 768px) {
  /* Hide kategori col in transactions table on phone (still visible in desc) */
  .table-hide-mobile { display: none !important; }
}

/* ===================================================
   TOPBAR: avatar dropdown compact on phone
   =================================================== */
@media (max-width: 575.98px) {
  .topbar-actions .dropdown > button > span:not(.avatar-fallback) {
    display: none;
  }
}

/* ===================================================
   ICON & COLOR PICKER (categories) — denser on phone
   =================================================== */
@media (max-width: 480px) {
  .icon-grid { grid-template-columns: repeat(6, 1fr); max-height: 200px; }
  .color-grid { grid-template-columns: repeat(8, 1fr); }
}

/* ===================================================
   AUTH SHELL: full screen on small phones
   =================================================== */
@media (max-width: 575.98px) {
  .auth-pane-form { min-height: 100vh; padding: 24px 20px; }
  .auth-form-container { max-width: 100%; }
  .auth-art-title { font-size: 24px; }
}

/* ===================================================
   SETTINGS: tabs become horizontal scroll on phone
   =================================================== */
@media (max-width: 991.98px) {
  .settings-tabs {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .settings-tabs::-webkit-scrollbar { display: none; }
  .settings-tabs li { flex-shrink: 0; }
  .settings-tabs .nav-link { white-space: nowrap; }
  .settings-tabs.nav { flex-wrap: nowrap !important; }
}

/* ===================================================
   FORMS: stack column buttons on small screens
   =================================================== */
@media (max-width: 575.98px) {
  .modal-footer .btn { flex: 1; justify-content: center; }
  .btn-group.w-100 .btn { font-size: 13px; padding: 9px 8px; }
}

/* ===================================================
   AVATAR PREVIEW: smaller on tiny screens
   =================================================== */
@media (max-width: 575.98px) {
  .avatar-preview, .avatar-placeholder {
    width: 72px; height: 72px;
    border-radius: 14px;
  }
  .avatar-placeholder [data-lucide] { width: 30px; height: 30px; }
}

/* ===================================================
   LANDSCAPE MODE on tiny screens (rotate to landscape on phone)
   =================================================== */
@media (max-width: 991.98px) and (orientation: landscape) and (max-height: 500px) {
  .auth-pane-art { display: none; }
  .auth-pane-form { padding: 16px 20px; }
}
