:root {
  --bg: #08111f;
  --panel: rgba(255, 255, 255, 0.075);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.16);
  --text: #f8fafc;
  --muted: rgba(248, 250, 252, 0.68);
  --accent: #48c6a8;
  --accent-dark: #0f8f75;
  --warn: #f5b74f;
  --bad: #ff7161;
  --good: #67d98d;
  --paper: #fffdf6;
  --ink: #172033;
}

* {
  box-sizing: border-box;
}

body.demo-page {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: linear-gradient(135deg, #07110f 0%, #18231f 48%, #0d1214 100%);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  overflow-x: hidden;
}

.demo-header {
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(190px, 260px) 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(2, 8, 18, 0.72);
}

.demo-header img {
  width: 220px;
  max-width: 100%;
  display: block;
}

.demo-title,
.demo-status {
  display: grid;
  gap: 4px;
}

.demo-title span,
.demo-status span,
.kicker,
.panel-heading span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.demo-title strong {
  font-size: 24px;
  font-weight: 760;
  line-height: 1;
}

.demo-status {
  justify-items: end;
}

.demo-status strong {
  font-size: 22px;
}

.demo-shell {
  width: min(1500px, 96vw);
  min-height: calc(100vh - 74px);
  display: grid;
  grid-template-columns: minmax(240px, 0.78fr) minmax(520px, 1.55fr) minmax(260px, 0.8fr);
  gap: 16px;
  margin: 0 auto;
  padding: 18px 0 28px;
}

.demo-panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(16px);
}

.queue-panel,
.patient-panel {
  align-self: start;
  position: sticky;
  top: 92px;
  padding: 14px;
}

.workspace-panel {
  padding: 18px;
}

.panel-heading,
.workspace-topline,
.action-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.panel-heading {
  margin-bottom: 12px;
}

button {
  border: 0;
  border-radius: 8px;
  min-height: 38px;
  padding: 9px 13px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

button:focus-visible,
input:focus,
textarea:focus {
  outline: 3px solid rgba(72, 198, 168, 0.42);
  outline-offset: 2px;
}

.panel-heading button,
.secondary-btn {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.secondary-btn.danger {
  background: rgba(255, 113, 97, 0.18);
  border-color: rgba(255, 113, 97, 0.36);
}

.primary-btn {
  color: #04110e;
  background: var(--accent);
}

.queue-list {
  display: grid;
  gap: 9px;
}

.queue-item {
  width: 100%;
  display: grid;
  gap: 5px;
  text-align: left;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.queue-item.active {
  background: rgba(72, 198, 168, 0.18);
  border-color: rgba(72, 198, 168, 0.5);
}

.queue-item.done {
  border-color: rgba(103, 217, 141, 0.52);
}

.queue-item.failed {
  border-color: rgba(255, 113, 97, 0.55);
}

.queue-item small {
  color: var(--muted);
  font-weight: 700;
}

.queue-item strong {
  font-size: 15px;
}

.workspace-topline {
  align-items: start;
  margin-bottom: 14px;
}

.workspace-topline h1 {
  margin: 4px 0 0;
  font-size: 32px;
  line-height: 1.05;
}

.case-outcome {
  border-radius: 999px;
  padding: 8px 12px;
  color: #06101d;
  background: var(--warn);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.case-outcome.pass {
  background: var(--good);
}

.case-outcome.fail {
  background: var(--bad);
}

.rx-paper {
  color: var(--ink);
  background: var(--paper);
  border: 1px solid rgba(23, 32, 51, 0.16);
  border-radius: 8px;
  padding: 18px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.rx-paper-header,
.rx-paper-grid,
.profile-grid,
.answer-grid {
  display: grid;
  gap: 10px;
}

.rx-paper-header {
  grid-template-columns: 1fr auto;
  align-items: start;
  margin-bottom: 14px;
}

.rx-paper h2 {
  margin: 0;
  font-size: 24px;
}

.rx-paper-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rx-field,
.profile-field,
.answer-field {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.rx-field span,
.profile-field span,
.answer-field span {
  color: rgba(23, 32, 51, 0.56);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rx-field strong,
.profile-field strong,
.answer-field strong {
  overflow-wrap: anywhere;
}

.rx-field.wide {
  grid-column: 1 / -1;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.entry-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.entry-grid input,
.entry-grid textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.2);
  font: inherit;
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
}

.wide-field {
  grid-column: 1 / -1;
}

.action-row {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: 14px;
}

.feedback-panel {
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.feedback-panel h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.feedback-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.feedback-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.feedback-list li {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  line-height: 1.35;
}

.feedback-list li.pass {
  border-left: 4px solid var(--good);
}

.feedback-list li.fail {
  border-left: 4px solid var(--bad);
}

#patientProfile {
  color: var(--text);
}

.profile-name {
  margin: 0 0 12px;
  font-size: 28px;
  line-height: 1;
}

.profile-grid,
.answer-grid {
  grid-template-columns: 1fr;
}

.profile-field,
.answer-field {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.profile-field span,
.answer-field span {
  color: rgba(248, 250, 252, 0.52);
}

.answer-key {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.answer-key h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

@media (max-width: 1100px) {
  .demo-header,
  .demo-shell {
    grid-template-columns: 1fr;
  }

  .demo-status {
    justify-items: start;
  }

  .queue-panel,
  .patient-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .demo-header {
    padding: 12px 14px;
  }

  .demo-shell {
    width: min(100% - 20px, 1500px);
  }

  .entry-grid,
  .rx-paper-grid {
    grid-template-columns: 1fr;
  }

  .workspace-topline {
    display: grid;
  }
}
