/* ── Reset & Base ─────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 240px;
  --sidebar-collapsed-w: 68px;
  --topbar-h: 66px;

  --bg:      #f1f5f9;
  --bg-2:    #e8edf5;
  --surface: #ffffff;
  --border:  #e2e8f0;
  --border-2:#cbd5e1;

  --primary:       #6366f1;
  --primary-light: #eef2ff;
  --primary-dark:  #4338ca;
  --primary-glow:  rgba(99,102,241,.18);

  --income-color:  #10b981;
  --income-light:  #d1fae5;
  --expense-color: #f43f5e;
  --expense-light: #ffe4e6;

  --excellent: #059669;
  --good:      #10b981;
  --fair:      #f59e0b;
  --warn:      #f97316;
  --critical:  #e11d48;

  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --text-4: #cbd5e1;

  --radius:    14px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-md: 0 10px 25px -5px rgba(0,0,0,.10), 0 4px 10px -6px rgba(0,0,0,.06);
  --shadow-lg: 0 20px 40px -10px rgba(0,0,0,.14);

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

html, body {
  height: 100%;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Sidebar ──────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; height: 100vh;
  width: var(--sidebar-w);
  background: linear-gradient(175deg, #1e1b4b 0%, #312e81 60%, #3730a3 100%);
  display: flex; flex-direction: column;
  transition: width var(--transition); z-index: 100; overflow: hidden;
  box-shadow: 4px 0 24px rgba(0,0,0,.15);
}
.sidebar.collapsed { width: var(--sidebar-collapsed-w); }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .logo-text { opacity: 0; width: 0; overflow: hidden; pointer-events: none; }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: var(--topbar-h);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.logo { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo-icon {
  font-size: 22px; width: 38px; height: 38px;
  background: rgba(255,255,255,.12); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.logo-text {
  color: #fff; font-weight: 700; font-size: 15px;
  white-space: nowrap; letter-spacing: -.2px;
}
.sidebar-toggle {
  background: rgba(255,255,255,.08); border: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: rgba(255,255,255,.7);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.18); color: #fff; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 16px 10px; flex: 1; overflow-y: auto; }

.sidebar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; margin: 0 10px 12px;
  background: rgba(255,255,255,.08); border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  flex-shrink: 0;
}
.sidebar-user .user-avatar { font-size: 18px; line-height: 1; flex-shrink: 0; }
.sidebar-username {
  flex: 1; min-width: 0; font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,.85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user .btn-logout {
  background: none; border: none; cursor: pointer; font-size: 16px;
  color: rgba(255,255,255,.5); padding: 2px 0 2px 4px; line-height: 1;
  transition: color var(--transition); flex-shrink: 0;
}
.sidebar-user .btn-logout:hover { color: #f87171; }
.sidebar.collapsed .sidebar-user { padding: 10px; justify-content: center; margin: 0 8px 12px; }
.sidebar.collapsed .sidebar-username,
.sidebar.collapsed .btn-logout { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm); text-decoration: none;
  color: rgba(255,255,255,.6);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap; position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.9); }
.nav-item.active {
  background: rgba(255,255,255,.15);
  color: #fff; font-weight: 600;
  box-shadow: inset 3px 0 0 rgba(255,255,255,.6);
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; background: #a5b4fc; border-radius: 0 3px 3px 0;
}
.nav-icon { font-size: 17px; min-width: 24px; text-align: center; flex-shrink: 0; }
.nav-label { transition: opacity var(--transition), width var(--transition); font-size: 13.5px; }

/* Sidebar footer */
.sidebar::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 60px;
  background: linear-gradient(to top, rgba(0,0,0,.15), transparent);
  pointer-events: none;
}

/* ── Main Layout ──────────────────────────────── */
.main {
  margin-left: var(--sidebar-w); min-height: 100vh;
  transition: margin-left var(--transition);
  display: flex; flex-direction: column;
}
.main.collapsed { margin-left: var(--sidebar-collapsed-w); }

/* ── Topbar ───────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-xs);
}
.page-title { font-size: 18px; font-weight: 700; color: var(--text-1); letter-spacing: -.3px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.month-selector {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px 6px;
}
.month-selector span { font-size: 13.5px; font-weight: 600; padding: 0 6px; white-space: nowrap; color: var(--text-1); }
.btn-icon {
  background: transparent; border: none; border-radius: 6px;
  cursor: pointer; width: 26px; height: 26px; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  transition: background var(--transition), color var(--transition);
}
.btn-icon:hover { background: var(--border); color: var(--text-1); }

/* ── Buttons ──────────────────────────────────── */
.btn-primary {
  background: var(--primary); color: #fff; border: none;
  border-radius: var(--radius-sm); padding: 9px 18px;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform .1s;
  box-shadow: 0 2px 8px rgba(99,102,241,.3);
  letter-spacing: -.1px;
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(99,102,241,.4);
}
.btn-primary:active { transform: scale(.97); }

.btn-secondary {
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 18px; font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.btn-secondary:hover { background: var(--bg); border-color: var(--border-2); }

.btn-text {
  background: none; border: none; cursor: pointer;
  color: var(--primary); font-size: 13px; font-weight: 600;
  transition: color var(--transition);
}
.btn-text:hover { color: var(--primary-dark); text-decoration: underline; }

.btn-danger-sm {
  background: var(--expense-light); color: var(--expense-color);
  border: 1px solid #fecdd3; border-radius: var(--radius-xs);
  padding: 6px 12px; font-size: 12.5px; font-weight: 500; cursor: pointer;
  transition: background var(--transition);
}
.btn-danger-sm:hover { background: #fecdd3; }

.btn-delete, .btn-edit {
  background: none; border: none; cursor: pointer; color: var(--text-4);
  font-size: 15px; padding: 4px 7px; border-radius: var(--radius-xs);
  transition: color var(--transition-fast), background var(--transition-fast);
}
.btn-delete:hover { color: var(--expense-color); background: var(--expense-light); }
.btn-edit:hover   { color: var(--primary); background: var(--primary-light); }
.actions-cell     { white-space: nowrap; text-align: center; }
.text-center      { text-align: center; }

/* ── Sections ─────────────────────────────────── */
.section { display: none; padding: 28px; flex-direction: column; gap: 20px; }
.section.active { display: flex; }

/* ── Cards ────────────────────────────────────── */
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 24px;
  border: 1px solid var(--border);
}
.card-title {
  font-size: 14.5px; font-weight: 700; color: var(--text-1);
  margin-bottom: 18px; letter-spacing: -.2px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px;
}
.card-header .card-title { margin-bottom: 0; }

/* ── Health Banner ────────────────────────────── */
.health-banner {
  border-radius: var(--radius); padding: 26px 32px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; box-shadow: var(--shadow-md);
  transition: background .5s ease; position: relative; overflow: hidden;
}
.health-banner::before {
  content: ''; position: absolute; top: -40px; right: -40px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,.06); pointer-events: none;
}
.health-banner::after {
  content: ''; position: absolute; bottom: -60px; right: 100px;
  width: 160px; height: 160px; border-radius: 50%;
  background: rgba(255,255,255,.04); pointer-events: none;
}
.health-banner.excellent { background: linear-gradient(135deg, #059669 0%, #047857 100%); }
.health-banner.good      { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.health-banner.fair      { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.health-banner.warn      { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); }
.health-banner.critical  { background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%); }

.health-score-wrap { display: flex; align-items: center; gap: 20px; position: relative; z-index: 1; }
.health-circle {
  width: 70px; height: 70px; border-radius: 50%;
  background: rgba(255,255,255,.18); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.15), inset 0 1px 0 rgba(255,255,255,.3);
}
.health-info { position: relative; z-index: 1; }
.health-label { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.health-desc { font-size: 13px; opacity: .8; margin-top: 4px; }

.health-stats {
  display: flex; gap: 0; flex-wrap: wrap;
  position: relative; z-index: 1;
  background: rgba(0,0,0,.12); border-radius: 12px; overflow: hidden;
}
.hstat {
  padding: 14px 24px; text-align: center;
  border-right: 1px solid rgba(255,255,255,.12);
}
.hstat:last-child { border-right: none; }
.hstat-val { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.hstat-lbl { font-size: 11px; opacity: .7; margin-top: 3px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }

/* ── Charts ───────────────────────────────────── */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-card { padding: 24px; }
.chart-wrap { height: 250px; position: relative; }

/* ── Pagination ───────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  padding-top: 16px; margin-top: 4px;
  border-top: 1px solid var(--border);
}
.pagination:empty { display: none; }
.pg-info { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.pg-info strong { color: var(--text-2); }
.pg-controls { display: flex; align-items: center; gap: 4px; }
.pg-btn {
  min-width: 32px; height: 32px; padding: 0 6px;
  border: 1.5px solid var(--border); border-radius: var(--radius-xs);
  background: var(--surface); color: var(--text-2);
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.pg-btn:hover:not([disabled]) { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.pg-active {
  background: var(--primary) !important; border-color: var(--primary) !important;
  color: #fff !important; font-weight: 700;
  box-shadow: 0 2px 6px rgba(99,102,241,.3);
}
.pg-disabled { opacity: .35; cursor: not-allowed; }
.pg-ellipsis { font-size: 13px; color: var(--text-3); padding: 0 4px; line-height: 32px; }

/* ── Tables ───────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: -2px; padding: 2px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left; padding: 9px 14px; font-size: 11px; font-weight: 700;
  color: var(--text-3); text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 2px solid var(--border); white-space: nowrap;
}
.data-table td {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle; color: var(--text-2);
}
.data-table td:first-child { color: var(--text-1); font-weight: 500; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr {
  transition: background var(--transition-fast);
}
.data-table tbody tr:hover td { background: #f8fafc; }
.text-right { text-align: right; }
.empty-state {
  color: var(--text-3); text-align: center; padding: 40px !important;
  font-style: italic; font-size: 13px;
}

.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 100px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
}
.badge-income  { background: var(--income-light); color: #065f46; }
.badge-expense { background: var(--expense-light); color: #9f1239; }

.amount-income  { color: var(--income-color); font-weight: 700; }
.amount-expense { color: var(--expense-color); font-weight: 700; }

/* ── Forms ────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-full { grid-column: 1 / -1; }
.form-group label { font-size: 12.5px; font-weight: 600; color: var(--text-2); letter-spacing: .01em; }
.form-group input,
.form-group select {
  padding: 10px 13px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; background: var(--surface); color: var(--text-1);
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
}
.form-group input::placeholder { color: var(--text-3); }
.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: #fafbff;
}
.form-group select { cursor: pointer; }
.form-actions {
  grid-column: 1 / -1; display: flex; justify-content: flex-end;
  gap: 10px; padding-top: 6px; margin-top: 2px;
  border-top: 1px solid var(--border);
}

/* ── Filter Bar ───────────────────────────────── */
.filter-bar {
  margin-bottom: 14px; display: flex; gap: 8px;
  flex-wrap: wrap; align-items: center;
}
.filter-row {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.filter-bar select, .filter-row select {
  padding: 7px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; background: var(--surface); cursor: pointer; outline: none;
  font-family: inherit; color: var(--text-2); transition: border-color var(--transition);
}
.filter-bar select:focus, .filter-row select:focus { border-color: var(--primary); }

.history-search {
  flex: 1; min-width: 200px; max-width: 320px;
  padding: 7px 13px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; background: var(--surface); outline: none;
  font-family: inherit; color: var(--text-1);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.history-search::placeholder { color: var(--text-3); }
.history-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.date-range { display: flex; align-items: center; gap: 5px; flex-wrap: nowrap; }
.date-range input[type="date"] {
  padding: 7px 9px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12.5px; background: var(--surface); outline: none;
  font-family: inherit; color: var(--text-2);
  cursor: pointer; transition: border-color var(--transition); width: 134px;
}
.date-range input[type="date"]:focus { border-color: var(--primary); }
.date-range-sep { font-size: 13px; color: var(--text-4); flex-shrink: 0; }
.btn-icon-sm {
  width: 28px; height: 28px; border: 1.5px solid var(--border); border-radius: var(--radius-xs);
  background: var(--surface); cursor: pointer; font-size: 11px; color: var(--text-3);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.btn-icon-sm:hover { background: var(--expense-light); border-color: #fecdd3; color: var(--expense-color); }

/* ── Summary Section ──────────────────────────── */
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.summary-score-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.big-score { padding: 24px 0 28px; }
.score-emoji { font-size: 60px; line-height: 1; filter: drop-shadow(0 4px 8px rgba(0,0,0,.12)); }
.score-label { font-size: 26px; font-weight: 800; margin-top: 10px; letter-spacing: -.5px; }
.score-month { font-size: 13px; color: var(--text-3); margin-top: 5px; }
.score-breakdown { width: 100%; }
.score-stat {
  display: flex; justify-content: space-between; padding: 10px 0;
  border-top: 1px solid var(--border); font-size: 13.5px;
}
.score-stat span:first-child { color: var(--text-2); }
.score-stat span:last-child { font-weight: 700; }

.legend-list { display: flex; flex-direction: column; gap: 10px; }
.legend-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  border-left: 4px solid transparent;
  transition: transform var(--transition);
}
.legend-item:hover { transform: translateX(3px); }
.legend-excellent { background: #ecfdf5; border-color: var(--excellent); }
.legend-good      { background: #d1fae5; border-color: var(--good); }
.legend-fair      { background: #fef3c7; border-color: var(--fair); }
.legend-warn      { background: #ffedd5; border-color: var(--warn); }
.legend-critical  { background: #ffe4e6; border-color: var(--critical); }
.legend-emoji { font-size: 20px; min-width: 26px; text-align: center; }
.legend-name { font-weight: 700; font-size: 13.5px; }
.legend-desc { font-size: 12px; color: var(--text-2); margin-top: 1px; }

.category-breakdown-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 12px;
}
.cat-card {
  background: var(--bg); border-radius: 10px; padding: 16px;
  border: 1.5px solid var(--border);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.cat-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.cat-name { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; font-weight: 500; }
.cat-amount { font-size: 17px; font-weight: 800; margin-top: 6px; color: var(--text-1); letter-spacing: -.3px; }
.cat-pct { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.cat-bar { height: 4px; border-radius: 2px; background: var(--border); margin-top: 10px; overflow: hidden; }
.cat-bar-fill { height: 100%; background: var(--primary); border-radius: 2px; transition: width .6s ease; }

.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 100px; font-size: 12px; font-weight: 600;
}
.status-excellent { background: #d1fae5; color: var(--excellent); }
.status-good      { background: #a7f3d0; color: #065f46; }
.status-fair      { background: #fef3c7; color: #92400e; }
.status-warn      { background: #ffedd5; color: #9a3412; }
.status-critical  { background: #ffe4e6; color: var(--critical); }

/* ── Danger Button ────────────────────────────── */
.btn-danger {
  background: var(--expense-color); color: #fff; border: none;
  border-radius: var(--radius-sm); padding: 9px 22px;
  font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background var(--transition), box-shadow var(--transition), transform .1s;
  box-shadow: 0 2px 8px rgba(244,63,94,.3);
}
.btn-danger:hover {
  background: #e11d48;
  box-shadow: 0 4px 14px rgba(244,63,94,.4);
}
.btn-danger:active { transform: scale(.97); }

/* ── Confirm Modal ────────────────────────────── */
.confirm-modal {
  width: 400px !important; padding: 0 !important;
  text-align: center; overflow: hidden;
}
.confirm-modal > * { padding-left: 32px; padding-right: 32px; }
.confirm-icon-wrap {
  font-size: 46px; line-height: 1;
  padding: 32px 32px 0 !important;
  display: block;
}
.confirm-title {
  font-size: 18px; font-weight: 800; letter-spacing: -.4px;
  margin: 12px 0 8px; color: var(--text-1);
}
.confirm-msg {
  font-size: 13.5px; color: var(--text-2); line-height: 1.6;
  margin-bottom: 28px;
}
.confirm-actions {
  display: flex; gap: 10px; justify-content: center;
  padding: 0 32px 28px !important;
}
.confirm-cancel-btn { min-width: 100px; }

/* ── Modal ────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.5); backdrop-filter: blur(3px);
  z-index: 200; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius);
  padding: 0; width: 560px; max-width: 100%; max-height: 90vh; overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: modalIn .22s cubic-bezier(.34,1.56,.64,1);
  display: flex; flex-direction: column;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(-10px); }
  to   { opacity: 1; transform: none; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 18px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.modal-close {
  background: var(--bg); border: none; font-size: 15px;
  cursor: pointer; color: var(--text-3); width: 30px; height: 30px;
  border-radius: 7px; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--expense-light); color: var(--expense-color); }
.modal form { padding: 24px; overflow-y: auto; }

/* ── Toast ────────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 300;
  background: #1e293b; color: #fff; padding: 13px 22px;
  border-radius: 10px; font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0; transform: translateY(10px) scale(.97);
  transition: opacity .25s, transform .25s;
  pointer-events: none; max-width: 320px;
}
.toast.show { opacity: 1; transform: none; }
.toast.success { background: #064e3b; border-left: 4px solid var(--income-color); }
.toast.error   { background: #881337; border-left: 4px solid var(--expense-color); }

/* ── Colour utils ─────────────────────────────── */
.text-warn    { color: var(--warn); }
.text-income  { color: var(--income-color); }
.text-expense { color: var(--expense-color); }

/* ── Budget Section ───────────────────────────── */
.budget-income-summary {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.bis-item {
  text-align: center; flex: 1; min-width: 120px;
  background: var(--bg); border-radius: 10px; padding: 14px 16px;
  border: 1.5px solid var(--border);
}
.bis-val  { font-size: 20px; font-weight: 800; letter-spacing: -.5px; }
.bis-lbl  { font-size: 11.5px; color: var(--text-3); margin-top: 3px; font-weight: 500; }
.bis-arrow{ font-size: 18px; color: var(--text-4); flex-shrink: 0; }

.budget-total-bar-wrap {
  height: 8px; background: var(--border); border-radius: 4px; overflow: hidden;
}
.budget-total-bar, .budget-total-fill {
  height: 100%; border-radius: 4px; transition: width .6s cubic-bezier(.4,0,.2,1);
}
.budget-total-ok   { background: linear-gradient(90deg, var(--income-color), #34d399); width: 0; }
.budget-total-warn { background: linear-gradient(90deg, var(--warn), #fb923c); width: 0; }
.budget-total-over { background: linear-gradient(90deg, var(--expense-color), #fb7185); width: 100%; }

/* Budget Cards grid */
.budget-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.budget-card {
  border-radius: 12px; padding: 16px; border: 1.5px solid var(--border);
  display: flex; flex-direction: column; gap: 12px;
  min-width: 0;
  transition: box-shadow var(--transition), transform var(--transition);
}
.budget-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.budget-card-ok      { background: #f0fdf4; border-color: #a7f3d0; }
.budget-card-warn    { background: #fffbeb; border-color: #fde68a; }
.budget-card-exact   { background: #fff7ed; border-color: #fed7aa; }
.budget-card-over    { background: #fff1f2; border-color: #fecdd3; }
.budget-card-neutral { background: var(--bg); border-color: var(--border); }

.bc-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.bc-cat    { font-weight: 700; font-size: 13px; line-height: 1.3; word-break: break-word; flex: 1; min-width: 0; color: var(--text-1); }
.bc-actions { display: flex; gap: 2px; flex-shrink: 0; }

.bc-amounts { display: flex; flex-direction: column; gap: 6px; }
.bc-amount-row {
  display: flex; justify-content: space-between; align-items: baseline; min-width: 0;
}
.bc-lbl {
  font-size: 11px; color: var(--text-3); flex-shrink: 0; margin-right: 6px; font-weight: 500;
}
.bc-val {
  font-size: 13px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: right; min-width: 0;
}

.bc-bar-wrap { display: flex; align-items: center; gap: 8px; }
.bc-bar    { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; min-width: 0; }
.bc-fill   { height: 100%; border-radius: 3px; transition: width .5s cubic-bezier(.4,0,.2,1); }
.bc-ok     { background: linear-gradient(90deg, var(--income-color), #34d399); }
.bc-warn   { background: linear-gradient(90deg, var(--fair), #fbbf24); }
.bc-exact  { background: linear-gradient(90deg, var(--warn), #fb923c); }
.bc-over   { background: linear-gradient(90deg, var(--expense-color), #fb7185); }
.bc-pct    { font-size: 12px; font-weight: 700; color: var(--text-2); min-width: 34px; text-align: right; flex-shrink: 0; }
.bc-status { font-size: 11px; font-weight: 600; color: var(--text-2); }

/* Budget widget on dashboard */
.budget-widget-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 12px;
}
.bw-item {
  background: var(--bg); border-radius: 10px; padding: 14px;
  border: 1.5px solid var(--border);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.bw-item:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.bw-top    { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 10px; }
.bw-cat    { font-weight: 700; color: var(--text-1); }
.bw-bar    { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 7px; }
.bw-fill   { height: 100%; border-radius: 3px; transition: width .5s cubic-bezier(.4,0,.2,1); }
.bw-ok     { background: linear-gradient(90deg, var(--income-color), #34d399); }
.bw-warn   { background: linear-gradient(90deg, var(--fair), #fbbf24); }
.bw-exact  { background: linear-gradient(90deg, var(--warn), #fb923c); }
.bw-over   { background: linear-gradient(90deg, var(--expense-color), #fb7185); }
.bw-bottom { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); font-weight: 500; }

/* ── Assets Section ───────────────────────────── */
.assets-banner {
  border-radius: var(--radius); padding: 24px 28px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px;
  background: linear-gradient(135deg, #0f766e 0%, #134e4a 100%);
  color: #fff; box-shadow: var(--shadow-md); position: relative; overflow: hidden;
}
.assets-banner::before {
  content: ''; position: absolute; top: -40px; right: -40px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,.06); pointer-events: none;
}
.assets-banner-left { display: flex; align-items: center; gap: 18px; position: relative; z-index: 1; }
.assets-banner-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(255,255,255,.15); display: flex; align-items: center;
  justify-content: center; font-size: 28px; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.15), inset 0 1px 0 rgba(255,255,255,.3);
}
.assets-banner-label { font-size: 13px; opacity: .8; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.assets-banner-total { font-size: 28px; font-weight: 800; letter-spacing: -.5px; margin-top: 4px; }
.assets-banner-cats {
  display: flex; flex-wrap: wrap; gap: 8px; position: relative; z-index: 1;
}
.asset-cat-chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: rgba(255,255,255,.15); border-radius: 10px; padding: 8px 14px;
  font-size: 12px; min-width: 90px; text-align: center;
}
.asset-cat-chip strong { font-size: 13px; font-weight: 700; }

/* Budget hint in expense form */
.budget-hint {
  margin-top: 6px; padding: 7px 11px; border-radius: var(--radius-xs);
  font-size: 12px; font-weight: 500; border-left: 3px solid transparent;
}
.hint-ok   { background: #ecfdf5; color: #065f46; border-color: var(--income-color); }
.hint-warn { background: #fffbeb; color: #92400e; border-color: var(--fair); }
.hint-over { background: #fff1f2; color: #9f1239; border-color: var(--expense-color); }

/* ── Debt Section ─────────────────────────────── */
.debt-banner {
  border-radius: var(--radius); padding: 24px 28px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px;
  background: linear-gradient(135deg, #be123c 0%, #9f1239 100%);
  color: #fff; box-shadow: var(--shadow-md); position: relative; overflow: hidden;
}
.debt-banner::before {
  content: ''; position: absolute; top: -40px; right: -40px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,.06); pointer-events: none;
}
.debt-banner-left { display: flex; align-items: center; gap: 18px; position: relative; z-index: 1; }
.debt-banner-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(255,255,255,.15); display: flex; align-items: center;
  justify-content: center; font-size: 28px; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.15), inset 0 1px 0 rgba(255,255,255,.3);
}
.debt-banner-label { font-size: 13px; opacity: .8; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.debt-banner-total { font-size: 28px; font-weight: 800; letter-spacing: -.5px; margin-top: 4px; }
.debt-banner-stats {
  display: flex; gap: 0; flex-wrap: wrap; position: relative; z-index: 1;
  background: rgba(0,0,0,.12); border-radius: 12px; overflow: hidden;
}
.debt-stat {
  padding: 14px 24px; text-align: center;
  border-right: 1px solid rgba(255,255,255,.12);
}
.debt-stat:last-child { border-right: none; }
.debt-stat-val { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.debt-stat-lbl { font-size: 11px; opacity: .7; margin-top: 3px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }

/* Progress bar in debt table */
.debt-progress-wrap { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.debt-progress-bar  { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.debt-progress-fill { height: 100%; border-radius: 3px; transition: width .5s cubic-bezier(.4,0,.2,1); }
.debt-fill-aktif    { background: linear-gradient(90deg, #f43f5e, #fb7185); }
.debt-fill-overdue  { background: linear-gradient(90deg, #f97316, #fb923c); }
.debt-fill-lunas    { background: linear-gradient(90deg, var(--income-color), #34d399); }
.debt-pct { font-size: 11.5px; font-weight: 700; color: var(--text-2); min-width: 32px; text-align: right; flex-shrink: 0; }

/* Status badge */
.debt-status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 100px; font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
}
.debt-status-aktif   { background: #ffe4e6; color: #9f1239; }
.debt-status-overdue { background: #ffedd5; color: #9a3412; }
.debt-status-lunas   { background: #d1fae5; color: #065f46; }

/* Debt selector hint */
.debt-sel-hint {
  margin-top: 6px; padding: 7px 11px; border-radius: var(--radius-xs);
  font-size: 12px; font-weight: 500; border-left: 3px solid transparent;
  display: none;
}
.debt-sel-hint.show {
  display: block; background: #fff7ed; color: #92400e; border-color: var(--warn);
}

/* ── Responsive ───────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { width: var(--sidebar-collapsed-w); }
  .sidebar .nav-label, .sidebar .logo-text { opacity: 0; width: 0; overflow: hidden; }
  .main { margin-left: var(--sidebar-collapsed-w); }
  .charts-row { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-full { grid-column: 1; }
}
@media (max-width: 640px) {
  .health-banner { flex-direction: column; align-items: flex-start; padding: 20px; }
  .health-stats { gap: 0; width: 100%; }
  .hstat { flex: 1; padding: 12px 14px; }
  .topbar { padding: 0 16px; }
  .section { padding: 16px; gap: 14px; }
  .card { padding: 18px; }
  .filter-bar, .filter-row { flex-direction: column; align-items: stretch; }
  .history-search { max-width: 100%; }
  .date-range { flex-wrap: wrap; }
  .date-range input[type="date"] { width: 100%; flex: 1; }
}

/* ── Cicilan / Debt Schedule Modal ─────────────────────────────────────────── */
.btn-cicilan {
  background: #e0f2fe; color: #0369a1; border: none;
  border-radius: 6px; padding: 4px 8px; font-size: 13px; cursor: pointer;
  transition: background .15s;
}
.btn-cicilan:hover { background: #bae6fd; }
.btn-cicilan-pay {
  background: #dcfce7; color: #15803d; border: none;
  border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer;
  white-space: nowrap; transition: background .15s;
}
.btn-cicilan-pay:hover { background: #bbf7d0; }
.btn-cicilan-pay:disabled { opacity: .5; cursor: not-allowed; }
.btn-cicilan-cancel {
  background: #fee2e2; color: #b91c1c; border: none;
  border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer;
  white-space: nowrap; transition: background .15s;
}
.btn-cicilan-cancel:hover { background: #fecaca; }

.cicilan-legend {
  display: flex; gap: 16px; padding: 10px 0 6px; flex-wrap: wrap;
}
.cicilan-legend-item {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2);
}
.cicilan-dot {
  width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.08); flex-shrink: 0;
}

.cicilan-note {
  background: #fefce8; border: 1px solid #fef08a; border-radius: 8px;
  padding: 10px 14px; font-size: 12.5px; color: #713f12; margin-bottom: 10px; line-height: 1.6;
}

.cicilan-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 420px; overflow-y: auto; padding-right: 2px;
}

.cicilan-row {
  display: grid; grid-template-columns: 110px 1fr 1fr auto;
  align-items: center; gap: 12px;
  background: #fff7ed; border: 1px solid #fed7aa;
  border-radius: 8px; padding: 10px 14px;
}
.cicilan-row-paid {
  background: #f0fdf4; border-color: #bbf7d0;
}
.cicilan-row-future {
  background: #f8fafc; border-color: #e2e8f0;
}

.cicilan-period { line-height: 1.3; }
.cicilan-month  { font-size: 13px; font-weight: 600; color: var(--text-1); }
.cicilan-date   { font-size: 11px; color: var(--text-3); }
.cicilan-amount { font-size: 13px; font-weight: 600; color: var(--text-1); }

.cicilan-status { display: flex; align-items: center; }
.cicilan-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; padding: 3px 8px; border-radius: 999px; font-weight: 500; white-space: nowrap;
}
.cicilan-paid    { background: #dcfce7; color: #15803d; }
.cicilan-unpaid  { background: #fff7ed; color: #c2410c; }
.cicilan-future  { background: #f1f5f9; color: #64748b; }

.cicilan-action { display: flex; justify-content: flex-end; }

.cicilan-summary {
  margin-top: 12px; padding: 10px 14px;
  background: var(--bg-2); border-radius: 8px;
  font-size: 12.5px; color: var(--text-2); line-height: 1.8;
}

/* ── Expense filter summary bar ─────────────────────────────────────────────── */
.expense-summary-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 16px; margin: 4px 0 2px;
  font-size: 13px; color: var(--text-2); flex-wrap: wrap; gap: 8px;
}
.esb-label { flex: 1; min-width: 0; }
.esb-total { white-space: nowrap; font-size: 13.5px; }
.esb-amount { color: var(--expense); font-size: 15px; }

/* ── Unbudgeted pool bar ─────────────────────────────────────────────────────── */
.unmapped-header {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.unmapped-subtitle {
  font-size: 12.5px; color: var(--text-3); font-style: italic;
}
.unmapped-pool {
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
}
.unmapped-pool-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.unmapped-pool-stats {
  display: flex; gap: 24px; flex-wrap: wrap;
}
.up-stat { display: flex; flex-direction: column; gap: 2px; }
.up-lbl  { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; }
.up-val  { font-size: 15px; font-weight: 700; color: var(--text-1); }
.up-badge {
  font-size: 12.5px; padding: 4px 10px;
  background: white; border: 1px solid var(--border);
  border-radius: 999px; white-space: nowrap; align-self: center;
}
.up-warn {
  margin-top: 8px; font-size: 12px; color: #b45309;
  background: #fef3c7; border-radius: 6px; padding: 6px 10px;
}

/* ── Sisa Dana Bebas on income bar ──────────────────────────────────────────── */
.bis-item-free {
  border-left: 2px solid var(--border);
  padding-left: 20px;
}
.bis-free-note {
  font-size: 11px; color: var(--text-3); margin-top: 2px;
}

/* ── Net Worth Bar ───────────────────────────────────────────────────────────── */
.networth-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 20px; margin-bottom: 0;
}
.nw-item { display: flex; flex-direction: column; gap: 3px; }
.nw-lbl  { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; }
.nw-val  { font-size: 17px; font-weight: 700; }
.nw-sep  { font-size: 20px; color: var(--text-3); font-weight: 300; padding: 0 4px; }
.nw-result { border-left: 2px solid var(--border); padding-left: 16px; }

/* ── Debt Widget on Dashboard ────────────────────────────────────────────────── */
.debt-widget-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px;
}
.dw-item {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
}
.dw-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.dw-name   { font-size: 13.5px; font-weight: 600; color: var(--text-1); }
.dw-badge  { font-size: 11px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.dw-paid   { background: #dcfce7; color: #15803d; }
.dw-unpaid { background: #fff7ed; color: #c2410c; }
.dw-progress { display: flex; align-items: center; gap: 8px; }
.dw-bar    { flex: 1; height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.dw-fill   { height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s; }
.dw-pct    { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.dw-amounts { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); }

/* ── Dashboard Alerts ────────────────────────────────────────────────────────── */
#dashboardAlerts { display: flex; flex-direction: column; gap: 8px; }
.dash-alert {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 14px; border-radius: 8px; font-size: 13px; line-height: 1.5;
}
.dash-alert-warn   { background: #fefce8; border: 1px solid #fef08a; color: #713f12; }
.dash-alert-danger { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.dash-alert-ok     { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }

/* ── Salin Anggaran button ───────────────────────────────────────────────────── */
.btn-secondary {
  background: var(--bg-2); color: var(--text-1);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 12px; font-size: 13px; cursor: pointer;
  transition: background .15s;
}
.btn-secondary:hover { background: var(--border); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Recurring Transactions ──────────────────────────────────────────────────── */
.rec-inactive { opacity: .5; }
.toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px;
  transition: background .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 14px; height: 14px; background: white; border-radius: 50%;
  left: 3px; top: 3px; transition: transform .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── Notifikasi Section ──────────────────────────────────────────────────────── */
.nav-badge {
  display: inline-block; background: #ef4444; color: white;
  font-size: 10px; font-weight: 700; border-radius: 999px;
  padding: 1px 5px; margin-left: 4px; vertical-align: middle;
  min-width: 16px; text-align: center;
}
.notif-empty {
  text-align: center; padding: 40px 20px;
  color: var(--text-3); font-style: italic; font-size: 14px;
}
.notif-group { margin-bottom: 20px; }
.notif-group-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-3); margin-bottom: 8px;
}
.notif-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 10px;
  border: 1px solid; margin-bottom: 8px;
  cursor: pointer; transition: opacity .15s;
}
.notif-item:hover { opacity: .85; }
.notif-warn   { background: #fefce8; border-color: #fef08a; color: #713f12; }
.notif-danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.notif-icon   { font-size: 18px; flex-shrink: 0; }
.notif-msg    { flex: 1; font-size: 13.5px; line-height: 1.5; }
.notif-link   { font-size: 12px; font-weight: 600; white-space: nowrap; opacity: .7; }

/* ── Dana Bebas stat on health banner ───────────────────────────────────────── */
.hstat-free {
  border-left: 1px solid rgba(255,255,255,.15);
  padding-left: 20px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   FITUR BARU: Dark Mode, Goals, Search, Print, Category Trend, Annual, Settings
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Dark Mode ───────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:      #0f172a;
  --bg-2:    #1e293b;
  --surface: #1e293b;
  --border:  #334155;
  --border-2:#475569;

  --primary:       #818cf8;
  --primary-light: #1e1b4b;
  --primary-dark:  #a5b4fc;
  --primary-glow:  rgba(129,140,248,.18);

  --income-color:  #34d399;
  --income-light:  #064e3b;
  --expense-color: #fb7185;
  --expense-light: #4c0519;

  --text-1: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --text-4: #475569;
}
[data-theme="dark"] body { background: var(--bg); color: var(--text-1); }
[data-theme="dark"] .sidebar {
  background: linear-gradient(175deg, #0f0e1f 0%, #1e1b4b 60%, #312e81 100%);
}
[data-theme="dark"] .topbar { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .card   { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .data-table tbody tr:hover td { background: #1a2744; }
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select {
  background: var(--bg); border-color: var(--border); color: var(--text-1);
}
[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus { background: #1a2744; }
[data-theme="dark"] .modal        { background: var(--surface); }
[data-theme="dark"] .modal-close  { background: var(--bg-2); color: var(--text-3); }
[data-theme="dark"] .modal-close:hover { background: #4c0519; color: var(--expense-color); }
[data-theme="dark"] .budget-card-ok   { background: #052e16; border-color: #064e3b; }
[data-theme="dark"] .budget-card-warn { background: #1c1008; border-color: #422006; }
[data-theme="dark"] .budget-card-over { background: #1f0a10; border-color: #4c0519; }
[data-theme="dark"] .budget-card-neutral { background: var(--bg); }
[data-theme="dark"] .bis-item    { background: var(--bg); border-color: var(--border); }
[data-theme="dark"] .bw-item     { background: var(--bg); border-color: var(--border); }
[data-theme="dark"] .cat-card    { background: var(--bg); border-color: var(--border); }
[data-theme="dark"] .dw-item     { background: var(--bg); border-color: var(--border); }
[data-theme="dark"] .networth-bar{ background: var(--bg-2); border-color: var(--border); }
[data-theme="dark"] .pg-btn      { background: var(--surface); border-color: var(--border); color: var(--text-2); }
[data-theme="dark"] .history-search,
[data-theme="dark"] .filter-bar select,
[data-theme="dark"] .filter-row select,
[data-theme="dark"] .date-range input[type="date"] {
  background: var(--surface); border-color: var(--border); color: var(--text-1);
}
[data-theme="dark"] .notif-warn   { background: #1c1008; border-color: #422006; color: #fde68a; }
[data-theme="dark"] .notif-danger { background: #1f0a10; border-color: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .month-selector { background: var(--bg); border-color: var(--border); }
[data-theme="dark"] .unmapped-pool { background: var(--bg); border-color: var(--border); }
[data-theme="dark"] .expense-summary-bar { background: var(--bg); border-color: var(--border); }
[data-theme="dark"] #monthlyNote { background: var(--bg); color: var(--text-1); border-color: var(--border); }
[data-theme="dark"] .cicilan-row { background: #1c1008; border-color: #422006; }
[data-theme="dark"] .cicilan-row-paid   { background: #052e16; border-color: #064e3b; }
[data-theme="dark"] .cicilan-row-future { background: var(--bg); border-color: var(--border); }
[data-theme="dark"] .cicilan-note { background: #1c1008; border-color: #422006; color: #fde68a; }
[data-theme="dark"] .cicilan-summary { background: var(--bg-2); }
[data-theme="dark"] .confirm-modal { background: var(--surface); }
[data-theme="dark"] .legend-excellent { background: #052e16; }
[data-theme="dark"] .legend-good      { background: #064e3b; }
[data-theme="dark"] .legend-fair      { background: #1c1008; }
[data-theme="dark"] .legend-warn      { background: #431407; }
[data-theme="dark"] .legend-critical  { background: #1f0a10; }
[data-theme="dark"] .search-modal { background: var(--surface); }
[data-theme="dark"] .search-input { background: var(--surface); color: var(--text-1); }
[data-theme="dark"] .search-result-item:hover { background: var(--bg); }
[data-theme="dark"] .goal-card { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .goal-progress-bg { background: var(--border); }
[data-theme="dark"] .settings-row { border-color: var(--border); }
[data-theme="dark"] .custom-cat-chip { background: var(--bg); border-color: var(--border); }
[data-theme="dark"] #trendCategorySelect { background: var(--surface); color: var(--text-1); border-color: var(--border); }
[data-theme="dark"] #annualReportYear   { background: var(--surface); color: var(--text-1); border-color: var(--border); }

/* ── Goals Section ───────────────────────────────────────────────────────────── */
.goals-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px; margin-top: 4px;
}
.goals-grid:empty::after {
  content: 'Belum ada target tabungan. Tambahkan goal di atas.';
  display: block; color: var(--text-3); font-style: italic;
  font-size: 13px; padding: 24px 0;
}
.goal-card {
  border: 1.5px solid var(--border); border-radius: 14px; padding: 18px;
  background: var(--surface); display: flex; flex-direction: column; gap: 12px;
  transition: box-shadow var(--transition), transform var(--transition);
  position: relative;
}
.goal-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.goal-card-done { border-color: var(--income-color); background: #f0fdf4; }
[data-theme="dark"] .goal-card-done { background: #052e16; border-color: var(--income-color); }
.goal-header { display: flex; align-items: flex-start; gap: 10px; }
.goal-icon   { font-size: 26px; line-height: 1; flex-shrink: 0; }
.goal-info   { flex: 1; min-width: 0; }
.goal-name   { font-size: 14px; font-weight: 700; color: var(--text-1); line-height: 1.3; word-break: break-word; }
.goal-date   { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.goal-amounts { display: flex; justify-content: space-between; font-size: 13px; }
.goal-current { font-weight: 700; font-size: 15px; color: var(--primary); }
.goal-target  { color: var(--text-3); font-size: 12.5px; }
.goal-progress-wrap { display: flex; align-items: center; gap: 8px; }
.goal-progress-bg  { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.goal-progress-fill { height: 100%; border-radius: 4px; transition: width .5s cubic-bezier(.4,0,.2,1); }
.goal-pct  { font-size: 12px; font-weight: 700; color: var(--text-2); min-width: 34px; text-align: right; }
.goal-note { font-size: 12px; color: var(--text-3); font-style: italic; line-height: 1.4; }
.goal-actions { display: flex; gap: 6px; justify-content: flex-end; }
.goal-deadline-warn { font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: #fff7ed; color: #c2410c; font-weight: 500; }
[data-theme="dark"] .goal-deadline-warn { background: #431407; color: #fb923c; }
.goal-txs { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.goal-txs-label { font-size: 11.5px; font-weight: 600; color: var(--text-3); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.goal-tx-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.goal-tx-date { color: var(--text-3); min-width: 72px; flex-shrink: 0; }
.goal-tx-desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-tx-amt  { font-weight: 600; color: var(--income-color); flex-shrink: 0; }
.goal-txs-empty { font-size: 12px; color: var(--text-3); text-align: center; padding: 8px 0; border-top: 1px dashed var(--border); }

/* ── Global Search Modal ─────────────────────────────────────────────────────── */
.search-modal { border-radius: var(--radius); overflow: hidden; padding: 0 !important; }
.search-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.search-input {
  flex: 1; border: none; outline: none; font-size: 15px;
  font-family: inherit; background: transparent; color: var(--text-1);
}
.search-input::placeholder { color: var(--text-3); }
.search-results {
  overflow-y: auto; max-height: 440px; padding: 8px;
}
.search-results:empty::after {
  content: 'Ketik minimal 2 karakter untuk mencari...';
  display: block; color: var(--text-3); font-style: italic; font-size: 13px;
  text-align: center; padding: 28px;
}
.search-empty {
  text-align: center; color: var(--text-3); font-style: italic;
  padding: 32px; font-size: 13px;
}
.search-group-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-3); padding: 8px 10px 4px;
}
.search-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  transition: background var(--transition-fast);
}
.search-result-item:hover { background: var(--bg); }
.search-result-icon { font-size: 17px; min-width: 26px; text-align: center; flex-shrink: 0; }
.search-result-main { flex: 1; min-width: 0; }
.search-result-title { font-size: 13.5px; font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-sub   { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.search-result-amount { font-size: 13px; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
mark { background: #fef08a; border-radius: 2px; padding: 0 1px; }
[data-theme="dark"] mark { background: #713f12; color: #fef08a; }

/* ── Settings Section ────────────────────────────────────────────────────────── */
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-label { font-size: 14px; font-weight: 600; color: var(--text-1); }
.settings-desc  { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.custom-cats-list { display: flex; flex-wrap: wrap; gap: 8px; }
.custom-cat-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 500;
}
.custom-cat-chip button {
  background: none; border: none; cursor: pointer; color: var(--text-3);
  font-size: 13px; padding: 0; line-height: 1;
  transition: color var(--transition-fast);
}
.custom-cat-chip button:hover { color: var(--expense-color); }
.default-cat-tag {
  display: inline-flex; align-items: center;
  background: var(--primary-light); border: 1.5px solid var(--border);
  border-radius: 999px; padding: 4px 11px; font-size: 12.5px; color: var(--text-2);
  font-weight: 500; margin: 3px;
}

/* ── Annual Report ───────────────────────────────────────────────────────────── */
.annual-summary-bar {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px;
}
.annual-stat {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 14px 16px; text-align: center;
}
.annual-stat-val { font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.annual-stat-lbl { font-size: 11.5px; color: var(--text-3); margin-top: 4px; font-weight: 500; }
[data-theme="dark"] .annual-stat { background: var(--bg-2); }

/* ── @media print ────────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .nav, .modal-overlay, .toast, .btn-primary,
  .btn-secondary, .btn-text, .btn-edit, .btn-delete, .btn-danger,
  .pagination, .filter-bar, .filter-row, .form-grid, .card:not(.print-include) { display: none !important; }
  body { background: #fff !important; }
  .main { margin-left: 0 !important; }
  .section { display: none !important; }
  #printTarget { display: block !important; }
}

#printTarget {
  display: none;
  font-family: 'Inter', sans-serif; font-size: 13px; color: #0f172a;
}
.print-header {
  text-align: center; border-bottom: 2px solid #e2e8f0;
  padding-bottom: 16px; margin-bottom: 20px;
}
.print-header h1 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.print-header p  { font-size: 13px; color: #64748b; }
.print-stats { display: flex; gap: 0; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; margin-bottom: 20px; }
.print-stat { flex: 1; padding: 12px 16px; text-align: center; border-right: 1px solid #e2e8f0; }
.print-stat:last-child { border-right: none; }
.print-stat-val { font-size: 16px; font-weight: 800; }
.print-stat-lbl { font-size: 11px; color: #64748b; margin-top: 3px; }
.print-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 12px; }
.print-table th { background: #f1f5f9; padding: 8px 12px; text-align: left; font-weight: 700; border-bottom: 2px solid #e2e8f0; }
.print-table td { padding: 8px 12px; border-bottom: 1px solid #e2e8f0; }
.print-section-title { font-size: 14px; font-weight: 700; margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px solid #e2e8f0; }

/* ════════════════════════════════════════════════════════════════════════════
   INTERACTIVE ENHANCEMENTS — motion & micro-interactions, no feature changes
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Custom scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Dark/light mode body transition ─────────────────────────────────────── */
body {
  transition: background 0.3s ease, color 0.3s ease;
}

/* ── Section entrance: stagger direct children in ─────────────────────────── */
@keyframes section-child-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section.active > * {
  animation: section-child-in 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.section.active > *:nth-child(1)  { animation-delay: 0.00s; }
.section.active > *:nth-child(2)  { animation-delay: 0.05s; }
.section.active > *:nth-child(3)  { animation-delay: 0.09s; }
.section.active > *:nth-child(4)  { animation-delay: 0.13s; }
.section.active > *:nth-child(5)  { animation-delay: 0.16s; }
.section.active > *:nth-child(6)  { animation-delay: 0.18s; }
.section.active > *:nth-child(7)  { animation-delay: 0.20s; }
.section.active > *:nth-child(8)  { animation-delay: 0.22s; }
.section.active > *:nth-child(9)  { animation-delay: 0.24s; }
.section.active > *:nth-child(10) { animation-delay: 0.25s; }

/* ── Card surface: border glow on hover, no lift (inner items have own lift) */
.card {
  transition: box-shadow var(--transition), border-color var(--transition), background var(--transition);
}
.card:hover {
  box-shadow: 0 6px 24px -4px rgba(99,102,241,0.10), var(--shadow-sm);
  border-color: rgba(99,102,241,0.22);
}
[data-theme="dark"] .card:hover {
  box-shadow: 0 6px 24px -4px rgba(129,140,248,0.14), 0 1px 3px rgba(0,0,0,.2);
  border-color: rgba(129,140,248,0.28);
}

/* ── Health banner: the single live pulse ─────────────────────────────────── */
@keyframes banner-breathe {
  0%, 100% { box-shadow: var(--shadow-md); }
  50%       { box-shadow: var(--shadow-md), 0 0 40px 6px rgba(255,255,255,0.065); }
}
.health-banner {
  animation: banner-breathe 5s ease-in-out infinite;
}
.health-circle {
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.health-banner:hover .health-circle {
  transform: scale(1.08) rotate(-4deg);
}
.hstat {
  transition: background var(--transition-fast);
  cursor: default;
}
.hstat:hover { background: rgba(255,255,255,0.06); }
.hstat-val   { transition: transform var(--transition-fast); display: inline-block; }
.hstat:hover .hstat-val { transform: scale(1.07); }

/* ── Button ripple on press ───────────────────────────────────────────────── */
.btn-primary {
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255,255,255,0.22);
  opacity: 0;
  transform: scale(0.5);
}
.btn-primary:active::after {
  opacity: 1;
  transform: scale(1.8);
  transition: opacity 0s, transform 0s;
}
.btn-primary:not(:active)::after {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

/* ── Nav icon bounce on hover ─────────────────────────────────────────────── */
.nav-icon {
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  display: inline-block;
}
.nav-item:hover .nav-icon {
  transform: scale(1.22) rotate(-6deg);
}
.nav-item.active .nav-icon {
  transform: scale(1.1);
}

/* ── Table rows: primary tint on hover ────────────────────────────────────── */
.data-table tbody tr {
  transition: background var(--transition-fast);
}
.data-table tbody tr:hover td {
  background: var(--primary-light) !important;
}
[data-theme="dark"] .data-table tbody tr:hover td {
  background: rgba(99,102,241,0.07) !important;
}

/* ── Budget widget items: add lift to existing border/shadow hover ─────────── */
.bw-item {
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.bw-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* ── Debt widget items ────────────────────────────────────────────────────── */
.dw-item {
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.dw-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

/* ── Annual stat cards ────────────────────────────────────────────────────── */
.annual-stat {
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  cursor: default;
}
.annual-stat:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

/* ── Health stats on summary ──────────────────────────────────────────────── */
.hstat-free { transition: background var(--transition-fast); cursor: default; }
.hstat-free:hover { background: rgba(255,255,255,0.06); }

/* ── Search results ───────────────────────────────────────────────────────── */
.search-result-item {
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.search-result-item:hover {
  transform: translateX(3px);
}

/* ── Notif items ──────────────────────────────────────────────────────────── */
.notif-item {
  transition: opacity var(--transition), transform var(--transition);
}
.notif-item:hover {
  transform: translateX(3px);
}

/* ── Toast entrance ───────────────────────────────────────────────────────── */
@keyframes toast-slide-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
.toast.show {
  animation: toast-slide-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── Modal backdrop ───────────────────────────────────────────────────────── */
.modal-overlay {
  transition: background 0.2s ease;
}

/* ── Month selector: arrow hover ─────────────────────────────────────────── */
#prevMonth, #nextMonth {
  transition: background var(--transition), transform 0.15s ease;
}
#prevMonth:hover { transform: translateX(-2px); }
#nextMonth:hover { transform: translateX(2px); }

/* ── Sidebar logo hover ───────────────────────────────────────────────────── */
.logo-icon {
  transition: background var(--transition), transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.sidebar-header:hover .logo-icon {
  background: rgba(255,255,255,0.18);
  transform: rotate(-5deg) scale(1.08);
}

/* ── Category breakdown bar fill ─────────────────────────────────────────── */
.cat-card {
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.cat-card:hover .cat-bar-fill {
  filter: brightness(1.12) saturate(1.1);
}

/* ── Bis-item (income summary boxes) ─────────────────────────────────────── */
.bis-item {
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.bis-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

/* ── Settings chip hover ──────────────────────────────────────────────────── */
.custom-cat-chip {
  transition: border-color var(--transition), box-shadow var(--transition);
}
.custom-cat-chip:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ── Topbar sticky blur ───────────────────────────────────────────────────── */
.topbar {
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.92);
  transition: box-shadow var(--transition), background var(--transition);
}
[data-theme="dark"] .topbar {
  background: rgba(30,41,59,0.92);
}

/* ── Reduced motion: respect system preference ────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .section.active > * {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .health-banner {
    animation: none !important;
  }
  .toast.show {
    animation: none !important;
  }
  .bw-item:hover,
  .dw-item:hover,
  .annual-stat:hover,
  .bis-item:hover,
  .cat-card:hover,
  .search-result-item:hover,
  .notif-item:hover {
    transform: none !important;
  }
  .nav-item:hover .nav-icon,
  .nav-item.active .nav-icon,
  .sidebar-header:hover .logo-icon {
    transform: none !important;
  }
  #prevMonth:hover,
  #nextMonth:hover { transform: none !important; }
}

/* ── Di luar budget feature ───────────────────────────────────────────────── */
.oob-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
  user-select: none;
  margin-top: 2px;
}
.oob-checkbox-label:hover { color: var(--text); }
.oob-checkbox-box {
  width: 16px;
  height: 16px;
  accent-color: var(--danger, #ef4444);
  cursor: pointer;
  flex-shrink: 0;
}
.oob-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: #fef2f2;
  color: #ef4444;
  border: 1px solid #fecaca;
  vertical-align: middle;
  line-height: 1.5;
  white-space: nowrap;
}
[data-theme="dark"] .oob-badge {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.3);
}
.row-oob td:first-child {
  border-left: 3px solid #ef4444;
}
.filter-oob-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  white-space: nowrap;
}
.filter-oob-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: #fef2f2;
}
.filter-oob-btn.active {
  border-color: #ef4444;
  background: #fef2f2;
  color: #ef4444;
}
[data-theme="dark"] .filter-oob-btn:hover,
[data-theme="dark"] .filter-oob-btn.active {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.5);
  color: #f87171;
}

/* ── Snapshot & Rollback ──────────────────────────────────────────────────── */
.snapshot-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  transition: border-color var(--transition);
}
.snapshot-card:hover { border-color: var(--primary); }
.snapshot-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.snapshot-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}
.snapshot-time {
  font-size: 0.8rem;
  color: var(--primary);
}
.snapshot-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.snapshot-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.btn-restore {
  padding: 6px 14px;
  border-radius: 7px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition);
}
.btn-restore:hover { opacity: 0.85; }
.btn-del-snap {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-del-snap:hover {
  border-color: var(--danger, #ef4444);
  color: var(--danger, #ef4444);
}

/* ── Dana Bebas carryover label ───────────────────────────────────────────── */
.hstat-carry {
  font-size: 0.7rem;
  font-weight: 600;
  color: #86efac;
  margin-top: 2px;
  opacity: 0.85;
  white-space: nowrap;
}
