/* Copyright 2026 Automated Insights LLC. All rights reserved. */
/* Proprietary and confidential. Unauthorized copying prohibited. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --border: #dee2e6;
  --text: #212529;
  --text-muted: #545b62;
  --accent: #2563eb;
  --accent-dim: rgba(37,99,235,0.1);
  --danger: #dc2626;
  --warning: #b45309;
  --success: #16a34a;
  --info: #0284c7;
}

html, body {
  height: 100%;
  overflow: hidden;
}

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

/* --- Header --- */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  gap: 0.75rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

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

.logo span { color: var(--accent); }

.tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: none;
}

@media (min-width: 640px) {
  .tagline { display: block; }
}

.header-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.kofi-btn {
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: #ff5e5b;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s;
  white-space: nowrap;
}
.kofi-btn:hover { background: #e04745; }
@media (max-width: 640px) {
  .kofi-btn { font-size: 0.7rem; padding: 0.25rem 0.5rem; }
}

.back-link {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.back-link:hover { color: var(--accent); }

/* --- Search bar (inline in header) --- */
.search-wrap {
  flex: 1;
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 0.75rem;
  transition: border-color 0.2s;
  height: 34px;
}

.search-wrap:focus-within {
  border-color: var(--accent);
}

.search-icon { flex-shrink: 0; }

#address-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  outline: none;
}

#address-input::placeholder { color: var(--text-muted); }

#search-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

#search-btn:hover { background: #1d4ed8; }

.search-results {
  position: fixed;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  max-width: 500px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 200;
}

.search-results.hidden { display: none; }

.search-result-item {
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.search-result-item:last-child { border-bottom: none; }

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

.search-result-item .match-addr {
  color: var(--text);
}

.search-result-item .match-city {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.search-no-results {
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* --- Main layout --- */
#app {
  position: fixed;
  top: 48px; /* header only */
  left: 0;
  right: 0;
  bottom: 0;
}

#map {
  width: 100%;
  height: 100%;
}

/* --- Panel --- */
.panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 100%;
  height: 100%;
  background: var(--bg);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.25s ease;
}

.panel.hidden {
  transform: translateX(100%);
}

.panel-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
  padding: 0.25rem;
}

.panel-close:hover { color: var(--text); }

.panel-address {
  padding: 1.25rem 1.25rem 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  padding-right: 2.5rem;
}

/* --- Summary cards --- */
.panel-summary {
  padding: 0 1.25rem;
}

.panel-summary.hidden { display: none; }

.summary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
  text-align: center;
}

.summary-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.summary-value {
  font-size: 1.25rem;
  font-weight: 700;
}

/* Risk coloring */
.risk-high { color: var(--danger); }
.risk-medium { color: var(--warning); }
.risk-low { color: var(--success); }
.risk-info { color: var(--info); }

/* --- Detail sections --- */
.panel-details { padding: 0.5rem 1.25rem 2rem; }
.panel-details.hidden { display: none; }

.detail-section {
  margin-bottom: 1.5rem;
}

.detail-section h3 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.detail-item {
  background: var(--surface);
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
}

.detail-item.full-width {
  grid-column: 1 / -1;
}

.detail-item .d-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-item .d-value {
  font-size: 0.92rem;
  font-weight: 500;
  margin-top: 0.15rem;
}

/* Broadband table */
.broadband-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.broadband-table th {
  text-align: left;
  padding: 0.5rem 0.6rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.broadband-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.broadband-table tr:last-child td { border-bottom: none; }

/* --- Loading --- */
.panel-loading {
  padding: 3rem 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.panel-loading.hidden { display: none; }

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

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

.spinner-inline {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

/* --- Layer panel --- */
.layer-panel {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 50;
  min-width: 200px;
}

.layer-panel-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  width: 100%;
}

.layer-panel-toggle:hover {
  border-color: var(--accent);
}

.layer-panel-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 0.4rem;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}

.layer-panel-body.open {
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.85rem;
}

.layer-item:last-child { border-bottom: none; }
.layer-item:hover { background: var(--surface-2); }

.layer-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.layer-item .layer-icon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.layer-item .layer-loading {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* --- Legend --- */
.legend {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  z-index: 50;
  min-width: 120px;
  max-width: 180px;
  opacity: 1;
  font-size: 0.7rem;
}

.legend.hidden { display: none; }

.legend-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  margin-top: 0.35rem;
}

.legend-section-title:first-child {
  margin-top: 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.15rem;
  font-size: 0.75rem;
  color: var(--text);
}

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

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-swatch.circle {
  border-radius: 50%;
}

/* --- Footer --- */
footer {
  display: none; /* hidden when map is fullscreen */
}

/* --- Drag handle bar for bottom sheets --- */
.drag-handle {
  display: none;
}

.drag-handle-bar {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

/* --- Mobile adjustments --- */
@media (max-width: 640px) {
  /* --- Info panel as draggable bottom sheet with snap points --- */
  .panel {
    width: 100%;
    top: auto;
    bottom: 0;
    height: 25%;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
    transition: height 0.3s ease, transform 0.25s ease;
    will-change: height, transform;
  }

  .panel.snap-peek { height: 25%; }
  .panel.snap-half { height: 55%; }
  .panel.snap-full { height: 90%; }
  .panel.dragging { transition: none; }

  .panel.hidden {
    transform: translateY(100%);
  }

  .drag-handle {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0 0.25rem;
    cursor: grab;
    touch-action: none;
  }

  /* --- Layer panel as full-width bottom sheet --- */
  .layer-panel {
    position: absolute;
    top: auto;
    bottom: 5rem;
    left: 0.75rem;
    min-width: auto;
    max-width: none;
    width: auto;
    z-index: 50;
  }

  .layer-panel-toggle {
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    border-radius: 8px;
  }

  .layer-panel-body {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin-top: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    z-index: 150;
    transform: translateY(100%);
    transition: transform 0.3s ease, max-height 0.3s ease;
    max-height: 0;
  }

  .layer-panel-body.open {
    transform: translateY(0);
    max-height: 70vh;
    overflow-y: auto;
  }

  .layer-panel-body .drag-handle {
    display: flex;
  }

  .layer-panel-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 140;
  }

  .layer-panel-backdrop.visible {
    display: block;
  }

  .layer-item {
    padding: 0.65rem 0.75rem;
    font-size: 0.82rem;
    gap: 0.5rem;
    min-height: 48px;
  }

  .layer-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }

  .layer-item .layer-icon {
    width: 20px;
    font-size: 1rem;
  }

  .legend {
    top: 0.5rem;
    right: 0.5rem;
    max-width: 150px;
  }

  .search-wrap {
    max-width: 280px;
  }

  #address-input {
    font-size: 16px;
    padding: 0.3rem 0.5rem;
  }

  #search-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.82rem;
  }

  .summary-value {
    font-size: 1rem;
  }

  .panel-address {
    font-size: 0.85rem;
    padding: 1rem 1rem 0.5rem;
  }
}

/* --- Map marker --- */
.map-marker {
  width: 24px;
  height: 24px;
  background: var(--accent);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

/* --- Layer group collapsible --- */
.layer-group { border-bottom: 1px solid var(--border); }
.layer-group:last-child { border-bottom: none; }
.layer-group-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.layer-group-header:hover { color: var(--text); }
.layer-group-header svg {
  transition: transform 0.2s;
  flex-shrink: 0;
}
.layer-group-header.collapsed svg { transform: rotate(-90deg); }
.layer-group-items { overflow: hidden; max-height: 500px; transition: max-height 0.25s ease; }
.layer-group-items.collapsed { max-height: 0; }

/* --- Scrollbar styling for layer and info panels --- */
.layer-panel-body::-webkit-scrollbar,
.panel::-webkit-scrollbar {
  width: 6px;
}
.layer-panel-body::-webkit-scrollbar-track,
.panel::-webkit-scrollbar-track {
  background: var(--surface-2);
}
.layer-panel-body::-webkit-scrollbar-thumb,
.panel::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.layer-panel-body::-webkit-scrollbar-thumb:hover,
.panel::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --- Zoom hint --- */
.zoom-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 100;
  transition: opacity 0.3s;
}
.zoom-hint.hidden { opacity: 0; pointer-events: none; }

/* --- Onboarding overlay --- */
.onboarding-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.onboarding-overlay.hidden { display: none; }
.onboarding-content {
  background: var(--surface);
  border-radius: 16px;
  padding: 2rem 2.5rem;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}
.onboarding-icon { margin-bottom: 1rem; }
.onboarding-content p {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.6;
}

/* --- Toast notifications --- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  pointer-events: none;
}
.toast-error {
  background: #1a1a2e;
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-size: 0.82rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  pointer-events: auto;
  opacity: 1;
  transition: opacity 0.4s ease;
}
.toast-error.fade-out { opacity: 0; }

/* --- Preset buttons --- */
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.preset-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.7rem;
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.preset-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

/* --- Freeboard display --- */
.freeboard-positive { color: var(--success); font-weight: 600; }
.freeboard-negative { color: var(--danger); font-weight: 600; }

/* --- Legend sources --- */
.legend-sources {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  padding-top: 0.3rem;
  border-top: 1px solid var(--border);
}

/* --- Focus indicators --- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Reduced motion support --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Skip navigation link --- */
.skip-nav {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 300;
  font-size: 0.85rem;
  text-decoration: none;
  border-radius: 0 0 4px 0;
}
.skip-nav:focus {
  top: 0;
}

/* --- Panel toolbar (Report + Compare buttons) --- */
.panel-toolbar {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem 0;
  padding-right: 2.5rem;
}
.panel-toolbar-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.panel-toolbar-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.panel-toolbar-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* --- Comparison view --- */
.compare-view { padding: 0 1.25rem 2rem; }
.compare-view.hidden { display: none; }
.compare-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.compare-header h3 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.compare-clear-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.7rem;
  cursor: pointer;
  color: var(--text-muted);
}
.compare-clear-btn:hover { border-color: var(--danger); color: var(--danger); }
.compare-addresses {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.compare-addr-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}
.compare-addr-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}
.compare-table {
  width: 100%;
  border-collapse: collapse;
}
.compare-table th {
  text-align: left;
  padding: 0.4rem 0.5rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.compare-table td {
  padding: 0.45rem 0.5rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.compare-table tr:last-child td { border-bottom: none; }
.compare-better { color: var(--success); font-weight: 600; }
.compare-worse { color: var(--danger); font-weight: 600; }
.compare-neutral { color: var(--text); }

/* --- Nearest amenities section --- */
.amenity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.amenity-row:last-child { border-bottom: none; }
.amenity-type { color: var(--text-muted); font-size: 0.78rem; }
.amenity-name { font-weight: 500; flex: 1; margin: 0 0.5rem; }
.amenity-distance { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }

/* --- Print / PDF Report styles --- */
@media print {
  /* Hide everything except the report */
  body { overflow: visible !important; background: #fff !important; }
  html, body { height: auto !important; }
  header, #map, .layer-panel, .legend, .panel-close, .panel-toolbar,
  .panel-loading, .onboarding-overlay, .toast-container, footer,
  .compare-view, #search-results, .zoom-hint, .maplibregl-ctrl-group,
  .maplibregl-ctrl-attrib { display: none !important; }

  #app {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
  }

  .panel {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    transform: none !important;
    border: none !important;
    overflow: visible !important;
    background: #fff !important;
  }

  .panel.hidden { display: block !important; transform: none !important; }

  /* Report header */
  .print-report-header {
    display: block !important;
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #2563eb;
  }
  .print-report-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0.25rem;
  }
  .print-report-header .print-subtitle {
    font-size: 1rem;
    color: #212529;
    font-weight: 500;
  }
  .print-report-header .print-date {
    font-size: 0.82rem;
    color: #545b62;
    margin-top: 0.25rem;
  }

  /* Report footer */
  .print-report-footer {
    display: block !important;
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
    font-size: 0.78rem;
    color: #545b62;
  }

  /* Format summary cards in 2-column grid */
  .panel-summary {
    display: block !important;
    padding: 0 !important;
  }
  .summary-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
  }
  .summary-card {
    border: 1px solid #dee2e6;
    break-inside: avoid;
  }
  .panel-details {
    display: block !important;
    padding: 0.5rem 0 !important;
  }
  .detail-section { break-inside: avoid; }

  /* Panel address */
  .panel-address {
    display: none !important;
  }

  /* Clean page setup */
  @page {
    margin: 1.5cm;
    size: letter;
  }
}

/* Hide print elements on screen */
.print-report-header, .print-report-footer { display: none; }

/* --- Commute button --- */
.commute-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.2s, background 0.2s;
  white-space: nowrap;
}
.commute-btn:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.commute-btn.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

/* --- Commute panel --- */
.commute-panel {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 300px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.commute-panel.hidden { display: none; }
.commute-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
}
.commute-panel-header button {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}
.commute-panel-header button:hover { color: var(--text); }
.commute-panel-body {
  padding: 0.75rem;
}
.commute-panel-body label {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.3rem;
}
.commute-input-row {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.commute-input-row input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.82rem;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
}
.commute-input-row input:focus { border-color: var(--accent); }
.commute-input-row button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
}
.commute-input-row button:hover { background: #1d4ed8; }
.commute-result {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 0.6rem;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.commute-result.hidden { display: none; }
.commute-clear {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text-muted);
  width: 100%;
}
.commute-clear.hidden { display: none; }
.commute-clear:hover { border-color: var(--danger); color: var(--danger); }
.commute-iso-label {
  margin-top: 0.5rem;
  font-size: 0.75rem;
}
.commute-iso-label input { accent-color: var(--accent); }

/* --- Commute info overlay on map --- */
.commute-info {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 60;
  white-space: nowrap;
}
.commute-info.hidden { display: none; }

@media (max-width: 640px) {
  .commute-btn { display: none; }
  .commute-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 16px 16px 0 0;
  }
}

/* --- PRO Badge --- */
.pro-badge {
  display: inline-block;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 0.35rem;
  line-height: 1.4;
}

/* Hide PRO badges when user is subscribed */
.hs-pro .pro-badge { display: none; }

/* --- Gated data blur --- */
.pro-gated-data {
  filter: blur(5px);
  user-select: none;
  pointer-events: none;
  opacity: 0.5;
}
.hs-pro .pro-gated-data {
  filter: none;
  user-select: auto;
  pointer-events: auto;
  opacity: 1;
}

/* --- Upgrade Modal --- */
.pro-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: proModalFadeIn 0.2s ease;
}

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

.pro-modal {
  background: var(--surface);
  border-radius: 16px;
  max-width: 420px;
  width: 100%;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: proModalSlideUp 0.25s ease;
  position: relative;
}

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

.pro-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 0.25rem;
}
.pro-modal-close:hover { color: var(--text); }

.pro-modal h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.pro-modal .pro-subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}

.pro-feature-list {
  list-style: none;
  margin-bottom: 1.25rem;
}

.pro-feature-list li {
  font-size: 0.88rem;
  padding: 0.35rem 0;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pro-feature-list li::before {
  content: '\2713';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #d1fae5;
  color: #059669;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.pro-price {
  text-align: center;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
}

.pro-price .pro-price-highlight {
  color: var(--accent);
}

.pro-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pro-btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  width: 100%;
}
.pro-btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-1px);
}

.pro-btn-secondary {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s;
  width: 100%;
}
.pro-btn-secondary:hover {
  border-color: var(--text-muted);
}

/* Email capture state in modal */
.pro-email-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.pro-email-row input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.88rem;
  outline: none;
  color: var(--text);
  background: var(--surface-2);
}
.pro-email-row input:focus { border-color: var(--accent); }

.pro-thanks {
  text-align: center;
  padding: 1rem 0;
  color: var(--success);
  font-weight: 600;
  font-size: 0.92rem;
}

/* --- Toast success variant --- */
.toast-success {
  background: #059669;
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  margin-bottom: 0.5rem;
  animation: toastIn 0.3s ease;
}
.toast-success.fade-out { opacity: 0; transition: opacity 0.4s; }

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

/* --- Deal Calculator --- */
.deal-calc-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  user-select: none;
}
.deal-calc-chevron {
  margin-left: auto;
  transition: transform 0.2s;
  transform: rotate(-90deg);
}
.deal-calc-toggle[aria-expanded="true"] .deal-calc-chevron {
  transform: rotate(0deg);
}
.deal-calc-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  max-height: 800px;
  opacity: 1;
}
.deal-calc-body.collapsed {
  max-height: 0;
  opacity: 0;
}
.deal-calc-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.deal-input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.deal-input-row label {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 100px;
}
.deal-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 0.5rem;
  height: 30px;
  flex: 1;
  max-width: 160px;
  transition: border-color 0.2s;
}
.deal-input-wrap:focus-within {
  border-color: var(--accent);
}
.deal-input-prefix, .deal-input-suffix {
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.deal-input-wrap input {
  border: none;
  background: none;
  outline: none;
  font-size: 0.85rem;
  color: var(--text);
  width: 100%;
  padding: 0 0.25rem;
  text-align: right;
}
.deal-input-row select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 0.5rem;
  height: 30px;
  font-size: 0.85rem;
  color: var(--text);
  flex: 1;
  max-width: 160px;
  cursor: pointer;
}
.deal-input-row select:focus {
  border-color: var(--accent);
  outline: none;
}
.deal-calc-context {
  margin-top: 0.6rem;
  padding: 0.5rem 0.65rem;
  background: var(--surface-2);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.deal-calc-context:empty { display: none; }
.deal-calc-btn {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.45rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}
.deal-calc-btn:hover { background: #1d4ed8; }
.deal-calc-outputs {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.deal-calc-outputs:empty { display: none; }
.deal-output-item {
  background: var(--surface);
  border-radius: 6px;
  padding: 0.55rem 0.65rem;
}
.deal-output-item.full-width {
  grid-column: 1 / -1;
}
.deal-output-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.deal-output-value {
  font-size: 0.92rem;
  font-weight: 600;
  margin-top: 0.1rem;
}
.deal-positive { color: var(--success); }
.deal-negative { color: var(--danger); }
.deal-warning { color: var(--warning); }
.deal-separator {
  grid-column: 1 / -1;
  height: 1px;
  background: var(--border);
  margin: 0.2rem 0;
}

/* --- Property Details (County Appraiser) --- */
.property-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  transition: color 0.2s;
}
.property-link:hover { color: #1d4ed8; text-decoration: underline; }

.property-coming-soon {
  grid-column: 1 / -1;
  text-align: center;
  padding: 1rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
}
.property-coming-soon a {
  color: var(--accent);
  text-decoration: none;
}
.property-coming-soon a:hover { text-decoration: underline; }
