/* ==========================================================================
   Onko Portal — styles.css
   Clean, calm medical aesthetic. 100vh layout, zero page scroll.
   Created by M&K (c)2026 VetCoders
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */

:root {
  --font-main: "Inter", -apple-system, "Segoe UI", sans-serif;
  --base-font: 16px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  --navbar-h: 48px;
  --drawer-w: 380px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --transition: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme (default) */
html[data-theme="light"] {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --surface-hover: #f1f3f5;
  --surface-alt: #f0f4f2;
  --text: #1a1a2e;
  --text-secondary: #5a6570;
  --text-muted: #8b95a0;
  --accent: #2d6a4f;
  --accent-hover: #245a42;
  --accent-light: #d4edda;
  --accent-surface: #e8f5e9;
  --border: #dee2e6;
  --border-light: #e9ecef;
  --urgent: #c0392b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --bubble-user: #e8f0fe;
  --bubble-user-border: #bfd6ff;
  --bubble-ai: #f0f7f4;
  --bubble-ai-border: #c8e6d0;
  --input-bg: #ffffff;
  --translation-bg: #f0f7ff;
  --translation-border: #4a90d9;
}

/* Dark Theme */
html[data-theme="dark"] {
  --bg: #1a1a2e;
  --surface: #16213e;
  --surface-hover: #1c2a4a;
  --surface-alt: #1e2746;
  --text: #e0e0e0;
  --text-secondary: #a0aab4;
  --text-muted: #6b7580;
  --accent: #4ecca3;
  --accent-hover: #3dbb92;
  --accent-light: #1a3a30;
  --accent-surface: #162e28;
  --border: #2a2a4a;
  --border-light: #252545;
  --urgent: #e74c3c;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --bubble-user: #1e2d4a;
  --bubble-user-border: #2a4070;
  --bubble-ai: #1a2e28;
  --bubble-ai-border: #2a4a3a;
  --input-bg: #1c2a4a;
  --translation-bg: #1a2540;
  --translation-border: #4a90d9;
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */

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

html,
body {
  height: 100vh;
  overflow: hidden;
}

body {
  font-family: var(--font-main);
  font-size: var(--base-font);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   Navbar — 48px fixed top
   -------------------------------------------------------------------------- */

.navbar {
  height: var(--navbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 100;
  gap: var(--space-md);
}

.navbar-left {
  flex-shrink: 0;
}

.navbar-brand {
  font-size: 1.05em;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
}

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

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.875em;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.nav-tab i {
  font-size: 1.15em;
}

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

.nav-tab.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.font-controls {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-alt);
  border-radius: 999px;
  padding: 2px;
  border: 1px solid var(--border-light);
}

.font-label {
  font-size: 0.8em;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0 4px;
  user-select: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.9em;
  cursor: pointer;
  transition: all var(--transition);
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border);
}

.icon-btn i {
  font-size: 1.1em;
}

.chat-toggle-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* --------------------------------------------------------------------------
   App Shell — grid layout
   -------------------------------------------------------------------------- */

.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  height: calc(100vh - var(--navbar-h));
  position: relative;
  overflow: hidden;
  transition: grid-template-columns var(--transition);
}

.app-shell.drawer-open {
  grid-template-columns: 1fr var(--drawer-w);
}

/* --------------------------------------------------------------------------
   Main Area
   -------------------------------------------------------------------------- */

.main-area {
  overflow: hidden;
  position: relative;
}

.panel {
  display: none;
  height: 100%;
}

.panel.is-active {
  display: block;
}

.panel-scroll {
  height: 100%;
  overflow-y: auto;
  padding: var(--space-lg);
  scroll-behavior: smooth;
}

.panel-scroll::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.panel-scroll::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.panel-scroll::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.panel-scroll::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Panel Header
   -------------------------------------------------------------------------- */

.panel-header {
  margin-bottom: var(--space-lg);
}

.panel-header h2 {
  font-size: 1.4em;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-xs);
}

.panel-subtitle {
  color: var(--text-secondary);
  font-size: 0.9em;
}

/* --------------------------------------------------------------------------
   Cards Grid (Korepetycje)
   -------------------------------------------------------------------------- */

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

.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}

.badge {
  display: inline-block;
  margin-bottom: var(--space-sm);
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.card h3 {
  font-size: 1.05em;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text);
}

.card p {
  color: var(--text-secondary);
  font-size: 0.92em;
  margin-bottom: var(--space-sm);
}

.card strong {
  display: block;
  font-size: 0.85em;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-xs);
  margin-top: var(--space-md);
}

.card ul {
  padding-left: 1.2em;
  font-size: 0.9em;
  color: var(--text-secondary);
}

.card li {
  margin-bottom: 3px;
}

/* --------------------------------------------------------------------------
   Sources Section
   -------------------------------------------------------------------------- */

.sources-section {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-light);
}

.sources-section h3 {
  font-size: 1em;
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--text);
}

.sources-section ul {
  padding-left: 1.2em;
}

.sources-section li {
  margin-bottom: var(--space-sm);
  font-size: 0.92em;
}

.sources-section a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.sources-section a:hover {
  text-decoration: underline;
}

.source-desc {
  color: var(--text-muted);
  font-size: 0.9em;
}

/* --------------------------------------------------------------------------
   Search Forms
   -------------------------------------------------------------------------- */

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

.form-row {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-width: 0;
}

.form-field.grow {
  flex: 1;
  min-width: 200px;
}

.field-label {
  font-size: 0.8em;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input,
textarea,
select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.92em;
  padding: var(--space-sm) 12px;
  background: var(--input-bg);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.12);
}

html[data-theme="dark"] input:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] select:focus {
  box-shadow: 0 0 0 3px rgba(78, 204, 163, 0.15);
}

textarea {
  height: auto;
  resize: vertical;
  line-height: 1.5;
}

select {
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 20px;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

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

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

.btn-ghost {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.82em;
  font-weight: 500;
}

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

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

.btn-ghost i {
  font-size: 1.1em;
}

/* --------------------------------------------------------------------------
   Status Line
   -------------------------------------------------------------------------- */

.status-line {
  min-height: 1.4em;
  font-size: 0.82em;
  color: var(--text-muted);
  margin-top: var(--space-sm);
}

/* --------------------------------------------------------------------------
   Results List (PubMed + Brave)
   -------------------------------------------------------------------------- */

.results-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition);
}

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

.result-card h3 {
  font-size: 1em;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  line-height: 1.4;
}

.result-card h3 a {
  color: var(--accent);
  text-decoration: none;
}

.result-card h3 a:hover {
  text-decoration: underline;
}

.result-meta {
  font-size: 0.82em;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.result-description {
  font-size: 0.9em;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  line-height: 1.5;
}

.result-source {
  font-size: 0.78em;
  color: var(--text-muted);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-light);
}

/* --------------------------------------------------------------------------
   Abstract & Translation (PubMed)
   -------------------------------------------------------------------------- */

.abstract {
  margin-top: var(--space-sm);
  padding: var(--space-md);
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.88em;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text-secondary);
}

.translation {
  margin-top: var(--space-sm);
  padding: var(--space-md);
  background: var(--translation-bg);
  border-left: 3px solid var(--translation-border);
  border-radius: var(--radius-xs);
  font-size: 0.88em;
  line-height: 1.6;
}

.translation strong {
  display: block;
  margin-bottom: var(--space-sm);
  color: var(--translation-border);
  font-size: 0.9em;
}

.translation-content {
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Search Sub-tabs (Brave)
   -------------------------------------------------------------------------- */

.search-subtabs {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
  padding: 3px;
  background: var(--surface-alt);
  border-radius: 999px;
  border: 1px solid var(--border-light);
  width: fit-content;
}

.subtab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.82em;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

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

.subtab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   Visit List
   -------------------------------------------------------------------------- */

.visit-list {
  padding-left: 1.3em;
  margin-bottom: var(--space-lg);
}

.visit-list li {
  margin-bottom: var(--space-sm);
  font-size: 0.95em;
  color: var(--text);
  line-height: 1.6;
}

.notes-section {
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-light);
}

.notes-section textarea {
  min-height: 160px;
}

/* --------------------------------------------------------------------------
   Chat Drawer
   -------------------------------------------------------------------------- */

.chat-drawer {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  height: 100%;
  transform: translateX(100%);
  transition: transform var(--transition);
  overflow: hidden;
}

.app-shell.drawer-open .chat-drawer {
  transform: translateX(0);
}

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

.drawer-header h3 {
  font-size: 0.95em;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
}

.drawer-header h3 i {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Chat Messages
   -------------------------------------------------------------------------- */

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.bubble {
  border-radius: var(--radius);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.9em;
  line-height: 1.55;
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.bubble.user {
  background: var(--bubble-user);
  border: 1px solid var(--bubble-user-border);
  align-self: flex-end;
}

.bubble.assistant {
  background: var(--bubble-ai);
  border: 1px solid var(--bubble-ai-border);
  align-self: flex-start;
}

.bubble strong {
  display: block;
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.bubble-content {
  white-space: normal;
}

.bubble-content h3 {
  font-size: 1em;
  margin: 0.8em 0 0.3em;
  color: var(--text);
}

.bubble-content h4 {
  font-size: 0.92em;
  margin: 0.6em 0 0.2em;
  color: var(--text);
}

.bubble-content ul,
.bubble-content ol {
  padding-left: 1.3em;
  margin: 0.3em 0;
}

.bubble-content li {
  margin: 0.15em 0;
}

.bubble-content p {
  margin: 0.3em 0;
}

.bubble-content strong {
  display: inline;
  font-size: inherit;
  text-transform: none;
  letter-spacing: normal;
  color: inherit;
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Chat Input Area
   -------------------------------------------------------------------------- */

.chat-input-area {
  flex-shrink: 0;
  padding: var(--space-sm) var(--space-md) var(--space-md);
  border-top: 1px solid var(--border-light);
  background: var(--surface);
}

.chat-options {
  margin-bottom: var(--space-sm);
}

.check-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.78em;
  color: var(--text-muted);
  cursor: pointer;
}

.check-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: auto;
  accent-color: var(--accent);
}

.chat-input-row {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-end;
}

.chat-input-row textarea {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  resize: none;
}

.btn-send {
  width: 40px;
  height: 40px;
  padding: 0;
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
}

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

.btn-send i {
  font-size: 1.15em;
}

.chat-input-area .status-line {
  margin-top: var(--space-xs);
  font-size: 0.75em;
}

/* --------------------------------------------------------------------------
   Drag & Drop + Attachments
   -------------------------------------------------------------------------- */

.chat-drawer.dragover {
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
  background: var(--accent-surface);
}

.attachment-previews {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  padding: 0 var(--space-md) var(--space-sm);
  max-height: 100px;
  overflow-y: auto;
}

.attachment-preview {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  font-size: 0.78em;
  max-width: 180px;
}

.attachment-preview img {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.attachment-preview i {
  font-size: 1.2em;
  color: var(--accent);
  flex-shrink: 0;
}

.attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.attachment-remove {
  cursor: pointer;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1em;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
}

.attachment-remove:hover {
  color: var(--urgent);
}

#attach-btn {
  flex-shrink: 0;
  color: var(--text-secondary);
}

#attach-btn:hover {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Footer Disclaimer
   -------------------------------------------------------------------------- */

.footer-disclaimer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.7em;
  color: var(--text-muted);
  padding: 4px var(--space-md);
  background: var(--bg);
  border-top: 1px solid var(--border-light);
  z-index: 50;
  opacity: 0.7;
}

/* --------------------------------------------------------------------------
   Focus States
   -------------------------------------------------------------------------- */

.nav-tab:focus-visible,
.icon-btn:focus-visible,
.btn:focus-visible,
.subtab:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Responsive: < 900px
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .navbar-center span {
    display: none;
  }

  .nav-tab {
    padding: 0 10px;
    gap: 0;
  }

  .nav-tab i {
    font-size: 1.3em;
  }

  .font-label {
    display: none;
  }

  .chat-drawer {
    position: fixed;
    top: var(--navbar-h);
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 200;
    border-left: none;
  }

  .app-shell.drawer-open {
    grid-template-columns: 1fr;
  }

  .panel-scroll {
    padding: var(--space-md);
  }

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

  .form-row {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .navbar-brand {
    font-size: 0.9em;
  }

  .panel-header h2 {
    font-size: 1.2em;
  }
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */

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

.card {
  animation: fadeIn 0.3s ease both;
}

.cards-grid .card:nth-child(1) { animation-delay: 0.05s; }
.cards-grid .card:nth-child(2) { animation-delay: 0.1s; }
.cards-grid .card:nth-child(3) { animation-delay: 0.15s; }
.cards-grid .card:nth-child(4) { animation-delay: 0.2s; }
.cards-grid .card:nth-child(5) { animation-delay: 0.25s; }
.cards-grid .card:nth-child(6) { animation-delay: 0.3s; }

.result-card {
  animation: fadeIn 0.25s ease both;
}

/* --------------------------------------------------------------------------
   Query Templates (PubMed chips)
   -------------------------------------------------------------------------- */

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

.query-templates-section > .field-label {
  display: block;
  margin-bottom: var(--space-sm);
}

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

.chip-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.chip-category-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72em;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-right: 4px;
  white-space: nowrap;
}

.chip-category-label i {
  font-size: 1.1em;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.78em;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

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

.chip-active {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}

/* --------------------------------------------------------------------------
   Study Type Filters (checkbox chips)
   -------------------------------------------------------------------------- */

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

.filter-row > .field-label {
  display: block;
  margin-bottom: var(--space-xs);
}

.filter-row .chip-row {
  flex-direction: row;
  flex-wrap: wrap;
}

.chip-check {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.78em;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  gap: 4px;
}

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

.chip-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  min-height: auto;
  accent-color: var(--accent);
  margin: 0;
}

.chip-check:has(input:checked) {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

/* --------------------------------------------------------------------------
   Related Articles
   -------------------------------------------------------------------------- */

.related-articles {
  margin-top: var(--space-sm);
  padding: var(--space-md);
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.88em;
}

.related-articles strong {
  display: block;
  margin-bottom: var(--space-sm);
  font-size: 0.9em;
  color: var(--text);
}

.related-list {
  padding-left: 1.2em;
}

.related-list li {
  margin-bottom: var(--space-xs);
  line-height: 1.5;
}

.related-list a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.related-list a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   ClinicalTrials.gov Cards
   -------------------------------------------------------------------------- */

.ct-card .badge-ct {
  margin-bottom: var(--space-sm);
  background: var(--accent-surface);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */

@media print {
  .navbar,
  .chat-drawer,
  .footer-disclaimer,
  .search-form,
  .result-actions {
    display: none !important;
  }

  html, body {
    height: auto;
    overflow: auto;
  }

  .app-shell {
    display: block;
    height: auto;
  }

  .panel {
    display: block !important;
    height: auto !important;
  }

  .panel-scroll {
    overflow: visible;
    height: auto;
  }
}
