:root {
  --ink: #14213d;
  --muted: #5d6978;
  --line: #d8dee8;
  --soft: #f5f8fb;
  --paper: #ffffff;
  --teal: #0f766e;
  --blue: #2563eb;
  --red: #b42318;
  --shadow: 0 18px 45px rgba(20, 33, 61, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #edf2f7;
  line-height: 1.5;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero,
.runtime-panel,
.ehr-frame,
.ehr-output {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 32px;
  border-top: 6px solid var(--teal);
}

.hero.compact {
  padding: 26px 30px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 12px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: 0;
}

.lede {
  max-width: 780px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
}

.hero-actions,
.card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.button,
.choice {
  border: 0;
  border-radius: 7px;
  background: var(--teal);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  text-decoration: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
}

.button.secondary {
  background: #e8eef7;
  color: #1e293b;
}

.button:hover,
.choice:hover {
  filter: brightness(0.96);
}

.runtime-panel {
  margin-top: 22px;
  padding: 18px;
}

.embedded-runtime .app-shell {
  width: 100%;
  padding: 0;
}

.embedded-runtime .hero {
  display: none;
}

.embedded-runtime .runtime-panel {
  margin: 0;
  border: 0;
  box-shadow: none;
}

.embedded-runtime .runtime-card {
  min-height: 520px;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.status {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef6ff;
  color: #164e96;
  font-size: 13px;
  font-weight: 750;
}

.status.good {
  background: #e6fffa;
  color: #0f766e;
}

.status.bad {
  background: #fff1f2;
  color: var(--red);
}

.status.neutral {
  background: #f1f5f9;
  color: #475569;
}

.runtime-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.card-header {
  max-width: 760px;
}

.card-header h2 {
  margin-bottom: 8px;
  font-size: 25px;
  line-height: 1.15;
}

.card-header p {
  color: var(--muted);
}

.node-type {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #eff6ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.node-type.terminal {
  background: #ecfdf5;
  color: var(--teal);
}

.node-type.error {
  background: #fff1f2;
  color: var(--red);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.choice-grid.two {
  grid-template-columns: repeat(2, minmax(0, 220px));
}

.choice {
  min-height: 54px;
  padding: 12px 14px;
  text-align: left;
}

fieldset {
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

legend,
.input-label {
  display: block;
  margin-bottom: 8px;
  color: #334155;
  font-weight: 750;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.radio-row {
  align-items: flex-start;
}

.screener-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.screener-question {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.number-input {
  width: min(320px, 100%);
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
}

.input-error {
  margin: 8px 0 0;
  color: var(--red);
  font-weight: 700;
}

.video-wrap {
  width: min(760px, 100%);
  margin-top: 18px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #0f172a;
}

.video-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.decision-box {
  margin-top: 18px;
}

.path-summary {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.path-summary summary {
  cursor: pointer;
  font-weight: 800;
}

.path-summary ol {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.45;
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #f1f5f9;
}

.embed-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
  gap: 18px;
  margin-top: 22px;
}

.ehr-frame,
.ehr-output {
  padding: 18px;
}

.curebuilders-iframe {
  width: 100%;
  min-height: 720px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.error-list {
  color: var(--red);
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 16px;
  }

  .hero,
  .runtime-card {
    padding: 20px;
  }

  .choice-grid,
  .choice-grid.two,
  .embed-layout {
    grid-template-columns: 1fr;
  }
}
