
/* ─── RESET & TOKENS ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --ink:      #0E0E0E;
  --paper:    #F4F1EA;
  --cream:    #EAE6DC;
  --accent:   #C8F135;
  --red:      #FF4545;
  --muted:    #8A8680;
  --border:   rgba(14,14,14,0.12);
  --card:     #FFFFFF;
  --mono:     'JetBrains Mono', monospace;
  --sans:     'Syne', sans-serif;
}
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── NOISE TEXTURE OVERLAY ─── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 128px;
}

/* ─── LAYOUT ─── */
.shell {
  position: relative; z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 28px 80px;
}

/* ─── NAV ─── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}
.nav-logo {
  font-family: var(--sans);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-logo .dot {
  width: 10px; height: 10px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
}
.nav-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

/* ─── HERO STATS ─── */
.stats-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 40px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 28px 24px;
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.5s ease both;
}
.stat-card:nth-child(2) { animation-delay: 0.07s; }
.stat-card:nth-child(3) { animation-delay: 0.14s; }
.stat-card.hero-card {
  background: var(--ink);
  color: var(--paper);
}
.stat-card.hero-card::after {
  content: '';
  position: absolute;
  right: -30px; bottom: -30px;
  width: 130px; height: 130px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.15;
}
.stat-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.hero-card .stat-label { color: rgba(244,241,234,0.5); }
.stat-amount {
  font-family: var(--sans);
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 8px;
}
.hero-card .stat-amount { color: var(--accent); }
.stat-sub {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
}
.hero-card .stat-sub { color: rgba(244,241,234,0.4); }
.stat-icon {
  position: absolute;
  top: 24px; right: 24px;
  font-size: 1.2rem;
  opacity: 0.5;
}

/* budget bar */
.budget-bar-wrap { margin-top: 16px; }
.budget-bar-track {
  height: 4px;
  background: rgba(244,241,234,0.15);
  border-radius: 2px;
  overflow: hidden;
}
.budget-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0;
  transition: width 1.2s cubic-bezier(.16,1,.3,1);
}

/* ─── MAIN GRID ─── */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}

/* ─── SECTION HEADERS ─── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-count {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
}

/* ─── ADD FORM ─── */
.add-form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  animation: fadeUp 0.5s 0.2s ease both;
}
.form-title {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-title::before {
  content: '+';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  background: var(--accent);
  color: var(--ink);
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group.full { grid-column: 1 / -1; }
label {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
input, select {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(14,14,14,0.07);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%238A8680' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.type-toggle {
  display: flex;
  gap: 8px;
}
.type-btn {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--paper);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.18s;
  text-align: center;
}
.type-btn.active-expense {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.type-btn.active-income {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--accent);
}
.add-btn {
  width: 100%;
  padding: 12px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
  margin-top: 4px;
}
.add-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.add-btn:active { transform: scale(0.98); }

/* ─── TRANSACTION LIST ─── */
.tx-list-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  animation: fadeUp 0.5s 0.28s ease both;
}
.tx-filter-bar {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tx-filter-bar::-webkit-scrollbar { display: none; }
.filter-chip {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s;
}
.filter-chip.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.tx-list { max-height: 480px; overflow-y: auto; }
.tx-list::-webkit-scrollbar { width: 4px; }
.tx-list::-webkit-scrollbar-track { background: transparent; }
.tx-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.tx-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  animation: slideIn 0.3s ease both;
}
.tx-item:last-child { border-bottom: none; }
.tx-item:hover { background: var(--paper); }
.tx-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.tx-info { flex: 1; min-width: 0; }
.tx-name {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.tx-meta {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.tx-amount {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}
.tx-amount.expense { color: var(--red); }
.tx-amount.income  { color: #22A96B; }
.tx-del {
  opacity: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1rem;
  padding: 4px;
  border-radius: 4px;
  transition: opacity 0.15s, color 0.15s;
  line-height: 1;
}
.tx-item:hover .tx-del { opacity: 1; }
.tx-del:hover { color: var(--red); }
.tx-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 10px;
}
.tx-empty-icon { font-size: 2.4rem; opacity: 0.3; }
.tx-empty-text {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

/* ─── RIGHT PANEL ─── */
.right-panel { display: flex; flex-direction: column; gap: 20px; }

/* ─── CATEGORY BREAKDOWN ─── */
.breakdown-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  animation: fadeUp 0.5s 0.35s ease both;
}
.cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.cat-row:last-child { margin-bottom: 0; }
.cat-emoji { font-size: 1rem; width: 26px; text-align: center; }
.cat-info { flex: 1; }
.cat-name {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}
.cat-name span {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--muted);
}
.cat-bar-track {
  height: 3px;
  background: var(--cream);
  border-radius: 2px;
  overflow: hidden;
}
.cat-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.8s cubic-bezier(.16,1,.3,1);
  width: 0;
}

/* ─── CHART ─── */
.chart-card {
  background: var(--ink);
  border-radius: 12px;
  padding: 20px;
  animation: fadeUp 0.5s 0.42s ease both;
  color: var(--paper);
}
.chart-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(244,241,234,0.4);
  margin-bottom: 16px;
}
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 80px;
}
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.chart-bar {
  width: 100%;
  border-radius: 3px 3px 0 0;
  background: rgba(244,241,234,0.12);
  min-height: 4px;
  transition: height 0.6s cubic-bezier(.16,1,.3,1), background 0.2s;
  position: relative;
}
.chart-bar.active { background: var(--accent); }
.chart-bar:hover { background: var(--accent); cursor: pointer; }
.chart-day {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: rgba(244,241,234,0.3);
  letter-spacing: 0.06em;
}
.chart-col.today .chart-day { color: var(--accent); }

/* ─── QUICK TIPS ─── */
.tip-card {
  background: var(--accent);
  border-radius: 12px;
  padding: 18px 20px;
  animation: fadeUp 0.5s 0.5s ease both;
}
.tip-label {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(14,14,14,0.5);
  margin-bottom: 6px;
}
.tip-text {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
}

/* ─── CATEGORY COLORS ─── */
.cat-food     { background: #FFE5CC; }
.cat-transport{ background: #CCE8FF; }
.cat-shopping { background: #FFD6E8; }
.cat-health   { background: #D6FFE8; }
.cat-housing  { background: #E8D6FF; }
.cat-leisure  { background: #FFEFD6; }
.cat-income   { background: #DDFFC0; }
.cat-other    { background: #E8E8E8; }

.bar-food      { background: #FF8A35; }
.bar-transport { background: #3598FF; }
.bar-shopping  { background: #FF5C8D; }
.bar-health    { background: #35C97A; }
.bar-housing   { background: #8B5CF6; }
.bar-leisure   { background: #F59E0B; }
.bar-income    { background: #22A96B; }
.bar-other     { background: #9CA3AF; }

/* ─── TOAST ─── */
.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 10px 20px;
  border-radius: 30px;
  letter-spacing: 0.04em;
  z-index: 999;
  transition: transform 0.3s cubic-bezier(.16,1,.3,1), opacity 0.3s;
  opacity: 0;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ─── ANIMATIONS ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 800px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .stats-row .stat-card:first-child { grid-column: 1 / -1; }
  .main-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .shell { padding: 0 16px 60px; }
  .stats-row { grid-template-columns: 1fr; }
  .stat-amount { font-size: 1.8rem; }
}
