:root {
  --bg: #f0ebe3; --card: #ffffff; --line: #e3dccf; --ink: #2b2b2b; --muted: #777067;
  --accent: #7a5c3e; --accent-soft: #efe6d8; --warn: #b4451f; --ok: #3a7d44;
  --radius: 14px; --shadow: 0 1px 3px rgba(0,0,0,.06), 0 6px 18px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased;
}
.topbar { background: var(--accent); color: #fff; padding: 14px 20px; position: sticky; top: 0; z-index: 10; }
.topbar .brand { font-weight: 700; font-size: 15px; }
.topbar .sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.wrap { max-width: 720px; margin: 0 auto; padding: 22px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 16px; }
.cover { border-top: 6px solid var(--accent); }
.cover h1 { margin: 0 0 8px; font-size: 24px; }
.lead { color: var(--muted); margin: 0 0 14px; }
.notice { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.notice li { margin-bottom: 4px; }
.block-title { font-size: 16px; margin: 0 0 6px; }
.block-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

/* 신상정보 폼 */
.id-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 600; color: var(--accent); }
.field input[type=text], .field input[type=tel] {
  border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; font-size: 15px; background: #fcfaf6;
}
.field input:focus { outline: none; border-color: var(--accent); background: #fff; }
.gender-row { display: flex; gap: 8px; }
.gender-row label { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 9px; padding: 10px 16px; cursor: pointer; font-weight: 500; color: var(--ink); background: #fcfaf6; }
.gender-row input { accent-color: var(--accent); }
.gender-row label.checked { border-color: var(--accent); background: var(--accent-soft); }
.consent { display: flex; gap: 9px; align-items: flex-start; margin-top: 14px; font-size: 13.5px; color: var(--muted); background: #fcfaf6; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.consent input { margin-top: 3px; accent-color: var(--accent); }

/* 진행률 */
.progress-wrap { position: sticky; top: 56px; z-index: 9; margin-bottom: 14px; }
.progress-bar { height: 8px; background: var(--accent-soft); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
.progress-text { font-size: 12px; color: var(--muted); margin-top: 5px; text-align: right; }

/* 설문 */
.section-title { font-size: 14px; font-weight: 700; color: var(--accent); letter-spacing: .04em; margin: 26px 4px 8px; }
.section-title::before { content: "▎"; margin-right: 4px; }
.q-card { border: 1px solid var(--line); }
.q-card.answered { border-color: var(--accent); }
.q-title { font-weight: 700; font-size: 16px; padding: 0; }
.q-hint { color: var(--muted); font-size: 13px; margin: 6px 0 12px; }
.opts { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.opt { display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; cursor: pointer; transition: all .12s ease; background: #fcfaf6; }
.opt:hover { border-color: var(--accent); background: #fff; }
.opt.checked { border-color: var(--accent); background: var(--accent-soft); }
.opt input { margin-top: 3px; accent-color: var(--accent); flex: 0 0 auto; }
.opt-label { font-size: 14.5px; }

.actions { display: flex; gap: 10px; margin-top: 20px; }
.btn { font-size: 15px; font-weight: 600; border-radius: 10px; padding: 13px 22px; cursor: pointer; border: 1px solid transparent; text-decoration: none; display: inline-block; text-align: center; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #654a30; }
.btn.primary:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.submit-hint { font-size: 13px; color: var(--muted); margin-top: 10px; }
.submit-hint.warn { color: var(--warn); font-weight: 600; }
.footnote { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }

/* 제출 완료 */
.done { text-align: center; padding: 50px 22px; }
.done .check { font-size: 46px; }
.done h1 { font-size: 24px; margin: 12px 0 8px; }
.done p { color: var(--muted); }

/* ===== 원장 페이지 ===== */
.login-box { max-width: 400px; margin: 60px auto; }
.login-box h1 { font-size: 20px; margin: 0 0 4px; }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; border: 1px solid var(--line); border-radius: 9px; padding: 12px; font-size: 15px; background: #fcfaf6; }
.search-row input:focus { outline: none; border-color: var(--accent); background: #fff; }
.result-list { margin-top: 6px; }
.patient-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; background: #fcfaf6; }
.patient-row:hover { border-color: var(--accent); background: #fff; }
.pr-main { font-weight: 600; }
.pr-sub { font-size: 12.5px; color: var(--muted); }
.pr-tag { font-size: 12px; background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 4px 10px; white-space: nowrap; }
.muted-empty { color: var(--muted); font-size: 14px; padding: 12px 2px; }
.back-link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 14px; padding: 0; margin-bottom: 12px; }

/* 리포트 공통 */
.result-eyebrow { font-size: 12px; letter-spacing: .1em; color: var(--accent); font-weight: 700; }
.result-title { font-size: 30px; margin: 4px 0 6px; }
.result-title .hanja { font-size: 18px; color: var(--muted); font-weight: 500; }
.patient-meta { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.gyeyeol-line { font-size: 16px; margin-bottom: 12px; }
.gyeyeol-line b { color: var(--accent); }
.conf { display: inline-block; font-weight: 700; font-size: 14px; padding: 6px 12px; border-radius: 99px; }
.conf .conf-detail { font-weight: 400; opacity: .85; font-size: 12px; }
.c-vhigh { background: #e3f1e5; color: #2c6e3a; } .c-high { background: #e8f0d9; color: #4e6b1f; }
.c-mid { background: #fbf0d6; color: #8a6a1a; } .c-low { background: #f6dfd5; color: var(--warn); }
.conf-note { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.notes { border-left: 4px solid var(--warn); }
.note-list { margin: 0; padding-left: 18px; } .note-list li { margin-bottom: 8px; font-size: 14px; }
.note-inline { background: var(--accent-soft); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; margin: 8px 0; }

/* 판단 근거 */
.evidence-group { margin-top: 14px; }
.eg-head { font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 8px; margin-bottom: 8px; background: var(--accent-soft); color: var(--accent); }
.eg-head.ok { background: #e3f1e5; color: var(--ok); } .eg-head.no { background: #f6dfd5; color: var(--warn); }
.ev-row { display: grid; grid-template-columns: 72px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.ev-row:last-child { border-bottom: none; }
.ev-sec { font-size: 11px; color: var(--muted); padding-top: 2px; }
.ev-ans { font-size: 14px; } .ev-clue { font-size: 12.5px; color: var(--accent); margin-top: 2px; }
.ev-row.no .ev-clue { color: var(--muted); }
.ev-toward { font-size: 11px; background: #eee; color: #777; border-radius: 5px; padding: 1px 6px; margin-left: 4px; white-space: nowrap; }
.ev-row.no .ev-toward { background: #f6dfd5; color: var(--warn); }

/* 점수 막대 */
.score-row { display: grid; grid-template-columns: 90px 1fr 36px; align-items: center; gap: 10px; margin-bottom: 10px; }
.score-row.top .score-name { color: var(--accent); font-weight: 700; }
.score-name { font-size: 14px; } .score-name .rare { font-size: 10px; background: #eee; color: #999; border-radius: 4px; padding: 1px 5px; }
.score-track { background: var(--accent-soft); height: 14px; border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.score-fill { height: 100%; background: linear-gradient(90deg, #a98b66, var(--accent)); }
.score-row.top .score-fill { background: linear-gradient(90deg, #8a6a45, #5c4226); }
.score-val { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); }

/* 4대 축 */
.axis-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.axis-cell { border: 1px solid var(--line); border-radius: 10px; padding: 12px 6px; text-align: center; }
.axis-label { font-size: 13px; color: var(--muted); margin-bottom: 4px; } .axis-state { font-weight: 700; font-size: 14px; }
.axis-cell.ok { background: #e3f1e5; border-color: #bcd9c1; } .axis-cell.ok .axis-state { color: var(--ok); }
.axis-cell.no { background: #f6dfd5; border-color: #e6c2b2; } .axis-cell.no .axis-state { color: var(--warn); }
.axis-cell.na { opacity: .5; }

/* 계열 */
.gyeyeol-head { font-size: 17px; margin-bottom: 6px; } .gyeyeol-name { font-weight: 700; }
.tag { font-size: 11px; padding: 3px 9px; border-radius: 99px; vertical-align: middle; margin-left: 4px; }
.tag.ok { background: #e3f1e5; color: var(--ok); } .tag.warn { background: #fbf0d6; color: #8a6a1a; }
.rx { background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.rx-label { font-size: 12px; color: var(--accent); font-weight: 700; } .rx-val { font-size: 15px; margin-top: 2px; }
.disclaimer { font-size: 12.5px; color: var(--warn); margin: 6px 0 0; }
.overview { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; margin: 0; }
.overview dt { font-size: 13px; color: var(--accent); font-weight: 700; } .overview dd { font-size: 14px; margin: 0; }

@media (max-width: 480px) {
  .card { padding: 16px; } .cover h1 { font-size: 21px; }
  .id-grid { grid-template-columns: 1fr; } .actions { flex-direction: column; } .btn { width: 100%; }
  .result-title { font-size: 25px; } .axis-grid { grid-template-columns: repeat(2, 1fr); } .overview { grid-template-columns: 100px 1fr; }
}
@media print { .topbar, .actions, .footnote, .back-link, .search-row { display: none; } body { background: #fff; } .card { box-shadow: none; break-inside: avoid; } }
