/* ==========================================================
   재활 평가 추적 시스템 — 프로토타입 스타일
   토큰 기반: 라이트/다크 모두 명시적으로 설계
   ========================================================== */

:root {
  color-scheme: light;

  /* 시안 D — 카드가 뜨는 바탕은 옅은 톤, 카드는 흰색 */
  --page: #f2f5f4;
  --surface: #ffffff;
  --surface-2: #f7f9f8;
  --surface-3: #e2e8e7;

  --ink: #171d1d;
  --ink-2: #3f4948;
  --ink-3: #6f7978;

  --line: #e2e8e7;
  --line-strong: #cfd9d8;

  --accent: #00696b;
  --accent-hover: #00565a;
  --accent-ink: #ffffff;
  --accent-soft: #cce8e6;
  --accent-line: #9fd5d2;
  --accent-deep: #00363a;

  --good: #1e6b3f;
  --warning: #8a5a00;
  --serious: #8b4513;
  --critical: #8c0009;
  --good-ink: #1e6b3f;
  --warning-ink: #8a5a00;
  --serious-ink: #8b4513;
  --critical-ink: #8c0009;
  --good-bg: #c9edd4;
  --warning-bg: #ffdea6;
  --serious-bg: #ffdbc8;
  --critical-bg: #ffdad6;

  /* 분기 서열 램프 — 앱 고유 색 한 계열 (sequential) */
  --q1: #cce8e6;
  --q2: #a5d9d6;
  --q3: #74c2bf;
  --q4: #3d9d9c;
  --q5: #1f7d7e;
  --q6: #00575a;
  --q-ink-light: #00363a;   /* 밝은 단계 위 글자 */
  --q-ink-dark: #ffffff;    /* 어두운 단계 위 글자 */

  --plot-line: #00696b;
  --plot-fill: rgba(0, 105, 107, 0.12);
  --grid: #e6ebea;
  --axis: #cfd9d8;

  --shadow: none;

  --sans: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo",
    "Malgun Gothic", "맑은 고딕", system-ui, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "D2Coding", monospace;

  /* 시안 D — 카드는 크게 굴리고, 누르는 것은 알약 */
  --r: 24px;
  --r-tile: 20px;
  --r-field: 14px;
  --r-sm: 999px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0f1514;
    --surface: #1a2221;
    --surface-2: #202927;
    --surface-3: #2b3533;
    --ink: #dee4e3;
    --ink-2: #b0bab9;
    --ink-3: #8a9593;
    --line: #2b3533;
    --line-strong: #3d4746;
    --accent: #58d9d8;
    --accent-hover: #86eceb;
    --accent-ink: #003739;
    --accent-soft: #334b4a;
    --accent-line: #3d5b5a;
    --accent-deep: #cce8e6;
    --good-ink: #7ddb9c;
    --warning-ink: #f4c66a;
    --serious-ink: #f2ab84;
    --critical-ink: #ffb4ab;
    --good-bg: #16301f;
    --warning-bg: #362a10;
    --serious-bg: #352013;
    --critical-bg: #3a1512;
    --q1: #b7e6e4;
    --q2: #8ed4d1;
    --q3: #5fb9b7;
    --q4: #34918f;
    --q5: #1c6f70;
    --q6: #0f5254;
    --q-ink-light: #06272c;
    --q-ink-dark: #ffffff;
    --plot-line: #58d9d8;
    --plot-fill: rgba(88, 217, 216, 0.14);
    --grid: #2b3533;
    --axis: #3d4746;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f1514;
  --surface: #1a2221;
  --surface-2: #202927;
  --surface-3: #2b3533;
  --ink: #dee4e3;
  --ink-2: #b0bab9;
  --ink-3: #8a9593;
  --line: #2b3533;
  --line-strong: #3d4746;
  --accent: #58d9d8;
  --accent-hover: #86eceb;
  --accent-ink: #003739;
  --accent-soft: #334b4a;
  --accent-line: #3d5b5a;
  --accent-deep: #cce8e6;
  --good-ink: #7ddb9c;
  --warning-ink: #f4c66a;
  --serious-ink: #f2ab84;
  --critical-ink: #ffb4ab;
  --good-bg: #16301f;
  --warning-bg: #362a10;
  --serious-bg: #352013;
  --critical-bg: #3a1512;
  --q1: #b7e6e4;
  --q2: #8ed4d1;
  --q3: #5fb9b7;
  --q4: #34918f;
  --q5: #1c6f70;
  --q6: #0f5254;
  --q-ink-light: #06272c;
  --q-ink-dark: #ffffff;
  --plot-line: #58d9d8;
  --plot-fill: rgba(88, 217, 216, 0.14);
  --grid: #2b3533;
  --axis: #3d4746;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; text-wrap: balance; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- 셸 ---------- */

.shell { display: flex; min-height: 100vh; }

.rail {
  width: 236px;
  flex: 0 0 236px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; flex-direction: column; gap: 3px; padding: 0 8px; }
.brand-mark {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.brand-name { font-size: 16px; font-weight: 650; letter-spacing: -0.02em; }
.brand-sub { font-size: 11px; color: var(--ink-3); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.nav-btn:hover { background: var(--surface-3); color: var(--ink); }
.nav-btn[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-btn .ico { width: 16px; flex: 0 0 16px; display: grid; place-items: center; }
.nav-btn .count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 4px; }
.rail-note {
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-3);
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.main { flex: 1; min-width: 0; padding: 26px 30px 64px; }
.wrap { max-width: 1160px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }

/* 그리드·플렉스 항목은 기본값(min-width:auto)이라 내용보다 작아지지 않습니다.
   이걸 풀어주지 않으면 넓은 표 하나가 페이지 전체를 가로로 밀어냅니다. */
.wrap > *, .split > *, .split-3 > *, .tiles > * { min-width: 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.page-title { font-size: 24px; letter-spacing: -0.025em; }
.page-desc { font-size: 13px; color: var(--ink-2); margin-top: 3px; max-width: 62ch; }

/* ---------- 컴포넌트 ---------- */

/* 시안 A — 카드(테두리+둥근 모서리+그림자)를 쓰지 않습니다.
   흰 면 위에 가는 선으로만 구획하고, 숫자를 주인공으로 둡니다. */
.card {
  background: var(--surface);
  border: 0;
  border-top: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 16px 18px;
}
.card + .card { margin-top: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-title { font-size: 14px; font-weight: 650; }
/* 구역 이름표 — 아주 작게, 자간을 벌려 선처럼 읽히게 */
.sect-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.card-sub { font-size: 12px; color: var(--ink-3); }

.eyebrow {
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 650;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn-danger { color: var(--critical-ink); border-color: var(--line-strong); }
.btn-danger:hover { background: var(--critical-bg); }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 11px; color: var(--ink-3); }
.progress-patient-picker {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(220px, 1fr);
  gap: 10px;
  width: min(100%, 470px);
}
.required-mark { color: var(--critical-ink); font-size: 11px; margin-left: 3px; }
.row.assessment-meta-row { align-items: flex-start; }
.patient-combobox { position: relative; min-width: 0; }
.patient-combobox input[type="text"] { padding-right: 44px; }
.patient-picker-toggle {
  position: absolute; top: 1px; right: 1px; bottom: 1px; width: 42px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-2); cursor: pointer;
}
.patient-picker-toggle:hover { background: var(--accent-soft); color: var(--accent); }
.patient-picker-popup {
  position: absolute; top: calc(100% + 5px); left: 0; right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 14%); overflow: hidden;
}
.patient-picker-options { max-height: 240px; max-height: min(240px, 40dvh); overflow-y: auto; overscroll-behavior: contain; }
.patient-picker-options [role="option"] {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; min-height: 44px; cursor: pointer; overflow-wrap: anywhere;
}
.patient-picker-options [role="option"][aria-selected="true"] { font-weight: 700; color: var(--accent); }
.patient-picker-options [role="option"]:hover,
.patient-picker-options [role="option"].is-active { background: var(--accent-soft); outline: 2px solid var(--accent); outline-offset: -2px; }
.patient-picker-status { padding: 10px 14px; font-size: 11px; color: var(--ink-3); border-top: 1px solid var(--line); }
.rater-field { border-radius: var(--r-field); }
.rater-field.is-missing select { border-color: var(--warning); background: var(--warning-bg); }
.rater-field.is-missing > label,
.rater-field.is-missing > .hint { color: var(--warning-ink); }
.save-requirement { color: var(--warning-ink); font-size: 12px; font-weight: 650; }
input[type="text"], input[type="date"], input[type="search"], select, textarea {
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  width: 100%;
  transition: border-color 0.12s;
}
input:hover, select:hover { border-color: var(--accent-line); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 60px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.grid { display: grid; gap: 14px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.badge-good { background: var(--good-bg); color: var(--good-ink); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.badge-good .dot { background: var(--good); }
.badge-warning { background: var(--warning-bg); color: var(--warning-ink); border-color: color-mix(in srgb, var(--warning) 40%, transparent); }
.badge-warning .dot { background: var(--warning); }
.badge-serious { background: var(--serious-bg); color: var(--serious-ink); border-color: color-mix(in srgb, var(--serious) 40%, transparent); }
.badge-serious .dot { background: var(--serious); }
.badge-critical { background: var(--critical-bg); color: var(--critical-ink); border-color: color-mix(in srgb, var(--critical) 35%, transparent); }
.badge-critical .dot { background: var(--critical); }
.badge-neutral { background: var(--surface-3); color: var(--ink-2); border-color: var(--line); }
.badge-neutral .dot { background: var(--ink-3); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 11.5px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- 통계 타일 ---------- */

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 22px; }
.tile {
  background: var(--surface);
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 13px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tile-label { font-size: 11.5px; color: var(--ink-2); font-weight: 500; }
.tile-value { font-family: var(--mono); font-size: 28px; font-weight: 700; letter-spacing: -0.04em; line-height: 1.1; }
.tile-value .unit { font-size: 14px; color: var(--ink-3); font-weight: 500; margin-left: 2px; letter-spacing: 0; }
.tile-foot { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; }

.meter { height: 5px; border-radius: 100px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 100px; }

/* ---------- 표 ---------- */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* 표 위에서도 세로로 미는 동작은 페이지 스크롤로 넘깁니다. */
  touch-action: pan-x pan-y;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}

/* 가로로 긴 매트릭스에서 이름 열을 고정해 어느 대상자 행인지 놓치지 않게 합니다. */
.table-scroll.sticky-first th:first-child,
.table-scroll.sticky-first td:first-child {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 2;
  box-shadow: 1px 0 0 var(--line);
}
.table-scroll.sticky-first thead th:first-child { z-index: 3; background: var(--surface-2); }
.table-scroll.sticky-first tbody tr:hover td:first-child { background: var(--surface-2); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
/* 스크롤 컨테이너 안에서는 표를 억지로 줄이지 않고 가로로 넘깁니다.
   그러지 않으면 좁은 화면에서 이름이 한 글자씩 세로로 쌓입니다. */
.table-scroll > table { min-width: max-content; }
thead th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: 0;
  color: var(--ink-3);
  font-weight: 650;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.n, th.n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.t-name { font-weight: 600; white-space: nowrap; }
.t-code { font-family: var(--mono); font-size: 12px; color: var(--ink-2); white-space: nowrap; }

.empty { padding: 40px 20px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* ---------- 검사 입력 ---------- */

.item-card {
  border: 0;
  border-top: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--surface);
  overflow: hidden;
}
.item-card + .item-card { margin-top: 0; }
.item-card.done { border-top-color: var(--line-strong); }
.item-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px 9px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.item-no {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--r-sm);
  padding: 2px 7px;
  flex: 0 0 auto;
  margin-top: 1px;
}
.item-titles { min-width: 0; flex: 1; }
.item-ko { font-weight: 650; font-size: 14px; }
.item-en { font-size: 11.5px; color: var(--ink-3); }
.item-score {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  flex: 0 0 auto;
  color: var(--ink-3);
}
.item-score.set { color: var(--accent); }
.item-inst {
  font-size: 12.5px;
  color: var(--ink-2);
  padding: 10px 16px 0;
  line-height: 1.55;
}
.item-opts { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
/* 선택 표시는 배경색이 아니라 왼쪽 굵은 바 — 글자 대비를 해치지 않습니다 */
.opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 10px 10px 13px;
  border: 0;
  border-top: 1px solid var(--line);
  border-left: 3px solid transparent;
  border-radius: 0;
  cursor: pointer;
  transition: background 0.1s;
}
.opt:first-of-type { border-top: 0; }
.opt:hover { background: var(--surface-2); }
.opt input { margin: 2px 0 0; accent-color: var(--accent); flex: 0 0 auto; display: none; }
.opt.sel { background: transparent; border-left-color: var(--accent); }
.opt.sel .opt-ko { color: var(--ink); font-weight: 600; }
.opt-s {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12.5px;
  min-width: 22px;
  text-align: right;
  color: var(--ink-2);
  flex: 0 0 auto;
  margin-top: 1px;
}
.opt.sel .opt-s { color: var(--accent); }
.opt-text { min-width: 0; }
.opt-ko { font-size: 13px; line-height: 1.5; }
.opt-en { font-size: 11.5px; color: var(--ink-3); line-height: 1.45; margin-top: 2px; display: none; }
body.show-en .opt-en { display: block; }
body.show-en .item-inst-en { display: block; }
.item-inst-en { display: none; font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }

.item-note {
  margin: 0 16px 12px;
  padding: 8px 11px;
  background: var(--warning-bg);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--warning-ink);
  border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
}

/* ---------- 배터리형 검사(SPPB) ---------- */

.section-head { display: flex; align-items: flex-start; gap: 10px; margin: 22px 0 10px; }
.section-head:first-child { margin-top: 0; }
.section-no {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
  margin-top: 1px;
}
.section-ko { font-size: 15px; font-weight: 650; letter-spacing: -0.015em; }
.section-sub { display: block; font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.section-sub b { color: var(--accent); }

.item-fig {
  flex: 0 0 52px;
  width: 52px; height: 64px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 6px;
  margin-top: 1px;
}
.item-fig img { width: 100%; height: 100%; object-fit: contain; display: block; }
.item-fig .assessment-image-semi,
.item-fig .assessment-image-tandem {
  width: auto;
  max-width: 32px;
  max-height: 48px;
}

.item-card.locked { opacity: 0.55; }
.item-card.locked .item-score { font-size: 12px; font-weight: 600; }

.sub-field {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 0 16px 14px;
  font-size: 12.5px;
}
.sub-field > label { font-weight: 600; color: var(--ink-2); }

.measure-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; }
.measure-row > label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.measure-row input {
  max-width: 120px;
  font-family: var(--mono);
  font-size: 17px; font-weight: 650;
  text-align: right;
}
.measure-unit { font-size: 13px; color: var(--ink-2); font-weight: 600; }

.measure-figure { padding: 12px 16px 4px; }
.measure-figure img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0;
}
.measure-figure-cst img { max-width: 360px; }
.measure-figure-tug img { max-width: 520px; }

tr.row-hit td { background: var(--accent-soft); font-weight: 600; }

.seg-wrap { flex-wrap: wrap; }
.dist-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }

.sticky-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
  z-index: 5;
}
.sticky-total { display: flex; align-items: baseline; gap: 7px; }
.sticky-total b { font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.sticky-total span { font-size: 13px; color: var(--ink-3); font-family: var(--mono); }
.sticky-spacer { margin-left: auto; }

.progress-strip { display: flex; gap: 2px; align-items: center; }
.progress-strip i {
  width: 14px;
  height: 5px;
  border-radius: 2px;
  background: var(--surface-3);
  display: block;
}
.progress-strip i.on { background: var(--accent); }

/* ---------- 차트 ---------- */

.chart-wrap { position: relative; }
.chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: hidden;
  /* 차트 위에서 시작한 드래그가 그림 끌기·선택으로 새지 않고
     항상 세로 스크롤로 이어지게 합니다. */
  touch-action: pan-y;
  user-select: none;
  -webkit-user-drag: none;
}
.tip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  font-size: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.09s;
  z-index: 10;
  white-space: nowrap;
}
.tip.on { opacity: 1; }
.tip b { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tip .tip-q { color: var(--ink-3); font-size: 11px; display: block; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-2); align-items: center; }
.legend .key { display: inline-flex; align-items: center; gap: 5px; }
.legend .swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ---------- 분기 매트릭스 ---------- */

.matrix-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 3px 7px;
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.matrix-cell.blank { background: none; color: var(--ink-3); font-weight: 400; }

/* 램프 단계별 배경 + 그 위에서 읽히는 글자색.
   다크 모드는 램프가 밝은 쪽으로 뒤집히므로 3단계까지 어두운 글자를 씁니다. */
.matrix-cell[data-step="1"] { background: var(--q1); color: var(--q-ink-light); }
.matrix-cell[data-step="2"] { background: var(--q2); color: var(--q-ink-light); }
.matrix-cell[data-step="3"] { background: var(--q3); color: var(--q-ink-dark); }
.matrix-cell[data-step="4"] { background: var(--q4); color: var(--q-ink-dark); }
.matrix-cell[data-step="5"] { background: var(--q5); color: var(--q-ink-dark); }

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .matrix-cell[data-step="3"] { color: var(--q-ink-light); }
}
:root[data-theme="dark"] .matrix-cell[data-step="3"] { color: var(--q-ink-light); }

.delta { font-family: var(--mono); font-size: 12px; font-weight: 650; }
.delta.up { color: var(--good-ink); }
.delta.down { color: var(--critical-ink); }
.delta.flat { color: var(--ink-3); }

/* ---------- 기타 ---------- */

.notice {
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  border-radius: var(--r);
  padding: 12px 15px;
  font-size: 12.5px;
  color: var(--ink);
  line-height: 1.6;
}
.notice b { color: var(--accent); }
.demo-banner { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.demo-banner-btns { display: flex; gap: 6px; flex-shrink: 0; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice li { margin: 2px 0; }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: var(--page);
  padding: 10px 18px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 100;
  box-shadow: var(--shadow);
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.seg button {
  padding: 8px 13px;
  background: var(--surface);
  border: 0;
  border-right: 1px solid var(--line-strong);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--ink-2);
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.switch input { accent-color: var(--accent); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.split-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.progress-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 14px;
}

/* 목록에 높이를 걸어 안에서 스크롤시키는 건 마우스가 있는 넓은 화면에서만 씁니다.
   터치 기기나 좁은 창에서는 목록이 화면 대부분을 차지해, 그 위에서 민 드래그·휠이
   전부 목록 안으로 먹혀 페이지가 내려가지 않습니다. */
.list-scroll { max-height: 380px; overflow-y: auto; }
.list-scroll-tall { max-height: 560px; }

@media (pointer: coarse) {
  .list-scroll, .list-scroll-tall { max-height: none; overflow-y: visible; }
}
@media (max-width: 900px) {
  .list-scroll, .list-scroll-tall { max-height: none; overflow-y: visible; }
}

details.raw > summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--ink-2);
  padding: 4px 0;
  user-select: none;
}
details.raw > summary:hover { color: var(--ink); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 12.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

@media (max-width: 1000px) {
  .split, .split-3 { grid-template-columns: 1fr; }
}

@media (min-width: 1500px) {
  .tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* 터치로 누르는 대상은 어느 폭에서든 최소 높이를 확보합니다. */
@media (pointer: coarse) {
  .seg button { padding: 10px 15px; }
  .btn { padding: 9px 14px; }
  .btn-sm { padding: 7px 11px; }
  .switch { padding: 4px 0; }
}

/* ---------- 폰: 사이드바 → 상단 헤더 + 하단 탭바 ----------
   태블릿(768px 이상)은 사이드바를 그대로 씁니다. 화면이 넓어 탭바로 바꿀 이유가 없습니다. */

@media (max-width: 760px) {
  :root { --navh: 58px; }

  .shell { display: block; }
  /* .rail 을 투명하게 만들어 브랜드·탭바·설정 줄을 각각 배치합니다. */
  .rail { display: contents; }

  .brand {
    position: sticky;
    top: 0;
    z-index: 20;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    padding: 11px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }
  .brand-mark, .brand-sub { display: none; }
  .brand-name { font-size: 15px; white-space: nowrap; }
  .brand::after {
    content: "BBS · MBI";
    font-size: 11px;
    color: var(--ink-3);
    font-family: var(--mono);
    white-space: nowrap;
  }

  .rail-foot {
    margin: 0;
    padding: 7px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
  }
  .rail-note { display: none; }

  .nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0;
    padding: 5px 2px calc(5px + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  .nav-btn {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 5px 1px;
    font-size: 10.5px;
    line-height: 1.2;
    text-align: center;
    border-radius: var(--r-sm);
    min-width: 0;
  }
  .nav-btn .ico { font-size: 15px; width: auto; flex: none; }
  .nav-btn .count { display: none; }
  .nav-btn[aria-current="page"] { background: none; color: var(--accent); }
  .nav-btn[aria-current="page"] .ico { transform: translateY(-1px); }

  .main { padding: 16px 14px calc(var(--navh) + 28px); }
  .wrap { gap: 16px; }


  .page-title { font-size: 20px; }
  .page-head { gap: 12px; }
  .card { padding: 14px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px 13px; }
  .tile-value { font-size: 25px; }

  /* 손가락으로 누르는 대상은 키웁니다. */
  .opt { padding: 11px 10px; }
  .opt input { width: 18px; height: 18px; }
  .btn { padding: 9px 14px; }
  .btn-sm { padding: 6px 10px; }

  .item-inst { font-size: 12px; }
  .sticky-bar {
    bottom: calc(var(--navh) + 6px);
    gap: 10px;
    padding: 10px 13px;
  }
  .sticky-total b { font-size: 22px; }
  .sticky-bar #save-btn { flex: 1 1 auto; justify-content: center; }
  /* 검사 화면의 저장 버튼(고정 바)을 가리지 않도록 탭바보다 한참 위에 띄웁니다. */
  .toast { bottom: calc(var(--navh) + 72px); max-width: calc(100vw - 32px); text-align: center; }
}

@media (max-width: 560px) {
  .tiles { grid-template-columns: 1fr; }
  .progress-strip { display: none; }
  .progress-chart-grid { grid-template-columns: 1fr; }
  .page-head .row { width: 100%; }
  .page-head .row .btn { flex: 1 1 auto; justify-content: center; }
  .progress-patient-picker { grid-template-columns: 1fr; width: 100%; }
}

/* ---------- 필터 ---------- */

.filterbar {
  margin-bottom: 14px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
/* 걸러 보는 중이라는 사실이 눈에 띄어야 합니다 */
.filterbar.is-on {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.filterbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filterbar-label { font-size: 12px; color: var(--ink-3); flex: 0 0 auto; }
.filterbar-note { margin-top: 6px; font-size: 12.5px; color: var(--ink-2); }

/* 입력칸 기본값이 width:100% 라 그냥 두면 세로로 쌓입니다 */
.filter-select {
  width: auto;
  padding: 6px 10px;
  font-size: 13px;
  min-width: 118px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}
.filter-custom { display: inline-flex; align-items: center; gap: 5px; }
.filter-custom input {
  width: 66px;
  flex: 0 0 auto;
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}


/* ==========================================================
   시안 D — 부드러운 현대 (Material 3 Expressive).
   옅은 톤 바탕 위에 크게 굴린 흰 카드를 얹고, 누르는 것은 알약으로 둔다.
   (고객 확정: 2026-08-21)
   ========================================================== */

/* 숫자 — 서체를 갈아 끼우지 않고 자릿수 폭만 고정한다.
   고정폭 서체로 바꾸면 자릿수는 맞지만 터미널처럼 보인다. */
:root { --mono: var(--sans); }
body { font-variant-numeric: tabular-nums; }

/* 화면 구획 — 선이 아니라 카드가 나눈다 */
.card {
  background: var(--surface);
  border: 0;
  border-radius: var(--r);
  padding: 18px 20px;
}
.card + .card { margin-top: 0; }
.card-title { font-size: 15px; font-weight: 700; }
.sect-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-2);
}

/* 필터 줄 — 켜져 있으면 줄 전체가 옅은 색으로 물든다.
   일부만 보면서 전체라고 착각하는 사고를 막는 장치. */
.filterbar {
  margin-bottom: 0;
  padding: 11px 18px;
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}
.filterbar.is-on {
  background: var(--accent-soft);
  border-bottom: 0;
}
.filterbar.is-on .filterbar-label,
.filterbar.is-on .filterbar-note { color: var(--accent-deep); }
.filterbar-label { font-size: 12px; font-weight: 700; }
.filter-select {
  border-radius: var(--r-sm);
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

/* 지표 — 세로선으로 나눈 칸이 아니라 낱장 타일 */
.tiles {
  background: none;
  border: 0;
  padding: 0;
  gap: 10px;
}
.tile {
  background: var(--surface);
  border: 0;
  border-radius: var(--r-tile);
  padding: 14px 16px;
  margin-left: 0;
}
.tile:first-child { padding-left: 16px; margin-left: 0; }
.tile-label { color: var(--ink-2); }
.tile-value .unit { font-family: var(--sans); }
.meter { border-radius: 999px; height: 6px; background: var(--surface-3); }
.meter > span { border-radius: 999px; }

/* 차트·표 묶음 */
.chart-wrap { background: var(--surface); border-radius: var(--r-tile); }
.table-scroll { background: var(--surface); border-radius: var(--r-tile); }

/* 표 — 머리글은 옅게, 행 사이는 아주 가는 선만 */
table th {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}
table td { border-bottom: 1px solid var(--line); }
td.n, th.n { font-variant-numeric: tabular-nums; }

/* 판정 배지 — 알약 */
.badge {
  border-radius: 999px;
  border-color: transparent;
  font-weight: 700;
  padding: 4px 11px;
}

/* 버튼 — 알약, 손가락이 닿는 크기 */
.btn {
  border-radius: var(--r-sm);
  padding: 11px 20px;
  border-color: var(--line-strong);
  font-weight: 600;
}
.btn-sm { padding: 8px 15px; font-size: 12.5px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; }
/* 지우는 버튼 — 옅은 붉은 면. 눈에 띄되 주 동작처럼 보이지 않게. */
.btn-danger {
  background: var(--critical-bg);
  border-color: transparent;
  color: var(--critical-ink);
}
.btn-danger:hover { background: var(--critical-bg); filter: brightness(0.96); }

/* 고른 것은 옅은 색면으로 채운다 */
.chip { border-radius: var(--r-sm); padding: 9px 16px; }

/* 입력칸 — 알약까지 굴리면 글자가 가장자리에 붙어 읽기 나쁘다 */
input[type="text"], input[type="number"], input[type="date"], select, textarea {
  border-radius: var(--r-field);
}

/* 여러 줄이 들어가는 상자까지 알약으로 굴리면 글자가 모서리에 잘린다 */
.tip { border-radius: 12px; border-color: var(--line); }
.item-note {
  border-radius: var(--r-tile);
  border: 0;
  padding: 10px 14px;
}
.matrix-cell { border-radius: 10px; padding: 4px 8px; }

/* 테두리 없이 면과 모서리만으로 구분한다 */
.notice, .sticky-bar, .table-scroll { border: 0; }
.notice { padding: 14px 18px; }
.sticky-bar { padding: 14px 18px; box-shadow: 0 -2px 12px rgba(23, 29, 29, 0.06); }

/* 왼쪽 메뉴 — 고른 항목 뒤에 옅은 알약 */
.nav-btn { border-radius: 999px; }
.nav-btn[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-deep);
  box-shadow: none;
  font-weight: 700;
}

/* ---------- 분포 → 명단 (고객 요청 2026-08-22) ----------
   "19명인 건 알겠는데 누구냐" — 구간을 누르면 그 자리에서 명단이 펼쳐진다. */

.dist-row {
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  border-radius: var(--r-tile);
  padding: 8px 10px;
  margin: 0 -10px;
  transition: background 0.12s;
}
.dist-row:hover:not(:disabled) { background: var(--surface-3); }
.dist-row:disabled { cursor: default; opacity: 0.55; }
.dist-row.is-open { background: var(--accent-soft); }
.dist-caret { flex: 0 0 18px; text-align: right; color: var(--ink-2); font-size: 13px; line-height: 1; }
.dist-row.is-open .dist-caret { color: var(--accent-deep); }

.dist-list {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.dist-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.dist-list .table-scroll { max-height: 340px; overflow-y: auto; }

/* 눌러서 다른 화면으로 가는 타일 */
.tile-link {
  border: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background 0.12s;
}
.tile-link:hover { background: var(--accent-soft); }
.tile-go { color: var(--accent); font-weight: 700; font-size: 11.5px; white-space: nowrap; }

/* 직전 대비의 판정 낱말 — 화살표는 값의 방향, 낱말은 좋아졌는지 (고객 요청 2026-08-22) */
.delta i {
  font-style: normal;
  font-weight: 600;
  font-size: 0.92em;
  white-space: nowrap;
}
.delta { white-space: nowrap; }

/* 좁은 화면에서는 "명단 보기"가 뱃지 아래로 내려간다 —
   안 그러면 타일이 화면 밖으로 삐져나가 페이지가 가로로 밀린다. */
.tile-foot { flex-wrap: wrap; }
.tile-go { flex: 1 0 100%; }   /* 언제나 뱃지 아래 줄 — 옆에 붙이면 타일이 화면 밖으로 나간다 */

#risk-list.is-targeted {
  animation: risk-target-pulse 1.8s ease-out;
}
@keyframes risk-target-pulse {
  0%, 35% { box-shadow: 0 0 0 4px var(--accent-line); background: var(--accent-soft); }
  100% { box-shadow: 0 0 0 0 transparent; background: var(--surface); }
}

/* ---------- 운영 웹: 로그인 · 계정 · 동기화 ---------- */
[hidden] { display: none !important; }
body[data-server-mode="true"]:not(.session-ready) #app-shell { display: none; }
body[data-server-mode="true"] .rail-note { display: none; }

.server-loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  font-weight: 650;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 460px) minmax(340px, 460px);
  align-items: center;
  justify-content: center;
  gap: clamp(40px, 8vw, 120px);
  padding: 40px;
  background:
    radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--accent-soft) 72%, transparent), transparent 38%),
    var(--page);
}
.auth-brand h1 { margin: 10px 0 12px; font-size: clamp(34px, 5vw, 58px); line-height: 1.08; }
.auth-brand p, .auth-help { color: var(--ink-2); }
.auth-card {
  display: grid;
  gap: 18px;
  padding: clamp(26px, 4vw, 42px);
  background: var(--surface);
  border-radius: 24px;
  box-shadow: 0 22px 70px rgba(0, 54, 58, 0.12);
}
.auth-card h2 { margin: 0 0 6px; font-size: 26px; }
.auth-card p { margin: 0; }
.auth-submit { width: 100%; min-height: 48px; justify-content: center; }
.form-error { min-height: 20px; color: var(--critical); font-size: 13px; font-weight: 650; }

.account-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
}
.account-card b { display: block; }
.account-card span, .sync-state { font-size: 11px; color: var(--ink-2); }
.account-card .btn { color: var(--ink-2); border-color: var(--line-strong); }
.sync-state.is-busy { color: #ffe6a8; opacity: 1; }
.sync-state.is-error { color: #ffd2cf; opacity: 1; }

.staff-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.staff-chip { padding: 7px 11px; border-radius: 999px; background: var(--surface-3); font-size: 13px; }
.role-pill { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep); font-size: 11px; font-weight: 700; }
.status-ok { color: var(--good); font-weight: 700; }
.status-stop { color: var(--critical); font-weight: 700; }
.admin-grid { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(560px, 1.6fr); gap: 16px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 300px; }

.secure-dialog {
  width: min(560px, calc(100vw - 32px));
  border: 0;
  border-radius: 20px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(0,0,0,.24);
}
.secure-dialog::backdrop { background: rgba(0, 24, 27, .52); }
.secure-dialog form { display: grid; gap: 16px; padding: 28px; }
.secure-dialog h2, .secure-dialog p { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.duplicate-patient-summary { color: var(--ink-2); font-size: 15px; }
.duplicate-patient-warning {
  padding: 13px 15px;
  border-radius: 14px;
  background: var(--warning-bg);
  color: var(--warning-ink);
  font-weight: 650;
}

@media (max-width: 880px) {
  .auth-shell { grid-template-columns: minmax(280px, 520px); gap: 24px; padding: 24px; }
  .auth-brand h1 { font-size: 36px; }
  .admin-grid { grid-template-columns: 1fr; }
}

/* Scoped to the monthly body-composition workspace and its record drawer. */
.bc-workspace{--bc-muted:#75877f;--bc-line:#e1e9e4;--bc-ink:#19372f}
.bc-progress{margin-top:28px}.bc-progress-head{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap}.bc-progress-head h2{margin:0}.bc-progress-head p{margin:6px 0}.bc-progress .bc-actions{justify-content:flex-start}
.bc-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.bc-workspace .page-head{gap:18px}.bc-workspace .page-desc{max-width:520px}
.bc-patient{display:flex;align-items:center;gap:18px;position:relative;z-index:2;padding:24px;margin-bottom:28px}
.bc-avatar{width:48px;height:48px;flex-shrink:0;border-radius:15px;background:#ecf4ef;color:#00696b;display:grid;place-items:center;font-size:22px;font-weight:700}
.bc-picker{position:relative;min-width:0;flex:1;max-width:440px}.bc-picker label{display:block;font-size:12px;color:#637970;margin-bottom:7px}
.bc-search-wrap{display:flex;border:1px solid #cddbd4;border-radius:12px;overflow:hidden;background:white}
.bc-search-wrap input{border:0;border-radius:0;min-width:0;width:100%;font-weight:600;background:transparent;padding:12px;font-size:16px}
.bc-open{border:0;border-left:1px solid #e1e9e4;background:#f5f8f6;color:#00696b;width:42px;flex-shrink:0;cursor:pointer}
#bc-options{position:absolute;left:0;right:0;top:75px;max-height:280px;overflow-y:auto;border:1px solid #cddbd4;border-radius:10px;background:white;box-shadow:0 12px 30px #163c2b1c;z-index:5;padding:5px}
#bc-options[hidden]{display:none}#bc-options [role=option]{padding:12px;border-radius:6px;cursor:pointer;font-size:14px}#bc-options [role=option]:hover,#bc-options .bc-active{background:#e8f2ed}#bc-options [aria-selected=true]{font-weight:700;color:#00696b}.bc-no-match{padding:15px;font-size:13px;color:#75877f}
.bc-hint{font-size:12px;color:#71867b;line-height:1.7}.bc-picker>.bc-hint{display:block;margin-top:5px}
.bc-meta{display:flex;gap:32px;align-items:center;margin-left:auto}.bc-meta>div{display:grid;gap:7px;white-space:nowrap}.bc-meta small{font-size:11px;color:#75877f}.bc-meta b{font-size:14px;font-weight:600}.bc-pill{display:inline-block;border-radius:20px;padding:5px 11px;background:#eef5f0;color:#426653;font-size:12px}
.bc-toolbar{display:flex;gap:12px;align-items:center;justify-content:space-between;border-bottom:1px solid #dce6df;margin-bottom:10px}.bc-tabs{display:flex;gap:24px}.bc-tabs button{border:0;border-bottom:3px solid transparent;background:none;padding:13px 0;color:#70837a;cursor:pointer;font-size:15px;font-weight:600}.bc-tabs button[aria-pressed=true]{border-color:#00696b;color:#00696b}
.bc-ranges{display:flex;background:#e9efeb;border:1px solid #dee8e1;padding:3px;border-radius:9px;flex-shrink:0}.bc-ranges button{font-size:11px;background:none;border:0;border-radius:6px;padding:6px 10px;color:#637970;cursor:pointer}.bc-ranges button[aria-pressed=true]{background:white;color:#00696b;box-shadow:0 1px 4px #12382d10}
.bc-period{color:#7b8d83;font-size:11px;text-align:right;margin:9px 0 16px}.bc-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}.bc-metric.card{padding:24px 25px 16px;margin:0;border:1px solid #e3eae5;border-radius:20px}.bc-metric header{display:flex;justify-content:space-between;align-items:center}.bc-metric h2{font-size:16px;margin:0 0 3px;color:#19372f}.bc-metric header small{font-size:9px;letter-spacing:1px;color:#84918a}.bc-metric-icon{font-size:24px;color:var(--bc-color);background:#f3f6f3;border-radius:10px;width:37px;height:37px;text-align:center}
.bc-value{font-size:35px;font-weight:700;letter-spacing:-1px;margin:17px 0 7px;color:#163d32;font-variant-numeric:tabular-nums}.bc-value span{font-size:13px;font-weight:400;letter-spacing:0;color:#71867b;margin-left:7px}.bc-deltas{display:flex;gap:15px;flex-wrap:wrap;font-size:11px;color:#7b8c81;margin-bottom:8px}.bc-deltas b{font-weight:600;color:#496557;margin-left:4px}.bc-chart-scroll{overflow-x:auto}.bc-chart-scroll svg{display:block;width:100%;height:auto;min-width:0;font-family:inherit;font-size:11px;overflow:visible}.bc-empty-chart{min-height:220px;display:grid;place-items:center;color:#80938a;font-size:13px}.bc-metric-foot{font-size:10px;color:#8a9a90;border-top:1px solid #edf0ed;padding-top:10px}.bc-chart-note{margin:14px 0 28px}
.bc-history{padding:23px;margin-top:18px}.bc-history .card-head{align-items:center}.bc-history table{min-width:800px;font-size:13px}.bc-history td{font-variant-numeric:tabular-nums}.bc-note-cell{white-space:pre-wrap;min-width:140px;max-width:270px;overflow-wrap:anywhere}.bc-pagination{display:flex;justify-content:center;align-items:center;gap:15px;font-size:12px;padding-top:18px}
.bc-dialog{border:0;padding:0;max-width:none;max-height:none;width:min(520px,100%);height:100dvh;margin:0 0 0 auto;background:white;color:#19372f;box-shadow:-12px 0 50px #17302b20}.bc-dialog::backdrop{background:#17302b66;backdrop-filter:blur(2px)}body:has(.bc-dialog[open]){overflow:hidden}
.bc-drawer{padding:28px 28px 0;min-height:100%;display:flex;flex-direction:column}.bc-drawer-head{display:flex;align-items:flex-start;justify-content:space-between;gap:15px}.bc-drawer-head small{font-size:10px;letter-spacing:1.5px;color:#00696b}.bc-drawer h2{font-size:24px;margin:8px 0 0}.bc-person-lock{padding:16px;background:#f0f6f1;border:1px solid #dfe9e1;border-radius:12px;margin:16px 0 23px;overflow-wrap:anywhere}.bc-person-lock b{font-size:15px}.bc-person-lock small{font-size:11px;color:#708576}
.bc-drawer fieldset{border:0;padding:0;margin:0;min-width:0}.bc-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 15px}.bc-drawer .field{min-width:0}.bc-drawer .field label{font-size:12px}.bc-drawer input,.bc-drawer textarea{font-size:16px;border-radius:10px;padding:12px;width:100%;box-sizing:border-box;min-width:0}.bc-drawer input[type=number]{font-size:22px;font-weight:600;font-variant-numeric:tabular-nums}.bc-drawer input[type=date]{font-size:14px}.bc-form-section{border-top:1px solid #e1e9e4;padding-top:21px;margin-top:24px}.bc-form-section h3{font-size:13px;margin:0 0 18px}.bc-form-section h3 small{font-size:11px;font-weight:400;margin-left:8px;color:#788b7f}.bc-form-warning:not(:empty){background:#fff3d9;border-radius:10px;padding:13px;color:#7b5b22;font-size:12px;margin-top:18px;line-height:1.7}.bc-drawer .form-error{font-size:13px;line-height:1.6;margin:16px 0}
.bc-drawer-footer{display:flex;gap:8px;justify-content:flex-end;position:sticky;bottom:0;background:white;border-top:1px solid #e1e9e4;padding:17px 28px;margin: auto -28px 0}.bc-drawer-footer .btn-primary{flex:1}.bc-delete{color:#a63c31;margin-right:auto}
.bc-drawer input,.bc-drawer textarea{border:1px solid #cddbd4;background:white;color:#19372f}
@media(max-width:1100px){.bc-meta{gap:17px}.bc-patient{gap:12px}.bc-avatar{display:none}.bc-grid{gap:15px}.bc-metric.card{padding:20px}.bc-workspace .page-head{flex-wrap:wrap}.bc-actions{margin-left:auto}}
@media(max-width:750px){.bc-patient{flex-wrap:wrap;padding:18px}.bc-picker{max-width:none;width:100%;flex:auto}.bc-meta{width:100%;border-top:1px solid #e1e9e4;padding-top:13px;justify-content:space-between}.bc-meta>div{gap:5px}.bc-meta b{font-size:13px}.bc-toolbar{gap:8px}.bc-tabs{gap:16px}.bc-tabs button{font-size:13px}.bc-ranges button{padding:6px 7px}.bc-history{padding:18px}.bc-history .card-head{gap:12px}.bc-history .card-title{font-size:15px}}
@media(max-width:580px){.bc-grid{grid-template-columns:1fr}.bc-metric.card{padding:20px}.bc-toolbar{flex-wrap:wrap}.bc-period{text-align:left}.bc-drawer{padding:22px 20px 0}.bc-drawer-footer{margin-left:-20px;margin-right:-20px;padding:15px 20px}.bc-actions{gap:6px}.bc-actions .btn{font-size:12px;padding:10px 12px}.bc-form-grid{gap:16px 12px}.bc-empty-chart{min-height:180px}}
