/* =============================================================================
 *  Bourse FC — feuille de style
 *  1. Base & thème          5. Composants partagés (tableaux, pastilles…)
 *  2. Chrome applicatif     6. Pages (actus, classement, invest, IA, barème)
 *  3. Filtres & grille      7. Modales, fiche, éditeur
 *  4. Cartes (écusson)      8. Responsive
 * ========================================================================== */

/* ---------------------------------------------------------------- 1. BASE */
:root {
  --bg-0: #07080b;
  --bg-1: #0d0f14;
  --bg-2: #12151c;
  --bg-3: #191d26;
  --line: #262b36;
  --line-soft: #1c2029;
  --txt-0: #f2f4f8;
  --txt-1: #a9b1c1;
  --txt-2: #79839a;
  --gold: #d9b45b;
  --gold-2: #f7e3a1;
  --green: #35d07f;
  --red: #ef4a5a;
  --orange: #f59e0b;
  --blue: #4a8cff;

  /* Couleurs du signal : fixes, jamais dérivées du thème de la carte. */
  --sig-green: #22c55e;
  --sig-orange: #f59e0b;
  --sig-red: #ef4444;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 45px rgba(0, 0, 0, .55);

  /* Silhouette d'écusson (maquettes de Zac) : épaules arrondies, pointe en bas.
     Mêmes points que SHIELD_POINTS dans card.js (liseré intérieur). */
  --fut-shape: polygon(
    0% 10.5%, 9% 6.5%, 20% 3.2%, 31% 1.2%, 41% .2%, 50% 0%, 59% .2%, 69% 1.2%, 80% 3.2%, 91% 6.5%, 100% 10.5%,
    100% 78%, 53% 99.3%, 50% 100%, 47% 99.3%, 0% 78%
  );
  --hex: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1100px 640px at 12% -10%, #1a1f2b 0%, transparent 60%),
    radial-gradient(900px 520px at 92% 0%, #1d1a12 0%, transparent 55%),
    var(--bg-0);
  color: var(--txt-0);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body.has-modal { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: inherit; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .92em; color: var(--gold-2); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #262b36; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

.u-up, .is-up { color: var(--green); }
.u-down, .is-down { color: var(--red); }
.u-warn { color: var(--orange); }
.muted { color: var(--txt-2); }

/* ------------------------------------------------------ 2. CHROME APPLI */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: 10px 26px 0;
  background: rgba(10, 12, 16, .86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand__mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: linear-gradient(150deg, #f7e3a1, #c9973f 55%, #8a641f);
  color: #1a1206; border-radius: 9px; font-weight: 900; font-size: 15px;
  box-shadow: 0 4px 14px rgba(201, 151, 63, .35);
}
.brand__txt { line-height: 1.1; }
.brand__name { font-weight: 800; letter-spacing: .3px; font-size: 15px; }
.brand__sub { font-size: 10.5px; color: var(--txt-2); text-transform: uppercase; letter-spacing: 1.3px; }

.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }

/* Onglets : deuxième rangée, défilante si l'écran est étroit. */
.tabs {
  order: 10; flex: 1 0 100%;
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -6px; padding: 0 6px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 10px 14px 11px; font-size: 13.5px; font-weight: 600;
  color: var(--txt-1); border-bottom: 2px solid transparent; transition: .16s;
}
.tab:hover { color: var(--txt-0); }
.tab.is-active { color: var(--gold-2); border-bottom-color: var(--gold); }
.tab__num { font-size: 10.5px; font-weight: 800; color: var(--txt-2); letter-spacing: .5px; }
.tab.is-active .tab__num { color: var(--gold); }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 0 12px; height: 38px; width: 260px;
  transition: .16s;
}
.search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217, 180, 91, .12); }
.search input { background: none; border: none; outline: none; width: 100%; font-size: 13.5px; }
.search input::placeholder { color: var(--txt-2); }
.search svg { width: 15px; height: 15px; color: var(--txt-2); flex: none; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; position: relative;
  height: 38px; padding: 0 14px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--txt-0);
  transition: .16s;
}
.btn:hover:not(:disabled) { background: var(--bg-3); border-color: #333a49; }
.btn--primary { background: linear-gradient(180deg, #f2dda2, #c9a24a); color: #17120a; border-color: #d8bb69; }
.btn--primary:hover:not(:disabled) { filter: brightness(1.07); background: linear-gradient(180deg, #f7e6b4, #d3ad57); }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--red); border-color: #45222a; }
.btn--danger:hover:not(:disabled) { background: #2a1419; }
.btn--sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn--icon { width: 38px; padding: 0; justify-content: center; }
.btn.is-active { border-color: var(--gold); color: var(--gold-2); }
.ico { width: 17px; height: 17px; flex: none; }
.btn__tag {
  font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px;
  padding: 2px 6px; border-radius: 999px; color: var(--orange); background: rgba(245, 158, 11, .12);
}
.btn.is-busy .ico--sync { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.badge-count {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 10.5px; font-weight: 800;
  box-shadow: 0 0 0 2px var(--bg-0);
}
.badge-count[hidden] { display: none; }

.demo-banner {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px;
  padding: 6px 16px; font-size: 12px; color: #e9c46a;
  background: rgba(245, 158, 11, .07); border-bottom: 1px solid rgba(245, 158, 11, .18);
}
.demo-banner b { font-weight: 700; }
.demo-banner span { color: var(--txt-1); }

.page { padding: 24px 26px 70px; max-width: 1680px; margin: 0 auto; }
.page[hidden] { display: none; }

.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.4px; }
.page-head p { color: var(--txt-2); font-size: 13.5px; margin-top: 4px; max-width: 880px; }
.section-title { font-size: 20px; font-weight: 800; margin: 34px 0 14px; }
.sub-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--txt-1); margin: 20px 0 10px; }

/* -- Bandeau de statistiques -- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: linear-gradient(160deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; position: relative; overflow: hidden; min-width: 0;
}
.stat::after {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(180deg, var(--gold), transparent);
}
.stat__label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--txt-2); }
.stat__value { font-size: 24px; font-weight: 800; margin-top: 5px; letter-spacing: -.5px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.stat__value small { font-size: 14px; color: var(--txt-2); font-weight: 600; }
.stat__sub { font-size: 12px; color: var(--txt-1); margin-top: 2px; }
.sigcount { display: inline-flex; align-items: center; gap: 6px; }
.sigcount::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.sigcount[data-level="green"] { --c: var(--sig-green); }
.sigcount[data-level="orange"] { --c: var(--sig-orange); }
.sigcount[data-level="red"] { --c: var(--sig-red); }

/* --------------------------------------------------- 3. FILTRES & GRILLE */
.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 11px 13px; margin-bottom: 14px;
}
.filters--sub { margin-bottom: 22px; }
.filters__label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--txt-2); }
.filters__hint { font-size: 12px; color: var(--txt-2); }
.filters__spacer { flex: 1; }

.select, .input {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--txt-0);
  border-radius: 8px; height: 34px; padding: 0 10px; font-size: 13px; outline: none;
  transition: .16s; min-width: 0;
}
.select:focus, .input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217, 180, 91, .1); }
.select { padding-right: 26px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236d7688' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center; background-size: 14px;
}
.select option { background: var(--bg-2); }
.input.is-invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(239, 74, 90, .15); }

.toggle {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2);
  font-size: 13px; color: var(--txt-1); cursor: pointer;
}
.toggle input { accent-color: var(--gold); width: 15px; height: 15px; }
.toggle:has(input:checked) { border-color: var(--gold); color: var(--gold-2); }

.segmented { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.segmented--wrap { flex-wrap: wrap; margin-bottom: 10px; }
.segmented button { padding: 5px 11px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--txt-2); white-space: nowrap; }
.segmented button.is-active { background: var(--bg-3); color: var(--gold-2); }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--line); color: var(--txt-1); background: var(--bg-2); transition: .16s;
}
.chip:hover { border-color: #394254; color: var(--txt-0); }
.chip.is-active { background: rgba(217, 180, 91, .14); border-color: var(--gold); color: var(--gold-2); }
.chip--static { cursor: default; font-size: 11.5px; }

.grid {
  display: grid; gap: 30px 20px;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  justify-items: center;
}
.grid--sm { grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); }
.grid--lg { grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); }

.grid__item { animation: rise .42s cubic-bezier(.22, .9, .3, 1) backwards; display: flex; flex-direction: column; align-items: center; gap: 10px; }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.97); } }

.grid__detail {
  font-size: 11.5px; font-weight: 600; color: var(--txt-2);
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-soft);
  transition: .16s;
}
.grid__detail:hover, .grid__detail:focus-visible { color: var(--gold-2); border-color: var(--gold); }
@media (hover: hover) {
  .grid__detail { opacity: .35; }
  .grid__item:hover .grid__detail, .grid__detail:focus-visible { opacity: 1; }
}

.empty { grid-column: 1 / -1; text-align: center; padding: 70px 20px; color: var(--txt-2); }
.empty__icon { font-size: 40px; margin-bottom: 10px; opacity: .6; }
.empty__title { font-size: 17px; font-weight: 700; color: var(--txt-1); }
.empty__text { font-size: 13.5px; margin-top: 5px; }

/* ------------------------------------------------- 4. LA CARTE (ÉCUSSON) */
.fut {
  --cw: 260px;
  width: var(--cw);
  aspect-ratio: 260 / 380;
  font-size: calc(var(--cw) / 26);          /* 10 px en taille M : tout est en em */
  perspective: 1400px;
  position: relative;
  flex: none;
  /* L'ombre suit la silhouette. Posée ici (et non sur .fut__inner, en
     preserve-3d) pour ne pas casser le retournement. */
  filter: drop-shadow(0 .9em 1.1em rgba(0, 0, 0, .55));
}
.fut.is-flippable { cursor: pointer; }
.fut:focus-visible { outline: none; }
.fut:focus-visible .fut__inner { filter: drop-shadow(0 0 .35em var(--gold)); }

.fut__inner {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transition: transform .62s cubic-bezier(.3, .9, .3, 1);
}
.fut.is-flipped .fut__inner { transform: rotateY(180deg); }
@media (hover: hover) {
  .fut:not(.is-flipped):hover .fut__inner { transform: translateY(-6px) rotateX(3deg); }
  .fut.is-flipped:hover .fut__inner { transform: translateY(-6px) rotateY(180deg) rotateX(-3deg); }
}

.fut__face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.fut__face--back { transform: rotateY(180deg); }

/* Couches : cadre métallique > filet sombre > surface + reflet > texture > liseré > contenu */
.fut__face::before, .fut__face::after, .fut__shine, .fut__texture, .fut__body {
  position: absolute; clip-path: var(--fut-shape);
}
.fut__face::before { content: ''; inset: 0; z-index: 0; background: var(--frame); }
.fut__face::after  { content: ''; inset: .3em; z-index: 1; background: var(--edge); }
.fut__shine {
  inset: .42em; z-index: 2; pointer-events: none;
  background:
    linear-gradient(118deg, transparent 30%, rgba(255, 255, 255, .22) 44%, rgba(255, 255, 255, .04) 52%, transparent 64%),
    radial-gradient(70% 40% at 20% 6%, rgba(255, 255, 255, .22), transparent 70%),
    var(--surface);
}
/* Texture géométrique : éclats de lumière + trame triangulaire discrète. */
.fut__texture {
  inset: .42em; z-index: 3; pointer-events: none;
  background-image:
    linear-gradient(108deg, transparent 0 56%, rgba(255, 255, 255, .07) 56% 63%, transparent 63%),
    linear-gradient(72deg, transparent 0 64%, rgba(255, 255, 255, .05) 64% 74%, transparent 74%),
    linear-gradient(96deg, transparent 0 76%, rgba(255, 255, 255, .06) 76% 81%, transparent 81%),
    repeating-linear-gradient(60deg, var(--grid-line) 0 1px, transparent 1px 1.6em),
    repeating-linear-gradient(-60deg, var(--grid-line) 0 1px, transparent 1px 1.6em),
    linear-gradient(200deg, transparent 50%, rgba(0, 0, 0, .25));
}
.fut__line {
  position: absolute; inset: .95em; z-index: 4; width: calc(100% - 1.9em); height: calc(100% - 1.9em);
  pointer-events: none; overflow: visible;
}
.fut__line polygon { fill: none; stroke: var(--line-c); stroke-width: 1; vector-effect: non-scaling-stroke; }

.fut__body {
  inset: .42em; z-index: 5;
  padding: 2.7em 1.55em 4.3em;
  display: flex; flex-direction: column;
  color: var(--ink);
}

/* -- Recto : bandeau haut -- */
.fut-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .6em; padding: 0 .15em; }
.fut-top__rating { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; }
.fut-top__num {
  display: block; font-size: 3.7em; font-weight: 900; letter-spacing: -.04em;
  color: var(--ink); text-shadow: 0 1px 0 var(--emboss), 0 .05em .2em var(--glow-txt);
}
.fut-top__label {
  display: block; font-size: .92em; font-weight: 800; letter-spacing: .22em;
  text-transform: uppercase; color: var(--ink2); margin-top: .4em;
  text-shadow: 0 .05em .2em var(--glow-txt);
}
.fut-top__flag { margin-top: .75em; display: inline-flex; line-height: 0; }
.fut-top__flag .flag { width: 2.4em; height: 1.6em; border-radius: .18em; box-shadow: 0 0 0 1px rgba(0, 0, 0, .3), 0 .15em .35em rgba(0, 0, 0, .35); }
.flag--txt { font-size: .9em; font-weight: 800; padding: .1em .35em; border-radius: .2em; background: rgba(0, 0, 0, .3); color: #fff; line-height: 1.4; }

.fut-logo {
  width: 6.2em; height: 6.2em; flex: none; margin-top: .2em;
  display: grid; place-items: center; position: relative; overflow: hidden;
  border-radius: 1.5em;
  background: var(--logo-bg);
  border: 1px solid var(--logo-ring);
  box-shadow: 0 .3em .8em rgba(0, 0, 0, .3);
}
.fut-logo.has-img { background: var(--logo-bg-img); }
.fut-logo__mono { font-size: 2em; font-weight: 900; letter-spacing: .02em; color: var(--ink); }
.fut-logo.has-img .fut-logo__mono { display: none; }
.fut-logo__img { position: absolute; width: 72%; height: 72%; object-fit: contain; }

/* -- Recto : identité -- */
.fut-identity { margin-top: auto; text-align: center; }
.fut-identity__name {
  font-size: 2.45em; font-weight: 900; line-height: 1.02; letter-spacing: .01em; text-transform: uppercase;
  text-shadow: 0 1px 0 var(--emboss), 0 .06em .25em var(--glow-txt);
  overflow-wrap: anywhere;
}
.fut-identity__name.is-long { font-size: 1.85em; }
.fut-identity__sub {
  font-size: 1em; font-weight: 700; letter-spacing: .2em; text-transform: uppercase;
  margin-top: .5em; color: var(--hl);
}
.fut-identity__tags { display: flex; flex-wrap: wrap; gap: .35em; justify-content: center; margin-top: .55em; }
.fut-tag {
  font-size: .85em; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: .15em .55em; border-radius: 999px;
  border: 1px solid var(--rule); color: var(--ink2);
}

/* -- Recto : les deux notes -- */
.fut-ratings {
  display: flex; align-items: stretch; margin-top: .9em; padding-top: .75em;
  border-top: 1px solid var(--rule);
}
.fut-ratings__sep { width: 1px; background: var(--rule); margin: .2em .3em; }
.fut-rating { flex: 1; text-align: center; }
.fut-rating__label {
  font-size: .86em; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink2);
}
.fut-rating__value {
  font-size: 3em; font-weight: 800; line-height: 1; letter-spacing: -.03em; margin-top: .1em;
  text-shadow: 0 1px 0 var(--emboss);
}
.fut-rating__max { font-size: .95em; font-weight: 700; color: var(--hl); margin-top: .05em; }

/* -- Recto : cours & position (blocs optionnels) -- */
.fut-price {
  display: flex; align-items: baseline; justify-content: center; gap: .5em;
  margin-top: .6em; font-size: 1.1em; font-weight: 700;
}
.fut-price__chg { font-size: .85em; }
.fut-position {
  display: flex; flex-direction: column; align-items: center; gap: .1em;
  margin-top: .5em; font-size: .95em; font-weight: 600; color: var(--ink2);
}
.fut-price .is-up, .fut-position .is-up { color: var(--up-on-card); }
.fut-price .is-down, .fut-position .is-down { color: var(--down-on-card); }

/* -- Recto : pied (secteur) -- */
.fut-foot {
  margin-top: .7em; padding-top: .55em; border-top: 1px solid var(--rule);
  text-align: center; font-size: .95em; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* -- Pastille de signal (pointe de l'écusson) : couleur fixe + forme -- */
.fut-signal {
  position: absolute; z-index: 6; left: 50%; bottom: 1.3em; transform: translateX(-50%);
  width: 2.75em; height: 3.05em; display: grid; place-items: center;
  filter: drop-shadow(0 0 .45em var(--glow));
}
.fut-signal::before, .fut-signal::after { content: ''; position: absolute; clip-path: var(--hex); }
.fut-signal::before { inset: 0; background: linear-gradient(160deg, #e9edf3, #6b7280 50%, #1f2329); }
.fut-signal::after { inset: .2em; background: var(--sig); }
.fut-signal svg { position: relative; z-index: 1; width: 1.55em; height: 1.55em; color: var(--sig-ink); }
.fut-signal[data-level="green"]  { --sig: linear-gradient(160deg, #4ade80, #15803d); --glow: rgba(34, 197, 94, .75); --sig-ink: #fff; }
.fut-signal[data-level="orange"] { --sig: linear-gradient(160deg, #fcd34d, #d97706); --glow: rgba(245, 158, 11, .75); --sig-ink: #2a1600; }
.fut-signal[data-level="red"]    { --sig: linear-gradient(160deg, #f87171, #b91c1c); --glow: rgba(239, 68, 68, .75); --sig-ink: #fff; }

/* -- Verso -- */
.fut__face--back .fut__body { padding: 2.3em 1.45em 4.2em; }
.futb-head { text-align: center; }
.futb-head__title {
  font-size: 1.2em; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--hl);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.futb-head__sub { font-size: .86em; font-weight: 600; color: var(--ink2); margin-top: .15em; }
.futb-sec {
  display: flex; align-items: baseline; gap: .35em;
  margin-top: .5em; padding-top: .35em; border-top: 1px solid var(--rule);
  font-size: .9em; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--hl);
}
.futb-sec span { margin-right: auto; }
.futb-sec b { font-size: 1.25em; color: var(--ink); letter-spacing: 0; }
.futb-sec small { color: var(--ink2); font-weight: 700; letter-spacing: 0; }

.futb-fams { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .9em; margin-top: .3em; }
.futb-col { display: flex; flex-direction: column; gap: .3em; min-width: 0; }
.futb-fam__head {
  display: flex; justify-content: space-between; gap: .3em;
  font-size: .78em; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ink2);
  border-bottom: 1px solid var(--rule); padding-bottom: .1em; margin-bottom: .1em;
}
.futb-fam__head b { color: var(--ink); }
.futb-crit {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .3em;
  font-size: .9em; line-height: 1.3;
}
.futb-crit span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.futb-crit em { font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }

.futb-tech { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35em; margin-top: .3em; }
.futb-tn {
  display: flex; align-items: center; justify-content: space-between; gap: .25em;
  font-size: .86em; color: var(--ink); min-width: 0;
}
.futb-tn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.futb-conds { display: grid; grid-template-columns: 1fr 1fr; gap: .3em .9em; margin-top: .35em; }
.futb-cond { display: flex; align-items: center; gap: .4em; font-size: .9em; color: var(--ink); min-width: 0; }
.futb-cond span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Puce d'état d'une condition : fond plein + pictogramme, lisible sur tous les thèmes. */
.cond-chip {
  flex: none; display: grid; place-items: center;
  width: 1.45em; height: 1.45em; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .25);
}
.cond-chip svg { width: 1.05em; height: 1.05em; }
.cond-chip[data-state="favorable"]    { background: #15803d; color: #fff; }
.cond-chip[data-state="surveillance"] { background: #f59e0b; color: #2a1600; }
.cond-chip[data-state="attendre"]     { background: #c81e1e; color: #fff; }

/* -- Thèmes de carte -------------------------------------------------- */
.fut[data-theme="gold"] {
  --frame: linear-gradient(160deg, #fff3c4 0%, #d9ae4e 22%, #8c6420 48%, #e8c976 72%, #7a5518 100%);
  --edge: #4a3410;
  --surface: linear-gradient(160deg, #f8ecc6 0%, #e0c274 36%, #c9a352 62%, #a98436 100%);
  --ink: #2a1e07;
  --ink2: #5c4614;
  --hl: #6b4f14;
  --rule: rgba(74, 52, 16, .3);
  --emboss: rgba(255, 255, 255, .45);
  --glow-txt: transparent;
  --grid-line: rgba(74, 52, 16, .05);
  --line-c: rgba(74, 52, 16, .35);
  --logo-bg: rgba(255, 255, 255, .3);
  --logo-bg-img: rgba(255, 255, 255, .92);
  --logo-ring: rgba(74, 52, 16, .25);
  --up-on-card: #14692f;
  --down-on-card: #9b1c1c;
}
.fut[data-theme="dark"] {
  --frame: linear-gradient(160deg, var(--accent) 0%, #2a2f38 24%, #0b0d11 48%, var(--accent) 72%, #0b0d11 100%);
  --edge: #05070a;
  --surface: linear-gradient(160deg, #1d222c 0%, #0f1218 45%, #090b0f 100%);
  --ink: #f4f6fa;
  --ink2: #a3acbd;
  --hl: color-mix(in srgb, var(--accent) 70%, #ffffff);
  --rule: rgba(255, 255, 255, .15);
  --emboss: rgba(0, 0, 0, .5);
  --glow-txt: transparent;
  --grid-line: rgba(255, 255, 255, .025);
  --line-c: color-mix(in srgb, var(--accent) 55%, transparent);
  --logo-bg: rgba(255, 255, 255, .06);
  --logo-bg-img: rgba(255, 255, 255, .94);
  --logo-ring: rgba(255, 255, 255, .18);
  --up-on-card: #4ade80;
  --down-on-card: #f87171;
}
.fut[data-theme="brand"] {
  --frame: linear-gradient(150deg, color-mix(in srgb, var(--accent) 35%, #ffffff) 0%, var(--accent) 22%, color-mix(in srgb, var(--accent) 45%, #000000) 48%, color-mix(in srgb, var(--accent) 35%, #ffffff) 72%, color-mix(in srgb, var(--accent) 55%, #000000) 100%);
  --edge: rgba(0, 0, 0, .72);
  --surface: linear-gradient(155deg,
    color-mix(in srgb, var(--accent) 82%, #ffffff) 0%,
    var(--accent) 24%,
    color-mix(in srgb, var(--accent) 55%, #06070a) 56%,
    color-mix(in srgb, var(--accent2) 30%, #040508) 100%);
  --ink: #ffffff;
  --ink2: color-mix(in srgb, var(--accent) 22%, #eef2f8);
  --hl: color-mix(in srgb, var(--accent) 18%, #ffffff);
  --rule: rgba(255, 255, 255, .24);
  --emboss: rgba(0, 0, 0, .4);
  --glow-txt: rgba(0, 0, 0, .45);
  --grid-line: rgba(255, 255, 255, .035);
  --line-c: rgba(255, 255, 255, .28);
  --logo-bg: rgba(0, 0, 0, .22);
  --logo-bg-img: rgba(255, 255, 255, .96);
  --logo-ring: rgba(255, 255, 255, .3);
  --up-on-card: #bbf7d0;
  --down-on-card: #fecaca;
}
.fut[data-theme="light"] {
  --frame: linear-gradient(160deg, #ffffff 0%, #c9d0da 26%, #7e8796 50%, #e6ebf1 76%, #8e97a5 100%);
  --edge: #5d6674;
  --surface: linear-gradient(160deg, #ffffff 0%, #eceff4 40%, #d9dee6 72%, #c4cad4 100%);
  --ink: #171b24;
  --ink2: #535c6c;
  --hl: color-mix(in srgb, var(--accent) 60%, #1b2030);
  --rule: rgba(23, 27, 36, .18);
  --emboss: rgba(255, 255, 255, .8);
  --glow-txt: transparent;
  --grid-line: rgba(23, 27, 36, .035);
  --line-c: rgba(23, 27, 36, .22);
  --logo-bg: rgba(23, 27, 36, .06);
  --logo-bg-img: #ffffff;
  --logo-ring: rgba(23, 27, 36, .12);
  --up-on-card: #15803d;
  --down-on-card: #b91c1c;
}

/* Halo selon la rareté */
.fut[data-tier="ultimate"] { filter: drop-shadow(0 0 1.1em rgba(217, 180, 91, .35)) drop-shadow(0 .9em 1.1em rgba(0, 0, 0, .55)); }
.fut[data-tier="gold"] { filter: drop-shadow(0 0 .8em rgba(217, 180, 91, .2)) drop-shadow(0 .9em 1.1em rgba(0, 0, 0, .55)); }

/* ------------------------------------------ 5. COMPOSANTS PARTAGÉS */
.panel { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 17px; margin-bottom: 16px; min-width: 0; }
.panel--flush { padding: 0; overflow: hidden; }
.panel__title {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--gold);
  font-weight: 800; margin-bottom: 12px;
}
.panel__title--pad { padding: 15px 17px 0; }
.panel__aside { font-size: 11px; font-weight: 500; letter-spacing: .2px; text-transform: none; color: var(--txt-2); }
.panel__foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.panel p { font-size: 13.5px; color: var(--txt-1); line-height: 1.55; }
.panel p + p { margin-top: 8px; }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 11px 18px; }
.kv__k { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--txt-2); }
.kv__v { font-size: 13.5px; font-weight: 600; margin-top: 3px; }

.note {
  display: flex; gap: 11px; align-items: flex-start;
  background: rgba(74, 140, 255, .06); border: 1px solid rgba(74, 140, 255, .22);
  border-radius: var(--radius); padding: 13px 15px; margin-bottom: 18px;
}
.note--warn { background: rgba(245, 158, 11, .07); border-color: rgba(245, 158, 11, .3); }
.note__icon { font-size: 16px; line-height: 1.3; }
.note__text { font-size: 13px; color: var(--txt-1); line-height: 1.55; }
.note__text b { color: var(--txt-0); }

/* Tableaux */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--txt-2); padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tfoot td { border-top: 1px solid var(--line); font-weight: 600; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl--dense td { padding: 6px 8px; }
.tbl--dense th { padding: 8px 8px; }
.tbl__group td {
  background: var(--bg-2); font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--gold);
  padding-top: 7px; padding-bottom: 7px;
}
.tbl--click tbody tr[data-id] { cursor: pointer; transition: background .12s; }
.tbl--click tbody tr[data-id]:hover, .tbl--click tbody tr[data-id]:focus-visible { background: var(--bg-2); outline: none; }
.tbl th[data-sort] { cursor: pointer; user-select: none; }
.tbl th[data-sort]:hover { color: var(--txt-0); }
.tbl .is-mode { background: rgba(217, 180, 91, .06); color: var(--gold-2); }
.tbl td.is-best { background: rgba(34, 197, 94, .12); box-shadow: inset 2px 0 0 var(--sig-green); font-weight: 700; }
.tbl--ghost { opacity: .7; }
#rank-table { min-width: 780px; }
#pf-table { min-width: 820px; }
#dca-table { min-width: 560px; }
.tbl--cmp { min-width: 440px; }
.tbl--cmp th:first-child, .tbl--cmp td:first-child { width: 38%; }
.detail .tbl { min-width: 520px; }
.threshold { white-space: nowrap; }

.cell-stock { display: flex; align-items: center; gap: 7px; min-width: 0; white-space: nowrap; }
.cell-stock .muted { overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.cell-flag { display: inline-flex; line-height: 0; }
.cell-flag .flag, .bar__label .flag { width: 18px; height: 12px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .12); vertical-align: -1px; }

.tag {
  display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--txt-1); background: var(--bg-2);
  white-space: nowrap; vertical-align: middle;
}
.tag--accent { color: var(--gold-2); border-color: rgba(217, 180, 91, .45); background: rgba(217, 180, 91, .1); }
.tag--warn { color: #fbbf24; border-color: rgba(245, 158, 11, .45); background: rgba(245, 158, 11, .1); }

/* Signal en ligne */
.sig {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 11.5px; font-weight: 700; padding: 3px 9px 3px 7px; border-radius: 999px;
  color: var(--c-txt); background: var(--c-bg); border: 1px solid var(--c-bd);
}
.sig i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); }
.sig[data-level="green"]  { --c: var(--sig-green);  --c-txt: #86efac; --c-bg: rgba(34, 197, 94, .1);  --c-bd: rgba(34, 197, 94, .35); }
.sig[data-level="orange"] { --c: var(--sig-orange); --c-txt: #fcd34d; --c-bg: rgba(245, 158, 11, .1); --c-bd: rgba(245, 158, 11, .35); }
.sig[data-level="red"]    { --c: var(--sig-red);    --c-txt: #fca5a5; --c-bg: rgba(239, 68, 68, .1);  --c-bd: rgba(239, 68, 68, .35); }

/* État d'une condition (fond plein : lisible sur tous les thèmes de carte) */
.state-pill {
  display: inline-block; white-space: nowrap; font-weight: 800; font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase;
  padding: .2em .6em; border-radius: 999px; color: #fff; line-height: 1.35;
}
.state-pill[data-state="favorable"]    { background: #15803d; }
.state-pill[data-state="surveillance"] { background: #b45309; }
.state-pill[data-state="attendre"]     { background: #c81e1e; }

/* Note /5 dans un carré coloré */
.nchip {
  display: inline-grid; place-items: center; min-width: 1.6em; height: 1.45em; padding: 0 .25em;
  border-radius: .35em; font-style: normal; font-weight: 800; font-size: .88em; line-height: 1;
  color: #fff; font-variant-numeric: tabular-nums;
}
.tbl .nchip, .mini-row .nchip { font-size: 11.5px; }
.nchip[data-n="0"], .nchip[data-n="1"] { background: #c81e1e; }
.nchip[data-n="2"] { background: #c2410c; }
.nchip[data-n="3"] { background: #ca8a04; color: #1c1400; }
.nchip[data-n="4"] { background: #4d7c0f; }
.nchip[data-n="5"] { background: #15803d; }
.nchip[data-n="na"] { background: rgba(128, 128, 128, .28); color: inherit; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 10px); z-index: 99;
  max-width: min(640px, calc(100vw - 28px));
  background: #191d26; border: 1px solid #2f3542; color: #f2f4f8;
  padding: 11px 18px; border-radius: 11px; font-size: 13.5px; line-height: 1.45;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: .25s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.side { display: flex; flex-direction: column; min-width: 0; }
.two-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.two-cols--wide { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }

/* --------------------------------------------------------- 6. PAGES */
/* Actualités */
.news-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.news-grid .panel { margin-bottom: 0; }
.empty-block { text-align: center; padding: 18px 6px 8px; }
.empty-block__icon { font-size: 30px; opacity: .65; }
.empty-block__title { font-weight: 700; margin: 6px 0 8px; }
.empty-block p { font-size: 13px; }
.empty-block .empty-block__src { font-size: 12px; color: var(--txt-2); margin-top: 10px; }
.news-tickers { justify-content: center; margin: 14px 0 4px; }

/* Classement */
.mini-row {
  width: 100%; display: grid; grid-template-columns: 22px auto minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 8px 6px; border-radius: 9px; text-align: left; font-size: 13px; transition: background .12s;
}
.mini-row:hover { background: var(--bg-2); }
.mini-row__rank { font-weight: 800; color: var(--gold); text-align: center; }
.mini-row__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--txt-1); }
.mini-row__name b { color: var(--txt-0); margin-right: 4px; }
.mini-row__score { font-weight: 800; font-size: 15px; }
.mini-row__score small { font-size: 11px; color: var(--txt-2); font-weight: 600; }
.mini-row .cell-flag .flag, .mini-row .flag { width: 18px; height: 12px; border-radius: 2px; }

.log { display: flex; flex-direction: column; max-height: 360px; overflow: auto; }
.log-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; padding: 8px 6px 8px 10px; border-left: 2px solid transparent; font-size: 12.5px; }
.log-row + .log-row { border-top: 1px solid var(--line-soft); }
.log-row.is-unread { border-left-color: var(--gold); background: rgba(217, 180, 91, .04); }
.log-row__date { color: var(--txt-2); font-size: 11.5px; }
.log-row__stock { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--txt-1); }
.log-row__stock b { color: var(--txt-0); }
.log-row__change { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; color: var(--txt-2); }

/* Investissement */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar { display: grid; grid-template-columns: minmax(110px, 170px) minmax(0, 1fr) 54px 84px; align-items: center; gap: 10px; font-size: 13px; }
.bar__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.bar__track { position: relative; height: 9px; background: var(--bg-3); border-radius: 5px; }
.bar__track i { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: linear-gradient(90deg, #a5822d, var(--gold-2)); }
.bar__track b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: rgba(239, 68, 68, .7); border-radius: 1px; }
.bar.is-over .bar__track i { background: linear-gradient(90deg, #b45309, #f87171); }
.bar.is-over .bar__val { color: #fca5a5; }
.bar__val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar__eur { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.alerts { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: 13.5px; color: #fcd34d; }
.ok-line { color: var(--green) !important; margin-top: 10px; }

.dca-inputs, .weights { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 22px; margin-bottom: 12px; }
.field--inline { display: flex; flex-direction: column; gap: 5px; font-size: 11px; text-transform: uppercase; letter-spacing: .9px; color: var(--txt-2); font-weight: 700; }
.input-unit { display: inline-flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--txt-1); }
.input-unit .input { width: 110px; height: 36px; font-size: 14px; }
.dca-rule { font-size: 13px !important; margin-bottom: 12px; }

/* Conseils & IA */
.cmp-pickers { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cmp-pickers .select { flex: 1 1 200px; }
.cmp-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; padding: 6px 0 22px; }
#syn-stock { width: 100%; max-width: 360px; margin-bottom: 12px; }
.syn h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .9px; margin: 16px 0 6px; color: var(--txt-0); }
.syn ul { list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--txt-1); }
.syn ul li::before { content: '· '; color: var(--txt-2); }
.syn-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); font-size: 13.5px; line-height: 1.5; }
.syn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.disclaimer { font-size: 11.5px !important; color: var(--txt-2) !important; font-style: italic; margin-top: 16px !important; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.assistant textarea { width: 100%; height: auto; padding: 10px 12px; margin: 12px 0 10px; resize: none; opacity: .6; font-family: inherit; }

/* Barème */
.bareme-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 16px; font-size: 13px; color: var(--txt-1); }
.bareme-status { flex: 1; min-width: 200px; color: var(--green); }
.bareme-status.is-error { color: #fca5a5; }
.bareme-help { font-size: 12.5px !important; margin-bottom: 10px; }
.table-wrap + p { margin-top: 12px; font-size: 12.5px; }
.formula { padding: 8px 10px; background: var(--bg-2); border-radius: 8px; border: 1px solid var(--line); font-size: 12.5px; }
#bareme-table { min-width: 880px; }
.tbl--edit td { padding: 5px 6px; }
.input--cell { width: 4.6em; height: 30px; padding: 0 6px; text-align: right; font-variant-numeric: tabular-nums; }
.input--cell.is-own { border-color: rgba(217, 180, 91, .6); background: rgba(217, 180, 91, .08); }
.cell-cmp, .cell-unit { font-size: 11px; color: var(--txt-2); margin: 0 3px; }
.impact-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.impact-list { display: flex; flex-wrap: wrap; gap: 6px; }
.impact { font-size: 12px; padding: 3px 8px; border-radius: 7px; background: var(--bg-2); border: 1px solid var(--line); color: var(--txt-1); }
.impact b { color: var(--txt-0); margin-right: 3px; }
.rules { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--txt-1); line-height: 1.5; }
.rules b { color: var(--txt-0); }
.signal-legend { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 14px 0 10px; font-size: 12.5px; color: var(--txt-1); }
.signal-legend span { display: inline-flex; align-items: center; gap: 8px; }

/* Sources */
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(268px, 100%), 1fr)); gap: 14px; }
.conn {
  background: linear-gradient(160deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 9px;
}
.conn__head { display: flex; align-items: center; gap: 10px; }
.conn__icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-3); font-size: 17px; }
.conn__name { font-weight: 700; font-size: 14.5px; }
.conn__mode { font-size: 11.5px; color: var(--txt-2); }
.conn__role { font-size: 12.5px; color: var(--txt-1); line-height: 1.45; }
.conn__foot { display: flex; align-items: center; gap: 9px; margin-top: auto; padding-top: 6px; }
.badge { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; padding: 3px 8px; border-radius: 999px; border: 1px solid; }
.badge--active { color: var(--green); border-color: rgba(53, 208, 127, .35); background: rgba(53, 208, 127, .1); }
.badge--idle { color: var(--txt-2); border-color: var(--line); background: var(--bg-2); }

.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 12px; }
.pipe { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.pipe__step { font-size: 10.5px; font-weight: 800; letter-spacing: 1.1px; color: var(--gold); text-transform: uppercase; }
.pipe__title { font-size: 14px; font-weight: 700; margin: 6px 0 4px; }
.pipe__text { font-size: 12.5px; color: var(--txt-2); line-height: 1.45; }

/* ------------------------------------------ 7. MODALES, FICHE, ÉDITEUR */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4, 5, 8, .78); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 24px;
  overflow-y: auto;                         /* filet de sécurité si la modale dépasse */
  animation: fade .2s ease;
}
.overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }

.modal {
  background: linear-gradient(170deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  width: min(1180px, 100%); max-height: 90vh; display: flex; flex-direction: column;
  animation: pop .26s cubic-bezier(.2, .9, .3, 1);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }

.modal__head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal__title { font-size: 17px; font-weight: 800; }
.modal__sub { font-size: 12.5px; color: var(--txt-2); margin-top: 2px; }
.modal__close { margin-left: auto; width: 34px; height: 34px; flex: none; border-radius: 8px; color: var(--txt-2); font-size: 18px; }
.modal__close:hover { background: var(--bg-3); color: var(--txt-0); }
.modal__body { padding: 20px; overflow: auto; }
.modal__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); }
.modal__foot .modal__foot-left { margin-right: auto; }

/* Fiche détaillée */
.detail { display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 26px; }
.detail__card { display: flex; flex-direction: column; align-items: center; gap: 14px; position: sticky; top: 0; align-self: start; }
.detail__hint { font-size: 12px; color: var(--txt-2); }
.detail__panels { display: flex; flex-direction: column; min-width: 0; }
.detail__panels .panel:last-child { margin-bottom: 0; }

.conds { display: flex; flex-direction: column; }
.cond { display: grid; grid-template-columns: 12px 150px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 0; font-size: 13px; }
.cond + .cond { border-top: 1px solid var(--line-soft); }
.cond__dot { width: 10px; height: 10px; border-radius: 50%; }
.cond__dot[data-state="favorable"] { background: var(--sig-green); }
.cond__dot[data-state="surveillance"] { background: var(--sig-orange); }
.cond__dot[data-state="attendre"] { background: var(--sig-red); }
.cond__label { font-weight: 600; }
.cond__detail { color: var(--txt-2); font-size: 12.5px; }
.cond-total { display: flex; align-items: flex-start; gap: 12px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--txt-1); line-height: 1.5; }
.cond-total small { display: block; }

.hc { display: block; width: 100%; height: auto; }
.hc__grid { stroke: var(--line); stroke-dasharray: 3 4; }
.hc__axis { fill: var(--txt-2); font-size: 10px; }
.hc__line { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; }
.hc__dot { stroke: var(--bg-1); stroke-width: 2; }
.hc__dot[data-level="green"] { fill: var(--sig-green); }
.hc__dot[data-level="orange"] { fill: var(--sig-orange); }
.hc__dot[data-level="red"] { fill: var(--sig-red); }
.hc__dates { display: flex; justify-content: space-between; font-size: 11px; color: var(--txt-2); margin-top: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 11.5px; color: var(--txt-2); }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend__line { width: 16px; height: 2px; background: var(--gold); }
.legend__dot { width: 8px; height: 8px; border-radius: 50%; }
.legend__dot[data-level="green"] { background: var(--sig-green); }
.legend__dot[data-level="orange"] { background: var(--sig-orange); }
.legend__dot[data-level="red"] { background: var(--sig-red); }

/* Éditeur */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 22px; align-items: start; }
.editor__preview { position: sticky; top: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.editor__info { font-size: 12.5px; color: var(--txt-1); text-align: center; line-height: 1.8; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form__full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--txt-2); font-weight: 700; }
.field__unit { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--txt-2); opacity: .8; }
.field .input, .field .select, .field textarea {
  height: 36px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 0 11px; font-size: 13.5px; outline: none; color: var(--txt-0); width: 100%;
}
.field textarea { height: auto; padding: 9px 11px; resize: vertical; min-height: 74px; font-family: inherit; }
.field .input:focus, .field .select:focus, .field textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217, 180, 91, .1); }
.field .input.is-invalid { border-color: var(--red); }
.field__hint { font-size: 11px; color: var(--txt-2); }
.field--colors .colors { display: flex; gap: 8px; }
.field--colors input[type="color"] { width: 56px; padding: 2px 4px; cursor: pointer; }
.field--switch { align-self: end; height: 36px; }

.fieldset { border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px 12px; margin-bottom: 10px; }
.fieldset legend { padding: 0 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--gold-2); }
.fieldset__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); gap: 10px 12px; }

.form-section {
  grid-column: 1 / -1; margin-top: 6px; padding-top: 13px; border-top: 1px solid var(--line);
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--gold); font-weight: 800;
}
.form-section:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.form-section small { display: block; text-transform: none; letter-spacing: 0; color: var(--txt-2); font-weight: 500; margin-top: 4px; font-size: 11.5px; }
.display-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); gap: 8px; }

.switch-row { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--txt-1); text-transform: none; letter-spacing: 0; font-weight: 500; }
.switch-row input { accent-color: var(--gold); width: 15px; height: 15px; flex: none; }

/* ----------------------------------------------------------- 8. RESPONSIVE */
@media (max-width: 1180px) {
  .split { grid-template-columns: 1fr; }
  .news-grid { grid-template-columns: 1fr; }
  .detail { grid-template-columns: 1fr; }
  .detail__card { position: static; }
  .two-cols--wide { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
  .editor__preview { position: static; }
  .two-cols { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar { padding: 8px 14px 0; gap: 8px 10px; }
  .search { order: 5; width: 100%; }
  .brand__sub, .btn__txt, .btn__tag { display: none; }
  #btn-sync, #btn-add { width: 38px; padding: 0; justify-content: center; }
  .page { padding: 18px 14px 60px; }
  .page-head h1 { font-size: 22px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 13px; }
  .stat__value { font-size: 20px; }
  .filters .select { flex: 1 1 calc(50% - 10px); }
  .filters__spacer { display: none; }
  .form { grid-template-columns: 1fr; }
  .syn-grid { grid-template-columns: 1fr; }
  .bar { grid-template-columns: minmax(90px, 120px) minmax(0, 1fr) 48px; }
  .bar__eur { display: none; }
  .cond { grid-template-columns: 12px minmax(0, 1fr) auto; }
  .cond__detail { grid-column: 2 / -1; }
  .overlay { padding: 0; }
  /* Plein écran : hauteur fixée sur la fenêtre (un height: 100% dans la
     grille de l'overlay prendrait la hauteur du contenu, et le bas de la
     fiche deviendrait inaccessible). dvh suit la barre d'adresse mobile. */
  .modal { width: 100%; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; border: none; }
  .modal__body { padding: 14px; }
  .modal__head, .modal__foot { padding: 12px 14px; }
  /* La carte L de la fiche ne doit pas déborder sur un téléphone. */
  .detail__card .fut { --cw: min(300px, 78vw) !important; }
}
@media (max-width: 420px) {
  .tab { padding: 9px 10px 10px; font-size: 13px; }
  .filters .select, .filters .toggle { flex: 1 1 100%; }
  .modal__foot .btn { flex: 1 1 auto; justify-content: center; }
  .modal__foot .modal__foot-left { flex-basis: 100%; margin-right: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
