*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, a, select, [onclick], summary, label[for] { cursor: pointer; }

/* ── Toggle group sliding indicator ──
   A single ::before pseudo-element on the container slides between items
   whenever the .active child changes. JS writes --tg-x/y/w/h positions.
   Individual items lose their own background/border/shadow so only the
   slider draws the active "pill." Text color and font-weight still come
   from the .active rules so the label weight transition still plays.

   @property registers the vars as animatable <length>s — without this,
   browsers treat var() changes as discrete and the transition doesn't
   interpolate (transform jumps instantly to the final value). */
@property --tg-x { syntax: '<length>'; inherits: true; initial-value: 0px; }
@property --tg-y { syntax: '<length>'; inherits: true; initial-value: 0px; }
@property --tg-w { syntax: '<length>'; inherits: true; initial-value: 0px; }
@property --tg-h { syntax: '<length>'; inherits: true; initial-value: 0px; }
.tg-slider {
  position: relative;
  /* The JS writes --tg-x/y/w/h onto this element, so the transition that
     drives the slide lives here (inheriting into ::before below). */
  transition:
    --tg-x 0.32s cubic-bezier(0.34, 1.2, 0.64, 1),
    --tg-y 0.32s cubic-bezier(0.34, 1.2, 0.64, 1),
    --tg-w 0.32s cubic-bezier(0.34, 1.2, 0.64, 1),
    --tg-h 0.32s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.tg-slider::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: var(--tg-w);
  height: var(--tg-h);
  transform: translate(var(--tg-x), var(--tg-y));
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  pointer-events: none;
  z-index: 0;
}
/* Initial paint: place the thumb without animating from (0,0). */
.tg-slider.tg-slider-notx {
  transition: none;
}
/* No active child yet — hide thumb entirely. */
.tg-slider.tg-slider-empty::before { opacity: 0; }

/* Keep items above the thumb and strip their individual backgrounds so the
   slider is the only background. The scale bounce still plays via transform,
   but we turn off per-item box-shadow and border (redundant with the thumb). */
.tg-slider > * { position: relative; z-index: 1; }
.tg-slider .theme-opt.active,
.tg-slider .sv-opt.active,
.tg-slider .hv-opt.active,
.tg-slider .ds-view-btn.active,
.tg-slider .landing-theme-btn.active,
.tg-slider .compare-sort-btn.active {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  /* The slider handles the motion now — drop the per-item scale. */
  transform: none;
}

/* Respect users who prefer reduced motion — disable non-essential
   transforms and shorten transitions across the site (toggle groups,
   accordions, hover effects). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .theme-opt.active,
  .sv-opt.active,
  .hv-opt.active,
  .preview-tab.active,
  .ds-view-btn.active,
  .landing-theme-btn.active,
  .compare-sort-btn.active {
    transform: none !important;
  }
  /* Keep the slider's position (still driven by CSS vars) but don't animate. */
  .tg-slider {
    transition: none !important;
  }
}

/* Skip navigation */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 10000;
  padding: 8px 16px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  top: 8px;
}

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

:root {
  --bg: #f5f0e8;
  --bg-sidebar: #ece5d8;
  --bg-card: #e8e0d0;
  --bg-input: #e2d9c8;
  --bg-hover: #ddd4c2;
  --border: #b5a78e;
  --text: #3d3428;
  --text-muted: #6b5d4d;
  --text-subtle: #8a7a66;
  --accent: #5c4a32;
  --tag-use: #d4edda;
  --tag-use-text: #1b5e20;
  --tag-avoid: #f5d5d5;
  --tag-avoid-text: #8b1a1a;
  --tag-what: #d6e4f0;
  --tag-what-text: #1a4a7a;
  --sidebar-width: 260px;
  --header-height: 56px;
  --toc-height: 44px;
  --transition-color: color 0.15s;
  --transition-bg: background 0.15s;
  --transition-bg-color: background 0.15s, color 0.15s;
  --transition-transform: transform 0.2s;
  /* Accordion expand/collapse — matches the Figma plugin's --t-accordion.
     Used by sidebar sections; a slightly longer timing than the hover
     transitions above so the height change reads as motion, not a flicker. */
  --transition-accordion: 150ms;
  --badge-success-bg: #dcfce7;
  --badge-success-text: #166534;
  --badge-warn-bg: #fef3c7;
  --badge-warn-text: #92400e;
  --badge-danger-bg: #fee2e2;
  --badge-danger-text: #991b1b;
  --badge-info-bg: #dbeafe;
  --badge-info-text: #1e40af;
}

:root.light {
  --bg: #ffffff;
  --bg-sidebar: #fafafa;
  --bg-card: #f4f4f5;
  --bg-input: #f4f4f5;
  --bg-hover: #f0f0f0;
  --border: #c8c8cc;
  --text: #333333;
  --text-muted: #4b4b4b;
  --text-subtle: #767676;
  --accent: #18181b;
  --tag-use: #dcfce7;
  --tag-use-text: #166534;
  --tag-avoid: #fee2e2;
  --tag-avoid-text: #991b1b;
  --tag-what: #dbeafe;
  --tag-what-text: #1d4ed8;
}

:root.dark {
  --bg: #0a0a0a;
  --bg-sidebar: #111111;
  --bg-card: #1e1e1e;
  --bg-input: #282828;
  --bg-hover: #252525;
  --border: #444444;
  --text: #ffffff;
  --text-muted: #a3a3a3;
  --text-subtle: #8a8a8a;
  --accent: #ffffff;
  --tag-use: #166534;
  --tag-use-text: #bbf7d0;
  --tag-avoid: #7f1d1d;
  --tag-avoid-text: #fecaca;
  --tag-what: #1e3a5f;
  --tag-what-text: #bfdbfe;
}

:root.blue {
  --bg: #0d1b2a;
  --bg-sidebar: #132337;
  --bg-card: #1b2d42;
  --bg-input: #233a52;
  --bg-hover: #1f3450;
  --border: #3d5a78;
  --text: #ffffff;
  --text-muted: #8fb0cc;
  --text-subtle: #7a9dba;
  --accent: #60a5fa;
  --tag-use: #0d3b2e;
  --tag-use-text: #86efac;
  --tag-avoid: #4c1d1d;
  --tag-avoid-text: #fca5a5;
  --tag-what: #1e3a5f;
  --tag-what-text: #93c5fd;
}

/* :root.beige is intentionally omitted — beige is the default (:root) theme */

/* Button reset — shared base for all icon/ghost buttons */
.settings-btn,
.bookmark-remove,
.bookmark-inline-btn,
.panel-toggle,
.search-clear,
.sidebar-expand-btn,
.aka-toggle,
.acc-trigger,
.compare-expand-link,
.chat-history-date-group,
.rl-trigger,
.prev-ghost-btn {
  background: none;
  border: none;
}

/* Theme toggle */
.settings-wrap {
  position: relative;
  flex-shrink: 0;
}
.settings-btn {
  color: var(--text-muted);
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: var(--transition-color), var(--transition-bg);
}
.settings-btn:hover { color: var(--text); background: var(--bg-hover); }
.settings-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 200;
}
.settings-dropdown.open { display: block; }
.bookmarks-wrap {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}
.bookmarks-dropdown { min-width: 240px; }
.bookmarks-list {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
}
.bookmark-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.bookmark-link {
  flex: 1;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
}
.bookmark-link:hover { background: var(--bg-hover); }
.bookmark-remove {
  color: var(--text-subtle);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.bookmark-remove:hover { color: var(--text); background: var(--bg-hover); }
.bookmarks-empty {
  font-size: 13px;
  color: var(--text-subtle);
  padding: 8px 0;
}
.bookmark-inline-btn {
  color: var(--text-subtle);
  padding: 4px;
  margin-left: 8px;
  vertical-align: middle;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  transition: var(--transition-color);
}
.bookmark-inline-btn:hover { color: var(--accent); }
.bookmark-inline-btn.bookmarked { color: var(--accent); }
.history-wrap {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}
.history-dropdown {
  min-width: 220px;
}
.history-list {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
}
.history-item {
  display: block;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
}
.history-item:hover {
  background: var(--bg-hover);
}
.history-empty {
  font-size: 13px;
  color: var(--text-subtle);
  padding: 8px 0;
}
.settings-section { margin-bottom: 14px; }
.settings-section:last-child { margin-bottom: 0; }
.settings-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  margin-bottom: 8px;
}
.settings-theme-toggle {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.theme-opt, .sv-opt, .hv-opt {
  flex: 1;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid transparent;
  background: transparent;
  /* Animate background, color, border, and a subtle lift when the active
     item changes. The cubic-bezier gives a soft spring-like feel without
     being showy — matches other micro-interactions on the site. */
  transition:
    background 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
    color 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
    border-color 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
    box-shadow 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
    transform 0.22s cubic-bezier(0.34, 1.2, 0.64, 1);
  text-align: center;
  transform: scale(1);
}
.theme-opt { padding: 4px 10px; white-space: nowrap; }
.theme-opt.active,
.sv-opt.active,
.hv-opt.active,
.preview-tab.active {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transform: scale(1.02);
}
.theme-opt:active,
.sv-opt:active,
.hv-opt:active {
  transform: scale(0.97);
  transition-duration: 0.08s;
}
.settings-font-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.font-size-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 32px;
}
.font-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}
.font-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

/* Panel toggle (sidebar open/close) */
.panel-toggle {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  border-radius: 6px;
  transition: var(--transition-bg);
  color: var(--text-muted);
  flex-shrink: 0;
}
.panel-toggle:hover { background: var(--bg-hover); color: var(--text); }
.panel-toggle .icon-panel-close { display: block; }
.panel-toggle .icon-panel-open  { display: none; }
body.nav-collapsed .panel-toggle .icon-panel-close { display: none; }
body.nav-collapsed .panel-toggle .icon-panel-open  { display: block; }

body {
  font-family: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

h1 {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.2;
  color: var(--text);
  margin: 0 0 12px;
}
h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin: 0;
}
h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin: 0;
}
h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}
code {
  font-family: 'SF Mono', 'Fira Code', 'Menlo', monospace;
  font-size: 13px;
}
dt {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
}
dd {
  color: var(--text-muted);
  margin: 0;
}

/* Header */
header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 4px 24px;
  gap: 16px;
  background: var(--bg);
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 100;
}
header > nav {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  height: 100%;
  top: 0; left: 0; right: 0;
  z-index: 101;
}
/* Sidebar view toggle */
.sidebar-view-toggle {
  padding: 12px 16px 10px;
  border-bottom: none;
  margin-bottom: 8px;
}
.sv-toggle-inner {
  display: flex;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}
.sv-opt { padding: 4px 8px; }

.logo {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--accent);
  white-space: nowrap;
}
.logo span { color: var(--text-muted); font-weight: 400; }
.search-wrap {
  flex: 1;
  max-width: 480px;
  margin-left: auto;
  margin-right: 0;
  position: relative;
}
.search-wrap > svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  z-index: 3;
}
#search,
.search-wrap input[type="text"] {
  width: 100%;
  padding: 13px 36px 13px 38px;
  background: var(--bg-input);
  border: none;
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-radius 0.15s;
}
#search::placeholder,
.search-wrap input[type="text"]::placeholder { color: var(--text-muted); }
/* Clear button — shared between landing and header search */
.search-clear {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4px;
  color: var(--text-muted);
  transition: var(--transition-color);
  flex-shrink: 0;
}
.search-clear:hover { color: var(--text); }
.search-clear.visible { display: flex; }
/* Position clear button inside search inputs */
.search-wrap .search-clear,
.landing-search .search-clear {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
}
/* inputs don't need stacking context — let clear button sit above */
.search-wrap.typeahead-open #search,
.search-wrap.typeahead-open input[type="text"] {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.search-wrap .landing-typeahead {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0;
  z-index: 100;
}
.search-wrap .landing-typeahead.open {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: none;
}
.search-wrap .landing-typeahead .ta-item-name { font-size: 15px; }
.search-wrap .landing-typeahead .ta-item-desc { font-size: 13px; }
.search-wrap .landing-typeahead .ta-item { padding: 10px 14px; }

/* Layout */
.layout {
  display: flex;
  margin-top: var(--header-height);
  height: calc(100vh - var(--header-height));
}

/* Sidebar */
aside {
  width: var(--sidebar-width);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg);
  padding: 0;
  transition: width 0.25s ease;
  display: flex;
  flex-direction: column;
}
.sidebar-sections {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-sections::-webkit-scrollbar,
main::-webkit-scrollbar { width: 12px; }
.sidebar-sections::-webkit-scrollbar-track,
main::-webkit-scrollbar-track { background: transparent; }
.sidebar-sections::-webkit-scrollbar-thumb,
main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; border: 3px solid var(--bg); }
body.nav-collapsed aside {
  width: 0;
  padding: 0;
  border-right: none;
}
body.nav-collapsed #toc {
  left: 0;
}

.sidebar-expand-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 16px 8px;
  margin-bottom: 8px;
}
.sidebar-expand-btn {
  font-size: 13px;
  color: var(--text-subtle);
  padding: 0;
  transition: var(--transition-color);
}
.sidebar-expand-btn:hover { color: var(--text-muted); }
.sidebar-expand-sep {
  font-size: 13px;
  color: var(--text-subtle);
}

.sidebar-section { margin-bottom: 4px; }
.sidebar-label {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-subtle);
  padding: 10px 16px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
.sidebar-label:hover { color: var(--text-muted); }
.sidebar-chevron {
  display: flex;
  align-items: center;
  color: var(--text-subtle);
  flex-shrink: 0;
}
.sidebar-chevron .chev-down { display: block; }
.sidebar-chevron .chev-up   { display: none; }
.sidebar-section.collapsed .sidebar-chevron .chev-down { display: none; }
.sidebar-section.collapsed .sidebar-chevron .chev-up   { display: block; }
/* Animated body collapse — see ui.css for the same technique used in the
   Figma plugin. The section's items wrap in a single inner <div> (added
   in components.js and icons.js) so grid-template-rows: 1fr → 0fr
   resolves to one row and animates to natural content height. */
.sidebar-items {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows var(--transition-accordion);
}
.sidebar-items > * {
  overflow: hidden;
  min-height: 0;
}
.sidebar-section.collapsed .sidebar-items { grid-template-rows: 0fr; }
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0;
  transition: all 0.1s;
  border-left: 2px solid transparent;
  text-decoration: none;
}
.sidebar-item:hover {
  color: var(--text);
  background: var(--bg-hover);
}
.sidebar-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--bg-hover);
}
.sidebar-item .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--text-subtle);
  flex-shrink: 0;
  transition: background 0.1s;
}
.sidebar-item.active .dot { background: var(--accent); }
.sidebar-item.hidden { display: none; }

/* TOC bar */
#toc {
  position: fixed;
  top: var(--header-height);
  left: var(--sidebar-width);
  right: 0;
  height: var(--toc-height);
  background: var(--bg);
  display: none;
  align-items: center;
  padding: 0 48px 0 48px;
  z-index: 99;
  overflow-x: auto;
  gap: 0;
  transition: left 0.25s ease;
}
#toc::-webkit-scrollbar { display: none; }
.toc-link {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0 14px;
  height: var(--toc-height);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.1s, border-color 0.1s;
  cursor: pointer;
}
.toc-link:hover { color: var(--text); }
.toc-link.active {
  color: var(--text);
  border-bottom-color: var(--text);
}
.layout.toc-visible main {
  padding-top: var(--toc-height);
}

/* Main content */
main {
  flex: 1;
  overflow-y: auto;
  padding: 40px 48px;
  min-width: 0;
}

/* Home view */
#home-view { max-width: 100%; }
.home-subtitle {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}
.home-prompts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 1040px;
  width: 100%;
  margin-bottom: 40px;
}
.home-prompt-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg-card);
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-bg-color);
}
.home-prompt-chip:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.home-prompt-chip svg {
  flex-shrink: 0;
  color: var(--text-subtle);
}
.home-prompt-chip:hover svg {
  color: var(--text-muted);
}
.home-view-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}
.home-view-toggle-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.home-view-toggle {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.csv-download-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}
.csv-download-link svg { flex-shrink: 0; }
.hv-opt { padding: 5px 14px; }
.atomic-desc {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}
.home-section {
  margin-bottom: 48px;
}
.home-section-title {
  margin-bottom: 4px;
}
.home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.home-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-decoration: none;
  display: block;
}
.home-card:hover {
  border-color: var(--text-subtle);
  background: var(--bg-hover);
}
.home-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.home-card-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Component view */
#component-view { max-width: 100%; display: none; }
.comp-header { margin-bottom: 32px; }
.comp-category-label {
  font-weight: 400;
  color: var(--text-muted);
}
.comp-title-chevron {
  vertical-align: middle;
  margin: 0 4px;
  color: var(--text-muted);
}
.comp-title {
  display: flex;
  align-items: center;
  margin-top: 20px;
}
.comp-desc {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 4px;
}
.overview-section > .section-tag { margin-top: 0; margin-bottom: 20px; }
.overview-section > div + div { margin-top: 12px; }

/* Preview tabs */
.preview-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
  width: fit-content;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.preview-tab {
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition-bg-color);
}
.preview-tab:hover:not(.active) {
  background: var(--bg-hover);
  color: var(--text);
}

/* Preview box */
.preview-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 48px 40px;
  margin: 0 0 28px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 140px;
  font-size: 14px;
  color: #1a1a1a;
  --text: #1a1a1a;
  --text-muted: #555555;
  --text-subtle: #888888;
  --border: #d1d5db;
  --bg-card: #f5f5f5;
  --bg-input: #ffffff;
  --bg-hover: #eeeeee;
  --bg: #ffffff;
  --accent: #2563eb;
}
.preview-box * {
  font-size: inherit;
}
.preview-box .prev-section-label {
  font-size: 11px;
}
.preview-box .prev-btn-sm {
  font-size: 12px;
}
.preview-box .prev-btn-lg {
  font-size: 16px;
}
.preview-box .badge {
  font-size: 12px;
}
.preview-box h1, .preview-box h2, .preview-box h3 {
  font-size: 16px;
}
/* AUDIT FIX: removed .toast-title and .popover-title from this selector list —
   no element in any HTML/JS file uses those classes. */
.preview-box .card-title,
.preview-box .dialog-title {
  font-size: 15px;
}
.preview-box .prev-subtle {
  font-size: 12px;
}

/* Section blocks */
.section {
  margin-bottom: 28px;
}
.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 28px !important;
  font-weight: 600;
  padding: 0;
  background: none !important;
  color: var(--text) !important;
  margin-top: 8px;
  margin-bottom: 14px;
  line-height: 1.2;
}
.sub-section-tag { font-size: 20px !important; color: #666666 !important; }
:root.dark .sub-section-tag,
:root.blue .sub-section-tag { color: #ffffff !important; }
.section-tag::before {
  display: none;
}

/* Also known as */
.aka-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.aka-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.aka-card-body {
  flex: 1;
  min-width: 0;
}
.aka-term {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.aka-systems {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.aka-system-link,
.aka-system-tag {
  font-size: 14px;
  color: var(--text-subtle);
  text-decoration: none;
  transition: var(--transition-color);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
}
.aka-lib-name {
  min-width: 0;
}
.aka-lib-icon {
  flex-shrink: 0;
  border-radius: 1px;
}
:root.dark .aka-lib-icon,
:root.blue .aka-lib-icon,
:root.dark .is-detail-icon,
:root.blue .is-detail-icon {
  filter: invert(0.85);
}
.aka-system-link:hover {
  color: var(--text);
}
.states-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.states-tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 13px;
  border-radius: 6px;
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: default;
}
.compare-wrap:has(.states-table) {
  margin-left: -48px;
  margin-right: -48px;
  padding-left: 48px;
  padding-right: 48px;
  width: calc(100% + 96px);
}
.states-table {
  width: 100%;
}
.states-table td:last-child {
  width: 100%;
}
@media (max-width: 900px) {
  .compare-wrap:has(.states-table) {
    margin-left: -24px;
    margin-right: -24px;
    padding-left: 24px;
    padding-right: 24px;
    width: calc(100% + 48px);
  }
}
@media (max-width: 600px) {
  .compare-wrap:has(.states-table) {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
    width: calc(100% + 32px);
  }
}
.aka-toggle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-subtle);
  padding: 0;
  margin-top: 8px;
  margin-bottom: 4px;
  font-family: inherit;
  transition: var(--transition-color);
  text-align: left;
  align-self: flex-start;
}
.aka-toggle:hover {
  color: var(--text);
}
.tag-what  { background: var(--tag-what);  color: var(--tag-what-text); }
.tag-use   { background: var(--tag-use);   color: var(--tag-use-text); }
/* AI Prompt section */
.tag-prompt::before { background: #22d3ee; }
.prompt-block {
  background: #0d0d0d;
  border: 1px solid #262626;
  border-radius: 10px;
  padding: 20px 52px 20px 22px;
  font-family: 'SF Mono', 'Fira Code', 'Menlo', monospace;
  font-size: 13px;
  line-height: 1.75;
  color: #d4d4d4;
  white-space: pre-wrap;
  margin-top: 4px;
}
.prompt-copy {
  position: absolute;
  bottom: 10px;
  left: 10px;
  padding: 4px 10px;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  color: #888;
  cursor: pointer;
  font-family: 'Archivo', -apple-system, BlinkMacSystemFont, sans-serif;
  transition: var(--transition-color), var(--transition-bg);
}
.prompt-copy:hover { color: #d4d4d4; background: #2a2a2a; }

/* Icons section */
.icons-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.icon-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 14px 12px;
  background: var(--bg-card);
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition-bg);
  width: 100px;
}
.icon-chip:hover {
  background: var(--bg-hover);
}
.icon-chip svg { stroke-width: 1; }
.icon-chip-name {
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', 'Menlo', monospace;
  color: var(--text-subtle);
  width: 100%;
  text-align: center;
}

/* States section */
.states-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 4px;
}
.state-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 12px 14px;
}
.state-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.state-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.section-content {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-muted);
}
.section-content p { margin-bottom: 14px; }
.section-content p:last-child { margin-bottom: 0; }
.section-content ul {
  list-style: none;
  margin-top: 10px;
}
.section-content li {
  padding: 5px 0 5px 18px;
  position: relative;
  color: var(--text-muted);
}
.section-content li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 13px;
  width: 5px; height: 5px;
  border-radius: 50%;
}
.tag-use ~ .section-content li::before         { background: #4ade80; }
.tag-avoid ~ .section-content li::before       { background: #f87171; }
.tag-what ~ .section-content li::before        { background: #60a5fa; }
.usage-subhead-use ~ .section-content li::before   { background: #4ade80; }
.usage-subhead-avoid ~ .section-content li::before { background: #f87171; }

.usage-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.usage-subhead {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-top: 4px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.usage-subhead::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.usage-subhead-use::before   { background: #4ade80; }
.usage-subhead-avoid::before { background: #f87171; }

/* Related components */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.related-card {
  display: block;
  background: var(--bg-card);
  border-radius: 10px;
  padding: 14px 16px;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition-bg);
}
.related-card:hover {
  border-color: var(--text-subtle);
  background: var(--bg-hover);
}
.related-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.related-card-desc {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Anatomy section */
.anatomy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.anatomy-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 14px 16px;
}
.anatomy-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.anatomy-card-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* No results */
#no-results {
  display: none;
  padding: 60px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---- Component Previews ---- */
/* Button */
.prev-btn,
.prev-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  line-height: 1;
}
.prev-btn {
  background: #2563eb;
  color: #ffffff;
}
.prev-btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  margin-left: 10px;
}
/* Badge */
.badge {
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge-default { background: #f3f4f6; color: #1f2937; border: 1px solid #d1d5db; }
.badge-outline, .badge-outline-success, .badge-outline-warn, .badge-outline-danger, .badge-outline-info { background: transparent; border: 1px solid var(--border); }
.badge-outline { color: var(--text-muted); }
.badge-success { background: var(--badge-success-bg); color: var(--badge-success-text); }
.badge-warn    { background: var(--badge-warn-bg); color: var(--badge-warn-text); }
.badge-danger  { background: var(--badge-danger-bg); color: var(--badge-danger-text); }
.badge-info    { background: var(--badge-info-bg); color: var(--badge-info-text); }
.badge-sm { padding: 2px 8px; font-size: 11px; }
.badge-lg { padding: 6px 16px; font-size: 14px; }
.badge-dot { display: inline-flex; align-items: center; gap: 6px; }
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-dot.badge-success::before { background: #22c55e; }
.badge-dot.badge-warn::before { background: #f59e0b; }
.badge-dot.badge-danger::before { background: #ef4444; }
.badge-dot.badge-info::before { background: #3b82f6; }
.badge-dot.badge-default::before { background: #9ca3af; }
.badge-dot.badge-outline::before { background: var(--text-muted); }
.badge-outline-success { border-color: #bbf7d0; color: var(--badge-success-text); }
.badge-outline-warn    { border-color: #fde68a; color: var(--badge-warn-text); }
.badge-outline-danger  { border-color: #fecaca; color: var(--badge-danger-text); }
.badge-outline-info    { border-color: #93c5fd; color: var(--badge-info-text); }
.badge-notif { position: relative; display: inline-flex; }
.badge-notif-count { position: absolute; top: -6px; right: -8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 10px; font-weight: 700; line-height: 18px; text-align: center; background: #dc2626; color: #fff; }
/* Avatar */
.prev-avatar { display: flex; gap: 10px; align-items: center; }
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
/* Card */
.prev-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 260px;
}
.card-header { padding: 16px 18px 0; }
.card-title { font-size: 16px; font-weight: 600; }
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 12px 18px; font-size: 13px; color: var(--text-muted); line-height: 1.55; }
.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}
/* Input */
.prev-input { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 320px; }
.input-label { font-size: 13px; font-weight: 500; }
.input-field {
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  width: 100%;
}
.input-hint { font-size: 12px; color: var(--text-muted); }
/* Checkbox */
.prev-checks { display: flex; flex-direction: column; gap: 10px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check-box {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.check-box.checked {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  font-size: 10px;
}
/* Toggle / Switch */
.switch {
  width: 40px; height: 22px;
  background: #d1d5db;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
}
.switch.on { background: #2563eb; }
.switch::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: #ffffff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: var(--transition-transform);
}
.switch.on::after { background: #ffffff; transform: translateX(18px); }
/* Select */
.prev-select select {
  padding: 8px 32px 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  appearance: none;
  cursor: pointer;
  outline: none;
}
/* Tabs */
.prev-tabs { width: 100%; max-width: 420px; }
.tabs-list {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}
.tab-content { font-size: 13px; color: var(--text-muted); line-height: 1.6; padding: 0 4px; }
/* Tooltip */
.prev-tooltip { position: relative; display: inline-block; }
/* AUDIT FIX 3: removed .tooltip-box::after — dead rule, no element uses .tooltip-box anywhere in the codebase */
/* Progress */
.prev-progress { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 16px; }
.progress-bar { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
/* Skeleton */
.skel {
  background: var(--border);
  border-radius: 6px;
}
.skel-circle { width: 40px; height: 40px; border-radius: 50%; }
.skel-line { height: 12px; }
.skel-row { display: flex; gap: 10px; align-items: center; }
/* Accordion */
.prev-accordion { width: 100%; max-width: 420px; }
.acc-item { border-bottom: 1px solid var(--border); }
.acc-trigger {
  width: 100%;
  padding: 14px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
}
.acc-trigger span { font-size: 16px; color: var(--text-muted); transition: var(--transition-transform); }
.acc-content { font-size: 13px; color: var(--text-muted); padding-bottom: 0; line-height: 1.6; max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding-bottom 0.3s ease; }
.acc-item.open .acc-content { max-height: 200px; padding-bottom: 14px; }
.acc-item.open .acc-trigger span { transform: rotate(45deg); }
/* Dialog */
.prev-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  max-width: 380px;
  width: 100%;
}
.dialog-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.dialog-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
/* Breadcrumb */
.prev-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.bc-item { color: var(--text-muted); cursor: pointer; }
.bc-item:hover { color: var(--text); }
.bc-item.current { color: var(--text); }
.bc-sep { color: var(--text-subtle); font-size: 11px; }
/* Pagination */
.prev-pagination { display: flex; align-items: center; gap: 6px; }
.page-btn {
  min-width: 38px; height: 38px;
  padding: 0 10px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  color: #525252;
  background: #fff;
  transition: all 0.12s;
}
.page-btn.active { background: #0a0a0a; color: #fff; border-color: #0a0a0a; font-weight: 600; }
.page-btn:hover:not(.active):not(:disabled) { border-color: #a3a3a3; color: #0a0a0a; }
.page-btn:disabled { opacity: 0.35; cursor: default; }
.page-btn.ellipsis { border-color: transparent; background: none; cursor: default; color: #a3a3a3; }

/* Compare table */
.compare-wrap {
  overflow-x: auto;
  margin-top: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) transparent;
}
.compare-wrap::-webkit-scrollbar {
  height: 8px;
}
.compare-wrap::-webkit-scrollbar-track {
  background: var(--bg-card);
  border-radius: 4px;
}
.compare-wrap::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}
.compare-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--text-subtle);
}
.compare-table {
  width: max-content;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.compare-table th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  line-height: 1.6;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-subtle);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
  min-width: 120px;
}
.compare-table th:first-child,
.compare-table td:first-child {
  position: sticky;
  left: 0;
  background: var(--bg);
  z-index: 2;
  border-right: 1px solid var(--border);
}
.compare-table th:first-child {
  z-index: 3;
}
.compare-company {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--text-subtle);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 2px;
}
.compare-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--bg-hover);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  margin-left: 4px;
  letter-spacing: 0;
  text-transform: none;
  vertical-align: middle;
}
.compare-table td {
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

/* ── Compare table row accordion ──
   Each component row (.compare-comp-row) collapses smoothly into its
   category header using the grid-template-rows technique. <tr> can't be
   a grid container, so we wrap each <td>'s content in a .compare-cell
   div and animate THAT — all cells collapsing together gives the row
   zero height. The td's vertical padding and border also transition to
   0 so the row leaves no residual space. */
.compare-comp-row td {
  transition:
    padding-top    var(--transition-accordion),
    padding-bottom var(--transition-accordion),
    border-bottom-width var(--transition-accordion),
    border-bottom-color var(--transition-accordion);
}
.compare-comp-row td > .compare-cell {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows var(--transition-accordion);
}
.compare-comp-row td > .compare-cell > * {
  overflow: hidden;
  min-height: 0;
}
/* Collapse border-width to 0 too — color-only transition left a 1px residue
   per row, so categories with more components got taller collapsed gaps. */
.compare-comp-row.collapsed td {
  padding-top: 0;
  padding-bottom: 0;
  border-bottom-width: 0;
  border-bottom-color: transparent;
}
.compare-comp-row.collapsed td > .compare-cell {
  grid-template-rows: 0fr;
}

.compare-comp-row:hover td { background: var(--bg-hover); }
.compare-cat-row td:first-child {
  background: var(--bg-card);
}
.compare-comp-row:hover td:first-child { background: var(--bg-hover); }
.compare-cat-row {
  cursor: pointer;
  user-select: none;
}
.compare-cat-row:hover td { background: var(--bg-hover); }
.compare-cat-row td {
  background: var(--bg-card);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 0;
  position: sticky;
  left: 0;
  z-index: 2;
  border-bottom: 1px solid var(--border);
}
.compare-cat-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  position: sticky;
  left: 0;
  width: fit-content;
}
.compare-cat-chevron {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--text-subtle);
}
.compare-cat-chevron svg {
  transition: transform 0.2s ease;
}
.compare-cat-row.collapsed .compare-cat-chevron svg {
  transform: rotate(-90deg);
}
.compare-comp-link {
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.compare-comp-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.compare-ext-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
}
.compare-ext-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.compare-none { color: var(--text-subtle); font-size: 13px; }
.compare-controls { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.compare-sort-select {
  display: none;
  font-size: 13px;
  font-family: inherit;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}
@media (max-width: 640px) {
  .compare-sort-wrap .compare-sort-btn,
  .compare-sort-wrap .compare-sort-label,
  .csv-download-link {
    display: none;
  }
  .compare-sort-select {
    display: inline-block;
  }
}
.compare-expand-link {
  font-size: 13px;
  font-family: inherit;
  padding: 0;
  color: var(--text-subtle);
  transition: var(--transition-color);
}
.compare-expand-link:hover { color: var(--text-muted); }
.compare-expand-sep { font-size: 13px; color: var(--text-subtle); }
.compare-sort-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.compare-sort-label {
  font-size: 13px;
  color: var(--text-subtle);
}
.compare-sort-btn {
  font-size: 13px;
  font-family: inherit;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  transform: scale(1);
  transition:
    background 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
    color 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
    border-color 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
    transform 0.22s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.compare-sort-btn.active {
  background: var(--bg-card);
  color: var(--text);
  transform: scale(1.03);
}
.compare-sort-btn:active { transform: scale(0.97); transition-duration: 0.08s; }
/* Utility classes */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Preview layout utilities */
.prev-flex { display: flex; }
.prev-items-center { align-items: center; }
.prev-wrap { flex-wrap: wrap; }
.prev-gap-sm { gap: 6px; }
.prev-gap-md { gap: 8px; }
.prev-gap-lg { gap: 10px; }
.prev-inline-flex { display: inline-flex; align-items: center; }

/* Preview typography */
.prev-bold { font-weight: 600; }
/* Preview colors */
/* Preview backgrounds */
/* Preview borders */
/* Preview interactive */
.prev-not-allowed { opacity: 0.5; cursor: not-allowed; }
.prev-btn-destructive { padding: 8px 16px; font-size: 14px; border-radius: 8px; border: none; background: #ef4444; color: #fff; cursor: pointer; font-family: inherit; font-weight: 500; }
.prev-btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.prev-btn-lg { padding: 12px 24px; font-size: 15px; font-weight: 600; }
.prev-btn-icon { padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }

/* Preview utility classes (extracted from inline styles) */
.prev-tab, .prev-tab-muted, .prev-tab-active { font-size: 12px; padding: 5px 2px; border-radius: 5px; cursor: pointer; }
.prev-tab { color: #555; }
.prev-tab-muted { color: #aaa; }
.prev-tab-active { background: #e5e7eb; color: #0a0a0a; }
.prev-star { color: #f59e0b; }
.prev-hint { font-size: 10px; color: #888; padding: 4px 0; }
.prev-muted-sm { color: #999; font-size: 12px; }
.prev-section-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #888; margin-bottom: 10px; }
.prev-btn-md { font-size: 13px; padding: 7px 14px; }
.prev-check-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #333; cursor: pointer; }
.prev-subtle { font-size: 11px; color: #999; }
.prev-label, .prev-label-dark, .prev-label-muted { font-size: 12px; font-weight: 500; display: block; margin-bottom: 5px; }
.prev-label { color: #555; }
.prev-label-dark { color: #333; }
.prev-label-muted { color: #aaa; }
.prev-muted { font-size: 12px; color: #888; }
.prev-list-item { padding: 8px 12px; font-size: 13px; cursor: pointer; color: #555; }
.prev-menu-row, .prev-action-row, .prev-nav-link, .prev-option { font-size: 13px; cursor: pointer; border-radius: 5px; }
.prev-menu-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; color: #555; }
.prev-item-title { font-size: 13px; font-weight: 600; color: #0a0a0a; margin-bottom: 2px; }
.prev-action-row { padding: 6px 12px; color: #0a0a0a; display: flex; justify-content: space-between; }
.prev-flex-row { display: flex; align-items: center; gap: 8px; }
.prev-overline { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.prev-flex-wrap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.prev-option { padding: 7px 10px; color: #555; }
.prev-desc { font-size: 13px; color: #888; }
.prev-panel { display: flex; flex-direction: column; gap: 20px; align-items: flex-start; background: #ffffff; padding: 20px; }
.prev-btn-light { padding: 7px 14px; border-radius: 7px; border: 1px solid #e2e2e2; background: #ffffff; color: #0a0a0a; font-size: 13px; cursor: pointer; }
.prev-nav-link { padding: 6px 12px; color: #0a0a0a; }
.prev-divider { height: 1px; background: #eee; margin: 4px 0; }
.prev-sub { font-size: 11px; color: #999; margin-top: 2px; }
.prev-tooltip-anchor { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 6px; }
.prev-tooltip-bubble { position: relative; background: #1e293b; color: #ffffff; font-size: 12px; font-weight: 500; padding: 5px 10px; border-radius: 6px; white-space: nowrap; }
.prev-progress-track { position: relative; height: 6px; background: #e5e7eb; border-radius: 3px; }
.prev-progress-bar { height: 8px; background: #e5e7eb; border-radius: 9999px; overflow: hidden; }
.prev-disabled-text { color: #d1d5db; }
.prev-input-sm { font-size: 12px; padding: 6px 12px; }
.prev-center-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.prev-bold-title { font-size: 13px; font-weight: 600; color: #0a0a0a; }
.prev-form-col { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 300px; }
.prev-feed-item { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; display: flex; gap: 10px; align-items: flex-start; }
.prev-text-dim { font-size: 13px; color: #666; }
.prev-text-link { font-size: 13px; color: #555; cursor: pointer; }
.prev-text { font-size: 13px; color: #555; }
.prev-text-sm { font-size: 12px; color: #555; }
.prev-ghost-btn { padding: 6px 12px; font-size: 13px; font-weight: 500; color: #0a0a0a; border-radius: 6px; }
.prev-card-item { padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.prev-close { color: #aaa; cursor: pointer; font-size: 16px; line-height: 1; }
.prev-inline-group { position: relative; display: inline-flex; align-items: center; gap: 6px; }
/* Interactive preview elements */
.select-option:hover { background: #f3f4f6; }
.select-option.active { background: #f3f4f6; font-weight: 500; }
[data-menu-item]:hover { background: #f3f4f6; }
[data-combobox-option]:hover { background: #f3f4f6; }
/* Toast */
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}
/* Table */
.prev-table { width: 100%; max-width: 520px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.data-table tr:last-child td { border-bottom: none; }
/* Separator */
.separator { height: 1px; background: var(--border); margin: 12px 0; }
/* AUDIT FIX 3: removed .sep-text::before/.after — dead rule, no element uses .sep-text in the codebase */
/* Radio */
.radio-circle {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.radio-circle.selected::after {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
/* Popover */
/* Responsive */
@media (max-width: 900px) {
  aside {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    z-index: 100;
    border-right: none;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    display: flex;
  }
  aside.mobile-open {
    transform: translateX(0);
  }
  body.nav-collapsed aside { transform: translateX(-100%); }
  main { padding: 32px 24px; }
  #toc { left: 0 !important; padding: 0 16px; }
  body { height: auto; overflow: auto; }
  .layout { display: block; height: auto; padding-top: var(--header-height); }
  /* Header layout on mobile: logo stretches, search + settings right */
  header { position: fixed; }
  .logo { flex: 1; }
  .search-wrap {
    flex: 0 0 auto;
    max-width: none;
    margin-left: 0;
    order: 3;
  }
  .settings-wrap { order: 4; margin-left: 0; }
  header { gap: 4px; }
  header .chat-fab { width: 40px; height: 40px !important; padding: 0; margin: 0; background: transparent !important; color: var(--text-muted); justify-content: center; border-radius: 8px; }
  header .chat-fab:hover { background: transparent !important; color: var(--text-muted); }
  .search-wrap { flex: 0 0 40px; width: 40px; display: none; }
  .search-wrap #search { width: 40px; height: 40px; }
  .settings-btn { width: 40px; height: 40px; justify-content: center; }
  .settings-btn:hover { background: transparent; color: var(--text-muted); }
  .logo { margin-right: auto; }
  .search-wrap #search {
    width: 40px;
    padding: 11px 12px 11px 34px;
    cursor: pointer;
    background: transparent;
    border-color: transparent;
  }
  .search-wrap #search::placeholder { color: transparent; }
  .search-wrap.search-open {
    position: absolute;
    left: 60px;
    right: 16px;
    flex: 1;
    z-index: 5;
  }
  .search-wrap.search-open #search {
    width: 100%;
    cursor: text;
    background: var(--bg);
    border-color: var(--border);
  }
  .search-wrap.search-open #search::placeholder { color: var(--text-muted); }
  .search-wrap.search-open ~ .logo { visibility: hidden; }
  .search-wrap.search-open ~ .chat-fab,
  .search-wrap.search-open ~ .settings-wrap { display: none; }
}
@media (max-width: 600px) {
  main { padding: 20px 16px; }
  .home-grid { grid-template-columns: 1fr; }
  .anatomy-grid { grid-template-columns: 1fr; }
  h1 { font-size: 28px; }
  .usage-columns { grid-template-columns: 1fr; }
  .csv-download-link { display: none !important; }
  .home-view-toggle-wrap {
    align-items: stretch;
    width: 100%;
  }
  .home-view-toggle {
    display: flex;
    width: 100%;
  }
  .hv-opt { flex: 1; text-align: center; }
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 40px 16px 24px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-muted);
}
/* Utility classes */
.accent-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.accent-link:hover { opacity: 0.75; }
.code-inline { background: var(--bg-hover); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.gl-wrap { font-size: 15px; line-height: 1.8; color: var(--text); max-width: 1400px; }
.gl-list { display: grid; gap: 0; }
.gl-term { padding: 16px 0; }

.site-footer a {
  color: var(--text);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--text);
  text-decoration: underline;
}
.footer-social {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}
.footer-social a {
  color: var(--text-subtle);
  text-decoration: none;
  transition: var(--transition-color);
}
.footer-social a:hover {
  color: var(--text);
  text-decoration: none;
}

/* Tree View preview */
.p-tree-node .p-tree-chevron { transform: rotate(90deg); }
.p-tree-node.collapsed .p-tree-chevron { transform: rotate(0deg); }
.p-tree-node.collapsed > .p-tree-children { display: none; }

/* Landing Page — override body scroll lock */
body:has(.landing) {
  height: auto;
  overflow: auto;
}
.landing-banner {
  background: var(--text-muted);
  color: var(--bg);
  text-align: center;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.5;
}
.landing-banner a {
  color: var(--bg);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.landing-banner a:hover {
  opacity: 0.85;
}
.landing-banner-sep {
  margin: 0 6px;
  opacity: 0.6;
}
@media (max-width: 640px) {
  .landing-banner {
    font-size: 13px;
    padding: 10px 16px;
    line-height: 1.8;
  }
  .landing-banner-title,
  .landing-banner-links {
    display: block;
  }
}
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--bg);
}
.landing-hero {
  text-align: center;
  margin-bottom: 12px;
  max-width: 560px;
}
.landing-logo {
  color: var(--text-subtle);
  margin-bottom: 16px;
}
.landing-title span {
  font-weight: 400;
  color: var(--text-muted);
}
.landing-tagline {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 8px;
  text-align: center;
}
/* Landing search + Ask AI row */
.landing-search-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 1040px;
  width: 100%;
  margin-bottom: 24px;
}
.landing-search-row .landing-search {
  margin-bottom: 0;
  flex: 1 1 0;
  min-width: 0;
}
.landing-search {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 780px;
  width: 100%;
  flex: 0 0 auto;
  background: var(--bg-input);
  border: none;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
  color: var(--text-muted);
  transition: border-radius 0.2s;
  position: relative;
}
.landing-search > svg {
  flex-shrink: 0;
}
.landing-search.typeahead-open {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.landing-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: 'Archivo', sans-serif;
  font-size: 17px;
  color: var(--text);
  padding-right: 28px;
}
.landing-search input::placeholder {
  color: var(--text-subtle);
}
.landing-typeahead {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0;
  padding: 4px 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  max-height: 360px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  /* Animate down on open, up on close. Using visibility + opacity + transform
     instead of `display: none` so the change is transitionable. The element
     is position:absolute so it never takes layout space when hidden. */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition:
    opacity 0.18s cubic-bezier(0.34, 1.2, 0.64, 1),
    transform 0.18s cubic-bezier(0.34, 1.2, 0.64, 1),
    visibility 0s linear 0.18s;
}
.landing-typeahead.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition:
    opacity 0.18s cubic-bezier(0.34, 1.2, 0.64, 1),
    transform 0.18s cubic-bezier(0.34, 1.2, 0.64, 1),
    visibility 0s;
}
.ta-section-label {
  padding: 12px 20px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.ta-item-type-icon {
  flex-shrink: 0;
  color: var(--text-subtle);
  position: relative;
  top: 1px;
}
.ta-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 16px 20px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.1s;
  cursor: pointer;
}
.ta-item:first-child {
  border-radius: 0;
}
.ta-item:last-child {
  border-radius: 0 0 12px 12px;
}
.ta-no-results {
  padding: 14px 20px;
  color: var(--text-muted);
  font-size: 16px;
}
.ta-item:hover, .ta-item.active {
  background: var(--bg-hover);
}
.ta-item-name {
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
}
.ta-item-desc {
  font-size: 14px;
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
}
.landing-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 1040px;
  width: 100%;
}
.landing-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--bg-card);
  border: none;
  border-radius: 12px;
  padding: 28px 24px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.2s;
}
.landing-card:hover {
  background: var(--border);
}
.landing-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: #666666;
}
.landing-card:hover .landing-card-icon {
  color: var(--text);
}
.landing-card-title {
  font-size: 16px;
  margin-bottom: 8px;
}
.landing-card-desc {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}
/* Split card — no whole-card hover, has internal links instead */
.landing-card-split {
  cursor: default;
}
.landing-card-split:hover {
  background: var(--bg-card); /* suppress whole-card hover */
  border-color: transparent;
  transform: none;
  box-shadow: none;
}
.landing-card-links {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: 12px;
}
.landing-card-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.landing-card-link:hover {
  opacity: 0.75;
}
.landing-card-sep {
  color: var(--text-subtle);
  font-size: 14px;
}
@media (max-width: 640px) {
  .landing-cards {
    grid-template-columns: 1fr;
  }
  .landing-search {
    min-width: 0;
    max-width: none;
  }
  .landing-search-row {
    gap: 8px;
  }
  .home-prompts {
    flex-direction: column;
  }
  .home-prompt-chip {
    width: 100%;
    justify-content: center;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: block;
    text-align: center;
  }
  .home-prompt-chip svg {
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
    flex-shrink: 0;
  }
  .landing-bottom-row {
    flex-direction: column;
  }
}

/* ── Landing: Design Systems Banner ─────────────── */
.landing-theme-chooser {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 0;
  margin-bottom: 40px;
}
.landing-theme-options {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.landing-theme-btn {
  padding: 5px 14px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  transform: scale(1);
  transition:
    background 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
    color 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
    border-color 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
    box-shadow 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
    transform 0.22s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.landing-theme-btn.active {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transform: scale(1.02);
}
.landing-theme-btn:active { transform: scale(0.97); transition-duration: 0.08s; }
.landing-bottom-row {
  display: flex;
  gap: 24px;
  max-width: 1040px;
  width: 100%;
  margin-top: 24px;
}
.landing-ds-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  flex: 1;
  padding: 28px 32px 24px;
  border: none;
  border-radius: 12px;
  background: var(--bg-card);
  text-decoration: none;
  transition: background 0.2s;
}
.landing-ds-banner:hover {
  background: var(--border);
}
.landing-ds-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.landing-ds-desc {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.5;
}
.landing-ds-arrow {
  display: inline-flex;
  color: var(--text-subtle);
  margin-top: 8px;
}
.landing-ds-arrow svg {
  width: 24px;
  height: 24px;
  transition: color 0.2s, transform 0.2s;
}
.landing-ds-banner:hover .landing-ds-arrow {
  color: var(--text);
  transform: translateX(4px);
}
.landing-ds-banner-split {
  cursor: default;
}
.landing-ds-banner-split:hover {
  background: var(--bg-card);
}

/* ── Scrollable page body (non-app pages) ───────── */
body.page-scroll {
  height: auto;
  overflow: auto;
}

/* ── Design Systems Page ────────────────────────── */
.ds-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 80px 24px 48px;
}
.ds-header {
  margin-bottom: 40px;
}
.ds-subtitle {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 640px;
}
.ds-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.ds-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: none;
  border-radius: 12px;
  background: var(--bg-card);
  text-decoration: none;
  transition: background 0.2s;
}
.ds-card:hover {
  background: var(--border);
}
.ds-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.ds-card-name {
  font-size: 18px;
}
.ds-card-by {
  font-size: 13px;
  color: var(--text-muted);
}
.ds-card-count {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 3px 8px;
  border-radius: 10px;
}
.ds-card-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 14px;
}
.ds-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.ds-tag {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-hover);
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-decoration: none;
}
.ds-tag-storybook {
  background: var(--accent);
  color: var(--bg);
}
.ds-card-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-subtle);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition-color);
}
.ds-card:hover .ds-card-link { color: var(--text); }
.ds-card-meta { display: none; }

/* ── View Toggle ─────────────────────────────── */
.ds-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.ds-view-toggle, .ds-sort-wrap {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.ds-sort-label {
  display: none;
}
.ds-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  transform: scale(1);
  transition:
    background 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
    color 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
    border-color 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
    box-shadow 0.22s cubic-bezier(0.34, 1.2, 0.64, 1),
    transform 0.22s cubic-bezier(0.34, 1.2, 0.64, 1);
  white-space: nowrap;
}
.ds-view-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.ds-view-btn.active {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transform: scale(1.02);
}
.ds-view-btn:active { transform: scale(0.97); transition-duration: 0.08s; }

/* ── List View ───────────────────────────────── */
.ds-grid.ds-list-view {
  grid-template-columns: 1fr;
  gap: 12px;
}
.ds-list-view .ds-card {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  row-gap: 0;
  padding: 16px 24px;
  align-items: start;
  position: relative;
}
.ds-list-view .ds-card-header {
  display: contents;
}
.ds-list-view .ds-card-header > div {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
}
.ds-list-view .ds-card-header .ds-card-by {
  display: block;
}
.ds-list-view .ds-card-count {
  grid-column: 2;
  grid-row: 1;
  position: static;
  align-self: start;
}
.ds-list-view .ds-card-desc {
  grid-column: 1 / -1;
  grid-row: 2;
  margin-bottom: 0;
  margin-top: 4px;
}
.ds-list-view .ds-card-tags {
  grid-column: 1 / -1;
  margin-top: 8px;
}
.ds-list-view .ds-card-link {
  display: none;
}
.ds-list-view .ds-card-meta {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}
.ds-list-view .ds-card-meta .ds-card-by {
  display: none;
}
.ds-list-view .ds-card-meta .ds-card-link {
  display: none;
}

/* ── Table View ──────────────────────────────── */
.ds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-family: inherit;
}
.ds-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
  white-space: nowrap;
}
.ds-table th:hover { color: var(--text); }
.ds-table th.sorted { color: var(--text); }
/* AUDIT FIX: removed .ds-table th .sort-arrow — no element uses .sort-arrow. */
.ds-table th:last-child { cursor: default; }
.ds-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.ds-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}
.ds-table tbody tr:hover {
  background: var(--bg-hover);
}
.ds-table-name {
  font-weight: 600;
  color: var(--text);
}
.ds-table-company {
  color: var(--text-muted);
}
.ds-table-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}
.ds-table-links {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.ds-table th:nth-child(3),
.ds-table td:nth-child(3) {
  text-align: center;
  width: 120px;
}
.ds-table th:nth-child(4),
.ds-table td:nth-child(4) {
  text-align: right;
  width: 180px;
}

@media (max-width: 900px) {
  .ds-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .ds-grid {
    grid-template-columns: 1fr;
  }
  .ds-view-toggle {
    display: none;
  }
  .ds-toolbar {
    justify-content: flex-end;
  }
  .ds-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .ds-table th, .ds-table td { white-space: nowrap; }
}

/* ── Design System Detail Page ──────────────────── */

.ds-detail-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 56px 24px 64px;
}
.ds-detail-header { margin-bottom: 32px; }
.ds-detail-title {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  margin-top: 24px;
  margin-bottom: 8px;
}
.ds-detail-back {
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 36px;
  letter-spacing: -1px;
  padding: 0;
  transition: color var(--transition-color);
}
.ds-detail-back:hover { color: var(--text); }
.ds-detail-chevron {
  vertical-align: middle;
  margin: 0 4px;
  color: var(--text-muted);
}
.ds-detail-name {
  font-weight: 700;
  color: var(--text);
}
.ds-detail-site-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  text-decoration: none;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  white-space: nowrap;
  margin: 8px 0 20px;
  transition: background var(--transition-bg), color var(--transition-color);
}
.ds-detail-site-link:hover {
  background: var(--accent);
  color: var(--bg);
}
.ds-detail-desc {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 4px 0 0;
}
.is-detail-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
}
/* Installation code snippets on icon library detail pages */
.is-install-section { margin-bottom: 32px; }
.is-install-title { font-size: 18px; font-weight: 600; margin: 0 0 12px; }
.is-install-block { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.is-install-label {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  min-width: 48px; text-align: right; flex-shrink: 0;
}
.is-install-pre {
  margin: 0; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px; overflow-x: auto; flex: 1;
}
.is-install-pre code {
  color: var(--text); white-space: pre;
}
.ds-detail-grid.is-detail-grid {
  grid-template-columns: repeat(4, 1fr);
}
.is-detail-card {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.is-detail-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  opacity: 0.75;
  margin-bottom: 6px;
  filter: var(--icon-filter, none);
}
.is-detail-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 2px;
}
.ds-detail-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.ds-detail-count {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}
.ds-acc-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ds-acc-sep {
  color: var(--text-muted);
  font-size: 13px;
}
.ds-acc-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  padding: 0;
  transition: color var(--transition-color);
}
.ds-acc-btn:hover { color: var(--text); }
.ds-detail-section {
  margin-bottom: 8px;
}
.ds-acc-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 0;
  text-align: left;
}
.ds-acc-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--transition-transform);
}
.ds-acc-toggle[aria-expanded="true"] .ds-acc-chevron {
  transform: rotate(90deg);
}
.ds-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin-bottom: 24px;
}
.ds-detail-section h2 {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}
.ds-detail-cat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px;
  padding-bottom: 8px;
}
.ds-detail-cat-count {
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 8px;
  vertical-align: middle;
}
.ds-detail-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-card);
  text-decoration: none;
  transition: background var(--transition-bg);
}
a.ds-detail-card:hover {
  background: var(--bg-hover);
}
.ds-detail-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}
.ds-detail-card-sub {
  font-size: 11px;
  color: var(--text-muted);
}
.ds-detail-empty {
  color: var(--text-muted);
  font-size: 14px;
  padding: 24px 0;
}
@media (max-width: 640px) {
  .ds-detail-page { padding: 20px 16px 48px; }
  .ds-detail-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ── Chat Widget ────────────────────────────────── */

.chat-fab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Archivo', sans-serif;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.chat-fab:hover {
  opacity: 0.85;
}
/* Landing page: place next to search */
.landing-search-row .chat-fab {
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 15px;
}
/* Components page: place after search-wrap in header */
header .chat-fab {
  margin-left: -8px;
  margin-right: 0;
  height: 45px;
}

/* Chat panel */
.chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 33vw;
  min-width: 360px;
  display: flex;
  flex-direction: row;
  background: var(--bg);
  border-left: 1px solid var(--border);
  border-radius: 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 1001;
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 8px));
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  color: var(--text);
}
/* Home page: add margins back */
body:has(.landing-search-row) .chat-panel {
  top: 0;
  right: 0;
  bottom: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
}
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chat-panel.chat-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}
.chat-panel.chat-expanded {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  min-width: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
}
body:has(.landing-search-row) .chat-panel.chat-expanded {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  border: none;
  border-radius: 0;
}
.chat-panel.chat-landing-expanded {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

/* History sidebar */
.chat-history-sidebar {
  width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--border);
  transition: width 0.25s ease;
  flex-shrink: 0;
}
.chat-history-sidebar.open {
  width: 100%;
}
/* In collapsed mode, history takes over the full panel */
.chat-panel:not(.chat-expanded) .chat-history-sidebar.open ~ .chat-main {
  display: none;
}
.chat-expanded .chat-history-sidebar.open {
  width: 33.333%;
  max-width: 360px;
  min-width: 240px;
}
.chat-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-history-title {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  white-space: nowrap;
}
.chat-history-close[data-tooltip]::after {
  top: calc(100% + 6px);
}
.chat-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.chat-history-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.1s;
  gap: 8px;
}
.chat-history-item:hover {
  background: var(--bg-hover);
}
.chat-history-item.active {
  background: var(--bg-card);
}
.chat-history-item-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.chat-history-item-title {
  font-size: 16px;
  color: var(--text);
  line-height: 1.4;
}
.chat-history-delete {
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-subtle);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.chat-history-item:hover .chat-history-delete {
  display: flex;
}
.chat-history-delete:hover {
  color: var(--text-muted);
  background: var(--bg-hover);
}
.chat-history-date-group {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: var(--transition-color);
}
.chat-history-date-group:hover { color: var(--text-muted); }
.chat-history-chevron {
  flex-shrink: 0;
  transition: var(--transition-transform);
  transform: rotate(-90deg);
  order: 2;
}
.chat-history-date-group.open .chat-history-chevron {
  transform: rotate(0deg);
}
.chat-history-count {
  order: 1;
  margin-left: auto;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 10px;
  line-height: 1.4;
}
.chat-history-group-items {
  display: none;
}
.chat-history-date-group.open + .chat-history-group-items {
  display: block;
}
.chat-history-empty {
  padding: 20px 16px;
  font-size: 13px;
  color: var(--text-subtle);
  text-align: center;
}

/* Hide history toggle in expanded mode (sidebar always visible) */
.chat-expanded .chat-header > .chat-history-toggle {
  display: none;
}

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}
.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.chat-header-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--text-subtle);
  cursor: pointer;
  transition: all 0.15s;
}
.chat-header-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}
/* Custom tooltips */
.chat-header-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--bg);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 10;
}
.chat-header-btn[data-tooltip]:hover::after {
  opacity: 1;
}
/* Show/hide expand vs collapse icons */
.chat-expand .icon-collapse { display: none; }
.chat-expand .icon-expand { display: block; }
.chat-expanded .chat-expand .icon-collapse { display: block; }
.chat-expanded .chat-expand .icon-expand { display: none; }

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.chat-msg {
  display: flex;
  max-width: 100%;
  padding: 12px 20px;
}
.chat-msg-user {
  align-self: stretch;
}
.chat-msg-ai {
  align-self: stretch;
}
.chat-msg-content {
  padding: 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  word-break: break-word;
}
.chat-msg-user .chat-msg-content {
  background: var(--bg-card);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 500;
}
.chat-msg-ai .chat-msg-content {
  color: var(--text);
}
.chat-msg-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 0.15s;
}
.chat-msg-content a:hover {
  opacity: 0.7;
}
.chat-msg-content a.chat-component-link {
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
}
.chat-msg-content a.chat-component-link:hover {
  border-bottom-color: var(--accent);
  opacity: 1;
}
.chat-msg-content a.chat-external-link {
  font-size: 13px;
  color: var(--text-muted);
}
.chat-msg-content a.chat-external-link::after {
  content: ' \2197';
  font-size: 11px;
}
.chat-msg-content a.chat-ds-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.chat-msg-content a.chat-ds-link:hover {
  opacity: 0.7;
}
.chat-msg-content code {
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  border: 1px solid var(--border);
}
.chat-msg-content pre {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 8px 0 4px;
  overflow-x: auto;
  font-size: 12px;
}
.chat-msg-content strong {
  font-weight: 600;
}
.chat-msg-content ul,
.chat-msg-content ol {
  margin: 4px 0;
  padding-left: 18px;
}
.chat-msg-content li {
  margin-bottom: 2px;
}
.chat-msg-content h1,
.chat-msg-content h2,
.chat-msg-content h3,
.chat-msg-content h4 {
  margin: 12px 0 4px;
  line-height: 1.3;
  color: var(--text);
}
.chat-msg-content h1 { font-size: 20px; }
.chat-msg-content h2 { font-size: 18px; }
.chat-msg-content h3 { font-size: 16px; }
.chat-msg-content h4 { font-size: 15px; }
.chat-msg-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

/* Suggested follow-up prompts */
.chat-related-components {
  margin-top: 12px;
}
.chat-related-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.chat-related-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chat-related-link,
.chat-msg-content a.chat-related-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: none;
  border-radius: 8px;
  text-decoration: none;
  font-size: 16px;
  color: var(--text-muted);
  transition: var(--transition-bg);
}
.chat-related-link:hover,
.chat-msg-content a.chat-related-link:hover {
  background: var(--bg-hover);
  color: var(--text);
  opacity: 1;
}
.chat-related-name {
  font-weight: 400;
}
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 20px 12px;
}
.chat-suggestion {
  background: var(--bg-card);
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-family: 'Archivo', sans-serif;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  line-height: 1.4;
}
.chat-suggestion:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* Input area */
.chat-input-wrap {
  position: relative;
  padding: 12px 20px 8px;
  flex-shrink: 0;
}
.chat-input {
  width: 100%;
  background: var(--bg-input);
  border: none;
  border-radius: 10px;
  padding: 13px 48px 13px 16px;
  font-family: 'Archivo', sans-serif;
  font-size: 16px;
  color: var(--text);
  resize: none;
  overflow: hidden;
  outline: none;
  transition: border-color 0.15s;
  max-height: 120px;
  line-height: 1.4;
}
.chat-input:focus {
  outline: none;
}
.chat-input::placeholder {
  color: var(--text-subtle);
}
.chat-send {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--bg-card);
  color: var(--text-subtle);
  border: none;
  border-radius: 8px;
  cursor: default;
  transition: background 0.2s, color 0.2s;
}
.chat-send.chat-send-active {
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
}
.chat-send.chat-send-active:hover {
  opacity: 0.85;
}
.chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Streaming cursor */
.chat-streaming::after {
  content: '\25CF';
  display: inline;
  margin-left: 2px;
  color: #999;
  animation: chatCursorBlink 600ms infinite;
}
@keyframes chatCursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Loading thinking animation */
.chat-thinking {
  color: #999;
  font-style: italic;
  animation: chatThinkIn 250ms ease-out;
}
.chat-thinking-in {
  animation: chatThinkIn 250ms ease-out;
}
@keyframes chatThinkIn {
  0% { opacity: 0; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Mobile responsive */
@media (max-width: 480px) {
  .chat-fab span {
    display: none;
  }
  .chat-fab {
    padding: 10px;
  }
  .chat-expand {
    display: none !important;
  }
  .chat-panel {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
    overscroll-behavior: contain;
  }
  .chat-panel.chat-expanded {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: 0;
  }
  .chat-suggestions {
    display: none;
  }
  /* Mobile: center input when focused, hide everything else */
  .chat-panel .chat-header,
  /* AUDIT FIX: removed .chat-disclaimer — class not used anywhere. */
  .chat-panel .chat-messages,
  .chat-panel .chat-suggestions,
  .chat-panel .chat-history-sidebar {
    transition: opacity 0.25s ease;
  }
  .chat-panel .chat-main {
    transition: justify-content 0.25s ease;
  }
  .chat-panel .chat-input-wrap {
    transition: padding 0.25s ease, transform 0.25s ease;
  }
  .chat-panel.chat-input-focused .chat-header,
  .chat-panel.chat-input-focused .chat-messages,
  .chat-panel.chat-input-focused .chat-suggestions,
  .chat-panel.chat-input-focused .chat-history-sidebar {
    opacity: 0;
    pointer-events: none;
    flex: 0;
    min-height: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
    border: none;
    overflow: hidden;
  }
  .chat-panel.chat-input-focused {
    background: transparent;
    box-shadow: none;
  }
  .chat-panel.chat-input-focused::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, var(--bg) 80%, transparent 100%);
    pointer-events: none;
    z-index: 0;
  }
  .chat-panel.chat-input-focused .chat-main {
    justify-content: center;
    overflow: hidden;
    touch-action: none;
    position: relative;
    z-index: 1;
  }
  .chat-panel.chat-input-focused .chat-input-wrap {
    padding: 20px;
  }
  .chat-panel.chat-input-focused .chat-send {
    top: calc(50% - 4px);
  }
}
/* AUDIT FIX 5: .rl-*, .ar-*, and icon-page CSS moved to page-specific <style> blocks.
   Saves ~6.5 KB on every non-release-notes, non-analytics, non-icons page load. */
