/* ==========================================================================
   Petty Cash — Design Tokens
   A premium PH-fintech feel: deep navy glass surfaces, an emerald↔coral
   semantic pair for in/out flow, and a cyan-indigo gradient for primary
   actions (distinct from GCash blue, which is reserved for the Source badge).
   ========================================================================== */
:root {
  /* Color — pastel pink, premium-fintech feel */
  --bg-deep: #fdf1f7;
  --bg-deep-2: #fff8fb;
  --surface: rgba(255, 255, 255, 0.55);
  --surface-strong: rgba(255, 255, 255, 0.85);
  --surface-border: rgba(219, 39, 119, 0.14);
  --text-primary: #3b1330;
  --text-muted: #8a5a78;
  --text-faint: #c191b3;

  --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: #ec4899;
  --grad-primary: linear-gradient(135deg, #f9a8d4 0%, #ec4899 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(219, 39, 119, 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: 'Sora', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

@media (prefers-color-scheme: dark) {
  :root.theme-auto {
    --bg-deep: #2a1524;
    --bg-deep-2: #33192b;
    --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: #fbe4ef;
    --text-muted: #d6a6c3;
    --text-faint: #8a5a78;
  }
}

* { box-sizing: border-box; }
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(244, 114, 182, 0.22), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(249, 168, 212, 0.28), transparent 55%),
    var(--bg-deep);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(236, 72, 153, 0.25); }

a { color: inherit; text-decoration: none; }

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 96px;
}
@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(236, 72, 153, 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 14px;
  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(236, 72, 153, 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);
}

/* 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; }
.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(236, 72, 153, 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; }

/* ---------- 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(--emerald-soft); color: var(--emerald); }

/* ---------- 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(--surface-strong); color: var(--text-muted); }
.badge-receipt { background: rgba(99, 102, 241, 0.16); color: #a5b4fc; }

/* ---------- 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;
  border-left: 3px solid transparent;
  cursor: pointer;
}
.txn-card.cash_in { border-left-color: var(--emerald); }
.txn-card.cash_out { border-left-color: var(--coral); }
.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;
}
.sheet-overlay.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-width: 480px; margin: 0 auto;
  background: var(--bg-deep-2);
  border: 1px solid var(--surface-border);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 10px 20px 28px;
  transform: translateY(100%);
  transition: transform 360ms var(--ease);
  z-index: 91;
  max-height: 82vh;
  overflow-y: auto;
}
.sheet-overlay.open .sheet { transform: translateY(0); }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--surface-border); margin: 6px auto 18px; }

/* ---------- 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; }

/* ---------- 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); }

/* ---------- 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-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; }
}