/* ==========================================================================
   🎨 SECTION 1: GOOGLE FONTS IMPORT
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ==========================================================================
   🎨 SECTION 2: CSS RESET & DESIGN TOKENS (THEMES)
   Prinsip UX: Konsistensi visual melalui Design System Token
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root {
  /* Typography */
  --font-base: 'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Dark Theme – Neutral deep slate palette */
  --bg-color:        #0d1117;
  --panel-bg:        #161b22;
  --card-bg:         #1c2128;
  --card-bg-raised:  #21262d;
  --input-bg:        #0d1117;
  --text-primary:    #e6edf3;
  --text-secondary:  #7d8590;
  --text-muted:      #484f58;
  --border-color:    #30363d;
  --border-subtle:   #21262d;

  /* Brand */
  --primary:         #3fb950;
  --primary-dim:     #238636;
  --primary-hover:   #2ea043;
  --primary-glow:    rgba(63, 185, 80, 0.15);

  /* Chat bubbles */
  --msg-out:         #1a4731;
  --msg-in:          #1c2128;

  /* Semantics */
  --income:          #3fb950;
  --expense:         #f85149;
  --warning:         #d29922;
  --info:            #58a6ff;

  /* Nav */
  --nav-bg:          #161b22;
  --nav-active:      #3fb950;
  --nav-inactive:    #484f58;

  /* Sizing */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* Elevation shadows (dark) */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.6);

  /* Spacing scale */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;

  /* Transitions */
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:   cubic-bezier(0.4, 0, 1, 1);
  --duration:  200ms;
}

[data-theme="light"] {
  --bg-color:        #f6f8fa;
  --panel-bg:        #ffffff;
  --card-bg:         #f6f8fa;
  --card-bg-raised:  #eaeef2;
  --input-bg:        #ffffff;
  --text-primary:    #1f2328;
  --text-secondary:  #636c76;
  --text-muted:      #9198a1;
  --border-color:    #d0d7de;
  --border-subtle:   #eaeef2;

  --primary:         #1a7f37;
  --primary-dim:     #2da44e;
  --primary-hover:   #116329;
  --primary-glow:    rgba(26, 127, 55, 0.12);

  --msg-out:         #d8f3e3;
  --msg-in:          #ffffff;

  --income:          #1a7f37;
  --expense:         #cf222e;
  --warning:         #9a6700;
  --info:            #0969da;

  --nav-bg:          #ffffff;
  --nav-active:      #1a7f37;
  --nav-inactive:    #9198a1;

  --shadow-sm:  0 1px 3px rgba(31,35,40,0.12);
  --shadow-md:  0 4px 12px rgba(31,35,40,0.15);
  --shadow-lg:  0 12px 40px rgba(31,35,40,0.2);
}

/* ==========================================================================
   🎨 SECTION 3: BASE TYPOGRAPHY & GLOBAL
   ========================================================================== */
html, body {
  width: 100%;
  height: 100vh;
  overflow: hidden !important;
  position: fixed;
  max-width: 100vw !important;
  font-family: var(--font-base);
  font-size: 14px;
  line-height: 1.5;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Prevent iOS auto-zoom on inputs – UX Psychology: No interruption of flow */
input, select, textarea {
  font-size: 16px !important;
  font-family: var(--font-base);
}

/* Scrollbar polish */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: var(--radius-full); }

/* ==========================================================================
   🎨 SECTION 4: APP CONTAINER & RESPONSIVE SHELL
   ========================================================================== */
#app-container {
  width: 100%;
  max-width: 430px;
  height: 100vh;
  height: 100dvh; /* dynamic viewport height — akurat di mobile dengan address bar */
  display: flex;
  flex-direction: column;
  background-color: var(--panel-bg);
  position: relative;
  overflow: hidden;
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
}

@media (min-width: 481px) {
  #app-container {
    height: 88vh;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
  }
}

/* ==========================================================================
   🎨 SECTION 5: HEADER
   UX: Persistent context – user always knows where they are
   ========================================================================== */
header {
  background-color: var(--panel-bg);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  z-index: 20;
  min-height: 58px;
  flex-shrink: 0;
}

.header-profile {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* UX: Avatar gives human presence / reduces coldness of AI */
.avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-dim), var(--primary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.5px;
  box-shadow: 0 0 0 2px var(--primary-glow), var(--shadow-sm);
  flex-shrink: 0;
}

.header-info h1 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  line-height: 1.2;
}

/* UX: Online status dot – shows system is alive, reduces anxiety */
.header-info span {
  font-size: 10px;
  font-weight: 500;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}

.header-info span::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  background-color: var(--primary);
  border-radius: var(--radius-full);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* ==========================================================================
   🎨 SECTION 6: ICON BUTTONS
   ========================================================================== */
.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--duration) var(--ease-out),
              color var(--duration) var(--ease-out),
              transform 0.1s var(--ease-out);
  -webkit-user-select: none;
  user-select: none;
}

.icon-btn:hover {
  background-color: var(--card-bg-raised);
  color: var(--text-primary);
}

.icon-btn:active {
  transform: scale(0.92);
  background-color: var(--card-bg);
}

/* ==========================================================================
   🎨 SECTION 7: SCREEN VIEWS & VISIBILITY
   ========================================================================== */
.screen-view {
  flex: 1 1 0;     /* flex-grow:1, flex-shrink:1, flex-basis:0 */
  min-height: 0;   /* KRITIS: tanpa ini, konten panjang akan menekan nav keluar layar */
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   🎨 SECTION 8: CHAT VIEW
   UX: Familiar messaging pattern reduces learning curve
   ========================================================================== */
#chat-view {
  background-color: var(--bg-color);
  /* Subtle dot grid pattern for depth */
  background-image: radial-gradient(circle, var(--border-subtle) 1px, transparent 1px);
  background-size: 24px 24px;
}

[data-theme="light"] #chat-view {
  background-image: radial-gradient(circle, var(--border-color) 1px, transparent 1px);
}

#message-container {
  flex: 1;
  padding: var(--space-4) var(--space-4) var(--space-2);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* UX: Chunk messages in groups, visual rhythm keeps reading comfortable */
.message-bubble {
  max-width: 82%;
  padding: 9px 13px 7px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  line-height: 1.5;
  position: relative;
  word-wrap: break-word;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-base);
}

.message-bubble.incoming {
  background-color: var(--msg-in);
  align-self: flex-start;
  border-top-left-radius: 2px;
  border: 1px solid var(--border-subtle);
  animation: bubbleLeft 0.22s var(--ease-out) both;
}

.message-bubble.outgoing {
  background-color: var(--msg-out);
  align-self: flex-end;
  border-top-right-radius: 2px;
  animation: bubbleRight 0.22s var(--ease-out) both;
}

@keyframes bubbleLeft {
  from { transform: translateX(-12px) scale(0.97); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}

@keyframes bubbleRight {
  from { transform: translateX(12px) scale(0.97); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 4px;
  font-size: 9.5px;
  color: var(--text-muted);
  opacity: 0.8;
}

/* ==========================================================================
   🎨 SECTION 9: RECEIPT CARD IN BUBBLE
   ========================================================================== */
.receipt-card {
  margin-top: var(--space-2);
  border-top: 1px dashed var(--border-color);
  padding-top: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
}

.receipt-val-expense { color: var(--expense); font-weight: 600; }
.receipt-val-income  { color: var(--income);  font-weight: 600; }

.receipt-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 2px 7px;
  background-color: var(--card-bg-raised);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 500;
  margin-top: 4px;
  border: 1px solid var(--border-color);
}

/* ==========================================================================
   🎨 SECTION 10: TYPING INDICATOR
   UX: Shows AI is "thinking" – sets expectation, reduces perceived wait time
   ========================================================================== */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 11px 14px;
  background-color: var(--msg-in);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  border-top-left-radius: 2px;
  align-self: flex-start;
  width: fit-content;
  box-shadow: var(--shadow-sm);
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: var(--text-muted);
  border-radius: var(--radius-full);
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.4; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* ==========================================================================
   🎨 SECTION 11: CHAT INPUT BAR
   UX: Primary action area – must be thumb-reachable, prominent, and clean
   ========================================================================== */
.input-bar {
  background-color: var(--panel-bg);
  padding: var(--space-2) var(--space-3) var(--space-2);
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  border-top: 1px solid var(--border-color);
  padding-bottom: max(var(--space-2), env(safe-area-inset-bottom));
}

.input-wrapper {
  flex: 1;
  background-color: var(--input-bg);
  border-radius: var(--radius-xl);
  border: 1.5px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 4px 6px 4px 14px;
  gap: var(--space-2);
  transition: border-color var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out);
}

.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.chat-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  outline: none;
  padding: 7px 0;
  font-size: 14px;
  font-family: var(--font-base);
  line-height: 1.5;
  resize: none;
  min-height: 36px;
  max-height: 96px;
}

.chat-input::placeholder { color: var(--text-muted); }

/* Send button – uses primary brand colour for CTA hierarchy */
#send-msg-btn {
  width: 38px !important;
  height: 38px !important;
  border-radius: var(--radius-full) !important;
  background-color: var(--primary) !important;
  color: #fff !important;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--primary-glow);
  transition: background-color var(--duration) var(--ease-out),
              transform 0.1s var(--ease-out),
              box-shadow var(--duration) var(--ease-out);
}

#send-msg-btn:hover  { background-color: var(--primary-hover) !important; }
#send-msg-btn:active { transform: scale(0.9); }

/* ==========================================================================
   🎨 SECTION 12: IMAGE UPLOAD PREVIEW PANEL
   ========================================================================== */
.upload-preview-container {
  position: absolute;
  bottom: 68px;
  left: var(--space-3);
  right: var(--space-3);
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-md);
  z-index: 100;
  animation: slideUpFade 0.2s var(--ease-out);
}

@keyframes slideUpFade {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.preview-thumbnail {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.preview-info {
  flex: 1;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   🎨 SECTION 13: DASHBOARD / WALLET VIEW
   UX: F-pattern scan – most important info (balance) placed top-left/center
   ========================================================================== */
#dashboard-view {
  padding: var(--space-4);
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Hero balance card – highest contrast, largest type */
.wallet-card {
  background: linear-gradient(135deg, #0d4a2f 0%, #1a7f37 60%, #2ea043 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  color: #fff;
  box-shadow: 0 6px 24px rgba(26, 127, 55, 0.3), 0 1px 3px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: relative;
  overflow: hidden;
  flex-shrink: 0; /* Cegah penyusutan layout di mobile */
}

/* Decorative orb for visual richness */
.wallet-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 130px;
  height: 130px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.07);
}

.wallet-card::after {
  content: '';
  position: absolute;
  bottom: -30px;
  left: 40px;
  width: 90px;
  height: 90px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.04);
}

.wallet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1;
}

.wallet-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: 0.75;
}

/* UX: Balance number is the hero – maximal size for instant scanning */
.wallet-balance {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.3;
  padding: 4px 0;
  position: relative;
  z-index: 1;
}

.wallet-stats {
  display: flex;
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: var(--space-3);
  position: relative;
  z-index: 1;
}

.stat-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-box:first-child {
  border-right: 1px solid rgba(255,255,255,0.12);
  padding-right: var(--space-3);
}

.stat-box:last-child {
  padding-left: var(--space-4);
}

.stat-label {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.stat-value.in  { color: #a3f0b8; }
.stat-value.out { color: #ffb3ae; }

/* ==========================================================================
   🎨 SECTION 14: SECTION TITLES
   ========================================================================== */
.section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 4px;
  margin-bottom: 2px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ==========================================================================
   🎨 SECTION 15: CATEGORY BREAKDOWN
   ========================================================================== */
.categories-box {
  background-color: var(--card-bg);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  border: 1px solid var(--border-color);
  flex-shrink: 0; /* Cegah penyusutan box kategori */
}

.category-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.category-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.category-info strong {
  color: var(--text-primary);
  font-size: 11px;
}

.category-progress-bg {
  height: 5px;
  background-color: var(--input-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.category-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  width: 0;
  transition: width 0.6s var(--ease-out);
}

/* ==========================================================================
   🎨 SECTION 16: TRANSACTION CARDS
   UX: Swipe-readable cards – icon, label, amount in consistent positions
   ========================================================================== */
.transactions-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.transaction-card {
  background-color: var(--card-bg);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-3);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  animation: cardIn 0.18s var(--ease-out) both;
  transition: transform 0.15s var(--ease-out),
              box-shadow 0.15s var(--ease-out);
}

.transaction-card:active {
  transform: scale(0.985);
}

@keyframes cardIn {
  from { transform: translateY(6px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

.tx-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.tx-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.tx-badge {
  background-color: var(--card-bg-raised);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: 9px;
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.tx-amount {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: -0.3px;
}

.tx-amount.expense { color: var(--expense); }
.tx-amount.income  { color: var(--income);  }

/* ==========================================================================
   🎨 SECTION 17: SETTINGS & LOCK SCREEN
   ========================================================================== */
#settings-view {
  background-color: var(--bg-color);
}

/* UX: Centered lock screen – security ritual, deliberate and clear */
.lock-overlay {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  flex: 1;
  text-align: center;
}

.lock-icon {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--card-bg-raised), var(--card-bg));
  border: 1.5px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

.settings-form {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ==========================================================================
   🎨 SECTION 18: FORM ELEMENTS
   UX: Labels above inputs, clear affordance, generous touch targets (≥44px)
   ========================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.form-control {
  background-color: var(--input-bg);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 13px;
  color: var(--text-primary);
  outline: none;
  font-size: 14px;
  font-family: var(--font-base);
  transition: border-color var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out);
  width: 100%;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-help {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   🎨 SECTION 19: BUTTONS
   UX: Primary = 1 dominant action per screen; Danger = destructive, restrained
   ========================================================================== */
.btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 10px var(--space-4);
  font-weight: 600;
  font-size: 13.5px;
  font-family: var(--font-base);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: opacity var(--duration) var(--ease-out),
              background-color var(--duration) var(--ease-out),
              transform 0.1s var(--ease-out),
              box-shadow var(--duration) var(--ease-out);
  min-height: 40px;
  -webkit-user-select: none;
  user-select: none;
}

.btn:active { transform: scale(0.96); opacity: 0.9; }

.btn-primary {
  background-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px var(--primary-glow);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-danger {
  background-color: transparent;
  border: 1.5px solid var(--expense);
  color: var(--expense);
}

.btn-danger:hover {
  background-color: rgba(248, 81, 73, 0.08);
}

/* ==========================================================================
   🎨 SECTION 20: BOTTOM NAVIGATION BAR
   UX: 3-5 items max, thumb zone (bottom), active state clearly distinct
   ========================================================================== */
nav {
  height: 58px;
  background-color: var(--nav-bg);
  border-top: 1px solid var(--border-color);
  display: flex;
  z-index: 20;
  flex-shrink: 0;      /* nav TIDAK boleh menyusut */
  flex-grow: 0;        /* nav TIDAK boleh memanjang */
  width: 100%;         /* pastikan penuh secara horizontal */
  padding-bottom: env(safe-area-inset-bottom, 0);
  /* Pastikan nav tidak tersembunyi di belakang konten apapun */
  position: relative;
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--nav-inactive);
  cursor: pointer;
  transition: color var(--duration) var(--ease-out);
  position: relative;
  -webkit-user-select: none;
  user-select: none;
}

/* UX: Active tab indicator line at bottom – unmistakeable current position */
.nav-tab.active {
  color: var(--nav-active);
}

.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 2.5px;
  border-radius: var(--radius-full);
  background-color: var(--nav-active);
}

.nav-tab:active { opacity: 0.7; }

.nav-tab svg {
  transition: transform 0.15s var(--ease-out);
}

.nav-tab.active svg {
  transform: translateY(-1px);
}

.nav-tab span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* ==========================================================================
   🎨 SECTION 21: EMPTY STATES
   UX: Friendly empty state reduces frustration; uses illustration + brief copy
   ========================================================================== */
.empty-state {
  padding: 40px var(--space-5);
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  font-size: 13px;
}

.empty-state svg {
  opacity: 0.2;
}

/* ==========================================================================
   🎨 SECTION 22: SPLASH / LOADING SCREEN ANIMATION
   ========================================================================== */
@keyframes pulseGlow {
  0%, 100% {
    transform: scale(0.96);
    opacity: 0.85;
    text-shadow: 0 0 8px rgba(63, 185, 80, 0.25);
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
    text-shadow: 0 0 28px rgba(63, 185, 80, 0.6);
  }
}

/* ==========================================================================
   🎨 SECTION 23: MISC UTILITY ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUpFadeIn {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
