/* ==========================================================================
   BadgerSkope — Design System
   Dark-first, light mode via [data-theme="light"]
   IBM Plex Sans / Mono
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Custom Properties
   -------------------------------------------------------------------------- */

:root {
  /* Dark palette (default) */
  --bg: #0c0f14;
  --bg-elevated: #121821;
  --surface: #161d28;
  --surface-hover: #1c2633;
  --border: #2a3545;
  --text: #e6eaef;
  --text-muted: #9aa8b8;
  --accent: #4c9dff;
  --accent-soft: rgba(76, 157, 255, 0.14);
  --success: #5bd6a6;
  --warning: #f5a623;
  --danger: #ef4444;

  /* Radii (aligned with marketing page) */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 20px;

  /* Shadows */
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.15);

  /* Typography */
  --font: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  /* Evidence tier */
  --ev-approved: #5bd6a6;
  --ev-approved-bg: rgba(91, 214, 166, 0.15);
  --ev-pivotal: #36b5a0;
  --ev-pivotal-bg: rgba(54, 181, 160, 0.15);
  --ev-phase1: #f5a623;
  --ev-phase1-bg: rgba(245, 166, 35, 0.15);
  --ev-preclinical: #e87740;
  --ev-preclinical-bg: rgba(232, 119, 64, 0.15);
  --ev-practice: #9aa8b8;
  --ev-practice-bg: transparent;
  --ev-unknown: #6b7a8d;
  --ev-unknown-bg: transparent;

  /* Surface aliases (legacy glass names kept for compat) */
  --glass: var(--bg-elevated);
  --glass-border: var(--border);

  /* Transition speed */
  --speed: 0.1s;
  --speed-md: 0.15s;
}

[data-theme="light"] {
  --bg: #f5f7fa;
  --bg-elevated: #fff;
  --surface: #edf0f5;
  --surface-hover: #e3e7ed;
  --border: #d1d9e0;
  --text: #1a2332;
  --text-muted: #5a6a7a;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --ev-approved: #059669;
  --ev-approved-bg: rgba(5, 150, 105, 0.1);
  --ev-pivotal: #0d9488;
  --ev-pivotal-bg: rgba(13, 148, 136, 0.1);
  --ev-phase1: #d97706;
  --ev-phase1-bg: rgba(217, 119, 6, 0.1);
  --ev-preclinical: #c2410c;
  --ev-preclinical-bg: rgba(194, 65, 12, 0.1);
  --ev-practice: #5a6a7a;
  --ev-practice-bg: transparent;
  --ev-unknown: #94a3b8;
  --ev-unknown-bg: transparent;
  --glass: var(--bg-elevated);
  --glass-border: var(--border);
}

/* --------------------------------------------------------------------------
   HERO (removed - kept as empty stats badge)
   -------------------------------------------------------------------------- */

.hero { display: none; }

.hero__stats {
  text-align: center;
  padding: 0.35rem 0;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   STICKY NAV BAR
   -------------------------------------------------------------------------- */

.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 1rem;
  height: 48px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.nav-bar__inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 100%;
  gap: 0.25rem;
}

.nav-bar__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.nav-bar__logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 6px;
}

.nav-bar__name {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.nav-bar__tabs {
  display: flex;
  gap: 0.15rem;
}

.nav-bar__tabs .tab {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--speed), background var(--speed);
}
.nav-bar__tabs .tab:hover { color: var(--text); background: var(--surface); }
.nav-bar__tabs .tab[aria-selected="true"] {
  color: var(--accent);
  font-weight: 600;
}

.nav-bar__end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.nav-bar__link {
  font: inherit;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color var(--speed);
}
.nav-bar__link:hover { color: var(--text); }

@media (max-width: 640px) {
  .nav-bar__end .nav-bar__link { display: none; }
}

/* --------------------------------------------------------------------------
   SEARCH ZONE (clean, no-box search)
   -------------------------------------------------------------------------- */

.search-zone {
  max-width: 640px;
  margin: 1.25rem auto 0;
  padding: 0 1rem;
  position: relative;
}

.search-zone__input {
  width: 100%;
  padding: 0.7rem 1rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  outline: none;
  transition: border-color var(--speed-md), box-shadow var(--speed-md);
}
.search-zone__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-zone__input::placeholder {
  color: var(--text-muted);
}
[data-theme="light"] .search-zone__input {
  background: #fff;
  border-color: #c8d0da;
}

.search-zone__reset {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--danger);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}
.search-zone__reset:hover {
  background: rgba(239, 68, 68, 0.1);
}
.search-zone__reset[hidden] { display: none; }

/* --------------------------------------------------------------------------
   BROWSE TOOLBAR (filters toggle + count, inline)
   -------------------------------------------------------------------------- */

.browse-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 1280px;
  margin: 0.75rem auto 0;
  padding: 0 1rem;
}

.browse-toolbar__count {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* nav-bar styles defined in STICKY NAV BAR section above */

/* --------------------------------------------------------------------------
   BS MONOGRAM
   -------------------------------------------------------------------------- */

.monogram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: -0.03em;
  font-family: var(--font);
  flex-shrink: 0;
  user-select: none;
}

.monogram--lg {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  font-size: 1.35rem;
  margin-bottom: 1rem;
}

.monogram--footer {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 0.75rem;
}

/* --------------------------------------------------------------------------
   2. Reset & Base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

[data-theme="light"] html,
html:has([data-theme="light"]) {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   3. Layout — .app
   -------------------------------------------------------------------------- */

.app {
  margin: 0 auto;
  padding: 0 0 2rem;
}

/* --------------------------------------------------------------------------
   4. Navigation Tabs
   -------------------------------------------------------------------------- */

.tab-bar {
  display: none;
}

.tab-bar__inner,
.nav-tabs {
  display: flex;
  gap: 0;
  border-bottom: none;
  margin-bottom: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tab-bar__inner::-webkit-scrollbar,
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
  position: relative;
  padding: 0.7rem 1.1rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--speed);
}

.nav-tab:hover { color: var(--text); }

.nav-tab::after {
  content: "";
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: transparent;
  transition: background var(--speed);
}

.nav-tab--active {
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}

.nav-tab--active::after {
  display: none;
}

.tab-panel {
  display: none;
}

.tab-panel--active {
  display: block;
  animation: fadeIn var(--speed-md) ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* --------------------------------------------------------------------------
   5. Header
   -------------------------------------------------------------------------- */

.header {
  margin-bottom: 1.5rem;
}

.header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.brand__logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  flex-shrink: 0;
  object-fit: contain;
  transition: transform var(--speed);
}

.brand__logo:hover {
  transform: scale(1.02);
}

/* Legacy mark (fallback if logo not loaded) */
.brand__mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.65rem;
  line-height: 1;
  user-select: none;
}

.brand__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.brand__tag {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header__stats {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   6. Theme Toggle
   -------------------------------------------------------------------------- */

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--speed), color var(--speed), border-color var(--speed);
}

.theme-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--accent);
}

.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* --------------------------------------------------------------------------
   7. Controls / Filters
   -------------------------------------------------------------------------- */

.controls { display: none; }

.controls--advanced {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.65rem;
  max-width: 1280px;
  margin: 0.5rem auto 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.controls--advanced[hidden] {
  display: none;
}

@media (min-width: 1100px) {
  .controls--advanced {
    grid-template-columns: repeat(3, 1fr);
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field__label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.field__input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  font: inherit;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color var(--speed-md), box-shadow var(--speed-md), background var(--speed);
}

.field__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  background: var(--surface);
}

.field__select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239aa8b8' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.controls__reset {
  display: flex;
  align-items: flex-end;
  padding-bottom: 0.65rem;
}

.controls__reset-btn {
  font: inherit;
  font-size: 0.78rem;
  color: var(--danger);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: background var(--speed);
}

.controls__reset-btn:hover {
  background: rgba(239, 68, 68, 0.1);
}

.controls__reset-btn[hidden] {
  display: none;
}

/* Active filter indicator dot */
.field--active .field__label::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 0.4rem;
  vertical-align: middle;
}

/* --------------------------------------------------------------------------
   8. Buttons
   -------------------------------------------------------------------------- */

.btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--speed), border-color var(--speed), opacity var(--speed),
    transform var(--speed);
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn--ghost {
  background: var(--bg-elevated);
  color: var(--text);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.btn--primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

[data-theme="light"] .btn--primary {
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  opacity: 0.9;
}

.btn--danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn--danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.1);
}

.btn--small {
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
}

.btn--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  font-size: 1.1rem;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   9. Error Banner
   -------------------------------------------------------------------------- */

.load-error {
  padding: 1rem;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-sm);
  color: #fecaca;
  margin-bottom: 1rem;
}

[data-theme="light"] .load-error {
  color: var(--danger);
}

/* --------------------------------------------------------------------------
   10. Selection Bar
   -------------------------------------------------------------------------- */

.selection-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.selection-bar[hidden] {
  display: none;
}

.selection-bar__count {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.selection-bar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* --------------------------------------------------------------------------
   11. Card Grid
   -------------------------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 0.65rem;
  align-items: start;
  min-height: 200px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}

.grid[aria-busy="true"]::before {
  content: "";
  grid-column: 1 / -1;
  height: 200px;
  border-radius: var(--radius);
  background: var(--surface);
}

/* --------------------------------------------------------------------------
   12. Cards
   -------------------------------------------------------------------------- */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--speed), box-shadow var(--speed);
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
  animation: fadeInUp 0.15s ease both;
  animation-delay: var(--delay, 0ms);
  overflow: hidden;
}

.card::before { display: none; }

/* Staggered fade-in */
.card:nth-child(1)  { animation-delay: 0s; }
.card:nth-child(2)  { animation-delay: 0.03s; }
.card:nth-child(3)  { animation-delay: 0.06s; }
.card:nth-child(4)  { animation-delay: 0.09s; }
.card:nth-child(5)  { animation-delay: 0.12s; }
.card:nth-child(6)  { animation-delay: 0.15s; }
.card:nth-child(7)  { animation-delay: 0.18s; }
.card:nth-child(8)  { animation-delay: 0.21s; }
.card:nth-child(9)  { animation-delay: 0.24s; }
.card:nth-child(10) { animation-delay: 0.27s; }
.card:nth-child(11) { animation-delay: 0.30s; }
.card:nth-child(12) { animation-delay: 0.33s; }

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

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card--selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

/* Bookmark star */
.card__bookmark {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  opacity: 0;
  cursor: pointer;
  border-radius: 6px;
  transition: opacity var(--speed), color var(--speed), background var(--speed);
  z-index: 1;
}

.card:hover .card__bookmark,
.card__bookmark:focus-visible {
  opacity: 1;
}

.card__bookmark:hover {
  background: var(--surface);
}

.card--bookmarked .card__bookmark {
  opacity: 1;
  color: var(--warning);
}

@media (pointer: coarse) {
  .card__bookmark {
    opacity: 1;
    font-size: 1.15rem;
  }
}

.card__head {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.card__select {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  cursor: pointer;
  margin: 0.15rem 0 0;
}

.card__select input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
  cursor: pointer;
}

@media (pointer: coarse) {
  .card__select {
    padding: 0.25rem;
  }
  .card__select input {
    width: 1.35rem;
    height: 1.35rem;
  }
}

.card__head-text {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.card__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.card__main:hover {
  /* handled by card:hover */
}

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

.card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.card__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.card__meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.card__evidence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.card__evidence-label {
  font-weight: 500;
}

.card__meta-sep {
  opacity: 0.4;
}

.card__category {
  opacity: 0.7;
}

.card__summary {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  line-height: 1.5;
}

.card__chips { display: none; }
.chip { display: none; }

.card__hint {
  display: block;
  margin: 0.65rem 0 0;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent);
  opacity: 0;
  transition: opacity var(--speed);
}

.card:hover .card__hint,
.card:focus-within .card__hint {
  opacity: 0.8;
}

@media (pointer: coarse) {
  .card__hint {
    opacity: 0.5;
  }
}

/* --------------------------------------------------------------------------
   13. Evidence Tier Badges (Pills)
   -------------------------------------------------------------------------- */

.evidence-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  line-height: 1.4;
}

.evidence--approved {
  background: var(--ev-approved-bg);
  color: var(--ev-approved);
  border: 1px solid var(--ev-approved);
}

.evidence--pivotal {
  background: var(--ev-pivotal-bg);
  color: var(--ev-pivotal);
  border: 1px solid var(--ev-pivotal);
}

.evidence--phase1 {
  background: var(--ev-phase1-bg);
  color: var(--ev-phase1);
  border: 1px solid var(--ev-phase1);
}

.evidence--preclinical {
  background: var(--ev-preclinical-bg);
  color: var(--ev-preclinical);
  border: 1px solid var(--ev-preclinical);
}

.evidence--practice {
  background: var(--ev-practice-bg);
  color: var(--ev-practice);
  border: 1px solid var(--ev-practice);
}

.evidence--unknown {
  background: var(--ev-unknown-bg);
  color: var(--ev-unknown);
  border: 1px dashed var(--ev-unknown);
}

/* --------------------------------------------------------------------------
   14. Compare Table
   -------------------------------------------------------------------------- */

.compare-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  max-width: 100%;
}

.compare-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.compare-table th,
.compare-table td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.compare-table th {
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 2;
}

/* Sticky first column */
.compare-table th:first-child,
.compare-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg-elevated);
  font-weight: 600;
  min-width: 140px;
  border-right: 1px solid var(--border);
}

.compare-table th:first-child {
  background: var(--surface);
  z-index: 3;
}

/* Zebra striping */
.compare-table tbody tr:nth-child(even) td {
  background: var(--surface);
}

.compare-table tbody tr:nth-child(even) td:first-child {
  background: var(--surface);
}

.compare-table tbody tr:last-child td {
  border-bottom: none;
}

/* Highlight differences */
.compare-table .diff-highlight {
  background: var(--accent-soft);
  font-weight: 600;
}

/* Max 5 visible columns hint */
.compare-scroll-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.5rem;
}

/* --------------------------------------------------------------------------
   15. Stats Dashboard
   -------------------------------------------------------------------------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  padding: 1.25rem 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-top: 2px solid var(--accent);
}

.stat-card__number {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.stat-card__label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* Horizontal bar chart */
.bar {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: var(--surface);
  overflow: hidden;
  margin-top: 0.25rem;
}

.bar::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: calc(var(--pct, 0) * 1%);
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.6s ease;
}

.bar--success::after { background: var(--success); }
.bar--warning::after { background: var(--warning); }
.bar--danger::after  { background: var(--danger); }

/* Stat bar (JS rendering) */
.stat-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.stat-bar__label {
  flex: 0 0 140px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.stat-bar__track {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--surface);
  overflow: hidden;
  position: relative;
}

.stat-bar__fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  width: calc(var(--pct, 0));
  transition: width 0.6s ease;
}

.stat-bar__count {
  flex: 0 0 2.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text);
}

.stat-total {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stats-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* Card evidence badge */
.card__evidence-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill, 20px);
  white-space: nowrap;
}

.card--evidence-dashed {
  border-left: 3px dashed var(--text-muted);
}

/* Detail header */
.detail__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Synergy list */
.synergy-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Compare panel extras */
.compare-prose {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.compare-list {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.compare-list li {
  margin-bottom: 0.25rem;
}

.compare-dose {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.compare-remove {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--speed), color var(--speed);
}

.compare-remove:hover {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
}

.compare-row-label {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}

.compare-diff {
  background: var(--accent-soft);
}

/* Compare table (reuses dose table patterns) */
table.compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

table.compare th,
table.compare td {
  padding: 0.6rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  min-width: 180px;
}

table.compare thead th {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
  position: sticky;
  top: 0;
  z-index: 1;
}

table.compare th:first-child,
table.compare td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg-elevated);
  min-width: 120px;
}

table.compare thead th:first-child {
  z-index: 3;
  background: var(--surface);
}

table.compare tbody tr:nth-child(even) td {
  background: var(--surface);
}

table.compare tbody tr:nth-child(even) td:first-child {
  background: var(--surface);
}

table.compare tbody tr:last-child td {
  border-bottom: none;
}

/* --------------------------------------------------------------------------
   16. Modal (Detail)
   -------------------------------------------------------------------------- */

.modal {
  padding: 0;
  border: none;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

[data-theme="light"] .modal::backdrop {
  background: rgba(0, 0, 0, 0.25);
}

.modal__panel {
  position: relative;
  width: min(680px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  margin: auto;
  padding: 1.5rem 1.75rem;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal__close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 1;
  width: 2rem;
  height: 2rem;
  margin: -0.25rem -0.25rem 0 0;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--speed), color var(--speed);
}

.modal__close:hover {
  background: var(--surface-hover);
}

@media (pointer: coarse) {
  .modal__close {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.5rem;
  }
}

.modal__toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
  margin: -0.5rem -0.5rem 0.5rem 0;
  position: sticky;
  top: 0;
  z-index: 1;
}

.modal__hint {
  margin: 1rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.modal__hint kbd {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}

.modal--compact .modal__panel {
  width: min(420px, calc(100vw - 2rem));
}

@media (max-width: 480px) {
  .modal__panel {
    width: calc(100vw - 0.5rem);
    max-height: calc(100vh - 0.5rem);
    padding: 1rem;
    border-radius: var(--radius-sm);
  }
  .modal__panel--wide {
    width: calc(100vw - 0.5rem);
    padding: 1rem;
  }
}

.modal__title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.compare-panel__empty {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--text-muted);
}

.compare-panel__empty-icon {
  display: block;
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.compare-panel__empty-title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}

.compare-panel__empty-hint {
  margin: 0;
  font-size: 0.9rem;
  max-width: 340px;
  margin-inline: auto;
}

/* Detail header */
.detail__title {
  margin: 0 0 0.15rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding-right: 2rem;
}

.detail__actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.detail__bookmark-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--speed);
}

.detail__bookmark-btn:hover {
  border-color: var(--warning);
  color: var(--warning);
}

.detail__bookmark-btn--active {
  color: var(--warning);
  border-color: var(--warning);
  background: rgba(245, 166, 35, 0.1);
}

.detail__link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--accent);
  margin-bottom: 1rem;
  padding: 0;
  background: none;
  border: none;
  word-break: break-all;
  transition: color var(--speed);
}

.detail__link:hover {
  text-decoration: underline;
}

/* Nav between detail items */
.detail__nav[hidden] { display: none; }
.detail__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.5rem 0;
  margin: 0 0 1rem;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.detail__nav-pos {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 5rem;
  text-align: center;
}

.detail__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.detail__badge {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* Sections */
.detail__section {
  margin-bottom: 1.25rem;
}

.detail__section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  padding-left: 0;
  border-left: none;
}

.detail__section--highlight {
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
}

.detail__muted {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

.detail__section p,
.detail__section li {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

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

.detail__section li {
  position: relative;
  padding-left: 1.1rem;
  margin-bottom: 0.6rem;
}

.detail__section li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
}

.detail__prose {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.6;
}

/* Collapsible sections */
.detail__collapse {
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  margin-bottom: 1rem;
}

.detail__collapse summary {
  padding: 0.5rem 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color var(--speed);
}

.detail__collapse summary:hover {
  color: var(--accent);
}

.detail__collapse summary::before {
  content: "\25B6";
  font-size: 0.6rem;
  transition: transform var(--speed);
}

.detail__collapse[open] summary::before {
  transform: rotate(90deg);
}

.detail__collapse summary::-webkit-details-marker {
  display: none;
}

.detail__collapse-body {
  padding: 0 0 0.75rem;
}

/* Synergy links */
.synergy-pill {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: color var(--speed), border-color var(--speed);
  text-decoration: none;
}

.synergy-pill:hover {
  border-color: var(--accent);
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   17. Doses Table (within detail)
   -------------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

table.doses {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

table.doses th,
table.doses td {
  padding: 0.6rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

table.doses th {
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

table.doses tr:last-child td {
  border-bottom: none;
}

/* --------------------------------------------------------------------------
   18. Keyboard Shortcuts Modal
   -------------------------------------------------------------------------- */

.shortcuts-list,
.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.shortcuts-list__item,
.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
}

.shortcut-item__label {
  font-size: 0.85rem;
  color: var(--text);
}

.shortcut-item__keys {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.4rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: 0 1px 0 var(--border);
}

/* --------------------------------------------------------------------------
   19. Back to Top Button
   -------------------------------------------------------------------------- */

.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 90;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity var(--speed-md), transform var(--speed-md),
    background var(--speed), border-color var(--speed);
  box-shadow: var(--shadow-sm);
}

.back-to-top--visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   20. Bookmarks Bar / Indicator
   -------------------------------------------------------------------------- */

.bookmarks-bar {
  display: none;
}

.bookmarks-bar:not([hidden]) {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--warning);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 9999px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transform: translateY(8px);
  transition: opacity var(--speed-md), transform var(--speed-md),
    background var(--speed), border-color var(--speed);
}

.bookmarks-indicator {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--warning);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 9999px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity var(--speed-md), transform var(--speed-md),
    background var(--speed), border-color var(--speed);
}

.bookmarks-indicator--visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.bookmarks-indicator:hover {
  background: var(--surface-hover);
  border-color: var(--warning);
}

.bookmarks-indicator__count {
  font-variant-numeric: tabular-nums;
}

/* Badge on tab */
.tab__badge,
.nav-tab__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 9999px;
  background: var(--accent);
  color: #fff;
  margin-left: 0.35rem;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   21. Empty State
   -------------------------------------------------------------------------- */

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   22. Footer
   -------------------------------------------------------------------------- */

.footer {
  margin-top: 2rem;
  padding: 0.75rem 1rem;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.disclaimer {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.footer__top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.footer__logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
}

.footer__brand-name {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.footer__brand-tag {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.footer__meta {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--mono);
}

.footer__shortcuts {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.footer__shortcuts kbd {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}

/* --------------------------------------------------------------------------
   23. Utility Classes
   -------------------------------------------------------------------------- */

.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;
}

/* --------------------------------------------------------------------------
   24. Print Styles
   -------------------------------------------------------------------------- */

@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    background: #fff !important;
    background-image: none !important;
    font-size: 11pt;
    line-height: 1.4;
  }

  .app {
    max-width: 100%;
    padding: 0;
  }

  /* Hide interactive chrome */
  .nav-tabs,
  .controls,
  .selection-bar,
  .back-to-top,
  .bookmarks-indicator,
  .theme-toggle,
  .header__actions,
  .card__select,
  .card__bookmark,
  .btn,
  .modal__close,
  .detail__nav {
    display: none !important;
  }

  /* Single column cards */
  .grid {
    display: block;
  }

  .card {
    break-inside: avoid;
    border: 1px solid #ccc;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    page-break-inside: avoid;
  }

  .card::before {
    display: none;
  }

  .card__summary {
    -webkit-line-clamp: unset;
    display: block;
    overflow: visible;
  }

  .card__distinctive {
    -webkit-line-clamp: unset;
    display: block;
    overflow: visible;
  }

  /* Modal content prints full width */
  .modal,
  .modal__panel {
    position: static;
    width: 100%;
    max-width: 100%;
    max-height: none;
    overflow: visible;
    border: none;
    padding: 0;
    margin: 0;
  }

  .modal::backdrop {
    display: none;
  }

  /* Collapse sections open */
  .detail__collapse {
    border: 1px solid #ccc;
  }

  .detail__collapse-body {
    display: block !important;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #555;
  }

  .detail__link::after {
    content: "";
  }
}

/* --------------------------------------------------------------------------
   25. Responsive Breakpoints
   -------------------------------------------------------------------------- */

/* 1100px+: full grid layout (default) */
@media (min-width: 1100px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* 768-1100px: 2-column cards */
@media (max-width: 1099px) and (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

/* 520-768px: stacked filters, 1-2 columns */
@media (max-width: 767px) and (min-width: 520px) {
  .controls {
    grid-template-columns: 1fr 1fr;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .shortcuts-grid {
    grid-template-columns: 1fr;
  }

  .header__inner {
    flex-direction: column;
  }
}

/* < 520px: single column */
@media (max-width: 519px) {
  .app {
    padding: 0 0 1.5rem;
  }

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

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .shortcuts-grid {
    grid-template-columns: 1fr;
  }

  .header__inner {
    flex-direction: column;
  }

  .brand__mark,
  .brand__logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .brand__title {
    font-size: 1.25rem;
  }

  .modal__panel {
    width: calc(100vw - 1rem);
    padding: 1rem;
    border-radius: var(--radius-sm);
  }

  .detail__title {
    font-size: 1.15rem;
  }

  .nav-tab {
    padding: 0.6rem 0.75rem;
    font-size: 0.82rem;
  }

  .compare-table {
    font-size: 0.75rem;
  }

  .compare-table th,
  .compare-table td {
    padding: 0.5rem 0.6rem;
  }

  .selection-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .selection-bar__actions {
    justify-content: center;
  }
}

/* Narrow filter fallback */
@media (max-width: 900px) {
  .field--narrow {
    grid-column: 1 / -1;
  }
}

/* --- Mobile UX fixes --- */

@media (max-width: 380px) {
  .controls {
    padding: 0.5rem;
    gap: 0.4rem;
  }
  .field__label {
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .field__input {
    font-size: 16px; /* prevents iOS zoom on focus */
  }
  .btn--small {
    font-size: 0.82rem;
    padding: 0.4rem 0.65rem;
  }
}

@media (max-width: 400px) {
  .stats-dashboard {
    grid-template-columns: 1fr;
  }
}

@media (pointer: coarse) {
  .footer__shortcuts {
    display: none;
  }
}

@media (max-width: 480px) {
  .back-to-top {
    right: 0.75rem;
    bottom: 0.75rem;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .detail__hero-bar {
    padding: 0.75rem;
  }
  .detail__title {
    font-size: 1.15rem;
  }
  .detail__section {
    margin-bottom: 1rem;
  }
  .detail__section h3 {
    font-size: 0.68rem;
  }
  .detail__prose {
    font-size: 0.85rem;
  }
}

/* --------------------------------------------------------------------------
   26. Reduced Motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   27. Custom Scrollbar
   -------------------------------------------------------------------------- */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg);
}

/* --------------------------------------------------------------------------
   28. Focus & Selection
   -------------------------------------------------------------------------- */

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

::selection {
  background: rgba(76, 157, 255, 0.3);
  color: var(--text);
}

/* ---- Light mode fixes for newer components ---- */
[data-theme="light"] .hero {
  background: var(--bg);
}

[data-theme="light"] .nav-bar {
  background: var(--bg-elevated);
}

[data-theme="light"] .card {
  background: var(--bg-elevated);
}

[data-theme="light"] .card:hover {
  border-color: var(--accent);
}

[data-theme="light"] .controls {
  background: var(--surface);
}

[data-theme="light"] .selection-bar {
  background: var(--surface);
}

[data-theme="light"] .modal__panel {
  background: #fff;
  box-shadow: var(--shadow);
}

/* detail__hero-bar, --highlight, --note: no background to override */

[data-theme="light"] .stat-card {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(37, 99, 235, 0.08);
}

[data-theme="light"] .goal-btn {
  background: transparent;
  border-color: #c8d0da;
  color: var(--text-muted);
}

[data-theme="light"] .goal-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

[data-theme="light"] .goal-btn--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

[data-theme="light"] .doping-banner {
  background: rgba(217, 119, 6, 0.05);
}

/* detail__disclaimer: no background to override */

[data-theme="light"] .info-banner {
  background: rgba(37, 99, 235, 0.05);
  border-color: rgba(37, 99, 235, 0.1);
}

[data-theme="light"] .toast {
  background: #fff;
  border-color: #d1d9e0;
  box-shadow: var(--shadow);
}

[data-theme="light"] .quick-preview {
  background: #fff;
  border-color: #d1d9e0;
  box-shadow: var(--shadow);
}

[data-theme="light"] .search-autocomplete {
  background: #fff;
  border-color: #d1d9e0;
  box-shadow: var(--shadow);
}

[data-theme="light"] .category-intro {
  background: var(--surface);
}

[data-theme="light"] .controls {
  border-color: #c8d0da;
}

[data-theme="light"] .field__input {
  border-color: #c8d0da;
  background: #fff;
}

[data-theme="light"] .goal-bar {
  border-color: #c8d0da;
  background: #fff;
}
