/* ===================================================================
   Catatan Pengeluaran - Tampilan modern (mobile-first)
   =================================================================== */

:root {
  --bg:        #0b1020;
  --bg-2:      #0f1530;
  --card:      rgba(255,255,255,0.045);
  --card-solid:#151c34;
  --card-hi:   rgba(255,255,255,0.08);
  --text:      #f3f5fc;
  --muted:     #8b94b3;
  --muted-2:   #6b7494;
  --primary:   #7c6cff;
  --primary-2: #5b8cff;
  --accent:    #22d3ee;
  --border:    rgba(255,255,255,0.08);
  --danger:    #ff5c7a;
  --ok:        #34d399;
  --radius:    20px;
  --radius-sm: 14px;
  --shadow:    0 10px 30px rgba(0,0,0,0.35);
  --shadow-lg: 0 18px 45px rgba(0,0,0,0.45);
  --ease:      cubic-bezier(.22,.9,.3,1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background:
    radial-gradient(1100px 600px at 80% -10%, rgba(124,108,255,0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(34,211,238,0.10), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  min-height: 100vh;
}

.hidden { display: none !important; }
.muted  { color: var(--muted); }
.error-text { color: var(--danger); min-height: 1.2em; margin: 10px 0 0; font-size: 14px; font-weight: 500; }

/* ---------- Tombol ---------- */
.btn-primary, .btn-secondary {
  border: none; border-radius: 14px;
  padding: 14px 20px; font-size: 16px; font-weight: 650;
  font-family: inherit; cursor: pointer; color: #fff;
  transition: transform .12s var(--ease), filter .2s, box-shadow .2s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 20px rgba(124,108,255,0.35);
}
.btn-secondary { background: var(--card-hi); color: var(--text); }
.btn-primary:active, .btn-secondary:active { transform: scale(.96); }
.btn-primary.small, .btn-secondary.small { padding: 10px 16px; font-size: 14px; border-radius: 12px; }
.block { width: 100%; }

.icon-btn {
  background: rgba(255,255,255,0.12); border: none; color: #fff;
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; cursor: pointer;
  transition: transform .12s var(--ease), background .2s;
}
.icon-btn:active { transform: scale(.92); }

/* ---------- Layar PIN ---------- */
.lock-screen {
  min-height: 100vh; position: relative;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.lock-box {
  position: relative; z-index: 1;
  width: 100%; max-width: 350px; text-align: center;
  background: var(--card-solid);
  border: 1px solid var(--border);
  padding: 38px 26px; border-radius: 28px;
  box-shadow: var(--shadow-lg);
  animation: pop .5s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
.lock-icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  display: grid; place-items: center; border-radius: 20px; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 10px 24px rgba(124,108,255,0.45);
}
.lock-box h1 { font-size: 22px; font-weight: 800; margin: 6px 0 4px; }
.lock-box input {
  width: 100%; margin: 22px 0 16px; padding: 16px;
  font-size: 24px; text-align: center; letter-spacing: 8px; font-weight: 700;
  border-radius: 16px; border: 1px solid var(--border);
  background: rgba(0,0,0,0.25); color: var(--text);
}

/* ---------- App shell ---------- */
.app { max-width: 620px; margin: 0 auto; padding-bottom: 120px; }

/* ---------- Dashboard ---------- */
.dash {
  position: relative; overflow: hidden;
  margin: 0 0 6px;
  padding: calc(28px + env(safe-area-inset-top)) 22px 30px;
  background: linear-gradient(150deg, #7c6cff 0%, #5b8cff 55%, #22d3ee 130%);
  border-radius: 0 0 30px 30px;
  box-shadow: 0 16px 40px rgba(91,140,255,0.30);
}
.dash-glow {
  position: absolute; width: 240px; height: 240px; right: -60px; top: -90px;
  background: radial-gradient(circle, rgba(255,255,255,0.35), transparent 65%);
  pointer-events: none;
}
.dash-inner { position: relative; z-index: 1; }
.dash-row { display: flex; justify-content: space-between; align-items: center; }
.dash-label { font-size: 13px; font-weight: 600; letter-spacing: .02em; color: rgba(255,255,255,0.92); }
.dash-usd { font-size: 42px; font-weight: 900; margin-top: 10px; letter-spacing: -0.03em; line-height: 1; }
.dash-khr {
  display: inline-block; margin-top: 12px; padding: 5px 12px;
  font-size: 14px; font-weight: 600;
  background: rgba(255,255,255,0.18); border-radius: 999px;
  backdrop-filter: blur(4px);
}

/* ---------- Konten ---------- */
.content { padding: 18px 16px 0; }
.tab-panel { animation: fade .35s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.section-title { font-size: 15px; font-weight: 700; margin: 4px 2px 14px; color: var(--text); }

/* ---------- Daftar pengeluaran ---------- */
.expense-list { display: flex; flex-direction: column; gap: 11px; }
.expense-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 14px;
  display: flex; align-items: center; gap: 13px;
  backdrop-filter: blur(8px);
  transition: transform .14s var(--ease), background .2s;
  animation: rise .3s var(--ease) backwards;
}
.expense-item:active { transform: scale(.985); background: var(--card-hi); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.cat-avatar {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px; color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}
.exp-main { flex: 1; min-width: 0; }
.exp-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.exp-cat { font-weight: 700; font-size: 15.5px; }
.exp-amt { font-weight: 800; font-size: 15.5px; white-space: nowrap; }
.exp-sub { display: flex; justify-content: space-between; gap: 10px; margin-top: 3px; }
.exp-note { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-date { color: var(--muted-2); font-size: 12px; white-space: nowrap; font-weight: 500; }
.exp-actions { display: flex; gap: 6px; }
.exp-actions button {
  background: var(--card-hi); border: none; color: var(--text);
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center; transition: transform .12s var(--ease), background .2s;
}
.exp-actions button:active { transform: scale(.88); }
.exp-actions .del:active { background: rgba(255,92,122,0.25); }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text); }
.empty-emoji { font-size: 46px; margin-bottom: 10px; }
.empty-state p { font-weight: 600; margin: 0 0 4px; }
.empty-state span { font-size: 14px; }

/* ---------- Rekap ---------- */
.filter-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
  background: var(--card); border: 1px solid var(--border);
  padding: 10px 14px; border-radius: var(--radius-sm);
}
.filter-label { font-size: 14px; font-weight: 600; color: var(--muted); }
.filter-row input { flex: 1; background: transparent; border: none; padding: 4px 0; }

.recap-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
  backdrop-filter: blur(8px);
  animation: rise .3s var(--ease) backwards;
}
.recap-card h3 { margin: 0 0 14px; font-size: 14px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.hero-card {
  background: linear-gradient(140deg, rgba(124,108,255,0.18), rgba(91,140,255,0.10));
  border-color: rgba(124,108,255,0.30);
}
.hero-card h3 { color: rgba(255,255,255,0.75); }
.big-usd { font-size: 34px; font-weight: 900; letter-spacing: -0.03em; }
.big-khr { display: inline-block; margin-top: 8px; padding: 4px 12px; font-size: 14px; font-weight: 600; color: var(--text); background: rgba(255,255,255,0.10); border-radius: 999px; }

.recap-line {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--border);
}
.recap-line:first-child { border-top: none; padding-top: 2px; }
.recap-line .name { flex: 1; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.recap-line .val { text-align: right; }
.recap-line .val .usd { font-weight: 800; }
.recap-line .val .khr { font-size: 12px; color: var(--muted); margin-top: 1px; }

.cat-dot { width: 12px; height: 12px; border-radius: 5px; flex-shrink: 0; box-shadow: 0 0 0 3px rgba(255,255,255,0.06); }

.day-block { border-top: 1px solid var(--border); padding: 14px 0; }
.day-block:first-child { border-top: none; padding-top: 2px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; margin-bottom: 8px; }
.day-head .d-total { font-size: 13px; color: var(--muted); font-weight: 600; }
.day-cat { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); padding: 3px 0; }

/* ---------- Pengaturan ---------- */
.field-label { display: block; font-size: 13px; color: var(--muted); margin: 16px 0 7px; font-weight: 600; }
.inline { display: flex; gap: 10px; align-items: stretch; }
.inline input { flex: 1; }
.inline .btn-primary { white-space: nowrap; }
.cat-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cat-head h3 { margin: 0; }
.cat-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--border); }
.cat-row:first-of-type { border-top: none; }
.cat-row .name { flex: 1; font-weight: 600; }
.cat-row button { background: var(--card-hi); border: none; color: var(--text); padding: 8px 12px; border-radius: 10px; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; transition: transform .12s var(--ease); }
.cat-row button:active { transform: scale(.9); }
.cat-row button.del { color: var(--danger); }
.version-note { text-align: center; color: var(--muted-2); font-size: 12px; margin: 24px 0 0; }

/* ---------- Input umum ---------- */
input, select {
  width: 100%; padding: 14px; border-radius: 14px;
  border: 1px solid var(--border); background: rgba(0,0,0,0.22); color: var(--text);
  font-size: 16px; font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(124,108,255,0.18);
}
input[type="color"] { padding: 5px; height: 50px; cursor: pointer; }
.amount-input { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }

/* ---------- FAB ---------- */
.fab {
  position: fixed; right: 18px; bottom: calc(86px + env(safe-area-inset-bottom));
  width: 60px; height: 60px; border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; border: none; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 12px 28px rgba(124,108,255,0.55);
  z-index: 60; transition: transform .14s var(--ease);
  animation: fabIn .4s var(--ease) .1s backwards;
}
.fab:active { transform: scale(.9) rotate(90deg); }
@keyframes fabIn { from { opacity: 0; transform: scale(.5); } to { opacity: 1; transform: none; } }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: space-around;
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  background: rgba(13,18,38,0.82);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(18px);
}
.bottom-nav .tab {
  flex: 1; border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--muted-2); font-family: inherit; font-size: 11px; font-weight: 600;
  padding: 4px; transition: color .2s, transform .12s var(--ease);
}
.bottom-nav .tab svg { transition: transform .2s var(--ease); }
.bottom-nav .tab.active { color: var(--primary); }
.bottom-nav .tab.active svg { transform: translateY(-2px) scale(1.08); }
.bottom-nav .tab:active { transform: scale(.9); }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5,8,20,0.6); backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeBg .25s var(--ease);
}
@keyframes fadeBg { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  width: 100%; max-width: 620px;
  background: var(--card-solid); border: 1px solid var(--border); border-bottom: none;
  border-radius: 28px 28px 0 0;
  padding: 14px 20px calc(24px + env(safe-area-inset-bottom));
  max-height: 92vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .32s var(--ease);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
.modal-handle { width: 42px; height: 5px; border-radius: 99px; background: var(--card-hi); margin: 2px auto 14px; }
.modal-box h2 { margin: 0 0 6px; font-size: 19px; font-weight: 800; }
.modal-actions { display: flex; gap: 12px; margin-top: 24px; }
.modal-actions button { flex: 1; }

.currency-toggle {
  display: flex; gap: 6px; padding: 5px;
  background: rgba(0,0,0,0.22); border-radius: 16px; border: 1px solid var(--border);
}
.cur-btn {
  flex: 1; padding: 12px; border-radius: 12px; cursor: pointer;
  border: none; background: transparent; color: var(--muted); font-weight: 700;
  font-family: inherit; font-size: 15px; transition: all .22s var(--ease);
}
.cur-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; box-shadow: 0 6px 16px rgba(124,108,255,0.4);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%);
  background: rgba(20,26,52,0.96); color: #fff; padding: 13px 20px;
  border: 1px solid var(--border); border-radius: 14px;
  z-index: 200; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translateX(-50%); } }

@media (min-width: 620px) {
  .modal { align-items: center; }
  .modal-box { border-radius: 28px; border-bottom: 1px solid var(--border); }
}
