/* 침대 상세(#/bed/:id · 모니터 서랍) — docs/M3-UI.md §4. 색은 tokens.css 변수만 쓴다.
   배치: 머리말 → [영웅(BedFigure) | 카드들]. 넓은 화면은 카드 격자만 넓어지고 글자는 그대로(§11). 서랍(.bd-compact)은 한 줄. */

.bd {
  /* 자세 색(타임라인 띠·범례 점) — 구역 팔레트에서 빌려 쓴다. 큰 면적은 표면과 섞어 채도를 낮춘다. */
  --p-supine: var(--zone-2); --p-left: var(--zone-1); --p-right: var(--zone-6);
  --p-left30: color-mix(in srgb, var(--zone-1) 52%, var(--surface)); --p-right30: color-mix(in srgb, var(--zone-6) 52%, var(--surface));
  --p-semi_fowler: var(--zone-10); --p-sitting: var(--zone-4); --p-prone: var(--zone-0); --p-no_load: var(--st-empty-line); --p-none: var(--st-empty-line);
  display: grid; gap: var(--s-5); align-content: start; min-width: 0;
}
.bd-page { max-width: 200rem; }
.bd [data-p="supine"] { --pc: var(--p-supine); } .bd [data-p="left"] { --pc: var(--p-left); } .bd [data-p="right"] { --pc: var(--p-right); }
.bd [data-p="left30"] { --pc: var(--p-left30); } .bd [data-p="right30"] { --pc: var(--p-right30); } .bd [data-p="semi_fowler"] { --pc: var(--p-semi_fowler); }
.bd [data-p="sitting"] { --pc: var(--p-sitting); } .bd [data-p="prone"] { --pc: var(--p-prone); } .bd [data-p="no_load"], .bd [data-p="none"] { --pc: var(--p-no_load); }

/* 그림 경고색을 상태 토큰에 맞춘다(테마 따라감) */
.bd .pc-fig { --fig-warn: var(--st-delay-line); --fig-warn-soft: var(--st-delay-bg); --fig-critical: var(--st-critical-line); --fig-critical-soft: var(--st-critical-bg); }

/* ───────── 머리말 ───────── */
.bd-head { display: grid; gap: var(--s-3); min-width: 0; }
.bd-back { display: inline-flex; align-items: center; gap: var(--s-1); width: max-content; font-size: var(--fs-13); font-weight: 600; color: var(--text-2); text-decoration: none; margin-left: -.25rem; padding: .125rem .25rem; border-radius: var(--r-chip); transition: color var(--d-fast), background-color var(--d-fast); }
.bd-back:hover { color: var(--text); background: var(--hover); }
.bd-back .icon { width: 1rem; height: 1rem; }
.bd-head-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3) var(--s-5); flex-wrap: wrap; min-width: 0; }
.bd-head-row2 { align-items: flex-start; }
.bd-id { display: flex; align-items: baseline; gap: var(--s-4); flex-wrap: wrap; min-width: 0; }
.bd-label { font-size: var(--fs-bed-lg); font-weight: 750; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.bd-who { display: inline-flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; min-width: 0; }
.bd-patient { font-size: var(--fs-16); font-weight: 600; color: var(--text); }
.bd-chips { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; min-width: 0; flex: 1 1 24rem; }
.bd-chips .badge, .bd-chips .chip { height: 1.625rem; padding: 0 .5625rem; font-size: var(--fs-12); }
.bd-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; justify-content: flex-end; }
.bd-head-sk { display: grid; gap: var(--s-2); }
.bd-sk-title { height: 2rem; width: 12rem; }
.bd-sk-line { height: .875rem; width: min(24rem, 60%); }

/* ───────── 격자 ───────── */
.bd-grid { display: grid; gap: var(--s-5); grid-template-columns: minmax(0, 1fr); align-items: start; min-width: 0; }
.bd-side { display: grid; gap: var(--s-5); min-width: 0; }
.bd-main { display: grid; gap: var(--s-5); grid-template-columns: minmax(0, 1fr); grid-template-areas: "tl" "dose" "data" "log" "alerts"; align-items: start; min-width: 0; }
.bd-pair { display: contents; }
.bd-tl { grid-area: tl; } .bd-dose { grid-area: dose; } .bd-data { grid-area: data; } .bd-log { grid-area: log; } .bd-alerts { grid-area: alerts; }
@media (min-width: 1100px) {
  .bd:not(.bd-compact) .bd-grid { grid-template-columns: minmax(23rem, 31rem) minmax(0, 1fr); }
  .bd:not(.bd-compact) .bd-side { position: sticky; top: calc(var(--strip-h) + var(--topbar-h) + var(--alarm-h, 0px) + var(--s-4)); }
}
@media (min-width: 1440px) {
  .bd:not(.bd-compact) .bd-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "tl tl" "dose data" "log log" "alerts alerts"; }
}
@media (min-width: 1900px) {
  .bd:not(.bd-compact) .bd-grid { grid-template-columns: minmax(26rem, 34rem) minmax(0, 1fr); gap: var(--s-6); }
  .bd:not(.bd-compact) .bd-main { grid-template-columns: minmax(0, 1.55fr) minmax(22rem, 1fr); grid-template-areas: "tl tl" "log dose" "log data" "log alerts"; gap: var(--s-6); }
  .bd:not(.bd-compact) .bd-fig { max-width: 31rem; }
}

/* ───────── 카드 ───────── */
.bd-card { padding: 0; display: grid; min-width: 0; }
.bd-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; padding: var(--s-4) var(--s-5) 0; }
.bd-card-head h2 { font-size: var(--fs-16); font-weight: 650; letter-spacing: var(--tracking-title); }
.bd-card-sub { font-size: var(--fs-12); color: var(--text-2); margin-top: 2px; font-variant-numeric: tabular-nums; }
.bd-card-sub:empty { display: none; }
.bd-card-tools { display: flex; align-items: center; gap: var(--s-2); }
.bd-card-tools:empty { display: none; }
.bd-card-body { padding: var(--s-4) var(--s-5) var(--s-5); min-width: 0; }
.bd-card-body .empty-state { padding: var(--s-7) var(--s-4); }

/* ───────── 영웅 ───────── */
.bd-hero { padding: var(--s-5); display: grid; gap: var(--s-4); }
.bd-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); min-height: 2.75rem; }
.bd-pose { display: grid; gap: 2px; min-width: 0; }
.bd-pose-name { font-size: var(--fs-20); font-weight: 700; letter-spacing: -.015em; line-height: 1.2; }
.bd-pose-sub { font-size: var(--fs-13); color: var(--text-2); font-variant-numeric: tabular-nums; min-height: 1.2em; }
.bd-turning { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--st-active-fg); }
.bd-turning .icon { width: 1.125rem; height: 1.125rem; animation: bd-spin var(--d-spin) var(--ease) infinite; }
@keyframes bd-spin { to { transform: rotate(360deg); } }
.bd-hero-right { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; justify-content: flex-end; }
.bd-live { display: inline-flex; align-items: center; gap: .375rem; font-size: var(--fs-12); font-weight: 600; color: var(--st-fg); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bd-live i { width: .4375rem; height: .4375rem; border-radius: 50%; background: var(--st-line); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-line) 18%, transparent); }
.bd-live[data-st="done"] i { animation: bd-breath var(--d-breath) var(--ease-in-out) var(--loop); }
@keyframes bd-breath { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--st-line) 6%, transparent); } }
.bd-hero-alert { display: grid; gap: var(--s-2); }
.bd-hero-alert:empty { display: none; }
.bd-hero-al { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3); border-radius: var(--r-ctl); background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-13); min-width: 0; }
.bd-hero-al[data-lv="p1"] { background: var(--st-critical-bg); border-color: color-mix(in srgb, var(--st-critical-line) 35%, transparent); }
.bd-hero-al[data-lv="p2"] { background: var(--st-delay-bg); border-color: color-mix(in srgb, var(--st-delay-line) 30%, transparent); }
.bd-hero-al .muted { margin-left: auto; font-size: var(--fs-12); white-space: nowrap; }
.bd-fig-wrap { display: grid; justify-items: center; min-width: 0; margin: 0 calc(var(--s-2) * -1); }
.bd-fig { width: 100%; max-width: 28rem; min-height: 12rem; }
.bd-compact .bd-fig { max-width: 22rem; }

/* 범례 */
.bd-legend { display: grid; gap: var(--s-3); padding-top: var(--s-2); border-top: 1px solid var(--border); }
.bd-heat { display: grid; gap: .375rem; padding-top: 1.125rem; }
.bd-heat-track { position: relative; }
.bd-heat-bar { height: .5rem; border-radius: var(--r-full); box-shadow: inset 0 0 0 1px var(--hairline); }
.bd-heat-tick { position: absolute; top: -.25rem; width: 2px; height: 1rem; margin-left: -1px; border-radius: 1px; background: var(--text); }
.bd-heat-tick b { position: absolute; bottom: calc(100% + 2px); left: 50%; translate: -50% 0; font-size: var(--fs-12); font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bd-heat-scale { display: flex; justify-content: space-between; font-size: var(--fs-12); color: var(--text-3); font-variant-numeric: tabular-nums; }
.bd-legend-keys, .bd-tl-keys { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); font-size: var(--fs-12); color: var(--text-2); align-items: center; }
.bd-key { display: inline-flex; align-items: center; gap: .375rem; white-space: nowrap; }
.bd-key b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.bd-key .icon { width: .875rem; height: .875rem; }
.bd-key.is-turning { color: var(--st-active-fg); font-weight: 600; }
.bd-key-dot { width: .625rem; height: .625rem; border-radius: 3px; background: var(--pc, var(--st-empty-line)); flex: none; }
.bd-key-dot[data-p="gap"] { background: repeating-linear-gradient(135deg, var(--border-strong) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--border); }
.bd-key-line { width: 2px; height: .75rem; border-radius: 1px; background: var(--text); }

/* 영웅 아래 숫자 */
.bd-hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; border-radius: var(--r-ctl); overflow: hidden; background: var(--border); border: 1px solid var(--border); }
.bd-stat { display: grid; gap: 2px; align-content: start; padding: var(--s-3); background: var(--surface); min-width: 0; }
.bd-stat-l { font-size: var(--fs-12); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-stat-v { font-size: var(--fs-20); font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-stat-s { font-size: var(--fs-12); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.bd-stat[data-st] .bd-stat-v, .bd-stat[data-st] .bd-stat-s { color: var(--st-fg); }
.bd-stat[data-st="normal"] .bd-stat-v { color: var(--text); }
.bd-stat[data-st="normal"] .bd-stat-s { color: var(--text-3); }
.bd-compact .bd-hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) and (min-width: 769px) { .bd:not(.bd-compact) .bd-hero-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ───────── 24시간 타임라인 ───────── */
.bd-tl-wrap { position: relative; padding: 1rem 0 1.75rem; }
.bd-tl-band { position: relative; height: 1.75rem; border-radius: var(--r-chip); background: var(--surface-2); overflow: hidden; box-shadow: inset 0 0 0 1px var(--hairline); }
.bd-tl-seg { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--pc, var(--st-empty-line)) 82%, var(--surface)); box-shadow: inset -1px 0 0 color-mix(in srgb, var(--surface) 70%, transparent); transition: background-color var(--d-base); }
.bd-tl-seg[data-p="gap"] { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--border-strong) 80%, transparent) 0 3px, transparent 3px 7px); box-shadow: none; }
.bd-tl-seg:hover { filter: brightness(1.08); }
.bd-tl-marks { position: absolute; left: 0; right: 0; top: 0; height: .875rem; }
.bd-tl-mark { display: inline-block; width: .625rem; height: .625rem; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 2px var(--surface); flex: none; }
.bd-tl-marks .bd-tl-mark { position: absolute; top: .125rem; translate: -50% 0; }
.bd-tl-mark[data-kind="partial"] { background: linear-gradient(90deg, var(--text) 50%, var(--surface) 50%); box-shadow: 0 0 0 1.5px var(--text), 0 0 0 3px var(--surface); }
.bd-tl-mark[data-kind="self"] { background: var(--surface); box-shadow: inset 0 0 0 2px var(--text-2), 0 0 0 2px var(--surface); }
.bd-tl-mark[data-by="unknown"] { opacity: .7; }
.bd-tl-dues { position: absolute; left: 0; right: 0; top: 2.875rem; height: .5rem; }
.bd-tl-due { position: absolute; top: 0; width: 2px; height: .4375rem; margin-left: -1px; border-radius: 1px; background: var(--st-due-line); }
.bd-tl-due[data-result="ontime"], .bd-tl-due[data-result="early"] { background: var(--st-done-line); }
.bd-tl-due[data-result="late"], .bd-tl-due[data-result="partial"] { background: var(--st-delay-line); }
.bd-tl-due[data-result="missed"] { background: var(--st-critical-line); }
.bd-tl-due-key { width: 2px; height: .625rem; border-radius: 1px; background: var(--st-due-line); }
.bd-tl-axis { position: absolute; left: 0; right: 0; bottom: 0; height: 1rem; font-size: var(--fs-12); color: var(--text-3); font-variant-numeric: tabular-nums; }
.bd-tl-axis span { position: absolute; translate: -50% 0; white-space: nowrap; }
.bd-tl-axis .bd-tl-now { right: 0; translate: 0 0; color: var(--text-2); font-weight: 600; }
.bd-tl-keys2 { margin-top: var(--s-2); padding-top: var(--s-3); border-top: 1px dashed var(--border); color: var(--text-3); }

/* ───────── 부위별 오늘 누적 ───────── */
.bd-dose-list { display: grid; gap: var(--s-3); list-style: none; margin: 0; padding: 0; }
.bd-dose-row { display: grid; grid-template-columns: minmax(6.5rem, 9rem) minmax(0, 1fr) minmax(6.5rem, max-content); gap: var(--s-3); align-items: center; font-size: var(--fs-13); }
.bd-dose-name { display: inline-flex; align-items: center; gap: .375rem; min-width: 0; font-weight: 550; }
.bd-dose-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-dose-track { position: relative; height: .625rem; border-radius: var(--r-full); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hairline); }
.bd-dose-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; background: color-mix(in srgb, var(--brand) 70%, var(--surface)); transition: width var(--d-slow) var(--ease); }
.bd-dose-row[data-level="warn"] .bd-dose-fill { background: var(--st-delay-line); }
.bd-dose-row[data-level="over"] .bd-dose-fill { background: var(--st-critical-line); }
.bd-dose-limit { position: absolute; top: -.25rem; bottom: -.25rem; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--text); opacity: .7; }
.bd-dose-val { display: grid; justify-items: end; line-height: 1.25; font-variant-numeric: tabular-nums; }
.bd-dose-val b { font-size: var(--fs-14); font-weight: 650; }
.bd-dose-row[data-level="warn"] .bd-dose-val b { color: var(--st-delay-fg); }
.bd-dose-row[data-level="over"] .bd-dose-val b { color: var(--st-critical-fg); }
.bd-dose-val span { font-size: var(--fs-12); color: var(--text-3); white-space: nowrap; }
.bd-wound-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--st-critical-line); box-shadow: 0 0 0 2px color-mix(in srgb, var(--st-critical-line) 22%, transparent); flex: none; display: inline-block; }
.bd-dose-row.is-wound .bd-dose-name { color: var(--st-critical-fg); }
.bd-dose-legend { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); margin-top: var(--s-4); padding-top: var(--s-3); border-top: 1px dashed var(--border); font-size: var(--fs-12); color: var(--text-3); }
.bd-dose-legend > span { display: inline-flex; align-items: center; gap: .375rem; }
.bd-dose-limit-key { width: 2px; height: .75rem; border-radius: 1px; background: var(--text); opacity: .7; }
.bd-sw { width: .625rem; height: .375rem; border-radius: var(--r-full); }
.bd-sw[data-level="warn"] { background: var(--st-delay-line); } .bd-sw[data-level="over"] { background: var(--st-critical-line); }

/* ───────── 수행 로그 ───────── */
.bd-evidence-note { display: inline-flex; align-items: center; gap: .375rem; font-size: var(--fs-12); color: var(--text-2); padding: .25rem .5rem; border-radius: var(--r-chip); background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.bd-evidence-note .icon { width: .8125rem; height: .8125rem; }
.bd-ok { display: inline-flex; align-items: center; gap: .25rem; color: var(--st-done-fg); font-weight: 600; }
.bd-bad { display: inline-flex; align-items: center; gap: .25rem; color: var(--st-critical-fg); font-weight: 600; }
.bd-log .bd-card-body { container-type: inline-size; }

.bd-logt { display: grid; min-width: 0; }
.bd-log-row { display: grid; grid-template-columns: 3.75rem minmax(10rem, 1.5fr) minmax(7.5rem, 1fr) 4.5rem 6.25rem minmax(6rem, 1.2fr) max-content; gap: var(--s-3); align-items: center; padding: var(--s-3) 0; border-bottom: 1px solid var(--border); font-size: var(--fs-13); min-width: 0; }
.bd-log-row > * { min-width: 0; }
.bd-log-row:last-child { border-bottom: 0; }
.bd-log-head { padding: 0 0 var(--s-2); font-size: var(--fs-12); font-weight: 600; color: var(--text-2); border-bottom: 1px solid var(--border); }
.bd-c-time { display: grid; gap: 2px; justify-items: start; font-variant-numeric: tabular-nums; }
.bd-c-time b { font-size: var(--fs-14); font-weight: 650; }
.bd-c-change { display: grid; gap: 1px; }
.bd-c-change b { font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.bd-c-change .muted { font-size: var(--fs-12); }
.bd-kind { font-size: var(--fs-12); font-weight: 600; color: var(--text-3); }
.bd-kind[data-kind="turn"] { color: var(--st-done-fg); } .bd-kind[data-kind="partial_turn"] { color: var(--st-caution-fg); }
.bd-kind[data-kind="exit"], .bd-kind[data-kind="fall_suspect"] { color: var(--st-critical-fg); } .bd-kind[data-kind="overdue"] { color: var(--st-delay-fg); }
.bd-c-actor { display: flex; flex-wrap: wrap; gap: .25rem .375rem; align-items: center; }
.bd-basis { display: inline-flex; align-items: center; height: 1.25rem; padding: 0 .375rem; border-radius: .3125rem; font-size: var(--fs-12); font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.bd-basis[data-prox="true"] { background: var(--brand-soft); color: var(--brand-soft-fg); border-color: transparent; }
.bd-c-stay { font-variant-numeric: tabular-nums; color: var(--text-2); }
.bd-c-note { display: grid; gap: .25rem; justify-items: start; }
.bd-annos { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.bd-annos li { display: grid; padding-left: .5rem; border-left: 2px solid var(--border-strong); }
.bd-annos small { font-size: var(--fs-12); color: var(--text-3); }
.bd-photo-badge { cursor: pointer; font: inherit; font-size: var(--fs-12); }
.bd-c-act { display: flex; justify-content: flex-end; }
.bd-more { font-size: var(--fs-12); padding-top: var(--s-3); }
/* 좁은 칸(서랍·폰·작은 화면): 한 줄을 두 단 카드로 */
@container (max-width: 680px) {
  .bd-log-head { display: none; }
  .bd-log-row { grid-template-columns: 3.5rem minmax(0, 1fr) auto; grid-template-areas: "time change judge" "time actor act" "time note note"; gap: .25rem var(--s-3); align-items: start; }
  .bd-c-time { grid-area: time; } .bd-c-change { grid-area: change; } .bd-c-judge { grid-area: judge; justify-self: end; }
  .bd-c-actor { grid-area: actor; align-self: center; } .bd-c-stay { display: none; } .bd-c-note { grid-area: note; } .bd-c-act { grid-area: act; align-self: center; }
  .bd-c-actor.is-empty, .bd-c-note.is-empty, .bd-c-judge > .muted { display: none; }
  .bd-c-act .btn { height: 1.75rem; }
}

/* ───────── 알림 이력 ───────── */
.bd-al-list { list-style: none; margin: 0; padding: 0; display: grid; }
.bd-al-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-3); align-items: center; padding: var(--s-3) 0 var(--s-3) var(--s-3); border-bottom: 1px solid var(--border); position: relative; font-size: var(--fs-13); }
.bd-al-row:last-child { border-bottom: 0; }
.bd-al-row::before { content: ""; position: absolute; left: 0; top: var(--s-3); bottom: var(--s-3); width: 3px; border-radius: 2px; background: var(--lv-p4); opacity: .5; }
.bd-al-row[data-lv="p1"]::before { background: var(--lv-p1); } .bd-al-row[data-lv="p2"]::before { background: var(--lv-p2); } .bd-al-row[data-lv="p3"]::before { background: var(--lv-p3); }
.bd-al-row.is-live::before { opacity: 1; }
.bd-al-main { display: grid; gap: 1px; min-width: 0; }
.bd-al-main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-al-main .muted { font-size: var(--fs-12); font-variant-numeric: tabular-nums; }

/* ───────── 함께 쌓인 데이터 ───────── */
.bd-dt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr)); gap: var(--s-2); }
.bd-data .bd-card-body { container-type: inline-size; }
.bd-dt { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3); border-radius: var(--r-ctl); background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.bd-dt > div { display: grid; gap: 1px; min-width: 0; }
.bd-dt-ic { width: 1.75rem; height: 1.75rem; display: grid; place-items: center; flex: none; border-radius: .5rem; background: var(--surface); color: var(--text-2); box-shadow: 0 0 0 1px var(--border); }
.bd-dt-ic .icon { width: .9375rem; height: .9375rem; }
.bd-dt-l { font-size: var(--fs-12); color: var(--text-2); line-height: 1.3; }
.bd-dt-v { font-size: var(--fs-16); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bd-dt-v small { font-size: var(--fs-12); font-weight: 550; color: var(--text-2); margin-left: 2px; }
.bd-dt-s { font-size: var(--fs-12); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-dt[data-st] { background: var(--st-bg); border-color: var(--st-border); }
.bd-dt[data-st] .bd-dt-v, .bd-dt[data-st] .bd-dt-ic { color: var(--st-fg); }
@container (max-width: 340px) { .bd-dt-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 7.25rem), 1fr)); } .bd-dt-ic { display: none; } .bd-dt { padding: var(--s-2) var(--s-3); } }

/* ───────── 실패·서랍 ───────── */
.bd-refresh-err { min-width: 0; }
.bd-fail { padding: var(--s-6) 0; }
.bd-panel { min-width: 0; }
.bd-compact { gap: var(--s-4); }
.bd-compact .bd-label { font-size: var(--fs-bed); }
.bd-compact .bd-patient { font-size: var(--fs-14); }
.bd-compact .bd-main, .bd-compact .bd-grid { gap: var(--s-4); }
.bd-compact .bd-card-head { padding: var(--s-3) var(--s-4) 0; }
.bd-compact .bd-card-body { padding: var(--s-3) var(--s-4) var(--s-4); }
.bd-compact .bd-hero { padding: var(--s-4); }
.bd-compact .bd-actions { justify-content: flex-start; }

/* ───────── 대화상자(보고·사유) ───────── */
.bd-anno-target { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-3); border-radius: var(--r-ctl); background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-13); }
.bd-anno-time { font-size: var(--fs-16); font-weight: 700; font-variant-numeric: tabular-nums; padding-right: var(--s-3); border-right: 1px solid var(--border); }
.bd-anno-target .muted { font-size: var(--fs-12); }
.bd-count { justify-self: end; font-variant-numeric: tabular-nums; }
.bd-evidence { display: flex; gap: var(--s-2); align-items: flex-start; font-size: var(--fs-12); color: var(--text-2); }
.bd-evidence .icon { width: .875rem; height: .875rem; flex: none; margin-top: 2px; }
.bd-form-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
.bd-skin { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); gap: var(--s-2); }
.bd-skin-opt { display: flex; align-items: center; gap: var(--s-2); min-height: var(--h-md); padding: 0 var(--s-3); border-radius: var(--r-ctl); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-13); text-align: left; cursor: pointer; transition: border-color var(--d-fast), background-color var(--d-fast); }
.bd-skin-opt:hover { border-color: var(--text-3); }
.bd-skin-opt i { width: 1rem; height: 1rem; border-radius: .3125rem; border: 1.5px solid var(--border-strong); flex: none; transition: background-color var(--d-fast), border-color var(--d-fast); }
.bd-skin-opt[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-soft-fg); font-weight: 600; }
.bd-skin-opt[aria-pressed="true"] i { background: var(--brand); border-color: var(--brand); box-shadow: inset 0 0 0 2px var(--surface); }
.bd-photo-note { display: flex; gap: var(--s-2); align-items: flex-start; padding: var(--s-3); border-radius: var(--r-ctl); background: var(--st-delay-bg); border: 1px solid var(--st-border, var(--border)); color: var(--text-2); font-size: var(--fs-12); line-height: 1.5; }
.bd-photo-note[data-st], .bd-photo-note { --st-border: color-mix(in srgb, var(--st-delay-line) 30%, transparent); }
.bd-photo-note b { color: var(--st-delay-fg); font-size: var(--fs-13); }
.bd-photo-note .icon { width: 1rem; height: 1rem; color: var(--st-delay-line); flex: none; margin-top: 1px; }
.bd-thumbs { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.bd-thumb, .bd-thumb-add { position: relative; width: 5rem; height: 5rem; border-radius: var(--r-ctl); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.bd-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bd-thumb .btn { position: absolute; top: 2px; right: 2px; width: 1.5rem; height: 1.5rem; min-height: 0; padding: 0; background: var(--surface); box-shadow: var(--shadow-1); }
.bd-thumb-add { display: grid; place-items: center; align-content: center; gap: 2px; border-style: dashed; border-color: var(--border-strong); color: var(--text-2); font-size: var(--fs-12); cursor: pointer; transition: border-color var(--d-fast), color var(--d-fast); }
.bd-thumb-add:hover { border-color: var(--brand); color: var(--brand); }
.bd-thumb-add:focus-within, #bd-photo-in:focus-visible + .bd-thumb-add { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.bd-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr)); gap: var(--s-3); }
.bd-photo-grid figure { display: grid; gap: var(--s-1); }
.bd-photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-ctl); border: 1px solid var(--border); }
.bd-photo-grid figcaption { font-size: var(--fs-12); color: var(--text-2); }

/* ───────── 폰 ───────── */
@media (max-width: 768px) {
  .bd { gap: var(--s-4); }
  .bd-grid, .bd-main { gap: var(--s-4); }
  .bd-label { font-size: var(--fs-bed); }
  .bd-hero { padding: var(--s-4); }
  .bd-fig-wrap { margin: 0 calc(var(--s-3) * -1); }
  .bd-hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bd-card-head { padding: var(--s-3) var(--s-4) 0; }
  .bd-card-body { padding: var(--s-3) var(--s-4) var(--s-4); }
  .bd-actions { width: 100%; justify-content: stretch; }
  .bd-actions > * { flex: 1 1 auto; justify-content: center; }
  .bd-dose-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name val" "track track"; gap: .375rem var(--s-3); }
  .bd-dose-name { grid-area: name; } .bd-dose-val { grid-area: val; display: flex; gap: var(--s-2); align-items: baseline; } .bd-dose-track { grid-area: track; }
  .bd-form-2 { grid-template-columns: minmax(0, 1fr); }
  .bd-evidence-note { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  .bd-turning .icon, .bd-live[data-st="done"] i { animation: none; }
}

/* 보고 사진: 변경 전 · 변경 후 두 칸 (폰에서는 위아래로) */
.bd-phases { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.bd-phase { border: 1px solid var(--border); border-radius: var(--r-card, 12px); padding: var(--s-3); background: var(--surface); display: grid; gap: var(--s-2); align-content: start; }
.bd-phase[data-phase="before"] { border-color: color-mix(in srgb, var(--st-delay-line) 45%, var(--border)); }
.bd-phase[data-phase="after"] { border-color: color-mix(in srgb, var(--st-active-line) 45%, var(--border)); }
.bd-phase-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-2); font-size: var(--fs-13, 13px); }
.bd-phase-h .muted { font-size: var(--fs-12); }
@media (max-width: 560px) { .bd-phases { grid-template-columns: 1fr; } .bd-thumb, .bd-thumb-add { width: 5.5rem; height: 5.5rem; } }

/* 침대 서랍: 알림 줄 아래에 처리 단추(내가 갈게요·보류·해결·보고) */
.bd-al-row { flex-wrap: wrap; }
.bd-al-acts { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: var(--s-2); padding-top: var(--s-2); }
.bd-al-acts .btn { min-height: 2.25rem; }
@media (max-width: 768px) { .bd-al-acts .btn { min-height: 2.75rem; flex: 1 1 auto; } }

/* 알림 처리 영역(팝업·침대 서랍 공통, alert-flow.js bigActions): 바쁜 손으로도 누르기 쉽게 큼직하게 */
.al-big { display: grid; gap: var(--s-3); width: 100%; }
.al-primary { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 3.75rem; padding: 0 var(--s-5); border: 0; border-radius: 16px; cursor: pointer;
  font: inherit; font-size: 1.125rem; font-weight: 700; letter-spacing: -.01em; color: var(--brand-fg); background: var(--brand);
  box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--brand) 70%, transparent), inset 0 1px 0 rgb(255 255 255 / .18);
  transition: transform var(--d-fast) var(--ease), box-shadow var(--d-base) var(--ease), filter var(--d-fast) var(--ease); }
.al-primary svg { width: 1.5rem; height: 1.5rem; flex: none; }
.al-primary.is-danger { background: var(--st-critical-line); color: var(--brand-fg); box-shadow: 0 8px 22px -6px color-mix(in srgb, var(--st-critical-line) 75%, transparent), inset 0 1px 0 rgb(255 255 255 / .2); }
.al-primary:hover { filter: brightness(1.06); }
.al-primary:active { transform: scale(.98); }
.al-primary.is-busy, .al-tile.is-busy { opacity: .65; pointer-events: none; }
.al-tiles { display: grid; gap: var(--s-2); grid-template-columns: repeat(auto-fit, minmax(5.25rem, 1fr)); }
.al-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 4.5rem; padding: var(--s-2); cursor: pointer;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); color: var(--text); font: inherit; font-size: .9375rem; font-weight: 600;
  transition: transform var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease), background-color var(--d-fast) var(--ease); }
.al-tile svg { width: 1.5rem; height: 1.5rem; color: var(--brand); }
.al-tile:hover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface-2)); }
.al-tile:active { transform: scale(.97); }
.al-tile.is-quiet { color: var(--text-2); } .al-tile.is-quiet svg { color: var(--text-3, var(--text-2)); }
.bd-al-row .al-big { flex-basis: 100%; margin-top: var(--s-2); }
.bd-hero-al { flex-direction: column; align-items: stretch; gap: var(--s-3); padding: var(--s-3); }
.bd-hero-al-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); }

/* 새 알림 팝업 */
.ap { display: grid; gap: var(--s-4); min-width: min(100%, 22rem); }
.ap-top { display: flex; align-items: center; gap: var(--s-3); }
.ap-ico { display: grid; place-items: center; width: 3.5rem; height: 3.5rem; flex: none; border-radius: 50%; background: var(--st-delay-bg); color: var(--st-delay-fg); }
.ap[data-lv="p1"] .ap-ico { background: var(--st-critical-bg); color: var(--st-critical-fg); animation: ap-ring var(--d-breath) var(--ease-in-out) var(--loop); }
.ap-ico svg { width: 1.75rem; height: 1.75rem; }
.ap-who { display: grid; flex: 1; min-width: 0; }
.ap-bed { font-size: 2.25rem; line-height: 1.05; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ap-kind { font-size: 1.0625rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-sub { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); color: var(--text-2); font-size: var(--fs-13, 13px); }
.ap-age { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.ap-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.ap-link { color: var(--brand); font-size: var(--fs-13, 13px); }
.ap-later { border: 0; background: none; color: var(--text-2); padding: var(--s-3) var(--s-2); min-height: 2.75rem; cursor: pointer; font: inherit; }
@keyframes ap-ring { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--st-critical-line) 0%, transparent); } 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--st-critical-line) 24%, transparent); } }
@media (max-width: 560px) { .al-primary { min-height: 4rem; } .al-tiles { grid-template-columns: repeat(auto-fit, minmax(4.75rem, 1fr)); } .ap-bed { font-size: 2rem; } }
