:root {
  --bg: #f3eee3;
  --ink: #1c2420;
  --muted: #5d6a63;
  --line: rgba(28, 36, 32, 0.12);
  --panel: rgba(255, 252, 246, 0.88);
  --accent: #0f6e56;
  --accent-soft: rgba(15, 110, 86, 0.12);
  --warn: #9a4d1c;
  --you: #0f6e56;
  --insurer: #2a4f7a;
  --display: "Fraunces", Georgia, serif;
  --sans: "Outfit", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--sans);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.wash {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(15, 110, 86, 0.16), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(154, 77, 28, 0.12), transparent 50%),
    linear-gradient(180deg, #f7f2e8 0%, #efe8d8 45%, #e7efe9 100%);
}

.top {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 0;
}

.home {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}

.brand {
  margin: 0.45rem 0 0;
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.tag {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.hero h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.55rem, 3.5vw, 2.1rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.lede {
  margin: 0.65rem 0 0;
  max-width: 42rem;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.1rem 1.15rem;
  backdrop-filter: blur(10px);
}

.chooser {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 0.7rem;
  align-items: stretch;
}

@media (max-width: 800px) {
  .chooser { grid-template-columns: 1fr; }
}

.chooser .panel {
  padding: 0.75rem 0.85rem 0.8rem;
  border-radius: 14px;
}

.chooser__title {
  margin: 0 0 0.45rem;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.chooser__insurance,
.chooser__procedure {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
  height: 100%;
}

.chooser__fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.55rem;
}

.chooser__fields .field--wide {
  grid-column: 1 / -1;
}

.chooser__ytd {
  margin-top: 0.15rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chooser__ytd-title {
  margin: 0;
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.chooser__ytd-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.chooser__ytd-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 0.55rem;
}

.field__hint {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  line-height: 1.3;
}

.chooser__ytd .field > span:first-child {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
}

@media (max-width: 520px) {
  .chooser__fields,
  .chooser__ytd-fields { grid-template-columns: 1fr; }
  .chooser__fields .field--wide { grid-column: auto; }
}

.chooser__selected {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.selected-codes {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 1.4rem;
}

.selected-codes__empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.selected-codes__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.selected-codes__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 6.5rem;
  overflow: auto;
}

.selected-code {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.35rem 0.28rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 110, 86, 0.08);
}

.selected-code__text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  font-size: 0.78rem;
  line-height: 1.25;
}

.selected-code__text strong {
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--accent);
}

.selected-code__text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 500;
}

.selected-code__remove {
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.selected-code__remove:hover,
.selected-code__remove:focus-visible {
  background: rgba(28, 36, 32, 0.08);
  color: var(--ink);
  outline: none;
}

.procedure-list {
  flex: 1 1 auto;
  min-height: 8.5rem;
  max-height: 10.5rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0.2rem;
}

.procedure-option {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  padding: 0.28rem 0.4rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.25;
}

.procedure-option:hover,
.procedure-option:has(input:focus-visible) {
  background: rgba(15, 110, 86, 0.08);
}

.procedure-option:has(input:checked) {
  background: rgba(15, 110, 86, 0.12);
}

.procedure-option input {
  margin-top: 0.15rem;
  flex: 0 0 auto;
}

.procedure-option span {
  min-width: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  padding: 0.45rem 0.55rem;
}

.chooser .field input,
.chooser .field select {
  font-size: 0.84rem;
  padding: 0.4rem 0.5rem;
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(15, 110, 86, 0.35);
  outline-offset: 1px;
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.places-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
}

.places-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 500;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.proc-summary {
  padding: 0.15rem 0.15rem 0.35rem;
}

.proc__code {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.proc__name {
  margin: 0.2rem 0 0;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.proc__meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.empty {
  margin: 0;
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
}

.place {
  display: grid;
  grid-template-columns: 2rem 1.15fr 1fr;
  gap: 0.85rem;
  padding: 0.95rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 252, 246, 0.92);
  align-items: start;
}

.place--best {
  border-color: rgba(15, 110, 86, 0.35);
  box-shadow: 0 0 0 1px rgba(15, 110, 86, 0.12);
}

.place__rank {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1;
  padding-top: 0.15rem;
}

.place__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
}

.place__title-row h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 650;
}

.badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.22rem 0.5rem;
}

.place .sys {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.place__missing {
  margin-top: 0.35rem !important;
  color: var(--warn) !important;
}

@media (max-width: 800px) {
  .place {
    grid-template-columns: 1.5rem 1fr;
  }
  .place .split {
    grid-column: 1 / -1;
  }
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.65rem;
}

@media (max-width: 520px) {
  .price-grid { grid-template-columns: 1fr; }
}

.price-chip {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.45rem 0.55rem;
  background: rgba(255,255,255,0.65);
}

.price-chip span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.price-chip strong {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.98rem;
  font-weight: 650;
}

.split {
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(15,110,86,0.08), rgba(42,79,122,0.08));
  padding: 0.75rem 0.8rem;
}

.split__label {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.split__bars {
  display: grid;
  gap: 0.4rem;
}

.bar {
  display: grid;
  grid-template-columns: 4.5rem 1fr auto;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.88rem;
}

.bar__track {
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(28,36,32,0.08);
  overflow: hidden;
}

.bar__fill {
  height: 100%;
  border-radius: inherit;
}

.bar__fill.you { background: var(--you); }
.bar__fill.insurer { background: var(--insurer); }

.split__note {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.proc {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 252, 246, 0.92);
  overflow: hidden;
}

.proc__head {
  padding: 0.95rem 1.05rem 0.7rem;
  border-bottom: 1px solid var(--line);
}

.hospital-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.85rem;
  padding: 0.95rem 1.05rem;
  border-bottom: 1px solid var(--line);
}

.hospital-row:last-child { border-bottom: 0; }

@media (max-width: 800px) {
  .hospital-row { grid-template-columns: 1fr; }
}

.hospital-row h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
}

.hospital-row .sys {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.muted { color: var(--muted); }

.hospital-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.hospital-list li {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.55);
}

.hospital-list__top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.45rem 0.85rem;
}

.hospital-list__id {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.hospital-list__stars {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.stars {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  line-height: 1;
}

.stars__glyphs {
  letter-spacing: 0.04em;
  font-size: 1.05rem;
}

.stars--compact .stars__glyphs {
  font-size: 0.92rem;
}

.stars__on { color: #d4a017; }
.stars__off { color: rgba(28, 36, 32, 0.22); }
.stars__num {
  font-weight: 700;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}
.stars--compact .stars__num { font-size: 0.82rem; }
.stars--na {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}
.stars__source {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.stars__source:hover { text-decoration: underline; color: var(--ink); }

.rating {
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.rating__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
}

.rating__more {
  margin-top: 0.35rem;
}

.rating__more summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  list-style: none;
}

.rating__more summary::-webkit-details-marker { display: none; }
.rating__more summary::after { content: " ▾"; }
.rating__more[open] summary::after { content: " ▴"; }

.rating__meta {
  margin: 0.4rem 0 0.45rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.rating-line,
.rating-cats li,
.rating-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.rating-cats,
.rating-groups {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.rating-group__better { color: var(--accent); font-weight: 650; }
.rating-group__worse { color: var(--warn); font-weight: 650; }

.hospital-list__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
}

.hospital-list a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

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

.hospital-list__missing {
  color: var(--warn);
  font-weight: 600;
}

.text-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.text-btn--link {
  display: inline;
}

.notes h2,
.sources h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 500;
}

.notes__sub {
  margin-top: 1.15rem !important;
  font-size: 1.1rem !important;
}

.notes__lead {
  margin: 0.55rem 0 0;
  line-height: 1.5;
  font-size: 0.95rem;
}

.notes .bullets + .notes__lead {
  margin-top: 0.75rem;
}

.bullets {
  margin: 0.7rem 0 0;
  padding-left: 1.15rem;
  color: var(--muted);
  line-height: 1.5;
}

.bullets li { margin: 0.35rem 0; }
.bullets strong { color: var(--ink); }

.foot {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.foot a { color: var(--accent); }
