/* ============================================================
   Home_Compass
   Vanilla CSS. No build step, no CDN, no external font request.
   Light theme only. Warm neutral plane + yellow accent.
   ============================================================ */

:root {
  color-scheme: light;

  /* — brand ————————————————————————————— */
  --accent-yellow:        #FFB800;
  --accent-yellow-deep:   #D99C00;
  --accent-yellow-tint:   #FFF3D2;
  --accent-yellow-wash:   #FFFAEE;

  /* — ink / surface (warm neutral ramp) ————————— */
  /* ink-3 / ink-4 are the de-emphasis steps. They are held at WCAG AA 4.5:1
     against every surface they actually land on (white / plane / plane-sunk /
     yellow-wash), so hierarchy is carried by size + weight, not by fading text
     out of legibility. Measured: ink-3 5.4–6.3:1, ink-4 4.6–5.4:1. */
  --ink-1:  #1B1915;
  --ink-2:  #55504A;
  --ink-3:  #655F53;
  --ink-4:  #6F6A5D;
  --surface:      #FFFFFF;
  --plane:        #F6F4EF;
  --plane-sunk:   #EFECE4;
  --line:         #E6E2D8;
  --line-soft:    #F0EDE6;
  --line-strong:  #D6D1C4;

  /* — status (icon + label always accompany colour) ——— */
  --good:      #0CA30C;  --good-ink:  #086E08;  --good-bg:  #E9F6E9;
  --caution:   #EC835A;  --caution-ink:#A9491F; --caution-bg:#FDEFE7;
  --critical:  #D03B3B;  --critical-ink:#9A2323;--critical-bg:#FAEAEA;

  /* — categorical series (validated: adjacent CVD ΔE 9.2 / normal 27.6) */
  --s1: #2A78D6;  /* 대출이자   */
  --s2: #EB6834;  /* 월세       */
  --s3: #1BAF7A;  /* 관리비     */
  --s4: #4A3AA7;  /* 기회비용   */
  --s5: #E87BA4;  /* 보증보험료 */
  --s-neutral: #DCD7CC;

  --grid: #EDEAE2;
  --axis: #CFC9BC;

  /* — geometry ————————————————————————— */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --shadow-1: 0 1px 2px rgba(27,25,21,.05), 0 10px 28px -18px rgba(27,25,21,.28);
  --shadow-2: 0 2px 6px rgba(27,25,21,.06), 0 24px 48px -28px rgba(27,25,21,.34);

  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
          "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic",
          "맑은 고딕", system-ui, sans-serif;

  --shell: 1420px;
  --topbar-h: 66px;
}

/* ── reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
/* must outrank the id-level display rules on #onboarding / #skeleton / #dashboard */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
/* 상단바가 sticky 66px 라 앵커·건너뛰기 링크가 그 아래로 들어간다. 측정: 「본문
   바로가기」를 누르면 #main 상단 66px 가 상단바에 덮였다 (WCAG 2.2 2.4.11). */
html {
  -webkit-text-size-adjust: 100%; scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 10px);
}
body {
  font-family: var(--font);
  background: var(--plane);
  color: var(--ink-1);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, dl, dd, figure, ol, ul { margin: 0; }
ul, ol { list-style: none; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
svg { display: block; }
strong { font-weight: 650; }

::selection { background: var(--accent-yellow-tint); color: var(--ink-1); }

:focus-visible {
  outline: 2.5px solid var(--ink-1);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--ink-1); color: #fff; padding: 10px 16px;
  border-radius: var(--r-sm); font-weight: 600; text-decoration: none;
  transition: top .16s ease;
}
.skip-link:focus { top: 12px; }

/* ── numerals ──────────────────────────────────────────── */
.fig-hero, .hm-num, .num, .money-echo, .fig-stats dd, .risk-score,
.sc-cost, .sc-tco, .policy-num, .alloc-total { font-variant-numeric: tabular-nums; }

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--topbar-h);
  background: rgba(246,244,239,.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--shell); height: 100%; margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 34px);
  display: flex; align-items: center; gap: 18px;
}
/* min-height 는 좁은 폭에서 마크와 부제가 빠지고 제목 한 줄(15px)만 남을 때를 위한
   것이다. 측정: 390px 에서 이 링크의 히트 영역이 92×15 로 WCAG 2.2 2.5.8(24×24)
   미달인 유일한 대상이었다. */
.brand {
  display: flex; align-items: center; gap: 11px; text-decoration: none;
  color: inherit; min-width: 0; min-height: 24px;
}
.brand-mark { display: block; flex: none; filter: drop-shadow(0 3px 8px rgba(27,25,21,.18)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong {
  font-size: 16px; font-weight: 700; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-text em {
  font-style: normal; font-size: 10px; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3);
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.conn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface);
  font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.conn-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-4); flex: none;
}
.conn[data-state="live"]   .conn-dot { background: var(--good); box-shadow: 0 0 0 3px rgba(12,163,12,.16); }
.conn[data-state="offline"].conn      { border-color: var(--line); }
.conn[data-state="offline"] .conn-dot { background: var(--accent-yellow-deep); box-shadow: 0 0 0 3px rgba(217,156,0,.16); }
/* local = 백엔드 미연결이지만 생성물로 판정이 성립하는 상태.
   disabled = 생성물이 없어 판정 자체를 하지 않는 상태 (D-11). 둘을 같은 색으로 뭉치지 않는다. */
.conn[data-state="local"]  .conn-dot  { background: var(--caution); box-shadow: 0 0 0 3px rgba(236,131,90,.18); }
.conn[data-state="disabled"] .conn-dot { background: var(--critical); box-shadow: 0 0 0 3px rgba(208,59,59,.18); }

/* Narrow viewports: the three topbar items cannot share 358px of usable width,
   which pushed the document to 503px and produced a horizontal scroll on a
   390px phone. The status badge collapses to its colour-coded dot; the full
   wording stays in the accessible name via a visually-hidden span (a role-less
   <span> may not carry aria-label — ARIA prohibits naming `generic`).

   ★ 두 단의 임계는 감이 아니라 잰 값이다. `.topbar-actions` 는 nowrap 이라
     줄지 않고, 부족분을 전부 `.brand`(min-width:0) 가 먹는다. 측정한 브랜드
     폭 — 820px:160 · 800px:157(잘림 시작) · 768px:127 · 700px:63 · 640px:7.
     즉 접힘이 620px 이면 621~810px 대역에서 제품 이름이 지워진다. 접힘을
     810px 로 올리면 actions 가 633→250 이 되어 468px 까지 온전하다.
     두 번째 단(마크 숨김 + 13px)도 같은 이유로 400 → 470 이다 — 401~460px
     에서 다시 잘렸다. */
@media (max-width: 810px) {
  .topbar-inner { gap: 10px; }
  .topbar-actions { gap: 8px; }
  .brand-text em { display: none; }
  .conn { padding: 0 9px; gap: 0; }
  .conn #connText {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
}
@media (max-width: 470px) {
  .brand-mark { display: none; }
  .brand-text strong { font-size: 13px; letter-spacing: -.03em; }
  /* `.btn-ghost` 축소는 여기 있었지만 **한 번도 적용된 적이 없다** — 기반 규칙
     `.btn-ghost`(아래 BUTTONS 절)가 특이도는 같고 순서가 뒤라 이겼다. 측정:
     375px 에서 #btnSample 이 padding 13px / font-size 12.5px, 즉 기반값 그대로였다.
     실제로 듣도록 정의 뒤로 옮겼다. */
}

/* ── buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border-radius: 10px; font-size: 14px; font-weight: 650;
  letter-spacing: -.012em; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-ghost {
  height: 32px; padding: 0 13px; font-size: 12.5px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
}
.btn-ghost:hover { background: var(--accent-yellow-wash); border-color: var(--accent-yellow); color: var(--ink-1); }
/* 좁은 폭에서 상단바가 브랜드를 밀어내지 않도록 고스트 버튼을 줄인다.
   TOP BAR 절에 있던 같은 규칙이 순서 때문에 죽어 있었다(그 자리 주석 참조). */
@media (max-width: 470px) {
  .btn-ghost { padding: 0 10px; font-size: 12px; }
}
.btn-primary {
  background: var(--ink-1); color: #fff;
  box-shadow: 0 1px 2px rgba(27,25,21,.2), 0 12px 24px -14px rgba(27,25,21,.6);
}
.btn-primary:hover { background: #302C26; }
.btn-primary .btn-arrow { transition: transform .18s cubic-bezier(.2,.7,.3,1); }
.btn-primary:hover .btn-arrow { transform: translateX(3px); }
.btn-block { width: 100%; height: 50px; font-size: 15px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn.is-busy .btn-label::after {
  content: ""; display: inline-block; width: 1.2em; text-align: left;
  animation: dots 1.1s steps(4, end) infinite;
}
@keyframes dots { 0%{content:""} 25%{content:"."} 50%{content:".."} 75%{content:"..."} }

/* ============================================================
   LAYOUT
   ============================================================ */
.app {
  max-width: var(--shell);
  margin: 0 auto;
  padding: clamp(20px, 3vw, 34px) clamp(16px, 3vw, 34px) 72px;
  display: grid;
  grid-template-columns: minmax(320px, 384px) minmax(0, 1fr);
  gap: clamp(18px, 2vw, 28px);
  align-items: start;
}
/* The panel is ~1375px tall — taller than most viewports. Pinned with a plain
   `top`, its lower half (the 주거 조건 switches and the submit button) hung
   permanently below the fold once results were on screen, so re-running with a
   tweaked input meant scrolling all the way back to the top. Capping it to the
   visible area lets the sidebar scroll on its own and keeps the CTA reachable. */
.col-form {
  position: sticky;
  top: calc(var(--topbar-h) + 20px);
  max-height: calc(100vh - var(--topbar-h) - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  /* keep the panel's rounded corners clear of the scrollbar gutter */
  padding-right: 2px; margin-right: -2px;
}
.col-form::-webkit-scrollbar { width: 8px; }
.col-form::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
.col-form::-webkit-scrollbar-track { background: transparent; }
.col-results { display: flex; flex-direction: column; gap: clamp(16px, 1.6vw, 22px); min-width: 0; }

@media (max-width: 1080px) {
  .app { grid-template-columns: 1fr; }
  /* single column: the form scrolls with the page, so drop the cap entirely */
  .col-form {
    position: static; max-height: none; overflow: visible;
    padding-right: 0; margin-right: 0;
  }
}

/* ── panel / card shells ───────────────────────────────── */
.panel, .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.card { padding: clamp(20px, 2.2vw, 30px); }

.eyebrow {
  font-size: 10.5px; font-weight: 700; letter-spacing: .15em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 7px;
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.card-title {
  font-size: clamp(19px, 1.5vw, 23px); font-weight: 700;
  letter-spacing: -.03em; line-height: 1.3;
}
.card-sub { margin-top: 7px; font-size: 13.5px; color: var(--ink-2); max-width: 62ch; }

/* ============================================================
   FORM PANEL
   ============================================================ */
.form-panel { overflow: hidden; }
.panel-head {
  padding: clamp(20px, 2vw, 26px) clamp(18px, 2vw, 24px) 20px;
  background: linear-gradient(168deg, var(--accent-yellow-wash) 0%, var(--surface) 78%);
  border-bottom: 1px solid var(--line-soft);
}
.panel-title { font-size: 21px; font-weight: 750; letter-spacing: -.035em; }
.panel-sub { margin-top: 8px; font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }

.fieldset {
  padding: 20px clamp(18px, 2vw, 24px);
  border-bottom: 1px solid var(--line-soft);
}
.legend {
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 14px;
}
.field + .field, .field-row + .field, .field + .field-row { margin-top: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field label, .label-static {
  display: block; font-size: 12.5px; font-weight: 620;
  color: var(--ink-2); margin-bottom: 6px;
}
.lbl-note {
  font-weight: 500; font-size: 11px; color: var(--ink-4);
  margin-left: 4px; letter-spacing: 0;
}

.input-wrap {
  position: relative; display: flex; align-items: center;
  background: var(--plane);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
}
.input-wrap:focus-within {
  background: var(--surface);
  border-color: var(--accent-yellow-deep);
  box-shadow: 0 0 0 3px rgba(255,184,0,.2);
}
.input-wrap input, .input-wrap select {
  flex: 1 1 auto; min-width: 0;
  height: 42px; padding: 0 12px;
  background: none; border: 0; outline: none;
  font-size: 15px; font-weight: 600; letter-spacing: -.015em;
  font-variant-numeric: tabular-nums;
}
.input-wrap.money input { text-align: right; padding-right: 6px; }
.input-wrap select {
  appearance: none; -webkit-appearance: none;
  padding-right: 34px; cursor: pointer;
  font-weight: 600;
}
.input-wrap:has(select)::after {
  content: ""; position: absolute; right: 13px; top: 50%;
  width: 8px; height: 8px; margin-top: -5px;
  border-right: 1.8px solid var(--ink-3); border-bottom: 1.8px solid var(--ink-3);
  transform: rotate(45deg); pointer-events: none;
}
.input-wrap input::-webkit-outer-spin-button,
.input-wrap input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input-wrap input[type=number] { -moz-appearance: textfield; }
.unit {
  padding: 0 13px 0 4px; font-size: 12.5px; font-weight: 600;
  color: var(--ink-3); flex: none;
}
.field-help { margin-top: 5px; font-size: 11.5px; color: var(--ink-3); line-height: 1.45; }
/* 오류는 동작이 일어난 자리에 적는다 — 토스트는 사라지고 어느 칸인지 남지 않는다.
   색만으로 알리지 않도록 앞에 「!」 표식을 둔다. --critical-ink 는 흰 면·plane 위
   모두 AA 다. */
.field-error {
  margin-top: 5px; font-size: 11.5px; line-height: 1.45; font-weight: 600;
  color: var(--critical-ink);
}
.field-error::before { content: "! "; font-weight: 700; }
.input-wrap:has([aria-invalid="true"]) { border-color: var(--critical); }
.money-echo { color: var(--ink-2); font-weight: 600; }
.money-echo:empty { display: none; }

/* segmented control */
.segmented {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px;
  padding: 3px; background: var(--plane-sunk);
  border-radius: 10px;
}
.segmented button {
  height: 36px; border-radius: 8px;
  font-size: 13px; font-weight: 620; color: var(--ink-2);
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.segmented button:hover { color: var(--ink-1); }
.segmented button[aria-checked="true"] {
  background: var(--surface); color: var(--ink-1);
  box-shadow: 0 1px 2px rgba(27,25,21,.09), 0 3px 8px -4px rgba(27,25,21,.2);
}

/* switches */
.switch-list { margin-top: 16px; display: flex; flex-direction: column; gap: 2px; }
.switch {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 12px; margin: 0 -10px 0 -12px;
  border-radius: 10px; cursor: pointer;
  transition: background .14s ease;
}
.switch:hover { background: var(--plane); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-copy { flex: 1 1 auto; min-width: 0; }
.switch-title { display: block; font-size: 13.5px; font-weight: 620; color: var(--ink-1); }
.switch-desc  { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.switch-track {
  flex: none; position: relative;
  width: 42px; height: 24px; border-radius: 999px;
  background: var(--line-strong);
  transition: background .18s cubic-bezier(.2,.7,.3,1);
}
.switch-thumb {
  position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(27,25,21,.32);
  transition: transform .2s cubic-bezier(.2,.7,.3,1);
}
.switch input:checked + .switch-track { background: var(--accent-yellow); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2.5px solid var(--ink-1); outline-offset: 2px; }

.form-foot { padding: 18px clamp(18px, 2vw, 24px) 22px; }
.form-note { margin-top: 11px; font-size: 11.5px; color: var(--ink-3); text-align: center; line-height: 1.5; }

/* ============================================================
   ONBOARDING / HERO
   ============================================================ */
#onboarding { display: flex; flex-direction: column; gap: clamp(16px, 1.6vw, 22px); }
.hero {
  position: relative; overflow: hidden;
  background: var(--ink-1); color: #fff;
  border-radius: var(--r-lg);
  padding: clamp(30px, 4vw, 52px) clamp(24px, 3.4vw, 48px);
  box-shadow: var(--shadow-2);
}
/* soft glow — sized so the gradient reaches zero alpha before the box edge,
   otherwise the element clips it into a visible hard disc */
.hero::before {
  content: ""; position: absolute; right: -190px; top: -330px;
  width: 820px; height: 820px;
  background: radial-gradient(circle closest-side,
    rgba(255,184,0,.26), rgba(255,184,0,.09) 46%, rgba(255,184,0,0) 74%);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .17em; text-transform: uppercase;
  color: var(--accent-yellow); margin-bottom: 16px;
}
.hero-title {
  font-size: clamp(28px, 3.7vw, 46px); font-weight: 780;
  letter-spacing: -.045em; line-height: 1.22;
}
.hero-title em {
  font-style: normal;
  background: linear-gradient(180deg, transparent 62%, rgba(255,184,0,.42) 62%);
  padding: 0 2px;
}
.hero-body {
  margin-top: 18px; max-width: 60ch;
  font-size: clamp(14px, 1.05vw, 15.5px); line-height: 1.72;
  color: rgba(255,255,255,.76);
}
.hero-body strong { color: #fff; }
.hero-metrics {
  margin-top: clamp(24px, 3vw, 36px);
  display: flex; flex-wrap: wrap; gap: clamp(20px, 3.5vw, 54px);
  padding-top: 22px; border-top: 1px solid rgba(255,255,255,.13);
}
.hero-metrics > div { display: flex; flex-direction: column; gap: 3px; }
.hm-num { font-size: clamp(24px, 2.4vw, 32px); font-weight: 750; letter-spacing: -.04em; line-height: 1; }
.hm-lbl { font-size: 11.5px; color: rgba(255,255,255,.6); font-weight: 500; letter-spacing: 0; }

.engine-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(188px, 1fr)); gap: 12px; }
.engine-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 20px 18px 18px;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.engine-card:hover {
  border-color: var(--accent-yellow); transform: translateY(-2px);
  box-shadow: var(--shadow-1);
}
.engine-no {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 22px; padding: 0 8px; border-radius: 6px;
  background: var(--accent-yellow-tint); color: #8A6200;
  font-size: 11px; font-weight: 750; letter-spacing: .06em; margin-bottom: 11px;
}
.engine-card h3 { font-size: 15px; font-weight: 700; letter-spacing: -.025em; }
.engine-card p { margin-top: 6px; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); }

/* ============================================================
   SKELETON
   ============================================================ */
#skeleton { display: flex; flex-direction: column; gap: 18px; }
.sk {
  border-radius: var(--r-lg);
  background: linear-gradient(100deg, var(--plane-sunk) 20%, #F8F6F1 42%, var(--plane-sunk) 64%);
  background-size: 260% 100%;
  animation: shimmer 1.4s linear infinite;
}
.sk-hero { height: 300px; }
.sk-wide { height: 220px; }
.sk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.sk-card { height: 190px; }
@keyframes shimmer { from { background-position: 140% 0; } to { background-position: -60% 0; } }

/* ============================================================
   DASHBOARD
   ============================================================ */
#dashboard { display: flex; flex-direction: column; gap: clamp(16px, 1.6vw, 22px); }

.reveal { animation: rise .46s cubic-bezier(.2,.7,.25,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ── chips ─────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 11px; height: 26px; border-radius: 999px;
  font-size: 12px; font-weight: 680; letter-spacing: -.01em;
  border: 1px solid transparent; white-space: nowrap;
}
.chip-lg { height: 32px; padding: 0 15px; font-size: 13px; }
.chip-sm { height: 24px; padding: 0 10px; font-size: 11.5px; }
.chip svg { flex: none; }
.chip-good     { background: var(--good-bg);     color: var(--good-ink);     border-color: rgba(12,163,12,.24); }
.chip-caution  { background: var(--caution-bg);  color: var(--caution-ink);  border-color: rgba(236,131,90,.34); }
.chip-critical { background: var(--critical-bg); color: var(--critical-ink); border-color: rgba(208,59,59,.26); }
.chip-neutral  { background: var(--plane-sunk);  color: var(--ink-2);        border-color: var(--line); }
.chip-brand    { background: var(--accent-yellow-tint); color: #7A5700;          border-color: rgba(217,156,0,.35); }

/* ── verdict card ──────────────────────────────────────── */
.verdict-body {
  /* 오른쪽 칸이 고정폭 게이지에서 유동폭 막대 목록으로 바뀌었다 (F-1).
     `auto` 로 두면 막대가 내용폭까지 줄어들어 서로 비교가 안 된다. */
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(18px, 3vw, 40px); align-items: start;
}
.fig-label { font-size: 12.5px; font-weight: 620; color: var(--ink-2); }
.fig-hero {
  font-size: clamp(40px, 5.4vw, 62px); font-weight: 780;
  letter-spacing: -.05em; line-height: 1.02; margin-top: 4px;
}
.fig-hero .cur { font-size: .48em; font-weight: 700; color: var(--ink-3); letter-spacing: -.02em; margin-left: 4px; }
.fig-sub { margin-top: 9px; font-size: 13px; color: var(--ink-2); }
.fig-stats {
  margin-top: 20px; display: flex; flex-wrap: wrap; gap: 10px;
}
.fig-stats > div {
  flex: 1 1 118px; padding: 11px 13px;
  background: var(--plane); border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
}
.fig-stats dt { font-size: 11px; font-weight: 600; color: var(--ink-3); }
.fig-stats dd { margin: 3px 0 0; font-size: 16px; font-weight: 700; letter-spacing: -.03em; }

/* ── 슈바베지수 — 시나리오별 실측 (SPEC 5.2.1 F-1) ─────────
   반원 게이지를 대체한다. 값이 여러 개이고 상한이 없으므로 척도를 데이터에서 잡고
   시나리오마다 한 줄을 그린다. 자세한 근거는 app.js 의 schwabeChartHTML 주석. */
.verdict-schwabe { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.verdict-schwabe figcaption { font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }
.verdict-schwabe figcaption b { color: var(--ink-2); }
.verdict-schwabe figcaption b:first-child {
  display: block; font-size: 12.5px; color: var(--ink-1); margin-bottom: 4px;
}
.schwabe-rows { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.schwabe-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, 1.4fr) auto;
  gap: 10px; align-items: center;
}
/* 클램프 2줄은 1440px 의 이름 칸에서만 성립했다. 1100~1280px(노트북)과
   721~820px 에서 「월세 — 지역 표준 보증금 + 청년전용 보증부월세대출」이
   중간에 잘렸다 (측정: scrollHeight 49 / clientHeight 32). 가장 긴 라벨이
   요구하는 3줄로 맞춘다 — 720px 이하에서 이미 쓰던 값과 같다. */
.schwabe-name {
  font-size: 12px; color: var(--ink-2); min-width: 0;
  line-height: 1.35; overflow: hidden; white-space: normal;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
}
.schwabe-bar { min-width: 0; }
.schwabe-val { font-size: 13px; font-weight: 700; letter-spacing: -.02em; text-align: right; }
.schwabe-na { font-size: 11.5px; color: var(--ink-4); }
.schwabe-axis {
  position: relative; height: 42px; margin-top: 2px;
  border-top: 1px solid var(--line-soft);
}
.schwabe-axis > span {
  position: absolute; top: 4px; transform: translateX(-50%);
  font-size: 10.5px; color: var(--ink-4); white-space: nowrap;
}
.schwabe-axis > span:first-child { transform: none; }
.schwabe-axis .schwabe-axis-end { transform: translateX(-100%); }
.schwabe-mark { top: -7px !important; }
.schwabe-mark i {
  display: block; width: 1px; height: 12px; margin: 0 auto;
  background: var(--axis);
}
.schwabe-mark b { display: block; font-size: 10px; font-weight: 650; color: var(--ink-3); }
.schwabe-mark-rec b { color: var(--good-ink); }
.schwabe-mark-max b { color: var(--caution-ink); transform: translateY(12px); }
.schwabe-note, .schwabe-empty {
  font-size: 11.5px; color: var(--ink-3); line-height: 1.6;
}
.schwabe-empty { padding: 12px 14px; background: var(--plane); border-radius: var(--r-md); }

@media (max-width: 720px) {
  .verdict-body { grid-template-columns: 1fr; }
}

/* ── allocation bar ────────────────────────────────────── */
.alloc {
  margin-top: 26px; padding-top: 22px;
  border-top: 1px solid var(--line-soft);
}
.alloc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.alloc-head h3 { font-size: 14px; font-weight: 700; letter-spacing: -.02em; }
.alloc-total { font-size: 12.5px; font-weight: 620; color: var(--ink-2); }

.legend-list {
  display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 13px;
}
.legend-list li { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-val { font-weight: 680; color: var(--ink-1); font-variant-numeric: tabular-nums; }

/* ── rationale ─────────────────────────────────────────── */
.rationale {
  margin-top: 22px; padding: 16px 18px;
  background: var(--accent-yellow-wash);
  border: 1px solid rgba(217,156,0,.22);
  border-radius: var(--r-md);
  display: flex; flex-direction: column; gap: 8px;
}
.rationale li {
  position: relative; padding-left: 20px;
  font-size: 13px; line-height: 1.62; color: #4A3D1B;
}
.rationale li::before {
  content: ""; position: absolute; left: 4px; top: .62em;
  width: 7px; height: 7px; border-radius: 2px;
  background: var(--accent-yellow); transform: rotate(45deg);
}

/* ── TCO compare ───────────────────────────────────────── */
.tco-compare {
  padding: 18px; background: var(--plane);
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
}
.tco-compare-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.tco-compare-head h3 { font-size: 14px; font-weight: 700; letter-spacing: -.02em; }
.hint { font-size: 11.5px; color: var(--ink-4); }

.tco-rows { display: flex; flex-direction: column; gap: 14px; }
/* flex-start, not baseline: a two-line clamped name reports its *last* line's
   baseline, which dropped the total figure to the bottom of the row. */
.tco-row-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 6px;
}
/* Scenario labels run long ("월세 — 지역 표준 보증금 + 중소기업취업청년
   전월세보증금대출"). A single nowrap line clipped them mid-word at 390px, so
   they wrap to at most two lines and only then ellipsize. */
.tco-row-name {
  font-size: 12.5px; font-weight: 620; color: var(--ink-1);
  line-height: 1.4; min-width: 0;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden;
}
.tco-row-val {
  font-size: 13px; font-weight: 720; letter-spacing: -.025em; line-height: 1.35;
  font-variant-numeric: tabular-nums; flex: none;
}
/* 4-step gridline underlay so bar lengths read against a scale */
.tco-row-bar {
  background-image: repeating-linear-gradient(90deg,
    var(--grid) 0 1px, transparent 1px calc(25% - 1px), var(--grid) calc(25% - 1px) 25%);
  background-position: 0 0;
  border-radius: 4px;
}
/* Ticks are absolutely placed at their true 0/25/50/75/100% positions so they
   line up with the gridlines under the bars. `space-between` only aligned the
   two end labels — the interior ones drifted by half their own width. */
.tco-axis {
  position: relative; height: 15px;
  margin-top: 9px; padding-top: 7px;
  border-top: 1px solid var(--line-soft);
  font-size: 10.5px; color: var(--ink-4); font-variant-numeric: tabular-nums;
}
.tco-axis span { position: absolute; top: 7px; transform: translateX(-50%); white-space: nowrap; }
.tco-axis span:first-child { transform: none; }
.tco-axis span:last-child  { transform: translateX(-100%); }

/* ── scenario cards ────────────────────────────────────── */
/* two up, so a 4th scenario completes a 2×2 block instead of stranding a row */
.scenario-grid {
  margin-top: 18px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 760px) { .scenario-grid { grid-template-columns: 1fr; } }

/* These cards are compared left-to-right, so every band — the headline 월 환산
   figure, the terms, the cost bar, the NPV footer — has to sit on one line
   across the row. Subgrid lets each card share the grid's row tracks, which
   aligns them by their real content height instead of reserving a fixed two
   lines for the title (that left a dead gap under short titles). */
@supports (grid-template-rows: subgrid) {
  @media (min-width: 761px) {
    .scenario { display: grid; grid-row: span 6; grid-template-rows: subgrid; gap: 13px; }
  }
}
.scenario {
  position: relative;
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 18px 16px 16px; background: var(--surface);
  display: flex; flex-direction: column; gap: 13px;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.scenario:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); transform: translateY(-2px); }
.scenario.is-best { border-color: var(--accent-yellow); box-shadow: 0 0 0 3px rgba(255,184,0,.16); }
.sc-flag {
  position: absolute; top: -10px; left: 14px;
  height: 21px; padding: 0 9px; border-radius: 999px;
  background: var(--accent-yellow); color: #4A3600;
  font-size: 10.5px; font-weight: 750; letter-spacing: .02em;
  display: inline-flex; align-items: center;
}
.sc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sc-name {
  font-size: 14.5px; font-weight: 700; letter-spacing: -.025em; line-height: 1.35;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.sc-type { margin-top: 4px; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.sc-cost-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.sc-cost { font-size: 26px; font-weight: 760; letter-spacing: -.04em; line-height: 1; }
.sc-cost small { font-size: 12px; font-weight: 600; color: var(--ink-3); letter-spacing: -.01em; margin-left: 3px; }
.sc-terms {
  display: flex; flex-wrap: wrap; gap: 5px 8px;
  font-size: 11.5px; color: var(--ink-2);
}
.sc-terms span {
  background: var(--plane); border: 1px solid var(--line-soft);
  border-radius: 6px; padding: 2px 7px; font-variant-numeric: tabular-nums;
}
.sc-bar-label { display: flex; align-items: baseline; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); }
.sc-tco { font-weight: 700; color: var(--ink-1); }
.sc-rationale { display: flex; flex-direction: column; gap: 5px; margin-top: 2px; }
.sc-rationale li {
  position: relative; padding-left: 13px;
  font-size: 12px; line-height: 1.55; color: var(--ink-2);
}
.sc-rationale li::before {
  content: ""; position: absolute; left: 0; top: .6em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--ink-4);
}
.sc-foot { margin-top: auto; padding-top: 11px; border-top: 1px dashed var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fit { display: flex; align-items: center; gap: 8px; }
.fit-label { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.fit-num { font-size: 13px; font-weight: 750; letter-spacing: -.02em; }

/* ── policies ──────────────────────────────────────────── */
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  height: 30px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.pill:hover { border-color: var(--line-strong); background: var(--plane); color: var(--ink-1); }
.pill.is-on { background: var(--ink-1); border-color: var(--ink-1); color: #fff; }

.policy-list { display: flex; flex-direction: column; gap: 9px; }
.policy {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px 18px; background: var(--surface);
  display: grid; grid-template-columns: 4px minmax(0,1fr) auto;
  gap: 0 16px; align-items: start;
  transition: border-color .16s ease, background .16s ease;
}
.policy:hover { border-color: var(--line-strong); background: #FDFCFA; }
.policy::before {
  content: ""; grid-row: 1 / -1; align-self: stretch;
  border-radius: 3px; background: var(--line-strong);
}
.policy[data-status="eligible"]::before    { background: var(--good); }
.policy[data-status="conditional"]::before { background: var(--caution); }
.policy[data-status="ineligible"]::before  { background: var(--line-strong); }
/* 후퇴는 **면**으로 한다. 여기 있던 `opacity: .72` 는 카드 전체를 배경 쪽으로
   합성해 :root 가 보장한다고 적어 둔 ink 램프의 AA 를 깼다 — 측정값 3.62:1
   (#817d77 on #f3f1ec, axe serious, 31개 노드). 글자 휘도를 건드리지 않고
   면만 낮추면 같은 위계를 유지하면서 7.3:1 / 4.9:1 로 돌아온다. */
.policy[data-status="ineligible"] { background: var(--plane); }
.policy-main { min-width: 0; }
.policy-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.policy-name { font-size: 14.5px; font-weight: 700; letter-spacing: -.025em; }
.policy-cat {
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  color: var(--ink-3); background: var(--plane-sunk);
  border-radius: 5px; padding: 2px 7px;
}
.policy-reasons { margin-top: 9px; display: flex; flex-direction: column; gap: 4px; }
.policy-reasons li {
  position: relative; padding-left: 17px;
  font-size: 12.5px; line-height: 1.55; color: var(--ink-2);
}
.policy-reasons li::before {
  content: ""; position: absolute; left: 2px; top: .42em;
  width: 9px; height: 5px; border-left: 1.7px solid var(--ink-4);
  border-bottom: 1.7px solid var(--ink-4); transform: rotate(-45deg);
}
.policy[data-status="eligible"] .policy-reasons li:not([data-met="false"])::before { border-color: var(--good); }
.policy[data-status="conditional"] .policy-reasons li:not([data-met="false"])::before { border-color: var(--caution); }
/* 미충족 사유 — 이 줄들이 판정을 결정했다. 넷을 **함께** 가른다.
     표식  체크(꺾은선) -> 가위표. 색각 이상에서도 모양만으로 갈린다.
     색    --critical (표식) · --critical-ink (본문). --surface 대비 7.96:1 (계산값).
     굵기  600 — 저대비·소형 화면에서 색이 죽어도 남는 신호.
     문구  본문이 이미 "…미충족" 이고, 낭독용 접두어가 그것을 문장 앞으로 올린다.
   색 하나만 바꾸면 「왜 떨어졌는지 항상 보여 준다」가 색각·저대비 환경에서 성립하지
   않는다. 위 두 줄에 `:not()` 을 건 것은 적격·조건부 카드의 색 규칙(특이도 0,3,2)이
   아래 규칙(0,2,2)을 이기기 때문이다 — 오늘은 미충족이 부적격 카드에만 나오지만,
   그 사실에 표시를 의존시키지 않는다. */
.policy-reasons li[data-met="false"] { color: var(--critical-ink); font-weight: 600; }
.policy-reasons li[data-met="false"]::before,
.policy-reasons li[data-met="false"]::after {
  content: ""; position: absolute; left: 1px; top: .62em;
  width: 10px; height: 0; border-left: 0;
  border-bottom: 1.7px solid var(--critical); transform: rotate(45deg);
}
.policy-reasons li[data-met="false"]::after { transform: rotate(-45deg); }
.policy-src { margin-top: 9px; font-size: 11px; color: var(--ink-4); line-height: 1.5; }
.policy-src b { font-weight: 650; color: var(--ink-3); }
.policy-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.policy-num { font-size: 15px; font-weight: 720; letter-spacing: -.03em; white-space: nowrap; }
.policy-num small { display: block; font-size: 10.5px; font-weight: 600; color: var(--ink-3); letter-spacing: 0; margin-bottom: 1px; }

@media (max-width: 640px) {
  .policy { grid-template-columns: 4px minmax(0,1fr); }
  .policy-side { grid-column: 2; text-align: left; align-items: flex-start; margin-top: 10px; }
}

/* ── risk ──────────────────────────────────────────────── */
/* meter as a full-width strip, factors in a grid below — no dead column */
.risk-meter {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 10px clamp(18px, 2.4vw, 32px);
  padding: 16px clamp(16px, 2vw, 22px);
  background: var(--plane); border: 1px solid var(--line-soft);
  border-radius: var(--r-md); margin-bottom: 14px;
}
.risk-meter > div:first-child { flex: 1 1 240px; max-width: 340px; min-width: 220px; }
.risk-score { font-size: 40px; font-weight: 780; letter-spacing: -.05em; line-height: 1; flex: none; }
.risk-score-unit { font-size: 15px; font-weight: 600; color: var(--ink-3); margin-left: 4px; letter-spacing: -.02em; }
.risk-scope {
  flex: 1 1 200px; font-size: 12px; color: var(--ink-3); line-height: 1.55;
  padding-left: clamp(14px, 1.6vw, 22px); border-left: 1px solid var(--line);
}

/* minmax 의 하한은 컨테이너가 그보다 좁아도 줄지 않는다. 측정: 320px 뷰포트에서
   li.factor 가 290px 트랙을 붙들어 문서 폭이 327px 이 됐다(가로 스크롤 발생, 유일한
   원인). `min(290px, 100%)` 는 290px 이상에서는 지금과 같고 그 아래에서만 접힌다. */
.factor-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr)); gap: 8px; }
.risk-foot { margin-top: 14px; font-size: 11.5px; color: var(--ink-4); line-height: 1.55; }
.factor {
  display: grid; grid-template-columns: minmax(0,1fr) auto;
  gap: 4px 12px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--r-md); background: var(--plane);
}
.factor-name { font-size: 13.5px; font-weight: 650; letter-spacing: -.02em; }
.factor-note { grid-column: 1 / -1; font-size: 12px; color: var(--ink-2); line-height: 1.55; }
.factor-val { font-size: 14px; font-weight: 720; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ── summary ───────────────────────────────────────────── */
.card-summary {
  position: relative;
  background: linear-gradient(158deg, #211E19 0%, #14120F 100%);
  color: #fff; border-color: #14120F;
  padding: clamp(24px, 2.6vw, 34px) clamp(24px, 3vw, 40px);
}
.summary-mark {
  position: absolute; top: 6px; left: 18px;
  font-size: 78px; line-height: 1; color: var(--accent-yellow);
  opacity: .28; font-family: Georgia, "Times New Roman", serif;
}
.card-summary p:first-of-type {
  position: relative; font-size: clamp(15px, 1.35vw, 18px);
  font-weight: 550; line-height: 1.75; letter-spacing: -.02em;
  color: rgba(255,255,255,.94); max-width: 74ch;
}
.summary-meta { margin-top: 16px; font-size: 11.5px; color: rgba(255,255,255,.48); letter-spacing: 0; }

/* ============================================================
   CHAT
   ============================================================ */
.card-chat { display: flex; flex-direction: column; }
.chat-log {
  display: flex; flex-direction: column; gap: 12px;
  max-height: 440px; overflow-y: auto;
  padding: 4px 2px 4px 0;
  scrollbar-width: thin;
}
.msg { display: flex; gap: 10px; max-width: 88%; }
.msg-user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 750; letter-spacing: -.02em;
}
.msg-bot .msg-avatar { background: var(--ink-1); color: var(--accent-yellow); }
.msg-user .msg-avatar { background: var(--accent-yellow-tint); color: #7A5700; }
.msg-bubble {
  padding: 12px 15px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.68; letter-spacing: -.012em;
  white-space: pre-wrap; word-break: break-word;
}
.msg-bot .msg-bubble {
  background: var(--plane); border: 1px solid var(--line-soft);
  border-top-left-radius: 4px; color: var(--ink-1);
}
.msg-user .msg-bubble {
  background: var(--ink-1); color: #fff; border-top-right-radius: 4px;
}
.msg-tools { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.tool-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 650; letter-spacing: .01em;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-2); border-radius: 6px; padding: 3px 8px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}
.tool-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--s1); }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4);
  animation: blink 1.1s ease-in-out infinite;
}
.typing i:nth-child(2) { animation-delay: .16s; }
.typing i:nth-child(3) { animation-delay: .32s; }
@keyframes blink { 0%,60%,100% { opacity: .28; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.chat-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 12px; }
.chat-input { display: flex; gap: 9px; }
.chat-input input {
  flex: 1 1 auto; min-width: 0; height: 46px; padding: 0 16px;
  background: var(--plane); border: 1px solid var(--line);
  border-radius: 12px; outline: none; font-size: 14px;
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
}
.chat-input input:focus {
  background: var(--surface); border-color: var(--accent-yellow-deep);
  box-shadow: 0 0 0 3px rgba(255,184,0,.2);
}
.chat-input input::placeholder { color: var(--ink-4); }
.btn-send { width: 46px; height: 46px; padding: 0; border-radius: 12px; flex: none; }

/* ============================================================
   CHART PRIMITIVES
   ============================================================ */
.viz { width: 100%; height: auto; display: block; overflow: visible; }
/* Fixed-size glyph charts opt out of the fluid .viz sizing. Sharing `.viz`
   stretched the 40px fit ring to its flex container's width, so the ring
   rendered as an oversized, off-centre arc inside every scenario card. */
.fit-ring { display: block; flex: none; width: 40px; height: 40px; }
.viz text { font-family: var(--font); }
.viz .axis-line { stroke: var(--axis); stroke-width: 1; }
.viz .grid-line { stroke: var(--grid); stroke-width: 1; }
.viz .tick { font-size: 11px; fill: var(--ink-3); }
/* knockout halo so a zone label stays legible if the gauge marker reaches it */
.viz .tick-boundary { paint-order: stroke fill; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.viz .bar-label { font-size: 11.5px; fill: var(--ink-2); font-weight: 600; }
.viz .bar-value { font-size: 12px; fill: var(--ink-1); font-weight: 700; }
.viz .seg { transition: opacity .14s ease; }
.viz:hover .seg { opacity: .5; }
.viz .seg:hover { opacity: 1; }
.viz .gauge-num { font-weight: 780; letter-spacing: -.04em; fill: var(--ink-1); }
.viz .gauge-sub { font-size: 11px; fill: var(--ink-3); font-weight: 600; }

.viz-tip {
  position: fixed; z-index: 120; pointer-events: none;
  background: var(--ink-1); color: #fff;
  padding: 8px 11px; border-radius: 9px;
  font-size: 12px; line-height: 1.45; font-weight: 550;
  box-shadow: 0 8px 24px -8px rgba(27,25,21,.5);
  max-width: 260px; letter-spacing: -.01em;
  transform: translate(-50%, -100%);
}
.viz-tip b { font-weight: 700; font-variant-numeric: tabular-nums; }
.viz-tip .tip-key { color: rgba(255,255,255,.62); font-weight: 500; }

/* ============================================================
   FOOTER · TOAST
   ============================================================ */
.site-foot { border-top: 1px solid var(--line); background: var(--plane-sunk); }
.foot-inner {
  max-width: var(--shell); margin: 0 auto;
  padding: 28px clamp(16px, 3vw, 34px) 40px;
}
.foot-disc {
  font-size: 12px; line-height: 1.7; color: var(--ink-2);
  max-width: 92ch; padding-left: 14px;
  border-left: 1px solid var(--line-strong);
}
.foot-disc strong { color: var(--ink-1); }
.foot-meta { margin-top: 14px; font-size: 11.5px; color: var(--ink-4); }
.foot-sep { margin: 0 6px; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 150; max-width: min(92vw, 460px);
  background: var(--ink-1); color: #fff;
  padding: 13px 18px; border-radius: 12px;
  font-size: 13px; line-height: 1.55; font-weight: 550;
  box-shadow: 0 16px 40px -12px rgba(27,25,21,.55);
  animation: rise .3s cubic-bezier(.2,.7,.25,1) both;
}
.toast b { color: var(--accent-yellow); font-weight: 700; }

/* ============================================================
   이상 신고 (SPEC 6.4 · 7.1)
   상담원에게만 보이는 확장이다. 익명 화면에서는 스크립트가 이 자리를 비워 두므로
   여기 규칙들은 아무것도 그리지 않는다.
   ============================================================ */
.report-slot:empty { display: none; }
.report-slot { margin: 8px 0 0; }
.report-btn { margin-top: 10px; }

.report-modal {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: rgba(27,25,21,.45);
  padding: 20px;
}
.report-modal[hidden] { display: none; }

.report-panel {
  width: min(100%, 520px); max-height: 90vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 22px;
  box-shadow: 0 24px 60px -18px rgba(27,25,21,.5);
}
.report-title { margin: 0 0 4px; font-size: 17px; font-weight: 700; color: var(--ink-1); }
.report-target { margin: 0 0 16px; font-size: 13px; color: var(--ink-3); }
.report-label {
  display: block; margin: 14px 0 6px;
  font-size: 12px; font-weight: 650; color: var(--ink-2);
}
.report-select, .report-reason {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink-1);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 9px 11px;
}
.report-reason { resize: vertical; }

/* 색만으로 나르지 않는다 — 이 문단은 문구 자체가 경고다 (styles.css 머리말의 규약). */
.report-privacy {
  margin: 14px 0 0; padding: 11px 13px;
  background: var(--caution-bg); border-left: 3px solid var(--caution);
  border-radius: 8px; font-size: 12.5px; line-height: 1.6; color: var(--caution-ink);
}
.report-actions {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px;
}
.report-note { margin: 10px 0 0; font-size: 12.5px; color: var(--critical-ink); }
.report-note:empty { display: none; }

/* ============================================================
   MOTION PREFERENCE
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   세션 · 로컬 경로 배너 · 데이터 등급 · 내부 정보 (6단계)
   ============================================================ */

/* ── 직원 로그인 (SPEC 6.1 · D-9) ────────────────────────── */
.session { display: flex; align-items: center; gap: 6px; }
.session-form { display: flex; align-items: center; gap: 5px; }
.session-form input {
  height: 30px; width: 116px; padding: 0 9px;
  font: inherit; font-size: 12px;
  background: var(--surface); color: var(--ink-1);
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
.session-form input:focus-visible { outline: 2px solid var(--accent-yellow-deep); outline-offset: 1px; }
.session-who { font-size: 12px; font-weight: 650; color: var(--ink-1); }
.session-role {
  margin-left: 4px; padding: 1px 6px; border-radius: 999px;
  background: var(--accent-yellow-tint); color: #6B4E00; font-size: 10.5px; font-weight: 700;
}
.btn-xs { height: 30px; padding: 0 11px; font-size: 12px; }
/* ≤620px 전용 토글. 그 위에서는 칸이 바에 그대로 있으므로 열 것이 없다. */
.session-toggle { display: none; }

@media (max-width: 860px) {
  .session-form input { width: 88px; }
}
/* 상단바 접힘 2단(≤810px)에서도 621~653px 대역은 브랜드가 4px 모자랐다.
   여기서 더 줄일 수 있는 것은 로그인 칸뿐이다 — 자리표시자만 짧아지고
   입력은 그대로 된다. */
@media (max-width: 810px) {
  .session-form input { width: 76px; }
}
/* 620px 아래로는 76px 칸 둘을 더 줄일 수 없고, 그대로 두면 부족분을
   `.brand`(min-width:0) 가 먹어 제품 이름이 지워진다. 그렇다고 칸을 `display: none`
   으로 지우면 **휴대폰에서 상담원이 로그인할 수 없다** — 상담원 확장(F7)은
   이 상단바가 유일한 입구다. 그래서 **자리만 비우고 칸은 남긴다** — 폼을
   상단바 아래 디스클로저로 내리고, 바에는 같은 라벨의 토글 하나만 세운다.
   토글은 지우기 전 제출 버튼과 같은 클래스·같은 라벨이므로 이 대역의 상단바
   폭 계산은 변하지 않는다 (측정: 320px·390px 가로 스크롤 0 유지).
   패널은 `.topbar`(position: sticky) 에 맞물려 바 아래로 떨어진다. 폭을 `100%`
   기준으로 잡는 것은 `100vw` 가 세로 스크롤바를 포함해 오버랩하기 때문이다. */
@media (max-width: 620px) {
  .session-toggle { display: inline-flex; }
  .session-form {
    position: absolute; top: calc(100% - 6px); right: clamp(16px, 3vw, 34px); z-index: 70;
    flex-direction: column; align-items: stretch; gap: 8px;
    width: min(256px, calc(100% - 32px)); padding: 12px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-md); box-shadow: 0 18px 40px -16px rgba(27,25,21,.45);
  }
  .session-form[data-open="false"] { display: none; }
  .session-form input { width: auto; height: 34px; }
}

/* ── 로컬 판정 경로 상태 배너 (SPEC 6.2 오프라인 정의 #3 · D-11) ──
   침묵 폴백 금지. 로컬로 내려갔거나 로컬조차 불가능하면 화면이 말한다. */
.local-banner {
  padding: 11px clamp(16px, 3vw, 34px);
  font-size: 12.5px; line-height: 1.6;
  border-bottom: 1px solid var(--line);
}
.local-banner[data-kind="local"] { background: var(--accent-yellow-wash); color: #5A4200; }
.local-banner[data-kind="disabled"] { background: var(--critical-bg); color: var(--critical-ink); }
.local-banner code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: .92em; padding: 1px 4px; border-radius: 4px;
  background: rgba(27,25,21,.06);
}
.local-banner .banner-fix { display: inline-block; margin-left: 4px; }

/* ── 데이터 등급 (SPEC 2.4) ──────────────────────────────── */
.grade-note, .grade-foot { font-size: 12.5px; color: var(--ink-2); line-height: 1.65; }
.grade-foot { margin-top: 14px; color: var(--ink-3); font-size: 11.5px; }
.grade-absent {
  padding: 14px 16px; border-radius: var(--r-md);
  background: var(--plane); border: 1px dashed var(--line-strong);
  font-size: 12.5px; color: var(--ink-2); line-height: 1.65;
}
/* 원인 유형의 구분은 **제목의 칩**이 진다 — 이 파일 머리말의 규약 그대로
   「색에는 아이콘과 라벨이 항상 동반한다」. 카드 옆면에 색 띠를 두는 방식은
   색만으로 의미를 나르게 되고, 제목이 이미 유형을 글로 말하고 있어 중복이기도 하다. */
.grade-group {
  margin-top: 14px; padding: 13px 15px;
  background: var(--plane); border: 1px solid var(--line-soft); border-radius: var(--r-md);
}
.grade-group h3 {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 700; color: var(--ink-1);
}
.grade-count {
  padding: 1px 7px; border-radius: 999px;
  background: var(--plane-sunk); color: var(--ink-2); font-size: 11px; font-weight: 650;
}
.grade-owner { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--ink-3); }
.grade-why { margin-top: 4px; font-size: 11.5px; color: var(--ink-3); }
.grade-facts { list-style: none; margin-top: 9px; display: flex; flex-direction: column; gap: 5px; }
.grade-facts li {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto;
  gap: 8px; align-items: baseline;
  padding-top: 5px; border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
}
.grade-facts li:first-child { border-top: 0; padding-top: 0; }
.grade-fact { color: var(--ink-1); min-width: 0; overflow-wrap: anywhere; }
.grade-origin { color: var(--ink-3); min-width: 0; overflow-wrap: anywhere; }
.grade-targets code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 10.5px; padding: 1px 5px; border-radius: 4px;
  background: var(--plane-sunk); color: var(--ink-2);
}
@media (max-width: 720px) {
  .grade-facts li { grid-template-columns: 1fr; gap: 2px; }
  .grade-owner { margin-left: 0; }
}

/* ── 내부 정보 (SPEC 6.1) ────────────────────────────────── */
.card-internal { border-color: var(--line-strong); background: var(--accent-yellow-wash); }
#internalBody h3 {
  margin-top: 18px; font-size: 13px; font-weight: 700; color: var(--ink-1);
}
#internalBody h3:first-child { margin-top: 0; }
.table-scroll { overflow-x: auto; margin-top: 8px; }
.internal-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.internal-table th, .internal-table td {
  padding: 6px 9px; text-align: left; border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.internal-table th { color: var(--ink-3); font-weight: 650; }
.internal-table code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 10.5px;
}
.internal-freshness { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.internal-freshness > div {
  flex: 1 1 130px; padding: 9px 11px;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
}
.internal-freshness dt { font-size: 10.5px; font-weight: 600; color: var(--ink-3); }
.internal-freshness dd { margin-top: 2px; font-size: 12.5px; font-weight: 650; }
.internal-thresholds { list-style: none; margin-top: 8px; display: flex; flex-direction: column; gap: 7px; }
.internal-thresholds li {
  padding: 9px 11px; background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
}
.internal-pid { font-size: 12px; font-weight: 700; margin-right: 7px; }
.internal-crit { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 5px; }
.internal-crit .crit {
  padding: 2px 7px; border-radius: 999px;
  background: var(--plane-sunk); color: var(--ink-2);
  font-size: 10.5px;
}
.internal-crit .crit b { color: var(--ink-1); font-weight: 650; }

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .topbar, .col-form, .card-chat, .chat-suggest, .toast, .skip-link,
  .local-banner, #btnPrint { display: none !important; }
  .app { grid-template-columns: 1fr; padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
  .card-internal { background: #fff; }
}
