/* MediMind — 통증 부위 그림 칸 · 작은 그림 (body-map.js, rules.mjs PAIN_MAP). 오른쪽에서 나오는 칸은 약제 변경 · 내원 이력과 같은 움직임(visit.css v-slide). */
.bm-back { position: fixed; inset: 0; z-index: 40; background: rgb(24 33 31 / 0.28); animation: v-fade .18s ease-out; }
.bm-back[hidden], .bm[hidden] { display: none; }
.bm { position: fixed; top: 0; right: 0; bottom: 0; z-index: 41; width: min(600px, 100vw); display: flex; flex-direction: column; background: var(--a-surface); border-left: 1px solid var(--a-line); box-shadow: var(--a-e2); outline: none; animation: v-slide .18s ease-out; }
.bm[data-closing] { animation: v-slide-out .16s ease-in forwards; pointer-events: none; }
.bm-back[data-closing] { animation: v-fade-out .16s ease-in forwards; pointer-events: none; }

.bm-h { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px 16px; flex-wrap: wrap; }
.bm-title { font-size: 15px; color: var(--a-ink); white-space: nowrap; margin-right: 4px; }
.bm-tabs, .bm-lr { display: inline-flex; border: 1px solid var(--a-line-strong); border-radius: 8px; overflow: hidden; }
.bm-tab, .bm-lr-b { position: relative; min-height: 32px; padding: 0 11px; border: 0; background: var(--a-surface); color: var(--a-ink-2); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; word-break: keep-all; }
.bm-tab + .bm-tab, .bm-lr-b + .bm-lr-b { border-left: 1px solid var(--a-line-strong); }
.bm-tab:hover, .bm-lr-b:hover { background: var(--a-row-hover); color: var(--a-ink); }
.bm-tab[aria-selected="true"], .bm-lr-b[aria-pressed="true"] { background: var(--a-accent); color: #fff; font-weight: 700; }
/* 그린 것이 있는 모형: 글자 오른쪽 위 작은 점 */
.bm-tab[data-ink]::after, .bm-lr-b[data-ink]::after { content: ""; position: absolute; top: 5px; right: 3px; width: 5px; height: 5px; border-radius: 50%; background: #d0383d; }
.bm-tab[aria-selected="true"][data-ink]::after, .bm-lr-b[aria-pressed="true"][data-ink]::after { background: #fff; }
.bm-x { margin-left: auto; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--a-muted); font: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.bm-x:hover { background: var(--a-row-hover); color: var(--a-ink); }

.bm-tools { display: flex; align-items: center; gap: 6px; padding: 0 16px 10px; flex-wrap: wrap; border-bottom: 1px solid var(--a-line-soft); }
.bm-tool { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 1px solid var(--a-line-strong); border-radius: 8px; background: var(--a-surface); color: var(--a-ink-2); font: inherit; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.bm-tool:hover:not(:disabled) { border-color: var(--a-accent); }
.bm-tool[aria-pressed="true"] { background: var(--a-accent-soft); border-color: var(--a-accent); color: var(--a-accent); font-weight: 700; }
.bm-tool:disabled { color: var(--a-disabled-ink); border-color: var(--a-line); cursor: default; }
.bm-tool-q { border-color: var(--a-line); }
.bm-swatch { width: 12px; height: 12px; flex: none; }
.bm-gap { flex: 1; }

.bm-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 10px; background: var(--a-sunken); }
.bm-svg { display: block; height: 100%; max-width: 100%; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.bm-svg[data-tool="pen"] { cursor: crosshair; }
.bm-svg[data-tool="eraser"] { cursor: cell; }
.bm-svg:not([data-tool="eraser"]) .bm-ring { display: none; }

.bm-f { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--a-line-soft); min-height: 56px; }
.bm-sum { flex: 1; min-width: 0; font-size: 13.5px; color: var(--a-ink); word-break: keep-all; }
.bm-sum p { margin: 0; line-height: 1.45; }
.bm-save { flex: none; min-width: 84px; }

/* 작은 그림: 진료 기록 아래 · 지난 진료 기록. 누르면 크게(테두리 = 누를 수 있음). */
.bm-thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.bm-thumb { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 6px 3px; border: 1px solid var(--a-line); border-radius: 8px; background: var(--a-surface); color: var(--a-muted); font: inherit; font-size: 11px; cursor: pointer; }
.bm-thumb:hover { border-color: var(--a-accent); color: var(--a-ink); }
.bm-thumb svg { display: block; height: 96px; width: auto; }

@media (max-width: 600px) {
  .bm { border-left: 0; }
  .bm-h { padding: 8px 10px 6px 12px; row-gap: 6px; }
  .bm-tabs { order: 3; width: 100%; overflow-x: auto; }
  .bm-tab { flex: 1 0 auto; padding: 0 8px; }
  .bm-lr { order: 4; }
  .bm-tools { padding: 0 12px 8px; }
  .bm-tool { padding: 0 9px; }
  .bm-f { padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) { .bm, .bm-back { animation: none; } }
@media print { .bm, .bm-back { display: none !important; } }

/* 진료 화면: 도구 줄의 '통증 부위' 단추 · 진료 기록 줄 아래의 작은 그림 */
.v-tool-pain { display: inline-flex; align-items: center; gap: 5px; }
.v-pain-ico { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.v-pain-ico circle { fill: currentColor; stroke: none; }
.v-pain { margin: 8px 16px 4px; }
.v-pain:empty { display: none; }
.rec-pain { align-items: start; }
.rec-pain .bm-thumb svg { height: 72px; }
