:root {
  --brand: #347461;
  --brand-dark: #263934;
  --brand-soft: #dcebe5;
  --warning: #d89b2b;
  --danger: #d9554f;
  --ink: #253530;
  --muted: #747d79;
  --line: #deded8;
  --panel: #ffffff;
  --bg: #f7f7f4;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  background: #e9ece8;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.phone-shell {
  width: 100vw;
  height: 100svh;
  min-height: 100svh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

@media (min-width: 520px) {
  .phone-shell {
    width: 390px;
    height: min(932px, 100dvh);
    min-height: min(932px, 100dvh);
    border-radius: 18px;
    box-shadow: 0 22px 80px rgba(0, 0, 0, 0.18);
  }
}

.screen {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px calc(118px + env(safe-area-inset-bottom));
}

@supports (height: 100dvh) {
  .phone-shell {
    height: 100dvh;
    min-height: 100dvh;
  }
}

@media (max-width: 519px) {
  body {
    display: block;
    background: var(--bg);
  }
}

.center {
  text-align: center;
}

.start {
  padding: 16px 32px calc(28px + env(safe-area-inset-bottom));
}

.start-logo {
  width: 112px;
  height: 112px;
  object-fit: contain;
  margin: clamp(28px, 7dvh, 52px) auto 22px;
  display: block;
}

.app-title {
  margin: 0;
  font-size: 36px;
  line-height: 1.15;
  font-weight: 800;
  color: var(--brand-dark);
}

.sub {
  margin: 12px 0 20px;
  color: var(--muted);
  font-size: 16px;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 18px 0 56px;
}

.choice-card,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}

/* 질병관리청 연령대 비교 카드 — 주최기관 공공데이터 가시화 */
.bench-card {
  padding: 14px 16px;
  margin: 12px 0;
  border-left: 4px solid var(--brand);
  background: var(--brand-soft);
}
.bench-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.bench-head strong {
  color: var(--brand-dark);
  font-size: 15px;
}
.bench-src {
  font-size: 11px;
  color: var(--brand);
  font-weight: 700;
  white-space: nowrap;
}
.bench-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.bench-chip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--ink);
}
.bench-chip strong {
  color: var(--brand-dark);
}
.bench-poly {
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 8px;
}
.bench-text {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

/* 예방접종 상담 권고 카드 — 질병청 감염병 라이브 API 근거 */
.advisory-card {
  padding: 14px 16px;
  margin: 12px 0;
  border-left: 4px solid var(--warning);
  background: #fff7ec;
}

/* 약물별 위험도 (v2.0 §5.2/5.3) — 개수 요약 칩 → 클릭 시 해당 약물 */
.drug-cat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 4px 0 8px;
}
.drug-cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drug-cat.active {
  border-color: var(--cat);
  background: color-mix(in srgb, var(--cat) 12%, var(--panel));
}
.drug-cat-n {
  font-size: 19px;
  font-weight: 800;
  color: var(--cat);
  line-height: 1;
}
.drug-cat-label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.drug-cat-hint {
  margin: 2px 0 4px;
  font-size: 12.5px;
  color: var(--muted);
}
.drug-filter-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin: 6px 0 8px;
}
.drug-risk-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.drug-risk-card {
  padding: 12px 14px;
}
.drug-risk-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.drug-risk-head strong {
  color: var(--ink);
  font-size: 14.5px;
}
.drug-grade-pill {
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.drug-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.drug-tag {
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.drug-tag.muted {
  background: #f0f0ec;
  color: var(--muted);
}
.drug-risk-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.drug-more {
  color: var(--muted);
  font-weight: 700;
}

/* 약물 상세 모달 (§5.3 Phase 2) */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 30, 26, 0.42);
  display: flex;
  align-items: flex-end;
  z-index: 50;
}
.modal-sheet {
  width: 100%;
  max-height: 82%;
  overflow-y: auto;
  background: var(--panel);
  border-radius: 18px 18px 0 0;
  padding: 18px 20px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.22);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.modal-head strong {
  font-size: 17px;
  color: var(--brand-dark);
}
.modal-close {
  border: none;
  background: none;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
}
.modal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.modal-row > span {
  color: var(--muted);
}
.modal-sub {
  margin: 14px 0 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}
.modal-warn-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink);
}
.generic-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.generic-list li {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  background: var(--brand-soft);
  border-radius: 10px;
}
.generic-list li strong {
  font-size: 13.5px;
  color: var(--ink);
}
.generic-list li span {
  font-size: 11.5px;
  color: var(--muted);
}
.modal-note {
  margin: 14px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

/* 약물 관계도 (§5.3 Phase 3) */
.graph-card {
  padding: 12px 8px 10px;
  margin-bottom: 12px;
}
.graph-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 4px;
}
.graph-legend span {
  position: relative;
  padding-left: 16px;
  font-size: 11.5px;
  color: var(--muted);
}
.graph-legend span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 3px;
  border-radius: 2px;
  background: var(--c);
}

.choice-card {
  height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--ink);
}

.choice-card strong {
  display: block;
  font-size: 16px;
  line-height: 1.45;
  text-align: center;
}

.icon-line {
  width: 32px;
  height: 32px;
  color: var(--brand);
}

.primary-btn,
.secondary-btn {
  width: 100%;
  min-height: 56px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 18px;
  cursor: pointer;
}

.primary-btn {
  border: 0;
  color: white;
  background: var(--brand);
}

.secondary-btn {
  border: 1px solid var(--brand);
  color: var(--brand);
  background: white;
}

.foot-note {
  margin-top: 18px;
  font-size: 13px;
  color: #7a817d;
}

.topbar {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 82px;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  margin-bottom: 12px;
}

.back-btn {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 28px;
  cursor: pointer;
}

.top-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 800;
}

.mini-logo {
  width: 22px;
  height: 22px;
}

.step {
  text-align: right;
  color: var(--muted);
  font-size: 13px;
}

.progress {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 22px 0 14px;
}

.progress span {
  height: 4px;
  border-radius: 99px;
  background: #dfdfda;
}

.progress span.active {
  background: var(--brand);
}

.headline {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 900;
}

.hint {
  margin: 6px 0 16px;
  color: var(--muted);
  font-size: 15px;
}

.card {
  padding: 14px;
  margin-bottom: 10px;
}

.age-row {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  height: 74px;
}

.subtle-help {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.round-btn {
  height: 44px;
  width: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  font-size: 24px;
  cursor: pointer;
}

.age-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  width: 100%;
  text-align: center;
  font-size: 30px;
  font-weight: 900;
}

.age-value-input {
  width: min(100%, 92px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: center;
  font-size: 30px;
  font-weight: 900;
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
  font: inherit;
}

.age-value-input::-webkit-outer-spin-button,
.age-value-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.age-value-input:focus {
  color: var(--brand-dark);
}

.age-value-input::placeholder {
  color: var(--muted);
}

.age-value span {
  font-size: 15px;
  font-weight: 500;
  margin-left: 3px;
}

.toggle-row {
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  margin-bottom: 8px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  font-weight: 700;
}

.toggle {
  width: 48px;
  height: 28px;
  border-radius: 99px;
  background: #d6d6d0;
  position: relative;
  border: 0;
  cursor: pointer;
}

.toggle::after {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  position: absolute;
  top: 3px;
  left: 3px;
}

.toggle.on {
  background: var(--brand);
}

.toggle.on::after {
  left: 23px;
}

.input-card h3 {
  min-height: 28px;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 16px;
}

.search {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--muted);
  background: white;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.chip {
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 13px;
}

.chip-button {
  border: 0;
  font-weight: 700;
  cursor: pointer;
}

.dose-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dose label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.dose input {
  width: 100%;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 0 10px;
}

.dose-combo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 6px;
}

.dose select {
  width: 100%;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 8px;
}

.dose .custom-unit-input {
  margin-top: 6px;
}

.result-score {
  padding: 34px 14px 18px; /* 상단 여유 — 게이지 맨 위 '50' 눈금이 카드 밖으로 잘리지 않게 */
  text-align: center;
}

.score-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.score-stack strong {
  display: block;
  margin-top: 14px;
  text-align: center;
  line-height: 1.25;
  word-break: keep-all;
  position: relative;
  z-index: 1;
}

.gauge-wrap {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 310px);
  height: 180px;
  margin: 0;
  z-index: 0;
}

.gauge-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.gauge-track,
.gauge-fill {
  fill: none;
  stroke-width: 13;
  stroke-linecap: round;
}

.gauge-track {
  stroke: #e7e7e3;
}

.gauge-svg text {
  fill: #6f7874;
  font-size: 13px;
  font-weight: 800;
}

.score-number {
  font-size: 54px;
  line-height: 1; /* 굵은 숫자 상하 잘림 방지 */
  color: var(--warning);
  font-weight: 900;
  margin-top: 55px; /* 게이지 안으로 밀어 넣는 핵심 수치 */
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

.score-total {
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
  position: relative;
  z-index: 1;
}

.pill {
  display: inline-block;
  margin: 8px 0;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
  background: #fff0d4;
  color: var(--warning);
  font-weight: 800;
  position: relative;
  z-index: 1;
}

.new-med-pill {
  flex: 0 0 auto;
  margin: 0;
  padding: 4px 9px;
  font-size: 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
}

.metric {
  display: grid;
  align-content: center;
}

.metric strong {
  display: block;
  margin-top: 2px;
  font-size: 28px;
  color: var(--brand);
}

.metric.warning strong {
  color: var(--warning);
}

.bar {
  height: 4px;
  background: #e3e3de;
  border-radius: 99px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: 32%;
  background: var(--brand);
}

.metric.warning .bar span {
  width: 48%;
  background: var(--warning);
}

.section-title {
  margin: 12px 0 8px;
  font-size: 18px;
}

.risk-list {
  padding: 8px;
}

.risk-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 7px;
  border-radius: 10px;
  background: #f7f3ed;
  margin-bottom: 8px;
}

.risk-mark {
  color: #6f7874;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 900;
}

.risk-item strong {
  display: block;
  font-size: 13px;
}

.risk-item span {
  color: var(--muted);
  font-size: 12px;
}

.bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 92px;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: white;
  border-top: 1px solid #eee;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}

.tab {
  border: 0;
  background: white;
  color: #69716d;
  font-size: 15.5px;
  display: grid;
  grid-template-rows: 32px 22px;
  align-items: center;
  justify-items: center;
  align-content: center;
  gap: 6px;
  cursor: pointer;
  min-width: 0;
  line-height: 1.15;
}

.tab.active {
  color: var(--brand);
  font-weight: 800;
}

.tab-icon {
  width: 30px;
  height: 30px;
  display: block;
  line-height: 1;
  margin: 0 auto;
  flex: 0 0 30px;
}

.simple-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.list-card {
  min-height: 78px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

button.list-card {
  width: 100%;
  border: 1px solid var(--line);
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.list-card strong {
  display: block;
  margin-bottom: 4px;
}

.list-card span {
  color: var(--muted);
  font-size: 13px;
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  font-size: 21px;
  font-weight: 900;
}

.home-brand img {
  width: 28px;
  height: 28px;
}

.home-title {
  margin: 24px 0 8px;
  font-size: 31px;
  line-height: 1.25;
  font-weight: 900;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0 24px;
}

.stat-card {
  min-height: 84px;
  display: grid;
  place-items: center;
  text-align: center;
}

.stat-card span {
  color: var(--muted);
}

.stat-card strong {
  display: block;
  font-size: 30px;
  line-height: 1.1;
}

.notice-card {
  margin-top: 18px;
  padding: 16px;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  background: #e2f0ea;
  border: 0;
  color: var(--brand);
  font-size: 13px;
  line-height: 1.5;
}

.result-notice {
  margin: 12px 0;
}

.check-error {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #ffefeb;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.empty-card {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 6px;
  color: var(--ink);
}

.empty-card span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.detail-section h3 {
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
}

.question {
  margin: 14px 0 8px;
  font-weight: 800;
  font-size: 14px;
}

.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-row.option-count-2,
.option-row.option-count-3,
.option-row.option-count-4 {
  display: flex;
}

.option {
  min-height: 36px;
  width: auto;
  flex: 1 1 auto;
  min-width: max-content;
  max-width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--ink);
  text-align: center;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  line-height: 1.2;
  font-size: clamp(11px, 3vw, 14px);
}

.option.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 800;
}

.med-manage-card {
  display: grid;
  gap: 12px;
}

.med-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.med-row strong,
.med-row span {
  overflow-wrap: anywhere;
  word-break: keep-all;
}

.med-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.med-actions,
.manage-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.icon-btn,
.delete-btn,
.small-btn {
  width: auto;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 14px;
}

.delete-btn {
  border: 1px solid #f1c5c1;
  background: #fff8f7;
  color: var(--danger);
  font-weight: 800;
  cursor: pointer;
}

.manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
}

.manage-grid label {
  color: var(--muted);
  font-size: 12px;
}

.manage-grid input {
  width: 100%;
  height: 38px;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  background: white;
  color: var(--ink);
}

.unit-input {
  height: 38px;
  margin-top: 5px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.unit-input input {
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
}

.unit-input span {
  padding-right: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.history-card:hover,
.option:hover,
.choice-card:hover {
  border-color: #b9cbc4;
}

.result-screen {
  padding-top: 10px;
  padding-bottom: 96px;
}

.result-screen .topbar {
  margin-top: 8px;
}

.result-screen .card {
  margin-bottom: 8px;
}

.result-screen .result-score {
  padding: 34px 14px 18px; /* 상단 여유 — 게이지 '50' 눈금 잘림 방지 */
}

.result-screen .gauge-wrap {
  width: min(100%, 280px);
  height: 162px;
  margin-bottom: 2px;
}

.result-screen .score-number {
  font-size: 54px;
}

.result-screen .pill {
  margin: 5px 0;
}

.result-screen .metric {
  min-height: 78px;
  padding: 12px;
}

.result-screen .metric strong {
  font-size: 25px;
}

.result-screen .section-title {
  margin: 8px 0 6px;
  font-size: 17px;
}

.result-screen .risk-list {
  padding: 7px;
}

.result-screen .risk-item {
  min-height: 42px;
  margin-bottom: 6px;
  padding: 6px;
}

.result-screen .primary-btn,
.result-screen .secondary-btn {
  min-height: 50px;
}

/* Design alignment overrides */
.ui-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.icon-text-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.toggle {
  flex: 0 0 48px;
}

.search .ui-icon {
  width: 20px;
  height: 20px;
}

.medicine-search {
  width: 100%;
  cursor: text;
}

.medicine-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
}

.history-search input,
.medicine-search input {
  width: 100%;
}

.medicine-search input::placeholder {
  color: #8a918d;
}

.medicine-search span {
  display: flex;
  align-items: center;
  color: #6f7874;
}

.inline-add {
  flex: 0 0 54px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--brand);
  border-radius: 999px;
  background: white;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.ocr-note {
  margin: -4px 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #e2f0ea;
  color: var(--brand);
  font-size: 13px;
  line-height: 1.4;
}

.ocr-review-note {
  margin: -2px 0 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: #fff0f3;
  color: #b3445a;
  font-size: 13px;
  line-height: 1.45;
}

.ocr-review-note.always {
  margin: 8px 0 0;
  background: #f7f4ec;
  color: #6f6352;
}

.detail-free-text {
  margin-top: 14px;
}

.detail-free-text span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.detail-free-text input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
}

.confirm-card {
  padding: 14px;
}

.confirm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.confirm-head button {
  border: 0;
  background: transparent;
  color: var(--brand);
  font-weight: 700;
}

.confirm-pill-list {
  display: grid;
  gap: 10px;
}

.confirm-pill-list span {
  padding: 13px;
  border-radius: 10px;
  background: #f7f3ed;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.confirm-pill-list.danger span {
  background: #fff0ee;
}

.confirm-pill-list em {
  flex: 0 0 auto;
  font-style: normal;
  color: #e4544b;
  border: 1px solid #e4544b;
  border-radius: 999px;
  padding: 2px 9px;
}

.compact {
  min-height: auto;
  margin-top: 4px;
}

.evidence-card {
  padding: 16px;
}

.evidence-card > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.evidence-card > div:first-child strong {
  min-width: 0;
  flex: 1 1 180px;
  line-height: 1.25;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.evidence-card > div:first-child span {
  border: 1px solid var(--brand);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--brand);
  font-size: 12px;
  white-space: nowrap;
}

.evidence-card p {
  margin: 10px 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.evidence-card small,
.evidence-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.evidence-card small button,
.evidence-toggle-btn {
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-weight: 800;
  padding: 0;
  cursor: pointer;
}

.full-evidence-detail {
  white-space: pre-line;
}

.action-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.action-card {
  min-height: 84px;
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 10px;
  align-items: start;
}

.action-card > span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #e2f0ea;
  color: var(--brand);
  font-size: 20px;
  font-weight: 900;
  margin-top: 2px;
}

.collapsible-text p {
  display: block;
  margin: 0;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.collapsible-text:not(.expanded) p {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.collapsible-text button {
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.action-detail p {
  font-size: 15px;
  line-height: 1.38;
  letter-spacing: 0;
  font-weight: 800;
}

.evidence-detail p {
  font-size: 14px;
  line-height: 1.55;
}

.full-evidence-detail {
  display: block;
  margin: 10px 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: break-word;
  white-space: pre-line;
}

.action-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  word-break: keep-all;
}

.consult-card,
.summary-card {
  background: #e2f0ea;
  border-color: #c8ded5;
}

.consult-card h3 {
  margin: 0 0 12px;
  color: var(--brand);
  display: flex;
  gap: 8px;
  align-items: center;
}

.consult-card div:not(:first-child),
.summary-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(52, 116, 97, 0.18);
  font-size: 12px;
  line-height: 1.35;
}

.consult-card span,
.summary-row span {
  color: var(--brand);
  font-weight: 800;
}

.consult-card strong,
.summary-row strong {
  min-width: 0;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.summary-lead {
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  margin: 24px 0 16px;
}

.summary-card {
  padding: 16px;
  background: white;
}

.summary-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
  font-size: 14px;
}

.summary-title span,
.summary-card small {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.summary-card small {
  display: block;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.summary-risk {
  margin: 14px 0;
  padding: 14px;
  border-radius: 10px;
}

.summary-risk span {
  display: inline-block;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 14px;
  margin-right: 12px;
}

.summary-risk strong {
  font-size: 25px;
}

.summary-risk p {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.summary-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 8px 0 10px;
}

.summary-actions .secondary-btn {
  min-height: 52px;
  font-size: 13px;
  display: grid;
  place-items: center;
  gap: 3px;
}

.save-feedback {
  min-height: 0;
  margin: 0;
  color: var(--brand);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.save-feedback:not(:empty) {
  margin: 8px 0 10px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 4px 8px;
}

.section-head h2,
.subsection-title {
  margin: 0;
  color: var(--brand);
  font-size: 19px;
}

.section-head span {
  padding: 4px 10px;
  border: 1px solid var(--brand);
  border-radius: 999px;
  color: var(--brand);
  font-size: 12px;
}

.medicine-group {
  padding: 0 14px;
  overflow: hidden;
}

.subsection-title {
  margin: 24px 4px 8px;
}

.med-manage-card {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.medicine-group > .med-manage-card.card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 10px 0;
}

.med-manage-card:last-child {
  border-bottom: 0;
}

.icon-only {
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: #6f7874;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.icon-only .ui-icon {
  width: 20px;
  height: 20px;
}

.text-action-btn {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--brand);
  border-radius: 999px;
  background: white;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.history-search {
  margin-top: 14px;
}

.filter-row {
  display: flex;
  gap: 8px;
  margin: 8px 0 12px;
}

.filter-row button {
  min-height: 36px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-weight: 700;
}

.filter-row .selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.history-result-card {
  width: 100%;
  min-height: 96px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.history-result-card strong {
  display: block;
  line-height: 1.3;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.history-result-card span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.history-score {
  text-align: right;
  min-width: 72px;
}

.history-score span {
  display: inline-block;
  margin: 0 0 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 14px;
  min-width: 64px;
  text-align: center;
  white-space: nowrap;
}

.history-score strong {
  display: block;
  font-size: 18px;
}

.metric strong small {
  font-size: 15px;
  color: var(--muted);
  font-weight: 700;
  margin-left: 2px;
}

.metric-caption {
  margin: 8px 2px 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.pending-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fff0d4;
  color: #8a6420;
  font-size: 12px;
  font-weight: 700;
}

/* 결과 하단 슬림 의료 고지 (오류 박스 대체) */
.result-disclaimer {
  margin: 14px 4px 4px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}

/* 홈 감염병 알림 — 우측 상단 아이콘 + 왼쪽으로 펼쳐지는 배너 */
.home-screen { position: relative; }
.epidemic-alert {
  position: absolute;
  bottom: calc(104px + env(safe-area-inset-bottom)); /* 하단 네비 위, 오른쪽 아래로 이동 */
  right: 16px;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

/* 홈 우측 상단 프로필 아이콘(전환·재설정) — 기존 알림 자리 */
.profile-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 31;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--brand);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
}
.epidemic-btn {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--danger);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
  transition: background 0.2s ease;
}
.epidemic-alert.seen .epidemic-btn {
  background: var(--muted); /* 확인 후 색 변경 */
}
.epidemic-banner {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.14);
  transition: max-width 0.28s ease, opacity 0.2s ease, padding 0.28s ease;
  padding: 0;
}
.epidemic-alert.open .epidemic-banner {
  max-width: 250px;
  opacity: 1;
  padding: 12px 14px;
}
.epidemic-banner strong {
  display: block;
  font-size: 13px;
  color: var(--brand-dark);
  white-space: nowrap;
  margin-bottom: 8px;
}
.epidemic-banner ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.epidemic-banner li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
}
.epi-name { word-break: keep-all; overflow-wrap: anywhere; line-height: 1.35; }
.epi-lvl {
  flex: none;
  font-size: 10.5px;
  font-weight: 800;
  color: #fff;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--muted);
}
.epi-lvl.lvl1 { background: var(--danger); }
.epi-lvl.lvl2 { background: var(--warning); }
.epi-lvl.lvl3 { background: #9aa39e; }
.epi-lvl.lvl4 { background: #b8bdb8; }
.epidemic-banner small {
  display: block;
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

/* 약물 정보 제공 — 매칭 약 카드 */
.drug-info-card { padding: 14px 16px; margin-bottom: 12px; }
.drug-info-name { display:block; font-size:16px; color:var(--brand-dark); margin-bottom:8px; }
.drug-info-card .modal-row:last-child { border-bottom: none; }

/* 프로필/보호자 화면 ([3.1]) */
.field-label { display:block; font-size:12.5px; font-weight:700; color:var(--muted); margin-bottom:6px; }
.text-input { width:100%; border:1px solid var(--line); border-radius:10px; padding:11px 12px; font-size:15px; color:var(--ink); background:#fff; }
.relation-chip { border:1px solid var(--line); background:#fff; color:var(--ink); border-radius:999px; padding:6px 13px; font-size:13px; cursor:pointer; }
.relation-chip.active { background:var(--brand); color:#fff; border-color:var(--brand); font-weight:700; }
.profile-list { display:flex; flex-direction:column; gap:10px; margin-bottom:14px; }
.profile-card { display:flex; justify-content:space-between; align-items:center; gap:10px; width:100%; text-align:left; padding:14px 16px; cursor:pointer; font:inherit; }
.profile-card.active { border-color:var(--brand); background:var(--brand-soft); }
.profile-card-main { display:flex; align-items:center; gap:8px; }
.profile-card-main strong { font-size:15.5px; color:var(--ink); }
.relation-badge { font-size:11px; font-weight:800; color:var(--brand); background:var(--brand-soft); border-radius:999px; padding:2px 9px; }
.profile-card.active .relation-badge { background:#fff; }
.profile-age { font-size:13px; color:var(--muted); font-weight:700; white-space:nowrap; }
.modal-center { align-items:center; justify-content:center; padding:20px; }
.modal-dialog { width:100%; max-width:320px; border-radius:16px; box-shadow:0 12px 44px rgba(0,0,0,0.22); }

/* 건강정보 요약 확인 카드 ([2]) */
.summary-card { padding: 14px 16px; margin-bottom: 16px; }
.summary-card .modal-row:last-of-type { border-bottom: none; }
