:root {
  --bg: #FAFBFC;
  --card: #FFFFFF;
  --card-hover: #F8FAFC;
  --border: #E2E8F0;
  --border-light: #CBD5E1;
  --text: #0F172A;
  --text-dim: #475569;
  --text-muted: #64748B;
  --accent: #059669;
  --accent-light: #10B981;
  --accent-dark: #047857;
  --navy: #0F172A;
  --emerald: #059669;
  --emerald-light: #D1FAE5;
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --blue: #2563EB;
  --orange: #EA580C;
  --purple: #7C3AED;
  --red: #DC2626;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

.hero {
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--emerald-light) 100%);
  border-bottom: 1px solid var(--border);
  padding: 2rem 1.5rem 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23059669' fill-opacity='0.03' fill-rule='nonzero'%3E%3Ccircle cx='7' cy='7' r='7'/%3E%3Ccircle cx='53' cy='53' r='7'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.hero-badge {
  display: none;
}

.pulse {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--navy);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.hero h1 .accent { color: var(--accent); }

.hero .subtitle {
  color: var(--text-dim);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.hero-stat { text-align: center; }

.hero-stat .num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  display: block;
}

.hero-stat .num.city {
  font-size: 1.5rem;
}

.hero-stat .lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 2rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  white-space: nowrap;
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-dim);
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  text-decoration: none;
}

.tab-btn:hover {
  background: var(--gray-50);
  color: var(--text);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.tab-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.section h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.last-updated {
  background: var(--gray-100);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  font-size: 0.85rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.attribution {
  background: linear-gradient(135deg, var(--emerald-light) 0%, var(--gray-100) 100%);
  border: 1px solid var(--accent);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  text-align: center;
}

.attribution h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.75rem;
}

.attribution p { color: var(--text-dim); margin-bottom: 1rem; }

.attribution-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.attribution-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--accent);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.attribution-link:hover {
  background: var(--accent);
  color: white;
  transform: translateY(-1px);
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--gray-50);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.filter-group { display: flex; flex-direction: column; gap: 0.5rem; }

.filter-label { font-weight: 600; color: var(--text); font-size: 0.875rem; }

.filter-input, .filter-select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color 0.2s ease;
}

.filter-input:focus, .filter-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.fund-size-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.size-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-dim);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.size-btn:hover, .size-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.fund-table-container {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  max-height: 600px;
  overflow-y: auto;
}

.fund-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

.fund-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  color: var(--text);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  background: var(--gray-50);
  position: sticky;
  top: 0;
  z-index: 10;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.fund-table th:hover { background: var(--gray-100); }

.fund-table th.sortable::after { content: '↕'; margin-left: 0.5rem; color: var(--text-muted); }
.fund-table th.sort-asc::after { content: '↑'; color: var(--accent); }
.fund-table th.sort-desc::after { content: '↓'; color: var(--accent); }

.fund-table td {
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.5);
  vertical-align: middle;
}

.fund-table tbody tr:hover { background: var(--gray-50); }

.fund-name { font-weight: 600; color: var(--navy); }
.fund-amount { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.fund-location { color: var(--text-dim); }

.fund-number {
  display: inline-block;
  background: var(--gray-100);
  color: var(--text);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.source-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.source-link:hover { text-decoration: underline; }

.loading { text-align: center; padding: 3rem; color: var(--text-muted); }

.loading-spinner {
  display: inline-block;
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.chart-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 1rem;
}

.chart-container { width: 100%; height: 250px; position: relative; }
.chart-container canvas, .chart-container svg { width: 100%; height: 100%; }

.this-week-funds {
  background: linear-gradient(135deg, var(--emerald-light) 0%, var(--gray-100) 100%);
  border: 1px solid var(--accent);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.this-week-funds h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.week-fund-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.2s ease;
}

.week-fund-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.week-fund-item:last-child { margin-bottom: 0; }

.week-fund-name { font-weight: 700; color: var(--navy); }
.week-fund-details { color: var(--text-dim); font-size: 0.875rem; }
.week-fund-amount { font-weight: 700; color: var(--accent); font-size: 1.125rem; }

.city-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.city-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  transition: transform 0.2s ease;
}

.city-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.city-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.city-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 1rem; }
.city-stat { text-align: center; }
.city-stat-num { font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.city-stat-lbl { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.city-recent {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-dim);
}

.pagination { display: flex; justify-content: center; gap: 0.5rem; margin-top: 2rem; }

.pagination button {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

.pagination button:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--accent);
}

.pagination button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }

.footer {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  background: var(--gray-50);
}

.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

.error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #DC2626;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.hidden { display: none !important; }

.seo-intro {
  max-width: 800px;
  margin: 0 auto 2rem;
  padding: 1.25rem 1.5rem;
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.7;
  text-align: center;
}

@media (max-width: 768px) {
  .hero { padding: 2.5rem 1.25rem 2rem; }
  .hero h1 { font-size: 2.5rem; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
  .container { padding: 1.5rem 1rem; }
  .filters { grid-template-columns: 1fr; gap: 1rem; }
  .fund-table th, .fund-table td { padding: 0.75rem 0.5rem; font-size: 0.8rem; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .city-grid { grid-template-columns: 1fr; }
  .attribution-links { flex-direction: column; align-items: center; }
}
