:root {
  color-scheme: light;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f8fa;
  color: #111827;
}

body {
  margin: 0;
}

.site-header {
  background: #111827;
  color: white;
  box-shadow: 0 2px 14px -10px rgba(15, 23, 42, 0.6);
}

.site-header .layout {
  padding: 0.4rem 1.5rem;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
}

.brand {
  font-weight: 600;
  color: white;
  text-decoration: none;
  font-size: 1rem;
}

.main-nav {
  display: flex;
  gap: 1rem;
}

.main-nav a {
  color: white;
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.main-nav form {
  margin: 0;
}

.main-nav button {
  background: none;
  border: none;
  color: white;
  font-size: 0.9rem;
  opacity: 0.85;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.2s ease;
}

.data-notes-banner {
  background: rgb(163, 164, 138);
  color: #e5e7eb;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-align: center;
  padding: 0.25rem 1.5rem;
}

.main-nav a:hover {
  opacity: 1;
}

.main-nav button:hover {
  opacity: 1;
}

.main-nav a:focus-visible,
.main-nav button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 3px;
}

.auth-card button[type="submit"]:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
}

.auth-card {
  max-width: 380px;
  margin: 4rem auto;
  background: white;
  padding: 2.25rem 2.5rem;
  border-radius: 0.9rem;
  box-shadow: 0 20px 45px -30px rgba(15, 23, 42, 0.55);
}

.auth-card h1 {
  margin: 0 0 1.5rem;
  font-size: 1.6rem;
  font-weight: 600;
  text-align: center;
}

.auth-card form {
  display: grid;
  gap: 1.25rem;
}

.oauth-actions {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.google-signin-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-radius: 0.65rem;
  border: 1px solid #d1d5db;
  background: white;
  color: #111827;
  font-weight: 500;
  text-decoration: none;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.google-signin-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -12px rgba(15, 23, 42, 0.4);
}

.google-signin-button:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
}

.auth-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  color: #9ca3af;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: #e5e7eb;
}

.small-text {
  font-size: 0.8rem;
}

.form-field {
  display: grid;
  gap: 0.4rem;
}

.form-field label {
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0;
}

.auth-card .auth-input,
.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"] {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 0.65rem;
  padding: 0.7rem 0.85rem;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-card .auth-input:focus,
.auth-card input[type="text"]:focus,
.auth-card input[type="email"]:focus,
.auth-card input[type="password"]:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.auth-card button[type="submit"] {
  background: #111827;
  color: white;
  border: none;
  border-radius: 0.65rem;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.auth-card button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px -18px rgba(15, 23, 42, 0.8);
}

.form-field.has-error .auth-input,
.form-field.has-error input {
  border-color: #dc2626;
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.2);
}

.form-error {
  background: #fee2e2;
  color: #991b1b;
  border-radius: 0.65rem;
  padding: 0.75rem 1rem;
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}

.auth-card .form-error:last-child {
  margin-bottom: 1rem;
}

.input-error {
  color: #b91c1c;
  font-size: 0.85rem;
  margin: 0;
}

@media (max-width: 600px) {
  .auth-card {
    margin: 3rem 1.25rem;
    padding: 2rem 1.5rem;
  }

  .auth-card h1 {
    font-size: 1.4rem;
  }
}

.layout {
  margin: 0 auto;
  max-width: 960px;
  padding: 3rem 1.5rem;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid #1d4ed8;
  background: white;
  color: #1d4ed8;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.secondary-button:hover {
  background: #eff6ff;
  box-shadow: 0 10px 24px -18px rgba(29, 78, 216, 0.6);
}

.secondary-button:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 3px;
}

.percentile-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.percentile-entity-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.loading-indicator {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(29, 78, 216, 0.25);
  border-top-color: #1d4ed8;
  animation: spin 0.75s linear infinite;
  display: none;
}

.loading-indicator.htmx-request {
  display: inline-block;
}

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

.trend-layout {
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  align-items: start;
}

@media (max-width: 1024px) {
  .trend-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .trend-sidebar {
    order: -1;
  }
}

.trend-main {
  min-width: 0;
}

.trend-sidebar {
  min-width: 0;
}

.stack {
  display: grid;
  gap: 2rem;
}

.stack-sm {
  display: grid;
  gap: 0.5rem;
}

.metrics {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.metric {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 10px 34px -20px rgba(15, 23, 42, 0.35);
}

.metric h2 {
  font-size: 1rem;
  color: #6b7280;
  margin-bottom: 0.75rem;
}

.metric p {
  font-size: 2rem;
  font-weight: 600;
  margin: 0;
}

.hint {
  color: #4b5563;
}

.icb-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.icb-list li {
  background: white;
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 8px 20px -18px rgba(15, 23, 42, 0.5);
}

.icb-list a {
  font-weight: 600;
  color: inherit;
  text-decoration: none;
}

.icb-list a:hover {
  text-decoration: underline;
}

.practice-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 10px 34px -20px rgba(15, 23, 42, 0.35);
  overflow: hidden;
}

.practice-table th,
.practice-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.practice-table thead {
  background: #f1f5f9;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

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

.practice-table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.practice-table tbody tr[data-url] {
  cursor: pointer;
}

.practice-table tbody tr[data-url]:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

.practice-table .numeric {
  text-align: right;
}

.practice-table[data-sortable="true"] th {
  cursor: pointer;
}

.practice-table[data-sortable="true"] th::after {
  content: "";
  margin-left: 0.25rem;
  border: 0.35rem solid transparent;
  border-top-color: #9ca3af;
  display: inline-block;
  vertical-align: middle;
  opacity: 0.4;
}

.practice-table[data-sortable="true"] th.sort-asc::after {
  border-top-color: #111827;
  transform: rotate(180deg);
  opacity: 1;
}

.table-wrapper {
  overflow-x: auto;
}

.trend-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.trend-statistics {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  background: #f8fafc;
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
}

.trend-statistics__item {
  display: grid;
  gap: 0.4rem;
}

.trend-statistics__label {
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #475569;
}

.trend-statistics__value {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 1.4rem;
  font-weight: 600;
  color: #0f172a;
}

.trend-statistics__divider {
  font-size: 0.9rem;
  color: #6b7280;
}

.trend-statistics__percentage {
  font-size: 0.95rem;
  font-weight: 600;
  color: #2563eb;
}

.trend-statistics__denominator {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

.trend-statistics__denominator-total {
  line-height: 1;
}

.trend-statistics__denominator-label {
  font-size: 0.85rem;
  color: #475569;
  font-weight: 500;
  text-transform: none;
}

@media (max-width: 640px) {
  .trend-statistics {
    padding: 0.75rem 1rem;
  }

  .trend-statistics__value {
    font-size: 1.2rem;
  }

  .trend-statistics__denominator {
    align-items: center;
  }

  .trend-statistics__denominator-label {
    text-align: center;
  }
}

.trend-chart-container {
  position: relative;
  width: 100%;
  height: 600px;
}

.toggle-group {
  display: inline-flex;
  background: #e5e7eb;
  border-radius: 999px;
  padding: 0.25rem;
  gap: 0.25rem;
}

.toggle-button {
  border: none;
  background: transparent;
  color: #374151;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
}

.toggle-button:hover {
  background: rgba(255, 255, 255, 0.6);
}

.toggle-button.is-active {
  background: #111827;
  color: white;
}

.download-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #111827;
  color: white;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.download-button:hover {
  background: #1f2937;
  transform: translateY(-1px);
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 2rem;
}

.dashboard-sidebar {
  display: grid;
  gap: 1rem;
}

.dashboard-main {
  display: grid;
  gap: 1rem;
}

.dashboard-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.area-toggle {
  display: inline-flex;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 0.25rem;
  background: white;
  box-shadow: 0 5px 16px -12px rgba(15, 23, 42, 0.45);
}

.area-toggle__option {
  border: none;
  background: transparent;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.15s ease;
}

.area-toggle__option.is-active {
  background: #111827;
  color: white;
}

.area-toggle__option:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.map-wrapper {
  background: white;
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 10px 34px -20px rgba(15, 23, 42, 0.35);
}

.date-slider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.date-slider input[type="range"] {
  width: 200px;
}

.dashboard-controls .toggle-hint {
  font-size: 0.85rem;
  color: #4b5563;
  margin: 0;
}

.dashboard-main .stack + .stack {
  margin-top: 1.5rem;
}

.area-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.area-header h2 {
  margin: 0;
}

.dashboard-main .geo-map {
  min-height: 420px;
}

.geo-map--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  border: 1px dashed #e5e7eb;
  border-radius: 0.75rem;
  background: #f9fafb;
  color: #6b7280;
  text-align: center;
  padding: 1.5rem;
}

.map-empty-state {
  margin: 0;
  font-size: 0.95rem;
}

.breadcrumbs {
  margin-bottom: 1rem;
}

.breadcrumbs a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.region-header {
  margin-bottom: 2rem;
}

.region-map-section {
  margin-bottom: 2rem;
}

.region-map {
  min-height: 360px;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 10px 34px -20px rgba(15, 23, 42, 0.35);
}

.region-header__title h1 {
  margin: 0.25rem 0 0;
}

.region-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.region-card {
  background: white;
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: 0 10px 34px -20px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.region-card strong {
  font-size: 1.8rem;
  font-weight: 700;
}

.region-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.region-section-header h2 {
  margin: 0;
}

.region-percentile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.region-percentile-card {
  background: white;
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 10px 34px -20px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.region-percentile-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.region-percentile-card__header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.region-percentile-card__stat {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
}

.region-percentile-card__chart {
  min-height: 220px;
}

.info-card {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 10px 34px -20px rgba(15, 23, 42, 0.35);
  display: grid;
  gap: 0.75rem;
}

.info-card h2 {
  margin: 0;
  font-size: 1.1rem;
}

.info-list {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.35rem;
}

.interventions-card {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 10px 34px -20px rgba(15, 23, 42, 0.35);
  display: grid;
  gap: 1.25rem;
}

.interventions-card h2 {
  margin: 0;
  font-size: 1.2rem;
}

.intervention-table tbody tr {
  cursor: pointer;
  border-left: 4px solid transparent;
  transition: background-color 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}

.intervention-table tbody tr:hover {
  transform: translateX(2px);
}

.intervention-table tbody tr:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

.intervention-table tbody tr.is-selected {
  border-left-color: var(--intervention-color, #2563eb);
  background: var(--intervention-background, rgba(37, 99, 235, 0.1));
}

.intervention-table tbody tr strong {
  font-weight: 600;
}

.intervention-table td.nowrap {
  white-space: nowrap;
}

.intervention-coverage-indicator {
  font-size: 0.75rem;
  font-weight: 400;
  color: #6b7280;
  margin-left: 0.5rem;
}

.intervention-strength {
  margin-left: 0.4rem;
  font-weight: 600;
  color: #0f766e;
  letter-spacing: 0.05em;
}

.intervention-strength--moderate {
  color: #047857;
}

.intervention-strength--strong {
  color: #065f46;
}

.intervention-duration {
  margin-left: 0.35rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.intervention-scope {
  margin-left: 0.4rem;
  font-size: 0.7rem;
  color: #64748b;
  font-style: italic;
}

.intervention-scope--national {
  color: #9ca3af;
}

.entity-percentile-card.is-hidden {
  display: none;
}

.intervention-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  background: #e5e7eb;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #1f2937;
}

.muted {
  color: #6b7280;
}

.entity-percentile-charts {
  gap: 1.5rem;
}

.entity-percentile-card {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 10px 34px -20px rgba(15, 23, 42, 0.35);
  display: grid;
  gap: 1rem;
}

.entity-percentile-card__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.entity-percentile-card__header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.entity-percentile-card__header h3 a {
  color: inherit;
  text-decoration: none;
}

.entity-percentile-card__header h3 a:focus,
.entity-percentile-card__header h3 a:hover {
  text-decoration: underline;
}

.entity-percentile-card__stat {
  font-weight: 600;
  font-size: 1.05rem;
  color: #dc2626;
}

.entity-percentile-card__chart {
  min-height: 260px;
}

.tooltip-anchor {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.supplier-status-note {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.tooltip-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.25rem;
  border-radius: 999px;
  border: 1px solid #1f2937;
  background: transparent;
  color: #1f2937;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}

.tooltip-toggle:focus {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

.tooltip {
  position: absolute;
  z-index: 20;
  max-width: 22rem;
  width: min(28rem, 70vw);
  padding: 0.5rem 0.75rem;
  background: #f3f4f6;
  color: #374151;
  border-radius: 0.4rem;
  font-size: 0.8rem;
  line-height: 1.3;
  box-shadow: 0 10px 18px -15px rgba(15, 23, 42, 0.45);
  top: calc(100% + 0.45rem);
  left: 0;
  transform: translateY(0.35rem);
  transition: opacity 120ms ease, transform 120ms ease;
  opacity: 0;
  pointer-events: none;
  text-transform: none;
}

.tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.icb-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.toggle-group {
  display: inline-flex;
  border: 1px solid #cbd5f5;
  border-radius: 999px;
  overflow: hidden;
}

.toggle {
  padding: 0.35rem 0.9rem;
  text-decoration: none;
  color: #1f2937;
  font-size: 0.875rem;
}

.toggle.is-active {
  background: #1f2937;
  color: white;
}

.download-link {
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: #1f2937;
  color: white;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.download-link::before {
  content: "⇩";
  font-size: 1rem;
}

.practice-table[data-sortable="true"] th.sort-desc::after {
  border-top-color: #111827;
  opacity: 1;
}

.icb-map {
  height: 420px;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 10px 34px -20px rgba(15, 23, 42, 0.35);
}
.percentile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.5rem;
  align-items: start;
}

.percentile-header {
  grid-column: 1 / -1;
}

.percentile-main {
  min-width: 0;
}

.percentile-sidebar {
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

@media (max-width: 1024px) {
  .percentile-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .percentile-sidebar {
    position: static;
    max-height: none;
  }
}
