:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #182033;
  --muted: #667085;
  --border: #d8dee9;
  --primary: #244c8f;
  --primary-soft: #e6edf8;
  --pass: #0f7b4f;
  --stop: #b42318;
  --waiting: #7a5a00;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  background: #101828;
  color: white;
}
.topbar h1 { margin: 0; font-size: 24px; }
.topbar p { margin: 4px 0 0; color: #d0d5dd; }
.gate {
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 700;
  background: #fff;
}
.gate-pass { color: var(--pass); }
.gate-stop { color: var(--stop); }
.gate-waiting { color: var(--waiting); }
.layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(420px, 1.55fr);
  gap: 18px;
  padding: 18px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.04);
}
.panel h2 { margin: 0 0 12px; font-size: 18px; }
.patient-panel, .request-panel { grid-column: 1; }
.workspace-panel { grid-column: 2; grid-row: 1 / span 2; }
.helper, .summary, .empty { color: var(--muted); }
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-size: 16px;
  resize: vertical;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
button {
  border: 0;
  background: var(--primary);
  color: white;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}
button.example {
  display: block;
  width: 100%;
  margin: 8px 0 0;
  background: var(--primary-soft);
  color: var(--primary);
  text-align: left;
}
.examples h3 { margin: 18px 0 8px; font-size: 15px; }
.context-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.context-grid div, .mini-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}
.context-grid span, .mini-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.workspace-sections {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}
.workspace-section {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: #fbfcff;
}
.workspace-section h3 {
  margin: 0 0 10px;
  font-size: 16px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.narrative {
  line-height: 1.55;
  margin: 0;
}
.table-wrap {
  overflow: auto;
  max-height: 380px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 8px;
  vertical-align: top;
}
th {
  position: sticky;
  top: 0;
  background: #eef2f8;
  z-index: 1;
}
.chart-box {
  height: 360px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.chart-box canvas { min-height: 320px; }
.trace-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  line-height: 1.55;
  font-size: 14px;
}
.trace-box hr { border: 0; border-top: 1px solid var(--border); margin: 10px 0; }
pre { white-space: pre-wrap; overflow: auto; }
@media (max-width: 950px) {
  .layout { grid-template-columns: 1fr; }
  .patient-panel, .request-panel, .workspace-panel { grid-column: 1; grid-row: auto; }
  .topbar { align-items: flex-start; flex-direction: column; }
}

/* V3: generic clinical workspace shell. No clinical bucket styling required. */
.workspace-section.visualization,
.workspace-section.table,
.workspace-section.traceability,
.workspace-section.narrative,
.workspace-section.cards {
  border-left: 4px solid rgba(55, 65, 81, 0.25);
}
