/* ============================================================
   FINTRACK - Dark Colorful Theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

/* ---- CSS Variables ---- */
:root {
  --bg-base:       #0d0f14;
  --bg-surface:    #13161e;
  --bg-card:       #181c27;
  --bg-elevated:   #1e2333;
  --bg-hover:      #242840;

  --border:        #2a2f45;
  --border-light:  #353c58;

  --text-primary:  #eef0f8;
  --text-secondary:#8b92b3;
  --text-muted:    #555e80;

  /* Accent palette - colorful */
  --cyan:    #00e5ff;
  --green:   #00e676;
  --yellow:  #ffd740;
  --orange:  #ff6d00;
  --pink:    #f50057;
  --purple:  #d500f9;
  --blue:    #2979ff;
  --teal:    #1de9b6;
  --red:     #ff1744;
  --lime:    #c6ff00;

  --income-color:  var(--green);
  --expense-color: var(--red);
  --balance-color: var(--cyan);

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,.4);
  --shadow-md: 0 4px 20px rgba(0,0,0,.5);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.6);

  --nav-height: 64px;
  --topbar-height: 60px;

  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  --transition: 0.2s cubic-bezier(.4,0,.2,1);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 99px; }

/* ============================================================
   LAYOUT
   ============================================================ */

#app { display: flex; min-height: 100vh; }

/* Sidebar (desktop) */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-logo {
  padding: 24px 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-img {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}
.sidebar-logo .logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
  box-shadow: 0 0 16px rgba(0,229,255,.3);
}
.sidebar-logo .logo-text {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 800;
  letter-spacing: -.5px;
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: 1.5px;
  color: var(--text-muted); text-transform: uppercase;
  padding: 12px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
  position: relative;
}
.nav-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.nav-item.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  border-radius: 0 3px 3px 0;
  background: var(--nav-accent, var(--cyan));
}
.nav-item .nav-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  background: rgba(255,255,255,.05);
  transition: var(--transition);
  flex-shrink: 0;
}
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { background: rgba(255,255,255,.1); }

/* Colorful nav icons */
.nav-item[data-page="scan"] .nav-icon       { color: var(--cyan);   --nav-accent: var(--cyan); }
.nav-item[data-page="dashboard"] .nav-icon  { color: var(--cyan);   --nav-accent: var(--cyan); }
.nav-item[data-page="transaction"] .nav-icon { color: var(--green); --nav-accent: var(--green); }
.nav-item[data-page="history"] .nav-icon    { color: var(--yellow); --nav-accent: var(--yellow); }
.nav-item[data-page="report"] .nav-icon     { color: var(--purple); --nav-accent: var(--purple); }
.nav-item[data-page="budget"] .nav-icon     { color: var(--orange); --nav-accent: var(--orange); }
.nav-item[data-page="wallet"] .nav-icon     { color: var(--teal);   --nav-accent: var(--teal); }
.nav-item[data-page="category"] .nav-icon   { color: var(--pink);   --nav-accent: var(--pink); }
.nav-item[data-page="recurring"] .nav-icon  { color: var(--lime);   --nav-accent: var(--lime); }
.nav-item[data-page="networth"] .nav-icon    { color: #a78bfa;      --nav-accent: #a78bfa; }
.nav-item[data-page="installment"] .nav-icon { color: var(--orange); --nav-accent: var(--orange); }
.nav-item[data-page="goals"] .nav-icon      { color: var(--green);  --nav-accent: var(--green); }
.nav-item[data-page="notes"] .nav-icon      { color: var(--yellow); --nav-accent: var(--yellow); }
.nav-item[data-page="backup"] .nav-icon     { color: var(--blue);   --nav-accent: var(--blue); }
.nav-item[data-page="splitbill"] .nav-icon  { color: var(--cyan);   --nav-accent: var(--cyan); }
.nav-item[data-page="settings"] .nav-icon   { color: var(--text-secondary); }

.sidebar-bottom {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top bar */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 90;
  gap: 16px;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700;
  flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-wallet-badge {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 99px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: var(--transition);
}
.topbar-wallet-badge:hover { border-color: var(--border-light); }
.topbar-wallet-badge i { color: var(--teal); font-size: 12px; }

/* Page content */
.page-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ============================================================
   PAGES
   ============================================================ */
.page { display: none; }
.page.active { display: block; }

/* ============================================================
   COMPONENTS - Cards
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
  letter-spacing: .3px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-light); }
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-color, var(--cyan));
}
.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 14px;
  color: var(--accent-color, var(--cyan));
}
.stat-card .stat-label {
  font-size: 12px; font-weight: 500;
  color: var(--text-muted); letter-spacing: .5px;
  text-transform: uppercase; margin-bottom: 6px;
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
}
.stat-card .stat-change {
  font-size: 12px; color: var(--text-muted);
  display: flex; align-items: center; gap: 4px;
}
.stat-card .stat-change.up   { color: var(--green); }
.stat-card .stat-change.down { color: var(--red); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600;
  transition: var(--transition);
  cursor: pointer; border: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,229,255,.25);
}
.btn-primary:hover { opacity: .9; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,229,255,.35); }
.btn-success {
  background: linear-gradient(135deg, var(--green), var(--teal));
  color: #000; font-weight: 700;
}
.btn-danger {
  background: linear-gradient(135deg, var(--red), var(--pink));
  color: #fff;
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}
.btn-outline:hover { background: var(--bg-elevated); border-color: var(--border-light); }
.btn-ghost {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  transition: var(--transition);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px; letter-spacing: .3px;
}
.form-control {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,229,255,.1); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control option { background: var(--bg-card); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

/* Type toggle */
.type-toggle {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px; gap: 4px;
}
.type-toggle-btn {
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--text-muted);
  cursor: pointer; transition: var(--transition);
}
.type-toggle-btn.active.income  { background: rgba(0,230,118,.15); color: var(--green); }
.type-toggle-btn.active.expense { background: rgba(255,23,68,.15);  color: var(--red); }

/* ============================================================
   TABLE
   ============================================================ */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 12px 16px;
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  color: var(--text-muted); text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  transition: var(--transition);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-elevated); color: var(--text-primary); }
.amount-income  { color: var(--green); font-weight: 600; font-family: var(--font-display); }
.amount-expense { color: var(--red);   font-weight: 600; font-family: var(--font-display); }

/* ============================================================
   BADGE / CHIP
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
}
.badge-income  { background: rgba(0,230,118,.15); color: var(--green); }
.badge-expense { background: rgba(255,23,68,.15);  color: var(--red); }
.badge-neutral { background: var(--bg-elevated); color: var(--text-secondary); }

/* Category color dot */
.cat-dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; padding: 16px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(20px) scale(.97);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-header {
  padding: 20px 24px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 800;
}
.modal-body { padding: 20px 24px 24px; }
.modal-footer {
  padding: 0 24px 24px;
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ============================================================
   CHARTS (canvas wrappers)
   ============================================================ */
.chart-wrapper {
  position: relative;
  width: 100%;
}
.chart-wrapper canvas { width: 100% !important; }

/* ============================================================
   DASHBOARD GRID
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 0;
}
.dashboard-grid .span-2 { grid-column: span 2; }

/* ============================================================
   TRANSACTION LIST ITEMS
   ============================================================ */
.txn-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: var(--transition);
}
.txn-item:last-child { border-bottom: none; }
.txn-item:hover { background: var(--bg-elevated); border-radius: var(--radius-md); padding: 14px 12px; margin: 0 -12px; }
.txn-icon {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.txn-info { flex: 1; min-width: 0; }
.txn-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.txn-amount { font-family: var(--font-display); font-size: 15px; font-weight: 700; }

/* ============================================================
   BUDGET PROGRESS
   ============================================================ */
.budget-item {
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.budget-item:last-child { border-bottom: none; }
.budget-header { display: flex; align-items: center; justify-content: space-between; }
.budget-label { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.budget-amounts { font-size: 13px; color: var(--text-muted); }
.progress-bar {
  height: 8px; background: var(--bg-elevated);
  border-radius: 99px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 99px;
  background: var(--fill-color, var(--cyan));
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.progress-fill.warning { background: var(--yellow); }
.progress-fill.danger  { background: var(--red); }

/* ============================================================
   WALLET CARDS
   ============================================================ */
.wallet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.wallet-card {
  border-radius: var(--radius-xl);
  padding: 24px;
  position: relative; overflow: hidden;
  cursor: pointer; transition: var(--transition);
  min-height: 140px;
}
.wallet-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.wallet-card::after {
  content: '';
  position: absolute; bottom: -30px; right: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
}
.wallet-card .w-icon { font-size: 24px; margin-bottom: 16px; opacity: .9; }
.wallet-card .w-name { font-size: 13px; opacity: .75; margin-bottom: 4px; }
.wallet-card .w-balance {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 800;
}
.wallet-card .w-active-badge {
  position: absolute; top: 16px; right: 16px;
  background: rgba(255,255,255,.2); padding: 3px 9px;
  border-radius: 99px; font-size: 10px; font-weight: 700;
}

/* ============================================================
   SEARCH & FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 20px; flex-wrap: wrap;
}
.search-box {
  flex: 1; min-width: 200px;
  position: relative;
}
.search-box i {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 14px;
}
.search-box input {
  width: 100%; padding: 10px 14px 10px 38px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-primary); border-radius: var(--radius-md);
  font-size: 14px; outline: none; transition: var(--transition);
}
.search-box input:focus { border-color: var(--cyan); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: .4; }
.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { font-size: 14px; }

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
#toast-container {
  position: fixed; bottom: 80px; right: 20px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--cyan);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-md);
  animation: slideInRight .3s ease;
  pointer-events: all; min-width: 260px;
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--yellow); }
.toast i { font-size: 16px; }
.toast.success i { color: var(--green); }
.toast.error   i { color: var(--red); }
.toast.warning i { color: var(--yellow); }
.toast.default i { color: var(--cyan); }
@keyframes slideInRight {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-section { margin-bottom: 32px; }
.settings-section-title {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 12px;
}
.settings-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: var(--transition);
}
.settings-item:hover { border-color: var(--border-light); }
.settings-item-left { display: flex; align-items: center; gap: 12px; }
.settings-item-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.settings-item-info h4 { font-size: 14px; font-weight: 600; }
.settings-item-info p  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Toggle switch */
.toggle-switch {
  position: relative; width: 44px; height: 24px;
  cursor: pointer;
}
.toggle-switch input { display: none; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg-hover); border-radius: 99px;
  transition: var(--transition);
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px;
  transition: var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--cyan); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ============================================================
   BOTTOM NAV (mobile)
   ============================================================ */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 68px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav-inner {
  display: flex; align-items: center;
  height: 68px;
  width: 100%;
  padding: 0;
}
.bottom-nav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  height: 100%;
  color: var(--text-muted);
  font-size: 11px; font-weight: 500;
  cursor: pointer;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
  min-width: 0;
}

.bottom-nav-item .nav-icon-wrap {
  width: 44px; height: 30px;
  border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.bottom-nav-item i {
  font-size: 20px;
  line-height: 1;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
.bottom-nav-item span {
  font-size: 11px; font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.bottom-nav-item.active span { font-weight: 700; }
.bottom-nav-item.active i { transform: scale(1.1); }

.bottom-nav-item:nth-child(1).active { color: var(--cyan); }
.bottom-nav-item:nth-child(1).active .nav-icon-wrap { background: rgba(0,229,255,.15); }

.bottom-nav-item:nth-child(2).active { color: var(--yellow); }
.bottom-nav-item:nth-child(2).active .nav-icon-wrap { background: rgba(255,215,64,.15); }

.bottom-nav-item:nth-child(3).active { color: var(--purple); }
.bottom-nav-item:nth-child(3).active .nav-icon-wrap { background: rgba(213,0,249,.15); }

.bottom-nav-item:nth-child(4).active { color: var(--orange); }
.bottom-nav-item:nth-child(4).active .nav-icon-wrap { background: rgba(255,109,0,.15); }

.bottom-nav-item:nth-child(5).active { color: var(--teal); }
.bottom-nav-item:nth-child(5).active .nav-icon-wrap { background: rgba(29,233,182,.15); }

/* ============================================================
   FAB (mobile) — fixed bottom RIGHT
   ============================================================ */
.fab-backdrop {
  display: none;
  position: fixed; inset: 0;
  z-index: 198;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.fab-backdrop.open { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

/* Stack items above FAB, aligned to right */
.fab-more {
  position: fixed;
  bottom: calc(68px + 72px);
  right: 20px;
  display: none;
  flex-direction: column;
  gap: 10px;
  z-index: 199;
  align-items: flex-end;
}
.fab-more.open { display: flex; }

.fab-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  padding: 13px 18px;
  border-radius: var(--radius-lg);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  animation: fabItemIn .2s ease both;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.fab-item:active { background: var(--bg-hover); transform: scale(.97); }
.fab-item i { font-size: 17px; width: 20px; text-align: center; flex-shrink: 0; }

.fab-more.open .fab-item:nth-child(5) { animation-delay: .03s; }
.fab-more.open .fab-item:nth-child(4) { animation-delay: .06s; }
.fab-more.open .fab-item:nth-child(3) { animation-delay: .09s; }
.fab-more.open .fab-item:nth-child(2) { animation-delay: .12s; }
.fab-more.open .fab-item:nth-child(1) { animation-delay: .15s; }

@keyframes fabItemIn {
  from { transform: translateY(14px) scale(.93); opacity: 0; }
  to   { transform: translateY(0)    scale(1);   opacity: 1; }
}

/* FAB button — bottom right */
.fab-main {
  position: fixed;
  bottom: calc(68px + 14px);
  right: 20px;
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  display: none; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
  box-shadow: 0 4px 20px rgba(0,229,255,.4);
  cursor: pointer; z-index: 201;
  transition: background .2s, box-shadow .2s, transform .2s cubic-bezier(.34,1.56,.64,1);
  -webkit-tap-highlight-color: transparent;
}
.fab-main.open {
  background: linear-gradient(135deg, #444, #222);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.fab-main:active { transform: scale(.92); }
#fab-icon { transition: transform .3s cubic-bezier(.34,1.56,.64,1); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .sidebar { width: 200px; }
  .main-content { margin-left: 200px; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
  .bottom-nav { display: flex; }
  .fab-main { display: flex; }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid .span-2 { grid-column: span 1; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  #toast-container { bottom: calc(68px + 16px); right: 12px; left: 12px; }
  .toast { min-width: unset; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .wallet-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.font-display { font-family: var(--font-display); }
.font-bold { font-weight: 700; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.loading-spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--cyan);
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Confirm dialog */
.confirm-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 360px; width: 100%;
  text-align: center;
  transform: scale(.95); transition: transform .2s;
}
.modal-overlay.open .confirm-dialog { transform: scale(1); }
.confirm-icon { font-size: 40px; margin-bottom: 16px; }
.confirm-title { font-family: var(--font-display); font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.confirm-msg { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* Page header */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 800;
}

/* Tab navigation */
.tab-nav {
  display: flex; gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 20px;
}
.tab-btn {
  flex: 1; padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  transition: var(--transition); text-align: center;
}
.tab-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Color picker for categories */
.color-picker-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px;
}
.color-swatch {
  width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
  transition: var(--transition);
}
.color-swatch.selected,
.color-swatch:hover { border-color: #fff; transform: scale(1.15); }

/* Icon picker */
.icon-picker-grid {
  display: grid; grid-template-columns: repeat(8, 1fr);
  gap: 6px; max-height: 200px; overflow-y: auto;
  margin-top: 8px;
}
.icon-option {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px;
  transition: var(--transition); color: var(--text-secondary);
}
.icon-option:hover, .icon-option.selected {
  background: var(--bg-hover); color: var(--text-primary);
  border: 1px solid var(--border-light);
}

/* ============================================================
   AI CHAT FAB & PANEL
   ============================================================ */

/* AI FAB Button */
.fab-ai {
  position: fixed;
  bottom: calc(68px + 14px);
  right: calc(48px + 20px + 12px); /* left of main FAB */
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  display: none; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
  box-shadow: 0 4px 20px rgba(124,58,237,.45);
  cursor: pointer; z-index: 201;
  border: none;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  -webkit-tap-highlight-color: transparent;
}
.fab-ai:active { transform: scale(.92); }
.fab-ai.open   { background: linear-gradient(135deg, #6d28d9, #4338ca); }

/* Pulse ring on AI FAB */
.fab-ai-pulse {
  position: absolute;
  width: 48px; height: 48px; border-radius: 50%;
  border: 2px solid rgba(124,58,237,.6);
  animation: aiPulse 2s ease-out infinite;
  pointer-events: none;
}
@keyframes aiPulse {
  0%   { transform: scale(1);   opacity: .8; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* AI Avatar */
.ai-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #fff; flex-shrink: 0;
}

/* Chat Panel */
.ai-chat-panel {
  position: fixed;
  bottom: calc(68px + 14px + 48px + 12px);
  right: calc(48px + 20px + 12px);
  width: 340px;
  max-height: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  display: none;
  flex-direction: column;
  z-index: 300;
  overflow: hidden;
  transform: scale(.92) translateY(16px);
  opacity: 0;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
}
.ai-chat-panel.open {
  display: flex;
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Chat Header */
.ai-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}

/* Messages */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.ai-chat-messages::-webkit-scrollbar { width: 4px; }
.ai-chat-messages::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 99px; }

/* Message bubbles */
.ai-msg {
  display: flex;
  gap: 8px;
  animation: msgIn .2s ease;
}
@keyframes msgIn {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}
.ai-msg.user { flex-direction: row-reverse; }

.ai-msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
}
.ai-msg.ai .ai-msg-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
}
.ai-msg.user .ai-msg-bubble {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.ai-typing {
  display: flex; gap: 4px; align-items: center;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}
.ai-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted);
  animation: typingDot .9s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: .15s; }
.ai-typing span:nth-child(3) { animation-delay: .30s; }
@keyframes typingDot {
  0%,60%,100% { transform: translateY(0); opacity: .4; }
  30%          { transform: translateY(-5px); opacity: 1; }
}

/* Data card inside message */
.ai-data-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 12px;
}
.ai-data-row {
  display: flex; justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.ai-data-row:last-child { border-bottom: none; }
.ai-data-label { color: var(--text-muted); }
.ai-data-val   { font-weight: 700; font-family: var(--font-display); }

/* Suggestions chips */
.ai-chat-suggestions {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 8px 12px 4px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ai-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 5px 11px;
  border-radius: 99px;
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.ai-chip:hover, .ai-chip:active {
  background: rgba(124,58,237,.15);
  border-color: #7c3aed;
  color: #a78bfa;
}

/* Input area */
.ai-chat-input-area {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ai-chat-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 9px 13px;
  border-radius: 99px;
  font-size: 13px;
  outline: none;
  font-family: var(--font-body);
  transition: var(--transition);
}
.ai-chat-input:focus { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124,58,237,.15); }
.ai-chat-input::placeholder { color: var(--text-muted); }
.ai-send-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.ai-send-btn:hover { transform: scale(1.08); }
.ai-send-btn:active { transform: scale(.92); }

/* Responsive — mobile */
@media (max-width: 768px) {
  .fab-ai { display: flex; }
  .ai-chat-panel {
    right: 12px; left: 12px; width: auto;
    bottom: calc(68px + 14px + 48px + 12px);
    max-height: 70vh;
    border-radius: var(--radius-xl);
  }
}
@media (min-width: 769px) {
  .fab-ai { display: flex; }
}

/* ============================================================
   ONBOARDING SCREEN
   ============================================================ */
#onboarding-screen {
  position: fixed; inset: 0;
  background: var(--bg-base);
  z-index: 9998;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}

.onb-container {
  width: 100%; max-width: 420px;
  display: flex; flex-direction: column;
  align-items: center;
  height: 100%;
  max-height: 700px;
  position: relative;
}

/* Slides wrapper */
.onb-slides {
  flex: 1;
  width: 100%;
  position: relative;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}

/* Individual slide */
.onb-slide {
  position: absolute;
  width: 100%;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: 20px 8px;
  opacity: 0;
  transform: translateX(60px);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
}
.onb-slide.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: all;
}
.onb-slide.exit-left {
  opacity: 0;
  transform: translateX(-60px);
}
.onb-slide.exit-right {
  opacity: 0;
  transform: translateX(60px);
}
.onb-slide.enter-right {
  opacity: 0;
  transform: translateX(60px);
}
.onb-slide.enter-left {
  opacity: 0;
  transform: translateX(-60px);
}

/* Icon wrapper */
.onb-icon-wrap {
  width: 120px; height: 120px;
  border-radius: 32px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 52px;
  margin-bottom: 32px;
  position: relative;
  box-shadow: 0 0 60px rgba(255,255,255,.04);
}
/* Glow ring behind icon */
.onb-icon-wrap::before {
  content: '';
  position: absolute; inset: -12px;
  border-radius: 40px;
  background: radial-gradient(circle, color-mix(in srgb, var(--slide-color) 20%, transparent) 0%, transparent 70%);
  z-index: -1;
}

.onb-logo-img {
  width: 80px; height: 80px;
  border-radius: 20px;
  object-fit: cover;
}

/* Slide text */
.onb-title {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  color: var(--text-primary);
  letter-spacing: -.5px;
}
.onb-desc {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 320px;
}

/* Dots */
.onb-dots {
  display: flex; gap: 8px;
  margin: 24px 0 20px;
}
.onb-dot {
  width: 8px; height: 8px;
  border-radius: 99px;
  background: var(--border-light);
  cursor: pointer;
  transition: width .3s ease, background .3s ease;
}
.onb-dot.active {
  width: 24px;
  background: var(--cyan);
}

/* Action buttons */
.onb-actions {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; gap: 12px;
  margin-bottom: 20px;
}
.onb-skip-btn {
  color: var(--text-muted);
  font-size: 14px;
  transition: opacity .3s;
}
.onb-next-btn {
  flex: 1;
  justify-content: center;
  padding: 13px 24px;
  font-size: 15px; font-weight: 700;
}

/* Progress bar */
.onb-progress {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.onb-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
  border-radius: 99px;
  transition: width .35s cubic-bezier(.4,0,.2,1);
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .onb-icon-wrap { width: 100px; height: 100px; font-size: 44px; margin-bottom: 24px; }
  .onb-title { font-size: 22px; }
  .onb-desc  { font-size: 14px; }
  .onb-logo-img { width: 68px; height: 68px; }
}

/* ============================================================
   NOTES PAGE
   ============================================================ */

/* Masonry-like grid */
.notes-masonry {
  columns: 2;
  column-gap: 14px;
}
@media (max-width: 480px) {
  .notes-masonry { columns: 1; }
}
@media (min-width: 1024px) {
  .notes-masonry { columns: 3; }
}

/* Note card */
.note-card {
  break-inside: avoid;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--note-color, var(--cyan));
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 14px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.note-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--note-color, var(--cyan));
}

.note-card-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-height: 26px;
}
.note-pin-icon {
  position: absolute;
  top: 14px; left: 14px;
  color: var(--yellow);
  font-size: 12px;
}
.note-card-actions {
  display: flex; gap: 2px;
  opacity: 0;
  transition: opacity .2s;
}
.note-card:hover .note-card-actions { opacity: 1; }

.note-card-title {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}
.note-card-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}
.note-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  flex-wrap: wrap;
  gap: 6px;
}
.note-tag {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
}
.note-date {
  font-size: 11px;
  color: var(--text-muted);
}

/* Color filter chip */
.note-color-chip {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--chip-color);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.note-color-chip.active {
  transform: scale(1.2);
  box-shadow: 0 0 0 3px rgba(255,255,255,.2);
}
.note-color-chip:first-child {
  width: auto; height: auto;
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  display: flex; align-items: center;
}
.note-color-chip:first-child.active {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: scale(1);
}

/* ============================================================
   GOALS PAGE
   ============================================================ */
.goal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--goal-color, var(--cyan));
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.goal-card::before {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 120px; height: 120px;
  background: radial-gradient(circle, color-mix(in srgb, var(--goal-color) 12%, transparent), transparent 70%);
  pointer-events: none;
}
.goal-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--goal-color, var(--cyan));
}
.goal-card.goal-done {
  border-left-color: var(--green);
  opacity: .85;
}
.goal-done-badge {
  position: absolute; top: 14px; right: 14px;
  background: rgba(0,230,118,.15);
  color: var(--green);
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; gap: 5px;
}
.goal-icon-wrap {
  width: 46px; height: 46px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--goal-color) 18%, transparent);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  color: var(--goal-color, var(--cyan));
  flex-shrink: 0;
}

/* ============================================================
   INSTALLMENT PAGE
   ============================================================ */
.inst-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--inst-color, var(--orange));
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  transition: var(--transition);
  position: relative;
}
.inst-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.inst-card.inst-overdue { border-left-color: var(--red); animation: overdueGlow 2s ease-in-out infinite; }
.inst-card.inst-done { opacity: .8; border-left-color: var(--green); }
@keyframes overdueGlow {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,23,68,0); }
  50%      { box-shadow: 0 0 12px 2px rgba(255,23,68,.2); }
}
.inst-icon-wrap {
  width: 46px; height: 46px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--inst-color) 18%, transparent);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--inst-color, var(--orange));
  flex-shrink: 0;
}

/* ============================================================
   NET WORTH PAGE
   ============================================================ */
.nw-hero-card {
  background: linear-gradient(135deg, #1a1040, #0d1a3a);
  border: 1px solid rgba(124,58,237,.3);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.nw-hero-card::before {
  content: '';
  position: absolute; top: -40px; right: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(124,58,237,.25), transparent 70%);
}
.nw-hero-card::after {
  content: '';
  position: absolute; bottom: -30px; left: -30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,229,255,.15), transparent 70%);
}
.nw-hero-value {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}
.nw-hero-value.positive { color: #4ade80; }
.nw-hero-value.negative { color: #f87171; }

.nw-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--nw-color, var(--teal));
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: var(--transition);
}
.nw-item-card:hover { transform: translateX(3px); border-color: var(--nw-color, var(--teal)); }

.nw-item-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--text-secondary);
  flex-shrink: 0;
}

/* ============================================================
   HELP PAGE
   ============================================================ */
.help-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--hc) 15%, transparent);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--hc, var(--cyan));
}

.help-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color var(--transition);
}
.help-card.open { border-color: var(--border-light); }

.help-card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 16px;
  cursor: pointer;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.help-card-header:hover { background: var(--bg-elevated); }

.help-chevron {
  color: var(--text-muted);
  font-size: 13px; flex-shrink: 0;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.help-card.open .help-chevron { transform: rotate(180deg); }

.help-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s cubic-bezier(.4,0,.2,1);
  border-top: 0px solid var(--border);
}
.help-card.open .help-card-body {
  max-height: 600px;
  border-top-width: 1px;
}

/* ============================================================
   SCAN STRUK PAGE
   ============================================================ */
.scan-dropzone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  min-height: 180px;
  display: flex; align-items: center; justify-content: center;
}
.scan-dropzone:hover,
.scan-dropzone.drag-over {
  border-color: var(--cyan);
  background: rgba(0,229,255,.04);
}
.scan-dropzone.drag-over { border-style: solid; }

#scan-preview-wrap {
  position: relative;
  width: 100%;
  display: flex; align-items: center; justify-content: center;
}
.scan-preview-img {
  max-height: 260px;
  max-width: 100%;
  border-radius: var(--radius-md);
  object-fit: contain;
}
.scan-remove-btn {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0,0,0,.7);
  color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: var(--transition);
}
.scan-remove-btn:hover { background: var(--red); }

/* Receipt items table */
.receipt-items-table { font-size: 13px; }
.receipt-item-header {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 4px;
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  letter-spacing: .5px; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.receipt-item-row {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.receipt-item-row:last-child { border-bottom: none; }

.receipt-item-name {
  flex: 1; min-width: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px; outline: none;
  transition: var(--transition);
}
.receipt-item-name:focus { border-color: var(--cyan); }

.receipt-item-qty {
  width: 50px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 6px;
  border-radius: var(--radius-sm);
  font-size: 13px; text-align: center; outline: none;
  transition: var(--transition);
}
.receipt-item-qty:focus { border-color: var(--cyan); }

.receipt-item-price {
  width: 110px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px; text-align: right; outline: none;
  transition: var(--transition);
  font-family: var(--font-display);
}
.receipt-item-price:focus { border-color: var(--cyan); }

.receipt-item-total {
  width: 110px;
  text-align: right;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
  flex-shrink: 0;
}

.receipt-item-del {
  width: 28px; height: 28px; flex-shrink: 0;
  background: rgba(255,23,68,.1);
  border: none; border-radius: var(--radius-sm);
  color: var(--red); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; transition: var(--transition);
}
.receipt-item-del:hover { background: rgba(255,23,68,.25); }

/* Receipt badge in transaction list */
.receipt-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(0,229,255,.12);
  color: var(--cyan);
  padding: 2px 7px; border-radius: 99px;
  font-size: 10px; font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.receipt-badge:hover { background: rgba(0,229,255,.22); }

/* Mobile responsive */
@media (max-width: 540px) {
  .receipt-item-header { display: none; }
  .receipt-item-row { flex-wrap: wrap; gap: 6px; }
  .receipt-item-name  { flex: 1 1 100%; }
  .receipt-item-qty   { width: 60px; }
  .receipt-item-price { width: 100px; }
  .receipt-item-total { width: auto; flex: 1; }
}

/* ============================================================
   RECEIPT BUILDER — Select Mode
   ============================================================ */
.txn-selectable {
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.txn-selectable:hover {
  background: rgba(29,233,182,.06);
}
.txn-selected {
  background: rgba(29,233,182,.1) !important;
  border-color: rgba(29,233,182,.3) !important;
}