/* ============================================================
   ZEEPY PRO - COMPONENT LIBRARY v3
   Sparkline · PeriodPills · FilterPills · Table · EmptyState
   Skeleton · Toast · CommandPalette · Chart · Tooltip · Modal
   ============================================================ */

/* ============================================================
   1. SPARKLINE
   Mini chart inline, utilisé dans les KPI cards et tables
   ============================================================ */

.sparkline {
  display: inline-block;
  width: 100%;
  height: 32px;
  vertical-align: middle;
}

.sparkline svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.sparkline-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 2px currentColor);
  opacity: 0.95;
}

.sparkline-line.up { stroke: var(--success); }
.sparkline-line.down { stroke: var(--error); }
.sparkline-line.cool { stroke: var(--accent-cool); }

.sparkline-fill {
  fill: var(--primary);
  opacity: 0.18;
}

.sparkline-fill.up { fill: var(--success); }
.sparkline-fill.down { fill: var(--error); }
.sparkline-fill.cool { fill: var(--accent-cool); }

.sparkline-dot {
  fill: #fff;
  stroke: var(--primary);
  stroke-width: 2;
  r: 3;
  filter: drop-shadow(0 0 8px var(--primary));
}

/* End dot animé (live indicator) */
@keyframes sparkline-end-pulse {
  0%, 100% {
    r: 3;
    opacity: 1;
  }
  50% {
    r: 5;
    opacity: 0.7;
  }
}

.sparkline-end-dot {
  fill: var(--accent-cool);
  filter: drop-shadow(0 0 4px var(--accent-cool));
  animation: sparkline-end-pulse 2s ease-in-out infinite;
}

.sparkline-end-dot.up { fill: var(--success); filter: drop-shadow(0 0 4px var(--success)); }
.sparkline-end-dot.down { fill: var(--error); filter: drop-shadow(0 0 4px var(--error)); }

/* ============================================================
   2. PERIOD PILLS (1J / 7J / 30J / 90J / 1A / Tout)
   Au-dessus des charts
   ============================================================ */

.period-pills {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 2px;
}

.period-pill {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
  white-space: nowrap;
}

.period-pill:hover {
  color: var(--text-primary);
}

.period-pill.active {
  background: var(--primary);
  color: var(--text-on-primary);
  font-weight: var(--fw-semibold);
}

/* ============================================================
   3. FILTER PILLS (cumulables, removable)
   Au-dessus des tables et grids
   ============================================================ */

.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.filter-pill:hover {
  border-color: var(--primary);
  color: var(--text-primary);
}

.filter-pill.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.filter-pill-icon {
  display: inline-flex;
  align-items: center;
}

.filter-pill-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  opacity: 0;
  transition: all var(--duration-fast) var(--ease-smooth);
  margin-left: 4px;
}

.filter-pill.active .filter-pill-remove {
  opacity: 0.7;
}

.filter-pill-remove:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.filter-pill-reset {
  color: var(--text-muted);
  font-size: var(--fs-body-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
}

.filter-pill-reset:hover {
  color: var(--text-primary);
}

/* ============================================================
   4. TABLE (sortable + hover + drilldown)
   ============================================================ */

.z-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  /* Scroll horizontal propre au lieu de tronquer la table sur mobile (retour beta). */
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.z-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-body-md);
}
/* Sur petit écran, on garde des colonnes lisibles et on laisse scroller. */
@media (max-width: 640px) {
  .z-table { min-width: 580px; }
}

.z-table thead {
  background: var(--bg-elevated);
}

.z-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-overline);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-overline);
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  user-select: none;
}

.z-table th.sortable {
  cursor: pointer;
  position: relative;
  padding-right: var(--space-6);
  transition: color var(--duration-fast) var(--ease-smooth);
}

.z-table th.sortable:hover {
  color: var(--text-primary);
}

.z-table th.sortable::after {
  content: '⇅';
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.4;
  font-size: 12px;
}

.z-table th.sorted-asc::after { content: '↑'; opacity: 1; color: var(--primary); }
.z-table th.sorted-desc::after { content: '↓'; opacity: 1; color: var(--primary); }

.z-table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.z-table tbody tr {
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-smooth);
  position: relative;
}

.z-table tbody tr:hover {
  background: var(--bg-hover);
}

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

/* Action button qui apparaît au hover row */
.z-table-action {
  opacity: 0;
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary);
  color: var(--text-on-primary);
  border: none;
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: opacity var(--duration-fast) var(--ease-smooth);
}

.z-table tbody tr:hover .z-table-action {
  opacity: 1;
}

/* Checkbox de sélection */
.z-table-checkbox {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-default);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  appearance: none;
  position: relative;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.z-table-checkbox:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.z-table-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid var(--text-on-primary);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Bulk actions bar (apparaît quand des rows sont sélectionnées) */
.z-table-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--primary-soft);
  border-bottom: 1px solid var(--border-strong);
}

.z-table-bulk-count {
  font-size: var(--fs-body-sm);
  color: var(--primary);
  font-weight: var(--fw-semibold);
}

.z-table-bulk-actions {
  display: flex;
  gap: var(--space-2);
}

/* Cell types spécifiques */
.cell-thumb {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.cell-thumb-img {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  overflow: hidden;
  flex-shrink: 0;
}

.cell-thumb-info {
  min-width: 0;
}

.cell-thumb-info strong {
  display: block;
  font-size: var(--fs-body-md);
  line-height: var(--lh-snug);
  margin-bottom: 2px;
}

.cell-thumb-info span {
  display: block;
  font-size: var(--fs-body-sm);
  color: var(--text-muted);
}

.cell-metric {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}

.cell-metric-bad {
  color: var(--error);
}

.cell-metric-good {
  color: var(--success);
}

/* ============================================================
   5. EMPTY STATE (avec astronaute)
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-16) var(--space-6);
  text-align: center;
}

.empty-state-icon {
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  border-radius: 50%;
  margin-bottom: var(--space-2);
  position: relative;
}

.empty-state-icon::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px dashed var(--border-default);
  animation: spin-slow 30s linear infinite;
}

@keyframes spin-slow {
  to { transform: rotate(360deg); }
}

.empty-state-title {
  font-size: var(--fs-heading-md);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}

.empty-state-desc {
  font-size: var(--fs-body-md);
  color: var(--text-secondary);
  max-width: 400px;
}

.empty-state-action {
  margin-top: var(--space-3);
}

/* ============================================================
   6. SKELETON (loading silhouettes)
   ============================================================ */

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}

.skeleton {
  background: linear-gradient(90deg,
    var(--bg-card) 0%,
    var(--bg-hover) 50%,
    var(--bg-card) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text { height: 14px; width: 100%; margin: 4px 0; }
.skeleton-text-lg { height: 24px; width: 60%; margin: 6px 0; }
.skeleton-text-sm { height: 12px; width: 40%; margin: 4px 0; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-thumb { width: 40px; height: 40px; border-radius: var(--radius-sm); }
.skeleton-card { height: 120px; border-radius: var(--radius-lg); }
.skeleton-chart { height: 240px; border-radius: var(--radius-md); }
.skeleton-kpi {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: var(--space-6);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

/* ============================================================
   7. TOAST (feedback)
   ============================================================ */

.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  min-width: 320px;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s var(--ease-out-expo) both;
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
}

.toast.toast-success::before { background: var(--success); }
.toast.toast-warning::before { background: var(--warning); }
.toast.toast-error::before { background: var(--error); }

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--primary);
  margin-top: 2px;
}

.toast.toast-success .toast-icon { color: var(--success); }
.toast.toast-warning .toast-icon { color: var(--warning); }
.toast.toast-error .toast-icon { color: var(--error); }

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: var(--fs-body-md);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.toast-desc {
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: var(--space-2);
}

.toast-close:hover { color: var(--text-primary); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px); }
}

.toast.toast-exit {
  animation: toast-out 0.2s var(--ease-smooth) forwards;
}

/* ============================================================
   8. COMMAND PALETTE (Cmd+K)
   ============================================================ */

.cmd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.7);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 120px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease-smooth);
}

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

.cmd-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  box-shadow: var(--shadow-lg), 0 0 60px var(--primary-glow);
  overflow: hidden;
  transform: translateY(-20px);
  transition: transform var(--duration-normal) var(--ease-out-expo);
}

.cmd-overlay.open .cmd-panel {
  transform: translateY(0);
}

.cmd-input-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: var(--fs-body-lg);
  color: var(--text-primary);
}

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

.cmd-shortcut {
  font-family: var(--font-mono);
  font-size: var(--fs-overline);
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
}

.cmd-results {
  max-height: 400px;
  overflow-y: auto;
  padding: var(--space-2);
}

.cmd-group-title {
  font-size: var(--fs-overline);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-overline);
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-3) var(--space-3) var(--space-2);
}

.cmd-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.cmd-item:hover,
.cmd-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.cmd-item-icon {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.cmd-item:hover .cmd-item-icon,
.cmd-item.active .cmd-item-icon {
  color: var(--primary);
}

.cmd-item-label {
  flex: 1;
  font-size: var(--fs-body-md);
}

.cmd-item-shortcut {
  font-family: var(--font-mono);
  font-size: var(--fs-body-sm);
  color: var(--text-muted);
}

.cmd-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-body-sm);
  color: var(--text-muted);
}

.cmd-footer-hints {
  display: flex;
  gap: var(--space-4);
}

.cmd-footer-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cmd-key {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  color: var(--text-secondary);
}

/* ============================================================
   9. CHART CONTAINER (ApexCharts wrapper)
   ============================================================ */

.z-chart-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.z-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.z-chart-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.z-chart-title {
  font-size: var(--fs-heading-md);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}

.z-chart-subtitle {
  font-size: var(--fs-body-sm);
  color: var(--text-muted);
}

.z-chart-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.z-chart-canvas {
  min-height: 240px;
  position: relative;
}

/* ApexCharts theme overrides (dark Zeepy) */
.apexcharts-canvas { background: transparent !important; }
.apexcharts-tooltip {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-md), 0 0 24px var(--primary-glow) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-sans) !important;
}
.apexcharts-tooltip.apexcharts-theme-dark { background: var(--bg-elevated) !important; }
.apexcharts-tooltip-title {
  background: transparent !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  font-family: var(--font-sans) !important;
  font-weight: var(--fw-semibold) !important;
}
.apexcharts-xaxistooltip,
.apexcharts-yaxistooltip {
  background: var(--bg-elevated) !important;
  border-color: var(--border-default) !important;
  color: var(--text-primary) !important;
}
.apexcharts-xaxis line,
.apexcharts-yaxis line { stroke: var(--hud-grid) !important; }
.apexcharts-gridline { stroke: var(--hud-grid) !important; stroke-dasharray: 4 !important; }
.apexcharts-text tspan { fill: var(--text-muted) !important; font-family: var(--font-sans) !important; }
.apexcharts-legend-text { color: var(--text-secondary) !important; font-family: var(--font-sans) !important; }
.apexcharts-tooltip-marker { width: 8px !important; height: 8px !important; }
.apexcharts-menu {
  background: var(--bg-elevated) !important;
  border-color: var(--border-default) !important;
  color: var(--text-primary) !important;
}
.apexcharts-menu-item:hover { background: var(--bg-hover) !important; }

/* Glow filter sur les paths/séries (subtil, signature) */
.z-chart-wrap .apexcharts-line-series path,
.z-chart-wrap .apexcharts-area-series .apexcharts-area path {
  filter: drop-shadow(0 0 3px rgba(73, 151, 208, 0.35));
}

.z-chart-wrap .apexcharts-bar-series path {
  filter: drop-shadow(0 0 4px rgba(73, 151, 208, 0.25));
}

.z-chart-wrap .apexcharts-pie .apexcharts-pie-area {
  filter: drop-shadow(0 0 6px rgba(73, 151, 208, 0.2));
}

.z-chart-wrap .apexcharts-radialbar path.apexcharts-radialbar-area {
  filter: drop-shadow(0 0 6px rgba(73, 151, 208, 0.35));
}

/* Marker au point survolé : glow plus visible (c'est le focus) */
.z-chart-wrap .apexcharts-marker {
  filter: drop-shadow(0 0 4px rgba(125, 211, 252, 0.6));
}

/* Crosshair (dashed line verticale au hover) plus visible */
.z-chart-wrap .apexcharts-xcrosshairs {
  stroke: var(--accent-cool) !important;
  stroke-width: 1.5 !important;
  stroke-dasharray: 4 !important;
  opacity: 0.7 !important;
  filter: drop-shadow(0 0 6px var(--accent-cool)) !important;
}

/* Live marker au bout d'une line chart (pulse) */
.apexcharts-marker.chart-live-marker {
  transform-origin: center;
  transform-box: fill-box;
  animation: chart-live-pulse 1.8s ease-in-out infinite;
  filter: drop-shadow(0 0 6px var(--accent-cool)) drop-shadow(0 0 12px var(--accent-cool));
}

@keyframes chart-live-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.6); opacity: 0.85; }
}

/* Peak label (badge "PEAK · 612K" sur le pic) */
.apexcharts-point-annotation-label,
.apexcharts-xaxis-annotation-label,
.apexcharts-yaxis-annotation-label {
  font-family: var(--font-mono) !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
}

/* Annotation lines (target, avg) plus marquées */
.apexcharts-annotation-rect,
.apexcharts-yaxis-annotation line,
.apexcharts-xaxis-annotation line {
  filter: drop-shadow(0 0 4px currentColor);
}

/* Orbital chart wrap (custom SVG signature) */
.z-orbital-wrap {
  background:
    radial-gradient(circle at center, rgba(73, 151, 208, 0.06) 0%, transparent 60%),
    var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
}

.z-orbital-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(800px circle at 20% 30%, rgba(125, 211, 252, 0.04), transparent 50%),
    radial-gradient(600px circle at 80% 70%, rgba(73, 151, 208, 0.04), transparent 50%);
  pointer-events: none;
}

.z-orbital-canvas {
  min-height: 400px;
  position: relative;
}

/* ============================================================
   SCORE RINGS (signature Zeepy) - chart + legend stack
   ============================================================ */

.sr-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 1fr);
  gap: var(--space-8);
  align-items: center;
}

@media (max-width: 768px) {
  .sr-wrap { grid-template-columns: 1fr; }
}

.sr-chart-area {
  min-height: 380px;
  position: relative;
}

.sr-chart-area svg [data-ring] {
  transition: opacity 0.25s var(--ease-smooth);
}

.sr-legend {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.sr-item {
  display: grid;
  grid-template-columns: 12px auto auto 1fr auto;
  gap: var(--space-3);
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
  background: transparent;
  border: 1px solid transparent;
}

.sr-item:hover,
.sr-item.is-active {
  background: var(--bg-elevated);
  border-color: var(--border-default);
}

.sr-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sr-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.sr-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-primary);
  white-space: nowrap;
}

.sr-bar {
  height: 4px;
  background: var(--bg-elevated);
  border-radius: var(--radius-pill);
  overflow: hidden;
  min-width: 60px;
}

.sr-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 1s var(--ease-out-expo);
  animation: sr-bar-grow 1.2s var(--ease-out-expo) both;
  transform-origin: left center;
}

@keyframes sr-bar-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.sr-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  white-space: nowrap;
}

.sr-max {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: 2px;
}

/* Sparkline planet style (planet dot at end of sparkline KPI) */
.sparkline-line {
  /* Already has glow from earlier - kept subtle */
}

/* Chart wrap featured : halo lumineux autour */
.z-chart-wrap.featured {
  background:
    linear-gradient(135deg, rgba(73, 151, 208, 0.04) 0%, transparent 50%),
    var(--bg-card);
  box-shadow:
    0 0 0 1px var(--border-strong),
    0 16px 48px rgba(0, 0, 0, 0.4),
    0 0 64px rgba(73, 151, 208, 0.18);
  border: none;
}

/* Chart canvas avec hud-grid background subtil */
.z-chart-canvas.hud {
  background-image:
    linear-gradient(var(--hud-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--hud-grid) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
}

/* ============================================================
   10. TOOLTIP (hover info)
   ============================================================ */

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: var(--fs-body-sm);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all var(--duration-fast) var(--ease-smooth);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-md);
  z-index: 100;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   11. MODAL
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.7);
  backdrop-filter: blur(8px);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease-smooth);
}

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

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg), 0 0 60px var(--primary-glow);
  transform: scale(0.95);
  transition: transform var(--duration-normal) var(--ease-out-expo);
  overflow: hidden;
}

.modal-overlay.open .modal { transform: scale(1); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: var(--fs-heading-md);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-5);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
}

/* ============================================================
   12. KPI CARD (proprietary futuristic v4)
   Aurora border sur featured · Big mono glow · Cursor follow
   ============================================================ */

.z-kpi {
  background:
    linear-gradient(135deg, rgba(73, 151, 208, 0.03) 0%, transparent 50%),
    var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: all 0.4s var(--ease-out-expo);
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.z-kpi::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    400px circle at var(--mouse-x, 50%) var(--mouse-y, 0%),
    rgba(73, 151, 208, 0.15),
    transparent 50%
  );
  opacity: 0;
  transition: opacity 0.4s var(--ease-smooth);
  pointer-events: none;
  z-index: 0;
}

.z-kpi::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 60%;
  height: 200%;
  background: linear-gradient(115deg, transparent 30%, rgba(125, 211, 252, 0.08) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.8s var(--ease-out-expo);
  pointer-events: none;
  z-index: 0;
}

.z-kpi > * { position: relative; z-index: 1; }

.z-kpi:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 48px rgba(73, 151, 208, 0.18);
}

.z-kpi:hover::before { opacity: 1; }
.z-kpi:hover::after { transform: translateX(180%); }

.z-kpi-label {
  font-size: var(--fs-overline);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-overline);
  text-transform: uppercase;
  color: var(--text-muted);
}

.z-kpi-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}

.z-kpi-number {
  font-family: var(--font-mono);
  font-size: 42px;
  font-weight: var(--fw-bold);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 32px rgba(255, 255, 255, 0.08);
}

.z-kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-semibold);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
}

.z-kpi-delta.up {
  background: var(--success-soft);
  color: var(--success);
  box-shadow: 0 0 16px var(--success-glow);
}

.z-kpi-delta.down {
  background: var(--error-soft);
  color: var(--error);
  box-shadow: 0 0 16px var(--error-glow);
}

.z-kpi-delta.neutral {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.z-kpi-spark {
  height: 40px;
  margin: var(--space-3) 0 var(--space-2);
  position: relative;
}

.z-kpi-spark .sparkline-line {
  filter: drop-shadow(0 0 6px currentColor);
}

.z-kpi-compare {
  font-size: var(--fs-body-sm);
  color: var(--text-muted);
}

/* Featured : aurora border + accent cool number + glow halo */
.z-kpi.featured {
  background:
    linear-gradient(135deg, rgba(73, 151, 208, 0.06) 0%, transparent 50%),
    var(--bg-card);
  border-color: transparent;
  position: relative;
}

.z-kpi.featured::before {
  content: '';
  position: absolute;
  inset: -1.5px;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--aurora-angle, 0deg),
    transparent 0deg,
    var(--primary) 60deg,
    var(--accent-cool) 120deg,
    transparent 180deg,
    transparent 270deg,
    var(--primary) 330deg,
    transparent 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: aurora-rotate 6s linear infinite;
  pointer-events: none;
  opacity: 1;
  z-index: 0;
}

.z-kpi.featured .z-kpi-number {
  background: linear-gradient(135deg, var(--accent-cool) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 24px var(--primary-glow));
}

/* ============================================================
   13. AVATAR (standardized)
   ============================================================ */

.z-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent-cool));
  color: var(--text-on-primary);
  font-weight: var(--fw-bold);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.z-avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.z-avatar.md { width: 32px; height: 32px; font-size: 13px; }
.z-avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.z-avatar.xl { width: 56px; height: 56px; font-size: 18px; }

.z-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.z-avatar-online::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 25%;
  height: 25%;
  background: var(--success);
  border: 2px solid var(--bg-page);
  border-radius: 50%;
}

/* ============================================================
   14. TABS
   ============================================================ */

.z-tabs {
  display: inline-flex;
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--space-2);
}

.z-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: var(--fs-body-md);
  font-weight: var(--fw-medium);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  position: relative;
  transition: color var(--duration-fast) var(--ease-smooth);
}

.z-tab:hover {
  color: var(--text-primary);
}

.z-tab.active {
  color: var(--primary);
  font-weight: var(--fw-semibold);
}

.z-tab.active::after {
  content: '';
  position: absolute;
  left: var(--space-3);
  right: var(--space-3);
  bottom: -1px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

/* ============================================================
   15. ASTRONAUTE COMPAGNON (signature Zeepy #1)
   Mascotte fixée en bas qui réagit aux données
   ============================================================ */

.astro-companion {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 6px;
  z-index: 90;
  pointer-events: none;
}

.astro-companion-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  pointer-events: auto;
  width: 100%;
  max-width: 360px;
}

.astro-bubble {
  background: var(--bg-elevated);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  padding-right: var(--space-8);
  max-width: 320px;
  font-size: var(--fs-body-sm);
  color: var(--text-primary);
  line-height: var(--lh-snug);
  position: relative;
  backdrop-filter: blur(20px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5), 0 0 32px var(--primary-glow);
  animation: bubble-in 0.5s var(--ease-out-expo) both;
  background-clip: padding-box;
  isolation: isolate;
}

.astro-bubble::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--primary), var(--accent-cool), transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.astro-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  right: 84px;
  width: 18px;
  height: 18px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-strong);
  border-right: 1px solid var(--border-strong);
  transform: rotate(45deg);
  z-index: 1;
}

.astro-bubble-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-overline);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-overline);
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
}

.astro-bubble-title-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cool);
  box-shadow: 0 0 6px var(--accent-cool);
  animation: pulse-dot 2s ease-in-out infinite;
}

.astro-bubble-msg {
  font-weight: var(--fw-medium);
}

.astro-bubble-actions {
  margin-top: var(--space-3);
  display: flex;
  gap: var(--space-2);
}

.astro-bubble-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.astro-bubble-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.astro-img-wrap {
  pointer-events: auto;
  cursor: pointer;
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter:
    drop-shadow(0 22px 40px rgba(73, 151, 208, 0.5))
    drop-shadow(0 0 28px rgba(125, 211, 252, 0.4))
    drop-shadow(0 0 12px rgba(52, 211, 153, 0.18));
}

/* Anneaux pulsés derrière l'astronaute (radar) */
.astro-img-wrap::before,
.astro-img-wrap::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90px;
  height: 90px;
  margin-top: -45px;
  margin-left: -45px;
  border-radius: 50%;
  border: 1.5px solid rgba(125, 211, 252, 0.4);
  animation: astro-radar 3.4s ease-out infinite;
  pointer-events: none;
  z-index: 0;
}
.astro-img-wrap::after {
  animation-delay: 1.2s;
  border-color: rgba(125, 211, 252, 0.32);
}

@keyframes astro-radar {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.4); opacity: 0; }
}

.astro-img-wrap img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s var(--ease-out-expo);
  animation: astro-idle 5s ease-in-out infinite;
}

.astro-img-wrap:hover img { transform: scale(1.06); }

/* Dot vert "en ligne" en bas-droite de l'astronaute */
.astro-status-dot {
  position: absolute;
  bottom: 22px;
  right: 24px;
  z-index: 3;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--success);
  border: 2.5px solid #030712;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.8);
}

@keyframes astro-idle {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-6px) rotate(2deg); }
}

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

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

/* Moods : filter drop-shadow épouse la silhouette */
.astro-mood-happy { filter: drop-shadow(0 0 12px var(--success-glow)) drop-shadow(0 0 4px var(--success)); }
.astro-mood-neutral { filter: drop-shadow(0 0 12px var(--primary-glow)) drop-shadow(0 0 4px var(--primary)); }
.astro-mood-concerned { filter: drop-shadow(0 0 12px rgba(251,191,36,0.4)) drop-shadow(0 0 4px var(--warning)); }
.astro-mood-alert { filter: drop-shadow(0 0 12px var(--error-glow)) drop-shadow(0 0 4px var(--error)); }
.astro-mood-thinking { filter: drop-shadow(0 0 12px var(--accent-cool-soft)) drop-shadow(0 0 4px var(--accent-cool)); }

/* ============================================================
   16. COCKPIT FRAME (signature Zeepy #3)
   Bezels viewfinder + HUD bar + scan boot
   ============================================================ */

.cockpit-frame {
  position: relative;
  isolation: isolate;
}

.cockpit-frame .corner {
  position: absolute;
  width: 28px;
  height: 28px;
  pointer-events: none;
  z-index: 5;
}

.cockpit-frame .corner-tl { top: 12px; left: 12px; border-top: 1.5px solid var(--primary); border-left: 1.5px solid var(--primary); }
.cockpit-frame .corner-tr { top: 12px; right: 12px; border-top: 1.5px solid var(--primary); border-right: 1.5px solid var(--primary); }
.cockpit-frame .corner-bl { bottom: 12px; left: 12px; border-bottom: 1.5px solid var(--primary); border-left: 1.5px solid var(--primary); }
.cockpit-frame .corner-br { bottom: 12px; right: 12px; border-bottom: 1.5px solid var(--primary); border-right: 1.5px solid var(--primary); }

/* HUD bar (coordonnées au top center) */
.cockpit-hud {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  z-index: 10;
  padding: 6px 14px;
  background: var(--bg-elevated);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(20px);
}

.cockpit-hud-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success-glow);
  animation: pulse-dot 2s ease-in-out infinite;
}

.cockpit-hud-sep {
  color: var(--text-muted);
  opacity: 0.3;
}

/* Mission badge bottom-right (fixed corner) */
.mission-badge {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 80;
  backdrop-filter: blur(20px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.mission-badge strong {
  color: var(--primary);
  font-weight: var(--fw-bold);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.mission-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mission-badge-status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success-glow);
}

/* Boot sequence (scan-line + light flash sur load) */
.boot-sequence {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

.boot-sequence::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(180deg, transparent, var(--accent-cool), transparent);
  box-shadow: 0 0 32px var(--accent-cool), 0 0 64px rgba(125,211,252,0.5);
  animation: boot-scan 1.4s var(--ease-out-expo) forwards;
}

.boot-sequence::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 0%, rgba(73,151,208,0.06) 70%, transparent 100%);
  animation: boot-fade 1.6s ease-out forwards;
}

@keyframes boot-scan {
  0% { top: -3%; opacity: 1; }
  90% { opacity: 1; }
  100% { top: 103%; opacity: 0; }
}

@keyframes boot-fade {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Telemetry label : KPI label en monospace coord */
.telemetry-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.telemetry-label::before {
  content: '[';
  color: var(--primary);
  opacity: 0.6;
}

.telemetry-label::after {
  content: ']';
  color: var(--primary);
  opacity: 0.6;
}
