@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --primary: #9FA8DA;
  --primary-light: #7986CB;
  --primary-dark: #5C6BC0;
  --accent: #3F51B5;
  --accent-light: #E8EAF6;
  --accent-muted: #fef3c7;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  --radius: 10px;
  --radius-lg: 14px;
  --radius-full: 50px;
}

::selection {
  background: var(--accent);
  color: var(--primary-dark);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 100px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 12px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-muted);
  border-radius: var(--radius);
}

.app-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.add-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.add-btn:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 4px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.tab-btn:not(.active):hover {
  background: var(--border-light);
  color: var(--text);
}

.tab-icon {
  font-size: 1rem;
}

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.summary-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.4s ease both;
}

.summary-card:nth-child(1) { animation-delay: 0s; }
.summary-card:nth-child(2) { animation-delay: 0.05s; }
.summary-card:nth-child(3) { animation-delay: 0.1s; }
.summary-card:nth-child(4) { animation-delay: 0.15s; }

.summary-card.total {
  border-left: 3px solid var(--accent);
}

.summary-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.summary-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.summary-change {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 4px;
}

.summary-change.up {
  color: var(--danger);
}

.summary-change.down {
  color: var(--success);
}

/* Section titles */
.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 14px;
}

.dashboard-section {
  margin-bottom: 32px;
}

/* Type Cards */
.type-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.type-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  animation: fadeInUp 0.4s ease both;
}

.type-card:nth-child(1) { animation-delay: 0.05s; }
.type-card:nth-child(2) { animation-delay: 0.1s; }
.type-card:nth-child(3) { animation-delay: 0.15s; }
.type-card:nth-child(4) { animation-delay: 0.2s; }
.type-card:nth-child(5) { animation-delay: 0.25s; }
.type-card:nth-child(6) { animation-delay: 0.3s; }
.type-card:nth-child(7) { animation-delay: 0.35s; }
.type-card:nth-child(8) { animation-delay: 0.4s; }

.type-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.type-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.type-icon {
  font-size: 1.25rem;
}

.type-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.type-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.type-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.type-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.type-stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.type-bar-container {
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
}

.type-bar {
  height: 100%;
  width: var(--bar-width);
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* Recent List */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  animation: fadeInUp 0.3s ease both;
}

.recent-item:nth-child(1) { animation-delay: 0s; }
.recent-item:nth-child(2) { animation-delay: 0.04s; }
.recent-item:nth-child(3) { animation-delay: 0.08s; }
.recent-item:nth-child(4) { animation-delay: 0.12s; }
.recent-item:nth-child(5) { animation-delay: 0.16s; }

.recent-item:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.recent-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.recent-icon {
  font-size: 1.25rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border-light);
  border-radius: 8px;
}

.recent-info {
  display: flex;
  flex-direction: column;
}

.recent-type {
  font-weight: 600;
  font-size: 0.875rem;
}

.recent-provider {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.recent-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.recent-amount {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.recent-date {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 36, 64, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--border-light);
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: var(--border);
  color: var(--text);
}

/* Bill Form */
.bill-form {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 44px;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

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

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.type-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.type-chip {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--card);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.type-chip:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.type-chip.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 8px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-light);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--border-light);
  color: var(--text);
}

/* Bill List */
.bill-list-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.list-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 4px 16px;
  transition: border-color 0.15s ease;
}

.search-bar:focus-within {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.08);
}

.search-icon {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9375rem;
  color: var(--text);
  padding: 8px 0;
  min-height: 44px;
}

.search-input:focus {
  outline: none;
}

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

.filter-sort-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.filter-chip {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--card);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-chip:hover {
  border-color: var(--primary-light);
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.sort-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  min-height: 44px;
}

.sort-select:focus {
  outline: none;
  border-color: var(--primary-light);
}

.list-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding: 0 4px;
}

.list-summary-total {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  color: var(--primary);
}

.bill-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bill-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  animation: fadeInUp 0.3s ease both;
}

.bill-item:nth-child(1) { animation-delay: 0s; }
.bill-item:nth-child(2) { animation-delay: 0.03s; }
.bill-item:nth-child(3) { animation-delay: 0.06s; }
.bill-item:nth-child(4) { animation-delay: 0.09s; }
.bill-item:nth-child(5) { animation-delay: 0.12s; }
.bill-item:nth-child(6) { animation-delay: 0.15s; }
.bill-item:nth-child(7) { animation-delay: 0.18s; }
.bill-item:nth-child(8) { animation-delay: 0.21s; }
.bill-item:nth-child(9) { animation-delay: 0.24s; }
.bill-item:nth-child(10) { animation-delay: 0.27s; }

.bill-item:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.bill-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.bill-type-badge {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border-light);
  border-radius: 10px;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.bill-item-info {
  min-width: 0;
}

.bill-item-type {
  font-weight: 600;
  font-size: 0.9rem;
}

.bill-item-provider {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bill-item-notes {
  font-size: 0.7rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: italic;
}

.bill-item-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.bill-item-amount {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.bill-item-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.delete-btn {
  background: none;
  border: none;
  font-size: 0.875rem;
  cursor: pointer;
  padding: 4px;
  opacity: 0.4;
  transition: opacity 0.15s ease;
}

.delete-btn:hover {
  opacity: 1;
}

/* Comparison */
.comparison-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.comparison-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chart-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.4s ease both;
}

.chart-card:nth-child(1) { animation-delay: 0s; }
.chart-card:nth-child(2) { animation-delay: 0.08s; }

.chart-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 14px;
}

.chart-wrapper {
  position: relative;
  height: 260px;
}

.doughnut-wrapper {
  height: 240px;
}

.comparison-section {
  margin-top: 8px;
}

.comparison-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comparison-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.3s ease both;
}

.comparison-card:nth-child(1) { animation-delay: 0s; }
.comparison-card:nth-child(2) { animation-delay: 0.05s; }
.comparison-card:nth-child(3) { animation-delay: 0.1s; }

.comparison-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.comparison-months {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.comparison-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.comparison-badge.up {
  background: var(--danger-bg);
  color: var(--danger);
}

.comparison-badge.down {
  background: var(--success-bg);
  color: var(--success);
}

.comparison-totals {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.comparison-total {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.comparison-total-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.comparison-total-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.comparison-arrow {
  color: var(--text-muted);
  font-size: 1.25rem;
}

.comparison-breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.breakdown-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
}

.breakdown-type {
  width: 80px;
  font-weight: 500;
  color: var(--text-secondary);
}

.breakdown-values {
  flex: 1;
  color: var(--text-muted);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
}

.breakdown-diff {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  min-width: 50px;
  text-align: right;
}

.breakdown-diff.up {
  color: var(--danger);
}

.breakdown-diff.down {
  color: var(--success);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  animation: fadeInUp 0.4s ease both;
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state h2,
.empty-state h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 300px;
  margin-bottom: 20px;
}

/* Loading */
.loading-container {
  padding: 20px 0;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.skeleton-card {
  height: var(--skeleton-h, 100px);
  background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius);
  animation: shimmer 1.5s infinite;
}

.skeleton-row {
  height: 64px;
  background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius);
  animation: shimmer 1.5s infinite;
  margin-bottom: 8px;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Responsive */
@media (max-width: 640px) {
  .app-header h1 {
    font-size: 1.2rem;
  }

  .add-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .tab-label {
    display: none;
  }

  .tab-icon {
    font-size: 1.2rem;
  }

  .tab-btn {
    padding: 10px 8px;
  }

  .summary-cards {
    grid-template-columns: 1fr 1fr;
  }

  .type-cards {
    grid-template-columns: 1fr;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .bill-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .bill-item-right {
    width: 100%;
    justify-content: space-between;
  }

  .filter-sort-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .comparison-totals {
    gap: 10px;
  }

  .comparison-total-value {
    font-size: 1rem;
  }

  .breakdown-type {
    width: 60px;
    font-size: 0.75rem;
  }
}

@media (max-width: 380px) {
  .summary-cards {
    grid-template-columns: 1fr;
  }
}
```

<!-- WALKTHROUGH_SCRIPT:
[
  {"step": 1, "narration": "Welcome to Bill Tracker — your personal utility expense manager. The dashboard shows your monthly spending at a glance.", "view": "user", "highlight_selector": ".summary-cards", "wait_for": "tap_to_continue"},
  {"step": 2, "narration": "Each utility type is broken down with totals, averages, and bill counts so you can see where your money goes.", "view": "user", "highlight_selector": ".type-cards", "wait_for": "tap_to_continue"},
  {"step": 3, "narration": "Tap the '+ Add Bill' button to log a new utility bill. Choose the type, enter the amount, date, and provider.", "view": "user", "highlight_selector": ".add-btn", "wait_for": "user_interaction"},
  {"step": 4, "narration": "Select the bill type using the category chips, fill in the details, and save.", "view": "user", "highlight_selector": ".type-selector", "wait_for": "user_interaction"},
  {"step": 5, "narration": "Switch to the Bills tab to see all your recorded bills. Filter by type, search by provider, and sort by date or amount.", "view": "user", "highlight_selector": ".tab-nav", "wait_for": "user_interaction"},
  {"step": 6, "narration": "The Compare tab shows month-over-month trends with charts and detailed breakdowns so you can track spending patterns over time.", "view": "user", "highlight_selector": ".charts-grid", "wait_for": "tap_to_continue"},
  {"step": 7, "narration": "Tap any bill to edit it, or use the delete button to remove it. Your data syncs across all your devices automatically.", "view": "user", "highlight_selector": ".bill-list", "wait_for": "tap_to_continue"}
]
-->

.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px 28px;
  text-align: center;
}

.auth-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: var(--accent-muted);
  font-size: 2rem;
}

.auth-card h1 {
  font-family: 'Space Grotesk', sans-serif;
  color: var(--primary);
  font-size: 1.6rem;
  margin-bottom: 10px;
}

.auth-card p {
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.auth-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--border-light);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-full);
  background: var(--accent-muted);
  color: var(--primary-dark);
  font-size: 0.875rem;
  font-weight: 600;
}

.sign-out-btn {
  padding: 10px 16px;
}

@media (max-width: 640px) {
  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .user-chip {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.chart-skeleton {
  min-height: 300px;
}

.chart-card canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

@media (max-width: 640px) {
  .chart-wrapper {
    height: 240px;
  }

  .doughnut-wrapper {
    height: 220px;
  }
}

.export-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.export-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.export-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.export-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.export-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.export-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.export-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.export-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.export-option {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--card);
  color: var(--text-secondary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.export-option:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.export-option.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.export-btn {
  margin-left: auto;
}

.export-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--border-light);
  border-radius: var(--radius);
  padding: 10px 12px;
}

@media (max-width: 640px) {
  .export-controls {
    align-items: stretch;
  }

  .export-btn {
    width: 100%;
    margin-left: 0;
  }
}

.ai-section {
  margin-bottom: 32px;
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ai-status {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  background: var(--border-light);
  color: var(--text-secondary);
  white-space: nowrap;
}

.ai-status.loading {
  background: var(--accent-muted);
  color: var(--primary);
}

.ai-status.ready {
  background: var(--success-bg);
  color: var(--success);
}

.ai-analysis-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
}

.ai-summary {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 16px;
}

.ai-block {
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
  margin-top: 14px;
}

.ai-block h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}

.ai-list {
  margin-left: 18px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-recommendations {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.ai-recommendation {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--border-light);
}

.ai-recommendation.impact-high {
  border-left: 3px solid var(--danger);
}

.ai-recommendation.impact-medium {
  border-left: 3px solid var(--accent);
}

.ai-recommendation.impact-low {
  border-left: 3px solid var(--success);
}

.ai-rec-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.ai-rec-title {
  font-weight: 700;
  color: var(--text);
}

.ai-impact-pill {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--card);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.ai-rec-detail {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.ai-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.88rem;
  margin-bottom: 12px;
}

.ai-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.ai-loading {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 640px) {
  .section-header-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .ai-status {
    align-self: flex-start;
  }
}

.annual-report-container {
  position: relative;
  opacity: 0;
  pointer-events: none;
  height: 0;
  overflow: hidden;
}

.annual-report {
  background: #fff;
  color: #111827;
  padding: 24px;
  font-family: 'DM Sans', sans-serif;
}

.annual-report h1,
.annual-report h2,
.annual-report h3 {
  font-family: 'Space Grotesk', sans-serif;
  color: #0f2440;
}

.annual-report h1 {
  font-size: 28px;
  margin-bottom: 8px;
}

.annual-report-intro {
  margin-bottom: 20px;
  color: #4b5563;
}

.annual-report-year {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e5e7eb;
}

.annual-report-metrics,
.annual-report-months {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.annual-report-metrics div,
.annual-report-months div {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
}

.annual-report-metrics span,
.annual-report-months span {
  display: block;
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.annual-report-metrics strong,
.annual-report-months strong {
  font-size: 14px;
  color: #111827;
}

.annual-report-subsection {
  margin-top: 16px;
}

.annual-report-subsection table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.annual-report-subsection th,
.annual-report-subsection td {
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
}

.annual-report-subsection th {
  background: #f9fafb;
}

@media (max-width: 640px) {
  .annual-report-metrics,
  .annual-report-months {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
