:root {
  color-scheme: light;
  --app-bg: #f4f6f5;
  --shell: #ffffff;
  --sidebar: #eef1ef;
  --surface: #ffffff;
  --surface-raised: #f8faf9;
  --surface-active: #e6f4f1;
  --text: #17201d;
  --text-strong: #0f1714;
  --text-muted: #65716c;
  --border: #dce3df;
  --border-strong: #c9d3ce;
  --brand: #167a6e;
  --brand-strong: #0e6459;
  --brand-soft: #dff1ed;
  --live: #18794e;
  --live-soft: #e4f4ea;
  --solar: #805500;
  --solar-strong: #f1bd34;
  --solar-soft: #fff5d6;
  --info: #2667a8;
  --info-soft: #e8f1fb;
  --review: #76520a;
  --review-soft: #fff3cf;
  --danger: #a72f3a;
  --danger-soft: #fdebee;
  --focus: #167a6e;
  --shadow: 0 8px 24px rgba(24, 42, 35, 0.07);
  --sidebar-width: 224px;
  --topbar-height: 68px;
  --bottom-nav-height: 68px;
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --app-bg: #090d13;
  --shell: #0f141c;
  --sidebar: #121821;
  --surface: #171e28;
  --surface-raised: #1a222e;
  --surface-active: #15302f;
  --text: #edf4f8;
  --text-strong: #ffffff;
  --text-muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.18);
  --border-strong: rgba(148, 163, 184, 0.3);
  --brand: #2fd0bf;
  --brand-strong: #66e3d7;
  --brand-soft: rgba(47, 208, 191, 0.13);
  --live: #37d796;
  --live-soft: rgba(55, 215, 150, 0.12);
  --solar: #f1bd34;
  --solar-strong: #f1bd34;
  --solar-soft: rgba(241, 189, 52, 0.12);
  --info: #6aa8ff;
  --info-soft: rgba(106, 168, 255, 0.12);
  --review: #f1bd34;
  --review-soft: rgba(241, 189, 52, 0.12);
  --danger: #ff717a;
  --danger-soft: rgba(255, 113, 122, 0.12);
  --focus: #66e3d7;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--app-bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--app-bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
select,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--small {
  width: 15px;
  height: 15px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--text-strong);
  color: var(--shell);
  text-decoration: none;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--sidebar);
}

.brand {
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  gap: 11px;
  padding: 0 18px;
  color: var(--text-strong);
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, transparent);
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
}

.brand-name {
  min-width: 0;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}

.brand-name strong {
  color: var(--brand);
  font-weight: 750;
}

.side-navigation {
  display: grid;
  gap: 4px;
  padding: 18px 12px;
}

.nav-link {
  position: relative;
  display: flex;
  min-width: 44px;
  min-height: 46px;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: 7px;
  color: var(--text-muted);
  font-weight: 620;
  text-decoration: none;
  transition: background-color 140ms ease, color 140ms ease;
}

.nav-link:hover {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--text);
}

.nav-link[aria-current="page"] {
  background: var(--surface-active);
  color: var(--brand-strong);
}

.nav-link[aria-current="page"]::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: -12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
  content: "";
}

.sidebar-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: auto 14px 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-raised);
}

.sidebar-status strong,
.sidebar-status small {
  display: block;
}

.sidebar-status strong {
  font-size: 12px;
  font-weight: 650;
}

.sidebar-status small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-dot--live {
  background: var(--live);
  box-shadow: 0 0 0 3px var(--live-soft);
}

.status-dot--muted {
  background: var(--text-muted);
}

.app-main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--shell) 94%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.mobile-brand {
  display: none;
}

.route-context {
  min-width: 0;
}

.route-eyebrow {
  display: block;
  margin-bottom: 1px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
}

.route-context h1 {
  margin: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 18px;
  font-weight: 720;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-controls {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.language-control {
  display: flex;
  min-width: 92px;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-muted);
}

.language-control select {
  min-width: 34px;
  flex: 1;
  border: 0;
  outline: 0;
  appearance: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.icon-button {
  display: inline-flex;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

.icon-button:hover,
.icon-button[aria-expanded="true"] {
  border-color: var(--border-strong);
  background: var(--surface-raised);
  color: var(--brand);
}

.theme-control {
  position: relative;
}

.theme-menu {
  position: absolute;
  top: 52px;
  right: 0;
  z-index: 50;
  width: 220px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.theme-menu fieldset {
  display: grid;
  gap: 3px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.theme-menu legend {
  padding: 6px 8px 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.theme-menu-choice {
  position: relative;
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border-radius: 6px;
  cursor: pointer;
}

.theme-menu-choice:hover,
.theme-menu-choice:has(input:checked) {
  background: var(--surface-active);
  color: var(--brand-strong);
}

.theme-menu-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.content {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 28px 30px 64px;
}

.route-view {
  min-width: 0;
  scroll-margin-block-start: calc(var(--topbar-height) + 12px);
}

.page-lead {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.page-lead > div {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.4;
  text-transform: uppercase;
}

.page-lead h2,
.panel h2,
.provider-card h2,
.state-banner h2,
.horizontal-panel h2 {
  overflow-wrap: anywhere;
}

.page-lead h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 28px;
  font-weight: 740;
  line-height: 1.2;
}

.page-lead p:not(.eyebrow) {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.provenance {
  display: inline-flex;
  min-height: 36px;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.provenance .icon {
  width: 17px;
  height: 17px;
}

.provenance--calculation {
  border-color: color-mix(in srgb, var(--info) 34%, var(--border));
  background: var(--info-soft);
  color: var(--info);
}

.provenance--unavailable,
.provenance--local {
  color: var(--text-muted);
}

.provenance--review {
  border-color: color-mix(in srgb, var(--review) 34%, var(--border));
  background: var(--review-soft);
  color: var(--review);
}

.state-banner {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 8px;
  background: var(--surface);
}

.state-banner--attention {
  border-left-color: var(--solar-strong);
}

.state-banner--review {
  border-left-color: var(--review);
}

.state-icon,
.panel-icon,
.empty-state-icon,
.provider-icon,
.account-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.state-icon {
  width: 44px;
  height: 44px;
  background: var(--solar-soft);
  color: var(--solar);
}

.state-banner--review .state-icon {
  background: var(--review-soft);
  color: var(--review);
}

.state-copy {
  min-width: 0;
}

.state-copy h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 16px;
  font-weight: 700;
}

.state-copy p {
  max-width: 760px;
  margin: 3px 0 0;
  color: var(--text-muted);
}

.state-action {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.state-action small {
  color: var(--text-muted);
  font-size: 10px;
}

.button {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 680;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.button--primary {
  background: var(--brand);
  color: #ffffff;
}

:root[data-theme="dark"] .button--primary {
  color: #071411;
}

.button--primary:hover:not(:disabled) {
  background: var(--brand-strong);
}

.button--secondary {
  border-color: var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
}

.button--secondary:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.button--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
}

.button--ghost:hover:not(:disabled) {
  background: var(--surface-raised);
  color: var(--text);
}

.button:disabled {
  border-color: var(--border);
  background: var(--surface-raised);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.75;
}

.metric-grid {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}

.metric-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  position: relative;
  min-width: 0;
  min-height: 132px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-top: 3px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
}

.metric-card--solar {
  border-top-color: var(--solar-strong);
}

.metric-card--info {
  border-top-color: var(--info);
}

.metric-card--income {
  border-top-color: var(--brand);
}

.metric-heading {
  display: flex;
  min-height: 22px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.metric-heading .icon {
  width: 18px;
  height: 18px;
}

.metric-card--solar .metric-heading .icon {
  color: var(--solar);
}

.metric-card--info .metric-heading .icon {
  color: var(--info);
}

.metric-card--income .metric-heading .icon {
  color: var(--brand);
}

.metric-value {
  display: block;
  min-width: 0;
  margin-top: 12px;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  font-weight: 740;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-value--empty {
  font-size: 19px;
  color: var(--text-muted);
}

.metric-card small {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
}

.two-column-grid,
.preferences-grid,
.provider-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.panel,
.provider-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.panel {
  padding: 20px;
}

.panel-heading {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading > div {
  min-width: 0;
}

.panel-heading h2,
.panel h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 17px;
  font-weight: 700;
}

.panel-heading p:not(.eyebrow),
.panel > p,
.horizontal-panel p {
  margin: 4px 0 0;
  color: var(--text-muted);
}

.panel-heading-icon {
  color: var(--text-muted);
}

.action-panel {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
}

.action-panel .button {
  grid-column: 2;
  justify-self: start;
}

.panel-icon,
.empty-state-icon {
  width: 44px;
  height: 44px;
  background: var(--surface-raised);
  color: var(--text-muted);
}

.panel-icon--brand {
  background: var(--brand-soft);
  color: var(--brand);
}

.panel-icon--blue {
  background: var(--info-soft);
  color: var(--info);
}

.empty-panel {
  display: flex;
  flex-direction: column;
}

.empty-state {
  display: flex;
  min-height: 92px;
  align-items: center;
  gap: 13px;
  margin: auto 0;
  color: var(--text-muted);
}

.empty-state strong {
  color: var(--text);
}

.empty-state p {
  margin: 2px 0 0;
}

.definition-list {
  display: grid;
  margin: 0;
}

.definition-list > div {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1fr);
  gap: 18px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.definition-list dt {
  color: var(--text-muted);
}

.definition-list dd {
  margin: 0;
  color: var(--text-strong);
  font-weight: 650;
  text-align: right;
  overflow-wrap: anywhere;
}

.feature-list {
  display: grid;
  gap: 13px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.feature-list .icon {
  margin-top: 1px;
  color: var(--brand);
}

.estimate-form {
  margin-bottom: 18px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.input-with-unit {
  display: grid;
  min-height: 46px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface-raised);
}

.input-with-unit:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 1px var(--focus);
}

.input-with-unit input {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-strong);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.input-with-unit > span {
  padding: 0 10px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.field input[aria-invalid="true"] {
  color: var(--danger);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.form-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.calculation-status {
  min-height: 21px;
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.chart-panel {
  margin-top: 18px;
}

.chart-frame {
  width: 100%;
  min-height: 250px;
  aspect-ratio: 16 / 6;
}

.chart-frame canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.horizontal-panel {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.horizontal-panel h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 16px;
}

.provider-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  padding: 20px;
}

.provider-icon {
  width: 44px;
  height: 44px;
  background: var(--brand-soft);
  color: var(--brand);
}

.provider-icon--blue {
  background: var(--info-soft);
  color: var(--info);
}

.provider-card h2 {
  min-height: 42px;
  margin: 0 0 10px;
  color: var(--text-strong);
  font-size: 15px;
  line-height: 1.35;
}

.provider-card strong {
  color: var(--review);
  font-size: 13px;
}

.provider-card p:not(.eyebrow) {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.checklist-panel {
  margin-top: 18px;
}

.checklist {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.checklist-index {
  color: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.checklist strong,
.checklist small {
  display: block;
}

.checklist strong {
  color: var(--text);
  font-size: 13px;
}

.checklist small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.checklist .icon {
  color: var(--review);
}

.identity-panel {
  margin-top: 0;
}

.account-avatar {
  width: 44px;
  height: 44px;
  background: var(--brand-soft);
  color: var(--brand);
}

.status-label {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-raised);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.status-label .status-dot {
  margin-top: 0;
}

.status-label--success {
  border-color: color-mix(in srgb, var(--live) 28%, var(--border));
  background: var(--live-soft);
  color: var(--live);
}

.status-label--success .icon {
  width: 17px;
  height: 17px;
}

.preference-panel {
  min-height: 214px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-raised);
}

.segmented-control label {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  text-align: center;
}

.segmented-control label:has(input:checked) {
  background: var(--surface);
  box-shadow: 0 1px 4px color-mix(in srgb, var(--text) 10%, transparent);
  color: var(--brand-strong);
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control .icon {
  width: 17px;
  height: 17px;
}

.select-field {
  display: grid;
  gap: 7px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.select-field select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--text-strong);
  cursor: pointer;
}

.bottom-navigation {
  display: none;
}

@media (max-width: 1120px) {
  .metric-grid--four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 899px) {
  body {
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  }

  .app-sidebar {
    display: none;
  }

  .app-main {
    margin-left: 0;
  }

  .topbar {
    padding: 0 16px;
  }

  .mobile-brand {
    display: flex;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    gap: 9px;
    color: var(--text-strong);
    font-size: 12px;
    font-weight: 750;
    text-decoration: none;
    white-space: nowrap;
  }

  .mobile-brand .brand-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .route-context {
    flex: 1;
    text-align: center;
  }

  .route-eyebrow {
    display: none;
  }

  .route-context h1 {
    font-size: 16px;
  }

  .content {
    padding: 24px 16px 36px;
  }

  .bottom-navigation {
    position: fixed;
    inset: auto 0 0;
    z-index: 45;
    display: grid;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 4px 4px env(safe-area-inset-bottom, 0px);
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--shell) 96%, transparent);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
  }

  .bottom-nav-link {
    position: relative;
    display: flex;
    min-width: 44px;
    min-height: 60px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 3px 2px;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 650;
    line-height: 1.1;
    text-align: center;
    text-decoration: none;
  }

  .bottom-nav-link .icon {
    width: 22px;
    height: 22px;
  }

  .bottom-nav-link[aria-current="page"] {
    background: var(--surface-active);
    color: var(--brand-strong);
  }

  .bottom-nav-link[aria-current="page"]::before {
    position: absolute;
    top: -5px;
    left: 28%;
    right: 28%;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--brand);
    content: "";
  }
}

@media (max-width: 700px) {
  .two-column-grid,
  .preferences-grid,
  .provider-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric-grid--three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .state-banner,
  .horizontal-panel {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .state-action,
  .horizontal-panel > :last-child {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 8px;
    padding: 0 12px;
  }

  .mobile-brand > span:last-child {
    display: none;
  }

  .route-context {
    text-align: left;
  }

  .language-control {
    min-width: 70px;
    padding: 0 7px;
  }

  .language-control > .icon:first-child {
    display: none;
  }

  .content {
    padding: 20px 14px 30px;
  }

  .page-lead {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
  }

  .page-lead h2 {
    font-size: 23px;
  }

  .page-lead .provenance {
    justify-self: start;
  }

  .metric-grid--three,
  .metric-grid--four,
  .field-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric-card {
    min-height: 118px;
  }

  .metric-value {
    font-size: 23px;
  }

  .panel,
  .provider-card {
    padding: 17px;
  }

  .state-banner {
    align-items: start;
    padding: 16px;
  }

  .state-action {
    width: 100%;
    justify-items: stretch;
  }

  .state-action .button {
    width: 100%;
  }

  .action-panel {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .action-panel .button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .chart-frame {
    min-height: 220px;
    aspect-ratio: 4 / 3;
  }

  .segmented-control {
    grid-template-columns: minmax(0, 1fr);
  }

  .segmented-control label {
    justify-content: flex-start;
    padding: 0 12px;
  }

  .definition-list > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }

  .definition-list dd {
    text-align: left;
  }

  .theme-menu {
    position: fixed;
    top: 60px;
    right: 12px;
    left: 12px;
    width: auto;
  }
}

@media (max-width: 360px) {
  .content {
    padding-right: 12px;
    padding-left: 12px;
  }

  .topbar-controls {
    gap: 5px;
  }

  .language-control {
    min-width: 62px;
  }

  .bottom-navigation {
    padding-right: 1px;
    padding-left: 1px;
  }

  .bottom-nav-link {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
