/* 테마: 한화 컬러 포인트 + 둥근 모서리 + 넉넉한 여백 (토스식)
   색을 바꾸려면 :root 값만 수정하면 됩니다. */
:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --line: #eef0f4;
  --text: #191f28;
  --muted: #6b7684;
  --faint: #a0a8b4;
  --brand: #e24c1c;          /* 한화 포인트 컬러 (조정 가능) */
  --brand-hover: #c93e12;
  --brand-soft: #fdeee8;
  --risk: #d9482b;
  --risk-soft: #fdf0ec;
  --ok: #1f9d6b;
  --radius: 20px;
  --card-radius: 28px;
  --pill: 999px;
  --shadow: 0 2px 8px rgba(25, 31, 40, 0.04), 0 12px 32px rgba(25, 31, 40, 0.06);
}

body { font-size: 15px; letter-spacing: -0.01em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 12px; }

/* ---------- 중앙 대형 워터마크 로고 (투명도 90%) ---------- */
.bg-logo { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 0; }
.bg-logo img { width: min(56vw, 620px); height: auto; opacity: 0.1; }
main, .footer { position: relative; z-index: 1; }

/* ---------- 상단 바 ---------- */
.topbar { background: rgba(255, 255, 255, 0.9); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--line); }
.topbar-inner { min-height: 72px; }
.brand-logo { height: 28px; }
.brand-name { font-weight: 800; letter-spacing: -0.02em; }
.nav-link { padding: 10px 18px; border-radius: var(--pill); font-weight: 600; }
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.active { background: var(--text); color: #fff; }
.header-account { padding: 11px 20px; border-radius: var(--pill); background: var(--brand); border: 0; font-size: 14px; font-weight: 700; }
.header-account:hover { background: var(--brand-hover); filter: none; }
.prototype-badge { border: 0; background: var(--surface); border-radius: var(--pill); padding: 5px 12px; }

/* ---------- 제목과 여백 ---------- */
.page-head { border-bottom: 0; padding: 64px 0 28px; margin-bottom: 16px; align-items: flex-end; }
.page-head h2 { font-size: clamp(1.8rem, 3.6vw, 2.4rem); font-weight: 800; letter-spacing: -0.035em; margin-bottom: 12px; }
.page-head p { font-size: 15px; line-height: 1.75; }
.eyebrow, .mini-label { color: var(--brand); font-weight: 700; }
.note { background: var(--surface); border-radius: var(--pill); padding: 8px 16px; font-weight: 500; }

/* ---------- 버튼 (알약 모양) ---------- */
.btn-primary { padding: 17px 30px; border-radius: var(--pill); background: var(--brand); font-size: 16px; font-weight: 700; letter-spacing: -0.01em; box-shadow: 0 6px 16px rgba(226, 76, 28, 0.22); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:disabled { background: #d5dae1; box-shadow: none; color: #fff; }
.btn-link { font-weight: 600; text-underline-offset: 4px; }

/* ---------- 카드 공통 (큰 둥근 모서리) ---------- */
.search-block, .term-card, .rec-card, .explain-item, .benefit-card, .terms-view, .terms-item, .auth-card, .apply-summary, .apply-form, .profile-card, .faq, .sample-box, .login-prompt, .grade-hero, .dim-row, .fit-disclaimer, .apply-external {
  border: 0;
  border-radius: var(--card-radius);
  background: var(--bg);
  box-shadow: var(--shadow);
}
.search-block, .grade-block, .mypage-body .grade-block, .terms-view, .profile-card, .apply-summary, .apply-form, .auth-card {
  padding: 30px 28px;
}
.mypage-body .grade-block { background: var(--surface); box-shadow: none; border-radius: var(--card-radius); }
.terms-item { background: var(--bg); padding: 20px 22px; }
.terms-item.active { box-shadow: 0 0 0 2px var(--brand) inset; }
.policy-link { border: 0; border-radius: var(--pill); padding: 14px 20px; background: var(--surface); }
.policy-link:hover { background: var(--brand-soft); }
.radio-item { border: 0; border-radius: var(--pill); padding: 12px 20px; background: var(--surface); }
.radio-item:has(input:checked) { background: var(--brand-soft); box-shadow: 0 0 0 2px var(--brand) inset; }

/* ---------- 입력칸 (둥근 모서리) ---------- */
.field span { font-size: 13px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea, #search-query, #terms-search, .search-box input, .chat-form input, #ask-situation {
  border: 0; border-radius: 20px; background: var(--surface); padding: 16px 20px; font-size: 15px;
}
.field input:focus, .field select:focus, .search-box input:focus, #search-query:focus, #terms-search:focus { outline: 2px solid var(--brand); outline-offset: 0; background: var(--bg); }
.search-box.big input { font-size: 17px; padding: 18px 22px; }

/* ---------- 칩·배지 (알약) ---------- */
.chip { border: 0; border-radius: var(--pill); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13px; padding: 7px 14px; }
.kw-row button, .search-chips button, .quick button { border: 0; border-radius: var(--pill); background: var(--surface); font-weight: 600; padding: 9px 16px; }
.kw-row button:hover, .search-chips button:hover { background: var(--brand-soft); color: var(--brand); }
.grade-badge { border-radius: var(--pill); }
.rec-rank { border-radius: 50%; }

/* ---------- 목록 ---------- */
.terms-layout { gap: 28px; }
.terms-item { border-radius: var(--card-radius); }
.terms-item strong { font-size: 16px; letter-spacing: -0.02em; }
.terms-clause { border-bottom: 0; padding: 16px 4px; }
.terms-clause + .terms-clause { border-top: 1px solid var(--line); }
.terms-clause summary { font-size: 15px; }
.terms-notice { border-radius: var(--card-radius); padding: 14px 18px; }

/* ---------- 검색 결과 패널 (번호 붙은 4개 카드) ---------- */
.result-panel { margin-top: 24px; padding: 28px; border-radius: var(--card-radius); background: var(--bg); box-shadow: var(--shadow); }
.panel-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.panel-head h3 { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; margin: 2px 0 4px; }
.panel-head p { font-size: 14px; color: var(--muted); }
.panel-no { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.panel-lead { font-size: 15px; line-height: 1.7; margin-bottom: 14px; }
.panel-sub { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.panel-sub h4 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.result-panel .benefit-card, .result-panel .explain-item, .result-panel .term-card { box-shadow: none; background: var(--surface); }
.flow-steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; counter-reset: step; }
.flow-steps li { counter-increment: step; display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; border-radius: 20px; background: var(--surface); }
.flow-steps li::before { content: counter(step); flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.flow-steps strong { display: block; font-size: 15px; margin-bottom: 2px; }
.flow-steps span { font-size: 14px; color: var(--muted); }
.apply-links li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.apply-links li:last-child { border-bottom: 0; }

/* ---------- 상황별 보험 묶음 ---------- */
.situation-block { margin-top: 16px; padding: 22px; border-radius: 24px; background: var(--surface); }
.situation-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 4px; }
.situation-head h3 { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; margin: 4px 0 2px; }
.situation-head p { font-size: 13px; color: var(--muted); }
.situation-no { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.situation-block .panel-sub { border-top-color: #e3e6eb; }
.situation-block .rec-card, .situation-block .benefit-card, .situation-block .explain-item { background: var(--bg); }

/* ---------- 서비스 흐름 (단계 카드 + 화살표) ---------- */
.flow-grid { gap: 28px; }
.flow-grid > div { position: relative; border: 0; border-radius: var(--card-radius); background: var(--bg); box-shadow: var(--shadow); padding: 26px 22px 24px; }
.flow-grid > div span { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-bottom: 16px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 15px; font-weight: 800; box-shadow: 0 6px 14px rgba(226, 76, 28, 0.25); }
.flow-grid > div strong { font-size: 17px; letter-spacing: -0.02em; }
.flow-grid > div:not(:last-child)::after { content: "›"; position: absolute; top: 50%; right: -21px; transform: translateY(-50%); color: var(--brand); font-size: 26px; font-weight: 800; line-height: 1; }

/* ---------- 모바일 ---------- */
@media (max-width: 800px) {
  .flow-grid > div:not(:last-child)::after { display: none; }
  .flow-grid { gap: 14px; }
  .result-panel { padding: 22px 18px; border-radius: 24px; }
  .page-head { padding: 40px 0 20px; }
  .search-block, .grade-block, .mypage-body .grade-block, .terms-view, .profile-card, .apply-summary, .apply-form, .auth-card { padding: 22px 20px; border-radius: 24px; }
  .bg-logo img { width: 80vw; }
}

/* ---------- Tesla 스타일 재구성 (흑백 팔레트 · 직각 모서리 · 평면 카드 · 대문자 버튼)
   참고: Tesla 브랜드 디자인 시스템 문서 기준 (공식 홈페이지 직접 확인 불가).
   색은 흑백 중심으로 쓰고, 위험 표시만 Tesla 사이렌 빨강을 씁니다. */
:root {
  --brand: #e24c1c;
  --brand-hover: #c93e12;
  --brand-soft: #fdeee8;
  --text: #171a20;
  --muted: #5c5e62;
  --faint: #a0a0a0;
  --surface: #f4f4f4;
  --line: #e5e5e5;
  --risk: #cc0000;
  --risk-soft: #ffe5e5;
  --radius: 2px;
  --card-radius: 2px;
  --pill: 0px;
  --shadow: 0 2px 8px rgba(23, 26, 32, 0.04);
}

body { font-size: 15px; letter-spacing: 0; color: var(--text); }

/* 상단 바: 워드마크 가운데, 메뉴 왼쪽, 계정 버튼 오른쪽 */
.topbar { background: rgba(255, 255, 255, 0.92); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--line); }
.topbar-inner { min-height: 64px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.brand { grid-column: 2; grid-row: 1; justify-self: center; }
.brand-logo { height: 22px; }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: 0.3em; text-transform: uppercase; }
.brand-name small { font-size: 11px; font-weight: 500; letter-spacing: 0.06em; color: var(--muted); }
.main-nav { grid-column: 1; grid-row: 1; justify-self: start; gap: 4px; }
.nav-link { padding: 6px 10px; font-size: 13px; font-weight: 500; color: var(--muted); background: transparent; border-radius: 0; transition: color .35s cubic-bezier(.4, 0, .2, 1); }
.nav-link:hover { background: transparent; color: var(--text); }
.nav-link.active { background: transparent; color: var(--brand); font-weight: 600; box-shadow: inset 0 -2px 0 var(--brand); }
.header-account { grid-column: 3; grid-row: 1; justify-self: end; padding: 10px 18px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; border-radius: 0; background: var(--brand); color: #fff; }
.header-account:hover { background: var(--brand-hover); transform: none; }

/* 버튼: 직각, 대문자, 낮은 대비 호버 */
.btn-primary { padding: 14px 28px; border-radius: 0; background: var(--brand); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; box-shadow: none; transition: filter .35s ease, transform .1s ease; }
.btn-primary:hover { background: var(--brand); filter: contrast(0.86); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { background: #c7c7c7; color: #fff; }
.btn-link { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand); }
.btn-link::after { content: " ›"; }
.btn-link:hover { text-decoration: underline; }

/* 첫 화면 */
.hero { padding: 120px 0 88px; gap: 64px; align-items: center; }
.eyebrow, .mini-label { color: var(--brand); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.hero h1 { font-size: clamp(2rem, 3.6vw, 2.6rem); font-weight: 500; letter-spacing: -0.015em; line-height: 1.15; }
.hero-lede { font-size: 17px; line-height: 1.5; color: var(--muted); margin-top: 8px; }
.hero-actions { gap: 16px; }
.hero .btn-primary { padding: 16px 32px; }
.disclaimer { font-size: 11px; color: var(--faint); }
.example { border: 1px solid var(--line); border-radius: 0; background: #fff; box-shadow: none; }
.example-row { border-radius: 0; }
.example-row.easy { background: var(--surface); border: 0; }
.strip { gap: 0; padding: 0 0 56px; }
.strip > div, .strip > div + div { padding: 28px 24px; border: 1px solid var(--line); border-radius: 0; background: #fff; margin-left: -1px; }
.strip strong { font-size: 17px; font-weight: 600; letter-spacing: 0; }
.strip p { font-size: 13px; color: var(--muted); }

.flow { padding: 88px 0 104px; text-align: left; border-top: 1px solid var(--line); }
.flow h2 { font-size: 32px; font-weight: 500; letter-spacing: -0.01em; margin-bottom: 40px; }
.flow-grid { gap: 0; }
.flow-grid > div { padding: 24px; border: 1px solid var(--line); border-radius: 0; background: #fff; box-shadow: none; margin-left: -1px; transition: background .35s cubic-bezier(.4, 0, .2, 1); }
.flow-grid > div:hover { transform: none; box-shadow: none; background: var(--surface); }
.flow-grid > div span { width: auto; height: auto; margin: 0 0 12px; border-radius: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; box-shadow: none; display: block; }
.flow-grid > div strong { font-size: 17px; font-weight: 600; letter-spacing: 0; }
.flow-grid > div:not(:last-child)::after { content: none; }

/* 페이지 머리말 */
.page-head { padding: 88px 0 32px; }
.page-head h2 { font-size: clamp(1.9rem, 3.4vw, 2.5rem); font-weight: 500; letter-spacing: -0.015em; }
.page-head p { font-size: 15px; color: var(--muted); }
.note { border-radius: 0; background: var(--surface); padding: 6px 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* 입력칸과 카드: 1px 테두리, 직각 */
.field input, .field select, .field textarea, #search-query, #terms-search, .search-box input, .chat-form input, #ask-situation { border: 1px solid #c7c7c7; border-radius: 0; background: #fff; padding: 14px 16px; font-size: 14px; }
.field input:focus, .field select:focus, .search-box input:focus, #search-query:focus, #terms-search:focus { outline: 2px solid var(--text); outline-offset: 0; background: #fff; }
.search-box.big input { font-size: 15px; padding: 16px 18px; }
.chip, .kw-row button, .search-chips button, .quick button { border: 1px solid var(--line); border-radius: 0; background: #fff; font-size: 12px; font-weight: 500; padding: 8px 12px; }
.kw-row button:hover, .search-chips button:hover { background: var(--surface); color: var(--text); }
.search-block, .grade-block, .mypage-body .grade-block, .terms-view, .profile-card, .apply-summary, .apply-form, .auth-card, .rec-card, .benefit-card, .explain-item, .term-card, .terms-item, .login-prompt, .faq, .apply-external, .fit-disclaimer {
  border: 1px solid var(--line); border-radius: 0; background: #fff; box-shadow: none;
}
.mypage-body .grade-block { background: #fff; }
.result-panel { border: 1px solid var(--line); border-radius: 0; background: #fff; box-shadow: none; }
.situation-block, .ai-block { border-radius: 0; background: var(--surface); }
.terms-item.active { box-shadow: inset 2px 0 0 var(--text); }
.policy-link, .radio-item { border-radius: 0; background: #fff; border: 1px solid var(--line); }
.radio-item:has(input:checked), .policy-link:hover { background: var(--surface); box-shadow: inset 0 0 0 1px var(--text); }
.rec-rank { border-radius: 0; background: var(--brand); }

/* 등급·위험 표시 */
.term-card.risk { border-left: 3px solid var(--risk); }
.term-tag.risk-tag { background: var(--risk); color: #fff; border-radius: 0; }

/* 푸터 */
.footer { background: var(--surface); border-top: 0; padding: 48px 0 56px; font-size: 12px; color: var(--muted); }
.footer-inner strong { color: var(--text); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }

@media (max-width: 800px) {
  .topbar-inner { grid-template-columns: 1fr; gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  .brand, .main-nav, .header-account { grid-column: 1; grid-row: auto; justify-self: center; }
  .main-nav { justify-self: stretch; overflow-x: auto; }
  .hero { padding: 64px 0 48px; gap: 36px; }
  .hero h1 { font-size: 1.9rem; }
  .strip > div, .strip > div + div { margin-left: 0; margin-top: -1px; }
  .flow { padding: 64px 0 72px; }
  .flow h2 { font-size: 26px; margin-bottom: 28px; }
  .flow-grid > div { margin-left: 0; margin-top: -1px; }
  .page-head { padding: 56px 0 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
.search-box > span { white-space: nowrap; }

/* ---------- 마이페이지: 사고 이력 목록 · 기존 질환 · 연동 사례 ---------- */
.import-block { background: var(--surface); border: 0; }
.import-block .btn-primary { margin-top: 8px; }
.import-cases { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 14px 0; }
.import-case { border: 1px solid var(--line); background: #fff; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.import-case p { font-size: 14px; }
.import-case .btn-primary { margin-top: auto; align-self: flex-start; padding: 10px 16px; font-size: 11px; }
.history-list { list-style: none; margin: 8px 0 12px; padding: 0; }
.history-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.history-list li span:first-child { flex: 1; }
.history-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.history-add select, .history-add input { padding: 10px 12px; border: 1px solid #c7c7c7; border-radius: 0; font-size: 14px; background: #fff; }
.history-add input { width: 110px; }
.check-group { display: flex; flex-wrap: wrap; gap: 8px; }
.check-group .radio-item input { margin-right: 6px; }
