/* NUMP Virtual Patient — 컬러 스킴은 design_claude.md 기준 (Yonsei 블루, dark 기본/light) */

/* [보존용 주석] 기존 Paperlogy 로컬 폰트 (400/500/700) — Pretendard로 교체(2026-07-20)
@font-face {
  font-family: 'Paperlogy'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/static/fonts/Paperlogy-4Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Paperlogy'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('/static/fonts/Paperlogy-5Medium.ttf') format('truetype');
}
@font-face {
  font-family: 'Paperlogy'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/static/fonts/Paperlogy-7Bold.ttf') format('truetype');
}
*/

/* Pretendard 로컬 폰트 — 실제 사용 두께만 추림(400 본문 / 500 강조 / 600 준굵게 / 700 제목·수치).
   CSS의 font-weight:800은 정의하지 않고 700으로 자동 폴백시킨다. woff2로 ttf 대비 용량 절감. */
@font-face {
  font-family: 'Pretendard'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/static/fonts/Pretendard-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Pretendard'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('/static/fonts/Pretendard-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Pretendard'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/static/fonts/Pretendard-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Pretendard'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/static/fonts/Pretendard-Bold.woff2') format('woff2');
}

/* Pretendard 우선, 없으면 시스템 폰트 폴백 */
:root {
  --bg: #0D1117; --surface: #161B27; --surface2: #1E2640; --border: #2A3354;
  --primary: #3B5BDB; --primary-hover: #4C6EF5; --accent: #A5B4FC;
  --text: #E8EBF4; --text-sub: #8892B0; --hl: #3B5BDB28; --hl-faint: #3B5BDB14;
  --marker: #4C6EF5; --badge: #A5B4FC; --success: #34D399; --warn: #F87171;
  --radius-card: 8px; --radius-btn: 6px; --radius-badge: 4px;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
}
:root[data-theme="light"] {
  --bg: #F7F8FA; --surface: #FFFFFF; --surface2: #EDF0F6; --border: #D5DAE3;
  --primary: #3B5BDB; --primary-hover: #2F4BC4; --accent: #2F4BC4;
  --text: #1A1F2E; --text-sub: #5B6577; --hl: #3B5BDB22; --hl-faint: #3B5BDB12;
  --marker: #3B5BDB; --badge: #2F4BC4; --success: #15924B; --warn: #C92A2A;
  --shadow: 0 2px 10px rgba(20,30,60,0.10);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg); color: var(--text);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Apple SD Gothic Neo',
               'Malgun Gothic', sans-serif;
  font-size: 15px; line-height: 1.42;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
header.app { border-bottom: 1px solid var(--border); background: var(--surface); }
header.app .inner { padding: 8px 22px; display: flex; align-items: center; gap: 10px; max-width: 1480px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  background: var(--primary); color: #fff; font-weight: 700; font-size: 13px;
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; letter-spacing: 0.5px;
}
.logo-box {
  background: #fff; border-radius: 8px; padding: 4px 7px; display: inline-flex; align-items: center;
}
.logo-box img { height: 34px; display: block; }
.logo-box.logo-fallback {
  background: var(--primary); color: #fff; font-weight: 800; font-size: 15px;
  padding: 6px 11px; letter-spacing: 0.5px;
}
:root[data-theme="light"] .logo-box:not(.logo-fallback) { border: 1px solid var(--border); }
header.app h1 { font-size: 19px; font-weight: 700; margin: 0; }
.spacer { flex: 1; }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-sub);
  background: var(--surface2); padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border);
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-sub); }
.status-pill.ok .dot { background: var(--success); }
.status-pill.down .dot { background: var(--warn); }

.btn-icon {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  width: 34px; height: 34px; border-radius: var(--radius-btn); cursor: pointer; font-size: 15px;
}
.btn-icon:hover { border-color: var(--primary); }

main#app { max-width: 1480px; margin: 0 auto; padding: 12px 22px 40px; }
.loading { color: var(--text-sub); text-align: center; padding: 60px; }

/* 공통 버튼 */
.btn {
  background: var(--primary); color: #fff; border: none; padding: 9px 16px;
  border-radius: var(--radius-btn); cursor: pointer; font-size: 14.5px; font-weight: 500;
  font-family: inherit;
}
.btn:hover { background: var(--primary-hover); }
.btn.ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { border-color: var(--primary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.sm { padding: 6px 12px; font-size: 13px; }

input, textarea, select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-btn); padding: 9px 12px; font-size: 14.5px; font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); }
textarea { resize: vertical; min-height: 60px; width: 100%; }

/* Section title */
.section-title { font-size: 14px; font-weight: 700; margin: 0 0 7px; color: var(--text); }
.muted { color: var(--text-sub); font-size: 13.5px; }

/* 시나리오 카드 그리드 */
.gen-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 14px 16px; margin-bottom: 22px;
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 12px 13px; cursor: pointer; transition: border-color .12s, transform .12s; box-shadow: var(--shadow);
}
.card:hover { border-color: var(--primary); transform: translateY(-2px); }
.card h3 { margin: 0 0 6px; font-size: 15.5px; }
.card .cc { color: var(--accent); font-size: 13px; font-weight: 500; }
.card .meta { color: var(--text-sub); font-size: 13px; margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.badge {
  display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: var(--radius-badge);
  background: var(--hl); color: var(--badge); border: 1px solid var(--border); font-weight: 500;
}
.badge-desc { font-size: 10.5px; opacity: 0.72; font-weight: 400; }
.badge.lvl-AI_ONLY { color: var(--text-sub); }
.badge.lvl-AI_PLUS_RULES { color: var(--accent); }
.badge.lvl-CLAUDE_REVIEWED { color: var(--success); border-color: var(--success); }
.badge.lvl-PHYSICIAN_REVIEWED { color: #fff; background: var(--primary); border-color: var(--primary); }
.diff { color: var(--text-sub); font-size: 12px; display: inline-flex; align-items: center; gap: 5px; }
.diff-boxes { display: inline-flex; gap: 3px; }
.dbox { width: 12px; height: 12px; border-radius: 3px; background: var(--surface2); border: 1px solid var(--border); }
.dbox.on { background: var(--warn); border-color: var(--warn); }

/* 진료 레이아웃 */
.consult { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
@media (max-width: 820px) { .consult { grid-template-columns: 1fr; } }
.consult3 { display: grid; grid-template-columns: 200px minmax(0, 1.6fr) 460px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .consult3 { grid-template-columns: 1fr; } }
.consult-right { display: flex; flex-direction: column; }
.consult-right .chat-window { height: 240px; }
.cc-quote { margin: 10px 0; color: var(--accent); font-size: 14px; font-style: italic; }
.progress-box { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.prog-item { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-sub);
  padding: 4px 9px; background: var(--bg); border-radius: 5px; border: 1px solid var(--border); }
.prog-item b { color: var(--accent); }

/* 헤더 back 버튼 */
.hdr-back { background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  padding: 6px 12px; border-radius: var(--radius-btn); cursor: pointer; font-size: 13.5px;
  font-family: inherit; margin-right: 4px; }
.hdr-back:hover { border-color: var(--primary); }

/* 환자 배너 (헤더 밑 중앙) */
.patient-banner { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 7px 16px; margin-bottom: 9px; box-shadow: var(--shadow); }
.pb-name { font-size: 17px; font-weight: 700; }
.pb-meta { color: var(--text-sub); font-size: 14px; }
.pb-cc { color: var(--accent); font-size: 14.5px; font-style: italic; }

/* 진찰/검사/영상 세로 섹션 */
.order-section { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; }
.order-section:first-of-type { border-top: none; padding-top: 4px; margin-top: 4px; }
.os-head { font-size: 14.5px; font-weight: 700; margin-bottom: 8px; }
.os-count { color: var(--accent); font-size: 12px; font-weight: 500; margin-left: 4px; }
.os-input { flex: 1; }
.order-section .log { max-height: 220px; overflow-y: auto; margin-top: 8px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 12px 13px; }
.patient-hdr h2 { margin: 0 0 4px; font-size: 18px; }
/* 활력징후: 2열 그리드(세로 줄 절반) — 각 칸은 이름 | 값 */
.vitals-table { width: 100%; margin-top: 8px; font-size: 13.5px; }
.vitals-table tbody { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
.vitals-table tr { display: flex; justify-content: space-between; align-items: baseline;
  gap: 6px; border-bottom: 1px solid var(--border); }
.vitals-table td { padding: 2px 0; border: none; white-space: nowrap; }
.vitals-table td.v-abn { color: var(--warn); font-weight: 700; }
.vitals-table td.v-name { color: var(--text-sub); }

/* 탭 */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab { padding: 7px 14px; border-radius: var(--radius-btn); cursor: pointer; background: var(--surface2);
  border: 1px solid var(--border); color: var(--text-sub); font-size: 14px; font-weight: 500; }
.tab.active { background: var(--hl); color: var(--accent); border-color: var(--primary); }

.io-row { display: flex; gap: 6px; margin-bottom: 7px; }
.io-row input { flex: 1; min-width: 0; }   /* 좁은 칸에서도 버튼이 밖으로 밀리지 않게 */
.io-row button { flex-shrink: 0; }
.io-row input:disabled { opacity: .6; cursor: not-allowed; }   /* 답변 재생 중 전송 잠금 */
/* placeholder(Win+H 안내 포함)만 작게 — 입력 글자는 14.5px 그대로. 좁은 화면에서 더 축소. */
.io-row input::placeholder { font-size: 12.5px; opacity: .7; }
@media (max-width: 640px) { .io-row input::placeholder { font-size: 10.5px; } }
.hx-chip.disabled { opacity: .45; pointer-events: none; }
.order-hint {
  font-size: 12.5px; color: var(--text-sub); background: var(--hl-faint);
  border: 1px solid var(--border); border-radius: 2px;
  padding: 6px 10px; margin-bottom: 8px; line-height: 1.45;
}
.order-hint b { color: var(--accent); }
.chips { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 7px; }
.chip { font-size: 12.5px; padding: 4px 10px; border-radius: 4px; background: var(--surface2);
  border: 1px solid var(--border); cursor: pointer; color: var(--text-sub); }
.chip:hover { border-color: var(--primary); color: var(--text); }

.log { display: flex; flex-direction: column; gap: 6px; }
.log { padding-left: 6px; }
.log-item { border: 1px solid var(--border); border-radius: var(--radius-btn); padding: 6px 10px; background: var(--bg); margin-left: 18px; position: relative; }
.log-item::before {
  content: ""; position: absolute; left: -12px; top: -3px; width: 10px; height: 16px;
  border-left: 1.5px solid var(--text-sub); border-bottom: 1.5px solid var(--text-sub);
  border-bottom-left-radius: 4px;
}
.log-item .q { color: var(--accent); font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.log-item .a { font-size: 14px; }
.log-item.abn { border-left: 3px solid var(--warn); }
.flag-H { color: var(--warn); font-weight: 700; }
.flag-L { color: var(--primary-hover); font-weight: 700; }
.log-img { margin-top: 8px; }
.log-img img {
  max-width: 100%; max-height: 320px; border-radius: var(--radius-btn);
  border: 1px solid var(--border); background: #000; cursor: zoom-in;
}

/* 제출 영역 */
.submit-area { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 16px; }
.field { margin-bottom: 7px; }
.field label { display: block; font-size: 13px; color: var(--text); font-weight: 700; margin-bottom: 3px; }
.field input, .field textarea { width: 100%; }

/* 결과 */
.result-score { font-size: 46px; font-weight: 700; color: var(--primary-hover); }
.grade { font-size: 18px; color: var(--text-sub); }
.axis-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.axis-name { width: 110px; font-size: 13.5px; color: var(--text-sub); }
.axis-bar { flex: 1; height: 10px; background: var(--surface2); border-radius: 999px; overflow: hidden; }
.axis-fill { height: 100%; background: var(--primary); border-radius: 999px; }
.axis-val { width: 48px; text-align: right; font-size: 13px; }
.fb-list { list-style: none; padding: 0; margin: 14px 0 0; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-btn); }
.fb-list li { padding: 7px 12px; border-bottom: 1px solid var(--border); font-size: 14px; line-height: 1.5; }
.fb-list li:last-child { border-bottom: none; }
.harmful { color: var(--warn); }

/* ── 채점 결과 2뷰포트 (좌: 점수 / 우: 정답지) ── */
.result2 { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .result2 { grid-template-columns: 1fr; } }
.result-left { position: sticky; top: 12px; text-align: center; }
.result-left .result-score { font-size: 52px; }
.result-left .axis-row { text-align: left; }
.rs-max { font-size: 22px; color: var(--text-sub); }
.dx-verdict { font-weight: 800; margin-top: 8px; padding: 5px; border-radius: 8px; font-size: 15px; }
.dx-verdict.ok { color: #0a7a3f; background: rgba(47, 158, 68, .12); }
.dx-verdict.no { color: #c0392b; background: rgba(224, 49, 49, .12); }
.result-meta { margin-top: 14px; font-size: 13px; display: flex; flex-direction: column; gap: 5px; text-align: left; }
.result-meta .harm b { color: #e03131; }
.result-right { display: flex; flex-direction: column; gap: 12px; }
.ak-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .ak-cols { grid-template-columns: 1fr; } }
.ak-block .ak-title { font-weight: 800; font-size: 15px; margin-bottom: 8px; }
.ak-sub { font-weight: 700; font-size: 12.5px; color: var(--text-sub); margin: 11px 0 5px; }
.ak-item { border-left: 3px solid var(--border); padding: 5px 0 5px 9px; margin-bottom: 6px; }
.ak-item.ak-done { border-left-color: #2f9e44; }
.ak-item.ak-miss { border-left-color: #e03131; background: rgba(224, 49, 49, .05); }
.ak-item.ak-harm { border-left-color: #e03131; }
.ak-head { font-size: 13.5px; line-height: 1.5; }
.ak-desc { font-size: 12.5px; color: var(--text-sub); margin-top: 2px; line-height: 1.5; }
.ak-val { color: var(--primary); font-weight: 600; font-size: 12.5px; }
.ak-k { display: inline-block; width: 42px; font-size: 12px; color: var(--text-sub); font-weight: 700; }
.rel-badge { font-size: 10.5px; padding: 1px 6px; border-radius: 6px; font-weight: 700; }
.rel-badge.CRITICAL { background: #e03131; color: #fff; }
.rel-badge.RELEVANT { background: var(--surface2); color: var(--text-sub); }
.done-y { color: #2f9e44; font-size: 11.5px; font-weight: 700; }
.done-n { color: #adb5bd; font-size: 11.5px; }
.yourdx-ok { color: #0a7a3f; font-weight: 700; }
.yourdx-no { color: #c0392b; font-weight: 700; }
.ddx-wrap { display: flex; flex-wrap: wrap; gap: 5px; }
.ddx-chip { background: var(--surface2); color: var(--primary); border-radius: 6px; padding: 2px 9px; font-size: 12.5px; }
.ddx-chip.gray { color: var(--text-sub); }
.teach-list { margin: 4px 0; padding-left: 18px; font-size: 13px; line-height: 1.55; }
.teach-list li { margin-bottom: 4px; }
.sm { font-size: 11.5px; }

/* ── 챗봇식 문진 (환자/의사 대화) ── */
.chat-window {
  height: 240px; overflow-y: auto; padding: 10px; margin-bottom: 8px;
  display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-btn);
}
.chat-hint { color: var(--text-sub); font-size: 14px; text-align: center; margin: auto; line-height: 1.8; }
.msg { display: flex; align-items: flex-end; gap: 9px; animation: bubble-in .22s ease; }
.msg.doctor { justify-content: flex-end; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 19px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.avatar.pat { background: linear-gradient(135deg, var(--surface2), var(--hl)); }
.avatar.doc { background: linear-gradient(135deg, var(--primary), var(--primary-hover)); }
.bubble {
  max-width: 78%; padding: 7px 12px; font-size: 14px; line-height: 1.4;
  border: 1px solid var(--border); position: relative; word-break: break-word;
}
.msg.patient .bubble {
  background: var(--surface2); color: var(--text);
  border-radius: 4px 16px 16px 16px;
}
.msg.doctor .bubble {
  background: var(--primary); color: #fff; border-color: transparent;
  border-radius: 16px 4px 16px 16px;
}
/* 환자 답변 타이핑 중 깜빡이는 커서 */
.msg.patient .bubble.typing::after {
  content: "▍"; color: var(--primary); margin-left: 1px;
  animation: type-blink 1s step-end infinite;
}
@keyframes type-blink { 50% { opacity: 0; } }
.bubble.pending { color: var(--text-sub); }
/* 답변 준비 중 — 타이핑 점 애니메이션(음성 합성 중) */
.typing-ind { display: inline-flex; align-items: center; gap: 5px; padding: 3px 2px; }
.typing-ind i { width: 7px; height: 7px; border-radius: 50%; background: var(--primary);
  opacity: .35; animation: typing-bounce 1.2s infinite ease-in-out; }
.typing-ind i:nth-child(2) { animation-delay: .18s; }
.typing-ind i:nth-child(3) { animation-delay: .36s; }
@keyframes typing-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .35; }
  40% { transform: translateY(-4px); opacity: 1; } }
/* 환자 답변 🔊 다시듣기 버튼 + 문진 제목 음성 on/off 토글 */
.tts-btn {
  border: none; background: transparent; cursor: pointer; padding: 0 2px;
  margin-left: 6px; font-size: 12px; line-height: 1; opacity: 0.55;
  vertical-align: middle; transition: opacity .15s;
}
.tts-btn:hover { opacity: 1; }
.section-title .voice-toggle {
  float: right; margin-left: 6px; border: 1px solid var(--border); background: var(--surface2);
  color: var(--text-sub); border-radius: 12px; padding: 1px 10px; cursor: pointer;
  font-size: 11.5px; font-weight: 700; line-height: 1.6;
}
.section-title .voice-toggle.on {          /* 켜짐: 채워진 강조색 + 흰 글씨 */
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.section-title .voice-toggle.off {         /* 꺼짐: 흐리게 + 취소선 */
  background: var(--surface2); color: var(--text-sub); opacity: .6; text-decoration: line-through;
}
.section-title .voice-toggle:hover { filter: brightness(1.06); border-color: var(--primary); }
@keyframes bubble-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%,100% { opacity: .5; } 50% { opacity: 1; } }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  padding: 11px 18px; border-radius: var(--radius-btn); box-shadow: var(--shadow);
  font-size: 14px; z-index: 100; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.err { border-color: var(--warn); color: var(--warn); }

/* 필터바 / 목록 / 카드 상단 */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.filter-bar .f-search { flex: 1; min-width: 200px; }
.list-head { color: var(--text-sub); font-size: 13px; margin-bottom: 9px; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 5px; }
.spec-tag { font-size: 11.5px; color: var(--text-sub); background: var(--surface2); padding: 2px 7px; border-radius: var(--radius-badge); }

/* 관리 화면 */
.manage-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.manage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.cov-summary { font-size: 13.5px; margin-bottom: 10px; }
.cov-summary b { color: var(--accent); }
.cov-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 12.5px; }
.cov-name { width: 92px; color: var(--text-sub); flex-shrink: 0; }
.cov-bar { flex: 1; height: 8px; background: var(--surface2); border-radius: 999px; overflow: hidden; }
.cov-fill { height: 100%; background: var(--primary); }
.cov-val { width: 42px; text-align: right; color: var(--text-sub); }
.list-count { margin-left: auto; color: var(--text-sub); font-size: 13px; white-space: nowrap; }
/* ── 페이지네이션 ── */
.pager { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 16px 0 8px; flex-wrap: wrap; }
.pager:empty { display: none; }
.pg-btn { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-btn); padding: 7px 13px; font-size: 13px; font-weight: 600; cursor: pointer; }
.pg-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pg-btn:disabled { opacity: .4; cursor: default; }
.pg-info { font-size: 13px; color: var(--text-sub); padding: 0 6px; }
.pg-info b { color: var(--primary); }
.ver { color: #6b7280; font-size: 12px; font-weight: 500; letter-spacing: 0; }
.chip.done { opacity: 0.55; background: var(--hl-faint); color: var(--accent); border-color: var(--primary); cursor: default; }
.order-guide { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.os-hint { color: var(--text-sub); font-size: 11.5px; font-weight: 400; margin-left: 4px; }
/* 아바타 */
.card-bottom { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.card-bottom .meta { margin-top: 0; flex: 1; }
.card-avatar { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; object-position: top; border: 1px solid var(--border); flex-shrink: 0; background: var(--surface2); }
.pt-card { display: flex; align-items: center; gap: 11px; margin-bottom: 4px; }
.pt-avatar { width: 58px; height: 58px; border-radius: 10px; object-fit: cover; object-position: top; border: 1px solid var(--border); background: var(--surface2); }
.pt-name { font-size: 17px; font-weight: 700; }
.pt-meta { font-size: 13px; color: var(--text-sub); margin-top: 2px; }
.avatar.pat, .avatar.doc { overflow: hidden; padding: 0; }
.avatar-img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }

/* ── 환자 사진(의사 시점) — 큰 아바타. 열 배치/스크롤은 아래 데스크톱·모바일 블록 ── */
.pt-hero { position: relative; width: 90%; margin: 0 auto 10px; border-radius: 12px;  /* 아바타 90% 축소(가운데) */
  overflow: hidden; border: 1px solid var(--border); background: var(--surface2);
  box-shadow: 0 1px 6px rgba(0,0,0,0.08); }
.pt-hero-img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover;
  object-position: center; background: var(--surface2); }
.pt-hero-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 14px 9px;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 9px; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,0.62)); }
.pt-hero-cap b { font-size: 16px; font-weight: 700; }
.pt-hero-cap span { font-size: 13px; opacity: 0.93; }
/* v2 아바타(patients_v2/): 파일 하단 라벨을 표시 때만 클립(파일은 보존). */
.pt-hero-img.av-v2 { aspect-ratio: 1.22; object-position: center top; }  /* 하단 라벨 박스 완전히 가리게(표시만, 파일은 그대로) */
/* 보호자 대답 케이스: 메인=보호자, 우하단에 실제 환자 얼굴을 작게 인셋 */
.pt-inset { position: absolute; right: 8px; bottom: 8px; width: 30%; max-width: 116px;
  border-radius: 9px; overflow: hidden; border: 2px solid rgba(255,255,255,.9);
  box-shadow: 0 2px 9px rgba(0,0,0,.35); background: var(--surface2); }
.pt-inset-img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: center top; }
.pt-inset-tag { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; font-weight: 700;
  text-align: center; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.62)); padding: 8px 2px 3px; }
/* 우측 열: 검사 오더 + 제출 세로 */
.col-orders { display: flex; flex-direction: column; gap: 12px; }
.avatar-img.av-v2 { transform: scale(1.2); transform-origin: center top; }  /* 줌해서 라벨 밀어냄(래퍼가 클립) */
.pt-avatar.av-v2 { clip-path: inset(0 0 16% 0 round 10px); }   /* 하단 16% 잘라 라벨 숨김 */
.card-avatar.av-v2 { clip-path: inset(0 0 16% 0 round 8px); }
.card-avatar-wrap { display: flex; justify-content: flex-end; margin-top: 8px; }
.badge { white-space: nowrap; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.card-top .cc { flex: 1; }
.card-top { flex-wrap: nowrap; }
.card-top .cc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-top .badge { flex-shrink: 0; }
/* card-top 2줄 고정 (증상 1~2줄 흡수, 카드 높이 균일) */
.card-top { min-height: 40px; align-items: flex-start; flex-wrap: nowrap; }
.card-top .cc { white-space: normal; text-overflow: clip; overflow: hidden; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* 제목 2줄 고정 (카드 높이 완전 균일) */
.card h3 { line-height: 1.3; min-height: 40px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card h3 { font-size: 16.5px; min-height: 44px; }
/* 카드 컴팩트 — 더 많은 카드 표시 */
.card-grid { grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 8px; }
.card { padding: 9px 11px; }
.card h3 { font-size: 15px; min-height: 38px; margin: 0 0 3px; line-height: 1.28; }
.card-top { min-height: 34px; }
.card .muted { font-size: 12.5px; }
.card-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; margin-top: 6px; }
.card-bottom .meta { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; margin: 0; }
.card-avatar { width: 40px; height: 40px; }
.card-avatar { width: 52px; height: 52px; }
/* ── 레이아웃 쥐어짜기 (대화창 세로 확보) ── */
/* 좌: 환자 | 중: 문진(넓게, 유동) | 우: 오더(좁게, 고정) */
/* 큰 화면 3열: 좌=큰 아바타 | 중=좁은 채팅 | 우=오더+제출 */
.consult3 { grid-template-columns: minmax(300px, 1.35fr) minmax(240px, 0.9fr) minmax(300px, 1.15fr); gap: 14px; }
.col-chat .chat-window { height: 400px; }

/* 큰 화면(≥1101px): 3영역 독립 스크롤 — 아바타 고정 / 채팅 자체 스크롤 / 오더+제출 별도 스크롤 */
@media (min-width: 1101px) {
  .consult3 { align-items: stretch; height: calc(100vh - 96px); }
  .consult3 > * { min-height: 0; }               /* grid 자식이 줄어들어 스크롤 가능 */
  .col-patient { overflow-y: auto; }
  .col-patient .pt-hero { position: sticky; top: 0; }  /* 아바타 고정 */
  .col-chat { overflow: hidden; display: flex; flex-direction: column; }
  .col-chat .chat-window { flex: 1 1 auto; height: auto; min-height: 140px; }
  .col-orders { overflow-y: auto; }

  /* PC 현장감(2026-10-14): 환자 얼굴을 크게. 영상 비율(이름표 가림·입/턱 보존)은 그대로 두고 크기만 키운다.
     폭은 열 너비 100%까지, 단 화면 높이에 맞춰 상한(아래 활력징후가 보이도록) → 낮은 화면에선 폭을 줄여 맞춤.
     채팅 열은 최소 360px(전송 버튼 넘침 방지). */
  .consult3 { grid-template-columns: minmax(340px, 1.4fr) minmax(360px, 1fr) minmax(320px, 1.1fr); }
  .col-patient .pt-hero { width: min(100%, calc((100vh - 250px) * 1.22)); }
}
/* 넓은 노트북·모니터(≥1500px): 좌우 빈 공간을 쓰도록 최대 폭 1480→1880px, 환자 열 비중↑ */
@media (min-width: 1500px) {
  header.app .inner, main#app { max-width: 1880px; }
  .consult3 { grid-template-columns: minmax(400px, 1.6fr) minmax(360px, 1fr) minmax(340px, 1.1fr); }
}
/* 문진 박스 강조 — 진료의 핵심 영역 */
.chat-panel { border: 2px solid var(--primary); box-shadow: 0 0 0 3px rgba(59,91,219,0.10); }
.chat-panel .section-title { color: var(--primary); font-size: 15px; }
.chat-panel .chips { margin-bottom: 5px; }
header.app .inner { padding: 5px 22px; }
.order-hint { padding: 4px 8px; margin-bottom: 5px; font-size: 11.5px; line-height: 1.35; }
.order-guide { margin-bottom: 4px; font-size: 12.5px; }
.field { margin-bottom: 5px; }
.section-title { margin: 0 0 5px; }
.dx-panel .field label { font-size: 12.5px; margin-bottom: 2px; }
.order-section { padding-top: 6px; margin-top: 6px; }

/* ══════════════════════════════════════════════════════════════
   모바일/좁은 화면 대응 (2026-07-20)
   ※ PC 레이아웃은 그대로 두고, 좁을 때만 재배치한다.
   ※ 이 블록은 파일 최하단에 둔다 — 위쪽 데스크톱 override가
     앞선 @media를 덮어버리므로, 여기서 다시 선언해야 적용된다.
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  /* 진료 3분할(사진|문진|검사+제출) → 세로 1열(사진→문진→검사→제출), 사진도 같이 스크롤 */
  .consult3 { grid-template-columns: 1fr; gap: 12px; }
  .col-chat .chat-window { height: 340px; }
  .pt-hero { max-width: 460px; margin: 0 auto 12px; }   /* 폰: 사진 적정 크기, 가운데 */
  .pt-hero-img.av-v2 { aspect-ratio: 1.5; }             /* 폰: 낮게(세로 공간 절약) */
  .ak-cols { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .consult { grid-template-columns: 1fr; }
  .result2 { grid-template-columns: 1fr; }   /* 채점: 점수 | 정답지 → 세로 */
}
@media (max-width: 640px) {
  /* 헤더: 여백 축소 + 부제 숨겨 한 줄 유지 */
  header.app .inner { padding: 6px 12px; gap: 8px; }
  header.app h1 { font-size: 15px; line-height: 1.25; }
  .ver { display: none; }
  main#app { padding: 10px 12px 32px; }
  /* 목록/관리 카드 1열 */
  .card-grid { grid-template-columns: 1fr; }
  .manage-grid { grid-template-columns: 1fr; }
  /* 검색은 한 줄 전체 차지 */
  .filter-bar { gap: 6px; }
  .filter-bar .f-search { flex: 1 1 100%; min-width: 0; }
  /* 대화창은 폰 화면에 맞게 낮춤 */
  .col-chat .chat-window { height: 300px; }
  .bubble { max-width: 88%; font-size: 13.5px; }
  .patient-banner { gap: 8px; }
  .tabs { gap: 4px; }
  .result-score { font-size: 36px; }
  .pager { gap: 5px; font-size: 12.5px; }
}
