/* ============================================
   TOOLBOX DASHBOARD v5.0 — Qalisia Design System
   Light theme, orange gradient, professional B2B
   Inspired by qalisia.com
   ============================================ */

/* ---- CUSTOM PROPERTIES ---- */
:root {
  /* Brand — Orange (Qalisia) */
  --orange: #fc7d0f;
  --orange-light: #ffaa54;
  --orange-gradient: linear-gradient(135deg, #fc7d0f 0%, #ffaa54 100%);
  --orange-bg: rgba(252, 125, 15, 0.08);
  --orange-bg-hover: rgba(252, 125, 15, 0.14);
  --orange-shadow: rgba(252, 125, 15, 0.25);

  /* Navy — text */
  --navy: #22253d;
  --navy-light: #36454f;

  /* Teal accent */
  --teal: #37b594;
  --teal-bg: rgba(55, 181, 148, 0.1);

  /* Neutrals */
  --white: #ffffff;
  --bg-base: #fafbfc;
  --bg-surface: #f5f5f5;
  --border-light: #e0e3e8;
  --border-default: #d0d4db;
  --text-primary: #22253d;
  --text-secondary: #4a5568;
  --text-muted: #8a919c;

  /* Semantic */
  --color-green: #34d399;
  --color-green-bg: rgba(52, 211, 153, 0.1);
  --color-red: #ef4444;
  --color-red-bg: rgba(239, 68, 68, 0.08);
  --color-yellow: #f59e0b;
  --color-yellow-bg: rgba(245, 158, 11, 0.1);
  --color-blue: #3b82f6;
  --color-blue-bg: rgba(59, 130, 246, 0.08);
  --color-purple: #8b5cf6;
  --color-purple-bg: rgba(139, 92, 246, 0.08);
  --color-cyan: #06b6d4;
  --color-cyan-bg: rgba(6, 182, 212, 0.08);

  /* Domain colors */
  --domain-design: #e84393;
  --domain-dev: #3b82f6;
  --domain-archi: #8b5cf6;
  --domain-data-ia: #06b6d4;
  --domain-automation: #f59e0b;
  --domain-docs: #34d399;
  --domain-research: #6366f1;
  --domain-testing: #ef4444;
  --domain-productivity: #a855f7;
  --domain-security: #dc2626;
  --domain-marketing: #fc7d0f;
  --domain-business: #14b8a6;

  /* Spacing — 4pt base */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-24: 96px;

  /* Typography */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.75rem;

  --leading-tight: 1.3;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.04em;

  /* Radius — Qalisia uses pill shapes */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 50px;

  /* Shadows — Qalisia style */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08);
  --shadow-orange: 0 4px 14px rgba(252, 125, 15, 0.3);

  /* Transitions */
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --duration-fast: 100ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
  --duration-entrance: 400ms;
  --stagger-delay: 40ms;
}

/* ---- MOTION DESIGN ---- */
@keyframes card-enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  animation: card-enter var(--duration-entrance) var(--ease) both;
  animation-delay: calc(var(--i, 0) * var(--stagger-delay));
}

.card:nth-child(n+13) {
  animation-delay: calc(12 * var(--stagger-delay));
}

@keyframes chip-enter {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.kit-chip {
  animation: chip-enter var(--duration-slow) var(--ease) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}

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

.stat-value {
  animation: stat-enter var(--duration-slow) var(--ease) both;
  animation-delay: calc(var(--i, 0) * 80ms);
}

@keyframes filters-enter {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.filter-group {
  animation: filters-enter var(--duration-slow) var(--ease) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}

@keyframes modal-backdrop-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-panel-enter {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-overlay.active {
  animation: modal-backdrop-enter var(--duration-slow) var(--ease) both;
}

.modal-overlay.active .modal {
  animation: modal-panel-enter var(--duration-entrance) var(--ease) both;
}

@keyframes modal-backdrop-exit {
  to { opacity: 0; }
}

@keyframes modal-panel-exit {
  to { opacity: 0; transform: scale(0.96) translateY(8px); }
}

.modal-overlay.closing {
  animation: modal-backdrop-exit var(--duration-normal) var(--ease-in) both;
}

.modal-overlay.closing .modal {
  animation: modal-panel-exit calc(var(--duration-normal) * 0.75) var(--ease-in) both;
}

@keyframes filter-activate {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.filter-btn.just-activated {
  animation: filter-activate var(--duration-normal) var(--ease);
}

@keyframes search-focus {
  from { box-shadow: 0 0 0 0px var(--orange-bg-hover); }
  to { box-shadow: 0 0 0 3px var(--orange-bg-hover); }
}

.search-box input:focus-visible {
  animation: search-focus var(--duration-normal) var(--ease) both;
}

.results-count {
  transition: opacity var(--duration-normal) var(--ease);
}

/* ---- REDUCED MOTION ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
  .card, .kit-chip, .stat-value, .filter-group {
    opacity: 1;
    transform: none;
  }
}

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

/* ---- BASE ---- */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

/* ---- HEADER ---- */
.header {
  padding: var(--sp-6) var(--sp-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.header-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: opacity var(--duration-normal) var(--ease);
}

.header-logo:hover {
  opacity: 0.85;
}

.header-logo:active {
  opacity: 0.7;
}

.qalisia-logo {
  height: 44px;
  width: auto;
}

.header-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  background: var(--bg-surface);
  padding: 2px var(--sp-2);
  border-radius: var(--radius-pill);
}

.header-stats {
  display: flex;
  gap: var(--sp-8);
  align-items: center;
}

.stat {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
}

.stat-value {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* ---- CONTROLS BAR ---- */
.controls {
  padding: var(--sp-4) var(--sp-8);
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-light);
  background: var(--white);
}

.search-box {
  flex: 1;
  min-width: 240px;
  max-width: 480px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: var(--sp-3) var(--sp-4) var(--sp-3) var(--sp-12);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  transition: border-color var(--duration-normal) var(--ease), box-shadow var(--duration-normal) var(--ease);
  min-height: 44px;
}

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

.search-box input:hover {
  border-color: var(--border-default);
}

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

.search-icon {
  position: absolute;
  left: var(--sp-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.controls-right {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  margin-left: auto;
}

/* View toggle */
.view-toggle {
  display: flex;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--bg-surface);
}

.view-toggle button {
  padding: var(--sp-2) var(--sp-3);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  min-width: 44px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-normal) var(--ease);
}

.view-toggle button:hover {
  color: var(--text-secondary);
}

.view-toggle button.active {
  background: var(--white);
  color: var(--orange);
  box-shadow: var(--shadow-sm);
}

.view-toggle button + button {
  border-left: 1px solid var(--border-light);
}

/* ---- FILTERS ---- */
.filters-bar {
  padding: var(--sp-3) var(--sp-8);
  border-bottom: 1px solid var(--border-light);
  background: var(--white);
}

#filters {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  align-items: center;
}

.filter-group {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-sep {
  width: 1px;
  height: 20px;
  background: var(--border-light);
  margin: 0 var(--sp-2);
  flex-shrink: 0;
}

.filter-btn {
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration-normal) var(--ease);
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.filter-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-surface);
}

.filter-btn.active {
  background: var(--orange-bg);
  color: var(--orange);
  font-weight: 600;
}

/* Domain filter buttons with individual colors */
.filter-btn.domain-btn.active {
  background: color-mix(in srgb, var(--domain-color) 12%, transparent);
  color: var(--domain-color);
}

/* ---- KITS SECTION ---- */
.kits-section {
  padding: var(--sp-6) var(--sp-8) 0;
  background: var(--bg-base);
}

.kits-section h2 {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
}

.kits-row {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.kit-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease);
  min-height: 36px;
  box-shadow: var(--shadow-sm);
}

.kit-chip:hover {
  border-color: var(--orange);
  color: var(--orange);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kit-chip.active {
  border-color: var(--orange);
  background: var(--orange-bg);
  color: var(--orange);
  font-weight: 600;
}

.kit-chip .kit-count {
  font-variant-numeric: tabular-nums;
  background: var(--bg-surface);
  padding: 1px var(--sp-2);
  border-radius: var(--radius-pill);
  font-size: 0.6875rem;
}

.kit-chip.active .kit-count {
  background: var(--orange-bg-hover);
}

/* ---- MAIN CONTENT ---- */
.main-wrapper {
  padding: var(--sp-6) var(--sp-8) 0;
}

.main {
  padding: 0 var(--sp-8) var(--sp-12);
}

.results-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--sp-4);
  font-variant-numeric: tabular-nums;
}

/* ---- GRID ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-4);
}

/* ---- CARD — Qalisia style ---- */
.card {
  padding: var(--sp-6);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  transition: all var(--duration-normal) var(--ease);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.card:hover {
  border-color: var(--orange);
  box-shadow: 0 8px 25px -5px rgba(252, 125, 15, 0.12);
  transform: translateY(-2px);
}

.card:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}

.card-title {
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--navy);
}

.card-author {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.card-nature {
  flex-shrink: 0;
}

.card-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-domains {
  display: flex;
  gap: var(--sp-1);
  flex-wrap: wrap;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border-light);
}

.card-tags {
  display: flex;
  gap: var(--sp-1);
  flex-wrap: wrap;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ---- BADGES ---- */

/* Nature badge — pill with subtle background */
.badge-nature {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 3px var(--sp-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  white-space: nowrap;
}

.nature-prompt    { background: var(--color-purple-bg); color: var(--color-purple); }
.nature-skill     { background: var(--orange-bg); color: var(--orange); }
.nature-mcp       { background: var(--color-green-bg); color: #059669; }
.nature-webapp    { background: var(--color-cyan-bg); color: var(--color-cyan); }
.nature-desktop   { background: var(--color-yellow-bg); color: #d97706; }
.nature-extension { background: rgba(236, 72, 153, 0.08); color: #ec4899; }
.nature-library   { background: var(--color-blue-bg); color: var(--color-blue); }
.nature-framework { background: var(--color-yellow-bg); color: var(--color-yellow); }
.nature-repo      { background: var(--bg-surface); color: var(--text-muted); }
.nature-api       { background: var(--color-red-bg); color: var(--color-red); }

/* Domain badge */
.badge-domain {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--sp-2);
  border-radius: var(--radius-pill);
  font-size: 0.6875rem;
  font-weight: 500;
  background: color-mix(in srgb, var(--domain-color) 10%, transparent);
  color: var(--domain-color);
}

/* Status */
.badge-status {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--sp-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
}

.status-suggested  { background: var(--color-blue-bg); color: var(--color-blue); }
.status-discovered { background: var(--bg-surface); color: var(--text-muted); }
.status-evaluated  { background: var(--color-yellow-bg); color: #d97706; }
.status-adopted    { background: var(--color-green-bg); color: #059669; }
.status-archived   { background: var(--color-red-bg); color: var(--color-red); }

/* Pricing */
.badge-pricing {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--sp-2);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
}

/* Tag */
.tag {
  display: inline-block;
  padding: 2px var(--sp-2);
  border-radius: var(--radius-pill);
  font-size: 0.6875rem;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  background: var(--white);
}

/* Link button — Qalisia orange gradient pill */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--white);
  text-decoration: none;
  background: var(--orange-gradient);
  border: none;
  transition: all var(--duration-normal) var(--ease);
  min-height: 32px;
  box-shadow: var(--shadow-sm);
}

.link-btn:hover {
  box-shadow: var(--shadow-orange);
  transform: scale(1.04);
}

.link-btn:active {
  transform: scale(0.97);
}

.link-btn svg {
  stroke: var(--white);
}

/* ---- TABLE VIEW ---- */
.table-container {
  overflow-x: auto;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.table-container table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.table-container th {
  background: var(--bg-surface);
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
  border-bottom: 1.5px solid var(--border-light);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color var(--duration-fast) var(--ease);
}

.table-container th:hover { color: var(--text-primary); }
.table-container th .sort-icon { margin-left: var(--sp-1); opacity: 0.4; }

.table-container td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-light);
  font-size: var(--text-sm);
  vertical-align: middle;
}

.table-container tr {
  transition: background var(--duration-fast) var(--ease);
}

.table-container tbody tr:hover td { background: var(--orange-bg); }
.table-container tbody tr:last-child td { border-bottom: none; }

.table-container .cell-name {
  font-weight: 600;
  color: var(--navy);
}

.table-container .cell-desc {
  color: var(--text-secondary);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(34, 37, 61, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--white);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: var(--sp-6);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 1;
}

.modal-header h2 {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--navy);
}

.modal-close {
  background: none;
  border: 1.5px solid var(--border-light);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  font-size: var(--text-lg);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--duration-normal) var(--ease);
  flex-shrink: 0;
}

.modal-close:hover {
  color: var(--orange);
  background: var(--orange-bg);
  border-color: var(--orange);
}

.modal-body {
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.detail-row {
  display: flex;
  gap: var(--sp-4);
}

.detail-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  font-weight: 600;
  color: var(--text-muted);
  min-width: 110px;
  padding-top: 2px;
  flex-shrink: 0;
}

.detail-value {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: var(--leading-relaxed);
  flex: 1;
}

.detail-value a {
  color: var(--orange);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease);
}

.detail-value a:hover { text-decoration: underline; }

.detail-tags {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.detail-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.detail-list li {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding-left: var(--sp-4);
  position: relative;
}

.detail-list li::before {
  content: '\2192';
  position: absolute;
  left: 0;
  color: var(--orange);
}

/* Relation links */
.relation-link {
  display: inline-flex;
  padding: 3px var(--sp-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--orange);
  background: var(--orange-bg);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease);
}

.relation-link:hover {
  background: var(--orange-bg-hover);
}

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: var(--sp-24) var(--sp-6);
  color: var(--text-muted);
}

.empty-state p {
  font-size: var(--text-lg);
  font-weight: 500;
}

.empty-state .sub {
  font-size: var(--text-sm);
  margin-top: var(--sp-2);
  color: var(--text-muted);
}

/* ---- FOOTER ---- */
.footer {
  padding: var(--sp-6) var(--sp-8);
  border-top: 1px solid var(--border-light);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-xs);
  background: var(--white);
}

.footer a {
  color: var(--orange);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-4);
    align-items: flex-start;
  }

  .header-stats {
    width: 100%;
    gap: var(--sp-6);
  }

  .controls {
    padding: var(--sp-3) var(--sp-4);
  }

  .search-box {
    min-width: 0;
    max-width: none;
    flex-basis: 100%;
  }

  .filters-bar {
    padding: var(--sp-3) var(--sp-4);
  }

  .kits-section {
    padding: var(--sp-4) var(--sp-4) 0;
  }

  .main {
    padding: var(--sp-4);
  }

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

  .card {
    padding: var(--sp-4);
  }

  .detail-row {
    flex-direction: column;
    gap: var(--sp-1);
  }

  .detail-label {
    min-width: auto;
  }

  .modal {
    max-height: 95vh;
  }

  .modal-header, .modal-body {
    padding: var(--sp-4);
  }
}

@media (min-width: 1440px) {
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
}

/* ============================================
   DARK MODE
   Activated by: system preference OR manual toggle
   Only overrides CSS variables — everything else follows
   ============================================ */

/* Theme toggle button */
.theme-toggle {
  padding: var(--sp-2) var(--sp-3);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-base);
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-normal) var(--ease);
}

.theme-toggle:hover {
  color: var(--orange);
  border-color: var(--orange);
  background: var(--orange-bg);
}

/* Dark mode variables */
[data-theme="dark"] {
  --white: #1a1d2e;
  --bg-base: #12141f;
  --bg-surface: #1e2133;
  --border-light: #2a2d42;
  --border-default: #363a52;
  --text-primary: #e8eaf0;
  --text-secondary: #a0a6b8;
  --text-muted: #6b7185;
  --navy: #e8eaf0;
  --navy-light: #c0c4d0;

  --orange-bg: rgba(252, 125, 15, 0.12);
  --orange-bg-hover: rgba(252, 125, 15, 0.20);
  --orange-shadow: rgba(252, 125, 15, 0.35);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.4);
  --shadow-orange: 0 4px 14px rgba(252, 125, 15, 0.25);

  --color-green-bg: rgba(52, 211, 153, 0.15);
  --color-red-bg: rgba(239, 68, 68, 0.12);
  --color-yellow-bg: rgba(245, 158, 11, 0.15);
  --color-blue-bg: rgba(59, 130, 246, 0.12);
  --color-purple-bg: rgba(139, 92, 246, 0.12);
  --color-cyan-bg: rgba(6, 182, 212, 0.12);
}

/* Dark mode SVG logo text override */
[data-theme="dark"] .qalisia-logo text[fill="#22253d"] {
  fill: #e8eaf0;
}

/* Dark mode modal overlay */
[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.6);
}

/* Dark mode table row hover */
[data-theme="dark"] .table-container tbody tr:hover td {
  background: var(--orange-bg);
}

/* System preference — auto dark mode when no manual toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --white: #1a1d2e;
    --bg-base: #12141f;
    --bg-surface: #1e2133;
    --border-light: #2a2d42;
    --border-default: #363a52;
    --text-primary: #e8eaf0;
    --text-secondary: #a0a6b8;
    --text-muted: #6b7185;
    --navy: #e8eaf0;
    --navy-light: #c0c4d0;

    --orange-bg: rgba(252, 125, 15, 0.12);
    --orange-bg-hover: rgba(252, 125, 15, 0.20);
    --orange-shadow: rgba(252, 125, 15, 0.35);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.4);
    --shadow-orange: 0 4px 14px rgba(252, 125, 15, 0.25);

    --color-green-bg: rgba(52, 211, 153, 0.15);
    --color-red-bg: rgba(239, 68, 68, 0.12);
    --color-yellow-bg: rgba(245, 158, 11, 0.15);
    --color-blue-bg: rgba(59, 130, 246, 0.12);
    --color-purple-bg: rgba(139, 92, 246, 0.12);
    --color-cyan-bg: rgba(6, 182, 212, 0.12);
  }

  :root:not([data-theme="light"]) .qalisia-logo text[fill="#22253d"] {
    fill: #e8eaf0;
  }

  :root:not([data-theme="light"]) .modal-overlay {
    background: rgba(0, 0, 0, 0.6);
  }
}
