 
:root {
  --bg: #efeee9; --panel: #ffffff; --panel2: #f7f6f2; --ink: #1c2026; --muted: #5f6771; --line: #dcdad2;
  --accent: #0e7a83; --accent-ink: #ffffff; --amber: #e39a12; --good: #1d8a4e; --bad: #c0392b; --crit: #a3121a; --info: #2f63b8;
  --good-bg: #e7f4ec; --bad-bg: #fbece9; --crit-bg: #fde3e3; --info-bg: #e8effb;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05); --r: 12px; --screen: #0b0f14;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1115; --panel: #161a20; --panel2: #1c2129; --ink: #e6e8eb; --muted: #9aa3ad; --line: #2a3039;
    --accent: #2bb3bd; --accent-ink: #061216; --amber: #f2ae2e; --good: #3fbf78; --bad: #ef6b5b; --crit: #ff7a7a; --info: #7da7f0;
    --good-bg: #13291d; --bad-bg: #2d1916; --crit-bg: #3a1414; --info-bg: #16213a;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1115; --panel: #161a20; --panel2: #1c2129; --ink: #e6e8eb; --muted: #9aa3ad; --line: #2a3039;
  --accent: #2bb3bd; --accent-ink: #061216; --amber: #f2ae2e; --good: #3fbf78; --bad: #ef6b5b; --crit: #ff7a7a; --info: #7da7f0;
  --good-bg: #13291d; --bad-bg: #2d1916; --crit-bg: #3a1414; --info-bg: #16213a;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.row { display: flex; gap: 8px; align-items: center; } .row.wrap { flex-wrap: wrap; } .row.end { justify-content: flex-end; }

 
.topbar { display: flex; align-items: center; gap: 12px 16px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; border: 0; background: none; cursor: pointer; padding: 0; text-align: left; }
.brand > span { display: flex; flex-direction: column; min-width: 0; }
.logo { width: 30px; height: 30px; flex: none; } .logo-a { fill: var(--ink); } .logo-b { stroke: var(--amber); stroke-width: 3.2; stroke-linecap: round; } .logo-c { stroke: var(--panel); stroke-width: 2.2; stroke-linecap: round; }
.brand .h1 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.brand .sub { font-size: 12px; color: var(--muted); }
.modes { display: flex; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-left: auto; }
.modes button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 600; }
.modes button[aria-selected="true"] { background: var(--ink); color: var(--panel); }
.modes button:disabled { opacity: .45; cursor: not-allowed; }
.top-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.modes:not([hidden]) + .top-right { margin-left: 0; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; padding: 5px 11px; cursor: pointer; max-width: 200px; }
.chip-btn span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#fbEmail { width: 100%; margin-top: 8px; }
.fb-btn { font-weight: 600; }
.chip-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.chip-btn.signed .dot { background: var(--good); }
.icon-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; font-weight: 700; flex: none; }

 
.btn { border: 1px solid var(--line); background: var(--panel2); border-radius: 8px; padding: 7px 12px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ok { background: var(--good); color: #fff; border-color: var(--good); }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; font-weight: 600; padding: 2px 0; text-align: left; }
.toggle { border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--muted); }
.toggle[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }

 
.home { max-width: 1100px; margin: 0 auto; padding: 24px 16px 8px; }
.hero h1 { font-size: 28px; letter-spacing: -.02em; }
.hero p { max-width: 720px; color: var(--muted); font-size: 15px; }
.cats { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 12px; }
.cats button { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-weight: 600; color: var(--muted); }
.cats button[aria-selected="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card h3 { font-size: 17px; }
.card .sub { color: var(--muted); margin: 0; }
.card.soon { opacity: .62; }
.card .tag { align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.card .tag.live { color: var(--good); border-color: var(--good); }
.opt { display: flex; flex-direction: column; gap: 4px; }
.opt > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: var(--panel2); padding: 7px 6px; font-size: 13px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.card .prog { font-size: 12.5px; color: var(--muted); margin: 0; }


 
.sim { display: grid; gap: 12px; padding: 12px 16px; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; max-width: 1500px; margin: 0 auto; }
.col-main { display: grid; gap: 12px; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 10px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.panel-head.sub { margin-top: 10px; }
.panel h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.side { display: grid; gap: 12px; min-width: 0; }

 
.monitor { background: var(--screen); color: #e8f0f2; border-color: #222a33; padding: 8px 10px 10px; }
.mon-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-variant-numeric: tabular-nums; margin-bottom: 4px; }
.mon-title { font-weight: 700; font-size: 13px; color: #c9d4da; margin-right: auto; }
.mon-clock b { font-size: 18px; color: #fff; }
.mon-clock .lab, .val .lab { font-size: 11px; color: #8fa0ab; font-weight: 700; letter-spacing: .06em; }
.mon-flag { font-size: 12px; font-weight: 800; letter-spacing: .08em; color: #ff5a5a; }
.strips { display: grid; gap: 2px; }
.strip { display: grid; grid-template-columns: minmax(0, 1fr) 118px; align-items: stretch; border-top: 1px solid #1a222c; }
.strip:first-child { border-top: 0; }
.strip canvas { width: 100%; height: 74px; display: block; }
.strip:first-child canvas { height: 96px; }
.val { display: flex; flex-direction: column; justify-content: center; padding-left: 10px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.val b { font-size: 28px; font-weight: 700; }
.val .sm { font-size: 11px; } .val .sm b { font-size: 13px; }
.v-ecg b, .v-ecg .lab { color: #37e07a; } .v-art b, .v-art .lab { color: #ff5e5e; } .v-cvp b, .v-cvp .lab { color: #5fb4ff; } .v-co2 b, .v-co2 .lab { color: #ffd84d; }
.mon-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.monitor .btn { background: #1a222c; border-color: #2c3844; color: #e8f0f2; }
.monitor .btn.ghost { background: none; }
.monitor .btn kbd { background: #0f151c; border-color: #2c3844; color: #c9d4da; }
.monitor .btn.done { border-color: #37e07a; color: #37e07a; }

 
.devices { display: grid; grid-template-columns: 1fr 1.25fr 1.35fr; gap: 12px; align-items: start; }
.dev .readout { font-variant-numeric: tabular-nums; font-weight: 600; margin: 6px 0; min-height: 1.4em; }
.btn.big { width: 100%; padding: 14px 10px; font-size: 16px; }
.btn[aria-pressed="true"] { background: var(--good); color: #fff; border-color: var(--good); }
.btn.shock { background: var(--crit); color: #fff; border-color: var(--crit); }
.btn.shock:disabled { background: var(--panel2); color: var(--muted); border-color: var(--line); }
.btn.shock.ready { animation: toolpulse 0.9s ease-in-out infinite; }
.btn.emerg { background: var(--amber); color: #1b1300; border-color: var(--amber); }
.chiprow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chip { border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; padding: 5px 11px; cursor: pointer; font-weight: 600; font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.bar { height: 6px; border-radius: 3px; background: var(--panel2); overflow: hidden; margin: 6px 0 8px; }
.bar i { display: block; height: 100%; width: 0; background: var(--amber); }
.bar i.full { background: var(--crit); }
.defib-btns .btn { flex: 1 1 auto; }
.steppers { display: grid; gap: 6px; margin: 8px 0; }
.stepper { display: grid; grid-template-columns: 36px 34px 44px 34px auto; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.stepper b { text-align: center; font-size: 17px; }
.st-btn { width: 34px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; font-weight: 700; font-size: 16px; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; font: 600 11px ui-monospace, monospace; background: var(--panel2); }
.btn kbd { margin-right: 4px; opacity: .8; }

 
.aid.hidden-list .steps { display: none; }
.orders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.order { display: flex; align-items: center; gap: 6px; text-align: left; border: 1px solid var(--line); background: var(--panel2); border-radius: 8px; padding: 6px 8px; cursor: pointer; font-size: 13px; font-weight: 600; min-width: 0; }
.order span { overflow-wrap: anywhere; }
.order .n { flex: none; }
.order.given { border-color: var(--good); }
.order.given::after { content: '✓'; color: var(--good); margin-left: auto; }
.feedlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 42vh; overflow: auto; }
.feedlist li { border-radius: 8px; padding: 7px 9px; font-size: 13px; border-left: 4px solid var(--line); background: var(--panel2); }
.feedlist li.error { border-color: var(--bad); } .feedlist li.critical { border-color: var(--crit); background: var(--crit-bg); }
.feedlist li.coach { border-color: var(--info); } .feedlist li.info { border-color: var(--muted); }
.feedlist .tag { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.feedlist li.error .tag { color: var(--bad); } .feedlist li.critical .tag { color: var(--crit); } .feedlist li.coach .tag { color: var(--info); }
.feedlist .fb { float: right; }
.pill-proposed { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--amber); border: 1px solid var(--amber); border-radius: 999px; padding: 0 6px; margin-left: 4px; }

 
.debrief-page h1 { font-size: 26px; letter-spacing: -.02em; }
.guess { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 14px 0; box-shadow: var(--shadow); }
.guess h2 { font-size: 18px; margin-bottom: 8px; }
.subs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 12px 0; }
.sub-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.sub-card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sub-card .big { font-size: 30px; font-weight: 800; }
.sub-card ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; font-size: 13px; }
.sub-card li::before { content: '✓ '; color: var(--good); font-weight: 800; }
.sub-card li.fired::before { content: '✗ '; color: var(--bad); }
.sub-card li.fired.crit::before { color: var(--crit); }
.timeline { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; overflow: hidden; }
.timeline svg { width: 100%; height: auto; display: block; font: 600 11px system-ui, sans-serif; }
.tl-lbl { fill: var(--muted); } .tl-axis { stroke: var(--line); } .tl-tick { fill: var(--muted); font-weight: 500; }
.tl-sinus { fill: #37b86a; } .tl-vf { fill: #d9443c; } .tl-asystole { fill: #7d8791; } .tl-postshock { fill: #9aa3ad; } .tl-paced { fill: #2f8fd8; } .tl-pea { fill: #9b59b6; } .tl-vt, .tl-torsades { fill: #e0772c; }
.tl-cpr { fill: var(--accent); } .tl-pause-bad { fill: var(--bad); } .tl-hold { fill: url(#hatch); }
.tl-hatch { stroke: var(--good); stroke-width: 2; }
.tl-shock { fill: var(--amber); stroke: var(--ink); stroke-width: .6; } .tl-order { fill: var(--info); } .tl-rule { fill: var(--crit); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 12px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

@media (max-width: 1100px) {
  .devices { grid-template-columns: 1fr 1fr; }
  .devices .pacer { grid-column: 1 / -1; }
}
@media (max-width: 1000px) {
  .sim { grid-template-columns: minmax(0, 1fr); padding: 8px; }
}
@media (max-width: 620px) {
  .devices { grid-template-columns: minmax(0, 1fr); }
  .strip { grid-template-columns: minmax(0, 1fr) 84px; }
  .strip canvas { height: 58px; } .strip:first-child canvas { height: 72px; }
  .val b { font-size: 20px; }
  .orders { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .topbar { padding: 8px 10px; }
  .brand .sub { font-size: 11px; }
  .modes { order: 3; width: 100%; margin-left: 0; justify-content: center; }
  .hero h1 { font-size: 22px; }
  .sim { padding: 8px 6px; }
  .mon-head { gap: 8px; }
}
.result { border-radius: 10px; padding: 9px 11px; font-size: 13.5px; border: 1px solid transparent; }
.result.ok { background: var(--good-bg); border-color: var(--good); }
.result.error { background: var(--bad-bg); border-color: var(--bad); }
.result.critical { background: var(--crit-bg); border-color: var(--crit); }
.result.info { background: var(--panel2); border-color: var(--line); }
.result.recovery { background: var(--info-bg); border-color: var(--info); }
.result .tag { display: block; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; margin-bottom: 2px; }
.result.ok .tag { color: var(--good); } .result.error .tag { color: var(--bad); } .result.critical .tag { color: var(--crit); } .result.recovery .tag { color: var(--info); }
.steps { margin: 8px 0 0; padding-left: 0; list-style: none; display: grid; gap: 2px; }
.steps li { display: flex; gap: 8px; padding: 4px 6px; border-radius: 6px; font-size: 13px; }
.steps li .n { width: 26px; flex: none; color: var(--muted); font-weight: 700; text-align: right; }
.steps li.done { color: var(--muted); } .steps li.done .n::after { content: ' ✓'; color: var(--good); }
.steps li.now { background: color-mix(in srgb, var(--amber) 16%, transparent); font-weight: 700; }
 
.foot { max-width: 1500px; margin: 8px auto 20px; padding: 0 16px; color: var(--muted); font-size: 12.5px; }
.foot p { margin: 4px 0; }
.copyright { font-weight: 600; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-card { background: var(--panel); border-radius: 14px; padding: 16px; width: min(560px, 100%); max-height: 90vh; overflow: auto; display: grid; gap: 10px; }
.modal-card.wide { width: min(960px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.modal-head h2 { font-size: 18px; }
input[type=email] { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--panel2); border-radius: 8px; padding: 7px 10px; }
.profile-list { display: flex; flex-wrap: wrap; gap: 6px; }
.progress-table table, table.keys { border-collapse: collapse; width: 100%; font-size: 13px; }
.progress-table td, .progress-table th, table.keys td { border-bottom: 1px solid var(--line); padding: 5px 6px; text-align: left; }
.danger-text { color: var(--bad); }
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.help-grid h3 { font-size: 14px; margin: 4px 0; }
.help-grid ul { padding-left: 18px; margin: 4px 0 10px; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font: 600 12px ui-monospace, monospace; background: var(--panel2); }
.debrief { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; max-height: 40vh; overflow: auto; }
.debrief li { border-left: 3px solid var(--bad); padding: 3px 8px; font-size: 13px; background: var(--panel2); border-radius: 0 6px 6px 0; }
.debrief li.critical { border-color: var(--crit); }
.stat-row { display: flex; gap: 16px; flex-wrap: wrap; }
.stat { background: var(--panel2); border-radius: 10px; padding: 8px 12px; } .stat b { display: block; font-size: 20px; }

.logo .logo-b { fill: none; stroke: #37e07a; stroke-width: 2.6; stroke-linejoin: round; }
.logo .logo-a { fill: #0b0f14; }
.card .brief { color: var(--muted); margin: 0; font-size: 13.5px; }
.note-proposed { max-width: 900px; }
.btn.shock kbd, .btn[aria-pressed="true"] kbd, .toggle[aria-pressed="true"] kbd, .btn.emerg kbd, .btn.primary kbd { background: transparent; color: inherit; border-color: currentColor; }
.btn.shock:disabled kbd { color: var(--muted); }
.steps li .n { width: 34px; }
.orders.one { grid-template-columns: minmax(0, 1fr); }
.order.stopped { border-color: var(--muted); color: var(--muted); text-decoration: line-through; }
.order.stopped::after { content: 'stopped'; margin-left: auto; font-size: 11px; text-decoration: none; }
.rs .rs-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 8px 0; }
.order.busy { border-color: var(--info); box-shadow: inset 0 0 0 1px var(--info); }
@media (max-width: 1100px) { .rs .rs-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .rs .rs-steps { grid-template-columns: minmax(0, 1fr); } }
