/* ============================================================
   TABUNGAN — style.css
   ============================================================ */

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

/* ---------- Design tokens ---------- */
:root {
  --bg:           #EEF4FF;
  --bg-soft:      #F7FAFF;
  --card:         #FFFFFF;
  --primary:      #3B6EE8;
  --primary-dark: #1A3E99;
  --primary-light:#D6E4FF;
  --navy:         #0E2240;
  --muted:        #6B82A6;
  --border:       #DDE8F8;
  --income:       #0CA882;
  --income-bg:    #E1F6F1;
  --expense:      #E8404A;
  --expense-bg:   #FDEAEB;
  --radius-lg:    20px;
  --radius-md:    14px;
  --radius-sm:    10px;
  --shadow:       0 8px 28px -10px rgba(59,110,232,0.22);
  --shadow-card:  0 2px 12px -4px rgba(14,34,64,0.08);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--navy);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,.display { font-family: 'Sora', sans-serif; }

/* ---------- Layout wrapper ---------- */
.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 26px 20px 80px;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #7AABFF);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  box-shadow: var(--shadow);
}
.brand-text h1 { font-size: 18px; margin: 0; font-weight: 700; letter-spacing: -0.02em; }
.brand-text p  { margin: 0; font-size: 12px; color: var(--muted); font-weight: 500; }
.topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  border: none; cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-weight: 600; font-size: 14px;
  border-radius: 999px; padding: 10px 18px;
  display: inline-flex; align-items: center; gap: 7px;
  transition: transform .14s, box-shadow .14s, background .14s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 6px 18px -5px rgba(59,110,232,0.5);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost {
  background: var(--card); color: var(--primary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-soft); }
.btn-danger {
  background: var(--expense); color: #fff;
  box-shadow: 0 6px 18px -5px rgba(232,64,74,0.45);
}
.btn-danger:hover { background: #C62D36; }

/* ---------- Hero balance card ---------- */
.hero {
  border-radius: 26px;
  padding: 28px 30px;
  background: linear-gradient(135deg, #152D8C 0%, #2F5BE0 55%, #6FA0FF 100%);
  color: #fff;
  box-shadow: 0 20px 44px -18px rgba(15,40,150,0.5);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255,255,255,0.07); top: -110px; right: -70px;
}
.hero::after {
  content: "";
  position: absolute; width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,0.05); bottom: -80px; left: -50px;
}
.hero-inner { position: relative; z-index: 1; }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 10px; }
.hero-label { font-size: 12px; opacity: 0.82; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; margin: 0 0 5px; }
.hero-balance { font-size: 38px; font-weight: 800; margin: 0; letter-spacing: -0.03em; font-family: 'Sora', sans-serif; }
.hero-badge {
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 9px; padding: 7px 11px;
  font-size: 11.5px; font-weight: 600;
  backdrop-filter: blur(4px);
}
.hero-stats { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.hero-stat {
  flex: 1; min-width: 140px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 14px; padding: 13px 15px;
  backdrop-filter: blur(5px);
}
.hero-stat .lbl { font-size: 11.5px; opacity: 0.85; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.hero-stat .val { font-size: 18px; font-weight: 700; margin-top: 4px; font-family: 'Sora', sans-serif; }

/* ---------- Shared card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  /* No margin-bottom here — grids control spacing */
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 10px; flex-wrap: wrap;
}
.card-head h2 { font-size: 15.5px; margin: 0; font-weight: 700; }

/* ---------- Segmented control ---------- */
.segmented {
  display: flex;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px; padding: 3px;
}
.segmented button {
  border: none; background: transparent; cursor: pointer;
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 12.5px;
  padding: 6px 13px; border-radius: 999px; color: var(--muted);
  transition: all .14s ease;
}
.segmented button.active { background: var(--primary); color: #fff; }

/* ==========================================================
   SYMMETRIC 4-CARD LAYOUT
   All card-pair rows use the SAME 2-column 50/50 grid.
   main-grid          → Kategori + Histori Transaksi
   bottom-grid         → Statistik Bulanan + Keuangan
   invest-goals-grid   → Portofolio + Tujuan Keuangan
   ========================================================== */
.main-grid,
.bottom-grid,
.invest-goals-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;   /* exactly 50 / 50 */
  gap: 18px;
  align-items: stretch;   /* both cards in a row always end at the same bottom edge */
  margin-bottom: 18px;
}
/* Cards inside grids: no extra margin so they stay flush */
.main-grid   > .card,
.bottom-grid > .card,
.invest-goals-grid > .card {
  margin-bottom: 0;
  width: 100%;         /* fill the cell completely */
  min-width: 0;        /* prevent overflow */
}
@media (max-width: 860px) {
  .main-grid,
  .bottom-grid,
  .invest-goals-grid { grid-template-columns: 1fr; }
}

/* ---------- Category boxes ---------- */
.cat-box {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px;
  margin-bottom: 9px; cursor: pointer;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.cat-box:last-child { margin-bottom: 0; }
.cat-box:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -9px rgba(59,110,232,0.32); }
.cat-box.active-filter { border-color: var(--primary); background: var(--primary-light); }

/* --- category icon: clickable, shows photo if uploaded --- */
.cat-box-icon {
  position: relative;
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0; background: #fff;
  border: 1.5px solid var(--border);
  cursor: pointer; overflow: hidden;
  transition: border-color .14s;
}
.cat-box-icon:hover { border-color: var(--primary); }
.cat-box-icon img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.icon-edit-badge {
  position: absolute; bottom: -3px; right: -3px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 50%; width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 7px; pointer-events: none;
}

.cat-box-body { flex: 1; min-width: 0; }
.cat-box-name { font-weight: 700; font-size: 13.5px; color: var(--navy); }
.cat-box-sub  { font-size: 10.5px; color: var(--muted); font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-box-sub .in  { color: var(--income); }
.cat-box-sub .out { color: var(--expense); }
.bar-track { height: 5px; border-radius: 999px; background: rgba(107,130,166,0.15); overflow: hidden; margin-top: 6px; }
.bar-fill  { height: 100%; border-radius: 999px; transition: width .5s ease; }
.cat-box-amount { font-weight: 700; font-family: 'Sora', sans-serif; font-size: 13px; flex-shrink: 0; }
.cat-del-btn {
  border: none; background: rgba(107,130,166,0.1); color: var(--muted);
  width: 22px; height: 22px; border-radius: 7px; font-size: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cat-del-btn:hover { background: var(--expense-bg); color: var(--expense); }

.empty { text-align: center; padding: 28px 10px; color: var(--muted); font-size: 13.5px; }
.empty .e-icon { font-size: 28px; margin-bottom: 8px; }

.cat-hint { font-size: 11px; color: var(--muted); margin: 0 0 10px; line-height: 1.4; }

/* Standalone filter row that sits BELOW a card-head (e.g. Keuangan's jenis/kategori
   filters), as opposed to `.filters` used inline inside a card-head. */
.filters-block { margin-bottom: 14px; }

/* Hint text directly under a modal field (e.g. harga rata-rata) — own rhythm,
   no negative-margin hacks. */
.field-hint { font-size: 11px; color: var(--muted); line-height: 1.4; margin: 6px 0 0; }

/* Reusable label style for the "add new" inputs (kategori/aset baru) */
.new-cat-label { display: block; font-size: 12px; font-weight: 600; color: var(--primary-dark); margin-bottom: 6px; }

/* Groups multiple controls in a card-head so 3+ header items (title + badge +
   button) stay tidy instead of spreading out via space-between. */
.card-head-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
select.filter-select {
  font-family: 'Inter', sans-serif;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: 9px; padding: 7px 10px;
  font-size: 12.5px; color: var(--navy); font-weight: 600;
}

/* ---------- Transaction list ---------- */
.tx-list {
  display: flex; flex-direction: column; gap: 9px;
  max-height: 340px; overflow-y: auto; padding-right: 3px; /* synced with .list-limited (Kategori) */
}
.tx-list::-webkit-scrollbar { width: 5px; }
.tx-list::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 10px; }

.tx-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px;
  border: 1px solid var(--border); border-radius: 13px;
  background: var(--bg-soft); cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.tx-item:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -9px rgba(59,110,232,0.28); }
.tx-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0; overflow: hidden;
}
.tx-icon img { width: 100%; height: 100%; object-fit: cover; }
.tx-icon.masuk  { background: var(--income-bg); }
.tx-icon.keluar { background: var(--expense-bg); }
.tx-mid { flex: 1; min-width: 0; }
.tx-mid .cat  { font-weight: 700; font-size: 13px; color: var(--navy); }
.tx-mid .note { font-size: 11.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-right { text-align: right; flex-shrink: 0; }
.tx-right .amt  { font-weight: 700; font-family: 'Sora', sans-serif; font-size: 13px; }
.tx-right .amt.masuk  { color: var(--income); }
.tx-right .amt.keluar { color: var(--expense); }
.tx-right .date { font-size: 11px; color: var(--muted); margin-top: 2px; }
.tx-del {
  border: none; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 14px; padding: 4px; border-radius: 7px; flex-shrink: 0;
}
.tx-del:hover { background: var(--expense-bg); color: var(--expense); }

/* ---------- Chart (compact) ---------- */
.chart-year-nav {
  display: flex; align-items: center; gap: 9px; margin-bottom: 10px;
}
.chart-year-nav button {
  width: 26px; height: 26px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--bg-soft);
  color: var(--primary); font-size: 13px; cursor: pointer; font-weight: 700;
}
.chart-year-nav button:hover { background: var(--primary-light); }
.chart-year-nav span { font-weight: 700; font-family: 'Sora', sans-serif; font-size: 13px; color: var(--navy); }
#chartWrap { width: 100%; }

/* ---------- Period summary (ringkasan waktu) — minimalis ---------- */
.period-card {
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--bg-soft);
  margin-bottom: 9px; overflow: hidden;
}
.period-card:last-child { margin-bottom: 0; }
.period-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px; cursor: pointer;
}
.period-title { font-weight: 700; font-size: 13.5px; color: var(--navy); }
.period-chevron { color: var(--muted); font-size: 12px; }
.period-stats { display: flex; gap: 7px; flex-wrap: wrap; padding: 0 14px 12px; }
.pstat {
  font-size: 11.5px; font-weight: 700; padding: 4px 9px; border-radius: 999px;
  font-family: 'Sora', sans-serif;
}
.pstat.in      { background: var(--income-bg); color: var(--income); }
.pstat.out     { background: var(--expense-bg); color: var(--expense); }
.pstat.balance { background: var(--primary-light); color: var(--primary-dark); }
.period-body {
  border-top: 1px solid var(--border); padding: 11px;
  display: flex; flex-direction: column; gap: 8px; background: #fff;
}

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(10,30,70,0.42);
  display: none; align-items: center; justify-content: center;
  padding: 20px; z-index: 50;
}
.overlay.show { display: flex; }
.modal {
  background: var(--card); border-radius: 22px; padding: 24px;
  width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto;
}
.modal h3 { margin: 0 0 14px; font-size: 17px; font-weight: 700; }
.modal p  { font-size: 13.5px; color: var(--muted); line-height: 1.55; margin: 0 0 16px; }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field input, .field select {
  width: 100%;
  font-family: 'Inter', sans-serif;
  border: 1px solid var(--border); border-radius: 11px;
  padding: 10px 12px; font-size: 14px;
  background: var(--bg-soft); color: var(--navy);
}
.field input:focus, .field select:focus {
  outline: 2px solid var(--primary-light); border-color: var(--primary);
}

.type-toggle { display: flex; gap: 9px; margin-bottom: 13px; }
.type-toggle button {
  flex: 1; border: 1.5px solid var(--border); background: var(--bg-soft);
  border-radius: 11px; padding: 10px; font-weight: 700; font-size: 13.5px; cursor: pointer;
  color: var(--muted); font-family: 'Inter', sans-serif; transition: all .14s ease;
}
.type-toggle button.active.masuk  { background: var(--income-bg);  border-color: var(--income);  color: var(--income); }
.type-toggle button.active.keluar { background: var(--expense-bg); border-color: var(--expense); color: var(--expense); }
.type-toggle button.active:not(.masuk):not(.keluar) { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }

.new-cat-section { background: var(--primary-light); border-radius: 13px; padding: 11px; margin: 0 0 13px; }
.new-cat-row { display: flex; gap: 7px; }
.new-cat-row input { flex: 1; }
.new-cat-row button { flex-shrink: 0; padding: 10px 13px; }

.modal-actions { display: flex; gap: 9px; margin-top: 8px; }
.modal-actions .btn { flex: 1; justify-content: center; }

/* ---------- Date field + Calendar ---------- */
.date-field {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  font-family: 'Inter', sans-serif;
  border: 1px solid var(--border); border-radius: 11px;
  padding: 10px 12px; font-size: 14px;
  background: var(--bg-soft); color: var(--navy);
  cursor: pointer; font-weight: 600;
}
.date-field:focus { outline: 2px solid var(--primary-light); border-color: var(--primary); }

.calendar-panel {
  margin-top: 9px; background: #fff;
  border: 1px solid var(--border); border-radius: 16px; padding: 13px;
  box-shadow: 0 10px 24px -12px rgba(59,110,232,0.28);
}
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.calendar-title { font-weight: 700; font-size: 14px; font-family: 'Sora', sans-serif; color: var(--navy); }
.calendar-nav-btn {
  width: 28px; height: 28px; border-radius: 8px; border: none;
  background: var(--bg-soft); color: var(--primary); font-size: 15px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.calendar-nav-btn:hover { background: var(--primary-light); }
.calendar-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center; font-size: 10.5px; font-weight: 700; color: var(--muted); margin-bottom: 5px;
}
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-day {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: 9px;
  font-size: 12.5px; font-weight: 600; color: var(--navy); cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.cal-day:hover   { background: var(--primary-light); }
.cal-day.today   { box-shadow: inset 0 0 0 1.5px var(--primary); }
.cal-day.selected { background: var(--primary); color: #fff; }
.cal-day.disabled-empty { visibility: hidden; cursor: default; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%;
  transform: translateX(-50%) translateY(18px);
  background: var(--navy); color: #fff;
  padding: 11px 18px; border-radius: 11px;
  font-size: 13px; font-weight: 600; opacity: 0;
  transition: all .24s ease; z-index: 60; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive tweaks ---------- */
@media (max-width: 480px) {
  .hero-balance { font-size: 30px; }
  .hero { padding: 22px 20px; }
  .card { padding: 16px; }
  .main-grid, .bottom-grid, .invest-goals-grid { gap: 14px; margin-bottom: 14px; }
  .wrap { padding: 18px 14px 64px; }
}
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Scrollable section + scroll ctrl buttons ---------- */
.scrollable-section {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.scroll-ctrl {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
  padding-top: 2px;
}
.scroll-btn {
  width: 28px; height: 28px;
  border: 1.5px solid var(--border);
  background: var(--bg-soft);
  border-radius: 8px;
  color: var(--primary);
  font-size: 11px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .13s, border-color .13s, transform .1s;
  flex-shrink: 0;
  line-height: 1;
}
.scroll-btn:hover  { background: var(--primary-light); border-color: var(--primary); }
.scroll-btn:active { transform: scale(0.93); }

/* make the inner lists fill remaining width */
#catBreakdown,
.tx-list,
#periodList,
#bizItemList,
#bizTxList,
.goal-grid { flex: 1; min-width: 0; }

/* list-limited: fixed height so scroll works */
.list-limited,
.goal-grid {
  max-height: 340px;
  overflow-y: auto;
  padding-right: 2px;
  align-content: flex-start;
}
.list-limited::-webkit-scrollbar,
.goal-grid::-webkit-scrollbar { width: 4px; }
.list-limited::-webkit-scrollbar-thumb,
.goal-grid::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 10px; }

/* period list inner scroll (used by Portofolio's investPeriodList — synced with
   .list-limited/.goal-grid so Portofolio ↔ Tujuan Keuangan bottoms line up) */
.period-list-inner {
  max-height: 340px;
  overflow-y: auto;
  padding-right: 2px;
}
.period-list-inner::-webkit-scrollbar { width: 4px; }
.period-list-inner::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 10px; }

/* Keuangan's periodList: kept compact via a "Lihat Semua" toggle in JS instead
   of an internal scrollbar, so its natural height matches Statistik Bulanan. */
#periodList { max-height: none; overflow-y: visible; padding-right: 0; }

/* ---------- See-all bar ---------- */
.see-all-bar {
  margin-top: 10px;
  text-align: center;
}
.see-all-btn {
  border: 1.5px solid var(--border);
  background: var(--bg-soft);
  color: var(--primary);
  border-radius: 999px;
  padding: 7px 18px;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px; font-weight: 700;
  cursor: pointer;
  transition: background .13s, border-color .13s;
}
.see-all-btn:hover { background: var(--primary-light); border-color: var(--primary); }

/* ---------- Brand logo: hover overlay, camera badge ---------- */
.brand-mark {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.brand-cam {
  position: absolute; inset: 0;
  background: rgba(10,30,70,0.45);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; opacity: 0;
  transition: opacity .16s;
  border-radius: 12px;
}
.brand-mark:hover .brand-cam { opacity: 1; }

/* ---------- Topbar extras ---------- */
.user-greeting {
  font-size: 13px; font-weight: 600;
  color: var(--muted);
  align-self: center;
}
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* ---------- 3-dot nav menu ---------- */
.menu-wrap { position: relative; }
.menu-dots-btn { font-size: 18px; font-weight: 800; padding: 8px 13px; line-height: 1; }
.menu-dropdown {
  display: none;
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 14px 32px -12px rgba(14,34,64,0.25);
  padding: 6px; min-width: 210px; z-index: 40;
}
.menu-dropdown.show { display: block; }
.menu-dropdown button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; border: none; background: transparent; cursor: pointer;
  text-align: left; padding: 9px 10px; border-radius: 9px;
  font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 600; color: var(--navy);
}
.menu-dropdown button:hover { background: var(--bg-soft); color: var(--primary); }

/* ---------- Portofolio (Keuangan Investasi) ---------- */
/* Card now lives in a 50/50 grid, so stats use a 2x2 layout by default
   to stay comfortably readable at half-page width. */
.invest-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}
.invest-toolbar .filters { margin: 0; }

/* ---- Asset tabs (small tabs, right-aligned, like other segmented controls) ---- */
.asset-tabs-scroll {
  max-width: 100%;
  overflow-x: auto;
  flex-shrink: 1;
}
.asset-tabs-scroll::-webkit-scrollbar { height: 3px; }
.asset-tabs-scroll::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 10px; }
.asset-tabs {
  flex-wrap: nowrap;
  width: max-content;
}
.asset-tabs button { flex-shrink: 0; white-space: nowrap; }
.invest-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 420px) { .invest-stats { grid-template-columns: 1fr; } }
.invest-stat {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 13px; padding: 12px 13px;
}
.invest-stat .lbl { font-size: 11px; font-weight: 600; color: var(--muted); }
.invest-stat .val { font-size: 16px; font-weight: 800; margin-top: 4px; font-family: 'Sora', sans-serif; color: var(--navy); }
.invest-stat .val.pos { color: var(--income); }
.invest-stat .val.neg { color: var(--expense); }

/* ---- Per-asset cards ---- */
.asset-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin: 12px 0 16px; }
.asset-cards:empty { margin: 0; }
.asset-card {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 13px; padding: 12px 13px; cursor: pointer; transition: border-color .14s, transform .12s;
}
.asset-card:hover { transform: translateY(-1px); border-color: var(--primary); }
.asset-card.active-asset { border-color: var(--primary); background: var(--primary-light); }
.asset-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.asset-card-icon { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: #fff; border: 1.5px solid var(--border); font-size: 14px; overflow: hidden; flex-shrink: 0; }
.asset-card-name { font-weight: 700; font-size: 13px; color: var(--navy); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-card-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 3px; }
.asset-card-row span:last-child { color: var(--navy); font-weight: 700; }
.asset-card-pct { font-weight: 800; }
.asset-card-pct.pos { color: var(--income); }
.asset-card-pct.neg { color: var(--expense); }

/* ---------- Pengelolaan Bisnis ---------- */
.biz-grid { display: grid; grid-template-columns: 1fr; gap: 18px; margin-top: 18px; }

.biz-switcher { display: flex; align-items: center; gap: 7px; margin-bottom: 14px; flex-wrap: wrap; }
.biz-switcher-select {
  flex: 1 1 160px; min-width: 120px; padding: 9px 10px; border-radius: 10px;
  border: 1.5px solid var(--border); background: #fff; font-family: inherit;
  font-size: 12.5px; font-weight: 700; color: var(--navy); cursor: pointer;
}
.biz-switcher-select:focus { outline: 2px solid var(--primary-light); border-color: var(--primary); }
.biz-switcher-count { font-size: 11px; font-weight: 700; color: var(--muted); }
.biz-del-btn:hover { border-color: var(--expense); color: var(--expense); background: var(--expense-bg); }
.biz-saldo-hint { font-size: 11px; color: var(--muted); font-weight: 600; line-height: 1.5; margin: -10px 0 16px; background: var(--primary-light); border-radius: 10px; padding: 8px 11px; }

/* Ringkasan keuangan inti: 3 angka, selalu terlihat di atas tab */
.biz-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.biz-summary-item {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 10px 12px;
}
.biz-summary-item .lbl { font-size: 11px; font-weight: 600; color: var(--muted); }
.biz-summary-item .val { font-size: 15px; font-weight: 800; margin-top: 3px; font-family: 'Sora', sans-serif; color: var(--navy); }
.biz-summary-item .val.pos { color: var(--income); }
.biz-summary-item .val.neg { color: var(--expense); }
@media (max-width: 380px) { .biz-summary { grid-template-columns: 1fr; } }

/* Tab: Bahan / Barang / Transaksi */
.biz-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.biz-tab {
  font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 700; color: var(--muted);
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 9px 6px; margin-bottom: -1px; cursor: pointer; transition: color .13s, border-color .13s;
}
.biz-tab:hover { color: var(--primary-dark); }
.biz-tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
.biz-panel[hidden] { display: none; }

/* Header tiap panel: judul ringkas + tombol tambah */
.biz-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.biz-panel-head-title { font-family: 'Sora', sans-serif; font-size: 13.5px; font-weight: 700; color: var(--navy); }
.biz-panel-substats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 600; }
.biz-panel-substats b { color: var(--navy); font-family: 'Sora', sans-serif; font-weight: 800; }
.biz-panel-substats-2 { margin: -4px 0 12px; }

/* Ringkasan Bahan/Barang sebagai kartu mini (bukan cuma teks) — minimalis, senada dgn .biz-summary */
.biz-mini-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.biz-mini-stat {
  display: flex; align-items: center; gap: 9px; min-width: 0;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 11px;
}
.biz-mini-ico { font-size: 17px; line-height: 1; flex-shrink: 0; }
.biz-mini-body { min-width: 0; }
.biz-mini-val {
  font-size: 13.5px; font-weight: 800; font-family: 'Sora', sans-serif; color: var(--navy);
  line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.biz-mini-lbl {
  font-size: 10.5px; font-weight: 600; color: var(--muted); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.biz-mini-lbl b { color: var(--navy); font-weight: 700; }
@media (max-width: 380px) { .biz-mini-stats { grid-template-columns: 1fr 1fr; } }

/* Sub-judul di dalam panel (mis. Riwayat Penjualan dalam tab Barang) */
.biz-subhead {
  font-family: 'Sora', sans-serif; font-size: 12.5px; font-weight: 700;
  color: var(--navy); margin: 20px 0 10px;
  padding-top: 16px; border-top: 1px dashed var(--border);
}

/* Daftar di dalam kartu gabungan dibuat lebih pendek karena bisa ada
   2 daftar (mis. Barang & Riwayat Penjualan) dalam satu panel yang sama */
.list-limited-sm { max-height: 220px; overflow-y: auto; padding-right: 2px; align-content: flex-start; flex: 1; min-width: 0; }
.list-limited-sm::-webkit-scrollbar { width: 4px; }
.list-limited-sm::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 10px; }

/* Cari & urutkan bahan */
.biz-toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.biz-search-input {
  flex: 1; min-width: 0; font-family: 'Inter', sans-serif;
  border: 1px solid var(--border); background: var(--bg-soft);
  border-radius: 11px; padding: 9px 12px; font-size: 12.5px; color: var(--navy);
}
.biz-search-input:focus { outline: 2px solid var(--primary-light); border-color: var(--primary); }
.biz-sort-select {
  font-family: 'Inter', sans-serif; border: 1px solid var(--border);
  background: var(--bg-soft); border-radius: 11px; padding: 9px 8px;
  font-size: 11.5px; font-weight: 600; color: var(--navy); flex-shrink: 0; max-width: 128px;
}
@media (max-width: 420px) { .biz-toolbar { flex-wrap: wrap; } .biz-sort-select { flex: 1 1 100%; max-width: none; } }

/* Kategori bahan: chip yang bisa difilter & dihapus */
.biz-cat-manage { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.biz-cat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-soft); border: 1.5px solid var(--border);
  border-radius: 999px; padding: 5px 6px 5px 12px;
  font-size: 11.5px; font-weight: 700; color: var(--navy);
  cursor: pointer; transition: border-color .13s, background .13s;
}
.biz-cat-chip:hover { border-color: var(--primary); }
.biz-cat-chip.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }
.biz-cat-chip .biz-cat-del {
  border: none; background: rgba(14,34,64,0.08); color: var(--muted);
  width: 16px; height: 16px; border-radius: 50%; font-size: 9px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.biz-cat-chip .biz-cat-del:hover { background: var(--expense); color: #fff; }

/* Bahan: kartu kecil & minimalis */
.biz-item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 9px; align-content: start; }
.biz-item-card {
  position: relative;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 12px; padding: 9px; cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color .13s, transform .12s;
}
.biz-item-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.biz-item-top { display: flex; align-items: center; gap: 8px; }
.biz-item-icon {
  position: relative;
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: #fff; border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; overflow: hidden; cursor: pointer;
  transition: border-color .14s;
}
.biz-item-icon:hover { border-color: var(--primary); }
.biz-item-icon .icon-edit-badge { width: 12px; height: 12px; font-size: 6px; }
.biz-item-body { min-width: 0; flex: 1; }
.biz-item-name { font-size: 11.5px; font-weight: 700; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.biz-item-sub  { font-size: 9.5px; font-weight: 600; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.biz-item-sub .biz-stok-low { color: var(--expense); }
.biz-item-sub.biz-item-total { color: var(--navy); font-weight: 800; }
.biz-item-actions { display: flex; gap: 5px; }
.biz-item-qty-btn {
  flex: 1; border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 5px 3px; font-size: 9.5px; font-weight: 700; cursor: pointer;
  color: var(--navy); font-family: 'Inter', sans-serif; transition: all .13s; white-space: nowrap;
}
.biz-item-qty-btn.plus:hover  { border-color: var(--income); color: var(--income); background: var(--income-bg); }
.biz-item-qty-btn.minus:hover { border-color: var(--expense); color: var(--expense); background: var(--expense-bg); }
.biz-item-qty-btn.sell {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.biz-item-qty-btn.sell:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.biz-item-hist-btn {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 5px 8px; font-size: 11px; cursor: pointer; flex-shrink: 0; transition: border-color .13s;
}
.biz-item-hist-btn:hover { border-color: var(--primary); }

/* Subtotal (harga x stok) langsung di modal Bahan */
.biz-subtotal-hint {
  margin: -4px 0 14px; padding: 8px 12px; border-radius: 10px;
  background: var(--bg-soft); border: 1px dashed var(--border);
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.biz-subtotal-hint span { color: var(--primary-dark); font-family: 'Sora', sans-serif; }
.biz-item-del {
  position: absolute; top: -5px; right: -5px;
  width: 17px; height: 17px; border-radius: 50%; border: none;
  background: var(--expense); color: #fff; font-size: 9px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  opacity: 0; transition: opacity .13s;
}
.biz-item-card:hover .biz-item-del { opacity: 1; }

/* Riwayat stok: baris log */
.biz-hist-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 11px;
  background: var(--bg-soft); margin-bottom: 7px; font-size: 12px;
}
.biz-hist-item:last-child { margin-bottom: 0; }
.biz-hist-mid { min-width: 0; flex: 1; }
.biz-hist-mid .biz-hist-note { font-weight: 700; color: var(--navy); font-size: 12px; }
.biz-hist-mid .biz-hist-date { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.biz-hist-delta { font-weight: 800; font-family: 'Sora', sans-serif; font-size: 13px; flex-shrink: 0; white-space: nowrap; }
.biz-hist-delta.plus  { color: var(--income); }
.biz-hist-delta.minus { color: var(--expense); }

/* Photo picker di modal Bahan */
.biz-photo-picker {
  width: 72px; height: 72px; border-radius: 16px;
  background: #fff; border: 1.5px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; position: relative; overflow: hidden; cursor: pointer;
  margin: 0 auto;
}
.biz-photo-picker:hover { border-color: var(--primary); }
.biz-photo-picker img { width: 100%; height: 100%; object-fit: cover; }
.biz-photo-picker .icon-edit-badge { position: absolute; bottom: 2px; right: 2px; }

.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; margin-bottom: 13px; }

/* ---------- Tujuan Keuangan (Goals) ---------- */
.goal-overall-badge {
  font-size: 11.5px; font-weight: 700; color: var(--primary-dark);
  background: var(--primary-light); padding: 5px 11px; border-radius: 999px;
}
/* Fixed 2-column grid so every goal card (achieved or not) gets an
   equal-width cell — a single leftover card no longer stretches to
   fill the whole row and look lopsided next to the others. */
.goal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 560px) { .goal-grid { grid-template-columns: 1fr; } }
.goal-card {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 15px; width: 100%; box-sizing: border-box;
  display: flex; flex-direction: column;
}
.goal-card.completed { border-color: var(--income); background: var(--income-bg); }
.goal-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.goal-name { font-weight: 700; font-size: 13.5px; color: var(--navy); display:flex; align-items:center; gap:7px; }
.goal-done-badge { font-size: 10.5px; font-weight: 700; color: var(--income); background: #fff; padding: 3px 8px; border-radius: 999px; }
.goal-del-btn {
  border: none; background: rgba(107,130,166,0.1); color: var(--muted);
  width: 22px; height: 22px; border-radius: 7px; font-size: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.goal-del-btn:hover { background: var(--expense-bg); color: var(--expense); }
.goal-progress-track { height: 9px; border-radius: 999px; background: rgba(107,130,166,0.15); overflow: hidden; }
.goal-progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #7AABFF); transition: width .5s ease; }
.goal-progress-fill.done { background: linear-gradient(90deg, var(--income), #72DFC8); }
.goal-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 7px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.goal-meta .collected { color: var(--income); font-weight: 700; }
.goal-actions { display: flex; gap: 7px; margin-top: auto; padding-top: 10px; }
.goal-withdrawn-note {
  margin-top: 8px; font-size: 11px; font-weight: 600; color: var(--muted);
  background: rgba(107,130,166,0.1); border-radius: 9px; padding: 6px 9px;
}
.goal-schedule-note {
  margin-top: 8px; font-size: 11px; font-weight: 600; color: var(--primary-dark);
  background: var(--primary-light); border-radius: 9px; padding: 6px 9px;
  line-height: 1.5;
}
.goal-overdue-note {
  margin-top: 8px; font-size: 11px; font-weight: 700; color: var(--expense);
  background: var(--expense-bg); border-radius: 9px; padding: 6px 9px;
  line-height: 1.5;
}
.goal-deadline-note {
  margin-top: 6px; font-size: 10.5px; font-weight: 600; color: var(--muted);
}
.goal-actions .btn { flex: 1; justify-content: center; padding: 7px 10px; font-size: 12px; }
.goal-history-section { border-top: 1px dashed var(--border); margin-top: 16px; padding-top: 14px; }
.goal-history-section .card-head { margin-bottom: 10px; }
.goal-history-section .card-head h2 { font-size: 13.5px; }