/* MoneyLog — gaya prototipe "Aurora": krem hangat, tinta, serif Playfair Display */
:root {
  --bg: #f4f1ea;
  --bg-outer: #eae6db;
  --ink: #171713;
  --ink-soft: #2a2921;
  --muted: #8b867b;
  --card: #ffffff;
  --line: #e7e1d3;
  --soft: #efe9dd;
  --dark: #1c1b17;
  --olive: #6f7355;
  --khaki: #a79b78;
  --sand: #d9d2be;
  --pale: #e9e4d6;
  --green: #2f7d4f;
  --red: #b3261e;
  --red-soft: #fbf0ee;
  --radius: 20px;
  --shadow: 0 6px 18px rgba(23, 20, 10, .06);
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg-outer);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.error { color: var(--red); font-size: .9rem; }
.success { color: var(--green); font-size: .9rem; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: .2rem 0 .6rem; }
a { color: var(--ink); font-weight: 500; }
strong { font-weight: 600; }

/* ---------- Kolom aplikasi (mobile-first, di web jadi bingkai tengah) ---------- */
#app, .auth-wrap {
  max-width: 430px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100dvh;
  position: relative;
}
@media (min-width: 768px) {
  body { background: radial-gradient(1200px 800px at 50% 30%, #f2eee4, var(--bg-outer)); }
  #app, .auth-wrap { box-shadow: 0 0 0 1px rgba(23,20,10,.05), 0 24px 60px rgba(23,20,10,.14); }
}

/* ---------- Auth ---------- */
.auth-wrap { padding: 3rem 1.4rem 3rem; }
.brand { text-align: center; margin-bottom: 1.6rem; }
.brand-logo {
  width: 66px; height: 66px; margin: 0 auto .8rem;
  background: var(--dark); color: #fff;
  font-family: var(--serif); font-weight: 600; font-size: 1.7rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 20px; box-shadow: 0 10px 24px rgba(23,20,10,.25);
}
.brand-logo.small { width: 32px; height: 32px; font-size: .95rem; border-radius: 10px; margin: 0; box-shadow: none; }
.brand h1 { font-size: 2rem; margin-bottom: .2rem; }
.brand p { color: var(--muted); margin: .2rem 0 0; font-size: .95rem; }
.auth-card { margin-top: 1rem; }
.auth-links { display: flex; flex-direction: column; gap: .5rem; margin-top: 1.1rem; font-size: .92rem; text-align: center; }
.auth-links a { text-decoration: none; color: var(--muted); }
.auth-links a:hover { color: var(--ink); }

/* ---------- Layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: .7rem 1.1rem; background: var(--bg);
}
.topbar-brand { display: flex; align-items: center; gap: .55rem; font-family: var(--serif); font-weight: 600; font-size: 1.15rem; }
.topbar-user {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--sand); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 600; font-size: 1rem;
}
.content { padding: .4rem 1.1rem 110px; }
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 1.05rem 1.1rem; margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 1.22rem; }

/* ---------- Beranda ---------- */
.home-head { display: flex; align-items: center; gap: .8rem; padding: .6rem .1rem 1rem; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: var(--sand); display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 600; font-size: 1.15rem;
}
.home-head p { margin: 0; }
.home-head strong { font-size: 1.05rem; }
.wallet-hero {
  background: var(--dark); color: #fff; border-radius: 22px;
  padding: 1.1rem 1.2rem; margin-bottom: 1.1rem;
  box-shadow: 0 14px 30px rgba(23,20,10,.22);
  cursor: pointer;
}
.wallet-hero .wh-top { display: flex; justify-content: space-between; align-items: center; font-size: .9rem; font-weight: 600; }
.wallet-hero .wh-tag { color: var(--khaki); font-size: .68rem; letter-spacing: .12em; font-weight: 700; }
.wallet-hero .wh-chip { width: 32px; height: 23px; border-radius: 5px; background: var(--khaki); margin: .9rem 0 .7rem; }
.wallet-hero .wh-num { color: rgba(255,255,255,.75); font-size: .85rem; letter-spacing: .08em; }
.wallet-hero .wh-bal { font-family: var(--serif); font-size: 1.55rem; font-weight: 600; margin-top: .25rem; }
.hero { text-align: center; padding: .4rem 0 1.1rem; }
.hero p { margin: 0; }
.serif-big { font-family: var(--serif); font-weight: 600; font-size: 2.45rem; line-height: 1.1; margin: .25rem 0; }
.hero-row { display: flex; justify-content: space-around; gap: 1rem; margin-top: .9rem; text-align: center; font-size: .9rem; color: var(--muted); }
.hero-row strong { display: block; color: var(--ink); font-size: 1.02rem; margin-top: .15rem; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dot.in { background: var(--green); }
.dot.out { background: var(--red); }
.quick-actions { display: flex; justify-content: space-between; gap: .4rem; margin: 0 .1rem 1.1rem; }
.qa {
  flex: 1; background: none; border: 0; cursor: pointer; padding: 0;
  display: flex; flex-direction: column; align-items: center; gap: .45rem;
  font-family: var(--sans); font-size: .72rem; color: var(--muted); font-weight: 500;
}
.qa-ic {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem; font-weight: 600; color: var(--ink);
  box-shadow: var(--shadow);
}
.qa-ic.ai-ic { font-size: .82rem; font-weight: 700; letter-spacing: .03em; }
.qa:active .qa-ic { background: var(--soft); }

/* ---------- Formulir & tombol ---------- */
label { display: block; font-size: .88rem; font-weight: 500; margin-bottom: .85rem; color: var(--ink-soft); }
input, select {
  width: 100%; margin-top: .35rem; padding: .78rem .85rem;
  border: 0; border-radius: 12px; font-size: 1rem; background: var(--soft);
  font-family: var(--sans); color: var(--ink);
}
input:focus, select:focus { outline: 2px solid rgba(111,115,85,.5); }
.card input, .card select { background: var(--soft); }
.btn {
  display: block; width: 100%; padding: .85rem 1rem; margin-top: .6rem;
  border: 0; background: var(--card); color: var(--ink);
  border-radius: 999px; font-size: 1rem; font-family: var(--sans); cursor: pointer;
  box-shadow: var(--shadow);
}
.btn.primary { background: var(--dark); color: #fff; font-weight: 600; }
.btn.primary:active { background: #000; }
.btn.primary:disabled { opacity: .55; }
.btn.big { font-size: 1.05rem; padding: 1rem; margin-bottom: 1rem; }
.btn.danger { background: var(--red-soft); color: var(--red); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--muted); box-shadow: none; }
.seg { display: flex; background: var(--soft); border-radius: 999px; padding: 4px; margin-bottom: 1rem; }
.seg-btn {
  flex: 1; padding: .6rem; border: 0; border-radius: 999px; background: transparent;
  font-size: .95rem; font-family: var(--sans); cursor: pointer; color: var(--muted);
}
.seg-btn.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 4px rgba(23,20,10,.12); }
.filter-row { display: flex; gap: .6rem; }
.filter-row select { flex: 1; }

/* ---------- Daftar transaksi ---------- */
.tx-item {
  display: flex; align-items: center; gap: .8rem;
  padding: .6rem 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.tx-item:last-child { border-bottom: 0; }
.tx-ava {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; color: var(--ink);
}
.t0 { background: var(--sand); } .t1 { background: var(--pale); }
.t2 { background: #ccd0ba; } .t3 { background: #ddd3b8; } .t4 { background: #e3ddcf; }
.tx-main { flex: 1; min-width: 0; }
.tx-item .note { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-item .meta { color: var(--muted); font-size: .8rem; }
.tx-amount { font-weight: 600; white-space: nowrap; font-size: .95rem; }
.tx-amount.income { color: var(--green); }
.tx-amount.expense { color: var(--ink); }
.tx-date-group { font-size: .82rem; color: var(--muted); margin: 1rem 0 .3rem; font-weight: 600; }

/* ---------- Grafik ---------- */
.bar-row { margin-bottom: .75rem; }
.bar-row .bar-head { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: .3rem; }
.bar { height: 9px; background: var(--soft); border-radius: 6px; overflow: hidden; }
.bar > div { height: 100%; background: var(--olive); border-radius: 6px; }
.week-bars { display: flex; align-items: flex-end; gap: .8rem; height: 120px; padding-top: .4rem; }
.week-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .45rem; height: 100%; justify-content: flex-end; }
.week-bar { width: 100%; max-width: 34px; border-radius: 8px 8px 4px 4px; background: var(--sand); }
.week-col.max .week-bar { background: var(--olive); }
.week-col.mid .week-bar { background: var(--khaki); }
.week-lab { font-size: .72rem; color: var(--muted); }
.donut-wrap { display: flex; align-items: center; gap: 1.1rem; }
.donut-legend { flex: 1; }
.legend-row { display: flex; align-items: baseline; gap: .5rem; padding: .28rem 0; font-size: .88rem; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; position: relative; top: -1px; }
.legend-name { flex: 1; }
.legend-pct { font-weight: 600; }
.legend-amt { display: block; color: var(--muted); font-size: .76rem; }

/* ---------- Dompet ---------- */
.wallet-item { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .75rem 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.wallet-item:last-child { border-bottom: 0; }
.wallet-item .w-name { font-weight: 600; }
.wallet-item .w-bal { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; white-space: nowrap; }
.total-wallet { text-align: center; padding: .6rem 0 .2rem; }
.total-wallet .serif-big { font-size: 2.1rem; }

/* ---------- Kategori & menu ---------- */
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--soft); border-radius: 999px;
  padding: .38rem .75rem; margin: 0 .4rem .45rem 0; font-size: .88rem;
}
.chip button { border: 0; background: none; color: var(--red); cursor: pointer; font-size: 1rem; padding: 0; }
.menu { padding: .35rem 1.1rem; }
.menu-item {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; text-align: left; background: none; border: 0;
  border-bottom: 1px solid var(--line); padding: .95rem 0; font-size: .98rem;
  font-family: var(--sans); cursor: pointer; color: var(--ink);
}
.menu-item::after { content: "›"; color: var(--muted); font-size: 1.25rem; }
.menu-item:last-child { border-bottom: 0; }
.menu-item:last-child::after { content: ""; }
.danger-text { color: var(--red); }
.profile-head { display: flex; align-items: center; gap: .9rem; }
.profile-head h3 { margin: 0 0 .15rem; font-size: 1.3rem; }
.profile-head p { margin: 0; }

/* ---------- AI ---------- */
.ai-dark { background: var(--dark); color: #f2f0e9; }
.ai-dark h3 { color: #fff; }
.ai-dark .muted { color: rgba(255,255,255,.6); }
.ai-banner { background: var(--dark); color: #f2f0e9; cursor: pointer; }
.ai-banner .ab-tag { color: var(--khaki); font-size: .68rem; letter-spacing: .12em; font-weight: 700; }
.ai-banner h3 { color: #fff; margin: .35rem 0 .3rem; }
.ai-banner p { margin: 0; color: rgba(255,255,255,.72); font-size: .88rem; line-height: 1.45; }
#ai-result ul { margin: .2rem 0 .2rem 1.1rem; padding: 0; line-height: 1.5; }
#ai-result li { margin-bottom: .3rem; }

/* ---------- Navbar bawah ---------- */
.bottomnav {
  position: fixed; bottom: 0; z-index: 10;
  left: 50%; transform: translateX(-50%);
  width: min(430px, 100%);
  display: flex; align-items: flex-start;
  background: var(--card); border-top: 1px solid var(--line);
  padding: .45rem .3rem calc(.35rem + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 18px rgba(23,20,10,.05);
}
.nav-btn {
  flex: 1; background: none; border: 0; padding: .3rem 0 .1rem;
  color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-family: var(--sans);
}
.nav-btn svg { width: 23px; height: 23px; }
.nav-btn span { font-size: .66rem; font-weight: 500; }
.nav-btn.active { color: var(--ink); }
.nav-btn.active span { font-weight: 700; }
.nav-btn.add { margin-top: -22px; }
.nav-btn.add .add-circle {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--dark); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 22px rgba(23,20,10,.3);
}
.nav-btn.add .add-circle svg { width: 24px; height: 24px; }
.nav-btn.add span:last-child { color: var(--muted); font-size: .66rem; }

/* ---------- Komponen stage8: toast, modal, spinner, status kosong ---------- */
.btn:disabled { opacity: .55; cursor: wait; }
.toast {
  position: fixed; left: 50%; z-index: 60;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(14px);
  background: var(--dark); color: #fff;
  padding: .78rem 1.25rem; border-radius: 999px;
  font-size: .92rem; font-weight: 500; text-align: center;
  max-width: min(92vw, 480px);
  box-shadow: 0 14px 34px rgba(23,20,10,.3);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.modal-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(23,20,10,.48);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-card {
  background: var(--card); border-radius: 20px;
  padding: 1.4rem 1.4rem 1.2rem; width: 100%; max-width: 400px;
  box-shadow: 0 24px 60px rgba(23,20,10,.3);
}
.modal-card h3 { margin-top: 0; }
.modal-card p { margin: .2rem 0 0; line-height: 1.5; }
.modal-actions { display: flex; gap: .6rem; margin-top: 1.1rem; }
.modal-actions .btn { margin-top: 0; }
.btn.danger-solid { background: var(--red); color: #fff; font-weight: 600; box-shadow: none; }
.spinner {
  display: inline-block; width: 14px; height: 14px; flex: none;
  border: 2px solid var(--sand); border-top-color: var(--olive);
  border-radius: 50%; vertical-align: -2px;
  animation: ml-spin .7s linear infinite;
}
@keyframes ml-spin { to { transform: rotate(360deg); } }
.loading-card { color: var(--muted); }
.empty { text-align: center; padding: 2rem 1.2rem; }
.empty-ic {
  width: 56px; height: 56px; margin: 0 auto .7rem;
  border-radius: 50%; background: var(--soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem; color: var(--muted);
}
.empty p { margin: .25rem 0; }
.month-nav { display: flex; align-items: center; gap: .6rem; }
.month-label { flex: 1; margin: 0; }
.month-btn {
  width: 46px; height: 46px; flex: none; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card);
  font-size: 1.35rem; line-height: 1; color: var(--ink); cursor: pointer;
}
.month-btn:active { background: var(--soft); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid rgba(111,115,85,.65); outline-offset: 2px;
}

/* ---------- Sidebar (hanya web lebar) ---------- */
.sidebar { display: none; }
.side-brand { display: flex; align-items: center; gap: .6rem; font-family: var(--serif); font-weight: 600; font-size: 1.3rem; margin-bottom: 1.3rem; }
.side-add { margin: 0 0 1.3rem; }
.side-nav { display: flex; flex-direction: column; gap: .25rem; }
.side-btn {
  display: flex; align-items: center; gap: .7rem;
  padding: .68rem .8rem; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink-soft);
  font-family: var(--sans); font-size: .95rem; text-align: left; cursor: pointer;
}
.side-btn svg { width: 20px; height: 20px; flex: none; }
.side-btn:hover { background: rgba(255,255,255,.7); }
.side-btn.active { background: var(--dark); color: #fff; font-weight: 600; }
.side-user { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); display: flex; align-items: center; gap: .7rem; }
.side-user .avatar { width: 40px; height: 40px; font-size: 1rem; }
.side-user-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side-user-meta strong { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-meta span { font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-logout { border: 0; background: none; font-size: 1.1rem; color: var(--muted); cursor: pointer; padding: .3rem; }
.side-logout:hover { color: var(--red); }

/* ---------- Tata letak web (desktop) ---------- */
@media (min-width: 1024px) {
  #app { max-width: none; margin: 0; box-shadow: none; }
  .auth-wrap { max-width: 460px; padding-top: 5rem; }
  .sidebar {
    display: flex; flex-direction: column;
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 20;
    width: 268px; padding: 1.5rem 1.15rem 1.2rem;
    background: var(--bg); border-right: 1px solid var(--line);
  }
  .topbar, .bottomnav { display: none; }
  .content { margin-left: 268px; padding: 2.2rem 2.6rem 3rem; }
  .content .view { max-width: 1120px; margin: 0 auto; }
  .toast { bottom: 28px; }

  /* Beranda: dua kolom */
  #view-home { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(0,1fr); gap: 1.2rem; align-items: start; }
  #view-home .card { margin-bottom: 0; }
  #view-home .home-head { grid-column: 1 / -1; padding-bottom: .2rem; }
  #view-home .hero { grid-column: 1; grid-row: 2; text-align: left; padding: .5rem .2rem 0; }
  #view-home .hero .serif-big { font-size: 3.1rem; }
  #home-wallet { grid-column: 2; grid-row: 2; }
  #home-wallet .wallet-hero { margin-bottom: 0; }
  #home-quick-card { grid-column: 1; grid-row: 3; }
  #view-home .quick-actions {
    grid-column: 2; grid-row: 3; margin: 0;
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1.05rem .6rem;
  }
  #home-cats-card { grid-column: 2; grid-row: 4; }
  #home-recent-card { grid-column: 1; grid-row: 4; }

  /* Dompet: daftar + formulir berdampingan */
  #view-wallets { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(0,1fr); gap: 1.2rem; align-items: start; }
  #wallet-form-card { position: sticky; top: 2rem; margin-bottom: 0; }

  /* Laporan: ringkasan penuh, grafik berdampingan */
  #view-report { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
  #view-report .card { margin-bottom: 0; }
  #report-summary-card { grid-column: 1 / -1; }
  #view-report .ai-banner { grid-column: 1 / -1; }
  #report-export { grid-column: 1 / -1; justify-self: start; width: auto; padding-left: 1.7rem; padding-right: 1.7rem; margin-top: 0; }
  #view-report > .btn.ghost { grid-column: 1 / -1; justify-self: start; width: auto; margin-top: 0; }

  /* Formulir & halaman tunggal: kolom tengah yang lega */
  #view-tx-form .card,
  #view-categories .card { max-width: 680px; margin-left: auto; margin-right: auto; }
  #view-categories > .btn.ghost { max-width: 680px; margin-left: auto; margin-right: auto; }

  /* Profil & Analisis AI: dua kolom lega (dulu kolom sempit 680px di tengah) */
  #view-profile { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
  #view-profile .card { margin-bottom: 0; }
  #view-profile .span2 { grid-column: 1 / -1; }
  #view-ai { display: grid; gap: 1.2rem; }
  #view-ai .card { margin-bottom: 0; }
  #view-ai > .btn.ghost { justify-self: start; width: auto; margin-top: 0; }
  .ai-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
  .ai-grid .span2 { grid-column: 1 / -1; }
  .ai-grid .card { margin-bottom: 0; }

  /* Transaksi: daftar lebar dengan efek hover */
  #tx-search { max-width: 430px; }
  #tx-list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .3rem 1.1rem 0.6rem; }
  #tx-list .card { background: transparent; box-shadow: none; }
  .tx-item { padding-left: .5rem; padding-right: .5rem; border-radius: 10px; }
  .tx-item:hover { background: var(--soft); }
  .wallet-item:hover { background: var(--soft); }
  .qa:hover .qa-ic { border-color: var(--khaki); }
  .btn.primary:hover { background: #000; }
}

/* ================= Stage 9: referensi dashboard web + perbaikan HP + animasi ================= */
.desktop-only { display: none; }
.desk-head { display: none; }
#app, .auth-wrap { overflow-x: clip; }
.btn { transition: background .15s ease, transform .1s ease, opacity .15s ease; }
.btn:active { transform: scale(.99); }
.side-btn { transition: background .15s ease, color .15s ease; }

/* Perbaikan HP: baris filter boleh membungkus, bulan baris sendiri di layar sempit */
.filter-row { flex-wrap: wrap; }
.filter-row select { flex: 1 1 120px; }
#tx-filter-month { flex: 1 1 150px; }
@media (max-width: 560px) {
  #tx-filter-month { flex-basis: 100%; }
  .month-btn { width: 40px; height: 40px; }
}
.tx-item .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero .serif-big { font-size: clamp(2rem, 11vw, 2.45rem); }
.donut-wrap { flex-wrap: wrap; justify-content: center; }
.wallet-hero .wh-bal { overflow-wrap: anywhere; }

/* Animasi */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.enter { animation: fadeUp .3s ease both; }
@keyframes growY { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.flow-bar, .mini-bar, .week-bar { transform-origin: bottom; animation: growY .55s ease both; }
@keyframes popIn { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-card { animation: popIn .18s ease both; }

/* Sidebar: pencarian + label seksi */
.side-search { position: relative; margin-bottom: 1rem; }
.side-search svg { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.side-search input { margin-top: 0; padding-left: 2.2rem; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.side-label { font-size: .7rem; letter-spacing: .11em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 1.05rem 0 .45rem; }

/* Kartu statistik + grafik mini */
.stat-card { padding: 1.1rem 1.2rem; }
.stat-label { color: var(--muted); font-size: .85rem; margin: 0 0 .3rem; font-weight: 500; }
.stat-value { font-family: var(--serif); font-weight: 600; font-size: 1.65rem; line-height: 1.15; }
.stat-sub { font-size: .8rem; margin: .2rem 0 0; }
.mini-bars { display: flex; align-items: flex-end; gap: 5px; height: 44px; margin-top: .75rem; max-width: 170px; }
.mini-col { flex: 1; display: flex; align-items: flex-end; height: 100%; }
.mini-bar { width: 100%; border-radius: 4px 4px 2px 2px; }
.mini-bar.mb-in { background: var(--olive); }
.mini-bar.mb-out { background: var(--khaki); }
.mini-bar.mb-sand { background: var(--sand); }

/* Grafik arus kas gabungan */
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.panel-head h3 { margin-top: 0; }
.legend { font-size: .82rem; }
.dot.in { background: var(--olive); }
.dot.out { background: var(--khaki); }
.flow-chart { display: flex; align-items: flex-end; gap: 1rem; height: 175px; padding-top: .5rem; }
.flow-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .45rem; height: 100%; justify-content: flex-end; }
.flow-pair { display: flex; align-items: flex-end; justify-content: center; gap: 5px; height: calc(100% - 22px); width: 100%; }
.flow-bar { width: 16px; border-radius: 5px 5px 2px 2px; }
.flow-bar.in { background: var(--olive); }
.flow-bar.out { background: var(--khaki); }
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); font-family: var(--sans); font-size: .85rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.link-btn:hover { color: var(--ink); }

@media (min-width: 1024px) {
  .desktop-only { display: block; }
  .stats-row.desktop-only { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
  .desk-head {
    display: flex; justify-content: space-between; align-items: center;
    max-width: 1120px; margin: 0 auto 1.5rem;
  }
  .crumb p { margin: 0; }
  .crumb-path { font-size: 1.02rem; color: var(--muted); }
  .crumb-path span { margin: 0 .3rem; }
  .crumb-path strong { color: var(--ink); font-weight: 600; }
  .crumb-date { color: var(--muted); font-size: .83rem; margin-top: .15rem !important; }
  .desk-head-user { display: flex; align-items: center; gap: .7rem; }
  .desk-head-user .avatar { width: 40px; height: 40px; font-size: 1rem; }
  .dhu-meta { display: flex; flex-direction: column; }
  .dhu-meta strong { font-size: .93rem; }
  .dhu-meta span { font-size: .76rem; color: var(--muted); }

  /* Beranda gaya panel referensi */
  #view-home { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #view-home .home-head, #view-home .hero, #view-home .quick-actions { display: none; }
  #view-home .stats-row { grid-column: 1 / -1; grid-row: 1; }
  #home-quick-card { grid-column: 1 / -1; grid-row: 2; }
  #home-quick-card #form-quick { display: flex; gap: .8rem; align-items: flex-start; }
  #home-quick-card #form-quick input { flex: 1; margin-top: 0; }
  #home-quick-card #form-quick .btn { width: auto; margin-top: 0; padding-left: 1.6rem; padding-right: 1.6rem; }
  #home-flow-card { grid-column: 1 / 3; grid-row: 3; }
  #home-wallet { grid-column: 3; grid-row: 3; }
  #home-wallet .wallet-hero { height: 100%; margin-bottom: 0; }
  #home-cats-card { grid-column: 1; grid-row: 4; }
  #home-cats-card .donut-wrap { flex-direction: column; gap: .5rem; }
  #home-recent-card { grid-column: 2; grid-row: 4; }
  #home-ai-panel { grid-column: 3; grid-row: 4; }
  #view-home .card, #view-report .card { transition: box-shadow .2s ease, transform .2s ease; }
  #view-home .card:hover, #view-report .card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(23,20,10,.09); }
}

/* ================= Stage 10: profil rinci, states, komponen pola ================= */
.avatar { overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.big { width: 76px; height: 76px; font-size: 1.7rem; }
.profile-head { display: flex; align-items: center; gap: 1.1rem; }
.ph-meta h3 { margin: 0 0 .15rem; }
.ph-meta p { margin: 0; }
.small { font-size: .8rem; }

.clickable { cursor: pointer; }
.stat-card[data-nav], .desk-head-user, .topbar-user, .side-user-main { cursor: pointer; }
.side-user-main { display: flex; align-items: center; gap: .7rem; flex: 1; min-width: 0; border-radius: 12px; }
.side-user-main:hover .side-user-meta strong { text-decoration: underline; }
.legend-row.clickable { border-radius: 8px; padding: .15rem .3rem; margin: 0 -.3rem; }
.legend-row.clickable:hover { background: var(--soft); }
.chip.clickable:hover { border-color: #6f7355; }

:focus-visible { outline: 2px solid #6f7355; outline-offset: 2px; }
button:active, .btn:active { transform: scale(.985); }

/* Isian kata sandi dengan tombol Lihat */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 4.4rem; }
.pw-eye {
  position: absolute; right: .45rem; top: 50%; transform: translateY(-50%);
  border: 0; background: var(--soft); color: var(--muted);
  font-size: .76rem; font-weight: 600; padding: .32rem .6rem; border-radius: 999px; cursor: pointer;
}
.pw-eye:hover { color: var(--ink, #171713); }

/* Baris tombol sejajar */
.row-btns { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: .4rem; }
.row-btns .btn { width: auto; flex: 1 1 150px; }
.file-btn { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-align: center; }

/* Chip contoh catat cepat */
.quick-try { margin: .6rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.try-chip {
  border: 1px solid var(--line); background: var(--soft); color: inherit;
  border-radius: 999px; padding: .28rem .7rem; font-size: .8rem; cursor: pointer;
}
.try-chip:hover { border-color: #6f7355; background: #fff; }

/* Chip filter aktif di daftar transaksi */
.chip-x {
  border: 1px solid var(--line); background: var(--soft); border-radius: 999px;
  padding: .2rem .6rem; font-size: .78rem; cursor: pointer; margin-left: .4rem;
}
.chip-x:hover { border-color: #b3543f; color: #b3543f; }

/* Snackbar beraksi */
.toast { display: flex; align-items: center; gap: .9rem; }
.toast-action {
  border: 0; background: none; color: #e8c97a; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; font-size: .8rem;
  cursor: pointer; padding: .3rem .2rem; white-space: nowrap;
}
.toast-action:hover { text-decoration: underline; }

/* Zona berbahaya & bantuan */
.danger-zone { border: 1px solid #dcb7a6; background: #fbf3ec; }
details { border-top: 1px solid var(--line); padding: .55rem 0; }
details:first-of-type { border-top: 0; }
details summary { cursor: pointer; font-weight: 600; padding: .2rem 0; }
details p { margin: .35rem 0 .2rem; line-height: 1.55; }

/* Rincian dompet */
.wh-month { font-size: .8rem; opacity: .85; margin-top: .4rem; }
.wh-tx {
  margin-top: .65rem; background: rgba(255,255,255,.13); color: #fff;
  border: 1px solid rgba(255,255,255,.35); padding: .38rem .85rem;
  border-radius: 999px; cursor: pointer; font-size: .82rem;
}
.wh-tx:hover { background: rgba(255,255,255,.22); }
.w-tx-link { background: none; border: 0; color: #6f7355; cursor: pointer; font-size: .8rem; font-weight: 600; padding: .2rem 0 0; }
.w-tx-link:hover { text-decoration: underline; }

/* Hasil Analisis AI */
.ai-grid { display: grid; gap: 1.2rem; }
.ai-grid .card { margin-bottom: 0; }
.ai-ringkasan { font-size: 1.03rem; line-height: 1.6; margin: 0; }
.ai-list { margin: .2rem 0 0 1.15rem; padding: 0; line-height: 1.55; }
.ai-list li { margin-bottom: .4rem; }
.anomali-warn { border: 1px solid #d9a05a; background: #fdf6ea; }

/* Sortir sejajar filter lain */
.filter-row #tx-sort { flex: 1 1 140px; }

/* Perbaikan stage 10: snackbar yang tampil harus bisa menerima klik (tombol Urungkan) */
.toast.show { pointer-events: auto; }
