/* ════════════════════════════════════════════════════════════
   Rekap Keuangan — style.css
   ════════════════════════════════════════════════════════════ */

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

:root {
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface2: #f2f2f7;
  --grouped: #ffffff;
  --sep: rgba(60,60,67,0.12);
  --sep-strong: rgba(60,60,67,0.18);
  --label: rgba(60,60,67,1);
  --label2: rgba(60,60,67,0.6);
  --label3: rgba(60,60,67,0.3);
  --label4: rgba(60,60,67,0.18);
  --fill: rgba(120,120,128,0.12);
  --fill2: rgba(120,120,128,0.08);

  --blue: #007aff;
  --blue-bg: rgba(0,122,255,0.1);
  --green: #34c759;
  --green-bg: rgba(52,199,89,0.1);
  --red: #ff3b30;
  --red-bg: rgba(255,59,48,0.1);
  --orange: #ff9500;
  --orange-bg: rgba(255,149,0,0.1);
  --teal: #32ade6;
  --teal-bg: rgba(50,173,230,0.1);
  --indigo: #5856d6;
  --indigo-bg: rgba(88,86,214,0.1);
  --gray: rgba(142,142,147,1);
  --gray-bg: rgba(142,142,147,0.1);

  --radius-sm: 10px;
  --radius: 13px;
  --radius-lg: 18px;
  --radius-xl: 22px;

  --font: -apple-system, 'SF Pro Text', 'SF Pro Display', 'Helvetica Neue', Inter, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface2: #2c2c2e;
    --grouped: #1c1c1e;
    --sep: rgba(84,84,88,0.65);
    --sep-strong: rgba(84,84,88,0.85);
    --label: rgba(255,255,255,1);
    --label2: rgba(235,235,245,0.6);
    --label3: rgba(235,235,245,0.3);
    --label4: rgba(235,235,245,0.18);
    --fill: rgba(120,120,128,0.36);
    --fill2: rgba(120,120,128,0.24);
    --blue-bg: rgba(0,122,255,0.18);
    --green-bg: rgba(52,199,89,0.18);
    --red-bg: rgba(255,59,48,0.18);
    --orange-bg: rgba(255,149,0,0.18);
    --teal-bg: rgba(50,173,230,0.18);
    --indigo-bg: rgba(88,86,214,0.18);
    --gray-bg: rgba(142,142,147,0.18);
  }
}

html { -webkit-font-smoothing: antialiased; }

body {
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  min-height: 100vh;
  padding: 0 0 80px;
}

/* ─── LOADING / ERROR STATES ─── */
#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 200;
}
#loading-screen.hidden { display: none; }

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--fill);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text { font-size: 14px; color: var(--label2); }

#error-banner {
  background: var(--red-bg);
  color: var(--red);
  font-size: 13px;
  padding: 12px 20px;
  text-align: center;
  display: none;
}
#error-banner.visible { display: block; }

/* ─── NAVIGATION BAR ─── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: rgba(242,242,247,0.8);
  border-bottom: 0.5px solid var(--sep);
  padding: 12px 20px 10px;
}
@media (prefers-color-scheme: dark) {
  .navbar { background: rgba(0,0,0,0.8); }
}
.navbar-inner {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-eyebrow { font-size: 11px; font-weight: 400; color: var(--label3); letter-spacing: .01em; margin-bottom: 1px; }
.nav-title { font-size: 17px; font-weight: 600; letter-spacing: -.022em; color: var(--label); }
.nav-right { text-align: right; }
.nav-acct { font-size: 12px; font-weight: 500; color: var(--label2); }
.nav-rek { font-size: 11px; color: var(--label3); margin-top: 1px; }

/* ─── PAGE ─── */
.page { max-width: 780px; margin: 0 auto; padding: 24px 20px 0; }

/* ─── SECTION HEADER ─── */
.sec-header { font-size: 13px; font-weight: 400; color: var(--label2); text-transform: uppercase; letter-spacing: .025em; padding: 0 4px 7px; }

/* ─── KPI ROW ─── */
.kpi-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 32px; }
.kpi {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px 18px 18px;
  position: relative;
  overflow: hidden;
}
.kpi-label { font-size: 13px; font-weight: 400; color: var(--label2); margin-bottom: 6px; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -.035em; line-height: 1; }
.kpi-sub { font-size: 12px; color: var(--label3); margin-top: 5px; font-weight: 400; }
.kpi.green .kpi-value { color: var(--green); }
.kpi.red .kpi-value { color: var(--red); }
.kpi.blue .kpi-value { color: var(--blue); }
.kpi.orange .kpi-value { color: var(--orange); }
.kpi-icon {
  position: absolute;
  top: 14px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

/* ─── CARD ─── */
.card { background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 10px; }

/* ─── INSET GROUPED ─── */
.group { margin-bottom: 32px; }

/* ─── CARD HEADER ─── */
.card-hd {
  padding: 14px 18px 12px;
  border-bottom: 0.5px solid var(--sep);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.card-hd-title { font-size: 13px; font-weight: 600; color: var(--label); text-transform: uppercase; letter-spacing: .025em; }
.card-hd-badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--label2);
  background: var(--fill);
  padding: 2px 8px;
  border-radius: 20px;
}

/* ─── SALDO FLOW ─── */
.saldo-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 0.5px solid var(--sep);
}
.saldo-row:last-child { border-bottom: none; }
.saldo-row.total {
  background: var(--fill2);
  padding-top: 14px; padding-bottom: 14px;
}
.saldo-lbl { font-size: 15px; color: var(--label2); font-weight: 400; }
.saldo-lbl.primary { color: var(--label); font-weight: 500; }
.saldo-val { font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
.saldo-val.g { color: var(--green); }
.saldo-val.r { color: var(--red); }
.saldo-val.b { color: var(--blue); }
.saldo-val.n { color: var(--label); }

/* ─── CAT BARS ─── */
.cat-row { padding: 12px 18px; border-bottom: 0.5px solid var(--sep); }
.cat-row:last-child { border-bottom: none; }
.cat-meta { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.cat-name { font-size: 14px; color: var(--label); font-weight: 400; }
.cat-right { display: flex; align-items: baseline; gap: 6px; }
.cat-amt { font-size: 14px; font-weight: 500; color: var(--label); font-variant-numeric: tabular-nums; }
.cat-pct { font-size: 12px; color: var(--label3); }
.bar-track { height: 5px; background: var(--fill); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; transition: width 1s cubic-bezier(.16,1,.3,1); }

/* ─── KPR ROWS ─── */
.kpr-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 0.5px solid var(--sep);
  gap: 12px;
}
.kpr-row:last-child { border-bottom: none; }
.kpr-left { flex: 1; }
.kpr-name { font-size: 15px; color: var(--label); font-weight: 400; margin-bottom: 2px; }
.kpr-sub { font-size: 12px; color: var(--label3); }
.kpr-right { text-align: right; }
.kpr-amt { font-size: 15px; font-weight: 500; color: var(--red); font-variant-numeric: tabular-nums; }
.kpr-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 5px;
  margin-left: 5px;
  vertical-align: middle;
}
.tag-blue { background: var(--blue-bg); color: var(--blue); }
.tag-teal { background: var(--teal-bg); color: var(--teal); }
.kpr-total {
  display: flex;
  justify-content: space-between;
  padding: 13px 18px;
  background: var(--fill2);
}
.kpr-total-lbl { font-size: 15px; font-weight: 600; color: var(--label); }
.kpr-total-val { font-size: 15px; font-weight: 600; color: var(--red); font-variant-numeric: tabular-nums; }

/* ─── PROPORSI ─── */
.prop-row { padding: 10px 18px; border-bottom: 0.5px solid var(--sep); }
.prop-row:last-child { border-bottom: none; }
.prop-meta { display: flex; justify-content: space-between; margin-bottom: 6px; }
.prop-lbl { font-size: 14px; color: var(--label2); }
.prop-pct { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.prop-footer {
  padding: 13px 18px;
  background: var(--fill2);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.prop-footer-lbl { font-size: 13px; color: var(--label2); }
.prop-footer-val { font-size: 22px; font-weight: 700; letter-spacing: -.03em; color: var(--red); }

/* ─── FILTER PILLS ─── */
.filter-scroll {
  padding: 10px 18px 12px;
  border-bottom: 0.5px solid var(--sep);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.f-pill {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--fill);
  color: var(--label2);
  border: none;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.f-pill:hover { background: var(--fill2); }
.f-pill.active { background: var(--blue); color: #fff; }

/* ─── TX TABLE ─── */
.tx-wrap { overflow-x: auto; }
table.tx { width: 100%; border-collapse: collapse; }
table.tx thead th {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--label3);
  text-align: left;
  padding: 8px 18px;
  border-bottom: 0.5px solid var(--sep);
  white-space: nowrap;
  background: var(--fill2);
}
table.tx thead th:last-child { text-align: right; }
table.tx tbody tr { border-bottom: 0.5px solid var(--sep); transition: background .1s; }
table.tx tbody tr:last-child { border-bottom: none; }
table.tx tbody tr:hover { background: var(--fill2); }
table.tx td { padding: 11px 18px; vertical-align: top; }
.tx-date { font-size: 13px; color: var(--label3); white-space: nowrap; width: 48px; font-variant-numeric: tabular-nums; }
.tx-desc-main { font-size: 14px; color: var(--label); }
.tx-desc-sub { font-size: 12px; color: var(--label3); margin-top: 2px; }
.tx-cat { white-space: nowrap; }
.cat-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
}
.chip-kpr     { background: var(--blue-bg);   color: var(--blue);   }
.chip-rumah   { background: var(--teal-bg);   color: var(--teal);   }
.chip-cc      { background: var(--red-bg);    color: var(--red);    }
.chip-ecom    { background: var(--indigo-bg); color: var(--indigo); }
.chip-pribadi { background: var(--orange-bg); color: var(--orange); }
.chip-qr      { background: var(--green-bg);  color: var(--green);  }
.chip-lain    { background: var(--gray-bg);   color: var(--gray);   }
.tx-amt {
  font-size: 14px;
  font-weight: 500;
  color: var(--red);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tx-count {
  font-size: 12px;
  color: var(--label3);
  text-align: center;
  padding: 12px;
  border-top: 0.5px solid var(--sep);
}

/* ─── CYCLE PICKER ─── */
.cycle-select-wrap { padding: 12px 18px; border-bottom: 0.5px solid var(--sep); }
.cycle-label { display:block; font-size: 12px; color: var(--label3); margin-bottom: 6px; }
.cycle-select {
  width: 100%;
  border: 0.5px solid var(--sep);
  background: var(--surface2);
  color: var(--label);
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  outline: none;
}

/* ─── NOTE ─── */
.note {
  font-size: 13px;
  color: var(--label3);
  padding: 0 4px;
  margin-top: 8px;
  line-height: 1.55;
}

/* ─── ANIMATIONS ─── */
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.kpi { animation: fadeSlide .45s ease both; }
.kpi:nth-child(1){ animation-delay:.04s }
.kpi:nth-child(2){ animation-delay:.08s }
.kpi:nth-child(3){ animation-delay:.12s }
.kpi:nth-child(4){ animation-delay:.16s }
.kpi:nth-child(5){ animation-delay:.20s }
.group { animation: fadeSlide .5s ease both; animation-delay: .2s; }

/* ─── TIER 1: KPI DELTA BADGES ─── */
.kpi-delta {
  font-size: 11px;
  font-weight: 500;
  margin-top: 6px;
  letter-spacing: .01em;
}
.delta-good    { color: var(--green); }
.delta-bad     { color: var(--red); }
.delta-neutral { color: var(--label3); }

/* ─── TIER 1: SAVINGS RATE — 5th KPI full-width ─── */
.kpi-wide {
  grid-column: 1 / -1;
}
.sr-track {
  height: 6px;
  background: var(--fill);
  border-radius: 4px;
  overflow: hidden;
}
.sr-fill {
  height: 100%;
  border-radius: 4px;
  width: 0%;
  transition: width 1s cubic-bezier(.16,1,.3,1);
}

/* ─── TIER 1: CATEGORY SUB-DESCRIPTION DRILL-DOWN ─── */
.cat-row {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cat-row:hover .cat-meta { opacity: .85; }

.cat-toggle {
  font-size: 14px;
  color: var(--label3);
  font-weight: 500;
  margin-left: 4px;
  display: inline-block;
  transition: transform .2s ease;
  line-height: 1;
}

.sub-drill {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s cubic-bezier(.16,1,.3,1);
}
.sub-drill.open {
  max-height: 600px;   /* generous ceiling — animates down from open */
}
.sub-drill.open > .sub-row:first-child {
  border-top: 0.5px solid var(--sep);
  margin-top: 6px;
}
.sub-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0 6px 8px;
  border-bottom: 0.5px solid var(--sep);
  min-height: 0; /* required for grid 0fr trick */
}
.sub-row:last-child { border-bottom: none; }
.sub-name {
  font-size: 13px;
  color: var(--label2);
  flex: 1;
  padding-right: 12px;
}
.sub-amt {
  font-size: 13px;
  font-weight: 500;
  color: var(--label);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ─── TIER 1: FILTER PILL AMOUNTS ─── */
.pill-amt {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.7;
  margin-left: 5px;
}
.f-pill.active .pill-amt {
  opacity: 0.85;
}

/* ─── TIER 2: PER-CATEGORY DELTA BADGE ─── */
.cat-delta {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: .01em;
}
.cat-delta-good {
  background: var(--green-bg);
  color: var(--green);
}
.cat-delta-bad {
  background: var(--red-bg);
  color: var(--red);
}

/* ─── TIER 2: TOP 5 TRANSACTIONS ─── */
.top-tx-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 0.5px solid var(--sep);
}
.top-tx-row:last-child { border-bottom: none; }
.top-tx-rank {
  font-size: 13px;
  font-weight: 700;
  color: var(--label3);
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.top-tx-row:first-child .top-tx-rank { color: var(--orange); }
.top-tx-body {
  flex: 1;
  min-width: 0;
}
.top-tx-desc {
  font-size: 14px;
  color: var(--label);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-tx-meta {
  font-size: 12px;
  color: var(--label3);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.top-tx-amt {
  font-size: 14px;
  font-weight: 600;
  color: var(--red);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── TIER 3: TREND CHART ─── */
#trend-card {
  padding: 8px 4px 4px;  /* SVG fills the card edge-to-edge */
  overflow: hidden;
}

/* ─── TIER 3: SMART INSIGHTS ─── */
.insight-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 0.5px solid var(--sep);
}
.insight-row:last-child { border-bottom: none; }

.insight-icon {
  font-size: 14px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  margin-top: 1px;
  line-height: 1.4;
}
.insight-text {
  font-size: 14px;
  color: var(--label2);
  line-height: 1.5;
  flex: 1;
}
.insight-text strong {
  font-weight: 600;
  color: var(--label);
}

/* type-specific left accent */
.insight-good  { border-left: 3px solid var(--green);  padding-left: 15px; }
.insight-bad   { border-left: 3px solid var(--red);    padding-left: 15px; }
.insight-neutral { border-left: 3px solid var(--sep-strong); padding-left: 15px; }

.insight-good  .insight-icon { color: var(--green);  }
.insight-bad   .insight-icon { color: var(--red);    }
.insight-neutral .insight-icon { color: var(--label3); }

/* ─── TIER 2: TRANSACTION SEARCH ─── */
.tx-search-wrap {
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--sep);
}
.tx-search {
  width: 100%;
  border: 0.5px solid var(--sep);
  background: var(--fill2);
  color: var(--label);
  border-radius: 10px;
  padding: 9px 14px;
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, background .15s;
  -webkit-appearance: none;
}
.tx-search:focus {
  border-color: var(--blue);
  background: var(--surface);
}
.tx-search::placeholder { color: var(--label3); }
/* hide native clear button on WebKit — we keep it for UX but style the field */
.tx-search::-webkit-search-cancel-button { opacity: 0.5; }

/* ════════════════════════════════════════════════════════════
   V2 — HELICOPTER VIEW (Pendapatan / Pengeluaran / Tabungan / Investasi)
   ════════════════════════════════════════════════════════════ */
.heli-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.heli {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px 18px 18px;
  position: relative;
  overflow: hidden;
  animation: fadeSlide .45s ease both;
}
.heli:nth-child(1){ animation-delay:.04s }
.heli:nth-child(2){ animation-delay:.08s }
.heli:nth-child(3){ animation-delay:.12s }
.heli:nth-child(4){ animation-delay:.16s }
.heli-label { font-size: 13px; font-weight: 500; color: var(--label2); margin-bottom: 6px; }
.heli-value { font-size: 26px; font-weight: 700; letter-spacing: -.035em; line-height: 1; }
.heli-sub   { font-size: 11px; color: var(--label3); margin-top: 5px; }
.heli-alloc { font-size: 11px; color: var(--label2); margin-top: 6px; font-weight: 500; }
.heli-icon {
  position: absolute;
  top: 14px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.heli.green  .heli-value { color: var(--green); }
.heli.red    .heli-value { color: var(--red); }
.heli.blue   .heli-value { color: var(--blue); }
.heli.indigo .heli-value { color: var(--indigo); }

@media (max-width: 520px) {
  .heli-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .heli { padding: 12px 14px; }
  .heli-value { font-size: 22px; }
}

/* ════════════════════════════════════════════════════════════
   V2 — PENGELUARAN PER BUCKET (group rows)
   ════════════════════════════════════════════════════════════ */
.grp-row {
  padding: 13px 18px;
  border-bottom: 0.5px solid var(--sep);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.grp-row:last-child { border-bottom: none; }
.grp-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.grp-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--label);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.grp-emoji { font-size: 14px; }
.grp-right { display: flex; align-items: baseline; gap: 6px; }
.grp-amt { font-size: 14px; font-weight: 600; color: var(--label); font-variant-numeric: tabular-nums; }
.grp-pct { font-size: 12px; color: var(--label3); }
.grp-toggle {
  font-size: 14px;
  color: var(--label3);
  font-weight: 500;
  margin-left: 4px;
  transition: transform .2s ease;
  line-height: 1;
}
.grp-drill {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s cubic-bezier(.16,1,.3,1);
  padding-left: 8px;
}
.grp-drill.open { max-height: 600px; padding-top: 10px; }
.grp-cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 13px;
}
.grp-cat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.grp-cat-name { color: var(--label2); flex: 1; }
.grp-cat-amt { color: var(--label); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ════════════════════════════════════════════════════════════
   V2 — SECTION HEADER WITH ACTION BUTTON
   ════════════════════════════════════════════════════════════ */
.sec-header-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 4px;
}
.add-btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-bg);
  border: none;
  border-radius: 14px;
  padding: 5px 12px;
  cursor: pointer;
  transition: opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.add-btn:hover { opacity: .8; }
.add-btn:active { transform: scale(.97); }

/* ════════════════════════════════════════════════════════════
   V2 — TX TABLE: action buttons + type chips
   ════════════════════════════════════════════════════════════ */
.tx-actions {
  text-align: right;
  white-space: nowrap;
  padding-right: 14px !important;
}
.tx-btn {
  background: var(--fill);
  color: var(--label2);
  border: none;
  border-radius: 6px;
  padding: 3px 8px;
  margin-left: 3px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.2;
  transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.tx-btn:hover { background: var(--fill2); color: var(--label); }
.tx-edit:hover { color: var(--blue); }
.tx-del:hover  { color: var(--red); }

.type-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: .02em;
}
.type-tabungan  { background: var(--blue-bg);   color: var(--blue);   }
.type-investasi { background: var(--indigo-bg); color: var(--indigo); }
.type-pengeluaran { display: none; } /* default — no chip */

/* ════════════════════════════════════════════════════════════
   V2 — TX TOOLBAR (search + type filter)
   ════════════════════════════════════════════════════════════ */
.tx-toolbar {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--sep);
}
.tx-toolbar .tx-search {
  flex: 1;
  margin: 0;
}
.tx-toolbar { padding-bottom: 10px; padding-top: 10px; }
/* override the original .tx-search-wrap padding since we now use toolbar */
.tx-type-filter {
  border: 0.5px solid var(--sep);
  background: var(--surface2);
  color: var(--label);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
  max-width: 165px;
}

/* ════════════════════════════════════════════════════════════
   V2 — INCOME LIST
   ════════════════════════════════════════════════════════════ */
.inc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 0.5px solid var(--sep);
}
.inc-row:last-child { border-bottom: none; }
.inc-left { flex: 1; min-width: 0; }
.inc-label { font-size: 14px; color: var(--label); font-weight: 500; }
.inc-date  { font-size: 12px; color: var(--label3); margin-top: 2px; }
.inc-amt   { font-size: 15px; font-weight: 600; color: var(--green); font-variant-numeric: tabular-nums; }
.inc-actions { display: flex; flex-shrink: 0; }
.inc-actions .tx-btn { margin-left: 4px; }
.inc-empty {
  padding: 24px;
  text-align: center;
  color: var(--label3);
  font-size: 13px;
}

/* ════════════════════════════════════════════════════════════
   V2 — MODAL
   ════════════════════════════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal.open { display: flex; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
}
.modal-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  animation: slideUp .25s cubic-bezier(.16,1,.3,1);
}
@media (min-width: 600px) {
  .modal { align-items: center; }
  .modal-card { border-radius: var(--radius-xl); margin: 20px; }
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px 12px;
  border-bottom: 0.5px solid var(--sep);
}
.modal-header h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--label);
}
.modal-close {
  background: var(--fill);
  border: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  color: var(--label2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.modal-close:hover { background: var(--fill2); color: var(--label); }

.modal-form {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1.2fr; gap: 12px; }
.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--label2);
  letter-spacing: .01em;
}
.field input, .field select {
  border: 0.5px solid var(--sep);
  background: var(--surface2);
  color: var(--label);
  border-radius: 10px;
  padding: 11px 14px;
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, background .15s;
  -webkit-appearance: none;
}
.field input:focus, .field select:focus {
  border-color: var(--blue);
  background: var(--surface);
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  justify-content: flex-end;
}
.btn-primary, .btn-secondary {
  border: none;
  border-radius: 12px;
  padding: 11px 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover { opacity: .9; }
.btn-primary:disabled { opacity: .5; cursor: wait; }
.btn-secondary {
  background: var(--fill);
  color: var(--label);
}
.btn-secondary:hover { background: var(--fill2); }

/* Hide the original .tx-search-wrap when used inside .tx-toolbar */
.tx-search-wrap { display: none; }
