:root {
  --bg: #0b0f19;
  --card-bg: #151b2b;
  --border: #1f2937;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --radius: 20px;
  --shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-main);
  padding: 30px;
  min-height: 100vh;
  background-image: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%);
}
.app { max-width: 1200px; margin: 0 auto; }

/* Topbar */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 30px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  width: 40px; height: 40px; background: var(--primary-gradient);
  border-radius: 12px; display: grid; place-items: center; color: #fff;
}
.brand h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }

/* Buttons */
.btn-primary {
  background: var(--primary-gradient); color: #fff; border: none; 
  padding: 12px 20px; border-radius: 12px; cursor: pointer; font-weight: 600;
  font-family: inherit; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 20px -6px rgba(99, 102, 241, 0.6);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -6px rgba(99, 102, 241, 0.8); }
.btn-ghost {
  background: transparent; color: var(--text-muted); border: 1px solid var(--border);
  padding: 12px 20px; border-radius: 12px; cursor: pointer; font-weight: 500; font-family: inherit;
  transition: 0.2s;
}
.btn-ghost:hover { background: var(--border); color: var(--text-main); }

/* KPI Cards */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 24px; }
.kpi-card {
  background: var(--card-bg); border: 1px solid var(--border);
  padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 20px;
  transition: transform 0.2s;
}
.kpi-card:hover { transform: translateY(-3px); }
.kpi-icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: grid; place-items: center; color: #fff;
  flex-shrink: 0;
}
.icon-blue { background: linear-gradient(135deg, #3b82f6, #6366f1); box-shadow: 0 8px 16px -4px rgba(59, 130, 246, 0.4); }
.icon-purple { background: linear-gradient(135deg, #8b5cf6, #ec4899); box-shadow: 0 8px 16px -4px rgba(139, 92, 246, 0.4); }
.icon-green { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 8px 16px -4px rgba(16, 185, 129, 0.4); }
.kpi-info span { font-size: 13px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-info h2 { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -0.5px; }

/* Charts */
.charts { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 24px; }
.card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-header h3 { font-size: 16px; font-weight: 600; color: var(--text-main); }
.badge-badge {
  background: rgba(99, 102, 241, 0.15); color: #a5b4fc;
  padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.chart-container { position: relative; height: 240px; width: 100%; }

/* Daily Report */
.daily-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.daily-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  transition: 0.2s;
}
.daily-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
.daily-date { font-size: 13px; color: var(--text-muted); font-weight: 500; margin-bottom: 8px; }
.daily-amount { font-size: 20px; font-weight: 700; color: var(--text-main); }
.daily-count { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Table */
.table-responsive { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 16px 12px; text-align: left; font-size: 14px; }
.table th { color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
.table tr { border-bottom: 1px solid var(--border); transition: background 0.2s; }
.table tr:last-child { border-bottom: none; }
.table tr:hover { background: rgba(255,255,255,0.02); }
.title-cell { font-weight: 500; }
.date-badge { background: var(--border); padding: 4px 10px; border-radius: 8px; font-size: 12px; color: var(--text-muted); }
.badge { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; display: inline-block; }
.cat-food { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.cat-shopping { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; }
.cat-transport { background: rgba(236, 72, 153, 0.15); color: #f472b6; }
.cat-health { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.cat-other { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.amount { font-weight: 700; color: #fff; }
.right { text-align: right; }
.del { color: #ef4444; opacity: 0.5; transition: 0.2s; }
.del:hover { opacity: 1; }
.empty { text-align: center; color: var(--text-muted); padding: 40px 0; }
.view-all { color: var(--primary); font-size: 13px; font-weight: 600; text-decoration: none; }
.view-all:hover { text-decoration: underline; }

/* Modal */
.modal {
  display: none; position: fixed; inset: 0;
  background: rgba(11, 15, 25, 0.8); backdrop-filter: blur(8px);
  align-items: center; justify-content: center; z-index: 100;
  padding: 16px;
}
.modal.open { display: flex; }
.modal-box {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 24px; padding: 30px; width: 100%; max-width: 480px;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,0.8);
  animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-header h3 { font-size: 20px; font-weight: 700; }
.close-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; transition: 0.2s; }
.close-btn:hover { color: #ef4444; }
.form-group { margin-bottom: 18px; flex: 1; }
.form-row { display: flex; gap: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; font-weight: 500; }
.form-group input, .form-group select {
  width: 100%; padding: 12px 16px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 12px; 
  color: var(--text-main); font-size: 14px; font-family: inherit; outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group select:focus { 
  border-color: var(--primary); 
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2); 
}
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 30px; }

/* --- RESPONSIVE MOBILE VIEW --- */
@media (max-width: 900px) {
  .kpis { grid-template-columns: 1fr; }
  .charts { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; gap: 0; }
}

@media (max-width: 600px) {
  body { padding: 16px; }
  
  /* Topbar stacks vertically */
  .topbar { flex-direction: column; align-items: flex-start; gap: 16px; }
  .btn-primary { width: 100%; justify-content: center; }
  
  /* Shrink KPI cards slightly */
  .kpi-card { padding: 20px; }
  .kpi-info h2 { font-size: 22px; }

  /* Daily Report grid stacks nicely */
  .daily-grid { grid-template-columns: 1fr 1fr; }

  /* Transform Table into Cards on Mobile */
  .table-responsive { overflow-x: visible; }
  .table thead { display: none; }
  .table tr {
    display: block;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    background: var(--bg);
  }
  .table tr:hover { background: var(--bg); }
  .table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border: none;
    font-size: 14px;
    text-align: right;
  }
  .table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    margin-right: 16px;
    text-align: left;
  }
  .table td.title-cell { font-weight: 600; font-size: 16px; margin-bottom: 8px; justify-content: center; text-align: center; }
  .table td.title-cell::before { display: none; } /* Hide label for title */
  .table td.right { text-align: right; justify-content: flex-end; }
  .table td .del { margin-left: 8px; }
  
  /* Modal becomes full width */
  .modal-box { padding: 24px; max-width: 100%; }
}

/* --- Add these to the bottom of your style.css --- */

/* Navigation Menu */
.nav-menu {
  display: flex;
  gap: 8px;
  background: var(--card-bg);
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: 0.2s;
}
.nav-link:hover {
  color: var(--text-main);
  background: rgba(255,255,255,0.05);
}
.nav-link.active {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(99, 102, 241, 0.6);
}

/* New Icon Colors */
.icon-orange { background: linear-gradient(135deg, #f59e0b, #ea580c); box-shadow: 0 8px 16px -4px rgba(245, 158, 11, 0.4); }

/* Category Summary List */
.category-list { display: flex; flex-direction: column; gap: 20px; }
.cat-item { display: flex; flex-direction: column; gap: 8px; }
.cat-info { display: flex; justify-content: space-between; align-items: center; }
.cat-count { font-size: 12px; color: var(--text-muted); }
.cat-amount { font-size: 16px; font-weight: 700; color: var(--text-main); }
.progress-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* Adjust KPI grid for Analysis page on smaller screens */
@media (max-width: 1024px) {
  .kpis { grid-template-columns: repeat(2, 1fr) !important; }
  .charts { grid-template-columns: 1fr !important; }
}

/* Mobile Navigation */
@media (max-width: 600px) {
  .nav-menu { width: 100%; justify-content: center; margin-top: 10px; }
  .nav-link { flex: 1; text-align: center; }
}