/* ==========================================================================
   Petty Cash (AC fund) — Design Tokens
   Blue variant of the Petty Cash design system — same emerald↔coral
   semantic pair for in/out flow, blue primary accent instead of pink.
   The accent blue is intentionally a different shade from --gcash-blue
   so the GCash source badge still reads as its own thing.
   ========================================================================== */
:root {
  /* Color — pastel blue, premium-fintech feel */
  --bg-deep: #eff6ff;
  --bg-deep-2: #f5f9ff;
  --surface: rgba(255, 255, 255, 0.55);
  --surface-strong: rgba(255, 255, 255, 0.85);
  --surface-border: rgba(59, 130, 246, 0.14);
  --text-primary: #1e3a5f;
  --text-muted: #5b7c99;
  --text-faint: #9db8d1;

  --emerald: #12b886;
  --emerald-soft: rgba(18, 184, 134, 0.14);
  --coral: #e0396b;
  --coral-soft: rgba(224, 57, 107, 0.14);
  --gcash-blue: #1174e0;
  --gcash-blue-soft: rgba(17, 116, 224, 0.12);

  --accent: #2563eb;
  --grad-primary: linear-gradient(135deg, #93c5fd 0%, #2563eb 100%);
  --grad-emerald: linear-gradient(135deg, #6ee7b7 0%, #10b981 100%);
  --grad-coral: linear-gradient(135deg, #fda4c0 0%, #e0396b 100%);

  /* Radius / shadow / motion */
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;
  --shadow-soft: 0 8px 30px rgba(59, 130, 246, 0.10);
  --shadow-glow-emerald: 0 0 0 1px rgba(18, 184, 134, 0.25), 0 8px 24px rgba(18, 184, 134, 0.15);
  --shadow-glow-coral: 0 0 0 1px rgba(224, 57, 107, 0.25), 0 8px 24px rgba(224, 57, 107, 0.15);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 300ms;

  /* Type */
  --font-display: 'Lexend', 'Segoe UI', sans-serif;
  --font-body: 'Lexend', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

@media (prefers-color-scheme: dark) {
  :root.theme-auto {
    --bg-deep: #0f1f33;
    --bg-deep-2: #142a42;
    --surface: rgba(255, 255, 255, 0.06);
    --surface-strong: rgba(255, 255, 255, 0.10);
    --surface-border: rgba(255, 255, 255, 0.12);
    --text-primary: #dbeafe;
    --text-muted: #93b4d1;
    --text-faint: #5b7c99;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
a, button, input, textarea, select, [role="button"], .glass-card, .stat-pick-card, .purpose-card, .filter-pill, .filter-chip, .dropdown-item {
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
html {
  min-height: 100%;
  background: var(--bg-deep);
}
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text-primary);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(96, 165, 250, 0.22), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(147, 197, 253, 0.28), transparent 55%),
    var(--bg-deep);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(37, 99, 235, 0.25); }

/* ---------- Decorative floating hearts (side margins) — recolored blue ---------- */
.bg-hearts {
  position: fixed; inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.bg-heart {
  position: absolute;
  top: 100%;
  color: rgba(37, 99, 235, 0.16);
  animation: bg-heart-float linear infinite;
}
.bg-heart.h1  { width: 20px; animation-duration: 22s; animation-delay: 0s; }
.bg-heart.h2  { width: 14px; animation-duration: 17s; animation-delay: 2.4s; }
.bg-heart.h3  { width: 24px; animation-duration: 26s; animation-delay: 5s; }
.bg-heart.h4  { width: 16px; animation-duration: 19s; animation-delay: 1s; }
.bg-heart.h5  { width: 22px; animation-duration: 23s; animation-delay: 8s; }
.bg-heart.h6  { width: 13px; animation-duration: 16s; animation-delay: 3.5s; }
.bg-heart.h7  { width: 26px; animation-duration: 27s; animation-delay: 10s; }
.bg-heart.h8  { width: 15px; animation-duration: 18s; animation-delay: 6.5s; }
.bg-heart.h9  { width: 21px; animation-duration: 24s; animation-delay: 12s; }
.bg-heart.h10 { width: 17px; animation-duration: 20s; animation-delay: 4s; }
.bg-heart.h11 { width: 19px; animation-duration: 21s; animation-delay: 14s; }
.bg-heart.h12 { width: 15px; animation-duration: 17.5s; animation-delay: 7s; }
.bg-heart.h13 { width: 23px; animation-duration: 25s; animation-delay: 9.5s; }
.bg-heart.h14 { width: 18px; animation-duration: 19.5s; animation-delay: 13s; }
@keyframes bg-heart-float {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(-115vh) translateX(14px) rotate(20deg); opacity: 0; }
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 96px;
  position: relative;
  z-index: 1;
}
@media (min-width: 900px) {
  .container { max-width: 720px; padding: 32px 24px 96px; }
}

/* ---------- Glass surfaces ---------- */
.glass-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-lg);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow-soft);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.glass-card:hover { background: var(--surface-strong); }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 20px;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; color: #ffffff;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
}

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: 16px;
  width: calc(100% - 32px);
  max-width: 448px;
  display: flex;
  justify-content: space-around;
  padding: 10px 8px;
  border-radius: 22px;
  background: rgba(255, 248, 251, 0.75);
  border: 1px solid var(--surface-border);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: var(--shadow-soft);
  z-index: 40;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 10px;
  border-radius: 14px;
  color: var(--text-faint);
  font-size: 11px;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease), transform 150ms var(--ease);
}
.nav-item svg { width: 20px; height: 20px; }
.nav-item.active { color: var(--text-primary); background: var(--surface-strong); }
.nav-item:active { transform: scale(0.92); }

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  overflow: hidden;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  border-radius: var(--r-md);
  padding: 14px 20px;
  font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 150ms var(--ease), box-shadow var(--dur) var(--ease), opacity var(--dur);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn-primary {
  background: var(--grad-primary);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3);
  width: 100%;
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
}
.btn-icon {
  width: 44px; height: 44px; padding: 0; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--surface-border); color: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
}

/* Ripple */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transform: scale(0);
  animation: ripple-anim 600ms var(--ease);
  pointer-events: none;
}
@keyframes ripple-anim {
  to { transform: scale(3.2); opacity: 0; }
}

/* ---------- Segmented control (Cash In / Cash Out) ---------- */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-md);
  padding: 6px;
  position: relative;
}
.segmented input { display: none; }
.segmented label {
  position: relative;
  z-index: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 10px;
  border-radius: 12px;
  font-weight: 600; font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}
.segmented input:checked + label { color: #ffffff; }
.segmented input#type_in:checked ~ .segmented-thumb { transform: translateX(0); background: var(--grad-emerald); }
.segmented input#type_out:checked ~ .segmented-thumb { transform: translateX(100%); background: var(--grad-coral); }
.segmented-thumb {
  position: absolute;
  top: 6px; left: 6px;
  width: calc(50% - 6px); height: calc(100% - 12px);
  border-radius: 12px;
  background: var(--grad-emerald);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}

/* ---------- Currency input ---------- */
.currency-field {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  padding: 28px 16px;
}
.currency-field .peso {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--text-faint);
  vertical-align: top;
  position: relative;
  top: 14px;
}
.currency-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 44px;
  text-align: center;
  width: auto;
  max-width: 75%;
  caret-color: var(--accent);
}
.currency-input::placeholder { color: var(--text-faint); }

/* ---------- Floating label fields ---------- */
.field { position: relative; margin-bottom: 16px; }
.checkbox-field {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-md);
  font-size: 14px; font-weight: 500; color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}
.checkbox-field input[type="checkbox"] {
  width: 20px; height: 20px; flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.field input[type="text"],
.field input[type="tel"],
.field textarea,
.field .fake-select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-md);
  padding: 20px 16px 8px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
  transition: border var(--dur) var(--ease), background var(--dur) var(--ease);
  resize: none;
}
.field textarea { min-height: 84px; padding-top: 22px; }
.field input:focus,
.field textarea:focus,
.field.open .fake-select {
  border-color: rgba(37, 99, 235, 0.45);
  background: var(--surface-strong);
}
.field label {
  position: absolute;
  left: 16px; top: 18px;
  color: var(--text-faint);
  font-size: 15px;
  pointer-events: none;
  transition: transform var(--dur) var(--ease), font-size var(--dur) var(--ease), color var(--dur) var(--ease), top var(--dur) var(--ease);
  transform-origin: left top;
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field textarea:focus + label,
.field textarea:not(:placeholder-shown) + label,
.field.filled label,
.field.open label {
  top: 9px;
  font-size: 11px;
  color: var(--accent);
}
.field.low-confidence input,
.field.low-confidence .fake-select {
  border-color: rgba(251, 191, 36, 0.55);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.12);
}
.field-hint {
  font-size: 11px;
  color: #fbbf24;
  margin-top: 4px;
  padding-left: 4px;
  display: none;
}
.field.low-confidence .field-hint { display: block; }

/* ---------- Purpose picker (stat-card grid, shared by Add Log + Settings) ---------- */
.purpose-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-height: 212px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
@media (min-width: 480px) {
  .purpose-grid { grid-template-columns: repeat(4, 1fr); }
}
.purpose-grid::-webkit-scrollbar { width: 6px; }
.purpose-grid::-webkit-scrollbar-track { background: transparent; }
.purpose-grid::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 999px; }
.purpose-grid::-webkit-scrollbar-thumb:hover { background: #1d4ed8; }
.purpose-card {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 12px 6px;
  background: var(--surface);
  border: 1.5px solid var(--surface-border);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: center;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform 150ms var(--ease);
}
.purpose-card:active { transform: scale(0.95); }
.purpose-card-icon {
  width: 38px; height: 38px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-strong); color: var(--text-muted);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.purpose-card-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); line-height: 1.25; word-break: break-word; }
.purpose-card.active { background: var(--accent-soft, rgba(37, 99, 235, 0.1)); border-color: rgba(37, 99, 235, 0.45); }
.purpose-card.active .purpose-card-icon { background: var(--accent); color: #fff; }
.purpose-card.active .purpose-card-label { color: var(--accent); }
.purpose-card-delete {
  position: relative;
  align-self: flex-end;
  margin: -6px -4px -2px 0;
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(224, 57, 107, 0.12); color: var(--coral);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.purpose-card-delete:hover { background: var(--coral); color: #fff; transform: scale(1.1); }
.purpose-card-delete:active { transform: scale(0.88); }
.purpose-card.removing {
  animation: purpose-card-remove 260ms ease forwards;
  pointer-events: none;
}
@keyframes purpose-card-remove {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.7); }
}

/* ---------- Icon picker (Settings — Add Purpose) ---------- */
.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
.icon-picker-grid::-webkit-scrollbar { width: 6px; }
.icon-picker-grid::-webkit-scrollbar-track { background: transparent; }
.icon-picker-grid::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 999px; }
.icon-picker-grid::-webkit-scrollbar-thumb:hover { background: #1d4ed8; }
.icon-picker-option {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1.5px solid var(--surface-border);
  color: var(--text-muted); cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform 150ms var(--ease);
}
.icon-picker-option:active { transform: scale(0.9); }
.icon-picker-option.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Custom dropdown ---------- */
.fake-select { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; }
.fake-select .chevron { transition: transform var(--dur) var(--ease); color: var(--text-faint); }
.field.open .fake-select .chevron { transform: rotate(180deg); }

/* Standalone fake-select with its own static label above (e.g. Date field)
   doesn't need the floating-label top padding — keep it vertically centered. */
#date-field .fake-select { padding: 15px 16px; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg-deep-2);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  z-index: 30;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
}
.field.open .dropdown-menu { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  font-size: 14px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background 150ms var(--ease);
}
.dropdown-item:hover { background: var(--surface-strong); }
.dropdown-item.active { background: var(--accent-soft, rgba(37, 99, 235, 0.12)); color: var(--accent); }

/* ---------- Suggestion chips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 16px; }
.chip {
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 150ms var(--ease);
}
.chip:hover, .chip:active { background: var(--grad-primary); color: #ffffff; border-color: transparent; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-gcash { background: var(--gcash-blue-soft); color: #5cb0ff; }
.badge-cash { background: var(--accent-soft, rgba(37, 99, 235, 0.12)); color: var(--accent); }
.badge-receipt { background: rgba(99, 102, 241, 0.16); color: #a5b4fc; }

/* ---------- Department badges (colors match each dept's Expense Log theme) ---------- */
.badge-dept-it { background: rgba(148, 163, 184, 0.18); color: #64748b; }
.badge-dept-admin { background: rgba(251, 146, 60, 0.16); color: #ea7f1f; }
.badge-dept-marketing { background: rgba(96, 165, 250, 0.16); color: #3b82f6; }
.badge-dept-dispatch { background: rgba(74, 222, 128, 0.18); color: #16a34a; }
.badge-dept-production { background: rgba(253, 224, 71, 0.25); color: #ca8a04; }

/* ---------- Dashboard summary cards ---------- */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.summary-card {
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.summary-card .label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.summary-card .value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.summary-card.balance { grid-column: 1 / -1; padding: 24px; }
.summary-card.balance .value { font-size: 34px; }
.summary-card.in .value { color: var(--emerald); }
.summary-card.out .value { color: var(--coral); }
.summary-card .glow {
  position: absolute; width: 140px; height: 140px; border-radius: 50%;
  filter: blur(50px); opacity: 0.35; top: -40px; right: -40px;
}
.summary-card.in .glow { background: var(--emerald); }
.summary-card.out .glow { background: var(--coral); }
.summary-card.balance .glow { background: var(--accent); }

/* ---------- Split stat switcher (CASH | GCASH toggle, glued together) ---------- */
.split-stat-card {
  display: flex;
  position: relative;
  padding: 5px;
  margin-bottom: 14px;
  overflow: hidden;
}
.split-stat-half {
  flex: 1;
  position: relative;
  z-index: 1;
  padding: 13px 14px;
  cursor: pointer;
  border-radius: calc(var(--r-lg) - 5px);
}
.split-stat-half .switch-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  transition: color var(--dur) var(--ease);
}
.split-stat-half.active .switch-text { color: #ffffff; }
.split-stat-thumb {
  position: absolute;
  top: 5px; left: 5px;
  width: calc(50% - 5px);
  height: calc(100% - 10px);
  border-radius: calc(var(--r-lg) - 5px);
  background: var(--grad-primary);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), opacity var(--dur) var(--ease);
  z-index: 0;
  opacity: 0;
}
.split-stat-thumb.show { opacity: 1; }
.split-stat-thumb.pos-gcash { transform: translateX(100%); background: linear-gradient(135deg, #7dd3fc 0%, #1174e0 100%); }

/* ---------- Create Log wizard ---------- */
.wizard-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 16px;
}
.wizard-back:hover { color: var(--text-primary); }
.source-pick .split-stat-half { padding: 26px 14px; }
.source-pick .switch-text { flex-direction: column; gap: 10px; font-size: 14px; }

/* ---------- Stat-card style pickers (Source / Type) — tap to advance, no continue button ---------- */
.wizard-step-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  color: var(--text-primary);
  margin: 0 0 14px 2px;
}
.stat-pick-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}
.stat-pick-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 20px;
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--surface-border);
  transition: border-color var(--dur) var(--ease), transform 150ms var(--ease), background var(--dur) var(--ease);
}
.stat-pick-card:active { transform: scale(0.98); }
.stat-pick-card .glow {
  position: absolute; width: 140px; height: 140px; border-radius: 50%;
  filter: blur(50px); opacity: 0; top: -40px; right: -40px;
  transition: opacity var(--dur) var(--ease);
}
.stat-pick-card .stat-pick-icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-strong);
  color: var(--text-muted);
  position: relative; z-index: 1;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.stat-pick-card .stat-pick-text {
  position: relative; z-index: 1;
}
.stat-pick-card .stat-pick-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  transition: color var(--dur) var(--ease);
}
.stat-pick-card .stat-pick-sub {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 3px;
}
.stat-pick-card .stat-pick-chevron {
  margin-left: auto;
  color: var(--text-faint);
  position: relative; z-index: 1;
  flex-shrink: 0;
  transition: color var(--dur) var(--ease), transform 150ms var(--ease);
}
.stat-pick-card.active .stat-pick-chevron { color: var(--text-primary); transform: translateX(2px); }
.stat-pick-card.cash .stat-pick-icon { color: var(--accent); }
.stat-pick-card.gcash .stat-pick-icon { color: var(--gcash-blue); }
.stat-pick-card.cash_in .stat-pick-icon { color: var(--emerald); }
.stat-pick-card.cash_out .stat-pick-icon { color: var(--coral); }
.stat-pick-card.cash .glow { background: var(--accent); }
.stat-pick-card.gcash .glow { background: var(--gcash-blue); }
.stat-pick-card.cash_in .glow { background: var(--emerald); }
.stat-pick-card.cash_out .glow { background: var(--coral); }

.stat-pick-card.active { border-color: transparent; }
.stat-pick-card.active .glow { opacity: 0.35; }
.stat-pick-card.active .stat-pick-label { color: var(--text-primary); }
.stat-pick-card.cash.active .stat-pick-icon { background: var(--grad-primary); color: #ffffff; }
.stat-pick-card.gcash.active .stat-pick-icon { background: linear-gradient(135deg, #7dd3fc 0%, #1174e0 100%); color: #ffffff; }
.stat-pick-card.cash_in.active .stat-pick-icon { background: var(--grad-emerald); color: #ffffff; }
.stat-pick-card.cash_out.active .stat-pick-icon { background: var(--grad-coral); color: #ffffff; }

/* ---------- Custom Range Cash In/Out toggle (Any Time / Today / etc.) ---------- */

/* ---------- Transaction card ---------- */
.txn-card {
  display: flex;
  gap: 12px;
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
}
.txn-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.txn-card.cash_in .txn-icon { background: var(--emerald-soft); color: var(--emerald); }
.txn-card.cash_out .txn-icon { background: var(--coral-soft); color: var(--coral); }
.txn-main { flex: 1; min-width: 0; }
.txn-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.txn-purpose { font-weight: 600; font-size: 14.5px; }
.txn-amount { font-family: var(--font-display); font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.txn-card.cash_in .txn-amount { color: var(--emerald); }
.txn-card.cash_out .txn-amount { color: var(--coral); }
.txn-meta { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 12px; color: var(--text-faint); flex-wrap: wrap; }
.txn-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 320ms var(--ease), margin-top 320ms var(--ease);
  margin-top: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  width: 100%;
}
.txn-card.expanded .txn-details { max-height: 200px; margin-top: 10px; }
.txn-details .row { display: flex; justify-content: space-between; padding: 4px 0; border-top: 1px solid var(--surface-border); }
.txn-details .row:first-child { border-top: none; }

/* ---------- Bottom sheet ---------- */
.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(59, 19, 48, 0.35);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
  z-index: 90;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-overlay.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: relative;
  width: 100%; max-width: 480px;
  background: var(--bg-deep-2);
  border: 1px solid var(--surface-border);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 10px 20px 28px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--dur) var(--ease);
}
.sheet-overlay.open .sheet { transform: translateY(0); }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--surface-border); margin: 6px auto 18px; cursor: grab; touch-action: none; }
.sheet.dragging { transition: none; }

@media (min-width: 641px) {
  .sheet-overlay { align-items: center; padding: 32px; }
  .sheet {
    max-width: min(480px, 92vw);
    border: 1px solid var(--surface-border);
    border-radius: 24px;
    padding: 20px 24px 28px;
    transform: translateY(14px) scale(0.96);
    opacity: 0;
    transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
  }
  .sheet-overlay.open .sheet { transform: translateY(0) scale(1); opacity: 1; }
  .sheet-handle { display: none; }
}

/* ---------- Custom date picker ---------- */
.datepicker-popup {
  width: 300px;
  padding: 16px;
  z-index: 95;
}
.dp-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.dp-title { font-family: var(--font-display); font-weight: 700; font-size: 14.5px; display: flex; gap: 6px; cursor: pointer; }
.dp-nav-btn {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--surface-border);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--text-primary);
  transition: background 150ms var(--ease), transform 150ms var(--ease);
}
.dp-nav-btn:active { transform: scale(0.9); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dp-dow { text-align: center; font-size: 10.5px; color: var(--text-faint); padding-bottom: 6px; }
.dp-day {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-primary);
  transition: background 150ms var(--ease), color 150ms var(--ease), transform 150ms var(--ease);
}
.dp-day:hover { background: var(--surface-strong); }
.dp-day.muted { color: var(--text-faint); opacity: 0.4; }
.dp-day.today { box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); font-weight: 700; }
.dp-day.selected { background: var(--grad-primary); color: #ffffff; font-weight: 700; }
.dp-footer { display: flex; justify-content: space-between; margin-top: 14px; }
.dp-today-btn { font-size: 12.5px; color: var(--accent); cursor: pointer; padding: 6px 10px; }
.dp-year-select {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}
.dp-year-select.open { display: grid; }
.dp-year-item {
  padding: 10px 0; text-align: center; border-radius: 10px; font-size: 13px; cursor: pointer;
  background: var(--surface);
}
.dp-year-item.selected { background: var(--grad-primary); color: #ffffff; font-weight: 700; }

/* ---------- Skeleton loader ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-strong) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: 10px;
}
@keyframes skeleton-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------- Recent activity loading overlay (keeps cards intact while switching) ---------- */
.recent-loading-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 8, 20, 0.06);
  backdrop-filter: blur(2px);
  border-radius: var(--r-lg);
  opacity: 0; pointer-events: none;
  transition: opacity 200ms var(--ease);
  z-index: 5;
}
.recent-loading-overlay.show { opacity: 1; pointer-events: auto; }
.recent-spinner {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 3px solid var(--surface-border);
  border-top-color: var(--accent);
  animation: recent-spin 700ms linear infinite;
}
@keyframes recent-spin { to { transform: rotate(360deg); } }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty-state .icon-wrap {
  width: 72px; height: 72px; margin: 0 auto 16px;
  border-radius: 20px;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint);
}
.empty-state h3 { color: var(--text-primary); font-family: var(--font-display); margin: 0 0 6px; }
.empty-state p { margin: 0; font-size: 13.5px; }

/* ---------- Success overlay ---------- */
.success-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(59, 19, 48, 0.55);
  backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
  transition: opacity 250ms var(--ease);
}
.success-overlay.show { opacity: 1; pointer-events: auto; }
.success-card { text-align: center; }
.success-ring {
  width: 92px; height: 92px; border-radius: 50%;
  background: var(--grad-emerald);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px;
  transform: scale(0);
  animation: success-pop 520ms var(--ease) forwards;
  box-shadow: 0 0 40px rgba(18, 216, 150, 0.5);
}
.success-ring.out { background: var(--grad-coral); box-shadow: 0 0 40px rgba(251, 113, 133, 0.5); }
@keyframes success-pop { 0% { transform: scale(0); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
.success-ring svg { width: 42px; height: 42px; stroke: #ffffff; }
.success-text { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: #ffffff; }

/* ---------- Receipt card ---------- */
.receipt-preview { position: relative; overflow: hidden; padding: 0; }
.receipt-preview img { width: 100%; display: block; border-radius: var(--r-lg); }
.receipt-actions {
  position: absolute; top: 10px; right: 10px;
  display: flex; gap: 6px;
}
.receipt-actions .btn-icon { width: 34px; height: 34px; background: rgba(4, 8, 20, 0.55); border-color: rgba(255,255,255,0.15); }

#receipt-result { margin-bottom: 18px; }

/* ---------- Upload loading overlay (3D flip-letter animation) ---------- */
.upload-overlay {
  position: fixed; inset: 0;
  background: rgba(8, 4, 12, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 3000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 24px;
}
.upload-overlay.active { opacity: 1; visibility: visible; }

.upload-loading-scene {
  --uls-size: clamp(22px, 8vw, 42px);
  --uls-perspective: 320;
  --uls-duration: 1.7;
  --uls-stagger: 0.09;
  --uls-ease: cubic-bezier(1, -0.52, .26, .89);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  perspective: calc(var(--uls-perspective) * 1px);
}
.upload-loading-word {
  display: flex;
  transform: translate(calc(var(--uls-size) * 0.7), 0) rotateX(-30deg) rotateY(45deg);
  transform-style: preserve-3d;
}
.upload-loading-letter-wrap {
  animation: uls-jump calc(var(--uls-duration) * 1s) calc(var(--uls-stagger) * var(--uls-i, 0) * 1s) var(--uls-ease) infinite;
  transform-origin: bottom center;
  transform-style: preserve-3d;
}
.upload-loading-letter-wrap .upload-loading-letter {
  animation: uls-rotate calc(var(--uls-duration) * 4s) calc(var(--uls-stagger) * var(--uls-i, 0) * 1s) ease infinite;
}
.upload-loading-letter {
  color: var(--accent);
  font-family: var(--font-display, inherit);
  font-size: calc(var(--uls-size) * 0.5);
  font-weight: 700;
  height: var(--uls-size);
  margin-right: calc(var(--uls-size) * 0.22);
  position: relative;
  text-transform: uppercase;
  transform-style: preserve-3d;
  width: var(--uls-size);
}
.upload-loading-panel {
  align-items: center;
  background: #eff6ff;
  border: max(2px, calc(var(--uls-size) * 0.06)) solid var(--accent);
  border-radius: 5px;
  display: flex;
  height: var(--uls-size);
  justify-content: center;
  left: 50%; top: 50%;
  position: absolute;
  width: var(--uls-size);
}
.upload-loading-panel:nth-of-type(1) { transform: translate3d(-50%, -50%, 0) translate3d(0, 0, calc(var(--uls-size) * 0.5)); }
.upload-loading-panel:nth-of-type(2) { transform: translate3d(-50%, -50%, 0) rotateX(90deg) translate3d(0, 0, calc(var(--uls-size) * 0.5)); }
.upload-loading-panel:nth-of-type(3) { transform: translate3d(-50%, -50%, 0) rotateX(180deg) translate3d(0, 0, calc(var(--uls-size) * 0.5)); }
.upload-loading-panel:nth-of-type(4) { transform: translate3d(-50%, -50%, 0) rotateX(-90deg) translate3d(0, 0, calc(var(--uls-size) * 0.5)); }
.upload-loading-panel:nth-of-type(5) { transform: translate3d(-50%, -50%, 0) rotateY(-90deg) translate3d(0, 0, calc(var(--uls-size) * 0.5)); }
@keyframes uls-rotate {
  0%, 30.625%  { transform: rotateX(0deg); }
  33.125%, 81.625% { transform: rotateX(90deg); }
  83.125%, 100% { transform: rotateX(180deg); }
}
@keyframes uls-jump {
  0%, 50%, 100% { transform: scaleX(1) scaleY(1) translate(0, 0); }
  15% { transform: scaleX(1.2) scaleY(0.8) translate(0, 0); }
  25% { transform: scaleX(0.9) scaleY(1.1) translate(0, -100%); }
}
.receipt-uploaded { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.receipt-uploaded-check {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: var(--emerald-soft); color: var(--emerald);
  display: flex; align-items: center; justify-content: center;
}
.receipt-uploaded-info { flex: 1; min-width: 0; }
.receipt-uploaded-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.receipt-uploaded-sub { font-size: 11px; color: var(--text-faint); margin-top: 1px; }
.receipt-uploaded-actions { display: flex; gap: 6px; flex-shrink: 0; }
.receipt-uploaded-actions .btn-icon {
  width: 32px; height: 32px; border-radius: 9px;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.receipt-uploaded-actions .btn-icon:active { transform: scale(0.9); }
.receipt-uploaded-actions .btn-icon[data-action="fullscreen"]:hover { background: var(--surface-strong); }
.receipt-uploaded-actions .btn-icon[data-action="replace"] { color: var(--accent); }
.receipt-uploaded-actions .btn-icon[data-action="replace"]:hover { background: rgba(37, 99, 235, 0.12); border-color: rgba(37, 99, 235, 0.4); }
.receipt-uploaded-actions .btn-icon[data-action="delete"] { color: var(--coral); }
.receipt-uploaded-actions .btn-icon[data-action="delete"]:hover { background: rgba(224, 57, 107, 0.12); border-color: rgba(224, 57, 107, 0.4); }

/* ---------- Image viewer — bottom sheet on mobile, centered modal on desktop ---------- */
.img-viewer-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 6, 14, 0.86);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 4000;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.img-viewer-overlay.open { opacity: 1; visibility: visible; }
.img-viewer-close {
  position: absolute; top: 16px; right: 16px;
  width: 38px; height: 38px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 2;
}
.img-viewer-close:hover { background: rgba(255, 255, 255, 0.2); }
.img-viewer-body {
  position: relative;
  width: 100%; max-width: 480px;
  background: var(--bg-deep-2);
  border-radius: 24px 24px 0 0;
  padding: 12px 14px 24px;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(.32, .72, 0, 1);
  display: flex; flex-direction: column; align-items: center;
}
.img-viewer-overlay.open .img-viewer-body { transform: translateY(0); }
.img-viewer-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--surface-border); margin: 2px auto 14px; }
.img-viewer-body img { max-width: 100%; max-height: 65vh; border-radius: 14px; object-fit: contain; display: block; opacity: 0; transition: opacity 0.25s ease; }
.img-viewer-body img.loaded { opacity: 1; }
.img-viewer-spinner {
  width: 32px; height: 32px; margin: 30px auto;
  border: 3px solid var(--surface-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: img-viewer-spin 0.7s linear infinite;
}
@keyframes img-viewer-spin { to { transform: rotate(360deg); } }

@media (min-width: 641px) {
  .img-viewer-overlay { align-items: center; padding: 32px; }
  .img-viewer-body {
    max-width: min(560px, 90vw);
    border-radius: 20px;
    padding: 20px;
    transform: translateY(14px) scale(0.96);
  }
  .img-viewer-overlay.open .img-viewer-body { transform: translateY(0) scale(1); }
  .img-viewer-handle { display: none; }
  .img-viewer-body img { max-height: 80vh; }
}

/* ---------- Utility ---------- */
.section-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; margin: 22px 0 10px 4px; color: var(--text-primary); }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.filter-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: none; }
.filter-scroll::-webkit-scrollbar { display: none; }

.filter-dropdowns { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.filter-dropdowns .filter-field { flex: 1; min-width: 140px; margin-bottom: 0; }
.filter-dropdowns .filter-field > label {
  position: static; display: block; margin-bottom: 6px;
  font-size: 11px; color: var(--text-faint);
}
.filter-dropdowns .fake-select { padding: 13px 14px; }
.filter-pill {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 150ms var(--ease);
  white-space: nowrap;
}
.filter-pill.active { background: var(--grad-primary); color: #ffffff; border-color: transparent; font-weight: 600; }
.search-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
}
.search-bar input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text-primary); font-size: 14.5px;
}
.search-bar svg { color: var(--text-faint); flex-shrink: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- Request Edit / Request Delete (history cards) ---------- */
.txn-request-actions {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--surface-border);
}
.btn-icon-request {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  background: var(--surface-strong);
  color: var(--text-muted);
  cursor: pointer;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn-icon-request:hover {
  transform: translateY(-2px) scale(1.06);
  background: var(--gcash-blue-soft);
  color: var(--gcash-blue);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(17, 116, 224, 0.18);
}
.btn-icon-request:active { transform: translateY(0) scale(0.96); }
.btn-icon-request-delete:hover {
  background: var(--coral-soft);
  color: var(--coral);
  box-shadow: var(--shadow-glow-coral);
}

/* ---------- Wider drag-to-close zone on bottom sheets (mobile) ---------- */
@media (max-width: 640px) {
  .sheet { padding-top: 6px; }
  .sheet-handle { margin: 8px auto 16px; cursor: grab; }
}

.req-field-checklist { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; }
.req-field-check {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px; font-size: 14px; color: var(--text-primary);
  border-bottom: 1px solid var(--surface-border);
  cursor: pointer;
}
.req-field-check:last-child { border-bottom: none; }
.req-field-check input { width: 18px; height: 18px; accent-color: var(--accent); }
/* ---------- Custom confirm dialog (themed replacement for browser confirm()) ---------- */
.confirm-sheet { text-align: center; padding-top: 6px; }
.confirm-icon {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 4px auto 14px;
  background: var(--coral-soft); color: var(--coral);
}
.confirm-icon:not(.danger) { background: var(--accent-soft, var(--surface)); color: var(--accent); }
.confirm-title { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--text-primary); margin-bottom: 8px; }
.confirm-message { font-size: 14px; line-height: 1.55; color: var(--text-muted); margin-bottom: 22px; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { width: auto; flex: 1; padding: 13px 16px; font-size: 14.5px; }
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--surface-border);
}