:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --text: #1a1a2e;
  --muted: #5a5a7a;
  --border: #d1d5db;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --success: #16a34a;
  --warn: #ca8a04;
  --fail: #dc2626;
  --radius: 8px;
  --max-width: 1200px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header, main, footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

header { padding-bottom: 0.5rem; }
header h1 { margin: 0; font-size: 1.75rem; }
header p { margin: 0.25rem 0 0; color: var(--muted); }
header nav a { color: var(--accent); text-decoration: none; }
header nav a:hover { text-decoration: underline; }
.site-note {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #78350f;
  max-width: 680px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}
.controls label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; color: var(--muted); }
.controls select, .controls input {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: var(--surface);
}
.controls input[type="search"] { min-width: 220px; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

th, td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

th { background: #f1f5f9; font-weight: 600; }
tr:hover { background: #f8fafc; }

.score { font-variant-numeric: tabular-nums; text-align: right; }
.score.good { color: var(--success); font-weight: 600; }
.score.fair { color: var(--warn); font-weight: 600; }
.score.poor { color: var(--fail); font-weight: 600; }
.score.na { color: var(--muted); font-weight: 400; }
.status.na { color: var(--muted); }
.na-note { font-size: 0.7rem; color: var(--muted); font-weight: 400; }
.beta-badge {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: 0.3rem;
  vertical-align: middle;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

a.external-link {
  display: inline-block;
  margin-left: 0.3rem;
  font-size: 0.85rem;
  opacity: 0.6;
}
a.external-link:hover { opacity: 1; }

a.muni-name { font-weight: 500; }

.muni-cell { display: flex; flex-direction: column; gap: 0.2rem; }
.muni-cell .muni-name { font-weight: 500; color: var(--text); }
.muni-links { display: flex; gap: 0.6rem; font-size: 0.8rem; }
a.link-details { color: var(--accent); font-weight: 500; }
a.link-details:hover { text-decoration: underline; }
a.link-out { color: var(--muted); }
a.link-out:hover { color: var(--accent); }

.pagination {
  display: flex;
  gap: 0.35rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.pagination button {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
}
.pagination button:hover:not(:disabled) { background: #f1f5f9; }
.pagination button:disabled { opacity: 0.5; cursor: default; }
.pagination span { padding: 0.35rem 0.2rem; color: var(--muted); }

.scores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

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

.score-card.overall {
  border-color: var(--accent);
  background: #eff6ff;
}

.score-card h2 { margin: 0 0 0.5rem; font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.score-value { font-size: 1.5rem; font-weight: 700; color: var(--text); }

.score-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  margin: 0.5rem 0;
  overflow: hidden;
}
.score-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.score-card.good .score-fill { background: var(--success); }
.score-card.fair .score-fill { background: var(--warn); }
.score-card.poor .score-fill { background: var(--fail); }

.score-card.preview {
  opacity: 0.85;
  background: #f8fafc;
}
.score-card.preview h2 {
  color: var(--muted);
}

.score-desc {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0.5rem 0 0;
  line-height: 1.4;
}

.score-label {
  font-size: 0.8rem;
  margin: 0.25rem 0 0;
  font-weight: 500;
}

.section-help {
  font-size: 0.85rem;
  color: var(--muted);
  margin: -0.5rem 0 1rem;
}

.status.pass { color: var(--success); }
.status.fail { color: var(--fail); }
.status.warn { color: var(--warn); }

/* Top issues summary */
#top-issues-section { margin-bottom: 1.5rem; }
.top-issues-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.top-issues-card h4 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.top-issues-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
  color: var(--text);
}
.top-issues-list li {
  margin-bottom: 0.25rem;
}
.issue-count {
  color: var(--muted);
  font-size: 0.8rem;
}

/* Check table expandables */
.check-summary { cursor: default; }
.check-summary.has-issues { cursor: pointer; }
.check-summary.has-issues:hover { background: #f8fafc; }
.check-summary.has-issues .check-toggle {
  display: inline-block;
  width: 1.2rem;
  color: var(--muted);
  font-size: 0.75rem;
  transition: transform 0.2s;
}
.check-summary.expanded .check-toggle {
  transform: rotate(90deg);
}
.check-details td { padding: 0; }

/* Multi-page scan indicators */
.pages-scanned {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.pages-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-right: 0.3rem;
}
.page-tag {
  display: inline-block;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  margin-right: 0.3rem;
  vertical-align: middle;
}

/* Issue details */
.issue-details {
  padding: 0.75rem 1rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.issue-severity-group {
  margin-bottom: 1rem;
}
.issue-severity-group:last-child { margin-bottom: 0; }
.issue-severity-group h4 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
}
.sev-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 0.4rem;
}
.sev-serious { background: #fee2e2; color: #991b1b; }
.sev-moderate { background: #fef3c7; color: #92400e; }
.sev-minor { background: #e0e7ff; color: #3730a3; }

.issue-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}
.issue-card:last-child { margin-bottom: 0; }
.issue-message { margin: 0 0 0.4rem; color: var(--text); font-weight: 500; }
.issue-recommendation { margin: 0 0 0.4rem; color: var(--muted); }
.issue-element { margin: 0 0 0.4rem; color: var(--muted); font-size: 0.8rem; }
.issue-element code {
  background: #f1f5f9;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
}
.issue-context { margin: 0.5rem 0 0; }
.issue-context summary {
  font-size: 0.8rem;
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
}
.issue-context pre {
  margin: 0.5rem 0 0;
  padding: 0.75rem;
  font-size: 0.8rem;
  max-height: 120px;
  overflow-y: auto;
}

pre {
  background: #f1f5f9;
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.85rem;
}

footer { padding-top: 0.5rem; color: var(--muted); font-size: 0.85rem; }
footer a { color: var(--accent); }

/* Dimension breakdown cards */
.dim-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.dim-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.dim-score {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}
.dim-subtitle {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.sig-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sig-row {
  display: grid;
  grid-template-columns: 2fr 100px 80px 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9rem;
}
.sig-row:last-child { border-bottom: none; }
.sig-main { display: flex; flex-direction: column; gap: 0.1rem; }
.sig-name { font-weight: 500; color: var(--text); }
.sig-help { font-size: 0.75rem; color: var(--muted); }
.sig-status { text-align: center; }
.sig-score { text-align: right; font-variant-numeric: tabular-nums; }
.sig-link-cell { text-align: right; font-size: 0.8rem; }
.sig-link { color: var(--accent); }
.sig-na { color: var(--muted); }
.sig-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.sig-found { background: #dcfce7; color: #15803d; }
.sig-missing { background: #fee2e2; color: #b91c1c; }
.dim-exempt {
  background: #f8fafc;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.dim-entry {
  font-size: 0.85rem;
  margin: 0.5rem 0 1rem;
}
.dim-entry a { font-weight: 500; }
.dim-warn { color: var(--fail); font-weight: 500; }
.dimension-legend {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.dimension-legend h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--text);
}
.dimension-legend p { margin: 0; line-height: 1.5; }

@media (max-width: 720px) {
  th, td { font-size: 0.8rem; padding: 0.45rem 0.5rem; }
  .controls { flex-direction: column; align-items: stretch; }
  .controls label { justify-content: space-between; }
  .controls input[type="search"] { width: 100%; }
  .scores { grid-template-columns: repeat(2, 1fr); }
  .sig-row { grid-template-columns: 1fr; gap: 0.25rem; }
  .sig-status, .sig-score, .sig-link-cell { text-align: left; }
}
