/* Charting extras: completeness meter + tab dots, medication safety panel, repeat actions, pediatric helper,
 * complaint checklist, narrative formats / phrase library, chart timeline and face sheet.
 * Dark mode: colours come from variables below, redefined for [data-theme="dark"] at the end of this file. */
:root {
  --cx-red: #c0392b; --cx-red-bg: #fdecea; --cx-red-line: #f3b8b1;
  --cx-amber: #9a5b00; --cx-amber-bg: #fff6e5; --cx-amber-line: #f5d49a;
  --cx-green: #1e8449; --cx-green-bg: #eafaf1; --cx-green-line: #bfe8cf;
  --cx-card: #fff; --cx-soft: #f6f8fa;
}

/* ---------- completeness meter (PCR top bar) ---------- */
.cm-meter { display: flex; align-items: center; gap: 10px; padding: 0 16px; background: none; border: 0; border-left: 1px solid rgba(255,255,255,.08); color: #fff; cursor: pointer; text-align: left; font: inherit; }
.cm-meter:hover { background: rgba(255,255,255,.07); }
.cm-ring-wrap { position: relative; width: 42px; height: 42px; flex: none; }
.cm-ring { width: 42px; height: 42px; display: block; }
.cm-track { fill: none; stroke: rgba(255,255,255,.18); stroke-width: 3.6; }
.cm-arc { fill: none; stroke: #f1c40f; stroke-width: 3.6; stroke-linecap: round; transition: stroke-dashoffset .4s ease; }
.cm-meter.cm-low .cm-arc { stroke: #ff7b6b; }
.cm-meter.cm-full .cm-arc { stroke: var(--green); }
.cm-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.cm-text { display: flex; flex-direction: column; line-height: 1.2; }
.cm-big { font-size: 14px; white-space: nowrap; }
.cm-label { font-size: 11px; color: #c5d1db; white-space: nowrap; }
@media (max-width: 1250px) { .cm-text { display: none; } .cm-meter { padding: 0 12px; } }
.pcr-tab.cm-has-dot { position: relative; }
.cm-dot { position: absolute; top: 9px; right: calc(50% - 30px); width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--blue); box-sizing: content-box; }
.cm-dot-error { background: #ff5a47; }
.cm-dot-warning { background: #f7c331; }
.cm-dot-done { background: #2ecc71; }
.pcr-tab.active .cm-dot { border-color: var(--blue-2); }
@media (max-width: 760px) { .cm-dot { top: 5px; right: calc(50% - 22px); width: 8px; height: 8px; } }

/* ---------- medication safety ---------- */
.ms-panel { border: 1px solid var(--line); border-left-width: 5px; border-radius: 4px; padding: 12px 14px; margin-bottom: 24px; background: var(--cx-soft); }
.ms-panel.ms-ok { border-color: var(--cx-green-line); border-left-color: var(--cx-green); background: var(--cx-green-bg); }
.ms-panel.ms-amber { border-color: var(--cx-amber-line); border-left-color: #f39c12; background: var(--cx-amber-bg); }
.ms-panel.ms-red { border-color: var(--cx-red-line); border-left-color: var(--red); background: var(--cx-red-bg); }
.ms-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ms-head .ico { width: 20px; height: 20px; }
.ms-ok .ms-head .ico { color: var(--cx-green); }
.ms-amber .ms-head .ico { color: #e08e0b; }
.ms-red .ms-head .ico { color: var(--red); }
.ms-red .ms-head b { color: var(--cx-red); }
.ms-sub { color: var(--text-2); font-size: 13px; }
.ms-list { list-style: none; margin: 10px 0 4px; padding: 0; display: grid; gap: 6px; }
.ms-item { display: flex; gap: 8px; align-items: baseline; font-size: 14px; color: var(--text); }
.ms-tag { flex: none; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 2px 6px; border-radius: 3px; }
.ms-danger .ms-tag { background: var(--red); color: #fff; }
.ms-warning .ms-tag { background: #f39c12; color: #2b1a00; }
.ms-override { margin-top: 10px; }
.ms-override .f { margin-bottom: 6px; }
.ms-override .f-label { color: var(--cx-red); font-weight: 700; }
.ms-override-ro { margin-top: 8px; font-size: 14px; }
.ms-disclaimer { font-size: 12px; color: var(--text-2); margin-top: 8px; font-style: italic; }
.fc-override { display: flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--cx-amber); }
.fc-override .ico { width: 15px; height: 15px; flex: none; }
.fc-c-act { width: 88px; }
.fc-acts { display: inline-flex; gap: 2px; align-items: center; justify-content: flex-end; }
.fc-repeat { border: 0; background: none; color: var(--blue-link); cursor: pointer; padding: 4px; border-radius: 3px; display: inline-flex; }
.fc-repeat .ico { width: 21px; height: 21px; }
.fc-repeat:hover { background: #e7f4fc; }

/* ---------- copy-forward buttons ---------- */
.vit-foot .btn.vit-repeat { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.vit-foot .btn.vit-repeat .ico { width: 20px; height: 20px; }
.ax-head-btns { display: flex; gap: 10px; align-items: center; }
.ax-copy { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; }
.ax-copy .ico { width: 18px; height: 18px; }
@media (max-width: 760px) { .vit-foot { flex-wrap: wrap; } .vit-foot .btn { min-width: 0; flex: 1 1 140px; } }

/* ---------- pediatric helper ---------- */
.peds-helper { border: 1px solid #bfe2f6; background: #f1f9fe; border-radius: 4px; padding: 12px 14px; margin: -10px 0 30px; display: grid; gap: 10px; }
.peds-est { display: flex; align-items: center; gap: 12px; }
.peds-est > .ico { width: 26px; height: 26px; color: var(--blue); flex: none; }
.peds-est > div { flex: 1; }
.peds-est-title { font-size: 15px; }
.peds-dim { color: var(--text-2); font-size: 12px; }
.peds-ranges-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-2); margin-bottom: 4px; }
.peds-table { border-collapse: collapse; font-size: 14px; }
.peds-table th { text-align: left; font-weight: 600; padding: 2px 16px 2px 0; color: var(--text-2); }
.peds-table td { padding: 2px 0; }
.peds-banner { display: flex; align-items: center; gap: 10px; padding: 10px 30px; background: #f1f9fe; border-bottom: 1px solid #bfe2f6; font-size: 14px; color: var(--text); }
.peds-banner .ico { width: 20px; height: 20px; color: var(--blue); flex: none; }
.vit-table td.vit-abn { font-weight: 700; }
.vit-table td.vit-abn-high { color: #c0392b; background: #fdf0ee; }
.vit-table td.vit-abn-low { color: #1f5fa8; background: #eef4fc; }

/* ---------- complaint checklist ---------- */
.ck-wrap { width: 100%; }
.ck-intro { color: var(--text-2); font-size: 14px; margin-bottom: 12px; }
.ck-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.ck-chip { border: 1px solid var(--line-2); background: var(--cx-card); color: var(--text); border-radius: 16px; padding: 6px 14px; font-size: 14px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.ck-chip.suggested { border-color: var(--blue); }
.ck-chip.suggested::before { content: '★'; color: var(--blue); font-size: 12px; }
.ck-chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.ck-chip.on.suggested::before { color: #fff; }
.ck-count { background: var(--green); color: #fff; border-radius: 10px; font-size: 11px; font-weight: 700; padding: 0 6px; }
.ck-list { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.ck-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--cx-card); }
.ck-row:last-child { border-bottom: 0; }
.ck-row.ck-set-pos { background: var(--cx-amber-bg); }
.ck-row.ck-set-neg { background: var(--cx-green-bg); }
.ck-main { flex: 1; min-width: 0; }
.ck-label { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ck-auto { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--cx-green); background: var(--cx-green-bg); border: 1px solid var(--cx-green-line); border-radius: 10px; padding: 1px 8px; }
.ck-auto .ico { width: 13px; height: 13px; }
.ck-text { font-size: 13px; color: var(--text-2); margin-top: 2px; font-style: italic; }
.ck-detail { margin-top: 6px; max-width: 420px; font-size: 14px; }
.ck-btns { display: flex; gap: 6px; flex: none; }
.ck-btn { border: 1px solid var(--line-2); background: var(--cx-card); color: var(--text); border-radius: 3px; padding: 6px 10px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ck-btn:disabled { cursor: default; opacity: .7; }
.ck-btn.ck-pos.on { background: #f39c12; border-color: #f39c12; color: #2b1a00; }
.ck-btn.ck-neg.on { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.ck-summary { margin-top: 16px; }
.ck-summary-head { font-size: 14px; color: var(--text-2); margin-bottom: 8px; }
.ck-summary .pt-chip { font-size: 14px; }
.pt-chip.ck-chip-pos { background: var(--cx-amber-bg); border-color: var(--cx-amber-line); }
.pt-chip.ck-chip-neg { background: var(--cx-green-bg); border-color: var(--cx-green-line); }
.ck-disclaimer { font-size: 12px; color: var(--text-2); font-style: italic; margin-top: 10px; }
@media (max-width: 760px) { .ck-row { flex-direction: column; align-items: stretch; } }

/* ---------- narrative formats + phrase library ---------- */
.nar-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.nar-fmt { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line-2); border-radius: 4px; overflow: hidden; }
.nar-fmt-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-2); padding: 0 10px; }
.nar-fmt-btn { border: 0; border-left: 1px solid var(--line-2); background: var(--cx-card); color: var(--text); padding: 7px 14px; font-size: 13px; font-weight: 700; cursor: pointer; }
.nar-fmt-btn.on { background: var(--navy); color: #fff; }
.nar-phrases { display: inline-flex; align-items: center; gap: 6px; }
.nar-phrases .ico { width: 16px; height: 16px; }
.ph-tip { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; margin-bottom: 10px; }
.ph-tip .ico { width: 18px; height: 18px; flex: none; }
.ph-search { width: 100%; margin-bottom: 12px; }
.ph-group h4 { margin: 12px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-2); }
.ph-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ph-item { border: 1px solid #bfe2f6; background: #e7f4fc; color: var(--navy); border-radius: 3px; padding: 6px 10px; font-size: 13px; cursor: pointer; text-align: left; }
.ph-item:hover { background: #d3ecfa; }

/* ---------- chart timeline ---------- */
.tlx-bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.tlx-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.tlx-filter { border: 1px solid var(--line-2); background: var(--cx-card); color: var(--text-2); border-radius: 14px; padding: 4px 12px; font-size: 12px; font-weight: 600; cursor: pointer; opacity: .55; }
.tlx-filter.on { opacity: 1; color: var(--text); }
.tlx-list { display: grid; }
.tlx-day { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-2); padding: 10px 0 4px; border-bottom: 1px solid var(--line); }
.tlx-row { display: grid; grid-template-columns: 74px 64px 18px 1fr auto; align-items: start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tlx-time { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }
.tlx-gap, .tlx-elapsed { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; padding-top: 2px; }
.tlx-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; background: var(--muted); }
.tlx-k-time .tlx-dot { background: var(--navy); }
.tlx-k-event .tlx-dot { background: #8e44ad; }
.tlx-k-vitals .tlx-dot { background: var(--blue); }
.tlx-k-treatment .tlx-dot { background: var(--green); }
.tlx-k-assessment .tlx-dot { background: #f39c12; }
.tlx-k-signature .tlx-dot { background: #7f8c8d; }
.tlx-k-narrative .tlx-dot { background: #bdc3c7; }
.tlx-label { font-weight: 600; color: var(--text); }
.tlx-kind { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-2); margin-right: 8px; }
.tlx-detail { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.tlx-note { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); margin-top: 12px; }
.tlx-note .ico { width: 16px; height: 16px; flex: none; }
@media (max-width: 600px) { .tlx-row { grid-template-columns: 64px 14px 1fr; } .tlx-gap, .tlx-elapsed { display: none; } }

/* ---------- face sheet ---------- */
.fs-notice { display: flex; align-items: center; gap: 8px; background: var(--cx-amber-bg); border: 1px solid var(--cx-amber-line); color: var(--cx-amber); font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 4px; margin-bottom: 14px; }
.fs-notice .ico { width: 18px; height: 18px; flex: none; }
.fs-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid var(--navy); padding-bottom: 10px; margin-bottom: 12px; }
.fs-name { font-size: 22px; font-weight: 800; color: var(--navy); }
.fs-sub { color: var(--text-2); font-size: 13px; flex: 1; }
.fs-print { display: inline-flex; align-items: center; gap: 6px; }
.fs-print .ico { width: 16px; height: 16px; }
.fs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; }
.fs-sec { border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; background: var(--cx-card); }
.fs-sec h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-2); }
.fs-wide { grid-column: 1 / -1; }
.fs-kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 0; font-size: 14px; }
.fs-kv dt { color: var(--text-2); font-weight: 600; }
.fs-kv dd { margin: 0; }
.fs-allergy.fs-has { color: var(--cx-red); font-weight: 700; }
.fs-dim { color: var(--text-2); font-size: 13px; }
.fs-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.fs-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.fs-t { width: 80px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.fs-override { font-size: 12px; color: var(--cx-amber); font-weight: 600; }
@media (max-width: 700px) { .fs-grid { grid-template-columns: 1fr; } }

/* ---------- dark mode ---------- */
@media screen {
  :root[data-theme="dark"] {
    --cx-red: #ff8a7d; --cx-red-bg: #3a1f1f; --cx-red-line: #6e2f2a;
    --cx-amber: #f5c26b; --cx-amber-bg: #352a14; --cx-amber-line: #6b5124;
    --cx-green: #6fdc9b; --cx-green-bg: #16301f; --cx-green-line: #2b5c3d;
    --cx-card: var(--dk-surface); --cx-soft: var(--dk-surface-2);
  }
  [data-theme="dark"] .peds-helper, [data-theme="dark"] .peds-banner { background: #14283a; border-color: #24496a; }
  [data-theme="dark"] .vit-table td.vit-abn-high { color: #ff9f94; background: #3a1f1f; }
  [data-theme="dark"] .vit-table td.vit-abn-low { color: #8fc1ff; background: #182a40; }
  [data-theme="dark"] .ph-item { background: #17324a; border-color: #24496a; color: var(--text); }
  [data-theme="dark"] .ph-item:hover { background: #1f4060; }
  [data-theme="dark"] .ck-chip.on, [data-theme="dark"] .nar-fmt-btn.on { background: #2d5f86; border-color: #2d5f86; }
  [data-theme="dark"] .fs-name { color: var(--dk-heading); }
  [data-theme="dark"] .fs-head { border-bottom-color: #3a4a59; }
  [data-theme="dark"] .fc-repeat:hover { background: #17324a; }
  [data-theme="dark"] .ms-item { color: var(--text); }
}

/* ---------- injury body map (Forms → Injury Body Map) + print body diagrams ---------- */
.frm-burn-region.inj-marked, .frm-burn-legend .sw.inj-marked { fill: #8e44ad; background: #8e44ad; stroke: #5e2d73; }
.frm-burn-region.inj-picked { stroke: var(--blue, #1d74b7); stroke-width: 3.5; }
.frm-burn-pct.inj-count { font-size: 15px; fill: #fff; }
.inj-picker { width: 100%; max-width: 560px; margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line, #d5dce2); border-left: 4px solid #8e44ad; border-radius: 6px; background: var(--cx-card); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.inj-picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 16px; }
.inj-types { flex-wrap: wrap; gap: 6px; }
.inj-types .pill { min-width: 0; }
.inj-picker-row { display: flex; gap: 8px; margin-top: 10px; }
.inj-picker-row .inj-note { flex: 1; min-width: 0; }
.inj-type { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 13px; font-weight: 600; background: #efe3f5; color: #6c3483; }
.inj-type-burn { background: var(--cx-amber-bg); color: var(--cx-amber); }
.inj-type-penetrating, .inj-type-laceration { background: var(--cx-red-bg); color: var(--cx-red); }
.qs-autofill { white-space: nowrap; }
.prt-body-svg { max-width: 360px; margin: 4px 0 8px; }
.prt-body-svg svg { width: 100%; height: auto; display: block; }
.prt-body-svg .frm-burn-title { font-size: 14px; font-weight: 700; letter-spacing: 2px; fill: #333; }
.prt-body-svg .frm-burn-side { font-size: 13px; font-weight: 700; fill: #888; }
@media (max-width: 600px) { .inj-picker-row { flex-direction: column; } }
@media screen {
  [data-theme="dark"] .inj-type { background: #3a2647; color: #d7b4ea; }
  [data-theme="dark"] .inj-picker { border-color: #3a4a59; border-left-color: #b07cc9; box-shadow: none; }
}
