/* Roleplay Simulation (pages/sim.js, js/sim/*): hub, library, editor, dispatch board, MCI, controller panel,
   Cardiac Monitor Simulator (crew), patient player view, debrief. Uses the app.css tokens for page UI. */
:root { --sim-ok: #1e7a45; --sim-ok-bg: #dcefe3; --sim-bad: #b03a2e; --sim-bad-bg: #fde2df; --sim-warn-bg: #fff3cd; --sim-warn: #8a6d00; }
.sim-muted { color: var(--text-2); font-size: 13px; }
.sim-h4 { margin: 16px 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-2); }
.sim-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sim-spacer { flex: 1; }
.sim-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; align-items: start; }
.sim-flush { padding: 0 !important; }
.sim-table-wrap { overflow-x: auto; }
.sim-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.sim-toolbar h2 { margin: 0; font-size: 20px; }
.sim-tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .3px; padding: 2px 7px; border-radius: 3px; background: #e3f2fb; color: #0a5f8c; margin-left: 6px; text-transform: uppercase; vertical-align: 1px; }
.sim-tag.red { background: var(--sim-bad-bg); color: var(--sim-bad); }
.sim-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 800; letter-spacing: 2px; background: var(--navy); color: #fff; padding: 2px 8px; border-radius: 3px; font-size: 13px; }
.sim-in-sm { width: auto; min-width: 70px; padding: 6px 8px; }
.sim-check { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; cursor: pointer; font-size: 14px; }
.sim-check input { width: 18px; height: 18px; margin-top: 1px; flex: none; }
.sim-check.done { color: var(--sim-ok); }
.sim-details summary { cursor: pointer; font-weight: 600; color: var(--navy); padding: 4px 0; }
.sim-ok td { background: #f2fbf5; } .sim-bad td { background: #fff6f5; }
.sim-dim td { opacity: .65; }
.sim-ev-time { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-2); margin-right: 8px; white-space: nowrap; }
.sim-logrow { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; align-items: baseline; }
.sim-logrow.k-shock span:nth-child(2), .sim-logrow.k-rosc span:nth-child(2) { color: var(--sim-bad); font-weight: 700; }
.sim-logrow.k-treatment span:nth-child(2) { color: #0a5f8c; font-weight: 600; }
.sim-modal .modal-body { padding: 16px 20px 22px; }
.sim-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.sim-form2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 14px; }
.sim-form3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.sim-form3 label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }

/* ---------- hub ---------- */
.sim-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-bottom: 22px; }
.sim-tile { display: flex; flex-direction: column; gap: 6px; text-align: left; border: 0; border-radius: 6px; padding: 18px; min-height: 150px; color: #fff; background: var(--tile); cursor: pointer; text-decoration: none; position: relative; overflow: hidden; font: inherit; }
.sim-tile:hover { filter: brightness(1.08); }
.sim-tile b { font-size: 19px; }
.sim-tile span { font-size: 13px; opacity: .9; line-height: 1.35; }
.sim-tile-ico { width: 34px; height: 34px; opacity: 1 !important; }
.sim-tile-ico svg { width: 34px; height: 34px; }
.sim-tile.t-start { background: linear-gradient(135deg, #1e9a52, #2ecc71); }
.sim-tile.t-join { background: linear-gradient(135deg, #0b78b8, #1fb3f3); cursor: default; }
.sim-tile.t-lib { background: linear-gradient(135deg, #2d3e50, #46617c); }
.sim-tile.t-call { background: linear-gradient(135deg, #b8541a, #e98b2a); }
.sim-tile.t-mci { background: linear-gradient(135deg, #8e2c22, #e74c3c); }
.sim-tile .sim-row { margin-top: auto; }
.sim-code-in { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 800; letter-spacing: 4px; text-transform: uppercase; width: 150px; text-align: center; font-size: 18px; padding: 6px 8px; }
.sim-code-in.big { width: 100%; max-width: 340px; font-size: 34px; padding: 12px; }
.sim-role { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #e8edf1; text-transform: capitalize; }
.sim-role.r-controller { background: #ede3fb; color: #5b2d9c; } .sim-role.r-crew { background: var(--sim-ok-bg); color: var(--sim-ok); } .sim-role.r-patient { background: #fde9d7; color: #9a4b0b; }

/* ---------- join ---------- */
.sim-join { max-width: 760px; }
.sim-join-info { margin: 12px 0; min-height: 26px; }
.sim-found { padding: 10px 12px; background: var(--bg-soft); border-left: 4px solid var(--green); }
.sim-bad { color: var(--sim-bad); }
.sim-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 14px; }
.sim-rolecard { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 18px; border-radius: 6px; border: 2px solid var(--line); background: var(--bg); cursor: pointer; font: inherit; color: inherit; min-height: 130px; }
.sim-rolecard:hover { border-color: var(--blue); }
.sim-rolecard b { font-size: 18px; color: var(--navy); }
.sim-rolecard span { color: var(--text-2); font-size: 14px; }
.sim-rolecard.r-crew { border-top: 6px solid var(--green); } .sim-rolecard.r-patient { border-top: 6px solid #e98b2a; } .sim-rolecard.r-controller { border-top: 6px solid #7d4cc9; }

/* ---------- library ---------- */
.sim-search { max-width: 360px; }
.sim-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; margin-top: 12px; }
.sim-cardtile { border: 1px solid var(--line); border-radius: 6px; padding: 16px; background: var(--bg); display: flex; flex-direction: column; gap: 6px; border-top: 4px solid var(--blue); }
.sim-cardtile h3 { margin: 4px 0 0; font-size: 18px; }
.sim-cardtile p { margin: 4px 0 8px; font-size: 14px; line-height: 1.45; color: var(--text); flex: 1; }
.sim-cardtile-top { display: flex; gap: 6px; align-items: center; }
.sim-cat { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-2); }
.sim-diff { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #e8edf1; }
.sim-diff.d-Beginner { background: var(--sim-ok-bg); color: var(--sim-ok); } .sim-diff.d-Intermediate { background: var(--sim-warn-bg); color: var(--sim-warn); } .sim-diff.d-Advanced { background: var(--sim-bad-bg); color: var(--sim-bad); }
.sim-detail-head { margin-bottom: 16px; } .sim-detail-head h2 { margin: 6px 0; }
.sim-findlist { margin: 6px 0; padding-left: 18px; font-size: 13px; }
.sim-editor { max-width: 1100px; }
.sim-stage-ed, .sim-resp-ed { border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; margin-bottom: 12px; background: var(--bg); }
.sim-stage-ed summary { cursor: pointer; font-size: 15px; margin-bottom: 8px; }
.sim-vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0 10px; }
.sim-json { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

/* ---------- dispatch board ---------- */
.sim-calls { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.sim-call { border: 1px solid var(--line); border-left: 6px solid #e98b2a; border-radius: 4px; padding: 12px 14px; background: var(--bg); display: flex; flex-direction: column; gap: 6px; }
.sim-call.p1 { border-left-color: var(--red); } .sim-call.p3 { border-left-color: var(--blue); }
.sim-call.st-closed { opacity: .55; }
.sim-call-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sim-call-head b { font-size: 17px; }
.sim-call-status { margin-left: auto; font-size: 11px; font-weight: 700; text-transform: uppercase; background: #e8edf1; padding: 2px 8px; border-radius: 10px; }
.sim-call-addr { font-weight: 700; font-family: ui-monospace, Menlo, Consolas, monospace; }
.sim-call-notes { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; background: var(--bg-soft); padding: 6px 8px; border-radius: 3px; }
.sim-prio { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 3px; background: #e98b2a; color: #fff; white-space: nowrap; }
.sim-prio.p1 { background: var(--red); } .sim-prio.p3 { background: var(--blue); }
.sim-dispatch { border-left: 4px solid var(--red); padding: 8px 10px; background: var(--bg-soft); border-radius: 3px; margin-bottom: 10px; font-size: 14px; }
.sim-dispatch-head { display: flex; gap: 8px; align-items: center; margin-bottom: 2px; }

/* ---------- pickers / import ---------- */
.sim-import-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow: auto; margin-top: 10px; }
.sim-import-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); text-align: left; font: inherit; color: inherit; }
.sim-import-row .sim-import-nums { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.sim-pick { cursor: pointer; grid-template-columns: minmax(180px, 1fr) 2fr; }
.sim-pick:hover { border-color: var(--blue); background: #f5fafd; }
.sim-pick-sum { font-size: 12px; }
.sim-num { display: flex; flex-direction: column; } .sim-num small { font-size: 11px; color: var(--text-2); text-transform: uppercase; }
.sim-chart-list { display: flex; flex-direction: column; gap: 6px; }
.sim-chart-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.sim-chart-row.on { border-color: var(--green); background: #f2fbf5; }
.sim-chart-main { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; } .sim-chart-sub { font-size: 12px; color: var(--text-2); }
.sim-ev-list { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 4px; padding: 4px 10px; }

/* ---------- MCI ---------- */
.sim-mci-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; font-size: 14px; }
.sim-mci-score { font-weight: 800; color: var(--navy); }
.sim-mci-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.sim-mci-card { border: 2px solid var(--line); border-radius: 6px; padding: 10px 12px; background: var(--bg); display: flex; flex-direction: column; gap: 6px; }
.sim-mci-card.tagged.t-green { border-color: #27ae60; } .sim-mci-card.tagged.t-yellow { border-color: #f1c40f; } .sim-mci-card.tagged.t-red { border-color: #e74c3c; } .sim-mci-card.tagged.t-black { border-color: #222; }
.sim-mci-card.wrong { box-shadow: 0 0 0 3px rgba(231, 76, 60, .25); }
.sim-mci-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.sim-mci-head b { font-size: 16px; }
.sim-mci-head .sim-tag-chip { margin-left: auto; }
.sim-mci-desc { font-size: 14px; font-weight: 600; }
.sim-mci-find { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-2); }
.sim-mci-tags { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sim-tagbtn { border: 2px solid transparent; border-radius: 4px; padding: 10px 6px; font-weight: 800; cursor: pointer; font-size: 14px; }
.sim-tagbtn.t-green { background: #27ae60; color: #fff; } .sim-tagbtn.t-yellow { background: #f1c40f; color: #3b3100; } .sim-tagbtn.t-red { background: #e74c3c; color: #fff; } .sim-tagbtn.t-black { background: #222; color: #fff; }
.sim-tagbtn.on { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(11, 152, 222, .45); }
.sim-tag-chip { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 3px; text-transform: uppercase; }
.sim-tag-chip.t-green { background: #27ae60; color: #fff; } .sim-tag-chip.t-yellow { background: #f1c40f; color: #3b3100; } .sim-tag-chip.t-red { background: #e74c3c; color: #fff; } .sim-tag-chip.t-black { background: #222; color: #fff; } .sim-tag-chip.t-none { background: #e8edf1; color: var(--text-2); }
.sim-mci-answer { font-size: 13px; border-top: 1px dashed var(--line); padding-top: 6px; }
.sim-mci-table td { font-size: 13px; }
.sim-mci-solo { margin-top: 18px; }
.sim-ref ol { padding-left: 20px; line-height: 2; font-size: 14px; }

/* ---------- controller ---------- */
.sc-page { max-width: 1700px; }
.sc-head { margin-bottom: 14px; }
.sc-head-main { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.sc-head-main h1 { margin: 0; font-size: 24px; }
.sc-kicker { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--text-2); text-transform: uppercase; }
.sc-code, .sc-timerbox { display: flex; flex-direction: column; align-items: center; background: var(--navy); color: #fff; border-radius: 6px; padding: 6px 14px; cursor: pointer; }
.sc-code small, .sc-timerbox small { font-size: 10px; letter-spacing: 1px; opacity: .8; }
.sc-code b { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 26px; letter-spacing: 4px; }
.sc-timerbox { background: #10161d; cursor: default; }
.sc-timer { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 24px; font-weight: 700; color: #3dff6e; }
.sc-members { flex: 1; min-width: 220px; } .sc-members small { color: var(--text-2); }
.sim-member { display: inline-flex; gap: 4px; align-items: baseline; font-size: 12px; background: var(--bg-soft); border-radius: 10px; padding: 2px 8px; margin: 2px 4px 0 0; }
.sim-member i { font-style: normal; font-size: 10px; text-transform: uppercase; color: var(--text-2); }
.sim-member.r-controller { background: #ede3fb; } .sim-member.r-crew { background: var(--sim-ok-bg); } .sim-member.r-patient { background: #fde9d7; }
.sc-head-actions { margin-top: 10px; }
.sc-grid { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 16px; align-items: start; }
.sc-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sc-panel .panel-body { padding: 12px 14px; }
.sc-mini { background: #000; border-radius: 6px; overflow: hidden; display: grid; grid-template-columns: 1fr 190px; }
.sc-canvas { width: 100%; height: 200px; display: block; }
.sc-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 6px; align-content: start; }
.sc-num { display: flex; flex-direction: column; color: #fff; padding: 2px 4px; }
.sc-num small { font-size: 10px; letter-spacing: .5px; opacity: .8; }
.sc-num b { font-size: 22px; font-family: ui-monospace, Menlo, Consolas, monospace; line-height: 1.1; }
.sc-num .sim-muted { color: #9aa; font-size: 10px; }
.sc-num.c-hr { color: #3dff6e; } .sc-num.c-sp { color: #38d6ff; } .sc-num.c-co { color: #ffe14a; } .sc-num.c-t { color: #ff8ad8; }
.sc-num.c-rh { grid-column: 1 / -1; } .sc-num.c-rh b { font-size: 13px; font-family: inherit; }
.sc-num.c-rh .sim-tag { margin: 4px 0 0; }
.sc-rgroup { margin-bottom: 6px; } .sc-rgroup small { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: .5px; }
.sc-rbtns { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }
.sc-rbtn { border: 1px solid var(--line-2); background: var(--bg); border-radius: 3px; padding: 6px 9px; font-weight: 700; font-size: 12px; cursor: pointer; min-width: 52px; }
.sc-rbtn.pl { border-color: #f3c3bd; color: var(--sim-bad); }
.sc-rbtn.on { background: var(--navy); color: #3dff6e; border-color: var(--navy); }
.sc-vrow { display: grid; grid-template-columns: 76px 1fr 78px 44px 108px; gap: 8px; align-items: center; padding: 3px 0; font-size: 13px; }
.sc-vrow label { font-weight: 600; color: var(--navy); }
.sc-range { width: 100%; accent-color: var(--blue); }
.sc-now { font-size: 12px; white-space: nowrap; } .sc-now.moving { color: #0a8fd6; font-weight: 700; }
.sc-vt { display: none; }
.sc-vactions { margin-top: 8px; }
.sc-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 13px; }
.sc-form label { display: flex; flex-direction: column; gap: 4px; color: var(--text-2); }
.sc-form label.sim-check { flex-direction: row; }
.sc-leads { grid-column: 1 / -1; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.sc-stage { border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.sc-stage.on { border-color: var(--green); background: #f2fbf5; box-shadow: inset 4px 0 0 var(--green); }
.sc-stage-head { display: flex; gap: 8px; align-items: center; } .sc-stage-head b { flex: 1; font-size: 14px; }
.sc-stage-v { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; margin: 4px 0; }
.sc-stage-p, .sc-stage-x { margin: 4px 0; }
.sc-hint { margin-top: 6px; }
.sc-chips { display: flex; flex-wrap: wrap; gap: 0; margin: 8px 0; }
.sc-chips .chip { font-size: 12px; }
.sc-inrow { flex-wrap: nowrap; } .sc-inrow .input { flex: 1; min-width: 0; }
.sc-alert { border-left: 5px solid var(--blue); background: #eef7fc; padding: 10px 12px; border-radius: 3px; margin-bottom: 10px; font-size: 14px; }
.sc-alert.red { border-color: var(--red); background: #fff1ef; animation: sim-pulse 1.4s ease-in-out infinite; }
.sc-alert.amber { border-color: var(--yellow); background: #fffbea; }
.sc-req { border: 1px solid #f0dc9a; background: #fffbea; border-radius: 4px; padding: 8px 10px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.sc-find { border-bottom: 1px solid var(--line); padding: 6px 0; }
.sc-find.rev .sc-find-head b { color: var(--sim-ok); }
.sc-find-head { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; } .sc-find-head b { flex: 1; font-size: 13px; }
.sc-find textarea { font-size: 13px; padding: 6px 8px; }
.sc-findings { max-height: 520px; overflow: auto; }
.sc-log { max-height: 520px; overflow: auto; }
.sc-log .r-crew span:nth-child(2) { font-weight: 600; }
.sc-tog { padding: 6px 0; } .sc-tog span { display: flex; flex-direction: column; } .sc-tog small { font-size: 12px; }
.sc-cues-log { max-height: 160px; overflow: auto; }
.sc-radio-log { max-height: 260px; }
@keyframes sim-pulse { 50% { box-shadow: 0 0 0 4px rgba(231, 76, 60, .2); } }

/* radio chat (crew + controller) */
.sim-radio { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.sim-radio-log { display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 120px; max-height: 50vh; padding: 4px 2px; }
.sim-msg { max-width: 88%; padding: 8px 10px; border-radius: 10px; font-size: 14px; line-height: 1.35; background: #e8edf1; color: #1d2a36; align-self: flex-start; }
.sim-msg.me { align-self: flex-end; background: #d6f5e1; }
.sim-msg-by { font-size: 11px; color: #5d6d7c; margin-bottom: 2px; }
.sim-radio-in { font-size: 14px; }

/* ---------- Cardiac Monitor Simulator (crew) ---------- */
.sim-full { position: fixed; inset: 0; z-index: 95; } /* below modals (100) and the roleplay footer */
.sm-wrap { background: #0b0f13; display: grid; grid-template-columns: 1fr 360px; gap: 0; color: #e8eef3; font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif; padding-bottom: 28px; }
.sm-device { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: linear-gradient(#2a3138, #1b2025); padding: 10px; gap: 8px; border-right: 3px solid #12161a; }
.sm-top { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #cfd8df; flex-wrap: wrap; }
.sm-brand { font-weight: 800; letter-spacing: 1.5px; color: #ff9e2c; font-size: 12px; }
.sm-mode { background: #11161b; border: 1px solid #3a444d; color: #3dff6e; font-weight: 700; padding: 2px 8px; border-radius: 3px; font-size: 12px; letter-spacing: .5px; }
.sm-pt { color: #fff; font-weight: 600; }
.sm-elapsed, .sm-clock { font-family: ui-monospace, Menlo, Consolas, monospace; color: #fff; }
.sm-elapsed { color: #ffe14a; }
.sm-batt { display: inline-flex; gap: 2px; border: 1px solid #8aa; padding: 2px; border-radius: 2px; }
.sm-batt i { width: 6px; height: 10px; background: #3dff6e; }
.sm-topbtn { background: #11161b; color: #fff; border: 1px solid #3a444d; border-radius: 4px; min-width: 36px; height: 32px; font-size: 16px; cursor: pointer; }
.sm-topbtn:hover { background: #222a31; }
.sm-panel-toggle { display: none; }
.sm-screen { flex: 1; display: grid; grid-template-columns: 1fr minmax(210px, 27%); background: #000; border: 6px solid #0e1114; border-radius: 10px; box-shadow: inset 0 0 40px rgba(0,0,0,.9), 0 0 0 2px #3a444d; min-height: 0; overflow: hidden; }
.sm-wavearea { position: relative; min-width: 0; min-height: 0; }
.sm-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sm-labels { position: absolute; inset: 0; pointer-events: none; }
.sm-lab { position: absolute; left: 8px; font-size: 12px; font-weight: 700; letter-spacing: .5px; }
.sm-lab.l-ecg { color: #3dff6e; } .sm-lab.l-spo2 { color: #38d6ff; } .sm-lab.l-co2 { color: #ffe14a; }
.sm-banner { position: absolute; left: 50%; top: 8%; transform: translateX(-50%); padding: 6px 16px; border-radius: 4px; font-weight: 800; letter-spacing: 1px; font-size: 18px; display: none; text-align: center; min-width: 260px; z-index: 3; }
.sm-banner.on { display: block; }
.sm-banner.b-info { background: #1b2a38; color: #fff; border: 1px solid #38d6ff; }
.sm-banner.b-warn { background: #3b3000; color: #ffe14a; border: 1px solid #ffe14a; }
.sm-banner.b-shock { background: #5a1300; color: #ffb066; border: 2px solid #ff7a1a; animation: sm-blink 0.8s steps(2) infinite; }
.sm-banner.b-ok { background: #0f3a1c; color: #3dff6e; border: 1px solid #3dff6e; }
.sm-progress { height: 5px; background: #333; margin-top: 6px; border-radius: 3px; overflow: hidden; }
.sm-progress i { display: block; height: 100%; width: 100%; background: currentColor; transform-origin: left; animation: sm-fill 2.2s linear forwards; }
.sm-progress.slow i { animation-duration: 3.4s; }
@keyframes sm-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes sm-blink { 50% { opacity: .55; } }
.sm-alarm { position: absolute; right: 8px; top: 6px; color: #ff4d4d; font-weight: 800; font-size: 14px; letter-spacing: .5px; display: none; z-index: 2; text-align: right; max-width: 70%; }
.sm-alarm.on { display: block; animation: sm-blink 1s steps(2) infinite; }
.sm-alarm.silenced { animation: none; opacity: .7; }
.sm-alarm.silenced::before { content: '🔇 '; }
.sm-status { position: absolute; left: 8px; bottom: 6px; font-weight: 800; letter-spacing: 1px; font-size: 13px; color: #ff9e2c; display: none; z-index: 2; background: rgba(0,0,0,.6); padding: 2px 6px; }
.sm-status.on { display: block; }
.sm-cue { position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); background: rgba(255, 255, 255, .95); color: #111; font-weight: 700; padding: 10px 18px; border-radius: 6px; font-size: 17px; max-width: 86%; text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,.6); display: none; z-index: 4; }
.sm-cue::before { content: 'SCENE: '; color: #b8541a; }
.sm-cue.on { display: block; }
.sm-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 5; }
.sm-flash.on { animation: sm-flash .45s ease-out; }
@keyframes sm-flash { 0% { opacity: .95; } 100% { opacity: 0; } }
.sm-nums { display: flex; flex-direction: column; border-left: 1px solid #222; min-height: 0; }
.sm-box { flex: 1; padding: 4px 10px; border-bottom: 1px solid #1d1d1d; display: flex; flex-direction: column; justify-content: center; position: relative; min-height: 0; }
.sm-box-head { display: flex; gap: 6px; align-items: baseline; font-size: 13px; font-weight: 700; letter-spacing: .5px; }
.sm-unit { font-size: 10px; opacity: .75; font-weight: 400; }
.sm-val { font-family: 'Arial Narrow', 'Roboto Condensed', Arial, sans-serif; font-weight: 700; font-size: clamp(30px, 5.2vh, 64px); line-height: 1; letter-spacing: -1px; }
.sm-sub { font-size: 11px; opacity: .85; min-height: 13px; letter-spacing: .5px; }
.sm-lim { position: absolute; right: 8px; top: 6px; font-size: 10px; opacity: .6; }
.b-hr { color: #3dff6e; } .b-spo2 { color: #38d6ff; } .b-nibp { color: #f2f2f2; } .b-co2 { color: #ffe14a; } .b-rr { color: #ffe14a; } .b-temp { color: #ff8ad8; flex: 0.6; }
.b-hr .sm-val { font-size: clamp(40px, 8vh, 96px); }
.b-nibp .sm-val { font-size: clamp(28px, 5vh, 58px); }
.sm-pair { display: grid; grid-template-columns: 1fr 1fr; flex: 1; min-height: 0; border-bottom: 1px solid #1d1d1d; }
.sm-pair .sm-box { border-bottom: 0; }
.sm-heart { color: #ff3b3b; opacity: .15; font-size: 16px; transition: opacity .08s; }
.sm-heart.on { opacity: 1; }
.sm-box.alarm { background: #4a0000; animation: sm-blink 1s steps(2) infinite; }
.sm-box.cycling .sm-val { color: #ffe14a; }
.sm-keys { display: flex; flex-wrap: wrap; gap: 8px; }
.sm-keygroup { display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch; background: #12171c; border: 1px solid #333c44; border-radius: 6px; padding: 6px; }
.sm-key { background: linear-gradient(#4a545e, #2f363d); color: #fff; border: 1px solid #12161a; border-bottom-width: 3px; border-radius: 5px; padding: 8px 12px; min-height: 46px; min-width: 70px; font-weight: 800; letter-spacing: .5px; font-size: 13px; cursor: pointer; touch-action: manipulation; }
.sm-key:active { transform: translateY(1px); border-bottom-width: 2px; }
.sm-key:disabled { opacity: .35; cursor: not-allowed; }
.sm-key.on { background: linear-gradient(#0f6f2f, #0a4a20); color: #3dff6e; }
.k-charge { background: linear-gradient(#e0b100, #a88300); color: #1b1400; }
.k-shock { background: linear-gradient(#ff7a1a, #c44d00); }
.k-shock.armed { animation: sm-blink .7s steps(2) infinite; box-shadow: 0 0 16px #ff7a1a; }
.k-analyze { background: linear-gradient(#1f8fd1, #145f8c); }
.k-sync.on { background: linear-gradient(#fff, #cfd8df); color: #111; }
.k-pacer.on, .k-pacer { }
.k-cpr.on { background: linear-gradient(#d43a2a, #8e2c22); color: #fff; }
.k-chart { background: linear-gradient(#2ecc71, #1e9a52); }
.k-light { background: linear-gradient(#3b444d, #262c32); }
.sm-select { background: #11161b; color: #fff; border: 1px solid #3a444d; border-radius: 5px; padding: 0 8px; min-height: 46px; font-weight: 600; }
.sm-energy { display: flex; align-items: stretch; gap: 4px; }
.sm-energy-box { display: flex; flex-direction: column; justify-content: center; align-items: center; background: #000; border: 1px solid #ff7a1a; border-radius: 5px; padding: 0 10px; min-width: 84px; color: #ffb066; }
.sm-energy-box small { font-size: 9px; letter-spacing: 1px; }
.sm-energy-val { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 20px; font-weight: 800; }
.sm-e { min-width: 40px; padding: 0 6px; }
.sm-pacerbar { display: none; align-items: center; gap: 12px; background: #1e1600; border: 1px solid #ff9e2c; border-radius: 6px; padding: 6px 10px; flex-wrap: wrap; }
.sm-pacerbar.on { display: flex; }
.sm-pacer-title { font-weight: 800; color: #ff9e2c; letter-spacing: 1px; }
.sm-pacer-ctl { display: flex; align-items: center; gap: 6px; }
.sm-pacer-ctl small { color: #ffcf8a; font-size: 11px; letter-spacing: 1px; }
.sm-pacer-ctl b { font-family: ui-monospace, Menlo, Consolas, monospace; min-width: 74px; text-align: center; font-size: 18px; color: #fff; }
.sm-pacer-ctl .sm-key { min-width: 46px; font-size: 18px; }
.sm-ended { position: absolute; inset: 0; background: rgba(0,0,0,.78); display: flex; align-items: center; justify-content: center; z-index: 20; text-align: center; color: #fff; }
.sm-ended h2 { color: #fff; }
/* crew panel */
.sm-panel { background: var(--bg, #fff); color: var(--text); display: flex; flex-direction: column; min-height: 0; }
.sm-panel-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; background: var(--navy); color: #fff; }
.sm-tabs { display: flex; border-bottom: 2px solid var(--line); background: var(--bg-soft); }
.sm-tab { flex: 1; border: 0; background: none; padding: 11px 4px; font-weight: 700; font-size: 13px; color: var(--text-2); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; position: relative; }
.sm-tab.on { color: var(--navy); border-bottom-color: var(--green); background: var(--bg, #fff); }
.sm-badge { display: inline-block; min-width: 16px; padding: 0 4px; margin-left: 4px; border-radius: 8px; background: var(--blue); color: #fff; font-size: 10px; line-height: 16px; }
.sm-badge.warn { background: #e98b2a; }
.sm-panel-body { flex: 1; overflow: auto; padding: 12px; font-size: 14px; }
.sim-cues .sim-cue { padding: 6px 8px; border-radius: 3px; margin-bottom: 4px; background: var(--bg-soft); font-size: 14px; }
.sim-cue.latest { background: #fff3cd; font-weight: 700; color: #3b3100; }
.sim-scene-card { border: 1px solid var(--line); border-radius: 4px; padding: 10px; margin: 10px 0; }
.sim-scene-card p { margin: 0 0 6px; }
.sim-hazards { color: var(--sim-bad); font-size: 13px; }
.sim-assess-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sim-assess-btn { display: flex; flex-direction: column; gap: 3px; text-align: left; border: 1px solid var(--line); border-radius: 5px; background: var(--bg, #fff); padding: 8px 10px; cursor: pointer; font: inherit; color: inherit; min-height: 64px; }
.sim-assess-btn b { font-size: 13px; color: var(--navy); }
.sim-assess-btn span { font-size: 12px; color: var(--text-2); }
.sim-assess-btn.revealed { border-color: var(--green); background: #f2fbf5; } .sim-assess-btn.revealed span { color: #133d22; font-weight: 600; }
.sim-assess-btn.pending { border-color: #f0dc9a; background: #fffbea; }
.sim-interp { white-space: pre-wrap; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; background: #fff8f6; border: 1px solid #f6c9c4; padding: 8px 10px; border-radius: 3px; margin: 0 0 10px; }
.sim-tx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin-bottom: 10px; }
.sim-tx { background: var(--tile); color: #fff; border: 0; border-radius: 3px; padding: 10px 8px; font-weight: 600; font-size: 13px; cursor: pointer; text-align: left; min-height: 48px; }
.sim-tx:hover { background: var(--tile-hover); }
.sim-paper { width: 100%; height: auto; border: 1px solid #ec9b93; margin-bottom: 10px; background: #fff8f6; }
.sim-12-modal .modal-body { max-height: 86vh; overflow: auto; }

/* ---------- patient player ---------- */
.sp-wrap { background: #fdf8f3; overflow: auto; color: #1d2a36; padding-bottom: 40px; font-size: 18px; }
.sp-top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #9a4b0b; color: #fff; }
.sp-top > div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.sp-top small { font-size: 11px; letter-spacing: 1.5px; opacity: .85; }
.sp-top b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-timer { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 18px; }
.sp-exit { background: rgba(255,255,255,.18); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.sp-body { max-width: 760px; margin: 0 auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.sp-now { background: #1d2a36; color: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.sp-now.flash { animation: sp-flash 1.6s ease-out; }
@keyframes sp-flash { 0% { box-shadow: 0 0 0 0 rgba(255, 158, 44, .9); background: #b8541a; } 100% { box-shadow: 0 0 0 18px rgba(255, 158, 44, 0); } }
.sp-kicker { font-size: 12px; letter-spacing: 1.5px; color: #ffcf8a; font-weight: 700; margin-bottom: 8px; }
.sp-prompt { font-size: clamp(22px, 5.4vw, 30px); font-weight: 700; line-height: 1.3; }
.sp-when { font-size: 13px; opacity: .75; margin-top: 8px; }
.sp-prev { margin-top: 10px; font-size: 15px; } .sp-prev summary { cursor: pointer; opacity: .8; }
.sp-prev-row { padding: 6px 0; border-top: 1px solid rgba(255,255,255,.15); } .sp-prev-row span { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; opacity: .7; margin-right: 8px; }
.sp-arrest-box { display: flex; flex-direction: column; gap: 4px; background: #e74c3c; color: #fff; border-radius: 12px; padding: 16px; font-size: 17px; animation: sm-blink 1.2s steps(2) infinite; }
.sp-arrest-box b { font-size: 22px; letter-spacing: 1px; }
.sp-card { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.sp-card h3 { margin: 0 0 10px; font-size: 19px; color: #9a4b0b; }
.sp-card h4 { margin: 16px 0 6px; font-size: 14px; letter-spacing: 1px; color: #5d6d7c; }
.sp-who { display: flex; flex-direction: column; } .sp-who b { font-size: 26px; } .sp-who span { color: #5d6d7c; }
.sp-cc { font-size: 22px; font-style: italic; margin: 8px 0; color: #1d2a36; }
.sp-act { background: #fff3e4; border-left: 5px solid #e98b2a; padding: 10px 12px; border-radius: 4px; margin: 10px 0; } .sp-act p { margin: 4px 0 0; }
.sp-lines ul { margin: 6px 0; padding-left: 22px; } .sp-lines li { margin: 4px 0; }
.sp-qa { display: grid; grid-template-columns: 150px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f0e6dc; font-size: 17px; } .sp-qa b { color: #5d6d7c; font-size: 14px; }
.sp-tx { list-style: none; margin: 0; padding: 0; } .sp-tx li { padding: 8px 0; border-bottom: 1px solid #f0e6dc; } .sp-t { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: #5d6d7c; }
.sp-cue { padding: 8px 0; border-bottom: 1px solid #f0e6dc; } .sp-cue span { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: #5d6d7c; margin-right: 8px; }
.sp-cue.latest { font-weight: 700; }
.sp-stages { padding-left: 22px; margin: 0; } .sp-stages li { padding: 8px 0; } .sp-stages li.on { color: #9a4b0b; } .sp-stages li.on b::after { content: '  ← NOW'; font-size: 12px; } .sp-stages li.past { opacity: .55; }
.sp-stages li div { font-size: 16px; }
.sp-muted, .sp-card .sp-muted { color: #5d6d7c; font-size: 15px; margin-top: 10px; }
.sp-ended { background: #1d2a36; color: #fff; border-radius: 12px; padding: 14px; } .sp-ended a { color: #ffcf8a; }

/* ---------- debrief ---------- */
.sim-debrief-head { margin-bottom: 14px; } .sim-debrief-head h2 { margin: 4px 0; }
.sim-kpis { margin-bottom: 18px; }
.sim-num-cell { font-family: ui-monospace, Menlo, Consolas, monospace; white-space: nowrap; width: 1%; }
.sim-expected { list-style: none; padding: 0; margin: 0; } .sim-expected li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.sim-exp-mark { display: inline-block; width: 22px; font-weight: 800; } .sim-expected li.done .sim-exp-mark { color: var(--sim-ok); } .sim-expected li.miss .sim-exp-mark { color: var(--sim-bad); }
.sim-kind { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-2); }
.sim-timeline tr.r-controller td { color: var(--text-2); }

/* ---------- responsive ---------- */
@media (max-width: 1400px) { .sc-grid { grid-template-columns: 1fr 1fr; } .sc-grid > .sc-col:nth-child(3) { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; } }
@media (max-width: 1100px) {
  .sm-wrap { grid-template-columns: 1fr; }
  .sm-panel { position: fixed; right: 0; top: 0; bottom: 28px; width: min(380px, 92vw); transform: translateX(100%); transition: transform .2s; z-index: 30; box-shadow: -6px 0 24px rgba(0,0,0,.5); }
  .sm-wrap.panel-open .sm-panel { transform: none; }
  .sm-panel-toggle { display: inline-block; }
}
@media (max-width: 900px) {
  .sim-two { grid-template-columns: 1fr; }
  .sc-grid, .sc-grid > .sc-col:nth-child(3) { grid-template-columns: 1fr; display: flex; flex-direction: column; }
  .sc-mini { grid-template-columns: 1fr; } .sc-nums { grid-template-columns: repeat(3, 1fr); }
  .sim-calls { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .sm-device { padding: 6px; overflow: auto; }
  .sm-screen { grid-template-columns: 1fr; grid-template-rows: 46vh auto; flex: none; }
  .sm-nums { display: grid; grid-template-columns: repeat(3, 1fr); border-left: 0; border-top: 1px solid #222; }
  .sm-pair { display: contents; }
  .sm-box { padding: 6px 8px; } .sm-val { font-size: 30px !important; }
  .sm-key { min-width: 60px; padding: 6px 8px; }
  .sc-vrow { grid-template-columns: 70px 1fr 70px; } .sc-vrow .sim-muted:not(.sc-now) { display: none; } .sc-now { grid-column: 2 / -1; }
  .sp-qa { grid-template-columns: 1fr; gap: 2px; }
  .sim-form3 { grid-template-columns: 1fr; }
}
@media print {
  .app-header, .module-bar, .sim-tabs, .sim-noprint, .page-head { display: none !important; }
  .sim-debrief .panel { break-inside: avoid; }
}
