/* ============================
   BASE LAYOUT & TYPOGRAPHY
   ============================ */

body.topic-page {
  margin: 0;
  padding: 0 0 40px;
  padding-top: 112px; /* toolbar + topic header */
  font-family: Calibri, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f5f7fa;
  color: #1f2937;
}

.study-mode #page-layout {
  filter: brightness(0.94);
}

.edit-mode #page-layout {
  filter: none;
}

#page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
  max-width: 1280px;
  margin: 30px auto;
  padding: 0 20px;
  box-sizing: border-box;
}

#content {
  min-width: 0;
  width: 100%;
  max-width: 900px;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  line-height: 1.6;
  box-sizing: border-box;
}

#content h1 {
  color: #1a3d7c;
  margin: 0 0 24px;
}

#content h2 {
  color: #1a3d7c;
  margin-top: 32px;
  margin-bottom: 6px;
  font-weight: 700;
}

#content ul {
  padding-left: 20px;
}

#content section {
  padding: 0;
  margin: 0 0 24px;
  background: transparent;
  border: none;
}

#content .section-divider {
  width: 100%;
  height: 1px;
  background: #e5e7eb;
  margin: 6px 0 14px;
}

/* ============================
   STACKED TOP BAR (FINAL)
   ============================ */

#mv-topstack {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #f5f7fa;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

#mv-topstack #topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  border-bottom: 1px solid #e5e7eb;
}

#mv-topstack #toolbar {
  display: flex;
  gap: 6px;
}

#mv-topstack #toolbar button,
#mv-topstack #modeToggle {
  padding: 6px 10px;
  border: 1px solid #d3d3d3;
  border-radius: 6px;
  background: #f0f0f0;
  cursor: default; /* visual only */
  font-size: 14px;
}

#mv-topstack #modeToggle {
  padding: 6px 12px;
  font-weight: 600;
}

#mv-topstack #topicbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  padding: 8px 16px;
}

#topicbar .topic-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

#topicbar .back-link {
  text-decoration: none;
  font-weight: 600;
  color: #2563eb;
}

#topicbar .topic-logo img {
  height: 28px;
  max-height: 28px;
  width: auto;
  display: block;
}

#topicbar .topic-context {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

#topicbar .topic-right {
  display: flex;
  align-items: center;
}

#topicbar .topic-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#topicbar .topic-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

#topicbar .mv-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
}

#topicbar .mv-badge.xhy {
  background: #dc2626;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
}

#topicbar .mv-badge.mv-badge-acs,
#topicbar .mv-badge.acs {
  background: #1f2937;
  color: #ffffff;
}

#topicbar .mv-badge-sepsis {
  background: #374151;
  color: #ffffff;
}

#topicbar .mv-badge-xhy {
  background: #b91c1c;
  color: #ffffff;
}

#topicbar .mv-badge-hy {
  background: #2563eb;
  color: #ffffff;
}

#topicbar .mv-badge-fy {
  background: #6b7280;
  color: #ffffff;
}

.toolbar-disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* =========================
   TEMP: TOOLBAR SLEEP MODE
   ========================= */
#toolbar {
  display: none !important;
}
.toolbar-actions,
.toolbar-colors,
.toolbar-toggle {
  pointer-events: none !important;
}
/* Toolbar intentionally disabled for stability.
   Do not remove unless re-enabling feature. */

/* ============================
   DECISION REPAIR CONTAINER (EMPTY PLACEHOLDER)
   ============================ */

#decision-repair {
  display: none;
  position: fixed;
  right: 20px;
  top: 140px;
  width: 320px;
  background: #ffffff;
  border-left: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  box-sizing: border-box;
  max-height: calc(100vh - 160px);
  overflow: auto;
}

.decision-repair.active,
#decision-repair.active {
  display: block;
}

.hidden {
  display: none !important;
}

.inline-atom-flag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #fef9c3;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  color: #92400e;
  font-size: 13px;
  margin-left: 10px;
}

.inline-atom-flag button {
  padding: 4px 8px;
  border: 1px solid #d97706;
  border-radius: 6px;
  background: #fef3c7;
  cursor: pointer;
  font-weight: 600;
  color: #92400e;
}

/* ============================
   TOPIC PAGE LAYOUT BASICS
   ============================ */

.mv-layout {
  display: block;
  padding: 24px 16px 48px;
}

.mv-topic {
  max-width: 820px;
  margin: 0 auto;
}

/* ============================
   Topic Atom Blocks (Vertical)
   ============================ */

.mv-atom {
  display: block;
  width: 100%;
  margin: 16px 0;
  padding: 18px 20px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border-left: 4px solid #1a3d7c;
}

.mv-atom p {
  margin: 0;
  line-height: 1.65;
}

.micro-stress-card {
  margin-top: 12px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}

.micro-choices {
  display: flex;
  gap: 8px;
}

.micro-choice-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: white;
  cursor: pointer;
  font-size: 13px;
}

.signal-card {
  list-style: none;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  background: #fff;
  position: relative;
}

.signal-card-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 2px;
}

.signal-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.signal-state-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
  font-size: 0.85rem;
  font-weight: 700;
}

.signal-updated {
  font-size: 0.85rem;
  color: #6b7280;
}

.micro-question {
  font-size: 1.05rem;
  font-weight: normal;
  margin-top: 0;
  margin-bottom: 20px;
}


.signal-card-meta {
  margin-bottom: 12px;
  color: #374151;
  font-size: 0.95rem;
}

.signal-contrast-text {
  margin-top: 6px;
  color: #6b7280;
}
/* =========================================
   MEDVORA GLOBAL PAGE THEME
   Applies home-page style language to pages
   ========================================= */

body {
  background: #f5f7fb;
  color: #1f2937;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
}

h1, h2, h3 {
  color: #1e3a8a;
  letter-spacing: -0.02em;
}

p {
  color: #374151;
  line-height: 1.6;
}

.medvora-page,
.page-shell,
.signals-page,
.repair-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 56px;
}

.signal-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.signal-card {
  list-style: none;
  border: 1px solid #dbe3f0;
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 18px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  position: relative;
}

.signal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 4px;
}

.signal-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  margin-left: auto;
  text-align: right;
  gap: 4px;
}

.signal-state-badge {
  display: inline-block;
  align-self: flex-end;
  padding: 6px 14px;
  border-radius: 999px;
  background: #e8eefc;
  color: #1e3a8a;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.signal-updated {
  font-size: 0.85rem;
  color: #6b7280;
}

.signal-card-meta {
  margin-bottom: 12px;
  color: #4b5563;
  font-size: 0.95rem;
}

.signal-contrast-text {
  margin-top: 6px;
  color: #6b7280;
}

.micro-question {
  font-size: 1.12rem;
  font-weight: 500;
  color: #111827;
  margin-top: 0;
  margin-bottom: 14px;
}

.micro-trigger-btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: #e8eefc;
  color: #1e3a8a;
  border: none;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.micro-trigger-btn:hover {
  background: #dbe7ff;
}

.micro-stress-card {
  margin-top: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid #dbe3f0;
  background: #f8fbff;
}

.micro-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.micro-choice-btn {
  padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid #cfd8e3;
  background: #ffffff;
  color: #111827;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

.micro-choice-btn:hover {
  background: #f3f6fb;
}

.micro-feedback {
  margin-top: 10px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.micro-start-btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: #e8eefc;
  color: #1e3a8a;
  border: none;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
  width: fit-content;
}

.micro-start-btn:hover {
  background: #dbe7ff;
}

.micro-choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid #cfd8e3;
  background: #ffffff;
  color: #111827;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

.micro-choice:hover {
  background: #f3f6fb;
}

.micro-choice.selected {
  border-color: #94a3b8;
}

.micro-choice.correct {
  border-color: #16a34a;
  background: #ecfdf5;
}

.micro-choice.incorrect {
  border-color: #dc2626;
  background: #fef2f2;
}

.micro-choice input[type="radio"] {
  display: none;
}

.cycle-tabs {
  display: flex;
  gap: 12px;
  margin: 20px 0 24px;
  flex-wrap: wrap;
}

.cycle-tab-btn {
  padding: 10px 18px;
  border: 1px solid #d3dceb;
  background: #ffffff;
  color: #1f2937;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 700;
}

.cycle-tab-btn.active {
  background: #1e3a8a;
  color: #ffffff;
  border-color: #1e3a8a;
}

hr {
  border: none;
  border-top: 1px solid #dbe3f0;
  margin: 24px 0;
}

.medvora-backbar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px 0;
}

.medvora-back-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid #d3dceb;
  background: #ffffff;
  color: #1f2937;
  font-weight: 700;
  cursor: pointer;
}

.medvora-back-btn:hover {
  background: #f3f6fb;
}

/* =========================
   GLOBAL PROBE BUTTON
   ========================= */

.probe-btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: #e8eefc;
  color: #1e3a8a;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.probe-btn:hover {
  background: #dbe7ff;
}

.probe-btn:active {
  background: #c7d7ff;
}

/* =========================
   TOPIC SIDEBAR MICRO SHELL
   ========================= */

.topic-sidebar .micro-choices {
  margin-top: 12px;
  margin-bottom: 2px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.topic-sidebar .micro-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.topic-sidebar .micro-choice:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
}

.topic-sidebar .micro-choice.selected {
  border-color: #6366f1;
  background: #eef2ff;
}

.topic-sidebar .micro-choice.correct {
  border-color: #22c55e;
  background: #ecfdf5;
}

.topic-sidebar .micro-choice.incorrect {
  border-color: #ef4444;
  background: #fef2f2;
}

.topic-sidebar .micro-choice input[type="radio"] {
  display: none;
}

/* Button styled like state badge */
.topic-sidebar .micro-start-btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: #e8eefc;
  color: #1e3a8a;
  border: none;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  width: fit-content;
}

.topic-sidebar .micro-start-btn:hover {
  background: #dbe7ff;
}

.topic-sidebar .micro-start-btn:active {
  background: #c7d7ff;
}

.topic-sublist {
  margin-top: 6px;
  margin-left: 20px;
  list-style-type: disc;
}

/* =========================
   ABBREVIATIONS SECTION
   ========================= */

.abbreviations-section {
  margin: 28px 0 24px;
  padding: 18px 20px;
  background: #f8fbff;
  border: 1px solid #dbe7f0;
  border-radius: 16px;
}

.abbreviations-section h2 {
  display: inline-block;
  margin: 0 0 14px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #e8eefc;
  color: #1e3a8a;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.abbreviations-section .section-divider {
  display: none;
}

.abbreviations-section ul {
  margin: 0;
  padding-left: 18px;
}

.abbreviations-section li {
  color: #374151;
  line-height: 1.55;
  margin-bottom: 6px;
}


/* =========================
   SIGNALS PAGE ACTIONS / MICRO
   ========================= */

.signal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  justify-content: flex-start;
  position: relative;
  z-index: 10;
}

.review-btn,
.stable-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #dbe3f0;
  background: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: all 0.15s ease;
}

.review-btn {
  pointer-events: auto;
  cursor: pointer;
}

.review-btn:hover {
  border-color: #2563eb;
  color: #1d4ed8;
  background: #eff6ff;
}

.stable-btn:hover {
  border-color: #16a34a;
  color: #166534;
  background: #ecfdf5;
}

.stable-btn:active,
.review-btn:active {
  transform: translateY(0);
}

.signal-card {
  position: relative;
  display: flex;
  flex-direction: column;
}

.signal-card * {
  pointer-events: auto;
}

.signal-actions {
  position: relative;
  z-index: 10;
}

.review-btn {
  pointer-events: auto !important;
}

.signal-tier-badge {
  margin-top: 0;
  align-self: flex-end;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  display: inline-block;
}

/* Shared micro shell styling for sidebar + signals */
.micro-card {
  margin-top: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid #dbe3f0;
  background: #f8fbff;
}

.micro-feedback {
  margin-top: 10px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.micro-choices {
  margin-top: 12px;
  margin-bottom: 2px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.micro-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.micro-choice:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
}

.micro-choice.selected {
  border-color: #6366f1;
  background: #eef2ff;
}

.micro-choice.correct {
  border-color: #22c55e;
  background: #ecfdf5;
}

.micro-choice.incorrect {
  border-color: #ef4444;
  background: #fef2f2;
}

.micro-choice input[type="radio"] {
  display: none;
}

.micro-start-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: #e8eefc;
  color: #1e3a8a;
  border: 1px solid #d6e3ff;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  width: fit-content;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: all 0.15s ease;
}

.micro-start-btn:hover {
  background: #dbe7ff;
  border-color: #bfd3ff;
  color: #1d4ed8;
}

.micro-start-btn:active {
  background: #c7d7ff;
}
