/* ==========================================================================
   L’Essence Bio — Clinical Luxury & Precision RUO Biotech Design System
   Palette & Tokens aligned with L’Essence Bio (Cormorant Garamond + Manrope + JetBrains Mono)
   ========================================================================== */

:root {
  --bg-canvas: #0A1320;
  --bg-surface: #101D30;
  --bg-elevated: #16263E;
  --bg-subtle: rgba(255, 255, 255, 0.045);
  --bg-hover: rgba(255, 255, 255, 0.08);
  --bg-glass: rgba(10, 19, 32, 0.88);

  --border-default: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --border-brand: rgba(66, 116, 184, 0.42);

  --text-primary: #FBF8F4;
  --text-secondary: #B8C7DA;
  --text-muted: #7B8FA8;

  /* Official L’Essence Bio Clinical Luxury Tokens */
  --brand-300: #8AB4F0;
  --brand-400: #6396DC;
  --brand-primary: #2B5B9E;
  --brand-500: #2B5B9E;
  --brand-600: #1B4580;
  --brand-fg: #FFFFFF;
  --rose-gold: #C59B82;

  /* Semantic Status Tokens */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.28);

  --warning: #C59B82;
  --warning-bg: rgba(197, 155, 130, 0.14);
  --warning-border: rgba(197, 155, 130, 0.32);

  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.28);

  --cyan: #10ddb4;
  --purple: #9b78ff;

  --grad-brand: linear-gradient(135deg, #2B5B9E 0%, #1B4580 100%);
  --shadow-card: 0 2px 6px rgba(0, 0, 0, 0.35), 0 12px 28px rgba(0, 0, 0, 0.28);
  --shadow-brand: 0 6px 22px rgba(43, 91, 158, 0.35);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;

  --header-h: 60px;
  --bottom-nav-h: 68px;
  --sidebar-w: 264px;
}

body.light-mode {
  --bg-canvas: #FBF8F4;
  --bg-surface: #FFFFFF;
  --bg-elevated: #F5EFE7;
  --bg-subtle: #EAE5DC;
  --bg-hover: rgba(20, 48, 79, 0.06);
  --bg-glass: rgba(251, 248, 244, 0.90);

  --border-default: rgba(20, 48, 79, 0.10);
  --border-strong: rgba(20, 48, 79, 0.18);
  --border-brand: rgba(43, 91, 158, 0.34);

  --text-primary: #14304F;
  --text-secondary: #4A5A70;
  --text-muted: #768599;

  --brand-300: #4274B8;
  --brand-400: #2B5B9E;
  --brand-primary: #14304F;
  --brand-500: #14304F;
  --brand-600: #0E2238;
  --brand-fg: #FFFFFF;

  --grad-brand: linear-gradient(135deg, #14304F 0%, #2B5B9E 100%);
  --shadow-card: 0 2px 6px rgba(20, 48, 79, 0.04), 0 12px 28px rgba(20, 48, 79, 0.06);
  --shadow-brand: 0 6px 20px rgba(20, 48, 79, 0.22);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Subtle Futuristic Grid Backdrop */
.bg-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(600px circle at 15% 0%, rgba(43, 91, 158, 0.07), transparent 65%),
    radial-gradient(500px circle at 90% 10%, rgba(16, 221, 180, 0.045), transparent 60%);
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.024) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.024) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 15%, #000 20%, transparent 100%);
}

body.light-mode .bg-grid {
  background-image:
    linear-gradient(to right, rgba(35, 34, 31, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(35, 34, 31, 0.035) 1px, transparent 1px);
}

/* Icons Utility */
.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
}

.icon-sm { width: 15px; height: 15px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 22px; height: 22px; }

/* ==========================================================================
   Layout Shell (Mobile-First)
   ========================================================================== */
.app-layout {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
}

/* Sidebar / Mobile Drawer */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  width: 280px;
  max-width: 85vw;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 16px;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 16px;
  border-bottom: 1px solid var(--border-default);
}

.brand-ident {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  height: 34px;
  width: auto;
  object-fit: contain;
}

.version-pill {
  display: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: rgba(43, 91, 158, 0.14);
  color: var(--brand-400);
  border: 1px solid var(--border-brand);
}

body.light-mode .version-pill {
  color: var(--brand-600);
}

.close-drawer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  cursor: pointer;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.16s ease;
  text-align: left;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(43, 91, 158, 0.12);
  border-color: var(--border-brand);
  color: var(--brand-400);
}

body.light-mode .nav-item.active {
  background: rgba(43, 91, 158, 0.16);
  color: #933e0d;
}

.nav-count {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}

.nav-item.active .nav-count {
  background: rgba(43, 91, 158, 0.2);
  border-color: var(--border-brand);
  color: inherit;
}

.commander-panel {
  margin-top: 20px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.commander-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.commander-badge-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--grad-brand);
  color: var(--brand-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-brand);
  flex-shrink: 0;
}

.commander-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.commander-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
   Top Header (Mobile-First Sticky Bar)
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--header-h);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-default);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--bg-subtle);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.icon-btn:hover {
  border-color: var(--border-brand);
  background: var(--bg-hover);
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-brand img {
  height: 24px;
  width: auto;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.25); }
}

.clock-group {
  display: none;
  align-items: center;
  gap: 8px;
}

.clock-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 16px;
  border-radius: 9999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.16s ease;
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--grad-brand);
  color: var(--brand-fg);
  font-weight: 700;
  box-shadow: var(--shadow-brand);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

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

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-secondary:hover {
  border-color: var(--border-brand);
  background: var(--bg-hover);
}

.hide-xs {
  display: none;
}

/* ==========================================================================
   Main Container & Hero Header
   ========================================================================== */
.page-content {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand-400), var(--cyan), transparent);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-400);
  margin-bottom: 6px;
}

body.light-mode .eyebrow {
  color: var(--brand-600);
}

.hero-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.6rem, 2.8vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.16;
  color: var(--text-primary);
}

.hero-title span {
  font-style: italic;
  background: linear-gradient(135deg, #8AB4F0 0%, #C59B82 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.light-mode .hero-title span {
  background: linear-gradient(135deg, #14304F 0%, #2B5B9E 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--text-secondary);
  max-width: 68ch;
}

.hero-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ==========================================================================
   KPI Cards Grid (Mobile 1->2->4 cols)
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.18s ease;
}

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

.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.kpi-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.kpi-icon-box {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(43, 91, 158, 0.1);
  border: 1px solid var(--border-brand);
  color: var(--brand-400);
  display: flex;
  align-items: center;
  justify-content: center;
}

body.light-mode .kpi-icon-box {
  color: var(--brand-600);
}

.kpi-metric {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text-primary);
}

.kpi-foot {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.progress-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  overflow: hidden;
  margin-top: 12px;
}

.progress-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--grad-brand);
  transition: width 0.45s ease;
}

/* ==========================================================================
   Section Headers & Panels
   ========================================================================== */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.section-title .icon {
  color: var(--brand-400);
}

.badge-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}

.overview-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* ==========================================================================
   Swarm Topology: Mobile Matrix (<768px) + Desktop Orbital Radar (>=768px)
   ========================================================================== */
.orbital-canvas {
  display: none;
  position: relative;
  height: 390px;
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at center, rgba(43, 91, 158, 0.08) 0%, transparent 65%),
    var(--bg-elevated);
  border: 1px solid var(--border-default);
  overflow: hidden;
}

.orbit-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px dashed var(--border-strong);
  pointer-events: none;
}

.orbit-circle.inner { width: 156px; height: 156px; }
.orbit-circle.outer { width: 296px; height: 296px; opacity: 0.65; }

.orbital-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hub-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: var(--brand-fg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  box-shadow: 0 0 0 6px rgba(43, 91, 158, 0.14), var(--shadow-brand);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.hub-center:hover {
  transform: translate(-50%, -50%) scale(1.05);
}

.hub-center-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.hub-center-role {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8.5px;
  font-weight: 700;
  opacity: 0.82;
}

.orbit-node {
  position: absolute;
  z-index: 4;
  transform: translate(-50%, -50%);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: all 0.18s ease;
  white-space: nowrap;
}

.orbit-node:hover,
.orbit-node.selected {
  border-color: var(--brand-400);
  transform: translate(-50%, -53%);
  box-shadow: var(--shadow-brand);
}

.orbit-node-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.orbit-node-name {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
}

.orbit-node-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  color: var(--text-muted);
}

/* Mobile Swarm Matrix (Shown on Mobile < 768px) */
.mobile-swarm-matrix {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.matrix-hub-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(43, 91, 158, 0.1);
  border: 1px solid var(--border-brand);
}

.matrix-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.matrix-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  cursor: pointer;
}

.inspector-bar {
  margin-top: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Cloud Endpoints List
   ========================================================================== */
.cloud-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cloud-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  transition: border-color 0.16s ease;
}

.cloud-item:hover {
  border-color: var(--border-brand);
}

.cloud-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.cloud-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cloud-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cloud-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cloud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ping-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.ping-badge.down {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

.ext-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-default);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
}

.ext-link-btn:hover {
  border-color: var(--border-brand);
  color: var(--brand-400);
}

/* Daemons Grid */
.daemons-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.daemon-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  font-size: 12.5px;
  font-weight: 600;
}

.daemon-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.daemon-state {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--success);
}

.daemon-state.err {
  color: var(--danger);
}

/* ==========================================================================
   Agents Squad Cards
   ========================================================================== */
.agents-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.agent-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.agent-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-brand);
}

.agent-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.agent-ident {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.agent-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.agent-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}

.role-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
}

.agent-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}

.agent-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
   CI/CD Pipeline & Repositories (Mobile Cards + Desktop Table)
   ========================================================================== */
.pipeline-steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.step-box {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.step-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.step-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(43, 91, 158, 0.14);
  color: var(--brand-400);
  border: 1px solid var(--border-brand);
}

.step-box p {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Mobile Repo Cards */
.repos-cards-mobile {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.repo-card-m {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.repo-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.repo-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.commit-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  background: rgba(43, 91, 158, 0.13);
  color: var(--brand-400);
  border: 1px solid var(--border-brand);
}

body.light-mode .commit-pill {
  color: var(--brand-600);
}

/* Desktop Table */
.repos-table-desktop {
  display: none;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-default);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-default);
  color: var(--text-secondary);
  vertical-align: middle;
}

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

.data-table tr:hover td {
  background: var(--bg-subtle);
}

/* ==========================================================================
   WhatsApp Self-Service Connect Tab
   ========================================================================== */
.wa-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.qr-stage {
  width: 100%;
  max-width: 268px;
  aspect-ratio: 1 / 1;
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  padding: 16px;
  margin: 14px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

.qr-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

.qr-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #27272a;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  padding: 10px;
}

.qr-empty .icon {
  width: 32px;
  height: 32px;
  color: #d97706;
}

.instruction-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.instruction-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
}

.instruction-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(43, 91, 158, 0.14);
  border: 1px solid var(--border-brand);
  color: var(--brand-400);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.instruction-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.instruction-body strong {
  color: var(--text-primary);
}

.instruction-body code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  color: var(--brand-400);
}

body.light-mode .instruction-body code {
  color: var(--brand-600);
}

/* ==========================================================================
   Mobile Bottom Navigation Bar (< 1024px)
   ========================================================================== */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-default);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.bnav-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  position: relative;
  transition: color 0.15s ease;
}

.bnav-btn.active {
  color: var(--brand-400);
}

body.light-mode .bnav-btn.active {
  color: var(--brand-600);
}

.bnav-btn.active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 32px;
  height: 2.5px;
  border-radius: 0 0 4px 4px;
  background: var(--brand-400);
}

/* Tab Visibility */
.tab-view { display: none; }
.tab-view.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: viewFade 0.18s ease-out;
}

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

/* ==========================================================================
   Progressive Responsive Breakpoints (min-width Mobile-First)
   ========================================================================== */

/* >= 640px (Large Phablets / Small Tablets) */
@media (min-width: 640px) {
  .page-content { padding: 20px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .matrix-grid { grid-template-columns: repeat(2, 1fr); }
  .daemons-grid { grid-template-columns: repeat(2, 1fr); }
  .pipeline-steps { grid-template-columns: repeat(2, 1fr); }
  .hero-actions { display: flex; flex-wrap: wrap; }
  .hide-xs { display: inline-flex; }
}

/* >= 768px (Tablets / Small Laptops) */
@media (min-width: 768px) {
  .hero-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 22px 26px;
  }
  .hero-title { font-size: 1.6rem; }
  .clock-group { display: flex; }

  /* Switch Swarm Matrix -> Full Vector Orbital Canvas */
  .mobile-swarm-matrix { display: none; }
  .orbital-canvas { display: block; }

  /* Switch Mobile Repo Cards -> Clean Enterprise Table */
  .repos-cards-mobile { display: none; }
  .repos-table-desktop { display: block; }

  .agents-grid { grid-template-columns: repeat(2, 1fr); }
  .wa-layout { grid-template-columns: 360px 1fr; align-items: start; }
}

/* >= 1024px (Desktop Command Center) */
@media (min-width: 1024px) {
  .app-layout {
    padding-left: var(--sidebar-w);
    padding-bottom: 0;
  }

  .sidebar {
    transform: translateX(0);
    width: var(--sidebar-w);
    z-index: 35;
  }

  .close-drawer-btn,
  #btnOpenDrawer,
  .mobile-brand,
  .bottom-nav,
  .drawer-overlay {
    display: none !important;
  }

  .topbar { padding: 12px 28px; }
  .page-content { padding: 26px 28px 48px; gap: 22px; }
  .daemons-grid { grid-template-columns: repeat(3, 1fr); }
}

/* >= 1280px (Widescreen Executive Display) */
@media (min-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .overview-split { grid-template-columns: 1.15fr 1fr; gap: 20px; }
  .agents-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .pipeline-steps { grid-template-columns: repeat(4, 1fr); }
}

/* ==========================================================================
   v3.2 — QA Mobile-First Hardening (320px → 1440px) + PWA UI
   Root cause fixed: grid tracks `1fr` = minmax(auto,1fr) expanded to the
   min-content of nowrap text (cards up to 492px on a 360px viewport).
   ========================================================================== */
html, body { max-width: 100%; overflow-x: hidden; }
.page-content, .tab-view, .card, .hero-card, .overview-split > *, .kpi-grid > *,
.agents-grid > *, .wa-layout > *, .matrix-item, .cloud-item, .daemon-pill,
.repo-card-m, .agent-card, .instruction-item, .step-box { min-width: 0; }

.kpi-grid, .overview-split, .matrix-grid, .daemons-grid, .agents-grid,
.pipeline-steps, .repos-cards-mobile, .wa-layout { grid-template-columns: minmax(0, 1fr); }
.hero-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hero-actions .btn { min-width: 0; }
.hero-actions .btn span:last-child { overflow: hidden; text-overflow: ellipsis; }

/* Safe text truncation */
.section-title { min-width: 0; flex: 1 1 auto; }
.section-title > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.badge-mono { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.matrix-item > div { flex: 1 1 auto; min-width: 0; }
.orbit-node-icon { flex-shrink: 0; }
.matrix-item .orbit-node-name, .matrix-item .orbit-node-sub,
.matrix-hub-title, .matrix-hub-sub {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.matrix-hub-title { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.matrix-hub-sub { font-size: 11.5px; color: var(--text-secondary); }
.cloud-left { flex: 1 1 auto; }
.cloud-left > div:last-child { min-width: 0; flex: 1 1 auto; }
.daemon-left { flex: 1 1 auto; }
.daemon-left > span:last-child { min-width: 0; }
.agent-ident { min-width: 0; }
.agent-ident > div:last-child { min-width: 0; }
.agent-title, .agent-id { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-footer { gap: 8px; }
.agent-footer > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo-name { min-width: 0; }
.repo-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.instruction-body { min-width: 0; overflow-wrap: anywhere; }
.inspector-bar > * { min-width: 0; }
.inspector-bar > div { flex: 1 1 200px; flex-wrap: wrap; }
.kpi-metric, .kpi-foot { overflow-wrap: anywhere; }

/* Compact, collision-free topbar (mobile-first) */
.topbar { padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); gap: 8px; }
.topbar-left { flex: 1 1 auto; gap: 8px; overflow: hidden; }
.topbar-right { flex: 0 0 auto; gap: 6px; }
.mobile-brand { flex-shrink: 0; }
.mobile-brand img { height: 28px; max-width: 132px; object-fit: contain; }
.status-badge { flex-shrink: 1; min-width: 0; padding: 5px 8px; }
.status-text-full { display: none; }
.status-text-short { display: inline; }
.btn-icon-mobile { width: 38px; padding: 0; }
.btn-pwa {
  min-height: 38px; width: 38px; padding: 0;
  background: rgba(43, 91, 158, 0.12); color: var(--brand-400);
  border: 1px solid var(--border-brand);
}
.btn-pwa:hover { background: rgba(43, 91, 158, 0.2); }
.pwa-btn-label { display: none; }
body.pwa-installed .btn-pwa,
body.pwa-installed .pwa-install-banner,
body.pwa-installed .nav-item-pwa { display: none !important; }

@media (max-width: 399px) {
  .status-text-short { display: none; }
  .status-badge { padding: 7px; }
  .topbar-right > a.btn-primary { display: none; }
}

@media (max-width: 339px) {
  .mobile-brand { display: none; }
}

/* PWA install banner */
.pwa-install-banner {
  display: none;
  align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(253,185,19,0.14), rgba(247,156,9,0.06));
  border: 1px solid var(--border-brand);
  box-shadow: var(--shadow-card);
}
.pwa-install-banner.visible { display: flex; }
.pwa-banner-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.pwa-banner-icon { width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0; border: 1px solid var(--border-strong); }
.pwa-banner-copy { min-width: 0; }
.pwa-banner-title { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.pwa-banner-sub { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.pwa-banner-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 12.5px; }
.icon-btn-sm { width: 32px; height: 32px; }

@media (max-width: 479px) {
  .pwa-install-banner { flex-direction: column; align-items: stretch; }
  .pwa-banner-actions .btn { flex: 1; }
}

/* PWA manual install modal (iOS / browsers sem beforeinstallprompt) */
.pwa-modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,0.62); backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.pwa-modal-backdrop.open { opacity: 1; pointer-events: auto; }
.pwa-modal {
  width: 100%; max-width: 420px;
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl); padding: 18px; box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  transform: translateY(16px); transition: transform 0.22s cubic-bezier(0.16,1,0.3,1);
}
.pwa-modal-backdrop.open .pwa-modal { transform: translateY(0); }
.pwa-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.pwa-modal-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pwa-app-icon { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--border-strong); }
.pwa-modal h3 { font-size: 16px; font-weight: 700; }
.pwa-modal p { font-size: 12.5px; color: var(--text-secondary); }
.pwa-modal-steps { display: flex; flex-direction: column; gap: 8px; }
.pwa-step {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-radius: var(--radius-md);
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  font-size: 13px; color: var(--text-secondary); line-height: 1.45;
}
.pwa-step strong { color: var(--text-primary); }
.pwa-step-num {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700;
  background: rgba(253,185,19,0.14); color: var(--brand-400); border: 1px solid var(--border-brand);
}

/* Standalone (installed app) tweaks */
@media (display-mode: standalone) {
  .pwa-install-banner, .btn-pwa, .nav-item-pwa { display: none !important; }
}

/* Re-declare responsive grids with minmax(0,1fr) */
@media (min-width: 640px) {
  .kpi-grid, .matrix-grid, .daemons-grid, .pipeline-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-actions { display: flex; }
  .btn-icon-mobile { width: auto; padding: 8px 14px; }
  .status-text-short { display: none; }
  .status-text-full { display: inline; }
  .topbar { padding-left: 16px; padding-right: 16px; }
}
@media (min-width: 768px) {
  .agents-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wa-layout { grid-template-columns: 360px minmax(0, 1fr); }
  .btn-pwa { width: auto; padding: 8px 12px; }
  .pwa-btn-label { display: inline; }
}
@media (min-width: 1024px) {
  .daemons-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topbar { padding: 12px 28px; }
}
@media (min-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .overview-split { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .agents-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pipeline-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* QA fix: 768–1023px topbar collision (clocks x install button) */
@media (min-width: 768px) and (max-width: 1023px) {
  .clock-group { display: none; }
}

/* QA fix: hero CTAs truncating on phones < 420px → stack full-width */
@media (max-width: 419px) {
  .hero-actions { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   v3.3 — QA Findings & Visual Evidence Tab + 5-item Mobile Bottom Nav
   ========================================================================== */
.bottom-nav {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
}

.qa-findings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

@media (min-width: 1024px) {
  .qa-findings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.qa-finding-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-width: 0;
}

.qa-finding-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.qa-sev-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.qa-sev-badge.sev-high {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.qa-sev-badge.sev-med {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.qa-status-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(43, 91, 158, 0.14);
  color: var(--brand-400);
  border: 1px solid var(--border-brand);
}

.qa-status-pill.dispatched {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

.qa-finding-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
}

.qa-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.qa-doc-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 12.2px;
  line-height: 1.5;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.qa-doc-box strong {
  color: var(--text-primary);
}

.qa-shots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.qa-shot-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 6px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 11px;
  transition: border-color 0.15s ease;
  min-width: 0;
}

.qa-shot-item:hover {
  border-color: var(--brand-400);
}

.qa-shot-item img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  object-position: top center;
  border-radius: 6px;
  background: #000;
}

.qa-shot-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qa-finding-actions {
  margin-top: auto;
  padding-top: 4px;
}

/* ==========================================================================
   v3.4 — Mobile-First Responsive QA Tab & Interactive Image Lightbox Modal
   ========================================================================== */
@media (max-width: 1023px) {
  body[data-active-tab="qa"] .hero-card,
  body[data-active-tab="agents"] .hero-card,
  body[data-active-tab="pipeline"] .hero-card,
  body[data-active-tab="whatsapp"] .hero-card {
    display: none !important;
  }
}

.qa-header-bar {
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qa-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.qa-header-sub {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.qa-filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-top: 2px;
  scrollbar-width: none;
}
.qa-filter-pills::-webkit-scrollbar {
  display: none;
}

.qa-pill {
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 12px;
  min-height: 34px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.qa-pill.active {
  background: rgba(43, 91, 158, 0.16);
  color: var(--brand-400);
  border-color: var(--border-brand);
}

.qa-head-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.qa-meta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

@media (min-width: 480px) {
  .qa-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.qa-meta-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.qa-meta-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 700;
}

.qa-meta-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qa-shots-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 359px) {
  .qa-shots-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

button.qa-shot-item {
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

button.qa-shot-item:hover,
button.qa-shot-item:focus-visible {
  border-color: var(--brand-400);
  transform: translateY(-1px);
}

.qa-shot-thumb-wrap {
  position: relative;
  width: 100%;
  height: 118px;
  border-radius: 6px;
  overflow: hidden;
  background: #050507;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.qa-shot-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.qa-zoom-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(9, 9, 11, 0.86);
  backdrop-filter: blur(6px);
  color: var(--brand-400);
  border: 1px solid var(--border-brand);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.qa-shot-caption {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.qa-doc-item + .qa-doc-item {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-default);
}

.qa-dispatch-btn {
  width: 100%;
  min-height: 40px;
  font-size: 12.5px;
}

/* Lightbox Fullscreen Overlay */
.qa-lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(5, 5, 8, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: none;
  flex-direction: column;
}

.qa-lightbox-backdrop.open {
  display: flex;
}

.qa-lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(15, 15, 20, 0.9);
  border-bottom: 1px solid var(--border-default);
  min-width: 0;
}

.qa-lightbox-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.qa-lightbox-caption {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qa-lightbox-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.qa-lb-close {
  border-color: var(--border-brand) !important;
  color: var(--brand-400) !important;
}

.qa-lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 16px;
  cursor: zoom-out;
}

.qa-lightbox-stage img {
  max-width: 96%;
  max-height: calc(100vh - 96px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--border-brand);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
  cursor: zoom-in;
  transition: transform 0.2s ease;
}

.qa-lightbox-stage img.zoomed {
  max-width: none;
  max-height: none;
  width: min(1200px, 185vw);
  cursor: zoom-out;
}


/* ==========================================================================
   v3.5 — Critical Fix: Mobile Drawer Stacking Context & Blur Overlay Bug
   Root cause: .drawer-overlay (z-index: 45, backdrop-filter: blur(4px)) was a
   direct child of <body>, while .sidebar (z-index: 50) was inside .app-layout
   (position: relative; z-index: 1). Because .app-layout created a root stacking
   context at z-index: 1, .drawer-overlay (45 > 1) painted ON TOP of .sidebar,
   blurring and blocking the entire mobile sidebar menu!
   ========================================================================== */
.app-layout {
  z-index: auto !important;
}

.drawer-overlay {
  z-index: 90 !important;
  background: rgba(0, 0, 0, 0.68) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.sidebar {
  z-index: 100 !important;
  box-shadow: 16px 0 48px rgba(0, 0, 0, 0.75);
}

@media (min-width: 1024px) {
  .sidebar {
    z-index: 35 !important;
    box-shadow: none;
  }
}

html, body {
  max-width: 100% !important;
  overflow-x: hidden !important;
}
.table-wrap, .panel, .card {
  max-width: 100% !important;
  overflow-x: auto !important;
}

@media (max-width: 768px) {
  .data-table {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    box-sizing: border-box !important;
  }
}


/* L'Essence Bio Official Trust Pillars Strip */
.lessence-trust-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 24px;
  padding: 16px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}
.trust-pillar-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 12px 14px;
}
.trust-pillar-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: #2B5B9E;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.trust-pillar-title {
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.trust-pillar-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.35;
  margin-top: 2px;
}
@media (max-width: 1100px) {
  .lessence-trust-bar {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .lessence-trust-bar {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 10px;
  }
}


/* Official L'Essence Bio HeaderFinal.tsx Wordmark + 3D Glass Helix */
.lessence-wordmark-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.lessence-helix-img {
  height: 36px;
  width: 26px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 8px rgba(20, 48, 79, 0.2));
}
.lessence-helix-sm {
  height: 28px;
  width: 20px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(20, 48, 79, 0.18));
}
.lessence-wordmark-col {
  display: flex;
  flex-direction: column;
  line-height: 1;
  min-width: 0;
}
.lessence-wordmark-top {
  display: flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}
.lessence-w-main {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}
.lessence-w-bio {
  font-family: 'Manrope', sans-serif;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #2B5B9E;
}
.lessence-w-sub {
  font-family: 'Manrope', sans-serif;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
  margin-top: 3px;
  white-space: nowrap;
}
.lessence-w-main-sm {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-primary);
}
.lessence-w-bio-sm {
  font-family: 'Manrope', sans-serif;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #2B5B9E;
}

/* ==========================================================================
   v3.4 — L'Essence Bio Bespoke Executive Modules (Clinical Luxury & RUO)
   ========================================================================== */

/* D. 1-Click Executive Navigation & Quick Links Bar */
.lessence-quicklinks-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.quicklink-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  color: var(--text-primary);
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  transition: all 0.18s ease;
  white-space: nowrap;
}

.quicklink-pill:hover {
  border-color: #2B5B9E;
  color: #2B5B9E;
  transform: translateY(-1px);
}

.quicklink-pill.primary {
  background: #14304F;
  color: #FBF8F4;
  border-color: #14304F;
}

.quicklink-pill.primary:hover {
  background: #1E436E;
  color: #FFFFFF;
}

/* C. Compliance & Cold-Chain UK/EU Telemetry Grid */
.lessence-compliance-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.compliance-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}

.compliance-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.compliance-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.compliance-status-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.32);
  white-space: nowrap;
}

.compliance-val {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compliance-meta {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.compliance-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.mini-ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid var(--border-default);
  background: var(--bg-canvas);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mini-ctrl-btn:hover {
  border-color: #2B5B9E;
  color: #2B5B9E;
}

/* A & B. Biotech Executive Split (Catalog Matrix + Quick-Calc) */
.biotech-executive-split {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.currency-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-canvas);
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border-default);
}

.curr-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.curr-btn.active {
  background: #14304F;
  color: #FBF8F4;
}

.ruo-batches-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ruo-batch-card {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ruo-batch-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.ruo-purity-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(43, 91, 158, 0.12);
  color: #2B5B9E;
  border: 1px solid rgba(43, 91, 158, 0.28);
}

.ruo-price-tag {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}

.ruo-batch-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-primary);
}

.ruo-batch-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.ruo-batch-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px dashed var(--border-default);
}

.ruo-verif-text {
  font-size: 11px;
  font-weight: 600;
  color: #059669;
}

.ruo-batch-links {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ruo-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
}

.ruo-link-chip.primary {
  background: #14304F;
  color: #FBF8F4;
  border-color: #14304F;
}

/* B. Executive Quick-Calc Widget */
.quick-calc-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quick-calc-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

.calc-presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.calc-preset-chip {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border-default);
  background: var(--bg-canvas);
  color: var(--text-primary);
  cursor: pointer;
}

.calc-preset-chip.active {
  background: #14304F;
  color: #FBF8F4;
  border-color: #14304F;
}

.calc-inputs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.calc-field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

.calc-field input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-default);
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
}

.calc-results-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.calc-res-box {
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.calc-res-box.primary {
  background: #14304F;
  color: #FBF8F4;
  border-color: #14304F;
}

.calc-res-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.82;
}

.calc-res-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 800;
}

.calc-res-sub {
  font-size: 11px;
  opacity: 0.85;
}

.calc-syringe-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.calc-syringe-scale {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-secondary);
}

.calc-syringe-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  overflow: hidden;
  padding: 1px;
}

.calc-syringe-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #14304F 0%, #2B5B9E 60%, #38bdf8 100%);
  transition: width 0.25s ease;
}

.calc-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-default);
}

.calc-ruo-note {
  font-size: 11px;
  color: var(--text-secondary);
}

.calc-full-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
  color: #2B5B9E;
  text-decoration: none;
}

@media (max-width: 1180px) {
  .lessence-compliance-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .biotech-executive-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .lessence-compliance-grid {
    grid-template-columns: 1fr;
  }
  .calc-inputs-grid,
  .calc-results-panel {
    grid-template-columns: 1fr;
  }
  .quicklink-pill {
    font-size: 11px;
    padding: 5px 10px;
  }
}
