/* Protocol Help - Dark-first Minimalist Design */
/* Following coregrai.com design principles */

/* ========================================
   CSS Variables
   ======================================== */
:root {
  /* Colors - Dark palette */
  --bg-primary: #0a0a0b;
  --bg-secondary: #111113;
  --bg-elevated: #1a1a1d;
  --bg-hover: #222225;

  --text-primary: #fafafa;
  --text-secondary: #a1a1a6;
  --text-muted: #6b6b70;

  --accent: #9B5DE5;
  --accent-hover: #B47AED;
  --accent-muted: rgba(155, 93, 229, 0.15);

  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);

  /* Appropriateness colors */
  --rating-high: #2FA47A;
  --rating-mid: #d4a72c;
  --rating-low: #dc4a4a;

  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --space-2xl: 64px;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-serif: 'Georgia', 'Times New Roman', 'Palatino Linotype', serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Layout */
  --header-height: 56px;
  --max-width: 1200px;
  --border-radius: 8px;
}

/* ========================================
   Reset & Base
   ======================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

input {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  color: inherit;
}

input:focus, button:focus {
  outline: none;
}

/* ========================================
   Layout
   ======================================== */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

.hidden {
  display: none !important;
}

/* ========================================
   Header
   ======================================== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 var(--space-lg);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.brand-text {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-nav {
  display: flex;
  gap: var(--space-xs);
}

/* Mobile menu button */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

.mobile-menu-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.mobile-menu-btn svg {
  width: 22px;
  height: 22px;
}

.mobile-menu-btn.active svg path:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active svg path:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active svg path:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.nav-link {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--border-radius);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-muted);
}

/* ========================================
   Anatomy Selector
   ======================================== */
.anatomy-section {
  padding: var(--space-2xl) 0;
  animation: fadeUp 0.6s ease;
}

/* ========================================
   Quick Search Hero
   ======================================== */
.quick-search-hero {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.quick-search-title {
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
  letter-spacing: -0.02em;
}

.quick-search-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

.quick-search-container {
  display: flex;
  max-width: 520px;
  margin: 0 auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  overflow: visible;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
}

.quick-search-container:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.quick-search-input {
  flex: 1;
  padding: var(--space-md) var(--space-lg);
  background: transparent;
  border: none;
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
}

.quick-search-input::placeholder {
  color: var(--text-muted);
}

.quick-search-btn {
  padding: var(--space-md) var(--space-lg);
  background: var(--accent);
  border: none;
  color: white;
  cursor: pointer;
  transition: background var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-search-btn:hover {
  background: var(--accent-hover);
}

.quick-search-btn svg {
  width: 20px;
  height: 20px;
}

/* Search Suggestions Dropdown */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  max-height: 320px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px var(--shadow);
}

.search-suggestions.hidden {
  display: none;
}

.suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.active {
  background: var(--bg-tertiary);
}

.suggestion-item.active {
  background: var(--accent-muted);
}

.suggestion-topic {
  font-weight: 500;
  color: var(--text-primary);
}

.suggestion-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.suggestion-badge {
  display: inline-block;
  padding: 2px 6px;
  background: var(--accent-muted);
  color: var(--accent);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

/* Global Search Result */
.global-search-result {
  max-width: 600px;
  margin: 0 auto var(--space-xl);
  animation: fadeUp 0.3s ease;
}

.global-result-card {
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
}

.global-result-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.global-result-topic {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.global-result-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.global-result-body {
  margin-bottom: var(--space-md);
}

.global-result-recommendation {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.global-result-recommendation strong {
  color: var(--text-primary);
  font-weight: 600;
}

.global-result-procedures {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

.global-result-proc {
  font-size: 13px;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-elevated);
  border-radius: 4px;
  color: var(--text-secondary);
}

.global-result-proc.primary {
  background: var(--accent-muted);
  color: var(--accent);
  font-weight: 500;
}

.global-result-consensus {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: var(--space-sm);
}

.global-result-consensus .consensus-value {
  font-weight: 600;
  color: var(--rating-high);
}

.global-result-consensus.moderate .consensus-value {
  color: var(--rating-mid);
}

.global-result-consensus.low .consensus-value {
  color: var(--rating-low);
}

.global-result-clinical {
  font-size: 13px;
  color: var(--text-secondary);
  padding: var(--space-sm);
  background: var(--bg-elevated);
  border-radius: var(--border-radius-sm);
  margin-bottom: var(--space-sm);
}

.global-result-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.global-result-source {
  color: var(--text-muted);
}

.global-result-action {
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--border-radius-sm);
  transition: background var(--transition-fast);
}

.global-result-action:hover {
  background: var(--accent-muted);
}

/* Info Card Collapsible */
.info-card-collapsible {
  max-width: 600px;
  margin: var(--space-lg) auto;
}

.info-card-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  list-style: none;
  width: 100%;
}

.info-card-toggle::-webkit-details-marker {
  display: none;
}

.info-toggle-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border-radius: 6px;
  flex-shrink: 0;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.info-toggle-btn svg {
  width: 14px;
  height: 14px;
  color: white;
  transition: transform var(--transition-fast);
}

.info-card-toggle:hover .info-toggle-btn {
  background: var(--accent-hover);
}

.info-card-collapsible[open] .info-toggle-btn svg {
  transform: rotate(45deg);
}

.info-toggle-label {
  font-size: 13px;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.info-card-toggle:hover .info-toggle-label {
  color: var(--text-secondary);
}

.info-card-body {
  margin-top: var(--space-sm);
  margin-left: 36px;
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  animation: fadeUp 0.2s ease;
}

.info-card-body .info-card-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.info-card-body .info-card-text strong {
  color: var(--accent);
}

.info-card-body .info-card-note {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

/* Advanced Search Divider */
.advanced-search-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider-text {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .quick-search-hero {
    margin-bottom: var(--space-lg);
  }

  .quick-search-title {
    font-size: 18px;
  }

  .quick-search-container {
    flex-direction: column;
  }

  .quick-search-input {
    padding: var(--space-md);
    text-align: center;
  }

  .quick-search-btn {
    padding: var(--space-sm);
  }

  .advanced-search-divider {
    margin-bottom: var(--space-lg);
  }

  .global-result-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

.section-title {
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 600;
  text-align: center;
  margin-bottom: var(--space-xl);
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.anatomy-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  max-width: 800px;
  margin: 0 auto;
}

.anatomy-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  transition: all var(--transition-base);
}

.anatomy-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.anatomy-btn.active {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.anatomy-icon {
  width: 40px;
  height: 40px;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.anatomy-btn:hover .anatomy-icon {
  color: var(--accent);
}

.anatomy-btn span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.anatomy-btn:hover span {
  color: var(--text-primary);
}

/* ========================================
   Info Card
   ======================================== */
.info-card {
  display: flex;
  gap: var(--space-lg);
  max-width: 800px;
  margin: var(--space-xl) auto 0;
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  animation: fadeUp 0.6s ease 0.2s both;
}

.info-card-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-muted);
  border-radius: var(--border-radius);
}

.info-card-icon svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.info-card-content {
  flex: 1;
}

.info-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.info-card-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.info-card-text strong {
  color: var(--accent);
  font-weight: 500;
}

.info-card-note {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

@media (max-width: 600px) {
  .info-card {
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md);
  }

  .info-card-icon {
    width: 40px;
    height: 40px;
  }

  .info-card-icon svg {
    width: 20px;
    height: 20px;
  }

  .info-card-title {
    font-size: 15px;
  }

  .info-card-text {
    font-size: 13px;
  }
}

/* ========================================
   Search Section
   ======================================== */
.search-section {
  animation: fadeUp 0.4s ease;
}

.search-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.back-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.back-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.back-btn svg {
  width: 20px;
  height: 20px;
}

.search-region-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Search Input */
.search-container {
  margin-bottom: var(--space-lg);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  transition: border-color var(--transition-fast);
}

.search-input-wrap:focus-within {
  border-color: var(--accent);
}

.search-icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  font-size: 16px;
  background: transparent;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-clear {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.search-clear:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.search-clear svg {
  width: 16px;
  height: 16px;
}

/* ========================================
   Concept Header
   ======================================== */
.concept-header {
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: linear-gradient(135deg, var(--accent-muted) 0%, rgba(155, 93, 229, 0.05) 100%);
  border: 1px solid var(--accent);
  border-radius: var(--border-radius);
  animation: fadeUp 0.3s ease;
}

.concept-match {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.concept-icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
  flex-shrink: 0;
}

.concept-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.concept-region {
  font-size: 12px;
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--bg-elevated);
  border-radius: 4px;
  margin-left: auto;
}

/* ========================================
   Summary Card (Quick Consensus)
   ======================================== */
.summary-card {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  animation: fadeUp 0.3s ease;
}

.summary-card.card-type-strong {
  border-left: 3px solid var(--rating-high);
}

.summary-card.card-type-conditional {
  border-left: 3px solid var(--rating-mid);
}

.summary-card.card-type-high-variance {
  border-left: 3px solid var(--rating-low);
}

.summary-card.card-type-clinical-first {
  border-left: 3px solid var(--accent);
}

.summary-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.summary-card-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.summary-card-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.summary-card.card-type-strong .summary-card-icon {
  color: var(--rating-high);
}

.summary-card.card-type-conditional .summary-card-icon {
  color: var(--rating-mid);
}

.summary-card.card-type-high-variance .summary-card-icon {
  color: var(--rating-low);
}

.summary-card.card-type-clinical-first .summary-card-icon {
  color: var(--accent);
}

.summary-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.summary-card-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.summary-card.card-type-strong .summary-card-badge {
  background: rgba(76, 175, 80, 0.15);
  color: var(--rating-high);
}

.summary-card.card-type-conditional .summary-card-badge {
  background: rgba(255, 193, 7, 0.15);
  color: var(--rating-mid);
}

.summary-card.card-type-high-variance .summary-card-badge {
  background: rgba(244, 67, 54, 0.15);
  color: var(--rating-low);
}

.summary-card.card-type-clinical-first .summary-card-badge {
  background: var(--accent-muted);
  color: var(--accent);
}

.summary-card-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.summary-card-body {
  margin-top: var(--space-sm);
}

.summary-card-recommendation {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.summary-card-rec-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.summary-card-rec-primary {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.summary-card-rec-consensus {
  font-size: 12px;
  color: var(--text-secondary);
}

.summary-card-equivalents {
  margin-top: var(--space-xs);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.summary-card-equiv-chip {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  color: var(--text-secondary);
}

.summary-card-alternatives {
  margin-top: var(--space-sm);
  font-size: 12px;
  color: var(--text-muted);
}

.summary-card-alternatives strong {
  color: var(--text-secondary);
  font-weight: 500;
}

.summary-card-clinical-msg {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: rgba(155, 93, 229, 0.08);
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
}

.summary-card-clinical-msg svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

.summary-card-footer {
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.summary-card-source {
  font-size: 11px;
  color: var(--text-muted);
}

.summary-card-action {
  font-size: 12px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--border-radius-sm);
  transition: background var(--transition-fast);
}

.summary-card-action:hover {
  background: var(--accent-muted);
}

.summary-card-dismiss {
  font-size: 11px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs);
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.summary-card-dismiss:hover {
  opacity: 1;
}

@media (max-width: 600px) {
  .summary-card {
    padding: var(--space-sm);
  }

  .summary-card-header {
    flex-direction: column;
    gap: var(--space-xs);
  }

  .summary-card-title {
    font-size: 14px;
  }

  .summary-card-rec-primary {
    font-size: 13px;
  }
}

/* ========================================
   Phase Filter Chips
   ======================================== */
.phase-filter-chips {
  margin-top: var(--space-md);
  animation: fadeUp 0.3s ease;
}

.phase-filter-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.phase-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.filter-chip.phase-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-chip.phase-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-muted);
}

.filter-chip.phase-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-primary);
}

.phase-count {
  font-size: 11px;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-weight: 500;
}

.filter-chip.phase-chip.active .phase-count {
  background: rgba(0, 0, 0, 0.2);
}

/* ========================================
   Grouped Scenarios by Phase
   ======================================== */
.scenario-phase-group {
  margin-bottom: var(--space-md);
}

.phase-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-sm);
  margin-bottom: var(--space-xs);
  background: var(--bg-elevated);
  border-radius: var(--border-radius);
  border-left: 3px solid var(--accent);
}

.phase-group-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.phase-group-count {
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--bg-primary);
  border-radius: 10px;
}

.phase-group-scenarios {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding-left: var(--space-sm);
}

/* Phase-specific styling */
.scenario-phase-group[data-phase="screening"] .phase-group-header {
  border-left-color: var(--rating-high);
}

.scenario-phase-group[data-phase="screening"] .phase-group-title {
  color: var(--rating-high);
}

.scenario-phase-group[data-phase="initial"] .phase-group-header {
  border-left-color: #3b82f6;
}

.scenario-phase-group[data-phase="initial"] .phase-group-title {
  color: #3b82f6;
}

.scenario-phase-group[data-phase="pretreatment"] .phase-group-header {
  border-left-color: var(--rating-mid);
}

.scenario-phase-group[data-phase="pretreatment"] .phase-group-title {
  color: var(--rating-mid);
}

.scenario-phase-group[data-phase="surveillance"] .phase-group-header {
  border-left-color: var(--accent);
}

.scenario-phase-group[data-phase="surveillance"] .phase-group-title {
  color: var(--accent);
}

.scenario-phase-group[data-phase="complication"] .phase-group-header {
  border-left-color: var(--rating-low);
}

.scenario-phase-group[data-phase="complication"] .phase-group-title {
  color: var(--rating-low);
}

/* Clarifying Chips */
.clarify-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  animation: fadeUp 0.3s ease;
}

.clarify-chip {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.clarify-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-muted);
}

.clarify-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-primary);
}

/* ========================================
   Assumed Context Banner
   Shows when condition-based urgency defaults are applied
   ======================================== */
.assumed-context-banner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.04) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  font-size: 13px;
  animation: fadeUp 0.3s ease;
}

.assumed-context-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.assumed-context-text {
  color: var(--text-secondary);
  flex: 1;
}

.assumed-context-text strong {
  color: var(--accent);
  font-weight: 600;
}

.assumed-context-change {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.assumed-context-change:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-muted);
}

/* Urgency-specific colors */
.assumed-context-banner[data-urgency="acute"] {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(239, 68, 68, 0.04) 100%);
  border-color: rgba(239, 68, 68, 0.25);
}

.assumed-context-banner[data-urgency="acute"] .assumed-context-icon {
  color: #ef4444;
}

.assumed-context-banner[data-urgency="acute"] .assumed-context-text strong {
  color: #ef4444;
}

.assumed-context-banner[data-urgency="routine"] {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, rgba(34, 197, 94, 0.04) 100%);
  border-color: rgba(34, 197, 94, 0.25);
}

.assumed-context-banner[data-urgency="routine"] .assumed-context-icon {
  color: #22c55e;
}

.assumed-context-banner[data-urgency="routine"] .assumed-context-text strong {
  color: #22c55e;
}

.assumed-context-banner[data-urgency="chronic"] {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.08) 0%, rgba(234, 179, 8, 0.04) 100%);
  border-color: rgba(234, 179, 8, 0.25);
}

.assumed-context-banner[data-urgency="chronic"] .assumed-context-icon {
  color: #eab308;
}

.assumed-context-banner[data-urgency="chronic"] .assumed-context-text strong {
  color: #eab308;
}

/* ========================================
   Urgency Override Modal
   ======================================== */
.urgency-override-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.urgency-override-dialog {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.urgency-override-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.urgency-override-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.urgency-override-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.urgency-override-close:hover {
  color: var(--text-primary);
}

.urgency-override-body {
  padding: var(--space-lg);
}

.urgency-override-body p {
  margin: 0 0 var(--space-md) 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.urgency-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.urgency-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.urgency-option:hover {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.urgency-option.selected {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.urgency-option strong {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.urgency-option span {
  font-size: 12px;
  color: var(--text-muted);
}

/* Urgency-specific colors for options */
.urgency-option[data-urgency="acute"]:hover,
.urgency-option[data-urgency="acute"].selected {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.urgency-option[data-urgency="routine"]:hover,
.urgency-option[data-urgency="routine"].selected {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
}

.urgency-option[data-urgency="chronic"]:hover,
.urgency-option[data-urgency="chronic"].selected {
  border-color: #eab308;
  background: rgba(234, 179, 8, 0.1);
}

/* ========================================
   Results Layout (Two-Panel)
   ======================================== */
.results-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: var(--space-lg);
  min-height: 400px;
}

.scenarios-panel,
.procedures-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.panel-header h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.panel-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  /* Allow text to wrap for full visibility */
  white-space: normal;
  line-height: 1.3;
}

.result-count {
  font-size: 12px;
  color: var(--text-muted);
}

.scenarios-list,
.procedures-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
}

/* Empty State */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 150px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: var(--space-lg);
}

/* ========================================
   Scenario Cards (Left Panel)
   ======================================== */
.scenario-card {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--border-radius);
  border: 1px solid transparent;
  margin-bottom: var(--space-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.scenario-card:hover {
  background: var(--bg-elevated);
  border-color: var(--border);
}

.scenario-card.active {
  background: var(--accent-muted);
  border-color: var(--accent);
}

.scenario-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-primary);
}

.scenario-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.scenario-meta .high-rated-count {
  color: var(--rating-high);
  font-weight: 500;
}

/* Scenario Accordion (for duplicate titles) */
.scenario-accordion {
  margin-bottom: var(--space-xs);
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.scenario-accordion.expanded {
  border-color: var(--accent-muted);
}

.accordion-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-secondary);
}

.accordion-header:hover {
  background: var(--bg-elevated);
}

.accordion-toggle {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.accordion-icon {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.accordion-icon.expanded {
  transform: rotate(90deg);
}

.accordion-content {
  flex: 1;
  min-width: 0;
}

.accordion-children {
  border-top: 1px solid var(--border);
  background: var(--bg-primary);
}

.accordion-children.hidden {
  display: none;
}

.scenario-child {
  margin: 0;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  padding-left: calc(var(--space-md) + 28px);
}

.scenario-child:last-child {
  border-bottom: none;
}

.scenario-child:hover {
  background: var(--bg-elevated);
}

.scenario-child.active {
  background: var(--accent-muted);
}

.child-title {
  font-size: 12px;
  color: var(--text-secondary);
}

.scenario-child.active .child-title {
  color: var(--text-primary);
}

.variant-count {
  color: var(--accent);
  font-weight: 500;
}

/* ========================================
   Procedure Cards (Right Panel) - HERO INFO
   ======================================== */
.procedure-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-elevated);
}

.procedure-card:hover {
  border-color: var(--border-hover);
  transform: translateX(4px);
}

.procedure-card.active {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.procedure-card.mri {
  border-left: 3px solid var(--accent);
}

/* Big rating number */
.procedure-rating {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.procedure-rating.high {
  background: rgba(47, 164, 122, 0.15);
  color: var(--rating-high);
}

.procedure-rating.mid {
  background: rgba(212, 167, 44, 0.15);
  color: var(--rating-mid);
}

.procedure-rating.low {
  background: rgba(220, 74, 74, 0.15);
  color: var(--rating-low);
}

.procedure-info {
  flex: 1;
  min-width: 0;
}

.procedure-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  /* Allow wrapping for long procedure names like "MRI without and with IV contrast" */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.procedure-level {
  font-size: 12px;
  color: var(--text-secondary);
}

.procedure-level.high { color: var(--rating-high); }
.procedure-level.mid { color: var(--rating-mid); }
.procedure-level.low { color: var(--rating-low); }

.procedure-modality {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--bg-hover);
  border-radius: 4px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ========================================
   MRI Protocol Card (Bottom)
   ======================================== */
.mri-protocol-card {
  margin-top: var(--space-lg);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--border-radius);
  animation: fadeUp 0.3s ease;
  overflow: hidden;
}

.protocol-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.protocol-card-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.protocol-card-title svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.protocol-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.contrast-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.contrast-badge.no-contrast {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.contrast-badge.with-contrast {
  background: var(--accent-muted);
  color: var(--accent);
}

/* Source badge - indicates if protocol is Human Verified or AI Generated */
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.source-badge.curated {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.source-badge.curated svg {
  stroke: #10b981;
}

.source-badge.suggested {
  background: rgba(249, 115, 22, 0.15);
  color: #ea580c;
  border: 1px dashed rgba(249, 115, 22, 0.5);
}

.source-badge.suggested svg {
  stroke: #ea580c;
}

.protocol-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.protocol-card-content {
  padding: var(--space-lg);
}

.sequences-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-sm);
}

.sequence-tag {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  font-size: 13px;
  color: var(--text-primary);
}

.sequence-tag.post-contrast {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.sequence-tag .seq-marker {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.sequence-tag.post-contrast .seq-marker {
  background: var(--accent);
}

/* Supplemental sequences - suggested additions */
.supplemental-sequences {
  grid-column: 1 / -1;
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px dashed var(--border);
}

.supplemental-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #ea580c;
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.supplemental-header svg {
  stroke: #ea580c;
}

.supplemental-group {
  margin-bottom: var(--space-sm);
}

.supplemental-reason {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: var(--space-xs);
}

.supplemental-seqs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.sequence-tag.supplemental {
  border-style: dashed;
  border-color: #ea580c;
  background: rgba(249, 115, 22, 0.08);
  color: var(--text-secondary);
}

.sequence-tag.supplemental .seq-marker {
  background: #ea580c;
}

.protocol-rationale {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.protocol-rationale-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.sequence-item.post-contrast {
  color: var(--accent);
}

.sequence-item .contrast-marker {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.contrast-rationale {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  padding: var(--space-md);
  background: var(--bg-elevated);
  border-radius: var(--border-radius);
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ========================================
   Differential Card (RadLITE)
   ======================================== */
.differential-card {
  width: 100%;
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--border-radius);
  animation: fadeUp 0.3s ease;
}

.differential-card.loading {
  opacity: 0.7;
}

.differential-card.error {
  border-left-color: var(--rating-low);
}

.differential-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.differential-term {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.differential-term svg {
  width: 16px;
  height: 16px;
}

.differential-badge {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--accent-muted);
  color: var(--accent);
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.differential-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-sm);
}

.differential-list {
  list-style: none;
  margin-bottom: var(--space-sm);
}

.differential-list li {
  font-size: 13px;
  color: var(--text-secondary);
  padding: var(--space-xs) 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.differential-list li::before {
  content: '';
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}

.differential-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

.differential-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.differential-link svg {
  width: 12px;
  height: 12px;
}

.differential-loader {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 13px;
  color: var(--text-muted);
}

.differential-loader .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   Scrollbar
   ======================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========================================
   Responsive - Tablet
   ======================================== */
@media (max-width: 900px) {
  .anatomy-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .results-layout {
    grid-template-columns: 1fr;
  }

  .protocol-panel {
    min-height: 300px;
  }

  .protocol-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========================================
   Responsive - Tablet
   ======================================== */
@media (max-width: 900px) {
  .protocol-filters {
    flex-direction: column;
    gap: var(--space-md);
    align-items: stretch;
  }

  .filter-group {
    flex-wrap: wrap;
    justify-content: center;
  }

  .filter-chips {
    justify-content: center;
  }

  .protocol-detail-title-row {
    flex-direction: column;
    gap: var(--space-md);
  }

  .protocol-quick-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ========================================
   Responsive - Mobile
   ======================================== */
@media (max-width: 600px) {
  :root {
    --space-lg: 20px;
    --space-xl: 32px;
  }

  .main {
    padding: var(--space-lg) var(--space-md);
  }

  /* Protocol filters mobile */
  .protocol-filters {
    padding: var(--space-sm);
    gap: var(--space-sm);
  }

  .filter-label {
    display: none;
  }

  .filter-chip {
    padding: 4px 10px;
    font-size: 12px;
  }

  .toggle-btn {
    padding: 4px 8px;
    font-size: 12px;
  }

  .sequence-timeline {
    padding: var(--space-sm);
  }

  .timeline-segment {
    min-width: 50px;
  }

  .timeline-label {
    font-size: 9px;
  }

  .quick-action-btn span {
    display: none;
  }

  .quick-action-btn {
    padding: var(--space-sm);
  }

  /* Show mobile menu button, hide desktop nav */
  .header-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: var(--space-md);
    flex-direction: column;
    gap: var(--space-sm);
    z-index: 99;
  }

  .header-nav.mobile-open {
    display: flex;
  }

  .mobile-menu-btn {
    display: flex !important;
  }

  .nav-link {
    width: 100%;
    text-align: center;
    padding: var(--space-md);
  }

  /* Anatomy grid */
  .anatomy-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }

  .anatomy-btn {
    padding: var(--space-md);
  }

  .anatomy-icon {
    width: 28px;
    height: 28px;
  }

  .anatomy-btn span {
    font-size: 12px;
  }

  /* Search section */
  .search-header {
    gap: var(--space-sm);
  }

  .search-region-title {
    font-size: 20px;
  }

  .search-input-wrap {
    padding: var(--space-sm) var(--space-md);
  }

  .search-input {
    font-size: 14px;
  }

  /* Results panels */
  .panel-header h3 {
    font-size: 12px;
  }

  .scenario-card {
    padding: var(--space-sm) var(--space-md);
  }

  .scenario-title {
    font-size: 13px;
  }

  .procedure-card {
    padding: var(--space-sm) var(--space-md);
  }

  .procedure-rating {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .procedure-name {
    font-size: 13px;
  }

  /* Protocol grid */
  .protocol-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .protocol-grid-card {
    padding: var(--space-md);
  }

  /* MRI Protocol card */
  .mri-protocol-card {
    padding: var(--space-md);
  }

  .sequence-tag {
    font-size: 11px;
    padding: var(--space-xs) var(--space-sm);
  }
}

/* ========================================
   Responsive - Small Mobile
   ======================================== */
@media (max-width: 400px) {
  .anatomy-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .anatomy-btn {
    padding: var(--space-sm);
  }

  .anatomy-icon {
    width: 24px;
    height: 24px;
  }

  .brand-text {
    font-size: 20px;
  }

  .results-layout {
    gap: var(--space-sm);
  }

  .footer-link {
    font-size: 11px;
  }
}

/* ========================================
   Protocols View
   ======================================== */
.protocols-section {
  animation: fadeUp 0.4s ease;
}

.protocols-header {
  text-align: center;
  margin-bottom: var(--space-lg);
}

/* Protocol Filters */
.protocol-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-xl);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.filter-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.filter-chip {
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-primary);
}

.contrast-toggle,
.view-toggle {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.toggle-btn {
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.toggle-btn:not(:last-child) {
  border-right: 1px solid var(--border);
}

.toggle-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.toggle-btn.active {
  background: var(--accent);
  color: var(--bg-primary);
}

.toggle-btn svg {
  width: 16px;
  height: 16px;
}

/* Bookmarked filter chip */
.filter-chip.bookmarked {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
}

.filter-chip.bookmarked.active {
  background: var(--accent);
  color: var(--bg-primary);
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: var(--space-sm);
}

.protocol-search-container {
  max-width: 600px;
  margin: 0 auto var(--space-xl);
}

.search-input-wrap.large {
  padding: var(--space-md) var(--space-lg);
}

.search-input-wrap.large .search-input {
  font-size: 18px;
}

/* Protocol Grid */
.protocol-results {
  animation: fadeUp 0.3s ease;
}

.protocol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.protocol-grid-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.protocol-grid-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.protocol-grid-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.protocol-grid-card-meta {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.protocol-grid-card-region {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--bg-elevated);
  border-radius: 4px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.protocol-grid-card-sequences {
  font-size: 12px;
  color: var(--text-muted);
}

.protocol-grid-card-sequences span {
  color: var(--accent);
  font-weight: 500;
}

/* Enhanced card with indications preview */
.protocol-grid-card-indications {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: var(--space-sm);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card bookmark indicator */
.protocol-grid-card.bookmarked {
  border-color: var(--accent);
}

.protocol-grid-card .bookmark-indicator {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  color: var(--accent);
}

.protocol-grid-card .bookmark-indicator svg {
  width: 16px;
  height: 16px;
  fill: var(--accent);
}

/* Scan time badge on card */
.protocol-grid-card-time {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.protocol-grid-card-time svg {
  width: 12px;
  height: 12px;
}

/* Protocol card footer row */
.protocol-grid-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
}

/* Grouped View Styles */
.protocol-grouped-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.protocol-group {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.protocol-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.protocol-group-header:hover {
  background: var(--bg-hover);
}

.protocol-group-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.protocol-group-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-primary);
  padding: 2px 8px;
  border-radius: 10px;
}

.protocol-group-toggle {
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.protocol-group-toggle svg {
  width: 16px;
  height: 16px;
}

.protocol-group.collapsed .protocol-group-toggle {
  transform: rotate(-90deg);
}

.protocol-group-content {
  padding: var(--space-md);
}

.protocol-group.collapsed .protocol-group-content {
  display: none;
}

.protocol-group-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.protocol-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.protocol-list-item:hover {
  border-color: var(--accent);
  transform: translateX(4px);
}

.protocol-list-item-name {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
}

.protocol-list-item-meta {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

/* Protocol Detail View */
.protocol-detail {
  animation: fadeUp 0.3s ease;
  max-width: 800px;
  margin: 0 auto;
}

.protocol-back-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: var(--space-lg);
  transition: color var(--transition-fast);
}

.protocol-back-btn:hover {
  color: var(--accent);
}

.protocol-back-btn svg {
  width: 18px;
  height: 18px;
}

.protocol-detail-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.protocol-detail-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
}

.protocol-detail-name {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
}

.protocol-quick-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.quick-action-btn.active {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
}

.quick-action-btn.active svg {
  fill: var(--accent);
}

.quick-action-btn svg {
  width: 16px;
  height: 16px;
}

.quick-action-btn.copied {
  background: var(--rating-high);
  border-color: var(--rating-high);
  color: white;
}

.protocol-detail-meta {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  flex-wrap: wrap;
}

.scan-time-badge {
  font-size: 12px;
  padding: 4px 12px;
  background: var(--bg-elevated);
  border-radius: 4px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.body-region-badge {
  font-size: 12px;
  padding: 4px 12px;
  background: var(--bg-elevated);
  border-radius: 4px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.protocol-section {
  margin-bottom: var(--space-xl);
}

.protocol-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-md);
}

.protocol-indications {
  color: var(--text-primary);
  line-height: 1.6;
}

.protocol-sequences-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.protocol-sequence-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
}

.protocol-sequence-item.post-contrast {
  border-left: 3px solid var(--accent);
}

.sequence-number {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.protocol-sequence-item.post-contrast .sequence-number {
  background: var(--accent-muted);
  color: var(--accent);
}

.sequence-name {
  font-size: 14px;
  color: var(--text-primary);
  flex: 1;
}

.sequence-contrast-label {
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.protocol-contrast-rationale {
  color: var(--text-primary);
  line-height: 1.6;
  padding: var(--space-md);
  background: var(--accent-muted);
  border-radius: var(--border-radius);
  border-left: 3px solid var(--accent);
}

.protocol-scanner-notes {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.scanner-note {
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  font-size: 13px;
  color: var(--text-secondary);
}

/* Sequence Timeline */
.sequence-timeline {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  overflow-x: auto;
}

.timeline-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
  padding: var(--space-xs);
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.timeline-segment.pre-contrast .timeline-dot {
  background: var(--text-secondary);
}

.timeline-segment.post-contrast .timeline-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.timeline-segment.contrast-injection .timeline-dot {
  background: var(--rating-mid);
  width: 16px;
  height: 16px;
}

.timeline-label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

.timeline-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 20px;
}

.timeline-connector.to-contrast {
  background: linear-gradient(90deg, var(--text-muted) 0%, var(--rating-mid) 100%);
}

.timeline-connector.from-contrast {
  background: linear-gradient(90deg, var(--rating-mid) 0%, var(--accent) 100%);
}

/* Related Protocols */
.related-protocols-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-sm);
}

.related-protocol-card {
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.related-protocol-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.related-protocol-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.related-protocol-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* Search highlighting */
.search-highlight {
  background: var(--accent-muted);
  color: var(--accent);
  padding: 0 2px;
  border-radius: 2px;
}

/* Better empty state */
.protocol-empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.protocol-empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.protocol-empty-state p {
  margin-bottom: var(--space-sm);
}

.protocol-empty-state .suggestion {
  font-size: 13px;
  color: var(--text-muted);
}

/* Empty state for protocols */
.protocol-empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.protocol-empty-state p {
  margin-bottom: var(--space-md);
}

/* View transition animations */
.anatomy-section,
.protocols-section,
.search-section {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.anatomy-section.fade-out,
.protocols-section.fade-out,
.search-section.fade-out {
  opacity: 0;
  transform: translateY(-10px);
}

.anatomy-section.hidden,
.protocols-section.hidden,
.search-section.hidden {
  display: none;
}

/* =========================================
   Enrichment Sections
   ========================================= */

/* Section title with icon */
.protocol-section-title .section-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  margin-right: var(--space-xs);
  opacity: 0.7;
}

.protocol-section-title .section-icon.red-flag-icon {
  color: var(--error);
  opacity: 1;
}

/* Clinical Pearls */
.clinical-pearls-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.clinical-pearl-item {
  position: relative;
  padding: var(--space-sm) var(--space-sm) var(--space-sm) var(--space-xl);
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-xs);
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
}

.clinical-pearl-item::before {
  content: '';
  position: absolute;
  left: var(--space-sm);
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.7;
}

/* Patient Prep */
.prep-items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.prep-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.prep-badge.warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #d97706;
}

.prep-badge.info {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
}

.prep-instructions {
  font-size: 14px;
  color: var(--text-secondary);
}

.prep-instructions ul {
  margin: var(--space-xs) 0 0 var(--space-lg);
  padding: 0;
}

.prep-instructions li {
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

/* Contraindications */
.contraindications-content {
  display: grid;
  gap: var(--space-md);
}

.contra-group h4.contra-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.contra-title.absolute {
  color: var(--error);
}

.contra-title.relative {
  color: var(--warning, #d97706);
}

.contra-group ul {
  margin: 0 0 0 var(--space-lg);
  padding: 0;
}

.contra-group li {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.contra-note {
  font-size: 13px;
  color: var(--text-secondary);
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
}

.contra-note.pregnancy {
  border-left: 3px solid var(--accent);
}

/* Red Flags */
.red-flags-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-xs);
}

.red-flag-item {
  position: relative;
  padding: var(--space-sm) var(--space-sm) var(--space-sm) var(--space-xl);
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--border-radius);
  font-size: 14px;
  color: var(--text-primary);
}

.red-flag-item::before {
  content: '!';
  position: absolute;
  left: var(--space-sm);
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background: var(--error);
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sequence Rationale */
.sequence-rationale-list {
  display: grid;
  gap: var(--space-sm);
}

.seq-rationale-item {
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
}

.seq-rationale-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: var(--space-xs);
}

.seq-rationale-purpose {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.seq-rationale-findings {
  font-size: 13px;
  color: var(--text-secondary);
}

.seq-rationale-findings strong {
  color: var(--text-muted);
}

/* Protocol Modifications (Upgrade/Downgrade) */
.upgrade-downgrade-content {
  display: grid;
  gap: var(--space-md);
}

@media (min-width: 640px) {
  .upgrade-downgrade-content {
    grid-template-columns: 1fr 1fr;
  }
}

.mod-group h4.mod-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mod-title.upgrade {
  color: var(--success, #10b981);
}

.mod-title.downgrade {
  color: var(--text-muted);
}

.mod-group ul {
  margin: 0 0 0 var(--space-lg);
  padding: 0;
}

.mod-group li {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

/* Alternative Protocols */
.alternatives-list {
  display: grid;
  gap: var(--space-sm);
}

.alt-protocol-item {
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
}

.alt-protocol-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.alt-protocol-when {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ========================================
   Site Footer (Slim)
   ======================================== */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: var(--space-md) var(--space-lg);
  margin-top: auto;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-xs);
}

.footer-divider {
  color: var(--text-muted);
  opacity: 0.4;
  font-size: 12px;
}

.footer-link {
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
  padding: var(--space-xs) var(--space-sm);
  transition: color var(--transition-fast);
  background: none;
  border: none;
  cursor: pointer;
}

.footer-link:hover {
  color: var(--accent);
}

.footer-copyright {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ========================================
   Modals
   ======================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: var(--space-xl);
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: none;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
  padding-right: var(--space-xl);
}

.modal-body {
  color: var(--text-secondary);
  line-height: 1.7;
}

.modal-body p {
  margin-bottom: var(--space-md);
}

.modal-body h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.modal-body a {
  color: var(--accent);
  text-decoration: none;
}

.modal-body a:hover {
  text-decoration: underline;
}

.modal-body em {
  color: var(--text-muted);
}

.terms-content h3 {
  margin-top: var(--space-xl);
}

/* Welcome Modal (First Visit) */
.welcome-modal .modal-backdrop {
  background: rgba(0, 0, 0, 0.9);
}

.welcome-content {
  max-width: 480px;
  text-align: center;
  padding: var(--space-xl) var(--space-xl) var(--space-lg);
}

.welcome-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-lg);
  background: var(--accent-muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-icon svg {
  width: 32px;
  height: 32px;
  color: var(--accent);
}

.welcome-content .modal-title {
  padding-right: 0;
  margin-bottom: var(--space-md);
}

.welcome-body {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.welcome-highlight {
  font-size: 16px;
  color: var(--rating-mid);
  margin-bottom: var(--space-md) !important;
}

.welcome-list {
  text-align: left;
  margin: var(--space-md) 0;
  padding-left: var(--space-lg);
}

.welcome-list li {
  margin-bottom: var(--space-sm);
  color: var(--text-muted);
}

.welcome-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--space-md);
  margin-bottom: var(--space-lg) !important;
}

.welcome-btn {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: var(--accent);
  color: var(--bg-primary);
  font-weight: 600;
  font-size: 15px;
  border-radius: var(--border-radius);
  transition: all var(--transition-fast);
}

.welcome-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* App layout */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main {
  flex: 1;
}

/* ========================================
   Query History Dropdown
   ======================================== */
.search-input-wrap {
  position: relative;
}

.query-history-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: var(--space-xs);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 50;
  overflow: hidden;
}

.query-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.query-history-clear {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.query-history-clear:hover {
  color: var(--accent);
  background: var(--accent-muted);
}

.query-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
}

.query-history-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.query-history-item:hover {
  background: var(--bg-hover);
}

.query-history-item svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.query-history-text {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
  /* Reset colors for print */
  :root {
    --bg-primary: #fff;
    --bg-secondary: #fff;
    --bg-elevated: #fff;
    --text-primary: #000;
    --text-secondary: #333;
    --text-muted: #666;
    --border: #ddd;
    --accent: #6b46c1;
  }

  /* Hide non-essential elements */
  .header,
  .header-nav,
  .mobile-menu-btn,
  .back-btn,
  .search-container,
  .search-input-wrap,
  .query-history-dropdown,
  .clarify-chips,
  .differential-card,
  .anatomy-section,
  .info-card,
  .footer,
  .protocol-filters,
  .protocol-search-container,
  .protocol-back-btn,
  .quick-action-btn,
  .protocol-quick-actions,
  .filter-group,
  .nav-link,
  #protocolResults,
  .scenarios-panel,
  .mri-protocol-card,
  .status-bar {
    display: none !important;
  }

  /* Reset page layout */
  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
    line-height: 1.4;
  }

  .app {
    display: block;
  }

  .main {
    padding: 0;
    max-width: none;
  }

  /* Protocol detail print layout */
  .protocol-detail {
    display: block !important;
    padding: 0;
  }

  .protocol-detail-header {
    border-bottom: 2px solid #000;
    padding-bottom: 12pt;
    margin-bottom: 16pt;
  }

  .protocol-detail-name {
    font-size: 18pt;
    font-weight: 700;
    color: #000;
    margin-bottom: 8pt;
  }

  .protocol-detail-meta {
    display: flex;
    gap: 12pt;
  }

  .contrast-badge,
  .body-region-badge,
  .scan-time-badge {
    background: none;
    border: 1px solid #333;
    color: #000;
    padding: 2pt 6pt;
    font-size: 10pt;
  }

  .contrast-badge.with-contrast {
    background: #eee;
  }

  /* Section styling */
  .protocol-section {
    margin-bottom: 14pt;
    page-break-inside: avoid;
  }

  .protocol-section-title {
    font-size: 12pt;
    font-weight: 700;
    color: #000;
    border-bottom: 1px solid #ccc;
    padding-bottom: 4pt;
    margin-bottom: 8pt;
  }

  .protocol-section-title svg {
    display: none;
  }

  /* Sequences list */
  .protocol-sequences-list {
    columns: 2;
    column-gap: 20pt;
  }

  .protocol-sequence-item {
    display: flex;
    align-items: center;
    gap: 6pt;
    padding: 4pt 0;
    border-bottom: 1px dotted #ddd;
    break-inside: avoid;
    background: none;
    border-radius: 0;
  }

  .sequence-number {
    width: 18pt;
    height: 18pt;
    background: #eee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9pt;
    font-weight: 600;
  }

  .sequence-name {
    font-size: 10pt;
  }

  .sequence-contrast-label {
    font-size: 8pt;
    color: #666;
    font-style: italic;
  }

  /* Hide timeline in print */
  .sequence-timeline {
    display: none;
  }

  /* Clinical pearls */
  .clinical-pearls-list {
    margin: 0;
    padding-left: 16pt;
  }

  .clinical-pearl-item {
    font-size: 10pt;
    margin-bottom: 4pt;
  }

  /* Patient prep */
  .patient-prep-grid {
    columns: 2;
    column-gap: 16pt;
  }

  .prep-badge {
    display: inline-block;
    background: #f5f5f5;
    border: 1px solid #ddd;
    padding: 2pt 6pt;
    font-size: 9pt;
    margin: 2pt;
    border-radius: 2pt;
  }

  .prep-badge.warning {
    background: #fff3cd;
    border-color: #ffc107;
  }

  /* Contraindications */
  .contra-group {
    margin-bottom: 8pt;
  }

  .contra-title {
    font-size: 10pt;
    font-weight: 600;
    margin-bottom: 4pt;
  }

  .contra-title.absolute {
    color: #c00;
  }

  .contra-group ul {
    margin: 0;
    padding-left: 14pt;
    font-size: 10pt;
  }

  /* Red flags */
  .red-flag-item {
    font-size: 10pt;
    color: #c00;
  }

  /* Related protocols - hide in print */
  #protocolDetailRelatedSection {
    display: none;
  }

  /* Page breaks */
  .protocol-detail-content {
    page-break-before: avoid;
  }

  #protocolDetailPearlsSection,
  #protocolDetailPrepSection,
  #protocolDetailContraSection {
    page-break-inside: avoid;
  }

  /* Print header/footer */
  @page {
    margin: 0.75in;
    size: letter;
  }

  /* Add print footer */
  .protocol-detail::after {
    content: "Radex - For educational purposes only. Verify with institutional protocols.";
    display: block;
    margin-top: 24pt;
    padding-top: 8pt;
    border-top: 1px solid #ccc;
    font-size: 8pt;
    color: #999;
    text-align: center;
  }
}

/* ========================================
   Protocol Builder Section
   ======================================== */
.builder-section {
  animation: fadeUp 0.4s ease;
}

.builder-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.builder-header .section-title {
  margin-bottom: var(--space-sm);
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

/* My Protocols Container */
.my-protocols-container {
  margin-bottom: var(--space-xl);
}

.my-protocols-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.subsection-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.subsection-title svg {
  color: var(--accent);
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--accent);
  color: var(--bg-primary);
  font-weight: 600;
  font-size: 14px;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 500;
  font-size: 14px;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.my-protocols-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

/* Custom Protocol Card */
.custom-protocol-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  position: relative;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.custom-protocol-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.custom-protocol-card .custom-badge {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  padding: 2px 8px;
  background: var(--accent-muted);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 4px;
}

.custom-protocol-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  padding-right: 60px;
}

.custom-protocol-card-meta {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
  font-size: 12px;
  color: var(--text-muted);
}

.custom-protocol-card-meta .meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.custom-protocol-card-sequences {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.custom-protocol-card-actions {
  display: flex;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

.card-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.card-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.card-action-btn.delete:hover {
  border-color: var(--rating-low);
  color: var(--rating-low);
}

.card-action-btn svg {
  width: 14px;
  height: 14px;
}

/* Protocol Editor */
.protocol-editor {
  animation: fadeUp 0.3s ease;
}

.editor-header {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.editor-title {
  flex: 1;
  font-size: 24px;
  font-weight: 600;
  margin: 0;
}

.editor-actions {
  display: flex;
  gap: var(--space-sm);
}

.editor-form {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.form-row {
  margin-bottom: var(--space-md);
}

.form-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.form-row.three-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-md);
}

.toggle-group.compact {
  gap: 0;
}

.toggle-group.compact .toggle-option {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 0;
}

.toggle-group.compact .toggle-option:first-child {
  border-radius: 6px 0 0 6px;
}

.toggle-group.compact .toggle-option:last-child {
  border-radius: 0 6px 6px 0;
}

/* Scope Tags Input */
.scope-tags-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  min-height: 42px;
}

.scope-tags-container:focus-within {
  border-color: var(--accent);
}

.scope-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.scope-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--accent-muted);
  border-radius: 4px;
  font-size: 12px;
  color: var(--accent);
}

.scope-tag-remove {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
  transition: all var(--transition-fast);
}

.scope-tag-remove:hover {
  background: var(--accent);
  color: var(--bg-primary);
}

.scope-tag-remove svg {
  width: 10px;
  height: 10px;
}

.scope-tags-container input {
  flex: 1;
  min-width: 150px;
  background: transparent;
  border: none;
  font-size: 13px;
  color: var(--text-primary);
}

.scope-tags-container input::placeholder {
  color: var(--text-muted);
}

.scope-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  padding: var(--space-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
}

.scope-suggestions.hidden {
  display: none;
}

.form-group:has(.scope-tags-container) {
  position: relative;
}

.scope-suggestion {
  padding: 6px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.scope-suggestion:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-muted);
}

/* Mini scope tags for protocol cards */
.custom-protocol-card-scope {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: var(--space-xs);
}

.scope-tag-mini {
  display: inline-block;
  padding: 2px 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  font-size: 10px;
  color: var(--text-muted);
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.toggle-group {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.toggle-option {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  font-size: 13px;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-option:not(:last-child) {
  border-right: 1px solid var(--border);
}

.toggle-option.active {
  background: var(--accent);
  color: var(--bg-primary);
}

/* Sequence Editor Layout */
.sequence-editor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  min-height: 500px;
}

.sequence-library-panel,
.protocol-sequences-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sequence-library-panel .panel-header,
.protocol-sequences-panel .panel-header {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sequence-library-panel .panel-header h3,
.protocol-sequences-panel .panel-header h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.library-count,
.sequence-count {
  font-size: 12px;
  color: var(--text-muted);
}

.sequence-search-container {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
}

.sequence-search-container .search-input-wrap {
  position: relative;
}

.sequence-search-container .search-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  padding-left: 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  font-size: 13px;
  color: var(--text-primary);
}

.sequence-search-container .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.sequence-filters {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
}

.filter-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.filter-chip.small {
  padding: 4px 10px;
  font-size: 12px;
}

.sequence-library-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
}

/* Sequence Library Item */
.sequence-library-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sequence-library-item:hover {
  border-color: var(--accent);
  transform: translateX(2px);
}

.sequence-library-item.added {
  opacity: 0.5;
  pointer-events: none;
}

.sequence-weighting-badge {
  padding: 2px 6px;
  background: var(--bg-hover);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  flex-shrink: 0;
}

.sequence-weighting-badge.T1 { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.sequence-weighting-badge.T2 { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.sequence-weighting-badge.T2-FLAIR { background: rgba(168, 85, 247, 0.2); color: #a855f7; }
.sequence-weighting-badge.DWI { background: rgba(249, 115, 22, 0.2); color: #f97316; }
.sequence-weighting-badge.SWI { background: rgba(236, 72, 153, 0.2); color: #ec4899; }
.sequence-weighting-badge.STIR { background: rgba(20, 184, 166, 0.2); color: #14b8a6; }
.sequence-weighting-badge.PD { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.sequence-weighting-badge.TOF { background: rgba(139, 92, 246, 0.2); color: #8b5cf6; }
.sequence-weighting-badge.PC { background: rgba(6, 182, 212, 0.2); color: #06b6d4; }
.sequence-weighting-badge.contrast { background: var(--accent-muted); color: var(--accent); }

.sequence-library-info {
  flex: 1;
  min-width: 0;
}

.sequence-library-name {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sequence-library-time {
  font-size: 11px;
  color: var(--text-muted);
}

.sequence-info-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.sequence-info-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sequence-info-btn svg {
  width: 14px;
  height: 14px;
}

.sequence-add-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: color var(--transition-fast);
  flex-shrink: 0;
}

.sequence-library-item:hover .sequence-add-icon {
  color: var(--accent);
}

/* Sequence Type Card (Grouped with plane selection) */
.sequence-type-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-sm);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.sequence-type-card:hover {
  border-color: var(--border-hover);
}

.sequence-type-card.expanded {
  border-color: var(--accent);
}

.sequence-type-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sequence-type-header:hover {
  background: var(--bg-hover);
}

.sequence-type-main {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
  min-width: 0;
}

.sequence-type-info {
  flex: 1;
  min-width: 0;
}

.sequence-type-name {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sequence-type-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: 2px;
}

.sequence-type-time {
  font-size: 11px;
  color: var(--text-muted);
}

.sequence-type-pulse {
  font-size: 10px;
  padding: 1px 5px;
  background: rgba(155, 93, 229, 0.15);
  color: var(--accent);
  border-radius: 3px;
  font-weight: 500;
}

.sequence-type-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.expand-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.sequence-type-card.expanded .expand-icon {
  transform: rotate(180deg);
}

/* Plane Selection Area */
.sequence-type-planes {
  display: none;
  padding: var(--space-sm) var(--space-md) var(--space-md);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.sequence-type-card.expanded .sequence-type-planes {
  display: block;
  animation: fadeUp 0.2s ease;
}

.plane-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.plane-buttons {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.plane-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.plane-btn:hover:not([disabled]) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-muted);
}

.plane-btn:active:not([disabled]) {
  transform: scale(0.95);
}

.plane-btn.added {
  background: rgba(47, 164, 122, 0.15);
  border-color: var(--rating-high);
  color: var(--rating-high);
  cursor: default;
}

.plane-btn .check-icon {
  width: 12px;
  height: 12px;
}

/* Sequence badge colors - grouped by weighting type */
/* T1-based sequences (blue) */
.sequence-weighting-badge.t1,
.sequence-weighting-badge.t1mprage,
.sequence-weighting-badge.mprage,
.sequence-weighting-badge.3dmprage {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

/* T2-based sequences (green) */
.sequence-weighting-badge.t2,
.sequence-weighting-badge.t2fs,
.sequence-weighting-badge.t2haste,
.sequence-weighting-badge.haste,
.sequence-weighting-badge.flair,
.sequence-weighting-badge.stir,
.sequence-weighting-badge.pdfs,
.sequence-weighting-badge.mrcp {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

/* Contrast-enhanced sequences (purple) */
.sequence-weighting-badge.t1c,
.sequence-weighting-badge.t1fsc,
.sequence-weighting-badge.t1post,
.sequence-weighting-badge.t1fspost,
.sequence-weighting-badge.3dmpragec,
.sequence-weighting-badge.mpragec,
.sequence-weighting-badge.dynamic {
  background: var(--accent-muted);
  color: var(--accent);
}

/* Functional/Other sequences (teal) */
.sequence-weighting-badge.dwi,
.sequence-weighting-badge.swi,
.sequence-weighting-badge.mra,
.sequence-weighting-badge.mraneck,
.sequence-weighting-badge.mrv,
.sequence-weighting-badge.mratof,
.sequence-weighting-badge.tof,
.sequence-weighting-badge.3dtofmra {
  background: rgba(20, 184, 166, 0.2);
  color: #14b8a6;
}

/* Protocol Sequence Actions (rationale + remove buttons) */
.protocol-sequence-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.sequence-rationale-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sequence-rationale-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sequence-rationale-btn svg {
  width: 14px;
  height: 14px;
}

/* Pulse Sequence Section in Rationale Panel */
.rationale-pulse-sequence {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.rationale-pulse-sequence .rationale-section-title {
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.rationale-pulse-info {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* Protocol Sequences Panel (Right) */
.protocol-sequences-drop-zone {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
  min-height: 300px;
}

.drop-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: var(--space-xl);
}

.drop-placeholder svg {
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.drop-placeholder p {
  margin: 0;
}

.drop-placeholder .hint {
  font-size: 12px;
  margin-top: var(--space-sm);
  opacity: 0.7;
}

/* Draggable Protocol Sequence Item */
.protocol-sequence-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-xs);
  cursor: grab;
  transition: all var(--transition-fast);
}

.protocol-sequence-item:active {
  cursor: grabbing;
}

.protocol-sequence-item.dragging {
  opacity: 0.5;
  transform: scale(1.02);
  border-color: var(--accent);
}

.protocol-sequence-item.post-contrast {
  border-left: 3px solid var(--accent);
}

.sequence-drag-handle {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  cursor: grab;
  flex-shrink: 0;
}

.sequence-order-number {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.protocol-sequence-item.post-contrast .sequence-order-number {
  background: var(--accent-muted);
  color: var(--accent);
}

.protocol-sequence-info {
  flex: 1;
  min-width: 0;
}

.protocol-sequence-name {
  font-size: 13px;
  color: var(--text-primary);
}

.protocol-sequence-time {
  font-size: 11px;
  color: var(--text-muted);
}

.sequence-remove-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.sequence-remove-btn:hover {
  background: rgba(220, 74, 74, 0.15);
  color: var(--rating-low);
}

.sequence-remove-btn svg {
  width: 14px;
  height: 14px;
}

/* Contrast Divider */
.contrast-divider {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  margin: var(--space-sm) 0;
  background: var(--accent-muted);
  border-radius: var(--border-radius);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.contrast-divider svg {
  width: 16px;
  height: 16px;
}

/* Protocol Summary */
.protocol-summary {
  padding: var(--space-md);
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-lg);
}

.summary-actions {
  display: flex;
  gap: var(--space-sm);
}

.summary-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.summary-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.summary-action-btn svg {
  flex-shrink: 0;
}

.summary-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.summary-label {
  font-size: 12px;
  color: var(--text-muted);
}

.summary-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

/* Rationale Panel */
.rationale-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  margin-top: var(--space-lg);
  animation: fadeUp 0.3s ease;
}

.rationale-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.rationale-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--accent);
}

.rationale-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.rationale-close:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.rationale-content {
  padding: var(--space-lg);
}

.rationale-section {
  margin-bottom: var(--space-lg);
}

.rationale-section:last-child {
  margin-bottom: 0;
}

.rationale-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rationale-purpose {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
}

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

.rationale-list li {
  position: relative;
  padding-left: var(--space-md);
  margin-bottom: var(--space-xs);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.rationale-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
}

.rationale-pearls {
  background: var(--accent-muted);
  border-radius: var(--border-radius);
  padding: var(--space-md);
}

.rationale-pearls .rationale-section-title {
  color: var(--accent);
}

.rationale-pearls .rationale-list li::before {
  background: var(--accent);
}

/* Responsive */
@media (max-width: 900px) {
  .sequence-editor-layout {
    grid-template-columns: 1fr;
  }

  .form-row.two-col,
  .form-row.three-col {
    grid-template-columns: 1fr;
  }

  .my-protocols-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .editor-header {
    flex-wrap: wrap;
  }

  .editor-title {
    order: -1;
    width: 100%;
    margin-bottom: var(--space-sm);
  }
}

/* ===========================================
   Protocol Templates
   =========================================== */

.templates-container {
  margin-bottom: var(--space-xl);
}

.templates-header {
  margin-bottom: var(--space-md);
}

.templates-header .subsection-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.templates-header .subsection-title svg {
  color: var(--accent);
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-md);
}

.template-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.template-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.template-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.template-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  line-height: 1.3;
}

.template-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.template-card-meta .meta-item {
  white-space: nowrap;
}

.template-card-meta .meta-divider {
  color: var(--border);
}

/* ===========================================
   Inline Sequence Rationale
   =========================================== */

.protocol-sequence-item-wrapper {
  margin-bottom: var(--space-xs);
}

.protocol-sequence-item.rationale-open {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  margin-bottom: 0;
}

.sequence-rationale-toggle {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.sequence-rationale-toggle:hover {
  background: var(--accent-muted);
  color: var(--accent);
}

.sequence-rationale-toggle.active {
  background: var(--accent-muted);
  color: var(--accent);
}

.sequence-rationale-toggle svg {
  width: 16px;
  height: 16px;
}

.sequence-inline-rationale {
  display: none;
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  font-size: 12px;
  line-height: 1.5;
  animation: fadeIn 0.2s ease;
}

.sequence-inline-rationale.expanded {
  display: block;
}

.inline-rationale-section {
  margin-bottom: var(--space-sm);
}

.inline-rationale-section:last-child {
  margin-bottom: 0;
}

.inline-rationale-section strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.inline-rationale-section p {
  margin: 4px 0 0 0;
  color: var(--text-secondary);
}

.inline-rationale-section .pulse-info {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.inline-rationale-section ul {
  margin: 4px 0 0 0;
  padding-left: var(--space-md);
  color: var(--text-secondary);
}

.inline-rationale-section ul li {
  margin-bottom: 2px;
}

.inline-rationale-section.pearls {
  background: var(--accent-muted);
  padding: var(--space-sm);
  border-radius: var(--border-radius);
  margin-top: var(--space-sm);
}

.inline-rationale-section.pearls strong {
  color: var(--accent);
}

.inline-rationale-section.pearls ul {
  color: var(--text-primary);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ========================================
   Quick Reference Card (Dual Pathway)
   ======================================== */
.quick-reference-card {
  width: 100%;
  margin-bottom: var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  overflow: hidden;
  animation: fadeUp 0.3s ease;
}

.quick-reference-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.quick-reference-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.quick-reference-title svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.quick-reference-badge {
  font-size: 10px;
  padding: 2px 8px;
  background: var(--accent-muted);
  color: var(--accent);
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.quick-reference-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
}

.pathway-section {
  padding: var(--space-md);
  background: var(--bg-elevated);
}

.pathway-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.pathway-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pathway-indicator.acute {
  background: var(--rating-low);
  box-shadow: 0 0 8px rgba(220, 74, 74, 0.4);
}

.pathway-indicator.followup {
  background: #4a90d9;
  box-shadow: 0 0 8px rgba(74, 144, 217, 0.4);
}

.pathway-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pathway-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.pathway-recommendations {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.pathway-rec {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-secondary);
  border-radius: 4px;
  font-size: 13px;
}

.pathway-rec-name {
  color: var(--text-primary);
  font-weight: 500;
}

.pathway-rec-rating {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.pathway-rec-rating .rating-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
}

.pathway-rec-rating .rating-badge.high {
  background: rgba(47, 164, 122, 0.15);
  color: var(--rating-high);
}

.pathway-rec-rating .rating-badge.mid {
  background: rgba(212, 167, 44, 0.15);
  color: var(--rating-mid);
}

.pathway-empty {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  padding: var(--space-sm);
  text-align: center;
}

.quick-reference-footer {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* Mobile: Stack pathways vertically */
@media (max-width: 600px) {
  .quick-reference-body {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   Search Suggestions Dropdown
   ======================================== */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 100;
  max-height: 300px;
  overflow-y: auto;
}

.suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.active {
  background: var(--bg-hover);
}

.suggestion-topic {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.suggestion-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: var(--space-sm);
}

.quick-search-container {
  position: relative;
}
