:root {
  color-scheme: light dark;
  --heading-font: 'Source Serif 4', 'Times New Roman', serif;
  --body-font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --bg: #f6f7fb;
  --fg: #101828;
  --muted: #5f6b7d;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --border: rgba(15, 23, 42, 0.08);
  --card-bg: rgba(255, 255, 255, 0.92);
  --shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
  --input-bg: rgba(37, 99, 235, 0.08);
  --input-border: rgba(37, 99, 235, 0.35);
  --dropdown-bg: #fff;
  --tooltip-bg: rgba(15, 23, 42, 0.95);
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #ef4444;
}

[data-theme='dark'] {
  --bg: #0f172a;
  --fg: #f1f5f9;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.15);
  --border: rgba(148, 163, 184, 0.12);
  --card-bg: rgba(30, 41, 59, 0.95);
  --shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
  --input-bg: rgba(96, 165, 250, 0.1);
  --input-border: rgba(96, 165, 250, 0.35);
  --dropdown-bg: #1e293b;
  --tooltip-bg: rgba(30, 41, 59, 0.98);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f172a;
    --fg: #f1f5f9;
    --muted: #94a3b8;
    --accent: #60a5fa;
    --accent-soft: rgba(96, 165, 250, 0.15);
    --border: rgba(148, 163, 184, 0.12);
    --card-bg: rgba(30, 41, 59, 0.95);
    --shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
    --input-bg: rgba(96, 165, 250, 0.1);
    --input-border: rgba(96, 165, 250, 0.35);
    --dropdown-bg: #1e293b;
    --tooltip-bg: rgba(30, 41, 59, 0.98);
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #eef2ff 0%, #ffffff 45%);
  color: var(--fg);
  font-family: var(--body-font);
  font-size: 16px;
  line-height: 1.55;
  transition: background 0.3s ease, color 0.3s ease;
}

[data-theme='dark'] body,
body:where(:root:not([data-theme='light'])) {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
}

@media (prefers-color-scheme: dark) {
  body:where(:root:not([data-theme='light'])) {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a {
  color: var(--accent);
}

a:hover,
a:focus {
  text-decoration: none;
}

h1,
h2,
h3,
h4,
.panel-header h2,
.entry-header h2,
.detail-tabs h4 {
  font-family: var(--heading-font);
  font-weight: 600;
}

h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  margin: 0;
}

h3 {
  font-size: 1.05rem;
  margin: 0;
}

.detail-tabs h4 {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

p,
small,
label,
button,
.meta-pill,
.filter-chip,
.category-btn,
.tab-btn,
.entry-summary,
.muted,
.dropdown-heading,
.dropdown-option__text,
.dropdown-toggle,
.dropdown-toggle__label,
.dropdown-toggle__icon {
  font-family: var(--body-font);
}

.table-class,
.panel-item span {
  font-family: var(--heading-font);
}

button {
  font-weight: 600;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 72px 24px 96px;
}

.hero {
  margin-bottom: 56px;
  display: flex;
  justify-content: center;
  text-align: center;
}

.hero__content {
  max-width: 760px;
  display: grid;
  gap: 18px;
}

.hero h1 {
  font-family: var(--heading-font);
  font-size: clamp(2.6rem, 4.6vw, 3.4rem);
  margin: 0;
  letter-spacing: -0.03em;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

small {
  font-size: 0.83rem;
  color: var(--muted);
}

.controls {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-bottom: 32px;
}

.control-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
  align-items: center;
}


.control-card--search {
  gap: 16px;
  align-items: stretch;
  text-align: left;
}

.control-card p,
.control-card small,
.control-card .label {
  width: 100%;
}

.inline-dropdowns {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.filter-dropdown {
  position: relative;
}

.dropdown-toggle {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 220px;
  font-size: 0.95rem;
}

.dropdown-toggle:hover,
.dropdown-toggle:focus {
  transform: translateY(-1px);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.filter-dropdown.is-open .dropdown-toggle {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.22);
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--dropdown-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px;
  display: none;
  z-index: 10;
}

.filter-dropdown.is-open .dropdown-panel {
  display: block;
}

.dropdown-section + .dropdown-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.dropdown-heading {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.dropdown-options {
  display: grid;
  gap: 6px;
}

.dropdown-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--fg);
}

.dropdown-option input[type='checkbox'] {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(15, 23, 42, 0.25);
  accent-color: var(--accent);
  cursor: pointer;
}

.dropdown-option__text {
  flex: 1;
  font-family: var(--body-font);
}

.dropdown-toggle__icon {
  font-size: 0.85rem;
  transition: transform 160ms ease;
}

.filter-dropdown.is-open .dropdown-toggle__icon {
  transform: rotate(180deg);
}
.filter-dropdown.is-open .dropdown-toggle {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.22);
}

.control-card label {
  font-weight: 600;
  font-size: 0.95rem;
}

.search-input {
  position: relative;
}

.search-input input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--fg);
  padding: 12px 14px 12px 44px;
  font-size: 1rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

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

.search-input input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--input-bg);
}

.search-input svg {
  position: absolute;
  top: 12px;
  left: 14px;
  width: 20px;
  height: 20px;
  stroke: rgba(16, 24, 40, 0.6);
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.category-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
  font-weight: 600;
  cursor: pointer;
  transition: all 160ms ease;
}

.category-btn.is-active {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
}

.action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn {
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary-btn {
  background: var(--accent);
  color: white;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.25);
}

.secondary-btn {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent);
}

.primary-btn:hover,
.primary-btn:focus,
.secondary-btn:hover,
.secondary-btn:focus {
  transform: translateY(-1px);
}

#result-count {
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.entries {
  display: grid;
  gap: 16px;
}

.entry-card {
  background: var(--card-bg);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}


.entry-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.entry-header__titles {
  flex: 1;
  min-width: 260px;
  display: grid;
  gap: 8px;
}

.entry-header h2 {
  margin: 4px 0 0;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

.entry-category {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.entry-summary {
  margin: 0;
  color: var(--muted);
}

.entry-header__meta {
  display: grid;
  gap: 8px;
  align-items: start;
  justify-items: end;
}

.meta-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all 140ms ease;
  color: var(--accent);
}

.icon-btn:hover,
.icon-btn:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.icon-btn.is-active,
.icon-btn.favorite-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.icon-btn.compare-btn.is-active {
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent);
}

.agent-count {
  font-size: 0.85rem;
  padding: 6px 10px;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 999px;
  font-weight: 600;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.expand-btn {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms ease;
}

.expand-btn:hover,
.expand-btn:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.entry-meta-block {
  display: grid;
  gap: 10px;
}

.meta-group {
  display: grid;
  gap: 4px;
}

.entry-meta-block h3 {
  margin: 0 0 4px;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.agent-list {
  margin: 0;
  font-weight: 600;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.1);
  font-size: 0.78rem;
  font-weight: 600;
}

.meta-chip--muted {
  background: rgba(15, 23, 42, 0.08);
  color: var(--muted);
}

.risk-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge-boxed {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.26);
}

.badge-teratogenic {
  background: rgba(251, 146, 60, 0.12);
  color: #c2410c;
  border-color: rgba(251, 146, 60, 0.26);
}

.badge-rems {
  background: rgba(147, 51, 234, 0.12);
  color: #7c3aed;
  border-color: rgba(147, 51, 234, 0.24);
}

.badge-age {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  border-color: rgba(59, 130, 246, 0.24);
}

.badge-pediatric {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.26);
}

.badge-infection {
  background: rgba(244, 114, 182, 0.12);
  color: #be185d;
  border-color: rgba(244, 114, 182, 0.26);
}

.entry-details {
  display: none;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  padding-top: 14px;
  gap: 14px;
}

.entry-details.is-open {
  display: grid;
}

.entry-toggle {
  display: flex;
  justify-content: flex-end;
  margin-top: -8px;
}

.expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  transition: all 140ms ease;
}

.expand-btn:hover,
.expand-btn:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.expand-btn[aria-expanded='true'] {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.22);
}

.expand-btn__icon {
  font-size: 0.85rem;
}

.risk-badge {
  position: relative;
  cursor: default;
}

.risk-badge:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.risk-badge::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  transform: translateX(-50%);
  background: var(--tooltip-bg);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: var(--shadow);
  max-width: 280px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 140ms ease, transform 140ms ease;
  transform-origin: top center;
  z-index: 5;
}

.risk-badge:hover::after,
.risk-badge:focus::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tab-btn {
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--fg);
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms ease;
}

.tab-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.24);
}

.tab-btn:hover,
.tab-btn:focus {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.tab-panels {
  display: grid;
  gap: 14px;
}

.tab-panel {
  display: none;
  gap: 14px;
}

.tab-panel.is-active {
  display: grid;
}

.grid-split {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.timeline {
  position: relative;
  margin: 16px 0;
}

.timeline-track {
  position: relative;
  height: 4px;
  background: rgba(15, 23, 42, 0.12);
  border-radius: 999px;
}

.timeline-point {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.timeline-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.timeline-point--critical .timeline-marker {
  background: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3);
}

.timeline-tooltip {
  position: absolute;
  top: -10px;
  transform: translate(-50%, -100%);
  background: var(--tooltip-bg);
  color: white;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  width: 200px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
}

.timeline-tooltip strong {
  display: block;
  margin-bottom: 4px;
}

.timeline-point:hover .timeline-tooltip,
.timeline-point:focus-within .timeline-tooltip {
  opacity: 1;
}

.timeline-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--muted);
}

.checklist {
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
}

.checklist-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  align-items: flex-start;
}

.checklist-row input[type='checkbox'] {
  margin-top: 4px;
}

.checklist-row.is-critical {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}

.checklist-copy {
  display: grid;
  gap: 4px;
}

.checklist-copy small {
  color: var(--muted);
  font-size: 0.75rem;
}


.bullet-list {
  margin: 12px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.entry-footer {
  display: grid;
  gap: 14px;
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.caution-block h4 {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  color: var(--muted);
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.references-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reference-chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.copy-btn {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 20px rgba(37, 99, 235, 0.25);
  transition: transform 160ms ease;
}

.copy-btn:hover,
.copy-btn:focus {
  transform: translateY(-1px);
}

.copy-btn.copied {
  background: #16a34a;
  box-shadow: 0 12px 20px rgba(22, 163, 74, 0.25);
}

.copy-btn--inline {
  margin-top: 10px;
}

.entry-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.entry-table th,
.entry-table td {
  padding: 18px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  vertical-align: top;
  text-align: left;
}

.entry-table th {
  background: rgba(37, 99, 235, 0.05);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.entry-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.04);
}

.table-class {
  font-weight: 700;
  margin-bottom: 4px;
}

.table-agents {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.table-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  font-size: 0.78rem;
  font-weight: 600;
}

.table-refs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.empty-state {
  text-align: center;
  padding: 48px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  border: 1px dashed rgba(37, 99, 235, 0.2);
  color: var(--muted);
}

.highlight {
  background: linear-gradient(90deg, rgba(129, 140, 248, 0.4), rgba(56, 189, 248, 0.4));
  padding: 0 2px;
  border-radius: 4px;
}

.secondary-panels {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin: 32px 0;
}

.panel-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  display: grid;
  gap: 12px;
  box-shadow: var(--shadow);
}

.panel-card.is-collapsed {
  display: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.panel-close {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.75rem;
}

.panel-list {
  display: grid;
  gap: 8px;
}

.panel-item {
  display: grid;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.panel-item:hover,
.panel-item:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.panel-item span {
  font-weight: 600;
}

.panel-item small {
  color: var(--muted);
}

.comparison-section {
  display: none;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.comparison-section.is-visible {
  display: grid;
  gap: 16px;
}

.comparison-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.comparison-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.comparison-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.comparison-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--card-bg);
  display: grid;
  gap: 10px;
}

.comparison-card h3 {
  margin: 0 0 4px;
}

.comparison-card ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.mobile-actions {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  box-shadow: var(--shadow);
  z-index: 20;
}

.mobile-actions button {
  border: none;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  padding: 14px 18px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.95);
  color: #fff;
  font-weight: 600;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 30;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-error {
  background: rgba(239, 68, 68, 0.95);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

[data-theme='dark'] .modal-backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.modal {
  background: var(--dropdown-bg);
  color: var(--fg);
  border-radius: 14px;
  padding: 22px 24px;
  max-width: 420px;
  width: min(90vw, 420px);
  display: grid;
  gap: 18px;
  box-shadow: var(--shadow);
}

.modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shortcut-list {
  display: grid;
  gap: 12px;
}

.shortcut-list div {
  display: grid;
  gap: 4px;
}

.shortcut-list kbd {
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.78rem;
  font-family: 'Inter', sans-serif;
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--accent);
  font-size: 1.25rem;
  cursor: pointer;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms ease;
  box-shadow: var(--shadow);
}

.theme-toggle:hover {
  transform: scale(1.1);
  border-color: var(--accent);
}

.theme-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Lab Order Templates Modal */
.lab-template-modal {
  max-width: 600px;
  width: min(90vw, 600px);
}

.lab-template-modal .template-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.lab-template-btn {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  transition: all 160ms ease;
}

.lab-template-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.lab-template-btn h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  color: var(--accent);
}

.lab-template-btn p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Quick Reference Card - Print Optimized */
.quick-ref-card {
  display: none;
}

@media print {
  body {
    background: white !important;
    color: #000 !important;
  }

  .hero p,
  .controls,
  .secondary-panels,
  .comparison-section,
  .mobile-actions,
  .copy-btn,
  .icon-btn,
  .primary-btn,
  .secondary-btn,
  .theme-toggle,
  #view-toggle,
  #export-csv {
    display: none !important;
  }

  .page {
    max-width: 100%;
    padding: 24px;
  }

  .entry-card {
    box-shadow: none;
    border: 1px solid #000;
    background: white !important;
    page-break-inside: avoid;
  }

  .entry-details {
    display: grid !important;
  }

  /* Quick Reference Card for Printing */
  .quick-ref-card {
    display: block;
    page-break-inside: avoid;
    border: 2px solid #000;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    background: white !important;
  }

  .quick-ref-card h3 {
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ccc;
    font-size: 1.1rem;
  }

  .quick-ref-card .ref-section {
    margin-bottom: 12px;
  }

  .quick-ref-card .ref-section h4 {
    margin: 0 0 6px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .quick-ref-card ul {
    margin: 0;
    padding-left: 18px;
    font-size: 0.85rem;
  }

  .quick-ref-card ul li {
    margin-bottom: 4px;
  }

  .quick-ref-card .caution-text {
    font-size: 0.8rem;
    font-style: italic;
    color: #666;
  }
}

@media (max-width: 720px) {
  .entry-card {
    padding: 20px;
  }

  .entry-header__meta {
    justify-items: start;
  }

  .mobile-actions {
    display: flex;
  }
}

[data-view="table"] #results {
  gap: 0;
}
