:root {
  --cc-navy: #225278;
  --cc-mid: #2B648C;
  --cc-blue: #3E8AB5;
  --cc-accent: #438FB9;
  --cc-light: #67B8DC;
  --cc-pale: #DCEBF4;
  --cc-paler: #EEF4F9;
  --cc-bg: #F5F6FA;
  --cc-footer: #1C4159;
  --cc-ink: #283641;
  --cc-ink-soft: #5a6b78;
  --grad-deep: linear-gradient(135deg, #225278, #2B648C 55%, #347aa6);
  --sh-sm: 0 2px 6px rgba(34, 82, 120, .07);
  --sh-md: 0 8px 24px rgba(34, 82, 120, .10);
  --sh-lg: 0 18px 44px rgba(34, 82, 120, .16);
  --radius: 16px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cc-bg);
  color: var(--cc-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cc-accent); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---- Header ---------------------------------------------------------- */
.site-head {
  background: var(--grad-deep);
  color: #fff;
  padding: 26px 0 30px;
}
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }
.brand .logo { height: 50px; width: auto; display: block; }
.brand .sub { font-size: .82rem; opacity: .82; font-weight: 500; }
.head-tag { font-size: .9rem; opacity: .9; max-width: 520px; }

/* ---- Controls -------------------------------------------------------- */
.controls {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--sh-md);
  padding: 22px 24px;
  margin: -22px 0 28px;
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr 1.35fr auto;
  gap: 20px 26px;
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; position: relative; }
.mm-hint { position: absolute; top: 100%; left: 2px; margin-top: 4px; font-size: .68rem; font-weight: 700; letter-spacing: .02em; color: var(--cc-accent); white-space: nowrap; }
.mm-hint[hidden] { display: none; }
.field > label { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--cc-ink-soft); }
.field .val { font-size: .8rem; font-weight: 700; color: var(--cc-navy); }

input[type="range"] { width: 100%; accent-color: var(--cc-accent); height: 22px; }
input[type="range"]:focus, input[type="range"]:focus-visible { outline: none; }
.field select, .field input[type="text"] {
  font: inherit; padding: 9px 11px; border: 1px solid #d4dde5; border-radius: 9px;
  background: #fff; color: var(--cc-ink); width: 100%; height: 40px; line-height: 1.25;
}
/* Match the rurality select to the location box: same chevron, same padding. */
.field select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16' fill='%235a6b78'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.field select:focus, .field input[type="text"]:focus { outline: 2px solid var(--cc-light); border-color: transparent; }
.footnote { display: block; margin-top: 6px; font-size: .74rem; color: var(--cc-ink-soft); line-height: 1.45; }

/* segmented period toggle */
.seg { display: inline-flex; background: var(--cc-paler); border-radius: 9px; padding: 3px; }
.seg button { font: inherit; font-size: .82rem; font-weight: 600; border: 0; background: transparent; color: var(--cc-ink-soft); padding: 7px 14px; border-radius: 7px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--cc-navy); box-shadow: var(--sh-sm); }

.btn-share {
  font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer;
  border: 0; border-radius: 10px; padding: 12px 20px;
  background: var(--grad-deep); color: #fff; box-shadow: 0 8px 18px rgba(34,82,120,.28);
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.btn-share:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(34,82,120,.34); }
.btn-share.copied { background: #2e7d52; }
.btn-share svg { width: 16px; height: 16px; fill: currentColor; }

/* ---- Autocomplete ---------------------------------------------------- */
.ac-box { position: relative; }
.ac-box input[type="text"] { padding-right: 34px; }
.ac-list {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1px solid #e1e8ee; border-radius: 11px; box-shadow: var(--sh-lg);
  max-height: 320px; overflow: auto; padding: 6px;
}
.ac-list[hidden] { display: none; }
.ac-item { padding: 9px 11px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.ac-item:hover, .ac-item.active { background: var(--cc-paler); }
.ac-item .st { font-size: .76rem; font-weight: 700; color: var(--cc-accent); }
.ac-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: none; cursor: pointer; color: var(--cc-ink-soft); font-size: 1.2rem; line-height: 0; padding: 4px; z-index: 2; }
.ac-clear:hover { color: var(--cc-navy); }
.ac-caret { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; fill: var(--cc-ink-soft); pointer-events: none; }
.ac-box:focus-within .ac-caret { fill: var(--cc-accent); }
/* When the box has a value the × clear shows, so hide the caret to avoid overlap. */
.ac-box input:not(:placeholder-shown) ~ .ac-caret { display: none; }

/* ---- Panels ---------------------------------------------------------- */
.panels { display: grid; grid-template-columns: 1fr 1.15fr; gap: 24px; align-items: start; }
.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--sh-md); padding: 28px; }
.panel h2 { margin: 0; font-size: 1.15rem; color: var(--cc-navy); letter-spacing: -.3px; }
.panel .eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--cc-accent); margin: 0 0 6px; }

/* revenue hero */
.hero-fig { margin: 18px 0 6px; }
.hero-fig .big { font-size: 3.2rem; font-weight: 700; letter-spacing: -1.5px; color: var(--cc-navy); line-height: 1; }
.hero-fig .big .cents { font-size: .5em; color: var(--cc-ink-soft); font-weight: 600; }
.hero-fig .cap { font-size: .9rem; color: var(--cc-ink-soft); margin-top: 6px; }
.hero-fig .cap b { color: var(--cc-mid); }

.rev-bars { margin: 22px 0 4px; display: flex; flex-direction: column; gap: 12px; }
.rev-bar .rb-top { display: flex; justify-content: space-between; font-size: .82rem; margin-bottom: 5px; }
.rev-bar .rb-top .lbl { color: var(--cc-ink-soft); font-weight: 600; }
.rev-bar .rb-top .amt { font-weight: 700; color: var(--cc-navy); }
.rev-bar .track { background: var(--cc-paler); border-radius: 8px; height: 16px; overflow: hidden; }
.rev-bar .fill { height: 100%; border-radius: 8px; transition: width .5s var(--ease); }
.rev-bar.total .fill { background: var(--grad-deep); }
.rev-bar.practice .fill { background: linear-gradient(135deg, #2e8b57, #3fae6a); }
.rev-bar.gp .fill { background: linear-gradient(160deg, #79c2e3, var(--cc-light)); }

.breakdown { margin-top: 22px; border-top: 1px solid #eef2f6; padding-top: 16px; font-size: .85rem; color: var(--cc-ink-soft); }
.breakdown .row { display: flex; justify-content: space-between; padding: 4px 0; }
.breakdown .row b { color: var(--cc-ink); font-weight: 600; }
.note { font-size: .76rem; color: var(--cc-ink-soft); margin-top: 14px; }
.flag { display: inline-block; background: #fff4e2; color: #9a6a17; border: 1px solid #f0d9a8; border-radius: 6px; padding: 1px 7px; font-size: .72rem; font-weight: 700; }

/* health bars */
.profile-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.profile-sub { font-size: .76rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--cc-ink-soft); }
.bars { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; align-items: center; }
.hbar .name { font-size: .86rem; text-align: right; color: var(--cc-ink); }
.hbar .track { background: var(--cc-paler); border-radius: 7px; height: 26px; position: relative; }
.hbar .fill { height: 100%; border-radius: 7px; background: var(--grad-deep); min-width: 3px; position: relative; transition: width .55s var(--ease); }
.hbar .pct { position: absolute; top: 0; height: 100%; display: flex; align-items: center; font-weight: 700; font-size: .8rem; white-space: nowrap; }
.hbar .pct:not(.out) { right: 0; padding-right: 10px; color: #fff; }
.hbar .pct.out { left: 100%; padding-left: 8px; color: var(--cc-navy); }
.hbar.low .fill { background: linear-gradient(160deg, #79c2e3, var(--cc-light)); }

.national-list .hbar .fill { background: linear-gradient(135deg, var(--cc-accent), var(--cc-light)); }
.national-list .hbar .pct:not(.out) { color: #fff; left: 0; right: auto; padding-left: 10px; padding-right: 0; }

.profile-empty { padding: 20px 0; color: var(--cc-ink-soft); font-size: .9rem; }

.narrative { font-size: .92rem; line-height: 1.6; color: var(--cc-ink); margin: 14px 0 20px; }
.narrative b { color: var(--cc-navy); font-weight: 700; }

.alert-panel {
  display: flex; align-items: flex-start; gap: 12px; margin-top: 22px;
  padding: 15px 20px; border-radius: 12px;
  background: linear-gradient(120deg, var(--cc-paler), rgba(220,235,244,.55));
  border-left: 4px solid var(--cc-light);
  box-shadow: var(--sh-sm);
}
.alert-panel svg { width: 22px; height: 22px; fill: var(--cc-accent); flex-shrink: 0; margin-top: 1px; }
.alert-panel span { font-size: .9rem; line-height: 1.45; color: var(--cc-navy); }
.alert-panel strong { font-weight: 700; }

.source { font-size: .74rem; color: var(--cc-ink-soft); margin-top: 22px; border-top: 1px solid #eef2f6; padding-top: 12px; }

footer.site-foot { text-align: center; color: var(--cc-ink-soft); font-size: .8rem; padding: 36px 0 48px; }

/* toast */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--cc-footer); color: #fff; padding: 12px 22px; border-radius: 11px; box-shadow: var(--sh-lg); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; font-size: .9rem; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 920px) {
  .controls { grid-template-columns: 1fr 1fr; }
  .controls .field.area { grid-column: 1 / -1; }
  .controls .field.share-wrap { grid-column: 1 / -1; }
  .btn-share { width: 100%; justify-content: center; }
  .panels { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .controls { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 1fr; gap: 3px; }
  .hbar .name { text-align: left; }
}
