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

:root {
  --emerald: #059669;
  --emerald-hover: #047857;
  --emerald-soft: rgba(5, 150, 105, 0.1);
  --emerald-glow: rgba(5, 150, 105, 0.3);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.1);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 68px;
}

body[data-theme="light"] {
  --bg: #f7f8f7;
  --bg-2: #ffffff;
  --bg-3: #f2f3f2;
  --surface: #ffffff;
  --surface-2: #f7f8f7;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --text: #0f172a;
  --text-soft: #475569;
  --text-muted: #94a3b8;
  --text-dim: #cbd5e1;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 10px 30px -15px rgba(15, 23, 42, 0.15);
  --chart-bar: rgba(5, 150, 105, 0.15);
}

body[data-theme="dark"] {
  --bg: #0c0f0e;
  --bg-2: #121615;
  --bg-3: #171c1a;
  --surface: #151a18;
  --surface-2: #1b211f;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #f1f5f4;
  --text-soft: #a8b2ae;
  --text-muted: #6b7671;
  --text-dim: #46504c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 10px 30px -15px rgba(0, 0, 0, 0.6);
  --chart-bar: rgba(5, 150, 105, 0.25);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

input:focus,
select:focus,
textarea:focus { outline: none; }

::selection { background: var(--emerald); color: white; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ============================================
   APP SHELL
============================================ */
.app { display: flex; min-height: 100vh; }

/* ============================================
   SIDEBAR
============================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: width 0.3s var(--ease), transform 0.3s var(--ease);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-w-collapsed); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: var(--topbar-h);
  gap: 0.5rem;
}

/* Collapsed sidebar: hide logo, center the toggle */
.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 1.1rem 0.5rem;
}

.sidebar.collapsed .logo {
  display: none;
}

.sidebar.collapsed .sidebar-toggle {
  width: 32px;
  height: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--emerald);
  flex-shrink: 0;
}

.logo-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--emerald), #047857);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px -3px var(--emerald-glow);
}

.logo-text {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
}

.sidebar-toggle {
  width: 26px; height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s var(--ease);
}
.sidebar-toggle:hover { background: var(--surface-2); color: var(--text); }
.sidebar-toggle svg { transition: transform 0.3s var(--ease); }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.65rem;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nav-group-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 0.75rem 0.5rem;
  white-space: nowrap;
}

.sidebar.collapsed .nav-group-label {
  opacity: 0;
  height: 0.5rem;
  padding: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  color: var(--text-soft);
  font-weight: 500;
  font-size: 0.85rem;
  transition: all 0.2s var(--ease);
  position: relative;
  white-space: nowrap;
}

.nav-item svg { flex-shrink: 0; opacity: 0.85; }

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: var(--emerald-soft);
  color: var(--emerald);
}
.nav-item.active svg { opacity: 1; }

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--emerald);
}

.nav-badge {
  margin-left: auto;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-family: var(--font-mono);
}
.nav-item.active .nav-badge {
  background: var(--emerald-soft);
  color: var(--emerald);
}

.sidebar.collapsed .nav-item span:not(.nav-badge) {
  opacity: 0;
  pointer-events: none;
}
.sidebar.collapsed .nav-badge { display: none; }

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.theme-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px solid var(--border);
  justify-content: center;
}

.theme-btn {
  flex: 1;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s var(--ease);
}
.theme-btn:hover { color: var(--text); }
.theme-btn.active {
  background: var(--surface);
  color: var(--emerald);
  box-shadow: var(--shadow-sm);
}

.sidebar.collapsed .theme-switch { flex-direction: column; }
.sidebar.collapsed .theme-btn { height: 26px; }

/* ============================================
   MAIN
============================================ */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  transition: margin-left 0.3s var(--ease);
  min-width: 0;
}
.sidebar.collapsed ~ .main { margin-left: var(--sidebar-w-collapsed); }

/* ============================================
   TOPBAR
============================================ */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  gap: 1rem;
  z-index: 40;
}
body[data-theme="dark"] .topbar {
  background: rgba(12, 15, 14, 0.8);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.sidebar-toggle-mobile {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--text-muted);
  align-items: center;
  justify-content: center;
}
.sidebar-toggle-mobile:hover {
  background: var(--surface-2);
  color: var(--text);
}

.page-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.month-picker {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.month-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s var(--ease);
}
.month-btn:hover {
  background: var(--surface);
  color: var(--text);
}

.month-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  min-width: 110px;
  text-align: center;
  padding: 0 0.3rem;
  letter-spacing: -0.01em;
}

/* ============================================
   BUTTONS
============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: var(--emerald);
  color: white;
  box-shadow: 0 4px 12px -3px var(--emerald-glow);
}
.btn-primary:hover {
  background: var(--emerald-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -3px var(--emerald-glow);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

.btn-danger {
  background: var(--red);
  color: white;
  box-shadow: 0 4px 12px -3px rgba(220, 38, 38, 0.3);
}
.btn-danger:hover {
  background: #b91c1c;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -3px rgba(220, 38, 38, 0.35);
}

/* ============================================
   CONTENT
============================================ */
.content {
  padding: 1.5rem 1.75rem 3rem;
  max-width: 1500px;
  margin: 0 auto;
  width: 100%;
}

/* KPI strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: all 0.25s var(--ease);
}
.kpi:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.kpi-value {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.1;
  transition: all 0.3s var(--ease);
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}
.kpi-sub.positive { color: var(--emerald); }
.kpi-sub.negative { color: var(--red); }

/* Dashboard grid */
.dash-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.col-main,
.col-side {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.3rem;
  transition: border-color 0.25s var(--ease);
}
.card:hover { border-color: var(--border-strong); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.card-filters {
  display: flex;
  gap: 0.5rem;
}

.filter-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.7rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s var(--ease);
}
.filter-search:focus-within {
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px var(--emerald-soft);
}
.filter-search svg { color: var(--text-muted); flex-shrink: 0; }
.filter-search input {
  border: none;
  background: transparent;
  font-size: 0.8rem;
  color: var(--text);
  width: 140px;
  font-family: inherit;
}
.filter-search input::placeholder { color: var(--text-muted); }

/* ============================================
   CHART
============================================ */
.chart-wrap {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.chart-y {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 160px;
  padding-bottom: 22px;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-align: right;
}

.chart-area {
  display: flex;
  flex-direction: column;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2px;
  height: 160px;
  padding-bottom: 0;
  position: relative;
  border-bottom: 1px solid var(--border);
}

.chart-bar {
  flex: 1;
  background: var(--chart-bar);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  position: relative;
  transition: all 0.3s var(--ease);
  cursor: pointer;
  min-width: 4px;
}
.chart-bar:hover {
  background: var(--emerald);
}
.chart-bar.has-value {
  background: rgba(5, 150, 105, 0.5);
}
.chart-bar.has-value:hover {
  background: var(--emerald);
}
.chart-bar.today {
  background: var(--emerald);
  box-shadow: 0 0 0 2px var(--emerald-soft);
}

.chart-bar-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--text);
  color: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s var(--ease);
  z-index: 5;
}
.chart-bar:hover .chart-bar-tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.chart-x {
  display: flex;
  justify-content: space-between;
  padding-top: 0.5rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ============================================
   EXPENSES LIST
============================================ */
.expenses-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 520px;
  overflow-y: auto;
  margin: 0 -0.4rem;
  padding: 0 0.4rem;
}

.expense-item {
  display: grid;
  grid-template-columns: 42px 1fr auto auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 0.6rem;
  border-radius: 10px;
  transition: all 0.2s var(--ease);
  animation: slideIn 0.35s var(--ease);
  position: relative;
}

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

.expense-item:hover {
  background: var(--surface-2);
}

.expense-item.removing {
  animation: slideOut 0.3s var(--ease) forwards;
}

@keyframes slideOut {
  to { opacity: 0; transform: translateX(20px); max-height: 0; padding: 0; margin: 0; }
}

.expense-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.expense-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.expense-note {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.expense-meta .dot { opacity: 0.5; }

.expense-amount {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.expense-actions {
  display: flex;
  gap: 0.15rem;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

.expense-item:hover .expense-actions { opacity: 1; }

.expense-action {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s var(--ease);
}
.expense-action:hover {
  background: var(--surface-2);
  color: var(--text);
}
.expense-action.delete:hover {
  background: var(--red-soft);
  color: var(--red);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  display: none;
}
.empty-state.visible { display: block; }

.empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--emerald-soft);
  color: var(--emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.2rem;
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}
.empty-state p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.empty-state .btn {
  margin: 0 auto;
}

/* ============================================
   CATEGORY BREAKDOWN
   ============================================ */
.cat-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.cat-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.cat-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cat-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-amount {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.cat-bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}

.cat-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s var(--ease);
}

.cat-empty {
  padding: 2rem 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: none;
}
.cat-empty.visible { display: block; }

/* ============================================
   GLANCE LIST
   ============================================ */
.glance-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.glance-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0.5rem;
  border-radius: 8px;
  transition: background 0.2s var(--ease);
}
.glance-item:hover { background: var(--surface-2); }

.glance-label {
  font-size: 0.82rem;
  color: var(--text-soft);
}

.glance-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

/* ============================================
   MODAL
   ============================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s var(--ease);
}
.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-2);
  border-radius: 16px;
  width: 100%;
  max-width: 460px;
  padding: 1.5rem;
  box-shadow: 0 30px 80px -20px rgba(15, 23, 42, 0.4);
  transform: translateY(20px) scale(0.98);
  transition: transform 0.3s var(--ease);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-backdrop.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.3rem;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s var(--ease);
}
.modal-close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.01em;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="date"] {
  padding: 0.7rem 0.9rem;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  border-radius: 9px;
  font-size: 0.9rem;
  color: var(--text);
  transition: all 0.2s var(--ease);
  font-family: inherit;
  width: 100%;
}
.field input:focus {
  border-color: var(--emerald);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--emerald-soft);
}
.field input::placeholder { color: var(--text-muted); }

.amount-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.amount-currency {
  position: absolute;
  left: 0.9rem;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

.amount-input-wrap input {
  padding-left: 2rem !important;
  font-family: var(--font-mono) !important;
  font-weight: 600 !important;
  font-size: 1rem !important;
}

/* Category picker */
.cat-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.cat-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.7rem 0.4rem;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-soft);
  transition: all 0.2s var(--ease);
  font-size: 0.72rem;
  font-weight: 500;
  font-family: inherit;
}
.cat-btn:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.cat-btn.active {
  background: var(--emerald-soft);
  border-color: var(--emerald);
  color: var(--emerald);
}

.cat-btn-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}

.modal-footer {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* Delete confirm modal */
.modal-confirm {
  max-width: 380px;
  text-align: center;
}

.confirm-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.confirm-text {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0.4rem 0 1.5rem;
}

.modal-confirm .modal-footer {
  justify-content: center;
}

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: var(--bg-2);
  padding: 0.75rem 1.2rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.4);
  z-index: 300;
  transition: transform 0.4s var(--ease);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: 90vw;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast-undo {
  background: rgba(255, 255, 255, 0.15);
  color: var(--bg-2);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 0.3rem;
  transition: background 0.2s var(--ease);
}
.toast-undo:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.3);
  }
  .main { margin-left: 0 !important; }
  .sidebar.collapsed { width: var(--sidebar-w); }
  .sidebar.collapsed .nav-item span:not(.nav-badge),
  .sidebar.collapsed .nav-group-label {
    opacity: 1;
    height: auto;
    padding: 0 0.75rem 0.5rem;
  }
  .sidebar.collapsed .nav-badge { display: inline-block; }
  .sidebar-toggle-mobile { display: flex; }
  .sidebar-toggle { display: none; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .content { padding: 1.1rem 1rem 2rem; }
  .topbar { padding: 0 1rem; }
  .month-label { min-width: 90px; font-size: 0.78rem; }
  .page-title { font-size: 1rem; }
  .btn-primary span { display: none; }
  .expense-item {
    grid-template-columns: 38px 1fr auto;
    gap: 0.7rem;
  }
  .expense-actions { opacity: 1; }
  .expense-actions .expense-action:not(.delete) { display: none; }
  .filter-search input { width: 100px; }
}

@media (max-width: 450px) {
  .kpi-strip { grid-template-columns: 1fr; gap: 0.7rem; }
  .kpi { padding: 0.9rem 1rem; }
  .kpi-value { font-size: 1.35rem; }
}