:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --primary: #0f766e;
  --primary-hover: #0d5e58;
  --primary-soft: #ccfbf1;
  --detected: #dc2626;
  --detected-bg: #fef2f2;
  --moderate: #d97706;
  --moderate-bg: #fffbeb;
  --clear: #059669;
  --clear-bg: #ecfdf5;
  --unavailable: #64748b;
  --unavailable-bg: #f1f5f9;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.muted {
  color: var(--muted);
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.15rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #0f172a;
  color: #ffffff;
}

.brand-au {
  color: var(--primary);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
}

.header-nav a:hover {
  color: var(--text);
}

.pill-count {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: 4px;
}

/* Buttons */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--surface-alt);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.btn-icon {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
}

/* Hero */
.hero {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  border-bottom: 1px solid var(--border);
  padding: 48px 0 40px;
}

.hero-inner {
  text-align: center;
  max-width: 900px;
}

.hero-badge {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(1.85rem, 3.6vw, 2.7rem);
  line-height: 1.16;
  letter-spacing: -0.02em;
}

.hero-sub {
  margin: 0 auto 28px;
  max-width: 700px;
  color: var(--muted);
  font-size: 1.05rem;
}

.search-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: left;
}

.search-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.input-wrap {
  position: relative;
}

.address-wrap {
  flex: 1.6;
}

.email-wrap {
  flex: 1;
}

.search-row input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
}

.search-row input:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}

.suggest-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  list-style: none;
  margin: 0;
  padding: 6px;
  z-index: 50;
  max-height: 260px;
  overflow-y: auto;
}

.suggest-dropdown li {
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
}

.suggest-dropdown li:hover {
  background: var(--surface-alt);
}

.suggest-lga {
  font-size: 0.78rem;
  color: var(--muted);
}

.sample-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.sample-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.sample-chip {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.8rem;
  color: var(--text);
  cursor: pointer;
}

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

.hero-stats {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: var(--muted);
}

/* Scan Progress */
.scan-card {
  margin: 28px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.scan-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.scan-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.scan-header p {
  margin: 2px 0 0;
  font-size: 0.9rem;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-track {
  height: 8px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.25s ease;
}

.scan-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.scan-step.done {
  color: var(--clear);
  font-weight: 600;
}

/* Error */
.error-banner {
  margin: 20px 0;
  padding: 14px 18px;
  background: var(--detected-bg);
  border: 1px solid #fecaca;
  color: var(--detected);
  border-radius: var(--radius);
  font-weight: 600;
}

/* Report Dashboard */
#report-section {
  padding: 28px 20px 44px;
}

.report-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.report-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.mono-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
}

.email-note {
  font-size: 0.82rem;
  color: var(--clear);
  font-weight: 600;
}

.report-title {
  margin: 0 0 4px;
  font-size: 1.65rem;
}

.report-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.report-actions {
  display: flex;
  gap: 10px;
}

/* Summary Grid */
.summary-grid {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.verdict-card, .metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.verdict-card.tone-high {
  border-left: 5px solid var(--detected);
}

.verdict-card.tone-moderate {
  border-left: 5px solid var(--moderate);
}

.verdict-card.tone-low {
  border-left: 5px solid var(--clear);
}

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

.verdict-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 4px 0 6px;
}

.verdict-facts {
  font-size: 0.86rem;
  color: var(--muted);
}

.metric-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.metric-num {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.1;
}

.metric-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 600;
}

.metric-detected .metric-num { color: var(--detected); }
.metric-moderate .metric-num { color: var(--moderate); }
.metric-clear .metric-num { color: var(--clear); }
.metric-unavailable .metric-num { color: var(--unavailable); }

/* Visual Grid */
.visual-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.panel-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.layer-toggles {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--muted);
}

.layer-toggles label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.spatial-map-wrap {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  height: 340px;
  position: relative;
}

.spatial-map-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}

.dot-parcel { background: #0f766e; }
.dot-flood { background: #3b82f6; }
.dot-bushfire { background: #ef4444; }
.dot-heritage { background: #a855f7; }
.dot-rail { background: #475569; }

.census-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.census-box {
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.census-val {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
}

.census-lbl {
  font-size: 0.75rem;
  color: var(--muted);
}

.school-list, .parcel-specs {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 12px;
  font-size: 0.88rem;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
}

.spec-row span:first-child {
  color: var(--muted);
}

.spec-row strong {
  text-align: right;
}

/* 19-Point Ledger */
.ledger-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.ledger-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.ledger-header h3 {
  margin: 0 0 4px;
}

.ledger-header p {
  margin: 0;
  font-size: 0.88rem;
}

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}

.filter-pill.active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.category-select {
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0 10px;
  font-size: 0.84rem;
  background: #fff;
}

.ledger-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.check-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.check-summary {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 14px 16px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
}

.check-summary:hover {
  background: #f8fafc;
}

.check-num {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-alt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--muted);
}

.check-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.check-title {
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--text);
}

.check-cat {
  font-size: 0.76rem;
  color: var(--muted);
}

.check-sub {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 2px;
}

.status-badge {
  font-size: 0.74rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}

.status-DETECTED {
  background: var(--detected-bg);
  color: var(--detected);
}

.status-MODERATE {
  background: var(--moderate-bg);
  color: var(--moderate);
}

.status-CLEAR {
  background: var(--clear-bg);
  color: var(--clear);
}

.status-UNAVAILABLE {
  background: var(--unavailable-bg);
  color: var(--unavailable);
}

.check-details {
  border-top: 1px solid var(--border);
  background: #f8fafc;
  padding: 14px 16px 14px 64px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  font-size: 0.86rem;
}

.detail-block h5 {
  margin: 0 0 4px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.detail-block p {
  margin: 0;
  color: var(--text);
}

/* Lead Panel */
.lead-panel {
  margin-top: 20px;
  background: linear-gradient(135deg, #0f172a 0%, #134e4a 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px;
}

.lead-copy h3 {
  margin: 0 0 6px;
}

.lead-copy .muted {
  color: #cbd5e1;
  margin: 0 0 14px;
  font-size: 0.92rem;
}

.lead-form {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1.2fr auto;
  gap: 10px;
}

.lead-form input,
.lead-form select {
  height: 44px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0 12px;
  font-size: 0.9rem;
  background: #fff;
  color: var(--text);
}

.lead-status {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #ecfdf5;
  font-size: 0.88rem;
  font-weight: 600;
}

@media (max-width: 900px) {
  .lead-form {
    grid-template-columns: 1fr;
  }
}

/* Info Sections */
.info-section {
  padding: 44px 0;
  border-top: 1px solid var(--border);
  background: #fff;
}

.section-title {
  margin: 0 0 20px;
  font-size: 1.4rem;
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.pillar-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--bg);
}

.pillar-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 6px;
}

.pillar-card h4 {
  margin: 0 0 8px;
}

.pillar-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.sources-section {
  padding: 30px 0;
  border-top: 1px solid var(--border);
}

.sources-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 20px;
}

.modal-card {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: var(--shadow);
}

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

.modal-header h3 {
  margin: 0;
}

.shortlist-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.shortlist-actions {
  display: flex;
  gap: 8px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 20px 0;
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 900px) {
  .search-row {
    flex-direction: column;
  }
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .verdict-card {
    grid-column: 1 / -1;
  }
  .visual-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .no-print {
    display: none !important;
  }
  body {
    background: #fff;
  }
  .check-details {
    display: grid !important;
  }
  .panel, .ledger-panel, .verdict-card, .metric-card {
    box-shadow: none;
    break-inside: avoid;
  }
}

