*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
img {
  max-width: 100%;
  height: auto;
  display: block;
}
.mobile-fab {
  display: none;
}

:root {
  --bg: #f4f4f5;
  --surface: #fff;
  --surface-2: #f0f0f0;
  --surface-3: #e8e8e8;
  --border: rgba(0, 0, 0, 0.07);
  --border-md: rgba(0, 0, 0, 0.12);
  --border-hi: rgba(0, 0, 0, 0.18);
  --text-1: #111;
  --text-2: #555;
  --text-3: #999;
  --accent: #1a56db;
  --accent-hi: #2563eb;
  --accent-bg: rgba(26, 86, 219, 0.08);
  --accent-border: rgba(26, 86, 219, 0.25);
  --green: #16a34a;
  --green-bg: rgba(22, 163, 74, 0.1);
  --green-border: rgba(22, 163, 74, 0.25);
  --teal: #0e7490;
  --teal-bg: rgba(14, 116, 144, 0.1);
  --red: #dc2626;
  --red-bg: rgba(220, 38, 38, 0.1);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --sidebar: 224px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "JetBrains Mono", "Fira Code", monospace;
}

[data-theme="dark"] {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-2: #222;
  --surface-3: #2a2a2a;
  --border: rgba(255, 255, 255, 0.07);
  --border-md: rgba(255, 255, 255, 0.11);
  --border-hi: rgba(255, 255, 255, 0.17);
  --text-1: #efefef;
  --text-2: #999;
  --text-3: #555;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body {
  display: flex;
  overflow-x: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 20;
  transition:
    transform 0.25s ease,
    width 0.25s ease;
}
.sidebar-top {
  padding: 18px 14px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-bottom {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 24px;
}
.logo-mark {
  width: 28px;
  height: 28px;
  background: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.logo-mark img {
  width: 28px;
  height: 28px !important;
  max-width: 28px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}
.logo-text {
  font-size: 14.5px;
  font-weight: 400;
  color: var(--text-1);
  letter-spacing: -0.2px;
}
.logo-text strong {
  font-weight: 700;
  color: var(--teal);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--radius-md);
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.12s;
}
.nav-item:hover {
  background: var(--surface-2);
  color: var(--text-1);
}
.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.sidebar-section-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 20px 0 8px 9px;
}

.coverage-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.coverage-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 9px;
  border-radius: var(--radius-md);
}
.coverage-item.active {
  background: var(--teal-bg);
}
.coverage-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
  background: var(--text-3);
}
.coverage-item.active .coverage-dot {
  background: var(--teal);
}
.coverage-item.coming .coverage-dot {
  background: var(--border-md);
}
.coverage-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-1);
}
.coverage-item.coming .coverage-name {
  color: var(--text-3);
}
.coverage-count {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
}
.coverage-item.active .coverage-count {
  color: var(--teal);
}

.account-block {
  display: flex;
  align-items: center;
  gap: 9px;
}
.account-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2);
  flex-shrink: 0;
}
.account-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-1);
}
.account-plan {
  font-size: 11px;
  color: var(--teal);
}

/* ── MOBILE TOPBAR ── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 30;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-1);
  padding: 4px;
}
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 18;
  align-items: center;
  padding: 0 16px 0 56px;
}
.mobile-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 19;
}
.sidebar-overlay.open {
  display: block;
}

/* ── SITE BANNER ── */
.site-banner {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 40px;
  display: flex;
  align-items: center;
  position: fixed;
  top: 0;
  left: var(--sidebar);
  right: 0;
  z-index: 15;
  transition: left 0.25s ease;
}
.site-banner-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
}
.site-banner-logo {
  width: 22px;
  height: 22px !important;
  max-width: 22px;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
}
.site-banner-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
}
.site-banner-name strong {
  font-weight: 700;
  color: var(--teal);
}
.site-banner-tag {
  font-size: 11px;
  color: var(--text-3);
  margin-left: 4px;
}

/* ── MAIN ── */
.main {
  margin-left: var(--sidebar);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 40px;
  min-width: 0;
  max-width: 100%;
}

/* ── TOPBAR ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.topbar-left {
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-1);
}
.page-sub {
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 2px;
  display: block;
}
.data-freshness {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
}
.freshness-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

/* ── SEARCH SECTION ── */
.search-section {
  padding: 20px 24px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  margin-bottom: 14px;
}
.search-icon {
  color: var(--text-3);
  flex-shrink: 0;
}
.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-1);
  font-family: var(--font);
  font-size: 14px;
}
.search-input::placeholder {
  color: var(--text-3);
}
.search-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.search-btn:hover {
  background: var(--accent-hi);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 14px;
}
.filter-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-3);
  margin-right: 2px;
}
.chip {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-md);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
}
.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.chip.active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}
.filter-divider {
  width: 1px;
  height: 20px;
  background: var(--border-md);
  margin: 0 4px;
}
.sort-select {
  padding: 5px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-md);
  background: var(--surface);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 12.5px;
  outline: none;
  cursor: pointer;
}

/* ── STATS BAR ── */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.stat-pill {
  font-size: 12.5px;
  color: var(--text-2);
}
.stat-pill strong {
  color: var(--text-1);
  font-weight: 600;
}
.stat-divider {
  width: 1px;
  height: 14px;
  background: var(--border-md);
}
.stat-spacer {
  flex: 1;
}
.export-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-md);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
}
.export-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── RESULTS ── */
#resultsArea {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}
.results-header {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr 1fr 1.2fr 32px;
  gap: 12px;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
.results-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.result-row {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr 1fr 1.2fr 32px;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  align-items: center;
}
.result-row:hover {
  background: var(--surface-2);
}
.col-address .addr-line {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
}
.col-address .city-line {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
}
.col-owner {
  font-size: 12.5px;
  color: var(--text-2);
}
.col-year,
.col-value {
  font-size: 13px;
  color: var(--text-1);
  font-family: var(--mono);
}
.col-value {
  text-align: right;
  font-weight: 500;
}
.col-arrow {
  display: flex;
  justify-content: center;
  color: var(--text-3);
}

/* ── CLASS TAGS ── */
.class-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.tag-commercial {
  background: rgba(26, 86, 219, 0.1);
  color: #1a56db;
}
.tag-nonprofit {
  background: rgba(22, 163, 74, 0.1);
  color: #16a34a;
}
.tag-municipal {
  background: rgba(217, 119, 6, 0.1);
  color: #d97706;
}
.tag-utility {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}
.tag-other {
  background: var(--surface-2);
  color: var(--text-3);
}

/* ── EMPTY / NO RESULTS ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
}
.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--text-3);
}
.empty-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: 6px;
}
.empty-sub {
  font-size: 13px;
  color: var(--text-3);
}
.no-results {
  text-align: center;
  padding: 48px 24px;
}
.no-results p {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: 6px;
}
.no-results span {
  font-size: 13px;
  color: var(--text-3);
}

/* ── DETAIL PANEL ── */
.detail-panel {
  position: fixed;
  right: -440px;
  top: 0;
  width: 440px;
  max-width: 100vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border-md);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transition: right 0.25s ease;
  overflow: hidden;
}
.detail-panel.open {
  right: 0;
}
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-address {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 3px;
}
.panel-owner {
  font-size: 12.5px;
  color: var(--text-3);
}
.panel-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color 0.12s;
}
.panel-close:hover {
  color: var(--text-1);
}
.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 24px;
}
.value-highlight {
  background: var(--teal-bg);
  border-bottom: 1px solid rgba(14, 116, 144, 0.2);
  padding: 16px 20px;
}
.vh-amount {
  font-size: 22px;
  font-weight: 700;
  color: var(--teal);
  font-family: var(--mono);
}
.vh-label {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 3px;
}
.panel-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.panel-field {
}
.pf-label {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 3px;
}
.pf-value {
  font-size: 13px;
  color: var(--text-1);
}
.pf-value.mono,
.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}
.na {
  color: var(--text-3);
}
.ptc-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 20px 0;
  padding: 10px 16px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.12s;
}
.ptc-btn:hover {
  background: var(--accent);
  color: #fff;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 40;
}
.overlay.open {
  display: block;
}

/* ── SITE FOOTER ── */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  margin-top: auto;
}
.site-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.site-footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-footer-logo {
  width: 20px;
  height: 20px !important;
  max-width: 20px;
  object-fit: contain;
  border-radius: 3px;
  flex-shrink: 0;
}
.site-footer-brand {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-1);
}
.site-footer-brand strong {
  font-weight: 700;
  color: var(--teal);
}
.site-footer-copy {
  font-size: 11px;
  color: var(--text-3);
  margin-left: 6px;
}
.site-footer-links {
  display: flex;
  gap: 16px;
}
.site-footer-links a {
  font-size: 11px;
  color: var(--text-3);
  text-decoration: none;
}
.site-footer-links a:hover {
  color: var(--text-2);
}

/* ── MOBILE ── */
@media (max-width: 768px) {
  .sidebar-toggle {
    display: flex;
  }
  .mobile-topbar {
    display: flex;
  }
  .sidebar {
    transform: translateX(-100%);
    width: 240px;
    z-index: 25;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar.open .logo {
    padding-left: 44px;
    margin-top: 4px;
  }
  .site-banner {
    left: 0;
    top: 0;
    z-index: 22;
  }
  .site-banner-inner {
    padding-left: 56px;
  }
  .site-banner-logo {
    width: 18px;
    height: 18px !important;
    max-width: 18px;
  }
  .mobile-topbar {
    top: 40px;
  }
  .main {
    margin-left: 0;
    padding-top: 92px;
  }
  .site-footer {
    margin-left: 0;
  }
  .topbar {
    padding: 12px 16px;
  }
  .search-section {
    padding: 14px 16px 0;
  }
  #resultsArea {
    padding: 12px 16px;
  }
  .results-header {
    display: none;
  }
  .result-row {
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 12px 14px;
  }
  .col-owner,
  .col-class,
  .col-year,
  .col-value,
  .col-arrow {
    display: none;
  }
  .col-address {
    grid-column: 1;
  }
  .stats-bar {
    padding: 8px 16px;
    gap: 8px;
  }
  .filter-row {
    gap: 6px;
  }
  .detail-panel {
    width: 100vw;
    right: -100vw;
  }
  .logo-mark {
    width: 24px;
    height: 24px;
    max-width: 24px;
    max-height: 24px;
  }
  .logo-mark img {
    width: 24px;
    height: 24px !important;
    max-width: 24px;
    max-height: 24px;
  }
  .site-footer-logo {
    width: 16px;
    height: 16px !important;
    max-width: 16px;
    max-height: 16px;
  }
}

/* ── PAGINATION ────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 0;
  font-size: 0.85rem;
  color: var(--text-muted, #6b7280);
}

.pagination button {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text, #111827);
  transition: background 0.15s;
}

.pagination button:hover:not(:disabled) {
  background: var(--surface-hover, #f3f4f6);
}

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

/* ── PTC FALLBACK ──────────────────────────────────── */
.ptc-results-banner {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.85rem;
  color: #92400e;
  margin-bottom: 16px;
}

.ptc-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #6b7280);
  margin-bottom: 8px;
  margin-top: 4px;
}

.ptc-fallback {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.ptc-fallback-btn {
  display: inline-block;
  padding: 8px 16px;
  background: var(--accent, #0d9488);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.875rem;
  text-align: center;
  transition: opacity 0.15s;
}

.ptc-fallback-btn:hover {
  opacity: 0.85;
}

/* Make PTC fallback result rows clickable links */
a.result-row {
  text-decoration: none;
  color: inherit;
  display: contents;
}

.parcel-photo {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 8px;
  margin: 12px 0 16px 0;
  display: block;
}

.photo-loading {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-muted, #6b7280);
  margin: 8px 0;
}

.maps-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--accent, #0d9488);
  text-decoration: none;
  margin-bottom: 12px;
}

.maps-link:hover {
  text-decoration: underline;
}
