:root {
  --navy: #1a2a3a;
  --blue: #1565C0;
  --blue-lt: #4a7a9a;
  --green: #2E7D32;
  --green-m: #5a7a6a;
  --gold: #C09030;
  --gold-lt: #D4A843;
  --bg: #f2f3ee;
  --bdr: #dde0d8;
  --txt: #333;
  --txt-lt: #666;
  --rad: 6px;
  --serif: 'Libre Baskerville', Georgia, serif;
  --sans: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.10);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--sans); background: var(--bg); color: var(--txt); -webkit-font-smoothing: antialiased; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── INPUT VIEW ── */
.input-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #eef1ea 0%, #e4eaf2 50%, #eef1ea 100%);
  position: relative;
  overflow: hidden;
}
.input-view .grid-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0.06; pointer-events: none;
}
.input-content {
  position: relative; z-index: 1; text-align: center;
  max-width: 660px; width: 100%; padding: 0 28px;
  animation: fadeUp 0.6s ease forwards;
}
.input-content h1 {
  font-family: var(--serif);
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 400;
  color: var(--navy);
  margin: 36px 0 40px;
  line-height: 1.35;
}
.search-bar {
  position: relative;
  display: flex;
  max-width: 560px;
  margin: 0 auto;
  box-shadow: var(--shadow-lg);
  border-radius: var(--rad);
  overflow: visible;
  border: 1px solid var(--bdr);
  background: white;
}
.search-bar input {
  flex: 1;
  padding: 16px 20px;
  font-size: 15px;
  border: none;
  outline: none;
  font-family: var(--sans);
  color: var(--txt);
  background: transparent;
  border-radius: var(--rad) 0 0 var(--rad);
}
.search-bar button {
  padding: 16px 28px;
  background: var(--blue-lt);
  color: white;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
  white-space: nowrap;
  border-radius: 0 var(--rad) var(--rad) 0;
  transition: background 0.2s;
}
.search-bar button:hover { background: var(--blue); }
.search-bar button:disabled { background: #8aa0b4; cursor: wait; }

.dropdown {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: white;
  border: 1px solid var(--bdr);
  border-top: none;
  border-radius: 0 0 var(--rad) var(--rad);
  max-height: 280px;
  overflow-y: auto;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  display: none;
}
.dropdown.active { display: block; }
.dropdown-item {
  padding: 12px 20px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}
.dropdown-item:hover { background: #f0f4f8; }
.dropdown-item strong { color: var(--navy); }
.dropdown-item .meta { color: #999; font-size: 12px; display: block; margin-top: 2px; }

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--bdr);
  border-top: 3px solid var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}
.data-note { margin-top: 28px; font-size: 13px; color: #999; line-height: 1.6; }

/* ── TOP BAR ── */
.topbar {
  background: white;
  border-bottom: 1px solid var(--bdr);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-logo { cursor: pointer; display: flex; align-items: center; gap: 8px; }
.topbar-logo span { font-family: var(--serif); font-size: 18px; font-weight: 700; color: #1a3a2a; }
.topbar-actions { display: flex; gap: 10px; }
.btn-outline {
  padding: 8px 16px; background: none;
  border: 1px solid var(--bdr); border-radius: var(--rad);
  font-size: 13px; cursor: pointer; color: #555; font-family: var(--sans);
}
.btn-primary {
  padding: 8px 20px; background: var(--blue); color: white;
  border: none; border-radius: var(--rad);
  font-size: 13px; cursor: pointer; font-weight: 600; font-family: var(--sans);
}

/* ── REPORT ── */
.report-page {
  max-width: 820px;
  margin: 28px auto;
  background: white;
  border-radius: var(--rad);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: fadeUp 0.5s ease forwards;
}
.report-header {
  background: linear-gradient(135deg, #f7f9f6, #edf1f7);
  padding: 32px 44px 24px;
  border-bottom: 3px solid var(--blue);
}
.report-header h1 {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 700;
  color: var(--navy);
  margin: 16px 0 6px;
}
.report-body { padding: 28px 44px 36px; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 28px; }
.report-card {
  border: 1px solid var(--bdr);
  border-radius: var(--rad);
  padding: 22px;
}
.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 14px;
  padding-bottom: 8px;
  font-family: var(--sans);
}
.section-title.gold { border-bottom: 2px solid var(--gold-lt); }
.section-title.blue { border-bottom: 2px solid var(--blue); }
.section-title.plain { border-bottom: none; margin-bottom: 12px; }
.overview-list {
  font-size: 13px;
  line-height: 1.85;
  color: #444;
  list-style: disc;
  padding-left: 20px;
  margin: 0;
}
.legend-item {
  display: flex; align-items: center; gap: 8px; margin-bottom: 7px;
}
.legend-dot { width: 12px; height: 12px; border-radius: 2px; flex-shrink: 0; }
.legend-item span { font-size: 12.5px; color: #333; }

.bar-group { margin-bottom: 14px; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.bar-label { font-size: 11px; color: #666; width: 90px; flex-shrink: 0; text-align: right; }
.bar-label.sub { font-size: 10px; color: #999; }
.bar-track { flex: 1; background: #eaebe6; border-radius: 4px; overflow: hidden; }
.bar-fill { border-radius: 4px; display: flex; align-items: center; padding-left: 8px; transition: width 0.8s ease; }
.bar-fill span { font-weight: 700; }
.bar-fill.primary { background: var(--blue); height: 20px; }
.bar-fill.primary span { color: white; font-size: 11px; }
.bar-fill.avg { background: #b0b3aa; height: 14px; }
.bar-fill.avg span { color: white; font-size: 10px; }

.demand-dot {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px;
}
.demand-dot .dot { width: 13px; height: 13px; border-radius: 50%; margin-top: 3px; flex-shrink: 0; }
.demand-dot .text { font-size: 13px; color: #444; line-height: 1.5; }
.demand-dot strong { color: var(--navy); }

.recs-box {
  background: var(--navy);
  border-radius: var(--rad);
  padding: 22px 28px;
  color: white;
}
.recs-box h3 { font-size: 15px; font-weight: 700; margin: 0 0 14px; color: var(--gold-lt); }
.recs-box .rec-line { font-size: 13px; line-height: 2.1; }
.recs-box .check { color: var(--gold-lt); margin-right: 8px; }

.report-footer {
  border-top: 1px solid var(--bdr);
  padding: 14px 44px;
  text-align: center;
  font-size: 11px;
  color: #aaa;
}

/* Leaflet map container */
#report-map {
  width: 100%;
  height: 280px;
  border-radius: var(--rad);
  border: 1px solid var(--bdr);
  z-index: 1;
}
.map-stats {
  margin-top: 10px;
  display: flex;
  gap: 14px;
  font-size: 10px;
  color: #888;
}
.map-stats strong { color: #444; }

.page-footer {
  text-align: center;
  padding: 16px 0 44px;
  font-size: 11px;
  color: #bbb;
}

/* Logo */
.logo { display: flex; align-items: center; gap: 10px; }
.logo-text { text-align: left; }
.logo-name { font-weight: 700; color: #1a3a2a; font-family: var(--serif); line-height: 1.1; }
.logo-name sup { vertical-align: super; }
.logo-tagline { color: var(--green-m); font-style: italic; }

/* Print */
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .report-page { box-shadow: none !important; margin: 0 !important; max-width: 100% !important; border-radius: 0 !important; }
  #report-map { height: 250px; }
}

/* Mobile */
@media (max-width: 700px) {
  .report-grid { grid-template-columns: 1fr; }
  .report-header, .report-body { padding-left: 20px; padding-right: 20px; }
  .report-footer { padding-left: 20px; padding-right: 20px; }
  .topbar { padding: 10px 12px; }
}
