/* 보유세 지도 — 웹/HTML5 앱 공용 스타일 */

/*
 * 팔레트 — 지도 말풍선과 같은 결로 맞춘 밝은 톤.
 *   기본색  파스텔 페리윙클 (하늘색↔보라 사이)
 *   포인트  파스텔 그린 (종합부동산세·증가/감소 등 대비가 필요한 곳)
 * 지도 위 말풍선이 흰 배경 고정이라, 앱 전체도 밝은 톤 하나로 통일했습니다.
 */
:root {
  /*
   * OS가 다크 모드면 브라우저가 캔버스·스크롤바·폼 컨트롤을 어둡게 칠합니다.
   * 이 앱은 밝은 톤 하나로 가므로 UA 기본값도 라이트로 고정합니다.
   */
  color-scheme: light;

  --bg: #f4f5fd;
  --surface: #ffffff;
  --surface-2: #f7f8ff;
  --ink: #232a45;
  --ink-2: #5b6488;
  --ink-3: #8d95b5;
  --line: #e5e8f8;
  --line-strong: #ccd3f7;

  /* 기본색 — 참고 이미지의 보라 계열 */
  --brand: #8b7ee6;
  --brand-soft: #f0edfd;

  /* 금액 강조 — ₩ 글리프의 진한 보라 */
  --tax: #6d5cc9;
  --tax-soft: #efecfb;

  /* 참고 이미지의 중간 하늘색 */
  --sky: #7fc5e8;
  --sky-soft: #e9f4fb;

  /* 포인트 — 참고 이미지의 파스텔 그린(민트) */
  --mint: #5fc7ac;
  --mint-soft: #e6f7f2;
  --ctx: #5fc7ac; /* 종합부동산세 세그먼트 */
  --ok: #3fae8c;
  --warn: #c58b46;
  --warn-soft: #fdf3e6;

  /* 참고 이미지 그라데이션 (민트 → 하늘 → 보라) */
  --grad: linear-gradient(135deg, #86d5be 0%, #8cc5ea 50%, #ae8fdf 100%);

  --radius: 14px;
  --shadow: 0 1px 2px rgba(90, 100, 180, 0.06), 0 8px 24px rgba(90, 100, 180, 0.1);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  /* 모바일은 문서 전체가 스크롤됩니다 — 지도까지 같이 밀려 올라가서
     상세 내용을 화면 가득 볼 수 있습니다. 데스크톱은 아래에서 고정 높이로 되돌립니다. */
  min-height: 100%;
  background: var(--bg);
}

@media (min-width: 900px) {
  html,
  body {
    height: 100%;
  }
}

body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Pretendard', 'Noto Sans KR',
    'Malgun Gothic', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

/* ---------------------------------------------------------------- topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex: none;
  /* 문서 전체가 스크롤되므로, 붙여 두지 않으면 로고가 위로 사라집니다 */
  position: sticky;
  top: 0;
  z-index: 600;
}

.topbar__title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: none;
}

/* -------------------------------------------------------------- 광고(배너) */

/* 배너 이미지 공통: 폭에 맞춰 비율 유지 축소 */
.coupang-ad {
  display: block;
  line-height: 0;
}
.coupang-ad img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* 데스크톱 자리: 제목과 버튼 사이 빈 공간. 세로로 가운데, 넘치면 잘라 레이아웃 보호 */
.ad-slot--desktop {
  display: none;
}
@media (min-width: 900px) {
  .ad-slot--desktop {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
    align-items: center;
    overflow: hidden;
  }
  /* 상단바가 너무 높아지지 않게 배너 높이를 제한 (가로형 비율 유지) */
  .ad-slot--desktop .coupang-ad img {
    max-height: 56px;
    width: auto;
  }
}

/* 모바일 자리: 상단바 아래 얇은 줄. sticky 아님 → 스크롤하면 사라져 방해 최소화 */
.ad-slot--mobile {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.ad-slot--mobile .coupang-ad img {
  max-height: 60px;
  width: auto;
}
@media (min-width: 900px) {
  .ad-slot--mobile {
    display: none;
  }
}

/* 쿠팡 파트너스 고지 */
.ad-disclosure {
  margin: 2px 2px 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-3);
}

.topbar__mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex: none;
  display: block;
  /* 로고 SVG 가 못 뜨는 경우에도 자리와 색이 남도록 */
  background: var(--grad);
}

.topbar h1 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.topbar p {
  margin: 0;
  font-size: 12px;
  color: var(--ink-3);
}

.ghost-btn {
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.ghost-btn:active {
  background: var(--line);
}

/* --------------------------------------------------- 현재 위치 버튼/마커 */

/* 지도 위 원형 버튼 (네이버 현재위치 버튼처럼). 지도 확대/축소는 좌상단이라 우하단에 둡니다 */
.map-loc-btn {
  position: absolute;
  right: 12px;
  bottom: 44px;
  z-index: 500;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.map-loc-btn:hover {
  color: var(--brand);
}
.map-loc-btn:active {
  transform: scale(0.94);
}
.map-loc-btn svg {
  width: 22px;
  height: 22px;
  display: block;
}
.map-loc-btn:disabled {
  cursor: default;
  opacity: 0.7;
}
/* 위치 확인 중: 아이콘 회전으로 로딩 표시 */
.map-loc-btn.is-loading svg {
  animation: loc-spin 0.9s linear infinite;
}
@keyframes loc-spin {
  to {
    transform: rotate(360deg);
  }
}

/* 현재 위치 파란 점 마커 (지도 위) */
.me-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #4285f4;
  border: 2.5px solid #fff;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.12),
    0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ---------------------------------------------------------------- layout */

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  /* 모바일: 잘라내지 않고 문서 스크롤에 맡깁니다 */
  overflow: visible;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 400px;
    grid-template-rows: 1fr;
    overflow: hidden;
  }
}

.map-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface-2);
}

.map-stack {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 지도 위에 떠 있는 "몇 곳 표시 중" 안내 */
.map-count {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 500;
  margin: 0;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink-2);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  pointer-events: none;
  max-width: calc(100% - 20px);
}

/* 안내 배너가 떠 있으면 그만큼 위로 */
.map-notice:not([hidden]) ~ .map-count,
.map-stack:has(.map-notice:not([hidden])) .map-count {
  bottom: 52px;
}

.map-notice[hidden] {
  display: none;
}

.map-notice {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink);
  background: color-mix(in srgb, var(--warn) 14%, var(--surface));
  border-top: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
}

.map-notice p {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.map-notice .ghost-btn {
  font-size: 11.5px;
  padding: 5px 11px;
  white-space: nowrap;
}

.map {
  flex: 1;
  /* 모바일: 지도 높이를 고정해 슬라이더와 상세 패널이 항상 보이도록 */
  height: 38vh;
  min-height: 220px;
  background: var(--surface-2);
}

@media (min-width: 900px) {
  .map {
    height: auto;
    min-height: 0;
  }
}

.map--unavailable {
  display: grid;
  place-items: center;
  padding: 24px;
}

.map-fallback {
  display: grid;
  gap: 6px;
  text-align: center;
  color: var(--ink-2);
  max-width: 340px;
}

.detail-pane {
  min-height: 0;
  /* 모바일: 이 안에서만 스크롤되면 지도가 화면을 계속 차지해 답답합니다.
     문서 전체가 스크롤되도록 넘기고, 데스크톱에서만 독립 스크롤로 되돌립니다. */
  overflow: visible;
  padding: 14px 14px calc(24px + var(--safe-b));
  display: grid;
  gap: 12px;
  align-content: start;
}

@media (min-width: 900px) {
  .detail-pane {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-left: 1px solid var(--line);
  }
}

/* ----------------------------------------------------------- year slider */

.year-control {
  flex: none;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 12px 16px 14px;
}

.year-control__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.year-now strong {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.year-now span {
  margin-left: 8px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.badge {
  flex: none;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
}

.badge--proposed {
  background: color-mix(in srgb, var(--warn) 16%, transparent);
  color: var(--warn);
}

.year-slider {
  width: 100%;
  margin: 4px 0 2px;
  height: 28px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.year-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: var(--line-strong);
}

.year-slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--line-strong);
}

.year-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--brand);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(110, 95, 190, 0.45);
}

.year-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(110, 95, 190, 0.45);
}

.year-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink-3);
}

.year-ticks button {
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  padding: 2px 4px;
  cursor: pointer;
}

.year-ticks button[aria-current='true'] {
  color: var(--tax);
  font-weight: 700;
}

.year-basis {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--ink-3);
}

/* --------------------------------------------------------------- bubbles */

/*
 * 말풍선은 지도 타일 위에 올라가므로 라이트/다크와 무관하게 **흰 배경**으로 고정합니다.
 * 강조색은 하늘색과 보라 사이의 파스텔 페리윙클 계열로 통일했습니다.
 */
:root,
:root[data-theme='dark'] {
  --bub-bg: #ffffff;
  --bub-ink: #232a45;
  --bub-sub: #8d95b5;
  --bub-line: #e8eaf8;
  --bub-accent: #a08fe8; /* 참고 이미지의 보라 — 핀·테두리 */
  --bub-border: #cdc4f2; /* 테두리를 또렷하게 */
  --bub-accent-soft: #f1edfd;
  --bub-mint: #5fc7ac; /* 포인트 (종부세 뱃지) */
  --bub-strong: #6d5cc9; /* 금액 강조 */
  --bub-shadow: 0 2px 6px rgba(110, 95, 190, 0.16), 0 10px 26px rgba(110, 95, 190, 0.18);
}

/*
 * 말풍선 래퍼는 크기 0의 기준점입니다.
 * Leaflet은 divIcon 컨테이너 자체가, 네이버 지도는 안쪽 div가 이 클래스를 갖습니다.
 * 자식들은 모두 absolute라 좌표(0,0) 기준으로 배치됩니다.
 */
.bubble-wrap {
  position: relative;
  background: none;
  border: 0;
  width: 0 !important;
  height: 0 !important;
  transform-origin: 0 0;
  pointer-events: auto;
}

.bubble {
  position: absolute;
  left: 0;
  bottom: 14px;
  transform: translateX(-50%);
  min-width: 108px;
  padding: 7px 10px 8px;
  background: var(--bub-bg);
  border: 1.5px solid var(--bub-border);
  border-radius: 12px;
  box-shadow: var(--bub-shadow);
  text-align: center;
  white-space: nowrap;
  font-family: inherit;
  cursor: pointer;
}

.bubble__name {
  font-size: 11px;
  color: var(--bub-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.bubble__price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  color: var(--bub-ink);
}

.bubble__label {
  font-size: 10px;
  color: var(--bub-sub);
}

.bubble__value {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.bubble__tax {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-top: 2px;
  padding-top: 3px;
  border-top: 1px dashed var(--bub-line);
  color: var(--bub-strong);
}

.bubble__taxlabel {
  font-size: 10px;
  color: var(--bub-sub);
}

.bubble__taxvalue {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.bubble--region {
  border-color: var(--bub-accent);
  background: var(--bub-accent-soft);
}

.bubble--region .bubble__name {
  font-size: 12px;
  font-weight: 700;
  color: var(--bub-ink);
}

.bubble--region .bubble__tax {
  border-top-color: color-mix(in srgb, var(--bub-accent) 45%, transparent);
}

.bubble--region .bubble__flag {
  color: var(--bub-sub);
  font-weight: 400;
}

.bubble__flag {
  margin-top: 3px;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--bub-mint);
}

.bubble__tail {
  position: absolute;
  left: 0;
  bottom: 8px;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--bub-bg);
  border-right: 1.5px solid var(--bub-border);
  border-bottom: 1.5px solid var(--bub-border);
}

.bubble__pin {
  position: absolute;
  left: 0;
  bottom: 0;
  transform: translate(-50%, 50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bub-accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bub-accent) 30%, transparent);
}

/* 축소 보기 — 겹침을 줄이기 위해 단지명·라벨을 감춘 작은 말풍선 */
.bubble-wrap.is-compact .bubble {
  min-width: 0;
  padding: 4px 7px 5px;
  border-radius: 9px;
}

.bubble-wrap.is-compact .bubble__value {
  font-size: 12px;
}

.bubble-wrap.is-compact .bubble__tax {
  margin-top: 1px;
  padding-top: 2px;
}

.bubble-wrap.is-compact .bubble__taxvalue {
  font-size: 11.5px;
}

.bubble-wrap.is-selected .bubble {
  border-color: var(--bub-accent);
  border-width: 2.5px;
  background: var(--bub-bg);
  box-shadow:
    0 0 0 5px color-mix(in srgb, var(--bub-accent) 22%, transparent),
    var(--bub-shadow);
}

.bubble-wrap.is-selected .bubble__tail {
  border-color: var(--bub-accent);
  border-right-width: 2.5px;
  border-bottom-width: 2.5px;
}

.bubble-wrap.is-selected .bubble__taxvalue {
  color: var(--bub-strong);
}

/* ----------------------------------------------------------------- cards */

.card,
details.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 10px;
  font-size: 13.5px;
  color: var(--ink-2);
  font-weight: 700;
  letter-spacing: 0.01em;
}

details.card > summary,
details.subcard > summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-2);
  list-style: none;
}

details.card > summary::after,
details.subcard > summary::after {
  content: ' ▾';
  color: var(--ink-3);
}

details[open].card > summary::after,
details[open].subcard > summary::after {
  content: ' ▴';
}

details.card[open] > summary {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.subcard {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.card--source {
  border-left: 3px solid var(--ink-3);
}

.source-state {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.source-state[data-kind='live'] {
  color: var(--ok);
}

.source-state[data-kind='sample'] {
  color: var(--warn);
}

.source-state[data-kind='checking'] {
  color: var(--ink-3);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  word-break: break-all;
}

.muted {
  color: var(--ink-3);
  font-weight: 400;
  font-size: 12px;
}

/* ------------------------------------------------------------------ hero */

.card--hero {
  border-top: 3px solid transparent;
  border-image: var(--grad) 1;
}

.hero__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.hero__head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.hero__head p {
  margin: 2px 0 0;
}

.chip {
  flex: none;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--line);
  color: var(--ink-2);
}

.chip--warn {
  background: color-mix(in srgb, var(--warn) 16%, transparent);
  color: var(--warn);
}

.area-picker {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.area-picker__label {
  font-size: 11.5px;
  color: var(--ink-3);
}

.area-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.area-chip {
  display: grid;
  gap: 1px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-2);
  font: inherit;
  cursor: pointer;
  text-align: left;
  line-height: 1.25;
}

.area-chip b {
  font-size: 13px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.area-chip span {
  font-size: 10.5px;
  color: var(--ink-3);
}

.area-chip[aria-current='true'] {
  border-color: var(--tax);
  background: color-mix(in srgb, var(--tax) 10%, var(--surface-2));
}

.area-chip[aria-current='true'] b {
  color: var(--tax);
}

.hero__price {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 12px 0 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.hero__price dt {
  font-size: 12.5px;
  color: var(--ink-2);
}

.hero__price dd {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero__tax {
  margin-top: 12px;
  display: grid;
  gap: 2px;
}

.hero__tax-label {
  font-size: 12.5px;
  color: var(--ink-2);
}

.hero__tax-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--tax);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero__delta {
  font-size: 12.5px;
  color: var(--ink-3);
}

.hero__delta[data-dir='up'] {
  color: var(--tax);
}

.hero__delta[data-dir='down'] {
  color: var(--ok);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.split > div {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 8px 10px;
  display: grid;
  gap: 1px;
}

.split b {
  font-size: 15px;
  letter-spacing: -0.01em;
}

/* ----------------------------------------------------------------- trend */

.trend {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 10px;
  align-items: end;
}

.trend__col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  border: 0;
  background: none;
  font: inherit;
  padding: 0;
  color: inherit;
}

/* 막대가 놓이는 고정 높이 슬롯 (app.js의 TREND_H와 동일) */
.trend__slot {
  display: flex;
  align-items: flex-end;
  height: 92px;
}

.trend__bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  border-radius: 6px 6px 0 0;
  overflow: hidden;
  background: var(--line);
  transition: height 0.18s ease;
}

.trend__seg {
  display: block;
  width: 100%;
  flex: none;
}

.trend__seg--ctx {
  background: var(--mint);
}

.trend__seg--property {
  background: var(--brand);
}

.trend__amount {
  font-size: 10.5px;
  color: var(--ink-2);
  text-align: center;
  white-space: nowrap;
}

.trend__year {
  font-size: 11px;
  color: var(--ink-3);
  text-align: center;
}

.trend__col[aria-current='true'] .trend__year {
  color: var(--tax);
  font-weight: 700;
}

.trend__col[aria-current='true'] .trend__bar {
  outline: 2px solid var(--tax);
  outline-offset: 1px;
}

.legend {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend__key {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.legend__key--property {
  background: var(--brand);
}

.legend__key--ctx {
  background: var(--mint);
  margin-left: 8px;
}

/* ------------------------------------------------------------- breakdown */

.breakdown {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.breakdown th,
.breakdown td {
  padding: 6px 0;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: baseline;
}

.breakdown td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.breakdown tr.group th {
  padding-top: 12px;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.03em;
  border-bottom-color: transparent;
}

.breakdown tr.sum td,
.breakdown tr.sum th {
  font-weight: 800;
  border-bottom: 0;
}

.breakdown tr.total td {
  color: var(--tax);
  font-size: 15px;
}

.breakdown .sub {
  padding-left: 10px;
  color: var(--ink-2);
  font-weight: 400;
}

.notes {
  margin: 12px 0 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--ink-2);
  display: grid;
  gap: 4px;
}

/* ---------------------------------------------------------------- fields */

.field {
  margin-top: 12px;
}

.field:first-of-type {
  margin-top: 0;
}

.field > label,
.field__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}

.field--check .field__row label {
  cursor: pointer;
  line-height: 1.4;
}

.field--row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.field--row label {
  display: grid;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.select,
.textarea,
.search,
.field input[type='number'],
.field input[type='text'] {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.field input[type='range'] {
  width: 100%;
  accent-color: var(--brand);
  margin-top: 6px;
  height: 22px;
}

.field input[type='checkbox'] {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
  flex: none;
}

.field output {
  font-variant-numeric: tabular-nums;
  color: var(--brand);
  font-weight: 700;
}

.hint {
  margin: 5px 0 0;
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.5;
}

.select {
  max-width: 180px;
}

.search {
  margin-bottom: 8px;
}

.textarea {
  margin-top: 8px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.code {
  margin: 8px 0 0;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  color: var(--ink-2);
}

.ghost-btn--block {
  display: block;
  width: 100%;
  margin-top: 8px;
}

.picker__empty {
  padding: 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-3);
}

.primary-btn {
  margin-top: 12px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* ---------------------------------------------------------------- picker */

.picker {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.picker button {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: inherit;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

.picker button[aria-current='true'] {
  border-color: var(--tax);
  background: color-mix(in srgb, var(--tax) 8%, var(--surface-2));
}

.picker .picker__tax {
  color: var(--tax);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ----------------------------------------------------------------- prose */

.prose {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.65;
}

.prose h4 {
  margin: 14px 0 4px;
  font-size: 12.5px;
  color: var(--ink);
}

.prose h4:first-child {
  margin-top: 0;
}

.prose ul {
  margin: 4px 0;
  padding-left: 18px;
}

.prose a {
  color: var(--brand);
}

.prose .warn {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--tax-soft);
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--tax) 30%, transparent);
}
