/* ====================================================
   SpendWise — Premium Dark Fintech Dashboard
   Design: Clean, professional, hackathon-ready
   ==================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ===== Design Tokens ===== */
:root {
  /* Brand Colors */
  --brand-primary:    #6366f1;   /* Indigo */
  --brand-secondary:  #8b5cf6;   /* Violet */
  --brand-accent:     #06b6d4;   /* Cyan */
  --brand-gradient:   linear-gradient(135deg, #6366f1, #8b5cf6);

  /* Semantic Colors */
  --color-income:     #10b981;   /* Emerald */
  --color-expense:    #f43f5e;   /* Rose */
  --color-warning:    #f59e0b;   /* Amber */
  --color-info:       #06b6d4;   /* Cyan */

  /* Background System */
  --bg-base:          #09090b;   /* Near-black zinc */
  --bg-elevated:      #111113;
  --bg-card:          #18181b;   /* Zinc-900 */
  --bg-card-hover:    #1f1f23;
  --bg-input:         #141418;
  --bg-overlay:       rgba(0, 0, 0, 0.8);

  /* Surface & Borders */
  --surface-1:        rgba(255,255,255,0.03);
  --surface-2:        rgba(255,255,255,0.06);
  --surface-3:        rgba(255,255,255,0.09);
  --border-subtle:    rgba(255,255,255,0.06);
  --border-default:   rgba(255,255,255,0.1);
  --border-strong:    rgba(255,255,255,0.16);
  --border-brand:     rgba(99,102,241,0.4);

  /* Text */
  --text-primary:     #fafafa;
  --text-secondary:   #a1a1aa;
  --text-tertiary:    #71717a;
  --text-muted:       #52525b;
  --text-brand:       #818cf8;

  /* Shadows */
  --shadow-sm:        0 1px 2px rgba(0,0,0,0.4);
  --shadow-md:        0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:        0 8px 32px rgba(0,0,0,0.5);
  --shadow-xl:        0 20px 60px rgba(0,0,0,0.6);
  --glow-brand:       0 0 24px rgba(99,102,241,0.25);
  --glow-income:      0 0 20px rgba(16,185,129,0.2);
  --glow-expense:     0 0 20px rgba(244,63,94,0.2);

  /* Fonts */
  --font-display:     'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body:        'Inter', system-ui, sans-serif;
  --font-mono:        'JetBrains Mono', 'Courier New', monospace;

  /* Radii */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   18px;
  --radius-2xl:  24px;
  --radius-full: 999px;

  /* Sidebar */
  --sidebar-width: 256px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* ===== Background: Subtle gradient mesh ===== */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(99,102,241,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 10%, rgba(139,92,246,0.05) 0%, transparent 50%),
    radial-gradient(ellipse 70% 40% at 50% 100%, rgba(6,182,212,0.04) 0%, transparent 50%);
  pointer-events: none;
}

/* ===== Floating Orbs (subtle) ===== */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  animation: orbDrift linear infinite;
}
.orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99,102,241,0.15), transparent 70%);
  top: -200px; left: -100px;
  animation-duration: 40s;
}
.orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(139,92,246,0.12), transparent 70%);
  bottom: -100px; right: -80px;
  animation-duration: 50s;
  animation-direction: reverse;
}
.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(6,182,212,0.08), transparent 70%);
  top: 50%; left: 60%;
  animation-duration: 35s;
}
@keyframes orbDrift {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(30px, -20px) scale(1.04); }
  66%  { transform: translate(-15px, 35px) scale(0.97); }
  100% { transform: translate(0, 0) scale(1); }
}

/* ===== Grid Background (very subtle) ===== */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 80px 80px;
  pointer-events: none;
}

/* ===== Particles ===== */
.particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.particle {
  position: absolute;
  border-radius: 50%;
  animation: particleRise linear infinite;
  opacity: 0;
}
@keyframes particleRise {
  0%   { transform: translateY(100vh) translateX(0); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.2; }
  100% { transform: translateY(-10vh) translateX(var(--drift, 0px)); opacity: 0; }
}

/* ===== Scanline ===== */
.scanline { display: none; }

/* ===== Sidebar ===== */
#sidebar {
  position: fixed;
  top: 0; left: 0;
  height: 100%;
  width: var(--sidebar-width);
  background: rgba(14, 14, 17, 0.96);
  border-right: 1px solid var(--border-subtle);
  z-index: 50;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

@media (max-width: 1023px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
}

/* Logo */
.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow-brand);
  flex-shrink: 0;
}

.logo-icon i {
  color: #fff;
  font-size: 1rem;
  position: relative;
  z-index: 1;
}

.logo-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.logo-sub {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  margin-top: 1px;
}

/* Nav */
nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: all 0.18s ease;
  margin-bottom: 2px;
  border: 1px solid transparent;
  position: relative;
  letter-spacing: -0.1px;
}

.nav-link i {
  width: 16px;
  text-align: center;
  font-size: 0.82rem;
  flex-shrink: 0;
  transition: color 0.18s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--surface-1);
  border-color: var(--border-subtle);
}

.nav-link.active {
  background: rgba(99,102,241,0.12);
  color: var(--text-brand);
  border-color: rgba(99,102,241,0.2);
  font-weight: 600;
}

.nav-link.active i {
  color: var(--brand-primary);
}

/* Sidebar User */
.sidebar-user {
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  cursor: default;
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-role {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 1px;
}

/* Dark mode toggle button */
#darkBtn {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-1);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 0.78rem;
  transition: all 0.18s;
  flex-shrink: 0;
}
#darkBtn:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

/* ===== Overlay ===== */
#overlay {
  position: fixed; inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 45;
  display: none;
}
#overlay.show { display: block; }

/* ===== Mobile Header ===== */
#mobileHeader {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  background: rgba(9, 9, 11, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 0 16px;
  height: 56px;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 1023px) { #mobileHeader { display: flex; } }

.menu-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--surface-1);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.85rem;
  transition: all 0.18s;
}
.menu-btn:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

/* ===== Main Content ===== */
main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  position: relative;
  z-index: 1;
}
@media (max-width: 1023px) {
  main { margin-left: 0; padding-top: 56px; }
}

/* Scroll snap container */
.snap-container {
  height: 100vh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

.snap-section {
  scroll-snap-align: start;
  scroll-snap-stop: always;
  min-height: 100vh;
  padding: 36px 32px;
  position: relative;
}

@media (max-width: 768px) {
  .snap-section { padding: 20px 16px; }
}

/* Sections */
.section { display: none; }
.section.active-section { display: block; }

/* ===== Page Header ===== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 1.5px;
  color: var(--text-brand);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.page-subtitle {
  font-size: 0.84rem;
  color: var(--text-tertiary);
  margin-top: 4px;
  font-weight: 400;
}

/* HUD Badge */
.hud-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-tertiary);
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  padding: 7px 12px;
  border-radius: var(--radius-md);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* ===== Cards ===== */
.neon-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  transition: all 0.22s ease;
  position: relative;
  overflow: hidden;
}

.neon-card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-md);
}

/* ===== Stat Cards ===== */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  border: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
  transition: all 0.22s ease;
  cursor: default;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}

.stat-card:hover {
  border-color: var(--border-default);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.stat-card.balance {
  background: linear-gradient(135deg, rgba(99,102,241,0.1) 0%, rgba(139,92,246,0.06) 100%);
  border-color: rgba(99,102,241,0.2);
}

.stat-card.income {
  background: linear-gradient(135deg, rgba(16,185,129,0.08) 0%, rgba(6,182,212,0.04) 100%);
  border-color: rgba(16,185,129,0.18);
}

.stat-card.expense {
  background: linear-gradient(135deg, rgba(244,63,94,0.08) 0%, rgba(244,63,94,0.04) 100%);
  border-color: rgba(244,63,94,0.18);
}

.stat-icon {
  position: absolute;
  top: 20px; right: 20px;
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}

.stat-card.balance .stat-icon { background: rgba(99,102,241,0.15); color: var(--brand-primary); }
.stat-card.income  .stat-icon { background: rgba(16,185,129,0.15); color: var(--color-income); }
.stat-card.expense .stat-icon { background: rgba(244,63,94,0.15);  color: var(--color-expense); }

.stat-label {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
  animation: countUp 0.5s ease both;
}

.stat-card.balance .stat-value { color: var(--text-primary); }
.stat-card.income  .stat-value { color: var(--color-income); }
.stat-card.expense .stat-value { color: var(--color-expense); }

.stat-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

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

/* ===== Chart Cards ===== */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 22px;
  transition: border-color 0.2s;
}

.chart-card:hover {
  border-color: var(--border-default);
}

.chart-title {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-title::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand-primary);
  box-shadow: 0 0 6px rgba(99,102,241,0.6);
  flex-shrink: 0;
}

/* ===== Transaction Row ===== */
.tx-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  transition: all 0.18s ease;
  margin-bottom: 4px;
}

.tx-row:hover {
  background: var(--surface-1);
  border-color: var(--border-subtle);
}

.tx-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.tx-desc {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.tx-meta {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.tx-amount {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  flex-shrink: 0;
}

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

/* View All Link */
.view-all {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-brand);
  text-decoration: none;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.18s;
}
.view-all:hover { opacity: 0.7; }

/* ===== Form Styles ===== */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  padding: 32px;
  max-width: 680px;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: -0.1px;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.88rem;
  transition: all 0.18s ease;
  outline: none;
  font-weight: 500;
}

.form-input::placeholder { color: var(--text-muted); font-weight: 400; }

.form-input:focus {
  border-color: var(--brand-primary);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.form-input[type="number"] { font-family: var(--font-mono); }
.form-input option { background: #111113; }

/* Type Toggle */
.type-toggle {
  display: flex;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 5px;
  margin-bottom: 26px;
}

.type-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.22s ease;
  color: var(--text-tertiary);
  background: transparent;
  letter-spacing: 0.2px;
}

.type-btn.active-expense {
  background: linear-gradient(135deg, rgba(244,63,94,0.15), rgba(244,63,94,0.08));
  border-color: rgba(244,63,94,0.3);
  color: var(--color-expense);
  box-shadow: 0 0 12px rgba(244,63,94,0.12);
}

.type-btn.active-income {
  background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(16,185,129,0.08));
  border-color: rgba(16,185,129,0.3);
  color: var(--color-income);
  box-shadow: 0 0 12px rgba(16,185,129,0.12);
}

/* Submit Button */
.btn-submit {
  width: 100%;
  padding: 13px;
  background: var(--brand-gradient);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.22s ease;
  box-shadow: 0 4px 16px rgba(99,102,241,0.3);
  position: relative;
  overflow: hidden;
}

.btn-submit::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s ease;
}

.btn-submit:hover::after { left: 100%; }

.btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(99,102,241,0.45);
}

.btn-submit:active { transform: scale(0.99); }

/* ===== NOT POSSIBLE Warning ===== */
.not-possible-banner {
  display: none;
  background: linear-gradient(135deg, rgba(244,63,94,0.12), rgba(244,63,94,0.06));
  border: 1px solid rgba(244,63,94,0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  color: var(--color-expense);
  font-size: 0.82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: warningPulse 2s ease-in-out infinite;
}

.not-possible-banner.hidden { display: none !important; }

@keyframes warningPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(244,63,94,0.2); }
  50%       { box-shadow: 0 0 16px rgba(244,63,94,0.15); }
}

/* ===== History Table ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
  color: var(--text-primary);
  transition: background 0.15s;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.data-table .amount-income  { color: var(--color-income);  font-family: var(--font-mono); font-weight: 600; }
.data-table .amount-expense { color: var(--color-expense); font-family: var(--font-mono); font-weight: 600; }

/* Category Badge */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
}

.filter-input {
  flex: 1;
  min-width: 160px;
  padding: 9px 13px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.84rem;
  outline: none;
  transition: all 0.18s;
  font-weight: 400;
}

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

.filter-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.filter-input option { background: #111113; }

/* Delete Button */
.btn-delete {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(244,63,94,0.15);
  background: rgba(244,63,94,0.06);
  color: var(--color-expense);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 0.72rem;
  transition: all 0.18s;
}

.btn-delete:hover {
  background: rgba(244,63,94,0.14);
  border-color: rgba(244,63,94,0.3);
  transform: scale(1.06);
}

/* ===== Progress Bar ===== */
.progress-track {
  height: 5px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.05);
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.9s cubic-bezier(.4,0,.2,1);
}

/* ===== Category Cards ===== */
.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 20px;
  transition: all 0.22s ease;
  position: relative;
  overflow: hidden;
}

.category-card:hover {
  border-color: var(--border-default);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* Corner decorations (minimal) */
.corner-tl, .corner-br { display: none; }

/* ===== Insight Cards ===== */
.insight-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  border: 1px solid var(--border-subtle);
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: all 0.22s ease;
}

.insight-card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
}

.insight-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.insight-title {
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 5px;
  letter-spacing: -0.1px;
}

.insight-body {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.insight-card.warning { border-color: rgba(245,158,11,0.2); }
.insight-card.warning .insight-title { color: var(--color-warning); }
.insight-card.danger  { border-color: rgba(244,63,94,0.2); }
.insight-card.danger  .insight-title { color: var(--color-expense); }
.insight-card.good    { border-color: rgba(16,185,129,0.2); }
.insight-card.good    .insight-title { color: var(--color-income); }

/* ===== Savings Meter ===== */
.savings-meter {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  text-align: center;
}

.meter-ring {
  width: 120px; height: 120px;
  margin: 0 auto 16px;
  position: relative;
}

.meter-ring svg { transform: rotate(-90deg); }
.meter-ring .ring-bg  { fill: none; stroke: rgba(255,255,255,0.05); stroke-width: 9; }
.meter-ring .ring-val { fill: none; stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset 1.2s cubic-bezier(.4,0,.2,1); }

.meter-pct {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -1px;
}

/* ===== Category Pills ===== */
#categoryPills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

/* ===== Toast ===== */
#toast {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}

#toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast-inner {
  background: #1f1f23;
  border: 1px solid var(--border-default);
  backdrop-filter: blur(20px);
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  color: var(--text-primary);
  font-weight: 500;
  min-width: 220px;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ===== No Data State ===== */
.no-data {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-muted);
}

.no-data i {
  font-size: 2.5rem;
  margin-bottom: 14px;
  display: block;
  opacity: 0.3;
}

.no-data p {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ===== Section Reveal ===== */
.section-reveal {
  animation: revealUp 0.35s ease both;
}

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

/* ===== Divider ===== */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 20px 0;
}

/* ===== Badge / Tags ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge-income  { background: rgba(16,185,129,0.12); color: var(--color-income); }
.badge-expense { background: rgba(244,63,94,0.12);  color: var(--color-expense); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .snap-section { padding: 18px 14px; }
  .stat-card { padding: 18px 18px; }
  .stat-value { font-size: 1.6rem; }
  .page-title { font-size: 1.3rem; }
  .form-card { padding: 22px 18px; }
  :root { --sidebar-width: 240px; }
}

/* ===== Utility for inline grid fixes ===== */
.chart-row         { display: grid; gap: 16px; }
.chart-row-insights { display: grid; gap: 16px; align-items: start; }

/* ===== New Category Button (in Categories page header) ===== */
.btn-new-cat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  background: var(--brand-gradient);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 12px rgba(99,102,241,0.3);
  white-space: nowrap;
  align-self: flex-start;
}
.btn-new-cat:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 20px rgba(99,102,241,0.45);
}

/* ===== Modal Overlay & Panel ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-panel {
  position: fixed;
  top: 0; right: 0;
  height: 100%;
  width: 420px;
  max-width: 100vw;
  background: #111113;
  border-left: 1px solid var(--border-default);
  z-index: 201;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-panel.open {
  transform: translateX(0);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--surface-1);
  color: var(--text-tertiary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.18s;
  flex-shrink: 0;
}
.modal-close:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
}

.modal-section-title {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 14px;
}

/* ===== New Category Form (inside modal) ===== */
.new-cat-form {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 6px;
}

@media (max-width: 500px) {
  .new-cat-form {
    grid-template-columns: auto 1fr;
  }
}

/* Emoji field */
.emoji-field { position: relative; }

.emoji-picker-btn {
  width: 46px; height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-input);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s;
  line-height: 1;
}
.emoji-picker-btn:hover {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.emoji-picker {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 240px;
  background: #1a1a1e;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 12px;
  z-index: 300;
  box-shadow: var(--shadow-xl);
  animation: revealUp 0.18s ease both;
}
.emoji-picker.hidden { display: none; }

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.emoji-btn {
  width: 30px; height: 30px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  line-height: 1;
}
.emoji-btn:hover { background: var(--surface-2); }
.emoji-btn.selected { background: rgba(99,102,241,0.2); }

/* Color Swatches */
.color-swatches {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: #fff; transform: scale(1.1); }

/* Add button */
.btn-add-cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--brand-gradient);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-shadow: 0 3px 12px rgba(99,102,241,0.3);
  height: 42px;
}
.btn-add-cat:hover {
  box-shadow: 0 5px 18px rgba(99,102,241,0.45);
  transform: translateY(-1px);
}

/* ===== Category List in Modal ===== */
.cat-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 8px;
  background: var(--surface-1);
  transition: border-color 0.18s;
}
.cat-list-item:hover { border-color: var(--border-default); }

.cat-list-emoji {
  width: 34px; height: 34px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.cat-list-name {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.cat-list-badge {
  font-size: 0.66rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.btn-delete-cat {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(244,63,94,0.15);
  background: rgba(244,63,94,0.06);
  color: var(--color-expense);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
  transition: all 0.18s;
  flex-shrink: 0;
}
.btn-delete-cat:hover {
  background: rgba(244,63,94,0.14);
  border-color: rgba(244,63,94,0.3);
}

@media (max-width: 1023px) {
  .modal-panel { width: 100%; max-width: 420px; }
}

