/* ============================================================
   ETF Maison Dynamique — Panel styles
   Editorial-minimal redesign (20260701edit1).
   Principles: flat surfaces (no radius/shadow), hairline dividers,
   strong type scale, cyan reserved for the single focal point
   per view. All class names preserved (JS contract unchanged).
   ============================================================ */

/* ── Panel shell ─────────────────────────────────────────── */

.etf-maison-panel {
  /* local display type scale (kept here so the file is self-contained
     and cache-busted as a unit; tokens.css has no cache-buster). */
  --etf-display: clamp(2.25rem, 5.5vw, 3.25rem);
  --etf-display-tight: clamp(1.75rem, 4.5vw, 2.5rem);
  --etf-label-tracking: 0.12em;

  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  background: var(--card);
  border: none;
  border-radius: 0;
  overflow: hidden;
}

/* Sidebar pliée → la première colonne se rétracte au rail (desktop only ;
   le mobile reste en colonne unique via le bloc @media plus bas). */
@media (min-width: 640px) {
  .etf-maison-panel.is-sidebar-collapsed {
    grid-template-columns: 56px minmax(0, 1fr);
  }
}

/* Flatten the global .card / .neon-card chrome (slot picks them up
   via JS classList). Two-class selectors win over the single-class
   globals in styles.css regardless of source order. */
.etf-maison-panel.card,
.etf-maison-panel.neon-card,
.etf-maison-panel.card.neon-card {
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: var(--card);
}

/* ── Master-detail layout ─────────────────────────────────── */

/* The slot is a flex column (.etf-maison-panel); force the grid child to fill
   it and neutralize the lazy-render sizing that left a gap at the top.
   (#etfMaisonPanelSlot ID == layout.css ID; this file loads later → wins.) */
#etfMaisonPanelSlot {
  content-visibility: visible;
  contain: none;
}

/* Hide the symbol/timeframe selector in ETF mode (irrelevant here). */
.layout-etf-maison .tb-selects { display: none !important; }

/* Mobile: the sidebar collapses to a compact <select> in the detail head. */
.etf-mobile-select { display: none; }

.etf-master-detail {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  flex: 1;
  height: 100%;
  min-height: 0;
}

.etf-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.015);
}
.etf-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.etf-sidebar-head .etf-eyebrow { margin: 0; font-size: var(--text-xs); }
.etf-sidebar-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--sp-2) 0;
}
.etf-sidebar-section { padding: var(--sp-2) var(--sp-3) var(--sp-4); }
.etf-section-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  margin: 0 0 var(--sp-2);
  padding: var(--sp-1) 0 var(--sp-2);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.etf-section-toggle:hover { color: var(--text); }
.etf-section-chevron { font-size: 10px; width: 10px; flex-shrink: 0; }
.etf-section-toggle .etf-section-label {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 10px;
  flex: 1;
  text-align: left;
}
.etf-section-count { font-size: 10px; color: var(--muted); opacity: 0.7; flex-shrink: 0; }
.etf-sidebar-section.is-open .etf-section-chevron,
.etf-sidebar-section.is-open .etf-section-label { color: var(--accent-cyan); }
.etf-sidebar-section-body { padding-top: var(--sp-1); }
.etf-sidebar-collapse {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s, box-shadow 0.14s;
}
.etf-sidebar-collapse:hover {
  color: var(--accent-cyan);
  border-color: rgba(111, 231, 255, 0.45);
  background: rgba(111, 231, 255, 0.08);
  box-shadow: 0 0 14px rgba(111, 231, 255, 0.14);
}
.etf-sidebar-search { padding: 0 var(--sp-3) var(--sp-2); flex-shrink: 0; }
.etf-sidebar-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px var(--sp-2);
  font-size: var(--text-xs);
  font-family: inherit;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
}
.etf-sidebar-search input:focus { outline: none; border-color: var(--accent-cyan); }

/* Rail (sidebar pliée) : n'affiche que les tuiles-icônes + bouton d'extension. */
.etf-sidebar-rail { display: none; }
.etf-sidebar.is-collapsed .etf-sidebar-rail {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(111, 231, 255, 0.06), rgba(0, 0, 0, 0) 16%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012), rgba(255, 255, 255, 0.028));
}

/* Trois zones de la toolbar-rail : poignée (haut) / tuiles (milieu scrollable) / + (bas). */
.etf-rail-top {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: 10px 0 8px;
  border-bottom: 1px solid rgba(145, 160, 178, 0.10);
}
.etf-rail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 0;
  scrollbar-width: thin;
}
.etf-rail-foot {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: 8px 0 12px;
  border-top: 1px solid rgba(145, 160, 178, 0.10);
}

/* Poignée d'ouverture : 3 barres cyan (motif grip partagé avec le rail mobile). */
.etf-rail-grip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.etf-rail-grip span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: #6fe7ff;
  box-shadow: 0 0 6px rgba(111, 231, 255, 0.6);
  transition: width 0.15s, box-shadow 0.15s;
}
.etf-rail-expand:hover .etf-rail-grip span {
  width: 19px;
  box-shadow: 0 0 9px rgba(111, 231, 255, 0.9);
}

/* Bouton « + » (bas) : contour cyan pointillé = « ajouter ». */
.etf-rail-add {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px dashed rgba(111, 231, 255, 0.55);
  border-radius: 11px;
  background: rgba(111, 231, 255, 0.06);
  color: #6fe7ff;
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.etf-rail-add:hover {
  border-color: rgba(111, 231, 255, 0.9);
  background: rgba(111, 231, 255, 0.18);
  box-shadow: 0 0 18px rgba(111, 231, 255, 0.35);
  transform: translateY(-1px);
}
.etf-sidebar.is-collapsed .etf-sidebar-head,
.etf-sidebar.is-collapsed .etf-sidebar-search,
.etf-sidebar.is-collapsed .etf-sidebar-list,
.etf-sidebar.is-collapsed .etf-sidebar-foot { display: none; }

/* Bouton "dépiler" : pastille cyan discrète, même gabarit et langage
   que les tuiles (cohérence rail ↔ bouton). */
.etf-rail-expand {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(111, 231, 255, 0.5);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(111, 231, 255, 0.22), rgba(111, 231, 255, 0.08));
  color: #6fe7ff;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(111, 231, 255, 0.28), inset 0 0 10px rgba(111, 231, 255, 0.12);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.etf-rail-expand:hover {
  border-color: rgba(111, 231, 255, 0.9);
  background: linear-gradient(180deg, rgba(111, 231, 255, 0.34), rgba(111, 231, 255, 0.14));
  box-shadow: 0 0 24px rgba(111, 231, 255, 0.45), inset 0 0 14px rgba(111, 231, 255, 0.2);
  transform: translateX(1px);
}
.etf-rail-group { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.etf-rail-divider { width: 22px; height: 1px; background: var(--border-subtle); margin: 4px 0; opacity: 0.7; }

/* Tuile-lettre : surface remplie arrondie (squircle), plus "appliquée" qu'un
   disque nu. L'actif porte le liseré cyan vertical lumineux = signature
   partagée avec la sidebar dépliée et le rail mobile. */
.etf-rail-tile {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(145, 160, 178, 0.20);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s, box-shadow 0.14s, transform 0.14s;
}
.etf-rail-tile:hover {
  background: rgba(111, 231, 255, 0.18);
  border-color: rgba(111, 231, 255, 0.55);
  color: #fff;
  transform: translateY(-1px);
}
.etf-rail-tile.is-selected {
  color: #fff;
  border-color: rgba(111, 231, 255, 0.9);
  background: linear-gradient(180deg, rgba(111, 231, 255, 0.38), rgba(111, 231, 255, 0.16));
  box-shadow: 0 0 18px rgba(111, 231, 255, 0.45), inset 0 0 12px rgba(111, 231, 255, 0.18);
}
.etf-rail-tile.is-selected::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, transparent, #6fe7ff 25%, #6fe7ff 75%, transparent);
  box-shadow: 0 0 10px rgba(111, 231, 255, 0.9), 0 0 18px rgba(111, 231, 255, 0.5);
}
/* Tuiles "modèle" : contour pointillé pour les distinguer des ETF propres. */
.etf-rail-tile--template {
  font-weight: 500;
  font-style: italic;
  border-style: dashed;
  border-color: rgba(145, 160, 178, 0.42);
  color: var(--muted);
}
.etf-rail-tile--template:hover { border-color: rgba(111, 231, 255, 0.55); }
.etf-sidebar-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: 2px;
  border: none;
  border-left: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  border-radius: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.etf-sidebar-item:hover { background: rgba(145, 160, 178, 0.05); color: var(--text); }
.etf-sidebar-item.is-selected {
  border-left-color: var(--accent-cyan);
  color: var(--text);
  background: linear-gradient(90deg, rgba(111, 231, 255, 0.22), rgba(111, 231, 255, 0.02));
  box-shadow: -2px 0 12px rgba(111, 231, 255, 0.4);
}
.etf-sidebar-item.is-selected .etf-sidebar-item-name { color: #fff; }
.etf-sidebar-item-name { font-size: var(--text-sm); font-weight: 500; }
.etf-sidebar-item-meta { font-size: 10px; color: var(--muted); letter-spacing: 0.02em; }
.etf-sidebar-item--template .etf-sidebar-item-name { color: var(--muted); font-weight: 400; }
.etf-sidebar-item--template:hover .etf-sidebar-item-name { color: var(--text); }
.etf-sidebar-empty { padding: var(--sp-3); font-size: var(--text-xs); color: var(--muted); }
.etf-sidebar-active-actions {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
}
.etf-sidebar-active-actions > span {
  overflow: hidden;
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.etf-sidebar-active-actions > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.etf-sidebar-active-actions .btn {
  min-width: 0;
  padding-inline: 6px;
  font-size: 10px;
}
.etf-sidebar-foot {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.etf-detail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.etf-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding: var(--sp-5) var(--sp-6) var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.etf-detail-title { display: flex; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap; min-width: 0; }
.etf-detail-title strong { font-size: var(--text-xl); font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.etf-detail-name-row { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.etf-detail-name-row strong { min-width: 0; }
.etf-rule-info-btn {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  font: 600 12px/1 inherit;
  cursor: pointer;
  flex-shrink: 0;
}
.etf-rule-info-btn:hover,
.etf-rule-info-btn:focus-visible {
  color: var(--accent-cyan);
  border-color: rgba(111, 231, 255, 0.45);
  outline: none;
}
.etf-detail-sub { font-size: var(--text-xs); }
.etf-detail-actions { display: flex; gap: var(--sp-2); flex-shrink: 0; }
.etf-detail-subnav {
  display: flex;
  gap: 0;
  padding: 0 var(--sp-6);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.etf-detail-subnav[hidden] { display: none; }
.etf-detail-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--sp-6);
}

/* Mobile: sidebar hidden, detail fills; a compact <select> in the detail head
   replaces the in-flow sidebar (cleaner, detail-first on small screens). */
@media (max-width: 639px) {
  .etf-maison-panel {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
  }
  .etf-sidebar { display: none !important; }
  .etf-mobile-select {
    display: block;
    width: 100%;
    margin-bottom: var(--sp-2);
  }
  .etf-detail-head { padding: var(--sp-4); gap: var(--sp-3); }
  .etf-detail-subnav {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--card);
    padding: 0 var(--sp-4);
    overflow-x: auto;
  }
  .etf-detail-subnav .etf-tab-btn { white-space: nowrap; flex-shrink: 0; }
  .etf-detail-body { padding: var(--sp-4); }
}

/* ── Masthead (was gradient hero) ────────────────────────── */

.etf-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-6);
  padding: var(--sp-8) var(--sp-8) var(--sp-5);
  background: transparent;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.etf-hero-text {
  min-width: 0;
}

.etf-eyebrow {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--etf-label-tracking);
  color: var(--muted);
  margin-bottom: var(--sp-2);
}

.etf-title {
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 var(--sp-2);
}

.etf-subtitle {
  font-size: var(--text-sm);
  line-height: 1.55;
  max-width: 540px;
  color: var(--muted);
  margin: 0;
}

.etf-hero-actions {
  display: flex;
  gap: var(--sp-2);
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Tab navigation ──────────────────────────────────────── */

.etf-tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 var(--sp-8);
  flex-shrink: 0;
}

.etf-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  margin-bottom: -1px;
  font-size: var(--text-sm);
  font-family: inherit;
  font-weight: 400;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.etf-tab-btn:hover { color: var(--text); }

.etf-tab-btn.is-active {
  color: var(--text);
  border-bottom-color: var(--accent-cyan);
  font-weight: 500;
}

/* ── Tab panels ──────────────────────────────────────────── */

.etf-tab-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* ── Empty / loading / error states ─────────────────────── */

.etf-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  color: var(--muted);
  font-size: var(--text-sm);
  text-align: center;
  padding: var(--sp-8);
}

.etf-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  color: var(--muted);
  font-size: var(--text-sm);
  animation: etf-pulse 1.4s ease-in-out infinite;
}

@keyframes etf-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

.etf-progress {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-8);
  min-height: 140px;
  align-content: center;
}

.etf-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.etf-progress-head strong {
  font-size: var(--text-sm);
  color: var(--text);
  font-weight: 500;
}

.etf-progress-track {
  width: 100%;
  height: 2px;
  border-radius: 0;
  background: var(--border-subtle);
  overflow: hidden;
  border: none;
}

.etf-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-cyan);
  box-shadow: none;
  transition: width 0.35s ease;
}

.etf-progress-meta {
  font-size: var(--text-xs);
  color: var(--muted);
}

.etf-error {
  color: var(--color-danger);
  background: transparent;
  border-top: 1px solid rgba(255, 110, 180, 0.28);
  border-radius: 0;
  padding: var(--sp-4) 0;
  font-size: var(--text-sm);
}

/* ── Toast ───────────────────────────────────────────────── */

.etf-toast {
  background: transparent;
  border: 1px solid rgba(141, 255, 47, 0.3);
  border-radius: 2px;
  color: var(--color-success);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  font-size: var(--text-sm);
  animation: etf-fade-in 0.2s ease;
}

@keyframes etf-fade-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Rules list ──────────────────────────────────────────── */

.etf-rules-list {
  display: flex;
  flex-direction: column;
}

/* Overview = a quiet editorial stat strip (hairline-separated),
   not a row of bordered cards. */
.etf-rules-overview,
.etf-comp-overview {
  display: grid;
  gap: 0;
  margin-bottom: var(--sp-6);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.etf-comp-overview {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.etf-overview-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-5) var(--sp-5);
  border: none;
  border-left: 1px solid var(--border-subtle);
  border-radius: 0;
  background: transparent;
}

.etf-overview-card:first-child {
  border-left: none;
}

/* The accent card = the single focal point of the Règles view:
   the active rule name, set in the display tier. */
.etf-overview-card--accent {
  border-left: none;
  background: transparent;
}

.etf-overview-card span {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--etf-label-tracking);
  color: var(--muted);
}

.etf-overview-card strong {
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--text);
}

.etf-overview-card--accent strong {
  font-size: var(--etf-display-tight);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.05;
}

.etf-overview-card small {
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: 1.45;
}

/* Rule "cards" become flat editorial rows separated by hairlines. */

.etf-rule-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-5);
}

.etf-rule-info { flex: 1; min-width: 0; }

.etf-rule-headline {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  margin-bottom: var(--sp-1);
  flex-wrap: wrap;
}

.etf-rule-name {
  font-size: var(--text-lg);
  color: var(--text);
  font-weight: 500;
  letter-spacing: -0.005em;
  display: block;
}

.etf-rule-desc {
  font-size: var(--text-sm);
  color: var(--muted);
  margin: 0 0 var(--sp-2);
  line-height: 1.5;
}

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

.etf-rule-actions {
  display: flex;
  gap: var(--sp-2);
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Section labels (Modèles d'exemple / Mes ETF) ────────── */

.etf-section {
  margin-bottom: var(--sp-8);
}
.etf-section:last-child { margin-bottom: 0; }

.etf-section-label {
  margin: 0 0 var(--sp-5);
  padding-bottom: var(--sp-3);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--etf-label-tracking);
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border-subtle);
}

/* Template gallery — read-only, muted, visually distinct from own ETFs. */

/* "source" badge on a template = muted (not the cyan "Active" badge). */

/* ── Rule form ───────────────────────────────────────────── */

.etf-rule-form {
  max-width: 760px;
}

.etf-form-header {
  margin-bottom: var(--sp-6);
}

.etf-form-header strong {
  font-size: var(--text-xl);
  color: var(--text);
  font-weight: 600;
}

.etf-editor-save {
  height: 38px;
}

.etf-allocation-workbench {
  display: grid;
  gap: var(--sp-4);
  margin: var(--sp-4) 0 var(--sp-5);
}

.etf-allocation-summary {
  display: grid;
}

.etf-allocation-donut {
  border-radius: 50%;
}

.etf-allocation-donut::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
}

.etf-allocation-donut span {
  position: relative;
  z-index: 1;
  color: var(--text);
}

.etf-allocation-donut.is-warn span,
.etf-allocation-total strong.is-warn {
  color: #f3c96b;
}

.etf-allocation-total {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.etf-allocation-total span,
.etf-allocation-total small {
  color: var(--muted);
  font-size: var(--text-xs);
}

.etf-allocation-total strong {
  color: var(--text);
  line-height: 1;
  font-weight: 600;
}

.etf-allocation-list {
  display: grid;
  gap: 8px;
}

.etf-allocation-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 9px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.etf-allocation-row.is-active {
  border-color: rgba(111,231,255,0.5);
  background: rgba(111,231,255,0.055);
}

.etf-allocation-row[data-sleeve-kind="fixed"].is-active {
  border-color: rgba(255, 209, 102, 0.46);
  background: rgba(255, 209, 102, 0.05);
}

.etf-allocation-row[data-sleeve-kind="cash"].is-active {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.025);
}

.etf-allocation-swatch {
  width: 10px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: var(--sleeve-color, var(--accent-cyan));
  box-shadow: 0 0 12px color-mix(in srgb, var(--sleeve-color, #6fe7ff) 50%, transparent);
}

.etf-allocation-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.etf-allocation-main strong {
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.etf-allocation-main small {
  color: var(--muted);
  font-size: var(--text-xs);
}

.etf-allocation-weight {
  color: var(--text);
  font: 600 14px/1 var(--font-mono, monospace);
}

.etf-allocation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.etf-sleeve-focus {
  margin-top: var(--sp-1);
}

.etf-sleeve-kind-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: var(--sp-3);
  padding: 3px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.018);
}

.etf-sleeve-kind-tab {
  min-width: 0;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font: 600 11px/1.1 var(--font-sans, system-ui, sans-serif);
  letter-spacing: 0;
  text-align: center;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.etf-sleeve-kind-tab:hover {
  color: var(--text);
  border-color: var(--border-subtle);
}

.etf-sleeve-kind-tab.is-active {
  color: var(--text);
  border-color: rgba(111, 231, 255, 0.38);
  background: rgba(111, 231, 255, 0.075);
  box-shadow: inset 0 0 0 1px rgba(111, 231, 255, 0.04), 0 0 14px rgba(111, 231, 255, 0.08);
}

.etf-sleeve-kind-tab[data-sleeve-kind-tab="fixed"].is-active {
  border-color: rgba(255, 209, 102, 0.4);
  background: rgba(255, 209, 102, 0.075);
  box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.04), 0 0 14px rgba(255, 209, 102, 0.08);
}

.etf-sleeve-kind-tab[data-sleeve-kind-tab="fallback"].is-active {
  border-color: rgba(176, 140, 255, 0.44);
  background: rgba(176, 140, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(176, 140, 255, 0.05), 0 0 16px rgba(176, 140, 255, 0.1);
}

.etf-sleeve-kind-panel {
  display: grid;
  gap: var(--sp-3);
}

.etf-sleeve-kind-panel[hidden] {
  display: none !important;
}

.etf-sleeve-pocket-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 3px 2px 7px;
  scrollbar-width: thin;
}

.etf-sleeve-pocket-empty {
  min-height: 34px;
  display: grid;
  align-items: center;
  padding: 0 10px;
  border: 1px dashed var(--border-subtle);
  border-radius: 5px;
  color: var(--muted);
  font-size: var(--text-xs);
}

.etf-sleeve-pocket-tab {
  --sleeve-color: #64d8ff;
  flex: 0 0 auto;
  min-width: 118px;
  max-width: 190px;
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--sleeve-color) 18%, var(--border-subtle));
  border-radius: 5px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--sleeve-color) 8%, transparent), rgba(255, 255, 255, 0.012));
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, color 140ms ease;
}

.etf-sleeve-pocket-tab:hover {
  border-color: color-mix(in srgb, var(--sleeve-color) 38%, var(--border-subtle));
}

.etf-sleeve-pocket-tab.is-active {
  border-color: color-mix(in srgb, var(--sleeve-color) 58%, #ffffff);
  background:
    radial-gradient(circle at 22% 0%, color-mix(in srgb, var(--sleeve-color) 18%, transparent), transparent 52%),
    linear-gradient(135deg, color-mix(in srgb, var(--sleeve-color) 14%, transparent), rgba(255, 255, 255, 0.018));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--sleeve-color) 14%, transparent),
    0 0 14px color-mix(in srgb, var(--sleeve-color) 14%, transparent);
}

.etf-sleeve-pocket-tab span,
.etf-sleeve-pocket-tab small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.etf-sleeve-pocket-tab span {
  font-size: var(--text-xs);
  font-weight: 700;
}

.etf-sleeve-pocket-tab small {
  color: var(--muted);
  font: 700 10px/1 var(--font-mono, monospace);
}

.etf-sleeve-pocket-tab.is-fixed {
  --sleeve-color: #f4b942;
}

.etf-sleeve-pocket-tab.is-cash {
  --sleeve-color: #111820;
}

.etf-sleeve-pocket-tab.is-fallback {
  --sleeve-color: #b08cff;
}

.etf-title-input {
  min-width: 0;
  width: 100%;
  height: 30px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: 700 var(--text-base)/1.1 var(--font-sans, system-ui, sans-serif);
  overflow: hidden;
  text-overflow: ellipsis;
}

.etf-title-input:focus {
  outline: none;
  border-bottom-color: rgba(111, 231, 255, 0.42);
}

.etf-choice-picker {
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.014);
}

.etf-choice-picker > summary {
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  cursor: pointer;
}

.etf-choice-picker > summary span {
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 700;
}

.etf-choice-picker > summary strong {
  color: var(--muted);
  font: 700 10px/1 var(--font-mono, monospace);
}

.etf-choice-grid {
  max-height: 220px;
  overflow: auto;
  padding: 0 10px 10px;
}

.etf-holdings-picker {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.014);
}

.etf-holdings-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.etf-holdings-head span {
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 700;
}

.etf-holdings-head small {
  color: var(--muted);
  font: 700 10px/1 var(--font-mono, monospace);
}

.etf-symbol-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.etf-symbol-add input {
  height: 36px;
}

.etf-symbol-presets {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(111, 231, 255, 0.12);
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.024), rgba(0, 0, 0, 0.16));
}

.etf-symbol-preset-group {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
}

.etf-symbol-preset-group > span {
  color: rgba(231, 238, 247, 0.58);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.etf-symbol-preset-group > div {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.etf-symbol-preset {
  flex: 0 0 auto;
  min-width: 48px;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: rgba(3, 7, 12, 0.72);
  font: 800 11px/1 var(--font-mono, monospace);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.etf-symbol-preset:hover,
.etf-symbol-preset:focus-visible {
  border-color: rgba(111, 231, 255, 0.42);
  background: rgba(111, 231, 255, 0.08);
  outline: none;
}

.etf-symbol-preset.is-selected {
  color: #071018;
  border-color: rgba(111, 231, 255, 0.72);
  background: linear-gradient(180deg, rgba(111, 231, 255, 0.94), rgba(65, 203, 234, 0.78));
  box-shadow: 0 0 14px rgba(111, 231, 255, 0.16);
}

.etf-holdings-rows {
  display: grid;
  gap: 7px;
}

.etf-holding-row {
  display: grid;
  grid-template-columns: minmax(60px, 82px) minmax(92px, 1fr) minmax(62px, 74px) auto;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.16);
}

.etf-holding-row strong {
  min-width: 0;
  color: var(--text);
  font: 800 12px/1 var(--font-mono, monospace);
  overflow: hidden;
  text-overflow: ellipsis;
}

.etf-holding-row input {
  min-width: 0;
  height: 32px;
}

.etf-holding-row [data-holding-weight-range] {
  accent-color: var(--accent-cyan);
}

.etf-holding-row [data-holding-weight] {
  text-align: right;
}

.etf-holdings-picker.is-unweighted .etf-holding-row,
.etf-fallback-row.is-dynamic .etf-holding-row {
  grid-template-columns: minmax(74px, 1fr) auto;
}

.etf-holdings-picker.is-unweighted [data-holding-weight],
.etf-holdings-picker.is-unweighted [data-holding-weight-range],
.etf-fallback-row.is-dynamic [data-holding-weight-range],
.etf-fallback-row.is-dynamic [data-holding-weight] {
  display: none;
}

.etf-fallback-mode-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 170px);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(176, 140, 255, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(176, 140, 255, 0.035);
}

.etf-fallback-mode-block[hidden] {
  display: none !important;
}

.etf-fallback-mode-block span {
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 700;
}

.etf-fallback-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.etf-fallback-name {
  min-width: 0;
}

.etf-fallback-swatch {
  align-self: center;
  margin-bottom: 0;
  box-shadow: 0 0 14px rgba(176, 140, 255, 0.38), 0 0 28px rgba(216, 135, 255, 0.12);
}

.etf-fallback-switch {
  height: 38px;
  display: inline-grid;
  grid-template-columns: auto;
  align-items: center;
  padding: 0 11px;
  border: 1px solid rgba(176, 140, 255, 0.28);
  border-radius: 5px;
  background: rgba(176, 140, 255, 0.045);
  color: var(--muted);
  font: 800 10px/1 var(--font-mono, monospace);
  cursor: pointer;
}

.etf-fallback-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.etf-fallback-switch:has(input:checked) {
  color: #eadcff;
  border-color: rgba(176, 140, 255, 0.52);
  background:
    radial-gradient(circle at 28% 0%, rgba(216, 135, 255, 0.20), transparent 56%),
    rgba(176, 140, 255, 0.09);
  box-shadow: 0 0 14px rgba(176, 140, 255, 0.12);
}

.etf-allocation-control-host,
.etf-allocation-fallback-host {
  width: min(520px, 100%);
}

.etf-allocation-control {
  display: grid;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

.etf-allocation-control-head {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.etf-allocation-control-head strong {
  min-width: 0;
  color: var(--text);
  font-size: var(--text-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.etf-allocation-control-head output {
  color: var(--text);
  font: 700 13px/1 var(--font-mono, monospace);
}

.etf-lock-btn {
  min-width: 48px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font: 700 10px/1 var(--font-mono, monospace);
  cursor: pointer;
}

.etf-lock-btn.is-locked {
  color: #ffd166;
  border-color: rgba(255, 209, 102, 0.38);
  background: rgba(255, 209, 102, 0.06);
}

.etf-allocation-control-head .etf-lock-btn {
  display: none;
}

.etf-allocation-adjust {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.etf-allocation-slider {
  --allocation-color: #64d8ff;
  --allocation-pct: 0%;
  position: relative;
  min-width: 0;
  height: 48px;
  border-radius: var(--radius-pill);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.etf-allocation-slider:focus-visible {
  outline: 2px solid rgba(111, 231, 255, 0.7);
  outline-offset: 3px;
}

.etf-allocation-slider.is-fixed {
  --allocation-color: #f4b942;
}

.etf-allocation-slider.is-cash {
  --allocation-color: #1c2530;
}

.etf-allocation-slider.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.etf-allocation-slider.is-dragging {
  cursor: grabbing;
}

.etf-allocation-slider-track,
.etf-allocation-slider-fill {
  position: absolute;
  left: 0;
  top: 50%;
  height: 14px;
  border-radius: var(--radius-pill);
  transform: translateY(-50%);
}

.etf-allocation-slider-track {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.34);
}

.etf-allocation-slider-fill {
  right: auto;
  width: var(--allocation-pct);
  background: linear-gradient(90deg, color-mix(in srgb, var(--allocation-color) 78%, #ffffff), var(--allocation-color));
  box-shadow: 0 0 16px color-mix(in srgb, var(--allocation-color) 36%, transparent);
}

.etf-allocation-slider-thumb {
  position: absolute;
  left: var(--allocation-pct);
  top: 50%;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--allocation-color);
  border: 2px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--allocation-color) 16%, transparent), 0 7px 18px rgba(0, 0, 0, 0.38);
}

.etf-lock-btn--inline {
  height: 42px;
  min-width: 56px;
}

@media (max-width: 700px) {
  .etf-allocation-slider {
    height: 54px;
  }

  .etf-allocation-slider-track,
  .etf-allocation-slider-fill {
    height: 16px;
  }

  .etf-allocation-slider-thumb {
    width: 34px;
    height: 34px;
  }

  .etf-lock-btn--inline {
    height: 48px;
    min-width: 62px;
  }

  .etf-fallback-layout,
  .etf-fallback-grid,
  .etf-fallback-grid--rank {
    grid-template-columns: 1fr;
  }

  .etf-fallback-block--assets textarea {
    min-height: 84px;
  }

  .etf-choice-grid {
    max-height: 180px;
  }

  .etf-holding-row,
  .etf-holdings-picker.is-unweighted .etf-holding-row,
  .etf-fallback-row.is-dynamic .etf-holding-row {
    grid-template-columns: minmax(62px, 1fr) auto;
  }

  .etf-holdings-picker.is-weighted .etf-holding-row,
  .etf-fallback-row.is-fixed .etf-holding-row {
    grid-template-columns: minmax(58px, 76px) minmax(90px, 1fr) minmax(58px, 70px) auto;
  }

  .etf-fallback-row.is-dynamic .etf-holding-row {
    grid-template-columns: minmax(62px, 1fr) auto;
  }

  .etf-symbol-add {
    display: none;
  }

  .etf-symbol-preset-group {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .etf-symbol-preset {
    min-width: 52px;
    min-height: 36px;
  }

  .etf-fallback-mode-block {
    grid-template-columns: 1fr;
  }
}

.etf-fallback-strip {
  display: flex;
  width: 100%;
  min-height: 58px;
  margin-top: 8px;
  padding: 3px;
  border: 1px solid rgba(176, 140, 255, 0.28);
  border-radius: 7px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(176, 140, 255, 0.12), transparent 44%),
    rgba(7, 8, 13, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 0 22px rgba(176, 140, 255, 0.10);
}

.etf-fallback-strip-segment {
  flex: 0 0 var(--fallback-width, 100%);
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 2px;
  position: relative;
  padding: 8px 11px;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.10);
  background:
    radial-gradient(circle at 30% 0%, color-mix(in srgb, var(--fallback-color, #b08cff) 34%, transparent), transparent 48%),
    linear-gradient(120deg, color-mix(in srgb, var(--fallback-color, #b08cff) 28%, #080a0e), rgba(255, 255, 255, 0.012) 72%);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--fallback-color, #b08cff) 16%, transparent),
    inset 0 -10px 22px rgba(0, 0, 0, 0.22);
  transition: filter 140ms ease, box-shadow 140ms ease;
}

.etf-fallback-strip-segment:last-child {
  border-right: 0;
}

.etf-fallback-strip-segment::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 38%);
  opacity: 0.48;
}

.etf-fallback-strip-segment:hover {
  filter: brightness(1.12) saturate(1.08);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--fallback-color, #b08cff) 34%, transparent),
    0 0 16px color-mix(in srgb, var(--fallback-color, #b08cff) 24%, transparent);
}

.etf-fallback-strip-segment span,
.etf-fallback-strip-segment small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.etf-fallback-strip-segment span {
  font-size: var(--text-xs);
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.etf-fallback-strip-segment small {
  color: var(--muted);
  font-size: 10px;
  position: relative;
  z-index: 1;
}

.etf-fallback-list {
  display: grid;
  gap: 10px;
}

.etf-fallback-row {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(176, 140, 255, 0.20);
  border-radius: 7px;
  background:
    radial-gradient(circle at 18% 0%, rgba(176, 140, 255, 0.12), transparent 42%),
    linear-gradient(135deg, rgba(176, 140, 255, 0.050), rgba(255, 255, 255, 0.012) 58%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.etf-fallback-row[hidden] {
  display: none !important;
}

.etf-sleeve-focus-head.etf-fallback-head {
  grid-template-columns: 10px minmax(0, 1fr) auto;
}

.etf-fallback-row-head {
  grid-template-columns: minmax(86px, 110px) minmax(98px, 130px) minmax(150px, 1fr);
}

.etf-fallback-layout {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(220px, 1.1fr);
  gap: 10px;
}

.etf-fallback-block {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(176, 140, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(7, 8, 13, 0.22);
}

.etf-fallback-block > strong {
  color: color-mix(in srgb, #eadcff 84%, var(--text));
  font-size: var(--text-xs);
  font-weight: 800;
}

.etf-fallback-block--assets {
  grid-row: span 2;
}

.etf-fallback-block--assets textarea {
  min-height: 108px;
}

.etf-fallback-grid {
  display: grid;
  grid-template-columns: minmax(92px, 0.7fr) minmax(130px, 1.3fr);
  gap: 8px;
  align-items: end;
}

.etf-fallback-grid--rank {
  grid-template-columns: minmax(130px, 1fr) minmax(82px, 0.55fr) minmax(72px, 0.45fr);
}

.etf-sleeve-focus-head {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.etf-sleeve-focus-head strong {
  min-width: 0;
  color: var(--text);
  font-size: var(--text-base);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.etf-sleeve-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--border-subtle);
}

.etf-sleeve-tabs .etf-tab-btn {
  padding: 10px 8px 9px;
  text-align: center;
}

.etf-sleeve-panel {
  display: none;
  padding-top: var(--sp-3);
}

.etf-sleeve-panel.is-active {
  display: block;
}

.etf-form-section {
  margin-bottom: var(--sp-6);
  padding: 0;
  background: none;
  border: none;
  border-top: 1px solid var(--border-subtle);
  border-radius: 0;
}
.etf-form-section > summary {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  list-style: none;
  cursor: pointer;
  padding: var(--sp-5) 0 var(--sp-4);
  margin: 0;
  user-select: none;
}
.etf-form-section > summary::-webkit-details-marker,
.etf-form-section > summary::marker { display: none; }
.etf-form-section > summary::before {
  content: "▸";
  display: inline-block;
  width: 10px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  transition: transform 0.15s ease, color 0.15s ease;
}
.etf-form-section[open] > summary::before { transform: rotate(90deg); color: var(--accent-cyan); }
.etf-form-section > summary > h4 {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--etf-label-tracking);
  color: var(--muted);
  margin: 0;
  font-weight: 500;
  flex: 1;
}
.etf-form-section[open] > summary > h4 { color: var(--text); }

/* Chip de compte scope (aperçu live). */
.etf-scope-count {
  flex-shrink: 0;
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--muted);
  padding: 2px 9px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: transparent;
  white-space: nowrap;
}
.etf-scope-count.is-low { color: #e0b84d; border-color: rgba(224, 184, 77, 0.4); }
.etf-scope-count.is-warn { color: var(--down); border-color: rgba(255, 110, 180, 0.4); }

/* Rangée de presets. */
.etf-preset-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
  padding: var(--sp-3);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.015);
}
.etf-preset-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--etf-label-tracking);
  color: var(--muted);
  margin-right: var(--sp-1);
}

/* Bandeau de validation (bloquants + avertissements). */
.etf-form-warn-banner { margin-bottom: var(--sp-4); }
.etf-form-warn-banner ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.etf-form-warn-banner li {
  font-size: var(--text-xs);
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
}
.etf-warn--block {
  color: var(--down);
  border-color: rgba(255, 110, 180, 0.35);
  background: rgba(255, 110, 180, 0.06);
}

.etf-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: flex-end;
}

.etf-form-row .field {
  flex: 1;
  min-width: 140px;
}

.etf-rule-form textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
}

.etf-rule-form select[multiple] {
  width: 100%;
  min-height: 140px;
}

.etf-field-wide { min-width: 100% !important; }
.etf-field-sm { max-width: 100px; min-width: 80px !important; flex: 0 0 auto !important; }
.etf-field-date { min-width: 132px !important; max-width: 160px; }
.etf-field-hint {
  display: block;
  margin-top: 6px;
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--muted);
}

.etf-choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.etf-choice-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 2px;
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--text-sm);
  transition: border-color 0.15s, color 0.15s;
}

.etf-choice-pill:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.etf-choice-pill input[type="checkbox"] {
  accent-color: var(--accent-cyan);
}

.etf-bucket-builder {
  display: grid;
  gap: var(--sp-3);
}

.etf-bucket-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: var(--sp-2);
  align-items: end;
}

.etf-bucket-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: flex-start;
}

.etf-sleeve-builder {
  display: grid;
  gap: var(--sp-3);
}

.etf-sleeve-builder[hidden] {
  display: none !important;
}

.etf-sleeve-row {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.018);
}

.etf-sleeve-row[hidden] {
  display: none !important;
}

.etf-sleeve-row-head,
.etf-sleeve-grid {
  display: grid;
  gap: var(--sp-2);
  align-items: end;
}

.etf-sleeve-grid {
  grid-template-columns: repeat(3, minmax(130px, 1fr));
}

.etf-sleeve-grid[hidden] {
  display: none !important;
}

.etf-sleeve-row textarea {
  min-height: 58px;
}

@media (max-width: 700px) {
  .etf-editor-header {
    grid-template-columns: minmax(0, 1fr) 104px;
    gap: 8px;
  }

  .etf-editor-save {
    grid-column: 1 / -1;
  }

  .etf-allocation-summary {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
  }

  .etf-allocation-donut {
    width: 96px;
  }

  .etf-allocation-donut::after {
    inset: 18px;
  }

  .etf-allocation-total strong {
    font-size: 24px;
  }

  .etf-allocation-actions {
    grid-template-columns: 1fr;
  }

  .etf-rule-form--allocation > details[data-section="identity"],
  .etf-rule-form--allocation > details[data-section="ranking"],
  .etf-rule-form--allocation > details[data-section="scope"],
  .etf-rule-form--allocation > details[data-section="exceptions"],
  .etf-rule-form--allocation > details[data-section="switch"],
  .etf-rule-form--allocation > details[data-section="filtersMomentum"],
  .etf-rule-form--allocation > details[data-section="filtersEma"],
  .etf-rule-form--allocation > details[data-section="filtersStockbee"] {
    display: none;
  }

  .etf-rule-form--allocation .etf-preset-row {
    display: none;
  }

  .etf-rule-form--allocation .etf-form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .etf-sleeve-row-head,
  .etf-sleeve-grid {
    grid-template-columns: 1fr;
  }

  .etf-sleeve-row-head .etf-field-sm,
  .etf-sleeve-grid .etf-field-sm {
    max-width: none;
    width: 100%;
  }
}

.etf-rule-form--allocation {
  max-width: 920px;
}

.etf-editor-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--sp-3);
  align-items: center;
  margin-bottom: var(--sp-3);
}

.etf-editor-header > strong {
  display: block;
  color: var(--text);
  font-size: var(--text-base);
  font-weight: 600;
}

.etf-editor-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--sp-4);
}

.etf-editor-tabs .etf-tab-btn {
  min-height: 38px;
  text-align: center;
}

.etf-editor-panel[hidden] {
  display: none !important;
}

.etf-editor-panel.is-active {
  display: grid;
  gap: var(--sp-4);
}

.etf-allocation-summary {
  align-items: center;
}

.etf-allocation-donut::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: none;
  mix-blend-mode: normal;
  pointer-events: none;
}

.etf-allocation-donut::after {
  inset: 28%;
  background: color-mix(in srgb, var(--card) 92%, #07171d);
}

.etf-allocation-donut span {
  font: 700 34px/1 var(--font-mono, monospace);
}

.etf-allocation-total strong {
  font-size: 42px;
}

.etf-allocation-row {
  background: linear-gradient(90deg, rgba(111,231,255,0.025), rgba(255,255,255,0.012));
}

.etf-sleeve-row[data-sleeve-type="fixed"] .etf-dynamic-only,
.etf-sleeve-row[data-sleeve-type="dynamic"] .etf-fixed-only {
  display: none;
}

.etf-save-panel {
  max-width: 560px;
}

.etf-save-actions {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 700px) {
  .etf-rule-form--allocation {
    max-width: none;
  }

  .etf-editor-header {
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: 8px;
  }

  .etf-editor-save {
    grid-column: auto;
    height: 34px;
  }

  .etf-allocation-workbench {
    margin-top: 10px;
  }

  .etf-allocation-summary {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 12px;
  }

  .etf-allocation-donut {
    width: min(72vw, 292px);
  }

  .etf-allocation-donut::after {
    inset: 29%;
  }

  .etf-allocation-donut span {
    font-size: 32px;
  }

  .etf-allocation-total {
    justify-items: center;
    text-align: center;
  }

  .etf-allocation-total strong {
    font-size: 34px;
  }

  .etf-allocation-list {
    gap: 6px;
  }

  .etf-allocation-row {
    min-height: 46px;
    padding: 8px 9px;
  }

  .etf-allocation-actions {
    grid-template-columns: 1fr 1fr;
  }

  .etf-sleeve-row {
    padding: 10px;
  }

  .etf-save-panel {
    max-width: none;
  }
}

.etf-detail-head:has(.etf-head-save) {
  grid-template-columns: minmax(0, 1fr) auto;
}

.etf-detail-head:has(.etf-head-save) .etf-detail-sub {
  display: none;
}

.etf-head-save {
  justify-self: end;
  min-height: 32px;
  padding-inline: 12px;
}

.etf-rule-form--allocation > .etf-form-actions {
  display: none;
}

.etf-allocation-workbench {
  margin-top: 0;
}

.etf-allocation-summary {
  grid-template-columns: minmax(260px, 440px);
  justify-content: center;
  justify-items: center;
  gap: 0;
  width: 100%;
}

.etf-allocation-donut {
  width: min(440px, 62vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  position: relative;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.etf-allocation-donut::before,
.etf-allocation-donut::after,
.etf-allocation-donut span {
  display: none !important;
  content: none !important;
}

.etf-allocation-legend,
.etf-allocation-list--legend {
  display: none !important;
}

.etf-allocation-pie-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
  filter:
    drop-shadow(0 22px 42px rgba(0, 0, 0, 0.46))
    drop-shadow(0 0 18px rgba(111, 231, 255, 0.18))
    drop-shadow(0 0 42px rgba(111, 231, 255, 0.08));
}

.etf-pie-plate {
  fill: rgba(8, 10, 14, 0.58);
  stroke: rgba(111, 231, 255, 0.12);
  stroke-width: 0.75;
}

.etf-pie-segment {
  shape-rendering: geometricPrecision;
  transition: opacity 160ms ease, filter 160ms ease;
}

.etf-pie-segment.is-dynamic {
  filter: drop-shadow(0 0 2px rgba(100, 216, 255, 0.36));
}

.etf-pie-segment.is-fixed {
  filter: drop-shadow(0 0 2px rgba(255, 209, 102, 0.34));
}

.etf-pie-segment.is-fallback {
  filter: drop-shadow(0 0 2px rgba(176, 140, 255, 0.34));
}

.etf-pie-segment.is-cash {
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.14));
}

.etf-pie-segment:hover {
  filter: brightness(1.16) saturate(1.12);
}

.etf-pie-segment.is-empty {
  opacity: 0.42;
}

.etf-pie-rim {
  fill: none;
  stroke: rgba(111, 231, 255, 0.52);
  stroke-width: 0.85;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 5px rgba(111, 231, 255, 0.58));
}

.etf-pie-sheen {
  fill: none;
  stroke: rgba(255, 255, 255, 0.20);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.42;
  filter: blur(0.1px);
}

.etf-pie-label {
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  letter-spacing: 0;
}

.etf-pie-label {
  fill: rgba(255, 255, 255, 0.86);
  font: 800 12px/1 var(--font-mono, monospace);
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.32);
  stroke-width: 2px;
  stroke-linejoin: round;
}

.etf-editor-panel[data-editor-panel="allocation"].is-active {
  min-height: min(56vh, 520px);
  align-items: center;
  justify-items: center;
}

@media (max-width: 700px) {
  .etf-detail-head:has(.etf-head-save) {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .etf-head-save {
    min-height: 30px;
    padding-inline: 10px;
    font-size: 11px;
  }

  .etf-editor-tabs {
    margin-bottom: 8px;
  }

  .etf-allocation-summary {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0;
  }

  .etf-allocation-donut {
    width: min(80vw, 340px);
  }

  .etf-editor-panel[data-editor-panel="allocation"].is-active {
    min-height: min(62vh, 430px);
  }
}

.etf-scope-empty {
  padding: var(--sp-4);
  border: 1px dashed var(--border-default);
  border-radius: 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.etf-form-checks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
}

.etf-form-checks--scope {
  margin-top: var(--sp-2);
}

.etf-check {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.etf-check:hover { color: var(--text); }

.etf-check input[type="checkbox"] {
  accent-color: var(--accent-cyan);
  width: 14px;
  height: 14px;
}

.etf-form-actions {
  display: flex;
  gap: var(--sp-3);
  padding-top: var(--sp-5);
}

/* ── Composition tab ─────────────────────────────────────── */

.etf-comp-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

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

.etf-comp-title strong {
  font-size: var(--text-xl);
  color: var(--text);
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.01em;
  display: block;
  margin-top: var(--sp-1);
}

.etf-comp-actions {
  display: flex;
  gap: var(--sp-2);
  flex-shrink: 0;
  align-items: center;
}

/* Entonnoir « Pourquoi cette sélection ? » (Vague D : aide à la décision). */
.etf-funnel {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.015);
  cursor: help;
}
.etf-funnel-step {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 64px;
}
.etf-funnel-step strong {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.etf-funnel-step small {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.etf-funnel-arrow {
  color: var(--muted);
  opacity: 0.5;
  font-size: 14px;
}
.etf-funnel-step--out strong { color: var(--accent-cyan); }

/* ── Shared table ────────────────────────────────────────── */

.etf-table-wrap {
  overflow-x: auto;
  border-radius: 0;
  border: none;
}

.etf-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.etf-table thead {
  background: transparent;
  position: sticky;
  top: 0;
  z-index: 1;
}

.etf-table th {
  padding: var(--sp-3) var(--sp-3);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--etf-label-tracking);
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

.etf-table td {
  padding: var(--sp-3) var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text);
  vertical-align: middle;
}

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

.etf-table tbody tr:hover { background: rgba(145, 160, 178, 0.03); }

.etf-rank {
  color: var(--muted);
  width: 32px;
  font-variant-numeric: tabular-nums;
}

.etf-name-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.etf-symbols-cell {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
  color: var(--muted);
}

.etf-count {
  font-size: var(--text-xs);
  color: var(--muted);
  padding: var(--sp-2) 0;
  margin: 0;
}

@media (max-width: 960px) {
  .etf-rules-overview,
  .etf-comp-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .etf-overview-card:nth-child(3) {
    border-left: none;
  }
}

@media (max-width: 640px) {
  .etf-rules-overview,
  .etf-comp-overview {
    grid-template-columns: 1fr;
  }
  .etf-overview-card {
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }
  .etf-overview-card:first-child {
    border-top: none;
  }
}

/* ── History tab ─────────────────────────────────────────── */

.etf-hist-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.etf-hist-header strong {
  font-size: var(--text-xl);
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
}

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

/* ── Performance tab ─────────────────────────────────────── */

.etf-perf-header {
  display: flex;
  align-items: baseline;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}

.etf-perf-select-wrap { flex: 1; min-width: 200px; }

/* Editorial stat strip: hairline-separated, no card chrome. */
.etf-perf-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-bottom: var(--sp-6);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.etf-perf-card {
  background: transparent;
  border: none;
  border-left: 1px solid var(--border-subtle);
  border-radius: 0;
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.etf-perf-card:first-child {
  border-left: none;
}

/* The outperformance card = the single focal point: display-tier,
   cyan, the only colored element on the page. */
.etf-perf-card--out {
  border-left: none;
  background: transparent;
}

.etf-perf-card span {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--etf-label-tracking);
  color: var(--muted);
}

.etf-perf-card strong {
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.etf-perf-card--out strong {
  font-size: var(--etf-display);
  font-weight: 600;
  color: var(--accent-cyan);
  line-height: 1.02;
}

.etf-perf-card small {
  font-size: var(--text-xs);
  color: var(--muted);
}

@media (max-width: 639px) {
  .etf-perf-summary { grid-template-columns: 1fr; }
  .etf-perf-card {
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }
  .etf-perf-card:first-child {
    border-top: none;
  }
}

/* ── Backtest section ────────────────────────────────────── */

.etf-backtest-section {
  margin-top: var(--sp-8);
  border-top: 1px solid var(--border-default);
  padding-top: var(--sp-6);
}
.etf-backtest-section--primary {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

.etf-backtest-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.etf-backtest-header strong {
  font-size: var(--text-xl);
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.etf-backtest-header p {
  margin: var(--sp-2) 0 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.etf-backtest-controls {
  display: flex;
  gap: var(--sp-2);
  align-items: flex-end;
  flex-shrink: 0;
}
.etf-backtest-controls--mobile {
  width: 100%;
  flex-wrap: wrap;
}

.etf-bt-meta {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-bottom: var(--sp-4);
}

.etf-cache-status {
  min-height: 1.2em;
  margin: 0 0 var(--sp-3);
  font-size: var(--text-xs);
  color: var(--muted);
}

/* Backtest overview = editorial stat strip, hairline-separated. */
.etf-bt-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0;
  margin-bottom: var(--sp-6);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.etf-bt-note {
  margin-bottom: var(--sp-4);
  padding: var(--sp-3) 0;
  border: none;
  border-top: 1px solid var(--border-accent);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: var(--text-sm);
}

/* Bandeau de divulgation des hypothèses du backtest (Vague intégrité A4). */
.etf-bt-disclosure {
  margin-bottom: var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border-subtle);
  border-left: 2px solid rgba(224, 184, 77, 0.6);
  border-radius: 0;
  background: rgba(224, 184, 77, 0.04);
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.55;
}
.etf-bt-disclosure strong { color: var(--text); font-weight: 500; }
.etf-bt-disclosure em { color: #6fe7ff; font-style: normal; }

.etf-integrity-card {
  display: grid;
  gap: var(--sp-3);
  margin: 0 0 var(--sp-5);
  padding: var(--sp-4);
  border: 1px solid var(--border-subtle);
  border-left: 2px solid rgba(224, 184, 77, 0.72);
  background: rgba(224, 184, 77, 0.035);
}

.etf-integrity-card.is-complete {
  border-left-color: rgba(72, 199, 142, 0.78);
  background: rgba(72, 199, 142, 0.035);
}

.etf-integrity-card.is-invalid {
  border-left-color: rgba(255, 96, 96, 0.82);
  background: rgba(255, 96, 96, 0.045);
}

.etf-integrity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.etf-integrity-head strong {
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
}

.etf-integrity-badge {
  flex: 0 0 auto;
  padding: 3px 8px;
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  color: #e0b84d;
  font: 600 var(--text-xs)/1.3 system-ui, sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.etf-integrity-card.is-complete .etf-integrity-badge { color: #48c78e; }
.etf-integrity-card.is-invalid .etf-integrity-badge { color: #ff6060; }

.etf-coverage-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.etf-coverage-stat {
  min-width: 0;
  padding: var(--sp-3);
  border-left: 1px solid var(--border-subtle);
}

.etf-coverage-stat:first-child { border-left: none; }

.etf-coverage-stat span,
.etf-coverage-note {
  color: var(--muted);
  font-size: var(--text-xs);
}

.etf-coverage-stat strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: var(--text-lg);
  line-height: 1.15;
}

.etf-universe-coverage-list {
  display: grid;
  gap: 6px;
}

.etf-universe-coverage {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.018);
}

.etf-universe-coverage-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.etf-universe-coverage-head strong {
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 550;
}

.etf-universe-coverage-head span,
.etf-universe-coverage-counts,
.etf-universe-coverage small {
  color: var(--muted);
  font-size: var(--text-xs);
}

.etf-universe-coverage.is-complete .etf-universe-coverage-head span { color: #48c78e; }
.etf-universe-coverage.is-experimental .etf-universe-coverage-head span { color: #6fe7ff; }
.etf-universe-coverage.is-incomplete .etf-universe-coverage-head span { color: #e0b84d; }

.etf-return-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.etf-return-mode {
  padding: 4px 8px;
  border: 1px solid var(--border-subtle);
  color: var(--muted);
  font-size: var(--text-xs);
}

.etf-return-mode.is-available { color: #48c78e; }
.etf-return-mode.is-unavailable { color: #e0b84d; }

.etf-date-range {
  display: inline-grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--sp-2);
  max-width: 100%;
}
.etf-date-range::before {
  content: "";
  display: none;
}
.etf-date-range span {
  display: inline-flex;
  min-width: 0;
  padding: 3px 8px;
  border: 1px solid var(--border-subtle);
  color: var(--text);
  font-size: var(--text-xs);
  line-height: 1.2;
  white-space: nowrap;
}
.etf-date-range span + span::before {
  content: "->";
  margin: 0 8px 0 -2px;
  color: var(--muted);
}

.etf-metric-strip-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  margin-top: calc(var(--sp-2) * -1);
  margin-bottom: var(--sp-6);
}
.etf-backtest-metrics-table {
  min-width: 880px;
  margin-bottom: 0;
}
.etf-backtest-metrics-table th,
.etf-backtest-metrics-table td {
  white-space: nowrap;
}
.etf-backtest-metrics-table td:first-child {
  color: var(--text);
  font-weight: 500;
}

.etf-sweep-panel {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--sp-3);
}
.etf-sweep-title {
  display: grid;
  justify-items: center;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-3);
  text-align: center;
}
.etf-sweep-title::before {
  content: "";
  width: 42px;
  height: 1px;
  background: rgba(111, 231, 255, 0.72);
}
.etf-sweep-title strong {
  font-size: var(--text-xs);
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.etf-sweep-controls {
  display: grid;
  grid-template-columns: minmax(58px, 25%) minmax(0, 1fr);
  grid-template-areas:
    "count range"
    "button button";
  align-items: stretch;
  column-gap: var(--sp-3);
  row-gap: var(--sp-4);
}
.etf-sweep-controls .field {
  grid-area: count;
  min-width: 0 !important;
  max-width: none;
  display: grid;
  grid-template-rows: auto 30px;
  align-content: start;
  gap: 6px;
  margin: 0;
}
.etf-sweep-controls #etfSweepBtn {
  grid-area: button;
  grid-column: 1 / -1;
  justify-self: stretch;
  margin-top: 0;
}
.etf-sweep-range {
  grid-area: range;
  display: grid;
  grid-template-rows: auto 30px;
  gap: 6px;
  min-width: 0;
}
.etf-sweep-panel.is-running .etf-sweep-controls {
  display: none;
}
.etf-sweep-progress {
  margin-top: var(--sp-2);
}
.etf-sweep-progress-current {
  margin-top: var(--sp-3);
}
.etf-progress-track--current .etf-progress-fill {
  background: linear-gradient(90deg, rgba(111, 231, 255, 0.55), rgba(125, 255, 191, 0.82));
}
.etf-sweep-range-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  color: var(--muted);
}
.etf-sweep-range-head strong {
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 500;
}
.etf-sweep-range-track {
  position: relative;
  height: 30px;
  display: grid;
  align-items: center;
}
.etf-sweep-range-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background:
    linear-gradient(90deg,
      rgba(145, 160, 178, 0.2) 0%,
      rgba(145, 160, 178, 0.2) var(--sweep-min-pct, 8%),
      rgba(111, 231, 255, 0.72) var(--sweep-min-pct, 8%),
      rgba(111, 231, 255, 0.72) var(--sweep-max-pct, 49%),
      rgba(145, 160, 178, 0.2) var(--sweep-max-pct, 49%),
      rgba(145, 160, 178, 0.2) 100%);
  border-radius: var(--radius-pill);
  box-shadow: 0 0 10px rgba(111, 231, 255, 0.12);
}
.etf-sweep-range-track input[type="range"] {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  width: 100%;
  height: 22px;
  margin: 0;
  transform: translateY(-50%);
  background: transparent;
  pointer-events: none;
  appearance: none;
  z-index: 2;
}
.etf-sweep-range-track input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: transparent;
}
.etf-sweep-range-track input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -9px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(111, 231, 255, 0.82);
  background: #071018;
  box-shadow: 0 0 10px rgba(111, 231, 255, 0.35);
  appearance: none;
  pointer-events: auto;
}
.etf-sweep-range-track input[type="range"]::-moz-range-track {
  height: 2px;
  background: transparent;
}
.etf-sweep-range-track input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(111, 231, 255, 0.82);
  background: #071018;
  box-shadow: 0 0 10px rgba(111, 231, 255, 0.35);
  pointer-events: auto;
}

.etf-bt-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  margin: var(--sp-5) 0 var(--sp-3);
}

/* Panneaux stress tests + sweep topN (Vagues D20/D17). */
.etf-stress { margin-top: var(--sp-6); }
.etf-stress .etf-table { min-width: 420px; }
.etf-stress #etfSweepOut { margin-top: var(--sp-2); }

.etf-bt-section-head strong {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--etf-label-tracking);
  color: var(--muted);
  font-weight: 500;
}

.etf-rebalance-audit {
  margin: var(--sp-5) 0;
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  background: rgba(4, 11, 19, 0.42);
}

.etf-rebalance-audit > summary {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
}

.etf-rebalance-audit > summary span {
  color: var(--muted);
  font-size: var(--text-xs);
}

.etf-rebalance-audit .etf-bt-disclosure {
  margin: 0 var(--sp-4) var(--sp-3);
}

.etf-rebalance-audit .etf-table-wrap {
  max-height: min(56vh, 620px);
  overflow: auto;
}

.etf-rebalance-audit-table {
  min-width: 940px;
}

.etf-rebalance-composition {
  min-width: 260px;
  white-space: normal;
}

.etf-chart-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-top: var(--sp-5);
  margin-bottom: var(--sp-3);
}

.etf-chart-presets,
.etf-chart-range {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  align-items: flex-end;
}

.etf-chart-meta {
  margin-bottom: var(--sp-3);
  font-size: var(--text-xs);
  color: var(--muted);
}

/* Chart = breathing room, no border card. */
.etf-chart-wrap {
  position: relative;
  margin-top: var(--sp-5);
  border: none;
  border-top: 1px solid var(--border-subtle);
  border-radius: 0;
  overflow: visible;
  background: transparent;
  padding-top: var(--sp-4);
  touch-action: none;
  cursor: grab;
}
.etf-chart-wrap:active { cursor: grabbing; }

/* Tooltip de survol (Vague B). */
.etf-chart-tooltip {
  position: absolute;
  top: 10px;
  min-width: 160px;
  padding: 8px 10px;
  background: rgba(8, 12, 18, 0.94);
  border: 1px solid rgba(111, 231, 255, 0.28);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45), 0 0 14px rgba(111, 231, 255, 0.1);
  color: var(--text);
  font-size: var(--text-xs);
  line-height: 1.5;
  pointer-events: none;
  z-index: 6;
  backdrop-filter: blur(4px);
}
.etf-tip-date {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 5px;
}
.etf-tip-row { display: flex; align-items: center; gap: 7px; }
.etf-tip-row strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.etf-tip-row.diff strong { color: var(--accent-cyan); }
.etf-tip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.etf-tip-dot.pf { background: #6fe7ff; box-shadow: 0 0 6px rgba(111, 231, 255, 0.6); }
.etf-tip-dot.bm { background: rgba(145, 160, 178, 0.9); }
.etf-tip-dot.nt { background: transparent; border: 1.5px dashed rgba(111, 231, 255, 0.8); box-shadow: none; }

.etf-backtest-svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ── Colour helpers ──────────────────────────────────────── */

.etf-pos { color: var(--up); }
.etf-neg { color: var(--down); }

/* ── Responsive (mobile) ─────────────────────────────────── */

@media (max-width: 639px) {
  /* Generous masthead that stacks. */
  .etf-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-4);
    padding: var(--sp-6) var(--sp-4) var(--sp-4);
  }
  .etf-hero-actions { width: 100%; }

  /* Sticky, horizontally-scrollable tab bar so 4 tabs never wrap
     and stay reachable while scrolling a long table. */
  .etf-tab-nav {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--card);
    padding: 0 var(--sp-4);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .etf-tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .etf-rule-main { flex-direction: column; }
  .etf-rule-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .etf-bt-overview { grid-template-columns: 1fr; }

  .etf-bt-section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Display tiers clamp down so the focal number never overflows. */
  .etf-overview-card--accent strong { font-size: var(--etf-display-tight); }
  .etf-perf-card--out strong { font-size: var(--etf-display-tight); }
}

/* Mobile ETF Maison shell -------------------------------------------------
   Keep the real master navigation visible. The earlier mobile variant hid the
   sidebar behind a select and the slot could reserve its intrinsic height
   before rendering, which left a large blank band below the topbar. */
@media (max-width: 639px) {
  body:has(.app-shell.layout-etf-maison) {
    overflow: hidden;
  }

  .app.app-shell.layout-etf-maison {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas:
      "workspace"
      "bottom" !important;
    height: 100dvh;
    min-height: 100dvh;
    grid-template-rows: minmax(0, 1fr) auto !important;
    overflow: hidden;
  }

  /* [etf-mobile-exit-20260808] Ne PAS masquer la barre entiere : elle porte le burger,
     seule sortie du mode sur telephone. Mesure avant correction : ETF_MAISON a 390px
     n'offrait que deux controles cliquables (le rail et la fermeture d'un toast), donc
     entrer dans le mode y enfermait l'utilisateur. On garde le gain de place -- la barre
     ne consomme plus aucune ligne de grille -- en la reduisant a un calque sans hauteur
     qui ne porte que le menu, evenements de pointeur desactives pour ne rien bloquer. */
  .app-shell.layout-etf-maison {
    position: relative;
  }

  .app-shell.layout-etf-maison #topbarMain {
    display: block !important;
    position: absolute;
    top: 0;
    right: 0;
    left: auto;
    z-index: 30;
    height: auto;
    min-height: 0;
    padding: 6px 8px 0 0;
    background: none;
    border: none;
    pointer-events: none;
  }

  .app-shell.layout-etf-maison #topbarMain > *:not(.topbar-mobile-menu) {
    display: none !important;
  }

  .app-shell.layout-etf-maison #topbarMain .topbar-mobile-menu {
    display: block !important;
    pointer-events: auto;
  }

  /* Meme bouton que le hamburger du screener, pour que les deux modes presentent le
     meme controle et non deux. 31px de large etait trop etroit pour le pouce. */
  .app-shell.layout-etf-maison #topbarMain .topbar-mobile-menu > summary {
    height: 38px;
    width: 38px;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 18px;
  }

  .app-shell.layout-etf-maison #topbarMain .tb-selects {
    display: none !important;
  }

  .app-shell.layout-etf-maison #etfMaisonPanelSlot {
    display: grid !important;
    grid-template-columns: 32px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    position: relative;
    align-self: stretch;
    justify-self: stretch;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100dvh;
    margin: 0;
    border-top: 1px solid var(--border-subtle);
    overflow: hidden;
    content-visibility: visible !important;
    contain: none !important;
    contain-intrinsic-size: auto 0 !important;
  }

  .app-shell.layout-etf-maison #etfMaisonPanelSlot:not(.is-sidebar-collapsed)::after {
    content: "";
    position: absolute;
    inset: 0 0 0 32px;
    z-index: 16;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.28);
  }

  .app-shell.layout-etf-maison .etf-sidebar {
    display: flex !important;
    grid-column: 1;
    position: relative;
    z-index: 22;
    min-width: 0;
    width: 32px;
    height: 100%;
    border-right: 1px solid rgba(145, 160, 178, 0.14);
    background: rgba(7, 8, 10, 0.82);
    transition: width 160ms ease, background 160ms ease, box-shadow 160ms ease;
    touch-action: pan-y;
  }

  .app-shell.layout-etf-maison #etfMaisonPanelSlot.is-sidebar-collapsed .etf-sidebar::after {
    content: "";
    position: absolute;
    top: 8px;
    right: 0;
    bottom: 8px;
    width: 1px;
    border-radius: var(--radius-pill);
    background: linear-gradient(180deg,
      transparent 0%,
      rgba(111, 231, 255, 0.16) 16%,
      rgba(111, 231, 255, 0.52) 50%,
      rgba(111, 231, 255, 0.16) 84%,
      transparent 100%);
    box-shadow: 0 0 8px rgba(111, 231, 255, 0.28);
    pointer-events: none;
  }

  .app-shell.layout-etf-maison #etfMaisonPanelSlot:not(.is-sidebar-collapsed) .etf-sidebar::after {
    content: "";
    position: absolute;
    top: 8px;
    right: 0;
    bottom: 8px;
    width: 1px;
    border-radius: var(--radius-pill);
    background: linear-gradient(180deg,
      transparent 0%,
      rgba(111, 231, 255, 0.16) 16%,
      rgba(111, 231, 255, 0.58) 50%,
      rgba(111, 231, 255, 0.16) 84%,
      transparent 100%);
    box-shadow: 0 0 10px rgba(111, 231, 255, 0.34);
    pointer-events: none;
  }

  .app-shell.layout-etf-maison #etfMaisonPanelSlot:not(.is-sidebar-collapsed) .etf-sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 24;
    width: min(85vw, 332px);
    max-width: calc(100vw - 18px);
    background: rgba(7, 8, 10, 0.97);
    box-shadow: 18px 0 44px rgba(0, 0, 0, 0.48);
    touch-action: pan-y;
  }

  .app-shell.layout-etf-maison .etf-sidebar-rail {
    display: flex !important;
  }

  .app-shell.layout-etf-maison .etf-sidebar:not(.is-collapsed) .etf-sidebar-rail {
    display: none !important;
  }

  .app-shell.layout-etf-maison .etf-sidebar.is-collapsed .etf-sidebar-rail {
    align-items: stretch;
    gap: 0;
    width: 100%;
    padding: 8px 3px 12px;
    overflow: hidden;
  }

  .app-shell.layout-etf-maison .etf-sidebar.is-collapsed .etf-sidebar-head,
  .app-shell.layout-etf-maison .etf-sidebar.is-collapsed .etf-sidebar-search,
  .app-shell.layout-etf-maison .etf-sidebar.is-collapsed .etf-sidebar-list,
  .app-shell.layout-etf-maison .etf-sidebar.is-collapsed .etf-sidebar-foot {
    display: none !important;
  }

  .app-shell.layout-etf-maison .etf-rail-expand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    border-color: rgba(111, 231, 255, 0.22);
    color: rgba(111, 231, 255, 0.92);
    background: rgba(111, 231, 255, 0.06);
  }

  .app-shell.layout-etf-maison .etf-rail-group {
    gap: 6px;
  }

  /* Rail mobile = colonne transparente ; seul un fin « grabber » flotte au centre.
     Le bouton remplit toute la colonne (zone de tap), le visuel reste délicat. */
  .app-shell.layout-etf-maison .etf-rail-visual {
    position: relative;
    display: grid;
    place-items: center;
    flex: 1;
    width: 100%;
    min-height: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    cursor: pointer;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
  }

  .app-shell.layout-etf-maison .etf-rail-visual__edge { display: none; }

  /* Filament vertical lumineux : trait fin en dégradé qui s'estompe aux
     extrémités (effet « suspendu »). Les spans d'origine sont masqués. */
  .app-shell.layout-etf-maison .etf-rail-visual__grip {
    position: relative;
    width: 2px;
    height: 48px;
    border-radius: var(--radius-pill);
    background: linear-gradient(180deg,
      transparent 0%,
      rgba(145, 160, 178, 0.55) 22%,
      rgba(145, 160, 178, 0.55) 78%,
      transparent 100%);
    box-shadow: none;
    transition: height 0.28s ease, background 0.28s ease, box-shadow 0.28s ease;
  }
  .app-shell.layout-etf-maison .etf-rail-visual__grip span { display: none; }

  /* ETF actif → le filament devient cyan et respire doucement. */
  .app-shell.layout-etf-maison .etf-rail-visual.is-active .etf-rail-visual__grip {
    background: linear-gradient(180deg,
      transparent 0%,
      rgba(111, 231, 255, 0.95) 22%,
      rgba(111, 231, 255, 0.95) 78%,
      transparent 100%);
    box-shadow: 0 0 8px rgba(111, 231, 255, 0.55), 0 0 16px rgba(111, 231, 255, 0.22);
    animation: etf-rail-breathe 3.6s ease-in-out infinite;
  }

  /* Hover / focus / tap → le filament s'allonge et s'illumine. */
  .app-shell.layout-etf-maison .etf-rail-visual:hover .etf-rail-visual__grip,
  .app-shell.layout-etf-maison .etf-rail-visual:focus-visible .etf-rail-visual__grip,
  .app-shell.layout-etf-maison .etf-rail-visual:active .etf-rail-visual__grip {
    height: 58px;
    background: linear-gradient(180deg,
      transparent 0%,
      #6fe7ff 18%,
      #6fe7ff 82%,
      transparent 100%);
    box-shadow: 0 0 10px rgba(111, 231, 255, 0.85), 0 0 22px rgba(111, 231, 255, 0.35);
  }
  .app-shell.layout-etf-maison .etf-rail-visual:focus-visible { outline: none; }

  @keyframes etf-rail-breathe {
    0%, 100% { opacity: 0.6; box-shadow: 0 0 6px rgba(111, 231, 255, 0.4), 0 0 12px rgba(111, 231, 255, 0.14); }
    50%      { opacity: 1;   box-shadow: 0 0 11px rgba(111, 231, 255, 0.75), 0 0 22px rgba(111, 231, 255, 0.3); }
  }

  .app-shell.layout-etf-maison .etf-rail-tile {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.018);
    font-size: 11px;
  }

  .app-shell.layout-etf-maison .etf-sidebar-head {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    grid-template-areas:
      "collapse title"
      "new new";
    align-items: center;
    gap: 7px;
    padding: 10px 10px 9px;
    border-bottom-color: rgba(145, 160, 178, 0.12);
  }

  .app-shell.layout-etf-maison .etf-rail-visual__grip {
    width: 20px;
    height: 28px;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0;
    transition: transform 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
    opacity: 0.72;
  }

  .app-shell.layout-etf-maison .etf-rail-visual__grip::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 50%;
    width: 9px;
    height: 9px;
    border-top: 2px solid rgba(145, 160, 178, 0.74);
    border-right: 2px solid rgba(145, 160, 178, 0.74);
    border-radius: 1px;
    transform: translateY(-50%) rotate(45deg);
  }

  .app-shell.layout-etf-maison .etf-rail-visual.is-active .etf-rail-visual__grip,
  .app-shell.layout-etf-maison .etf-rail-visual:hover .etf-rail-visual__grip,
  .app-shell.layout-etf-maison .etf-rail-visual:focus-visible .etf-rail-visual__grip,
  .app-shell.layout-etf-maison .etf-rail-visual:active .etf-rail-visual__grip {
    transform: translateX(1px);
    opacity: 1;
    filter: drop-shadow(0 0 9px rgba(111, 231, 255, 0.72));
  }

  .app-shell.layout-etf-maison .etf-rail-visual.is-active .etf-rail-visual__grip::before,
  .app-shell.layout-etf-maison .etf-rail-visual:hover .etf-rail-visual__grip::before {
    border-color: rgba(111, 231, 255, 0.95);
  }

  .app-shell.layout-etf-maison .etf-sidebar-collapse {
    grid-area: collapse;
    display: inline-flex !important;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-lg);
    border-color: rgba(145, 160, 178, 0.16);
  }

  .app-shell.layout-etf-maison .etf-sidebar-head .etf-eyebrow {
    grid-area: title;
    font-size: 9px;
    line-height: 1.1;
    letter-spacing: 0.08em;
    color: rgba(151, 166, 184, 0.92);
  }

  .app-shell.layout-etf-maison #etfNewRuleBtn {
    grid-area: new;
    width: 100%;
    min-height: 34px;
    padding: 0 6px;
    font-size: 10px;
    white-space: nowrap;
    border-radius: var(--radius-md);
  }

  .app-shell.layout-etf-maison .etf-sidebar-list {
    display: flex !important;
    flex-direction: column;
    min-height: 0;
    padding: 6px 0 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .app-shell.layout-etf-maison .etf-sidebar-search {
    display: block;
    padding: 0 10px 8px;
  }

  .app-shell.layout-etf-maison .etf-sidebar-search input {
    height: 34px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.025);
  }

  .app-shell.layout-etf-maison .etf-sidebar-section {
    padding: 8px 8px 12px;
    border-bottom: 1px solid rgba(145, 160, 178, 0.08);
  }

  .app-shell.layout-etf-maison .etf-section-toggle {
    margin: 0 0 8px;
    padding: 0 0 7px;
    border-bottom-color: rgba(145, 160, 178, 0.1);
    cursor: pointer;
  }

  .app-shell.layout-etf-maison .etf-section-chevron {
    width: 8px;
    color: rgba(111, 231, 255, 0.7);
  }

  .app-shell.layout-etf-maison .etf-section-toggle .etf-section-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.07em;
    line-height: 1.1;
  }

  .app-shell.layout-etf-maison .etf-section-count {
    min-width: 18px;
    padding: 1px 5px;
    border: 1px solid rgba(145, 160, 178, 0.14);
    border-radius: var(--radius-pill);
    text-align: center;
    font-size: 9px;
    opacity: 0.9;
  }

  .app-shell.layout-etf-maison .etf-sidebar-section-body {
    display: grid;
    gap: 3px;
    padding-top: 0;
  }

  .app-shell.layout-etf-maison .etf-sidebar-item {
    gap: 2px;
    min-height: 46px;
    margin: 0;
    padding: 7px 7px 7px 8px;
    border-left-width: 2px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.012);
  }

  .app-shell.layout-etf-maison .etf-sidebar-item.is-selected,
  .app-shell.layout-etf-maison .etf-sidebar-item:hover,
  .app-shell.layout-etf-maison .etf-sidebar-item:focus-visible {
    background: rgba(111, 231, 255, 0.055);
    outline: none;
  }

  .app-shell.layout-etf-maison .etf-sidebar-item-name {
    display: -webkit-box;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .app-shell.layout-etf-maison .etf-sidebar-item-meta {
    overflow: hidden;
    font-size: 9px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-shell.layout-etf-maison .etf-sidebar-empty {
    padding: 8px 2px;
    font-size: 10px;
    line-height: 1.35;
  }

  .app-shell.layout-etf-maison .etf-sidebar-foot {
    display: none;
  }

  .app-shell.layout-etf-maison .etf-mobile-select {
    display: none !important;
  }

  .app-shell.layout-etf-maison .etf-detail {
    grid-column: 2;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }

  .app-shell.layout-etf-maison .etf-detail-head {
    align-items: flex-start;
    padding: 9px 10px 7px;
    gap: 6px;
  }

  .app-shell.layout-etf-maison .etf-detail-title {
    display: grid;
    gap: 2px;
    width: 100%;
  }

  .app-shell.layout-etf-maison .etf-detail-title strong {
    font-size: 15px;
    line-height: 1.12;
  }

  .app-shell.layout-etf-maison .etf-detail-sub {
    font-size: 10px;
    line-height: 1.35;
  }

  .app-shell.layout-etf-maison .etf-detail-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }

  .app-shell.layout-etf-maison .etf-detail-actions .btn {
    flex: 1 1 auto;
    min-height: 32px;
    padding: 0 8px;
    font-size: 10px;
  }

  .app-shell.layout-etf-maison .etf-detail-subnav {
    padding: 0 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .app-shell.layout-etf-maison .etf-detail-subnav .etf-tab-btn {
    min-height: 40px;
    padding: 0 10px;
    font-size: 10px;
  }

  .app-shell.layout-etf-maison .etf-detail-body {
    padding: 12px 10px calc(12px + var(--safe-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .app-shell.layout-etf-maison .etf-empty {
    min-height: 180px;
    padding: 18px 10px;
  }

  .app-shell.layout-etf-maison .etf-backtest-section {
    margin-top: 16px;
    padding-top: 14px;
  }

  .app-shell.layout-etf-maison .etf-backtest-section--primary {
    margin-top: 0;
    padding-top: 0;
  }

  .app-shell.layout-etf-maison .etf-detail-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 6;
    background: rgba(7, 8, 10, 0.96);
    border-bottom-color: rgba(145, 160, 178, 0.12);
  }

  .app-shell.layout-etf-maison .etf-detail-name-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24px;
    align-items: center;
    width: 100%;
  }

  .app-shell.layout-etf-maison .etf-detail-title {
    width: auto;
    min-width: 0;
  }

  .app-shell.layout-etf-maison .etf-detail-menu-host {
    justify-self: end;
  }

  .app-shell.layout-etf-maison .etf-detail-menu {
    position: relative;
    display: block !important;
  }

  .app-shell.layout-etf-maison .etf-detail-menu > summary {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }

  .app-shell.layout-etf-maison .etf-detail-menu .topbar-mobile-panel {
    right: 0;
    left: auto;
    max-width: calc(100vw - 56px);
  }

  .app-shell.layout-etf-maison .etf-detail-name-row strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-shell.layout-etf-maison .etf-rule-info-btn {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .app-shell.layout-etf-maison .etf-detail-subnav {
    background: rgba(7, 8, 10, 0.96);
  }

  .app-shell.layout-etf-maison .etf-detail-subnav .etf-tab-btn {
    flex: 1 1 50%;
    text-align: center;
  }

  .app-shell.layout-etf-maison .etf-detail-subnav[hidden] {
    display: none !important;
  }

  .app-shell.layout-etf-maison .etf-backtest-controls--mobile {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    align-items: end;
  }

  .app-shell.layout-etf-maison .etf-backtest-controls--mobile .field {
    width: 100%;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box;
  }

  .app-shell.layout-etf-maison .etf-backtest-controls--mobile .field span {
    overflow: hidden;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-shell.layout-etf-maison .etf-backtest-controls--mobile input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .app-shell.layout-etf-maison .etf-backtest-controls--mobile #etfRunBacktestBtn {
    min-height: 38px;
  }

  .app-shell.layout-etf-maison .etf-progress {
    min-height: 88px;
    padding: 18px 4px;
  }

  .app-shell.layout-etf-maison .etf-integrity-card {
    padding: 12px 10px;
  }

  .app-shell.layout-etf-maison .etf-integrity-head {
    align-items: flex-start;
  }

  .app-shell.layout-etf-maison .etf-coverage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell.layout-etf-maison .etf-coverage-stat {
    border-top: 1px solid var(--border-subtle);
  }

  .app-shell.layout-etf-maison .etf-coverage-stat:nth-child(-n + 2) {
    border-top: none;
  }

  .app-shell.layout-etf-maison .etf-coverage-stat:nth-child(odd) {
    border-left: none;
  }

  .app-shell.layout-etf-maison .etf-universe-coverage-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .app-shell.layout-etf-maison .etf-bt-overview {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 12px;
  }

  .app-shell.layout-etf-maison .etf-perf-card span {
    font-size: 9px;
    letter-spacing: 0.06em;
  }

  .app-shell.layout-etf-maison .etf-date-range {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }

  .app-shell.layout-etf-maison .etf-date-range span {
    padding: 3px 6px;
    font-size: 10px;
  }

  .app-shell.layout-etf-maison .etf-perf-card small {
    font-size: 10px;
    line-height: 1.25;
  }

  .app-shell.layout-etf-maison .etf-perf-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 14px;
  }

  .app-shell.layout-etf-maison .etf-metric-strip-wrap {
    margin-top: -4px;
    margin-right: -10px;
    padding-right: 10px;
  }

  .app-shell.layout-etf-maison .etf-perf-card {
    min-width: 0;
    padding: 10px 8px;
    border-top: 1px solid var(--border-subtle);
    border-left: 1px solid var(--border-subtle);
  }

  .app-shell.layout-etf-maison .etf-perf-card:nth-child(1),
  .app-shell.layout-etf-maison .etf-perf-card:nth-child(2) {
    border-top: none;
  }

  .app-shell.layout-etf-maison .etf-perf-card:nth-child(odd) {
    border-left: none;
  }

  .app-shell.layout-etf-maison .etf-perf-card strong,
  .app-shell.layout-etf-maison .etf-perf-card--out strong {
    font-size: 18px;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .app-shell.layout-etf-maison .etf-chart-toolbar {
    margin-top: 12px;
  }

  .app-shell.layout-etf-maison .etf-chart-range .field {
    min-width: 118px !important;
  }

  .app-shell.layout-etf-maison .etf-stress {
    margin-top: 16px;
  }

  .app-shell.layout-etf-maison .etf-sweep-panel {
    padding: 12px 0 0;
  }

  .app-shell.layout-etf-maison .etf-sweep-controls {
    display: grid;
    grid-template-columns: minmax(74px, 28%) minmax(0, 1fr);
    grid-template-rows: 44px 34px;
    grid-template-areas:
      "count range"
      "button button";
    column-gap: 10px;
    row-gap: 12px;
    align-items: stretch;
  }

  .app-shell.layout-etf-maison .etf-sweep-controls .field {
    min-width: 0 !important;
    max-width: none;
    height: 44px;
    min-height: 44px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: 44px;
    align-items: center;
    gap: 6px;
  }

  .app-shell.layout-etf-maison .etf-sweep-controls .field span {
    align-self: center;
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
  }

  .app-shell.layout-etf-maison .etf-sweep-controls .field input {
    width: 100%;
    min-width: 0;
    height: 34px;
    padding-left: 6px;
    padding-right: 4px;
  }

  .app-shell.layout-etf-maison .etf-sweep-controls .btn {
    grid-area: button;
    height: 34px;
    min-height: 34px;
    margin-top: 0;
  }

  .app-shell.layout-etf-maison .etf-sweep-range {
    height: 44px;
    min-height: 44px;
    grid-template-rows: 14px 30px;
    gap: 0;
  }

  .app-shell.layout-etf-maison .etf-sweep-range-track {
    height: 30px;
  }

  .app-shell.layout-etf-maison .etf-sweep-range-head {
    min-height: 14px;
    line-height: 1;
    align-items: center;
  }

  .app-shell.layout-etf-maison .etf-rebalance-history {
    margin: 12px 0 14px;
  }
}
