/* ==========================================================================
   LOOKUPZ — Panel V9 Premium
   Noir + Violet Néon + Blanc
   3D subtle effects, halo radial, micro-interactions
   Sections :
     1. Tokens             2. Reset & Base           3. Background FX
     4. Layout (grid)      5. Sidebar                6. Topbar
     7. Main               8. Hero                   9. Buttons
    10. Stat cards        11. Insights             12. Search page
    13. Result cards      14. Pagination           15. Command palette
    16. Detail modal      17. Toasts                18. Autocomplete
    19. Spinner           20. Scrollbars            21. Responsive
    22. Accessibility
   ========================================================================== */

/* ==========================================================================
   1. TOKENS
   ========================================================================== */
:root {
  /* Backgrounds (deep black) */
  --bg-0: #04040a;
  --bg-1: #07071a;
  --bg-2: #0c0c22;
  --bg-3: #11112a;
  --bg-4: #181834;
  --bg-card: rgba(20, 20, 40, 0.55);
  --bg-card-hover: rgba(28, 28, 56, 0.78);

  /* Lines / borders */
  --line: rgba(255, 255, 255, 0.06);
  --line-2: rgba(255, 255, 255, 0.10);
  --line-violet: rgba(143, 7, 255, 0.22);

  /* Violet neon */
  --v-900: #2a0a52;
  --v-800: #4a0eb8;
  --v-700: #6a1cf0;
  --v-600: #8f07ff;
  --v-500: #a83bff;
  --v-400: #b16dff;
  --v-300: #c79aff;
  --v-200: #ddc4ff;
  --v-100: #f0e3ff;

  /* Source colors (all violet family) */
  --src-ants: var(--v-600);
  --src-unss: var(--v-300);
  --src-caf:  var(--v-500);

  /* Text */
  --text: #f6f6ff;
  --text-2: rgba(246, 246, 255, 0.72);
  --text-3: rgba(246, 246, 255, 0.46);
  --text-4: rgba(246, 246, 255, 0.24);

  /* Status (only used for error/warning) */
  --err: #ff8585;
  --err-bg: rgba(255, 120, 120, 0.10);
  --warn: #ffd166;
  --warn-bg: rgba(255, 209, 102, 0.10);

  /* Fonts */
  --f-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --f-mono: 'Space Grotesk', ui-monospace, monospace;

  /* Shadows */
  --shadow-sm: 0 4px 18px rgba(0, 0, 0, 0.40);
  --shadow-md: 0 14px 44px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 30px 100px rgba(0, 0, 0, 0.70);
  --shadow-glow: 0 0 50px rgba(143, 7, 255, 0.45);
  --shadow-glow-soft: 0 0 30px rgba(143, 7, 255, 0.25);
  --shadow-violet-strong: 0 8px 32px rgba(143, 7, 255, 0.50), 0 0 0 1px rgba(143, 7, 255, 0.30);

  /* Radius */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-2xl: 32px;

  /* Easing */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-snap: cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --sidebar-width: 240px;
  --topbar-height: 64px;
  --container-padding: 28px;

  /* 3D perspective (used by hovered cards, modal, hero) */
  --perspective: 1400px;
  --rotate-x: 0deg;
  --rotate-y: 0deg;
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* Enable crisp 3D rendering on capable devices only */
  transform-style: flat;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Establishes a 3D context for children */
  perspective: var(--perspective);
}

html, body { height: 100%; }

body {
  font-family: var(--f-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-0);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image:
    radial-gradient(1000px 800px at 15% -10%, rgba(143, 7, 255, 0.25), transparent 55%),
    radial-gradient(900px 700px at 100% 100%, rgba(106, 28, 240, 0.18), transparent 55%),
    radial-gradient(600px 500px at 50% 50%, rgba(168, 59, 255, 0.06), transparent 60%);
  background-attachment: fixed;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: inherit;
}

input, textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  outline: 0;
  width: 100%;
}

a { color: inherit; text-decoration: none; }
svg { display: block; flex-shrink: 0; }
img { max-width: 100%; display: block; }

kbd {
  font-family: var(--f-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2.5px 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text-3);
  line-height: 1;
}

::selection { background: rgba(143, 7, 255, 0.35); color: #fff; }

:focus-visible {
  outline: 2px solid var(--v-300);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ==========================================================================
   3. BACKGROUND FX (auroras + grain)
   ========================================================================== */
.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.35;
  mix-blend-mode: overlay;
}
.bg-noise::before {
  content: '';
  position: absolute;
  width: 700px; height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 59, 255, 0.32), transparent 70%);
  filter: blur(80px);
  top: -240px; left: -180px;
  animation: aurora-drift 24s ease-in-out infinite;
}
.bg-noise::after {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(106, 28, 240, 0.22), transparent 70%);
  filter: blur(80px);
  bottom: -240px; right: -180px;
  animation: aurora-drift 30s ease-in-out infinite reverse;
}
@keyframes aurora-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(120px, 60px) scale(1.1); }
  66% { transform: translate(-80px, 100px) scale(0.95); }
}

/* ==========================================================================
   4. LAYOUT GRID
   ========================================================================== */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--topbar-height) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  min-height: 100vh;
}

/* ==========================================================================
   5. SIDEBAR
   ========================================================================== */
.sidebar {
  grid-area: sidebar;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  padding: 18px 14px;
  background: linear-gradient(180deg, rgba(12, 12, 34, 0.85), rgba(7, 7, 26, 0.85));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 22px;
  z-index: 10;
}

.sb-toggle {
  display: none;
}
@media (min-width: 881px) {
  .sb-toggle { display: none !important; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 14px;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--v-500), var(--v-700));
  display: grid; place-items: center;
  color: #fff;
  font-family: var(--f-mono);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.5px;
  box-shadow: var(--shadow-glow-soft);
  transition: transform 0.4s var(--ease-bounce), box-shadow 0.4s var(--ease);
}
.brand-mark:hover {
  transform: rotateZ(-8deg) scale(1.05);
  box-shadow: var(--shadow-glow);
}
.brand-name {
  font-family: var(--f-mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1.4px;
  display: flex;
  align-items: baseline;
  gap: 1px;
}
.brand-l1 { color: var(--v-300); }
.brand-l2 { color: var(--text); }

.panel { display: flex; flex-direction: column; gap: 8px; }
.panel-title {
  font-family: var(--f-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 10px;
  margin-bottom: 2px;
}

.src-list { display: flex; flex-direction: column; gap: 3px; }
.src-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
  width: 100%;
}
.src-item:hover {
  background: rgba(143, 7, 255, 0.08);
  color: var(--text);
  transform: translateX(2px);
}
.src-item.is-active {
  background: linear-gradient(90deg, rgba(143, 7, 255, 0.18), rgba(143, 7, 255, 0.05));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(143, 7, 255, 0.30);
}
.src-mark {
  width: 22px; height: 22px;
  border-radius: 6px;
  display: grid; place-items: center;
  font-family: var(--f-mono);
  font-weight: 800;
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
}
.src-mark-all {
  background: linear-gradient(135deg, var(--v-500), var(--v-700));
  box-shadow: 0 2px 8px rgba(143, 7, 255, 0.35);
}
.src-mark-ants { background: linear-gradient(135deg, var(--v-600), var(--v-800)); }
.src-mark-unss { background: linear-gradient(135deg, var(--v-300), var(--v-500)); color: #1a0d3a; }
.src-mark-caf  { background: linear-gradient(135deg, var(--v-500), var(--v-700)); }
.src-mark-fed  { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.src-name { flex: 1; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-cnt {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 7px;
  border-radius: 999px;
  min-width: 38px;
  text-align: center;
}

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
  font-size: 13px;
  font-weight: 500;
}
.nav-item:hover {
  background: rgba(143, 7, 255, 0.08);
  color: var(--text);
  transform: translateX(2px);
}
.nav-item.is-active {
  background: linear-gradient(90deg, rgba(143, 7, 255, 0.22), rgba(143, 7, 255, 0.04));
  color: var(--text);
}
.nav-item.is-active svg { color: var(--v-300); }

.sb-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
}
.sb-orb {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--v-300);
  box-shadow: 0 0 10px var(--v-300);
  animation: orb-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes orb-pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 10px var(--v-300); }
  50% { opacity: 0.6; transform: scale(0.85); box-shadow: 0 0 6px var(--v-400); }
}
.sb-foot-l1 { font-size: 12px; font-weight: 500; color: var(--text); }
.sb-foot-l2 { font-size: 10.5px; color: var(--text-3); font-family: var(--f-mono); }

/* ==========================================================================
   6. TOPBAR
   ========================================================================== */
.topbar {
  grid-area: topbar;
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 24px;
  height: var(--topbar-height);
  background: linear-gradient(180deg, rgba(7, 7, 26, 0.85), rgba(7, 7, 26, 0.55));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  z-index: 9;
}
.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.crumb svg { color: var(--text-4); }
#crumbCurrent { color: var(--text); font-weight: 600; }

.search-trigger {
  flex: 1;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-3);
  font-size: 13px;
  transition: all 0.18s var(--ease);
}
.search-trigger:hover {
  background: rgba(143, 7, 255, 0.06);
  border-color: rgba(143, 7, 255, 0.30);
  color: var(--text-2);
  transform: translateY(-1px);
}
.search-trigger:active { transform: translateY(0); }
.search-trigger span { flex: 1; text-align: left; }

.topbar-r { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.status-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  transition: all 0.15s var(--ease);
}
.status-pill.is-ok {
  background: rgba(143, 7, 255, 0.10);
  color: var(--v-200);
  border: 1px solid rgba(143, 7, 255, 0.30);
}
.status-pill.is-error {
  background: var(--err-bg);
  color: var(--err);
  border: 1px solid rgba(255, 120, 120, 0.35);
}
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--v-300);
  box-shadow: 0 0 8px var(--v-300);
  animation: orb-pulse 2s ease-in-out infinite;
}
.status-pill.is-error .status-dot { background: var(--err); box-shadow: 0 0 8px var(--err); }

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--v-500), var(--v-700));
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(143, 7, 255, 0.40);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  transition: transform 0.3s var(--ease-bounce);
}
.avatar:hover { transform: scale(1.08) rotateZ(5deg); }

/* ==========================================================================
   7. MAIN
   ========================================================================== */
.main {
  grid-area: main;
  padding: var(--container-padding) 32px 48px;
  min-width: 0;
}

.view {
  display: block;
  animation: view-in 0.5s var(--ease) both;
}
.view[hidden] { display: none; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   8. HERO (with 3D tilt + dual halo)
   ========================================================================== */
.hero {
  position: relative;
  padding: 56px 44px 64px;
  border-radius: var(--r-2xl);
  background: linear-gradient(140deg, rgba(143, 7, 255, 0.18), rgba(106, 28, 240, 0.06) 50%, transparent 100%);
  border: 1px solid rgba(143, 7, 255, 0.20);
  overflow: hidden;
  isolation: isolate;
  margin-bottom: 28px;
  transform-style: preserve-3d;
  transition: transform 0.6s var(--ease);
}
.hero::before {
  content: '';
  position: absolute;
  inset: -1px;
  z-index: -1;
  background:
    radial-gradient(600px 400px at 90% 0%, rgba(168, 59, 255, 0.45), transparent 65%),
    radial-gradient(500px 350px at 0% 100%, rgba(74, 14, 184, 0.40), transparent 65%);
  filter: blur(40px);
  opacity: 0.85;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .25 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.4;
  mix-blend-mode: overlay;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(143, 7, 255, 0.12);
  border: 1px solid rgba(143, 7, 255, 0.30);
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--v-200);
  letter-spacing: 0.5px;
}
.hero-pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--v-300);
  box-shadow: 0 0 10px var(--v-300);
  animation: orb-pulse 2s ease-in-out infinite;
}
.hero-title {
  margin-top: 18px;
  font-family: var(--f-sans);
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -1.6px;
  color: var(--text);
}
.hero-title span { display: inline-block; }
.hero-accent {
  background: linear-gradient(135deg, var(--v-300), var(--v-500) 50%, var(--v-700));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-style: italic;
  padding-right: 0.05em;
}
.hero-sub {
  margin-top: 18px;
  color: var(--text-2);
  font-size: 16px;
  max-width: 640px;
  line-height: 1.55;
}
.hero-actions {
  margin-top: 28px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==========================================================================
   9. BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.1px;
  transition: transform 0.18s var(--ease-snap), box-shadow 0.25s var(--ease), background 0.15s var(--ease);
  white-space: nowrap;
  position: relative;
  will-change: transform;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn-lg { padding: 14px 22px; font-size: 14px; border-radius: 14px; }

.btn-primary {
  background: linear-gradient(135deg, var(--v-500), var(--v-700));
  color: #fff;
  box-shadow: var(--shadow-violet-strong), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  overflow: hidden;
}
/* Glossy sweep on hover */
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.25) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s var(--ease);
  pointer-events: none;
}
.btn-primary:hover {
  box-shadow: 0 12px 30px rgba(143, 7, 255, 0.60), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transform: translateY(-2px);
}
.btn-primary:hover::before { transform: translateX(100%); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border: 1px solid var(--line-2);
}
.btn-ghost:hover {
  background: rgba(143, 7, 255, 0.10);
  border-color: rgba(143, 7, 255, 0.40);
  color: var(--v-200);
  transform: translateY(-1px);
}

.reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 11px;
  color: var(--text-3);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--f-mono);
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: all 0.15s var(--ease);
}
.reset-btn:hover {
  color: var(--v-200);
  border-color: rgba(143, 7, 255, 0.40);
  background: rgba(143, 7, 255, 0.08);
  transform: rotate(-6deg);
}

/* ==========================================================================
   10. STAT CARDS (with 3D tilt on hover)
   ========================================================================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
  perspective: var(--perspective);
}

.stat-card {
  position: relative;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  isolation: isolate;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transform-style: preserve-3d;
  transform: rotateX(0) rotateY(0) translateZ(0);
  transition: transform 0.5s var(--ease-snap), background 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.5s var(--ease);
  will-change: transform;
  cursor: default;
}
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, rgba(143, 7, 255, 0.18), transparent 70%);
  z-index: -1;
}
.stat-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(143, 7, 255, 0.35);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.4), 0 0 24px rgba(143, 7, 255, 0.20);
}

.stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.stat-label {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.stat-tag {
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  letter-spacing: 0.5px;
  background: rgba(143, 7, 255, 0.10);
  color: var(--v-300);
}
.stat-val {
  font-family: var(--f-mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--text);
  line-height: 1;
  background: linear-gradient(135deg, #fff 0%, var(--v-200) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-sub {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-3);
}
.stat-bar {
  margin-top: 12px;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--v-500), var(--v-300));
  box-shadow: 0 0 10px var(--v-500);
  transition: width 0.8s var(--ease);
}
.pulse-bars {
  margin-top: 14px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
}
.pulse-bars span {
  flex: 1;
  background: linear-gradient(180deg, var(--v-400), var(--v-700));
  border-radius: 2px;
  transform-origin: bottom center;
  animation: pulse-bars 1.2s ease-in-out infinite;
}
.pulse-bars span:nth-child(1) { height: 30%; animation-delay: 0s; }
.pulse-bars span:nth-child(2) { height: 60%; animation-delay: 0.1s; }
.pulse-bars span:nth-child(3) { height: 90%; animation-delay: 0.2s; }
.pulse-bars span:nth-child(4) { height: 50%; animation-delay: 0.3s; }
.pulse-bars span:nth-child(5) { height: 75%; animation-delay: 0.4s; }
@keyframes pulse-bars {
  0%, 100% { opacity: 0.5; transform: scaleY(0.8); }
  50%      { opacity: 1; transform: scaleY(1.1); }
}

/* Source variants */
.stat-card.stat-ants .stat-tag  { background: rgba(143, 7, 255, 0.18); color: var(--v-100); }
.stat-card.stat-unss .stat-tag  { background: rgba(199, 154, 255, 0.15); color: var(--v-100); }
.stat-card.stat-caf  .stat-tag  { background: rgba(168, 59, 255, 0.18); color: var(--v-100); }
.stat-card.stat-ants .stat-bar-fill { background: linear-gradient(90deg, var(--v-600), var(--v-400)); }
.stat-card.stat-unss .stat-bar-fill { background: linear-gradient(90deg, var(--v-400), var(--v-200)); }
.stat-card.stat-caf  .stat-bar-fill { background: linear-gradient(90deg, var(--v-500), var(--v-300)); }

/* ==========================================================================
   11. INSIGHTS (top communes/villes/cp)
   ========================================================================== */
.insights {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.ins-card {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  backdrop-filter: blur(10px);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.ins-card:hover {
  border-color: rgba(143, 7, 255, 0.25);
  background: var(--bg-card-hover);
}
.ins-title {
  font-family: var(--f-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
}
.ins-list { display: flex; flex-direction: column; gap: 4px; }
.ins-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  transition: background 0.12s, transform 0.12s var(--ease-snap);
}
.ins-row:hover {
  background: rgba(143, 7, 255, 0.06);
  transform: translateX(2px);
}
.ins-row .k { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70%; }
.ins-row .c {
  font-family: var(--f-mono);
  color: var(--v-300);
  font-size: 11px;
  background: rgba(143, 7, 255, 0.10);
  padding: 2px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}
.ins-row-empty {
  padding: 6px 8px;
  color: var(--text-3);
  font-size: 12px;
  text-align: center;
}

/* ==========================================================================
   12. SEARCH PAGE
   ========================================================================== */
.search-wrap {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
  position: relative;
}
.search-wrap > .results-pane {
  min-width: 0; /* Allow the 1fr column to shrink properly */
}

.search-panel {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 22px;
  position: sticky;
  top: calc(var(--topbar-height) + 20px);
  max-height: calc(100vh - var(--topbar-height) - 40px);
  overflow-y: auto;
  backdrop-filter: blur(10px);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.panel-head h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-family: var(--f-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.field-input {
  position: relative;
  display: block;
}
.field input {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  transition: all 0.15s var(--ease);
  font-size: 13px;
}
.field input::placeholder { color: var(--text-4); }
.field input:hover { border-color: var(--line-2); }
.field input:focus {
  background: rgba(143, 7, 255, 0.06);
  border-color: rgba(143, 7, 255, 0.50);
  box-shadow: 0 0 0 3px rgba(143, 7, 255, 0.10);
}

.btn-submit { width: 100%; margin-top: 8px; }

/* Mode toggle (strict/loose) */
.mode-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 16px;
}
.mode-opt {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  transition: all 0.15s var(--ease);
}
.mode-opt:hover { color: var(--text-2); background: rgba(143, 7, 255, 0.06); }
.mode-opt.is-active {
  background: linear-gradient(135deg, var(--v-500), var(--v-700));
  color: #fff;
  box-shadow: 0 4px 12px rgba(143, 7, 255, 0.30);
}
.mode-opt svg { flex-shrink: 0; }

/* ==========================================================================
   13. RESULTS PANE
   ========================================================================== */
.results-pane {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  perspective: var(--perspective);
}

.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 13px;
  backdrop-filter: blur(10px);
}
.results-toolbar > div { display: flex; align-items: center; gap: 6px; }
.results-toolbar strong {
  font-family: var(--f-mono);
  color: var(--v-200);
  font-weight: 700;
  margin-right: 4px;
}
.results-time {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--text-3);
}
.results-time span { color: var(--v-300); font-weight: 700; margin-right: 3px; }
.results-source {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--text-3);
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

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

.res-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: transform 0.3s var(--ease-snap), background 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.4s var(--ease);
  cursor: pointer;
  animation: card-in 0.4s var(--ease) both;
  transform-style: preserve-3d;
  will-change: transform;
  backdrop-filter: blur(10px);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Subtle 3D lift on hover */
.res-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(143, 7, 255, 0.35);
  transform: translateX(6px) translateZ(0) scale(1.005);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 18px rgba(143, 7, 255, 0.18);
}

.res-avatar {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-family: var(--f-mono);
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(135deg, var(--v-500), var(--v-700));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.20);
  transition: transform 0.4s var(--ease-bounce);
}
.res-card:hover .res-avatar {
  transform: scale(1.06) rotateZ(-4deg);
}
.res-avatar.ants { background: linear-gradient(135deg, var(--v-600), var(--v-800)); }
.res-avatar.unss { background: linear-gradient(135deg, var(--v-300), var(--v-500)); color: #1a0d3a; }
.res-avatar.caf  { background: linear-gradient(135deg, var(--v-500), var(--v-700)); }

.res-info { min-width: 0; }
.res-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex-wrap: wrap;
}
.res-name > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.res-tag {
  font-family: var(--f-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.7px;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(143, 7, 255, 0.15);
  color: var(--v-100);
  flex-shrink: 0;
}
.res-tag.ants { background: rgba(143, 7, 255, 0.22); }
.res-tag.unss { background: rgba(199, 154, 255, 0.18); }
.res-tag.caf  { background: rgba(168, 59, 255, 0.20); }
.res-civ {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--f-mono);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 6px;
  border-radius: 4px;
}
.res-meta {
  margin-top: 4px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--text-3);
  flex-wrap: wrap;
}
.res-sep { color: var(--text-4); }
.res-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.res-meta-item svg { color: var(--v-400); flex-shrink: 0; }
.res-meta-item span { overflow: hidden; text-overflow: ellipsis; }
.res-meta-item.is-clickable {
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 5px;
  transition: background 0.15s var(--ease);
  max-width: 100%;
}
.res-meta-item.is-clickable:hover {
  background: rgba(143, 7, 255, 0.15);
  color: var(--text);
}
.res-meta-item.is-clickable.is-flash {
  background: rgba(143, 7, 255, 0.40);
  animation: copy-flash 0.6s var(--ease);
}
@keyframes copy-flash {
  0% { background: rgba(143, 7, 255, 0.50); }
  100% { background: rgba(143, 7, 255, 0.15); }
}
.res-score {
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(143, 7, 255, 0.20), rgba(106, 28, 240, 0.30));
  color: var(--v-100);
  flex-shrink: 0;
  border: 1px solid rgba(143, 7, 255, 0.30);
}

.res-action { display: flex; gap: 4px; }
.res-icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  color: var(--text-3);
  transition: all 0.15s var(--ease);
}
.res-icon-btn:hover {
  background: rgba(143, 7, 255, 0.12);
  border-color: rgba(143, 7, 255, 0.40);
  color: var(--v-200);
  transform: scale(1.08);
}
.res-icon-btn:active { transform: scale(0.92); }

/* Skeleton */
.res-card.is-skel { pointer-events: none; opacity: 0.55; }
.res-card.is-skel > div {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.04));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 6px;
}
.res-card.is-skel .res-avatar {
  background: rgba(255, 255, 255, 0.05);
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

mark {
  background: rgba(143, 7, 255, 0.30);
  color: var(--v-100);
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 600;
}

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty-ic {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: rgba(143, 7, 255, 0.08);
  display: grid; place-items: center;
  color: var(--v-400);
  border: 1px solid rgba(143, 7, 255, 0.20);
}
.empty-title {
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

/* ==========================================================================
   14. PAGINATION
   ========================================================================== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.pg-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s var(--ease);
}
.pg-btn:hover:not(:disabled):not(.is-active) {
  background: rgba(143, 7, 255, 0.10);
  border-color: rgba(143, 7, 255, 0.30);
  color: var(--v-200);
  transform: translateY(-1px);
}
.pg-btn.is-active {
  background: linear-gradient(135deg, var(--v-500), var(--v-700));
  border-color: var(--v-500);
  color: #fff;
  box-shadow: 0 4px 12px rgba(143, 7, 255, 0.35);
}
.pg-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.pg-dots { color: var(--text-3); padding: 0 4px; font-family: var(--f-mono); }

/* ==========================================================================
   15. COMMAND PALETTE
   ========================================================================== */
.palette {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: start center;
  padding-top: 14vh;
  animation: fade-in 0.15s var(--ease);
}
.palette[hidden] { display: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.palette-bg {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 10, 0.70);
  backdrop-filter: blur(8px);
}
.palette-box {
  position: relative;
  width: min(560px, 92vw);
  background: rgba(15, 15, 36, 0.95);
  border: 1px solid rgba(143, 7, 255, 0.30);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  overflow: hidden;
  backdrop-filter: blur(20px);
  animation: pop-in 0.2s var(--ease);
}
@keyframes pop-in {
  from { transform: translateY(-8px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.palette-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.palette-input-row svg { color: var(--v-300); }
.palette-input-row input {
  flex: 1;
  font-size: 14px;
  color: var(--text);
}
.palette-input-row input::placeholder { color: var(--text-3); }
.palette-list {
  max-height: 50vh;
  overflow-y: auto;
  padding: 8px;
}
.palette-section-title {
  font-family: var(--f-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-3);
  padding: 10px 10px 4px;
}
.palette-empty {
  padding: 18px 10px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-2);
  transition: background 0.12s, transform 0.12s var(--ease-snap);
}
.palette-item.is-sel {
  background: rgba(143, 7, 255, 0.14);
  color: var(--text);
  transform: translateX(2px);
}
.palette-item:hover { background: rgba(143, 7, 255, 0.10); }
.palette-item-ic {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  color: var(--v-300);
  flex-shrink: 0;
}
.palette-item-tx { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.palette-item-kbd {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.palette-foot {
  display: flex;
  gap: 18px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--text-3);
  flex-wrap: wrap;
}
.palette-foot kbd { margin-right: 4px; }

/* ==========================================================================
   16. DETAIL MODAL (3D flip-in)
   ========================================================================== */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 4, 10, 0.72);
  backdrop-filter: blur(6px);
  z-index: 999;
  animation: fade-in 0.18s var(--ease);
}
.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  pointer-events: none;
}
.detail-modal > .detail-box { pointer-events: auto; }
.detail-box {
  width: min(580px, 95vw);
  max-height: 90vh;
  background: rgba(15, 15, 36, 0.97);
  border: 1px solid rgba(143, 7, 255, 0.30);
  border-radius: var(--r-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transform-style: preserve-3d;
  animation: modal-3d-in 0.4s var(--ease-bounce) both;
  transform-origin: center center;
}
@keyframes modal-3d-in {
  from { transform: perspective(1400px) rotateX(-12deg) translateY(20px); opacity: 0; }
  to   { transform: perspective(1400px) rotateX(0) translateY(0); opacity: 1; }
}
.detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(143, 7, 255, 0.15), transparent);
}
.detail-avatar {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-family: var(--f-mono);
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  background: linear-gradient(135deg, var(--v-500), var(--v-700));
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(143, 7, 255, 0.40);
}
.detail-avatar.ants { background: linear-gradient(135deg, var(--v-600), var(--v-800)); }
.detail-avatar.unss { background: linear-gradient(135deg, var(--v-300), var(--v-500)); color: #1a0d3a; }
.detail-avatar.caf  { background: linear-gradient(135deg, var(--v-500), var(--v-700)); }
.detail-head-info { flex: 1; min-width: 0; }
.detail-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail-source-tag {
  margin-top: 4px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.detail-civ, .detail-id {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--f-mono);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 6px;
  border-radius: 4px;
}
.detail-close {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--text-3);
  display: grid; place-items: center;
  transition: all 0.18s var(--ease);
  flex-shrink: 0;
}
.detail-close:hover {
  background: rgba(143, 7, 255, 0.10);
  color: var(--v-200);
  transform: rotate(90deg);
}
.detail-body {
  padding: 14px 22px;
  overflow-y: auto;
  max-height: 60vh;
}
.detail-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
  align-items: center;
}
.detail-row:last-child { border-bottom: 0; }
.detail-row-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.detail-row-label svg { color: var(--v-400); flex-shrink: 0; }
.detail-row-value {
  color: var(--text);
  word-break: break-word;
  font-family: var(--f-mono);
  font-size: 12.5px;
}
.detail-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
}

/* ==========================================================================
   17. TOASTS
   ========================================================================== */
.toasts {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
  max-width: calc(100vw - 48px);
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(15, 15, 36, 0.95);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--text);
  max-width: 360px;
  animation: toast-in 0.25s var(--ease);
  pointer-events: auto;
  backdrop-filter: blur(20px);
  word-break: break-word;
}
.toast strong { font-weight: 700; }
.toast--success { border-left: 3px solid var(--v-300); }
.toast--info    { border-left: 3px solid var(--v-400); }
.toast--warning { border-left: 3px solid var(--warn); }
.toast--error   { border-left: 3px solid var(--err); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ==========================================================================
   18. AUTOCOMPLETE
   ========================================================================== */
.ac-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 30;
  background: rgba(15, 15, 36, 0.95);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  max-height: 240px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  display: none;
}
.ac-list.is-open { display: block; }
.ac-item {
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.10s, color 0.10s;
}
.ac-item:hover, .ac-item.is-sel {
  background: rgba(143, 7, 255, 0.12);
  color: var(--text);
}

/* ==========================================================================
   19. SPINNER
   ========================================================================== */
.spin {
  width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--v-300);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   20. SCROLLBARS
   ========================================================================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(143, 7, 255, 0.22);
  border-radius: 999px;
  transition: background 0.15s;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(143, 7, 255, 0.45);
}

/* ==========================================================================
   21. RESPONSIVE
   ========================================================================== */
@media (max-width: 1180px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .insights { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 880px) {
  :root { --container-padding: 16px; }
  .app {
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "main";
  }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    z-index: 50;
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 4, 10, 0.70);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9;
    opacity: 0;
    pointer-events: none;
    display: block;
    transition: opacity 0.25s var(--ease);
  }
  .sidebar-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
  }
  .sb-toggle {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
    color: var(--text-2);
    transition: all 0.15s var(--ease);
    flex-shrink: 0;
  }
  .sb-toggle:hover {
    background: rgba(143, 7, 255, 0.10);
    color: var(--v-200);
    border-color: rgba(143, 7, 255, 0.35);
  }
  .sb-toggle.is-active {
    background: rgba(143, 7, 255, 0.15);
    color: var(--v-100);
    border-color: rgba(143, 7, 255, 0.45);
  }
  .sb-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; gap: 12px; }
  .crumb { display: none; }
  .search-trigger { max-width: none; }
  .main { padding: 20px 18px 32px; }

  .stats-row { grid-template-columns: 1fr 1fr; }
  .insights { grid-template-columns: 1fr; }
  .hero { padding: 36px 24px 42px; }

  .search-wrap { grid-template-columns: 1fr; }
  .search-panel { position: static; max-height: none; }

  .detail-row { grid-template-columns: 1fr; gap: 4px; }
  .detail-row-label { font-size: 10px; }
}

@media (max-width: 520px) {
  .stats-row { grid-template-columns: 1fr; }
  .res-card { grid-template-columns: 40px 1fr; padding: 12px; gap: 10px; }
  .res-action { display: none; }
  .hero-title { font-size: 30px; letter-spacing: -1px; }
  .hero { padding: 28px 20px 32px; }
  .topbar-r .status-pill { display: none; }
  .topbar .search-trigger span { display: none; }
  .topbar .search-trigger { padding: 8px 12px; }
  .toast { max-width: calc(100vw - 32px); right: 16px; left: 16px; }
}

/* ==========================================================================
   22. ACCESSIBILITY
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}

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