:root {
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --color-background-tertiary: #f7f9fc;
  --wizard-text: #1a2633;
  --wizard-muted: #6a8aaa;
  --wizard-border: #e8ecf0;
  --wizard-primary: #1b3a5c;
  --wizard-save: #1a7a3a;
  --wizard-warning-bg: #fff6d8;
  --wizard-warning-text: #8a6400;
  --wizard-success: #1a7a3a;
  --wizard-danger: #b42318;
  --wizard-blue-soft: #eaf2ff;
}

.clinical-wizard-shell {
  min-height: 100vh;
  padding: 116px 20px 88px;
  background: var(--color-background-tertiary);
  color: var(--wizard-text);
  font-family: var(--font-sans);
}

.wizard-topbar {
  position: fixed;
  z-index: 50;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  border-bottom: 0.5px solid var(--wizard-border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.wizard-topbar__title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 750;
  color: var(--wizard-text);
}

.wizard-topbar__title span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wizard-prototype-badge {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--wizard-warning-bg);
  color: var(--wizard-warning-text);
  font-size: 0.78rem;
  font-weight: 800;
}

.wizard-topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wizard-health {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--wizard-muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.wizard-technical-link {
  border: 0.5px solid var(--wizard-border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--wizard-primary);
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 800;
}

.wizard-progress {
  position: fixed;
  z-index: 45;
  top: 48px;
  left: 0;
  right: 0;
  height: 52px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 0.5px solid var(--wizard-border);
  background: rgba(255, 255, 255, 0.96);
}

.wizard-step-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--wizard-text);
  cursor: pointer;
  font-weight: 750;
  opacity: 0.45;
}

.wizard-step-tab:disabled {
  cursor: not-allowed;
}

.wizard-step-tab--active {
  border-bottom-color: var(--wizard-primary);
  opacity: 1;
}

.wizard-step-tab--completed {
  border-bottom-color: var(--wizard-success);
  opacity: 1;
}

.wizard-step-number {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--wizard-border);
  color: var(--wizard-muted);
  background: #ffffff;
  font-size: 0.82rem;
  font-weight: 850;
}

.wizard-step-tab--active .wizard-step-number {
  border-color: var(--wizard-primary);
  background: var(--wizard-primary);
  color: #ffffff;
}

.wizard-step-tab--completed .wizard-step-number {
  border-color: var(--wizard-success);
  background: var(--wizard-success);
  color: #ffffff;
}

.wizard-step-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wizard-content {
  max-width: 820px;
  margin: 0 auto;
}

.wizard-step-panel {
  display: none;
}

.wizard-step-panel--active {
  display: grid;
  gap: 16px;
}

.wizard-card {
  background: #ffffff;
  border: 0.5px solid var(--wizard-border);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 8px 24px rgba(27, 58, 92, 0.04);
}

.wizard-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.wizard-card h2,
.wizard-card h3 {
  margin: 0;
  color: var(--wizard-text);
}

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

.wizard-case-controls {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.wizard-case-search {
  max-width: none;
}

.wizard-case-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.wizard-case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.wizard-case-card {
  min-height: 184px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 16px;
  border: 0.5px solid var(--wizard-border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--wizard-text);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(27, 58, 92, 0.035);
}

.wizard-case-card:hover {
  border-color: #b9c9d8;
}

.wizard-case-card--selected {
  border-color: var(--wizard-primary);
  background: #f1f6fb;
  box-shadow: 0 0 0 2px rgba(27, 58, 92, 0.12);
}

.wizard-case-card__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wizard-case-card__topline strong {
  font-size: 1rem;
  letter-spacing: 0;
}

.wizard-selected-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--wizard-primary);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 850;
}

.wizard-case-card__patient {
  font-weight: 850;
}

.wizard-case-card__meta,
.wizard-case-card__detail {
  color: var(--wizard-muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.wizard-case-card__meta {
  color: #40566c;
  font-weight: 750;
}

.wizard-case-heading {
  font-size: 1.2rem;
  line-height: 1.35;
  font-weight: 850;
  color: var(--wizard-text);
}

.wizard-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.wizard-clinical-badge {
  border: 0.5px solid #d9e2ea;
  border-radius: 999px;
  padding: 5px 10px;
  background: #f6f9fc;
  color: #40566c;
  font-size: 0.82rem;
  font-weight: 800;
}

.wizard-summary-card {
  background: #f8fbff;
}

.wizard-summary-card p,
.wizard-section-text {
  margin: 0;
  color: #40566c;
  line-height: 1.55;
  font-weight: 650;
}

.wizard-clinical-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.wizard-clinical-section {
  padding: 18px;
}

.wizard-clinical-section h3 {
  margin-bottom: 14px;
  font-size: 1rem;
}

.wizard-clinical-section .wizard-field-grid--two {
  grid-template-columns: 1fr;
}

.wizard-field-grid--three {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.wizard-field-grid--two,
.wizard-risk-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.wizard-clinical-field {
  min-height: 74px;
  padding: 12px;
  border: 0.5px solid var(--wizard-border);
  border-radius: 10px;
  background: #fbfcfe;
}

.wizard-clinical-field dt {
  margin-bottom: 6px;
  color: var(--wizard-muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.wizard-clinical-field dd {
  margin: 0;
  color: var(--wizard-text);
  font-weight: 720;
  overflow-wrap: anywhere;
}

.wizard-missing {
  color: #9aaabc;
  font-style: italic;
  font-weight: 500;
}

.wizard-risk-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 0.5px solid var(--wizard-border);
  border-radius: 10px;
  background: #ffffff;
}

.wizard-risk-badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 850;
  font-size: 0.82rem;
}

.wizard-risk-badge--no {
  background: #e8f7ee;
  color: var(--wizard-success);
}

.wizard-risk-badge--yes {
  background: #feeceb;
  color: var(--wizard-danger);
}

.wizard-risk-badge--unknown {
  background: #f0f3f6;
  color: #66788a;
}

.wizard-missing-list {
  margin: 0;
  padding-left: 20px;
  color: #40566c;
  line-height: 1.55;
  font-weight: 650;
}

.wizard-context-bar {
  padding: 10px 14px;
  border: 0.5px solid var(--wizard-border);
  border-radius: 12px;
  background: #eef3f8;
  color: #40566c;
  font-size: 0.9rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.wizard-rule-badge {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 850;
}

.wizard-rule-badge--deterministic {
  background: #e8f7ee;
  color: var(--wizard-success);
}

.wizard-rule-badge--llm {
  background: var(--wizard-blue-soft);
  color: var(--wizard-primary);
}

.wizard-drug-hero {
  padding: 18px 0;
  border-top: 0.5px solid var(--wizard-border);
  border-bottom: 0.5px solid var(--wizard-border);
}

.wizard-drug-name {
  display: block;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 850;
  color: var(--wizard-text);
}

.wizard-drug-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 12px;
  color: var(--wizard-muted);
  font-weight: 700;
}

.wizard-drug-meta span {
  padding: 0 12px;
  border-left: 1px solid var(--wizard-border);
}

.wizard-drug-meta span:first-child {
  padding-left: 0;
  border-left: 0;
}

.wizard-rule-line {
  padding: 12px;
  border-radius: 10px;
  background: #f7f9fc;
}

.wizard-rule-line code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.wizard-result-stack {
  display: grid;
  gap: 14px;
}

.wizard-result-panel {
  border: 0.5px solid var(--wizard-border);
  border-radius: 12px;
  padding: 16px;
  background: #ffffff;
}

.wizard-result-panel--rule {
  border-color: #c9dfd2;
  background: #f6fbf8;
}

.wizard-result-panel--limited {
  border-color: #f0d48a;
  background: #fffaf0;
}

.wizard-result-panel--llm {
  border-color: #c9dbf3;
  background: #f7fbff;
}

.wizard-result-panel--blocked {
  border-color: #f1b5b0;
  background: #fff7f6;
}

.wizard-result-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.wizard-result-panel h3,
.wizard-result-panel h4 {
  margin: 0;
}

.wizard-result-panel h4 {
  font-size: 0.92rem;
}

.wizard-result-panel p {
  margin: 10px 0 0;
  line-height: 1.5;
}

.wizard-result-details,
.wizard-factor-list dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 0;
}

.wizard-result-details div,
.wizard-factor-list div {
  padding: 11px;
  border: 0.5px solid var(--wizard-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
}

.wizard-result-details dt,
.wizard-factor-list dt {
  margin-bottom: 5px;
  color: var(--wizard-muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.wizard-result-details dd,
.wizard-factor-list dd {
  margin: 0;
  color: var(--wizard-text);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.wizard-rule-explanation,
.wizard-factor-list {
  margin-top: 14px;
}

.wizard-result-list {
  margin: 10px 0 0;
  padding-left: 20px;
  color: #40566c;
  line-height: 1.55;
  font-weight: 650;
}

.wizard-audit-note {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
  color: #40566c;
  font-size: 0.9rem;
}

.wizard-decision-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.wizard-decision-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 16px;
  border: 0.5px solid var(--wizard-border);
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
}

.wizard-decision-card input {
  position: absolute;
  opacity: 0;
}

.wizard-decision-card--selected {
  border-color: #8fd3a4;
  background: #ecf9f0;
}

.wizard-decision-icon {
  font-size: 1.35rem;
}

.wizard-decision-label {
  display: block;
  font-weight: 850;
}

.wizard-decision-description {
  display: block;
  margin-top: 3px;
  color: var(--wizard-muted);
  font-size: 0.88rem;
}

.wizard-modification-fields {
  display: none;
}

.wizard-modification-fields--visible {
  display: grid;
}

.wizard-rating-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.wizard-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.wizard-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 0.5px solid var(--wizard-border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--wizard-text);
  cursor: pointer;
  font-weight: 750;
}

.wizard-chip input {
  width: 1px;
  height: 1px;
  opacity: 0;
  position: absolute;
}

.wizard-chip--active {
  border-color: #9fc3ef;
  background: var(--wizard-blue-soft);
  color: var(--wizard-primary);
}

.wizard-footer {
  position: fixed;
  z-index: 50;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  border-top: 0.5px solid var(--wizard-border);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
}

.wizard-footer__note {
  color: var(--wizard-muted);
  font-size: 0.88rem;
}

.wizard-footer__actions {
  display: flex;
  gap: 10px;
}

.wizard-button {
  border: 0.5px solid var(--wizard-border);
  border-radius: 10px;
  padding: 10px 16px;
  background: #ffffff;
  color: var(--wizard-primary);
  cursor: pointer;
  font-weight: 850;
}

.wizard-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.wizard-button--primary {
  border-color: var(--wizard-primary);
  background: var(--wizard-primary);
  color: #ffffff;
}

.wizard-button--save {
  border-color: var(--wizard-save);
  background: var(--wizard-save);
  color: #ffffff;
}

@media (max-width: 760px) {
  .clinical-wizard-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .wizard-step-label,
  .wizard-health {
    display: none;
  }

  .wizard-field-grid--three,
  .wizard-field-grid--two,
  .wizard-case-filter-grid,
  .wizard-clinical-section-grid,
  .wizard-result-details,
  .wizard-factor-list dl,
  .wizard-risk-grid,
  .wizard-decision-grid,
  .wizard-rating-grid {
    grid-template-columns: 1fr;
  }

  .wizard-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .wizard-footer__actions {
    justify-content: flex-end;
  }
}
