/* Bourse Insight — application mobile. Thème clair et sombre (suit le réglage de l'iPhone). */
:root {
  --fond: #F3F5FA; --surface: #FFFFFF; --surface-2: #F6F8FC; --texte: #141B2D; --texte-2: #5B6478; --texte-3: #8A92A6;
  --ligne: rgba(27, 36, 64, .10); --accent: #3157D5; --accent-doux: rgba(49, 87, 213, .10);
  --marine: #1B2440; --marine-2: #2B3A6E; --argent: linear-gradient(135deg, #9AA3B5, #F5F7FC);
  --vert: #248A3D; --vert-doux: rgba(36, 138, 61, .12); --rouge: #D70015; --rouge-doux: rgba(215, 0, 21, .10);
  --orange: #C75100; --orange-doux: rgba(199, 81, 0, .12); --gris-doux: rgba(120, 120, 128, .12);
  --ombre: 0 1px 2px rgba(27, 36, 64, .05), 0 8px 24px rgba(27, 36, 64, .07);
  --barre: rgba(246, 248, 252, .84); --rayon: 20px;
  --haut: env(safe-area-inset-top, 0px); --bas: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0B1020; --surface: #161D33; --surface-2: #1F2842; --texte: #EEF1F8; --texte-2: #A3ABC0; --texte-3: #7C859C;
    --ligne: rgba(163, 171, 192, .16); --accent: #7C9BFF; --accent-doux: rgba(124, 155, 255, .16);
    --marine: #1B2440; --marine-2: #2B3A6E;
    --vert: #30D158; --vert-doux: rgba(48, 209, 88, .16); --rouge: #FF453A; --rouge-doux: rgba(255, 69, 58, .16);
    --orange: #FF9F0A; --orange-doux: rgba(255, 159, 10, .16); --gris-doux: rgba(120, 120, 128, .24);
    --ombre: none; --barre: rgba(14, 19, 35, .86);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--fond); color: var(--texte); font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
a { color: var(--accent); text-decoration: none; }
svg.ic { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- structure ---------- */
#app { min-height: 100%; }
.ecran { padding: calc(var(--haut) + 8px) 16px calc(var(--bas) + 96px); max-width: 760px; margin: 0 auto; animation: entree .28s ease both; }
@keyframes entree { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.entete { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.grand-titre { font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; margin: 6px 0 14px; }
.sous-titre { color: var(--texte-2); font-size: 15px; margin: -8px 0 16px; }
.retour { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); font-size: 17px; padding: 8px 4px 8px 0; }
.retour svg { width: 24px; height: 24px; }
.bouton-rond { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--accent); box-shadow: var(--ombre); }
.bouton-rond.actif { color: #FFCC00; }

/* barre d'onglets */
.onglets { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 7px 8px calc(var(--bas) + 6px); background: var(--barre); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: .5px solid var(--ligne); }
.onglets a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--texte-3); font-size: 10.5px; font-weight: 500; max-width: 110px; }
.onglets a.actif { color: var(--accent); }
.onglets svg.ic { width: 26px; height: 26px; }

/* ---------- blocs ---------- */
.carte { background: var(--surface); border-radius: var(--rayon); padding: 18px; box-shadow: var(--ombre); margin-bottom: 14px; }
.carte.serree { padding: 6px 18px; }
.titre-section { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 26px 0 4px; }
.aide { color: var(--texte-2); font-size: 14px; margin: 0 0 12px; }
.etiquette { color: var(--texte-2); font-size: 13px; font-weight: 600; }
.petit { color: var(--texte-2); font-size: 13px; }
.grille2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.grille3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 620px) { .grille2.large { grid-template-columns: repeat(3, 1fr); } }
.tuile { background: var(--surface); border-radius: 16px; padding: 13px 14px; box-shadow: var(--ombre); text-align: left; width: 100%; }
.tuile .val { font-size: 19px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.tuile .sous { color: var(--texte-2); font-size: 12px; }
.tuile .i { float: right; color: var(--texte-3); }
.tuile .i svg.ic { width: 17px; height: 17px; }
.liste { background: var(--surface); border-radius: var(--rayon); box-shadow: var(--ombre); overflow: hidden; margin-bottom: 14px; }
.ligne { display: flex; align-items: center; gap: 12px; padding: 13px 16px; width: 100%; text-align: left; position: relative; }
.ligne + .ligne::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--ligne); }
.ligne .corps { flex: 1; min-width: 0; }
.ligne .nom { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ligne .detail { color: var(--texte-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ligne .droite { text-align: right; font-weight: 600; white-space: nowrap; }
.ligne .chevron { color: var(--texte-3); width: 18px; height: 18px; }
.ligne:active, .tuile:active, .carte-lien:active { background: var(--surface-2); }

/* pastilles et badges */
.pastille { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--gris-doux); color: var(--texte-2); }
.pastille.vert { background: var(--vert-doux); color: var(--vert); }
.pastille.rouge { background: var(--rouge-doux); color: var(--rouge); }
.pastille.orange { background: var(--orange-doux); color: var(--orange); }
.pastille.bleu { background: var(--accent-doux); color: var(--accent); }
.pastilles { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.hausse { color: var(--vert); } .baisse { color: var(--rouge); } .neutre { color: var(--texte-2); }

/* recherche */
.recherche { display: flex; align-items: center; gap: 8px; background: var(--gris-doux); border-radius: 12px; padding: 0 12px; height: 44px; margin-bottom: 16px; }
.recherche input { flex: 1; border: 0; background: none; outline: none; font-size: 17px; height: 100%; min-width: 0; }
.recherche svg.ic { color: var(--texte-3); width: 19px; height: 19px; }

/* contrôle segmenté (sections d'une action, périodes) */
.segments { display: flex; gap: 4px; padding: 3px; background: var(--gris-doux); border-radius: 11px; overflow-x: auto; scrollbar-width: none; margin: 4px 0 16px; }
.segments::-webkit-scrollbar { display: none; }
.segments button { flex: 1 0 auto; padding: 7px 13px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--texte); white-space: nowrap; }
.segments button.actif { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }
.sections { position: sticky; top: 0; z-index: 10; margin: 0 -16px; padding: calc(var(--haut) + 6px) 16px 8px; background: var(--fond); }
.sections .segments { margin: 0; }

/* bandeau d'une action */
.hero { display: flex; gap: 16px; align-items: center; }
.hero .nom { font-size: 26px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
.hero .prix { font-size: 30px; font-weight: 700; letter-spacing: -.03em; margin-top: 8px; }
.hero .var { font-weight: 600; font-size: 15px; }
.hexa { width: 86px; height: 95px; flex: none; overflow: visible; }
.texte { font-size: 15px; line-height: 1.55; color: var(--texte); }
.texte p { margin: 0 0 10px; } .texte p:last-child { margin-bottom: 0; }

/* barres de note */
.barre-note { height: 6px; border-radius: 3px; background: var(--gris-doux); overflow: hidden; margin-top: 8px; }
.barre-note > div { height: 100%; border-radius: 3px; transition: width .6s ease; }
.jauge { position: relative; height: 8px; border-radius: 4px; margin: 14px 0 6px; background: linear-gradient(90deg, var(--rouge-doux), var(--gris-doux), var(--vert-doux)); }
.jauge i { position: absolute; top: -4px; width: 4px; height: 16px; border-radius: 2px; background: var(--texte); transform: translateX(-2px); }
.fourchette { position: relative; height: 54px; margin: 18px 4px 6px; }
.fourchette .zone { position: absolute; top: 22px; height: 10px; border-radius: 5px; background: var(--accent-doux); }
.fourchette .pt { position: absolute; top: 0; transform: translateX(-50%); text-align: center; font-size: 11px; color: var(--texte-2); white-space: nowrap; }
.fourchette .pt i { display: block; margin: 4px auto 0; width: 2px; height: 26px; background: var(--accent); border-radius: 1px; }
.fourchette .pt.cours i { background: var(--orange); width: 3px; }
.fourchette .pt.cours { color: var(--orange); font-weight: 700; top: auto; bottom: -18px; }

/* graphiques */
.graphe { position: relative; margin: 4px -6px 0; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.graphe svg { display: block; width: 100%; overflow: visible; }
.graphe .bulle { position: absolute; top: 0; pointer-events: none; background: var(--surface); box-shadow: 0 4px 14px rgba(0,0,0,.14);
  border-radius: 10px; padding: 6px 9px; font-size: 12px; white-space: nowrap; transform: translateX(-50%); display: none; z-index: 2; }
.graphe .bulle b { font-size: 14px; }
.legende { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--texte-2); margin-top: 6px; }
.legende i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.bascule { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 15px; padding: 4px 0; }
.interrupteur { width: 51px; height: 31px; border-radius: 16px; background: var(--gris-doux); position: relative; transition: background .2s; flex: none; }
.interrupteur::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.interrupteur.on { background: var(--vert); } .interrupteur.on::after { transform: translateX(20px); }

/* tableau défilant */
.tableau { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.tableau table { border-collapse: collapse; font-size: 13.5px; min-width: 100%; }
.tableau th, .tableau td { padding: 9px 10px; text-align: right; white-space: nowrap; border-bottom: .5px solid var(--ligne); }
.tableau th:first-child, .tableau td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
.tableau th { color: var(--texte-2); font-weight: 600; font-size: 12.5px; }
.tableau tr:last-child td { border-bottom: 0; }
.estime { color: var(--accent); }

/* boutons */
.bouton { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 50px; border-radius: 14px;
  background: linear-gradient(135deg, var(--marine), var(--marine-2)); color: #fff; font-weight: 600; font-size: 17px; box-shadow: 0 6px 18px rgba(27, 36, 64, .25); }
.bouton.secondaire { background: var(--accent-doux); color: var(--accent); }
.bouton:disabled { opacity: .55; }
.bouton-texte { color: var(--accent); font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; }

/* volet d'explication */
.voile { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.35); opacity: 0; transition: opacity .25s; }
.voile.ouvert { opacity: 1; }
.volet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 86vh; overflow-y: auto; background: var(--surface);
  border-radius: 22px 22px 0 0; padding: 10px 20px calc(var(--bas) + 24px); transform: translateY(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1);
  max-width: 760px; margin: 0 auto; overscroll-behavior: contain; }
.volet.ouvert { transform: none; }
.volet .poignee { width: 38px; height: 5px; border-radius: 3px; background: var(--gris-doux); margin: 0 auto 14px; }
.volet h3 { margin: 0 0 10px; font-size: 20px; letter-spacing: -.02em; }

/* états */
.squelette { border-radius: 12px; background: linear-gradient(90deg, var(--gris-doux) 25%, var(--surface-2) 50%, var(--gris-doux) 75%); background-size: 200% 100%; animation: brille 1.3s infinite; }
@keyframes brille { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.vide { text-align: center; color: var(--texte-2); padding: 30px 10px; }
.vide svg.ic { width: 42px; height: 42px; color: var(--texte-3); margin-bottom: 8px; }
.alerte { background: var(--orange-doux); color: var(--orange); border-radius: 14px; padding: 12px 14px; font-size: 14px; margin-bottom: 12px; }
.avertissement { color: var(--texte-3); font-size: 12px; line-height: 1.5; margin: 20px 4px; }
.charge { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: tourne .7s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }

/* accueil */
.bienvenue { margin: 10px 0 18px; }
.bienvenue h1 { font-size: 34px; letter-spacing: -.035em; line-height: 1.08; margin: 0; }
.bienvenue h1 span { background: linear-gradient(90deg, var(--marine-2), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bienvenue p { color: var(--texte-2); margin: 10px 0 0; font-size: 15px; }
.puces { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 18px; padding: 2px 16px; }
.puces::-webkit-scrollbar { display: none; }
.puces button { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--ombre); font-size: 14px; font-weight: 500; }
.idee { border-left: 4px solid var(--vert); }
.idee.perd { border-left-color: var(--rouge); }
.idee .chiffre { font-size: 28px; font-weight: 700; letter-spacing: -.03em; margin: 10px 0 2px; }
.qr { width: 220px; height: 220px; margin: 6px auto 10px; display: block; background: #fff; padding: 12px; border-radius: 18px; }
.etapes { margin: 0; padding-left: 20px; } .etapes li { margin-bottom: 8px; }

/* ---------- identité du logo : carte bleu nuit, marque ---------- */
.marque { display: flex; align-items: center; gap: 10px; margin: 4px 0 18px; }
.marque img { width: 38px; height: 38px; border-radius: 10px; box-shadow: 0 3px 10px rgba(27, 36, 64, .25); }
.marque b { font-size: 17px; letter-spacing: -.01em; }
.marque span { display: block; font-size: 12px; color: var(--texte-2); font-weight: 400; }
.carte.marine { background: radial-gradient(120% 90% at 0% 0%, #34477F 0%, transparent 60%), linear-gradient(150deg, var(--marine), #141B33);
  color: #fff; box-shadow: 0 10px 30px rgba(27, 36, 64, .28); }
.carte.marine .petit, .carte.marine .sous { color: rgba(255, 255, 255, .68); }
.carte.marine .pastille { background: rgba(255, 255, 255, .12) !important; color: #fff !important; }
.carte.marine .pastille.vert { color: #7EE8A8 !important; } .carte.marine .pastille.rouge { color: #FF9C94 !important; }
.carte.marine .pastille.orange { color: #FFC978 !important; } .carte.marine .pastille.bleu { color: #B4C6FF !important; }
.carte.marine .hausse { color: #7EE8A8; } .carte.marine .baisse { color: #FF9C94; }
.carte.marine .prix { background: linear-gradient(135deg, #FFFFFF, #B9C1D3); -webkit-background-clip: text; background-clip: text; color: transparent; }
.titre-section::after { content: ""; display: block; width: 28px; height: 3px; border-radius: 2px; margin-top: 6px; background: linear-gradient(90deg, #9AA3B5, #F5F7FC); }
@media (prefers-color-scheme: light) { .titre-section::after { background: linear-gradient(90deg, var(--marine-2), var(--accent)); } }
