/* ============================================================
   CATAT KEUANGAN — style.css
   Custom CSS yang tidak praktis dibuat dengan utility Tailwind
   ============================================================ */

:root {
  --brand: #2563eb;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e6ebf2;
  --text: #0f172a;
  --muted: #64748b;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 6px 18px -6px rgba(15, 23, 42, .12);
  --shadow-lg: 0 18px 40px -18px rgba(15, 23, 42, .28);
  --radius: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html.dark {
  --bg: #0b1220;
  --surface: #111a2b;
  --surface-2: #16223a;
  --border: #1f2a3d;
  --text: #e6edf7;
  --muted: #8fa0b8;
  --shadow-md: 0 6px 18px -6px rgba(0, 0, 0, .5);
  --shadow-lg: 0 18px 40px -18px rgba(0, 0, 0, .7);
}

* { -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overscroll-behavior-y: none;
}

body { margin: 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(100,116,139,.35); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(100,116,139,.55); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Loader ---------- */
.loader-bar { animation: loaderSlide 1.1s ease-in-out infinite; }
@keyframes loaderSlide {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(60%); }
  100% { transform: translateX(220%); }
}

/* ---------- Layout ---------- */
.page { animation: pageIn .22s ease-out; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 16rem;
  display: none;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 40;
}
@media (min-width: 1024px) { .sidebar { display: flex; } }

.side-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem .85rem;
  border-radius: 12px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.side-item i { font-size: 1.05rem; }
.side-item:hover { background: var(--surface-2); color: var(--text); }
.side-item.active {
  background: linear-gradient(135deg, rgba(37,99,235,.12), rgba(37,99,235,.06));
  color: var(--brand-700);
  font-weight: 600;
}
html.dark .side-item.active { color: #93c5fd; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1rem;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
@media (min-width: 1024px) { .topbar { padding: .9rem 2rem; } }

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: .6rem .25rem .5rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: color .15s ease;
}
.nav-item i { font-size: 1.15rem; }
.nav-item.active { color: var(--brand-600); }
html.dark .nav-item.active { color: #60a5fa; }

.nav-fab {
  width: 56px; height: 56px;
  margin: -22px auto 0;
  border-radius: 50%;
  border: 4px solid var(--bg);
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  font-size: 1.4rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 22px -8px rgba(37,99,235,.75);
  cursor: pointer;
  transition: transform .15s ease;
}
.nav-fab:active { transform: scale(.94); }

.fab {
  position: fixed;
  right: 2rem; bottom: 2rem;
  z-index: 45;
  width: 58px; height: 58px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  font-size: 1.5rem;
  align-items: center; justify-content: center;
  box-shadow: 0 14px 30px -10px rgba(37,99,235,.8);
  cursor: pointer;
  transition: transform .15s ease;
}
.fab:hover { transform: translateY(-2px) scale(1.03); }
.fab:active { transform: scale(.95); }

/* ---------- Cards & typography ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow-sm);
}
@media (min-width: 768px) { .card { padding: 1.25rem; } }

.section-title {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .75rem;
}

.page-title { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }

.hero-card {
  border-radius: 22px;
  padding: 1.35rem;
  color: #fff;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.22) 0%, rgba(255,255,255,0) 55%),
    linear-gradient(135deg, #3b82f6 0%, #2563eb 45%, #1e40af 100%);
  box-shadow: 0 20px 40px -22px rgba(37,99,235,.9);
}
.hero-mini {
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 14px;
  padding: .7rem .8rem;
  backdrop-filter: blur(6px);
}

/* ---------- Forms ---------- */
.form-label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: .35rem;
  letter-spacing: .01em;
}

.form-input {
  width: 100%;
  padding: .68rem .85rem;
  font-size: .9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  font-family: inherit;
}
.form-input::placeholder { color: #9aa8bd; }
.form-input:focus {
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
html.dark .form-input { background: var(--surface-2); }

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11 3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .7rem center;
  padding-right: 2rem;
}

textarea.form-input { resize: vertical; min-height: 62px; }

.form-error {
  font-size: .78rem;
  font-weight: 500;
  color: #e11d48;
  background: rgba(225,29,72,.08);
  border: 1px solid rgba(225,29,72,.2);
  border-radius: 10px;
  padding: .5rem .7rem;
}

/* ---------- Buttons ---------- */
.btn-primary, .btn-ghost, .btn-danger, .btn-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .65rem 1rem;
  font-size: .875rem;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease, color .15s ease, border-color .15s ease;
  font-family: inherit;
  line-height: 1.1;
  white-space: nowrap;
}
.btn-primary:active, .btn-ghost:active, .btn-danger:active, .btn-soft:active { transform: scale(.975); }

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(37,99,235,.9);
}
.btn-primary:hover { box-shadow: 0 12px 24px -10px rgba(37,99,235,.95); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-soft {
  background: rgba(37,99,235,.1);
  color: var(--brand-700);
  border-color: rgba(37,99,235,.16);
}
html.dark .btn-soft { color: #93c5fd; }

.btn-danger {
  background: linear-gradient(135deg, #f43f5e, #be123c);
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(225,29,72,.9);
}

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .12s ease;
  font-size: 1rem;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.94); }

/* ---------- Segmented ---------- */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.segmented button {
  padding: .55rem .5rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
  font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
}
.segmented button.active {
  background: var(--surface);
  color: var(--brand-700);
  box-shadow: var(--shadow-sm);
}
html.dark .segmented button.active { color: #93c5fd; }

/* ---------- Switch ---------- */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background .2s ease;
}
html.dark .switch-slider { background: #334155; }
.switch-slider::before {
  content: '';
  position: absolute;
  height: 20px; width: 20px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .switch-slider { background: var(--brand-600); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

/* ---------- Chart ---------- */
.chart-wrap { position: relative; height: 240px; width: 100%; }
@media (min-width: 768px) { .chart-wrap { height: 260px; } }

.empty-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  height: 200px;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}
.empty-inline i { font-size: 1.8rem; opacity: .45; }

/* ---------- List items ---------- */
.list-item {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .8rem .9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: background .15s ease, transform .12s ease, border-color .15s ease;
}
.list-item:hover { background: var(--surface-2); }
.list-item:active { transform: scale(.995); }

.li-icon {
  width: 42px; height: 42px;
  flex: none;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .5rem;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .02em;
  border-radius: 999px;
  text-transform: uppercase;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: 2.6rem 1rem;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-state i { font-size: 2.4rem; opacity: .4; }
.empty-state h4 { font-size: .95rem; font-weight: 700; color: var(--text); }
.empty-state p { font-size: .8rem; max-width: 26rem; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .2s ease;
  overflow-y: auto;
}
.modal-overlay.show { opacity: 1; }

.modal-box {
  width: 100%;
  max-width: 26rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(.97);
  opacity: 0;
  transition: transform .22s cubic-bezier(.16,1,.3,1), opacity .22s ease;
  max-height: calc(100dvh - 2rem);
  display: flex;
  flex-direction: column;
  margin: auto;
}
.modal-overlay.show .modal-box { transform: none; opacity: 1; }
.modal-sm { max-width: 22rem; }
.modal-lg { max-width: 34rem; }

.modal-header {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: 1.15rem 1.15rem .5rem;
}
.modal-body {
  padding: .25rem 1.15rem 1rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-footer {
  display: flex;
  gap: .6rem;
  padding: .9rem 1.15rem 1.15rem;
  border-top: 1px solid var(--border);
}
.modal-footer > button { flex: 1; }

.modal-icon {
  width: 42px; height: 42px;
  flex: none;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  z-index: 200;
  left: 50%;
  transform: translateX(-50%);
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  display: flex;
  flex-direction: column;
  gap: .5rem;
  width: min(92vw, 26rem);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .75rem .85rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  font-size: .84rem;
  font-weight: 500;
  transform: translateY(-14px);
  opacity: 0;
  transition: transform .25s cubic-bezier(.16,1,.3,1), opacity .25s ease;
}
.toast.in { transform: none; opacity: 1; }
.toast i.toast-ico { font-size: 1.05rem; line-height: 1.2; flex: none; }
.toast-success i.toast-ico { color: #059669; }
.toast-error i.toast-ico { color: #e11d48; }
.toast-warning i.toast-ico { color: #d97706; }
.toast-info i.toast-ico { color: #2563eb; }
.toast-close {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: .95rem;
  line-height: 1;
  padding: 2px;
}
.toast-msg { flex: 1; word-break: break-word; }

/* ---------- Install banner ---------- */
.install-banner {
  position: fixed;
  z-index: 110;
  left: 50%;
  transform: translateX(-50%) translateY(140%);
  bottom: calc(var(--safe-bottom) + 78px);
  width: min(94vw, 26rem);
  padding: .9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  transition: transform .35s cubic-bezier(.16,1,.3,1), opacity .3s ease;
  opacity: 0;
}
.install-banner.show { transform: translateX(-50%) translateY(0); opacity: 1; }
@media (min-width: 1024px) { .install-banner { bottom: 1.5rem; left: auto; right: 1.5rem; transform: translateY(140%); } .install-banner.show { transform: translateY(0); } }

/* ---------- PIN ---------- */
.pin-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid #cbd5e1;
  transition: background .18s ease, transform .18s ease, border-color .18s ease;
}
html.dark .pin-dot { border-color: #334155; }
.pin-dot.filled { background: var(--brand-600); border-color: var(--brand-600); transform: scale(1.14); }
.pin-dot.error { background: #e11d48; border-color: #e11d48; }

.keypad-btn {
  height: 58px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, transform .1s ease;
  font-family: inherit;
}
.keypad-btn:hover { background: var(--surface-2); }
.keypad-btn:active { transform: scale(.95); background: var(--surface-2); }

.shake { animation: shake .4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

/* ---------- Amount input ---------- */
.amount-input-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
html.dark .amount-input-wrap { background: var(--surface-2); }
.amount-input-wrap:focus-within {
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.amount-input-wrap > span {
  font-size: .9rem;
  font-weight: 700;
  color: var(--muted);
}
.amount-input-wrap input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 700;
  padding: .35rem 0;
  font-family: inherit;
  min-width: 0;
}
.amount-input-wrap input::placeholder { color: #9aa8bd; font-weight: 600; }

/* ---------- Misc ---------- */
.skeleton {
  background: linear-gradient(90deg, rgba(148,163,184,.15) 25%, rgba(148,163,184,.28) 37%, rgba(148,163,184,.15) 63%);
  background-size: 400% 100%;
  animation: skeleton 1.3s ease infinite;
  border-radius: 10px;
}
@keyframes skeleton {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Print-safe fallback (bukan mekanisme utama export PDF) */
@media print {
  .sidebar, .bottom-nav, .topbar, .fab, .install-banner, .toast-root { display: none !important; }
}