*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  max-width: 90%;
  width: 100%;
  margin: auto auto;
  padding: 1rem 2rem;
  padding-top: calc(var(--appbar-height, 60px) + 1rem);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  overflow-y: auto;
}

@media (min-width: 1400px) {
  main { max-width: 1200px; }
}
@media (max-width: 600px) {
  main { padding: 0 0.75rem; padding-top: calc(var(--appbar-height, 60px) + 0.5rem); max-width: 100%; }
}

.hero-logo {
  text-align: center;
  margin-bottom: 1rem;
  overflow: hidden;
}
.hero-logo img {
  max-width: 100%;
  border-radius: 12px;
  object-fit: contain;
  transition: max-height 0.15s;
  display: block;
  margin: 0 auto;
}
@media (max-width: 600px) {
  .hero-logo img { max-width: 100%; }
}

.hero-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
  flex-shrink: 0;
  margin-bottom: 1rem;
}

.search-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: 1.5rem;
  position: relative;
  flex-shrink: 0;
}

.search-row {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
}

#search-input {
  flex: 1;
  padding: 0.7rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
#search-input:focus { border-color: #3b82f6; }

#search-btn {
  padding: 0.7rem 1.4rem;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
#search-btn:hover { background: #2563eb; }

.search-dropdown-wrap {
  position: relative;
}

#suggestions {
  position: absolute;
  left: 0; right: 0;
  top: 0;
  z-index: 100;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  display: none;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.suggestion-item {
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover, .suggestion-item.highlighted { background: #eff6ff; }

#options-row {
  background: #fff;
  border-radius: 12px;
  padding: 0.75rem 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-top: 1rem;
}
#options-row summary {
  font-size: 0.9rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
#options-row summary::before {
  content: '▶';
  font-size: 0.65rem;
  transition: transform 0.15s;
}
#options-row[open] summary::before { transform: rotate(90deg); }
#options-row[open] { padding-bottom: 1rem; }

.options-row {
  display: flex;
  gap: 2rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.options-row label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}
.options-row input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: #3b82f6;
  cursor: pointer;
}

.chart-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: none;
}

.chart-header {
  margin-bottom: 1rem;
}
.chart-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
}
.chart-header p {
  font-size: 0.82rem;
  color: #64748b;
  margin-top: 0.2rem;
}

.chart-wrap {
  position: relative;
  height: 360px;
}

.chart-nav {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
  text-align: center;
}

.no-results {
  color: #ef4444;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  display: none;
}

#status-bar {
  font-size: 0.82rem;
  color: #64748b;
  margin-top: 0.75rem;
  min-height: 1.2em;
}
#status-bar:empty { display: none; }

.disclaimer {
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: center;
  padding: 0.75rem 1rem;
}
.disclaimer a { color: #64748b; }

.tax-rates-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: #3b82f6;
  text-decoration: none;
  cursor: pointer;
}
.tax-rates-link:hover { text-decoration: underline; }
.special-link-sep {
  font-size: 0.82rem;
  color: #94a3b8;
  margin: 0 0.15rem;
}

/* Exemptions chart options */
#exemptions-options {
  display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem;
  margin-bottom: 0.75rem;
}
#exemptions-options label {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.78rem; cursor: pointer; user-select: none;
}
#exemptions-options input[type=checkbox],
#exemptions-options input[type=radio] {
  width: 14px; height: 14px; cursor: pointer;
}

/* Tax rates legend */
#taxrates-legend {
  display: flex; flex-wrap: wrap; gap: 0.25rem 1rem;
  margin-bottom: 0.75rem;
}
#taxrates-legend label {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.78rem; cursor: pointer; user-select: none;
}
#taxrates-legend input[type=checkbox] {
  width: 14px; height: 14px; cursor: pointer;
}

@media (max-width: 600px) {
  .disclaimer { padding-right: 140px; }
}

/* Revaluation modal */
#reval-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
#reval-modal {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  position: relative;
}
#reval-modal h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.75rem;
}
#reval-modal p {
  font-size: 0.9rem;
  color: #334155;
  line-height: 1.6;
}
#reval-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
}
#reval-modal-close:hover { color: #1e293b; }

/* Year detail modal */
#year-modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: center; justify-content: center;
  padding: 1rem;
}
#year-modal {
  background: #fff; border-radius: 12px;
  padding: 1.5rem; max-width: 420px; width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  position: relative;
}
#year-modal h3 {
  font-size: 1rem; font-weight: 600; color: #1e293b;
  margin-bottom: 1rem;
}
#year-modal-close {
  position: absolute; top: 0.75rem; right: 0.75rem;
  background: none; border: none;
  font-size: 1rem; color: #94a3b8; cursor: pointer; line-height: 1;
}
#year-modal-close:hover { color: #1e293b; }
#year-modal-table {
  width: 100%; border-collapse: collapse;
}
#year-modal-table tr { border-bottom: 1px solid #f1f5f9; }
#year-modal-table tr:last-child { border-bottom: none; }
.yd-label {
  font-size: 0.85rem; color: #64748b;
  padding: 0.45rem 0.5rem 0.45rem 0;
  white-space: nowrap;
}
.yd-value {
  font-size: 0.85rem; color: #1e293b;
  padding: 0.45rem 0; text-align: right;
  font-variant-numeric: tabular-nums;
}
.yd-bold { font-weight: 700; font-size: 0.95rem; }

/* Ownership change tooltip */
.sold-tooltip {
  position: absolute;
  background: #1e293b;
  color: #f1f5f9;
  font-size: 0.8rem;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  max-width: 260px;
  line-height: 1.4;
  pointer-events: none;
  display: none;
  z-index: 10;
  white-space: nowrap;
}
