/* =========================================================
   MASTER DeFi — Dashboard FORTUNE (Pilier F)
   Premium · ergonomique · accent Violet Cosmique
   ========================================================= */

:root {
  /* Surfaces — quasi-noir « Tesla », cartes flottantes sur fond profond */
  --bg:        #060708;
  --bg-soft:   #0A0C10;
  --bg-card:   #101216;   /* carte mate, opaque, surélevée */
  --bg-elev:   #171A20;
  --line:      #242833;
  --line-soft: #161A21;

  /* Accents de pilier — désaturés, posés comme des touches, jamais comme du néon */
  --violet:        #8B5CFF;   /* Fortune */
  --violet-bright: #B49BFF;
  --violet-deep:   #6B3FE0;
  --blue:          #3B82E8;
  --blue-bright:   #7FB0FF;
  --blue-deep:     #1F4FA8;
  --gold:          #C9A24B;   /* or feutré, ton « lingot » plutôt que jaune vif */
  --gold-bright:   #E2C078;
  --gold-deep:     #9C7A28;
  --platine:       #C2C8D4;

  /* accent dynamique (pilotage par pilier) — défaut violet (F) */
  --accent:        var(--violet);
  --accent-bright: var(--violet-bright);
  --accent-deep:   var(--violet-deep);
  --accent-glow:   rgba(139, 92, 255, 0.10);  /* halo quasi nul — sobriété */
  --accent-text:   var(--accent-bright); /* texte accent lisible (clair en sombre) */
  --on-accent:     #fff;                 /* texte posé SUR un fond accent plein */
  --warn-text:     var(--gold-bright);   /* texte doré (surveillance) lisible */

  --up:        #3CCB8E;
  --up-soft:   rgba(60, 203, 142, 0.12);
  --down:      #E5697A;
  --down-soft: rgba(229, 105, 122, 0.12);

  --ink:       #F1F3F7;
  --ink-dim:   #9AA2B2;
  --ink-faded: #646C7C;

  --hair:       rgba(255,255,255,0.08);  /* filet fin universel */
  --glass:      rgba(255,255,255,0.025);
  --glass-line: rgba(255,255,255,0.08);
  --shadow:     0 26px 60px -30px rgba(0,0,0,0.9);
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.35);
  /* cartes sans bordure : arête supérieure subtile (sombre) + fond des tuiles internes */
  --card-edge:  inset 0 1px 0 rgba(255,255,255,0.05);
  --tile:       rgba(255,255,255,0.04);
  --tile-line:  rgba(255,255,255,0.07);

  --font-display: 'Space Grotesk','Inter',Arial,sans-serif;
  --font-serif:   'Space Grotesk','Inter',Arial,sans-serif; /* DA fintech : chiffres & titres en sans (ex-Fraunces) */
  --font-num:     'Space Grotesk','Inter',Arial,sans-serif; /* chiffres héros */
  --font-body:    'Inter',-apple-system,BlinkMacSystemFont,Arial,sans-serif;
  --r: 22px;
  --r-sm: 14px;
}

/* Thématisation par pilier */
[data-pillar="p"] { --accent: var(--blue);   --accent-bright: var(--blue-bright);   --accent-deep: var(--blue-deep);   --accent-glow: rgba(59,130,232,0.10); }
[data-pillar="r"] { --accent: var(--gold);   --accent-bright: var(--gold-bright);   --accent-deep: var(--gold-deep);   --accent-glow: rgba(201,162,75,0.10); --on-accent: #20180A; }
[data-pillar="f"] { --accent: var(--violet); --accent-bright: var(--violet-bright); --accent-deep: var(--violet-deep); --accent-glow: rgba(139,92,255,0.10); }
[data-pillar="o"] { --accent: #8A93A6; --accent-bright: #B2BAC8; --accent-deep: #5C6678; --accent-glow: rgba(138,147,166,0.10); }
:root[data-theme="light"][data-pillar="o"] { --accent-bright: #4A5364; }
[data-pillar="g"] { --accent: #7E8AA6; --accent-bright: #AAB4CC; --accent-deep: #545E76; --accent-glow: rgba(126,138,166,0.10); }
:root[data-theme="light"][data-pillar="g"] { --accent-bright: #454E66; }

/* ===== Mode clair — graphite sur blanc architectural (crisp, instrument) ===== */
:root[data-theme="light"] {
  --bg:        #EDEFF2;   /* canvas gris froid, pas d'ivoire */
  --bg-soft:   #E6E9ED;
  --bg-card:   #FFFFFF;   /* cartes blanc pur */
  --bg-elev:   #FFFFFF;
  --line:      #E1E4E9;   /* hairline neutre froide */
  --line-soft: #ECEEF1;

  --ink:       #0C0F15;   /* quasi-noir, contraste élevé */
  --ink-dim:   #515761;
  --ink-faded: #868C97;

  --hair:       rgba(12,15,21,0.07);
  --glass:      rgba(12,15,21,0.02);
  --glass-line: rgba(12,15,21,0.09);
  --shadow:     0 24px 50px -32px rgba(15,20,30,0.24), 0 2px 8px -4px rgba(15,20,30,0.07);
  --shadow-sm:  0 1px 2px rgba(15,20,30,0.07);
  --card-edge:  none;
  --tile:       rgba(12,15,21,0.038);
  --tile-line:  rgba(12,15,21,0.06);

  --gold:       #9C7A28;
  --gold-bright:#7E6320;
  --gold-deep:  #6B5418;
  --accent-text: var(--accent-deep); /* en clair : accent foncé pour lisibilité */
  --warn-text:   var(--gold-deep);
  --up:         #0F8A59;
  --up-soft:    rgba(15,138,89,0.10);
  --down:       #C53646;
  --down-soft:  rgba(197,54,70,0.10);
}
:root[data-theme="light"] body { background-image: none; }
:root[data-theme="light"] .sidebar { background: var(--bg-soft); }
:root[data-theme="light"] .nav-item:hover,
:root[data-theme="light"] table.positions tbody tr:hover,
:root[data-theme="light"] .alloc-row:hover,
:root[data-theme="light"] .alloc-row.hot { background: rgba(12,15,21,0.04); }
:root[data-theme="light"] .tabbar .cnt { background: rgba(12,15,21,0.06); color: var(--ink-dim); }
:root[data-theme="light"] .mobile-bar { background: rgba(255,255,255,0.9); }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  /* vignette neutre très discrète + grain de papier — pas de halo coloré */
  background-image:
    radial-gradient(1200px 700px at 50% -15%, rgba(255,255,255,0.022), transparent 60%);
  background-attachment: fixed;
}
/* grain fin appliqué sur toute la page (texture « papier de luxe ») */
body::before {
  content:''; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.32;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}
:root[data-theme="light"] body::before { opacity: 0.14; mix-blend-mode: multiply; }
.app, .modal-scrim { position: relative; z-index: 1; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.03em; line-height: 1.08; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.serif { font-family: var(--font-serif); font-weight: 500; letter-spacing: -0.01em; font-optical-sizing: auto; }

/* ===== LAYOUT ===== */
.app { display: grid; grid-template-columns: 258px 1fr; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--bg-soft);
  border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column;
  padding: 24px 16px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 24px; margin-bottom: 4px; border-bottom: 1px solid var(--hair); }
.brand img { width: 36px; height: 36px; }
.brand-text { font-family: var(--font-serif); font-weight: 600; font-size: 1.18rem; letter-spacing: -0.01em; }
.brand-text small { display: block; font-family: var(--font-body); font-size: 0.62rem; color: var(--ink-faded); letter-spacing: 0.24em; text-transform: uppercase; font-weight: 500; margin-top: 2px; }
.nav-group-label { font-size: 0.64rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-faded); padding: 20px 12px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--r-sm);
  color: var(--ink-dim); font-size: 0.92rem; font-weight: 500;
  transition: background 0.2s, color 0.2s; cursor: pointer; position: relative;
}
.nav-item:hover { background: var(--glass); color: var(--ink); }
.nav-item.active { background: color-mix(in srgb,var(--accent) 9%,transparent); color: var(--ink); }
.nav-item.active::before { content:''; position:absolute; left:0; top:8px; bottom:8px; width:2px; border-radius:2px; background: var(--accent); }
.nav-item .ic { width: 18px; text-align: center; opacity: 0.75; }
.nav-item .ic-pillar { width: 20px; height: 20px; flex-shrink: 0; opacity: 0.9; transition: opacity 0.2s; }
.nav-item:hover .ic-pillar, .nav-item.active .ic-pillar { opacity: 1; }
.nav-item .badge { margin-left: auto; font-size: 0.62rem; background: transparent; border: 1px solid color-mix(in srgb,var(--accent) 45%,transparent); color: var(--accent-text); border-radius: 5px; padding: 1px 6px; font-weight: 600; letter-spacing: 0.04em; }
.sidebar-foot { margin-top: auto; }
.user-chip {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border: 1px solid var(--hair); border-radius: var(--r-sm);
  background: var(--bg-card);
}
.user-av { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-elev); border: 1px solid var(--hair); display:grid; place-items:center; font-family: var(--font-serif); font-weight:600; font-size:0.82rem; color:var(--ink-dim); }
.user-chip .nm { font-size: 0.85rem; font-weight: 600; }
.user-chip .pl { font-size: 0.72rem; color: var(--ink-faded); }

/* ===== MAIN ===== */
.main { min-width: 0; padding: 26px 30px 50px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.crumb { font-size: 0.66rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-faded); margin-bottom: 10px; display:flex; align-items:center; gap:8px; }
.crumb .dot { width:5px; height:5px; border-radius:50%; background: var(--accent); }
.topbar h1 { font-family: var(--font-serif); font-weight: 500; font-size: clamp(1.7rem, 3vw, 2.25rem); letter-spacing: -0.015em; }
.topbar .sub { color: var(--ink-dim); font-size: 0.9rem; margin-top: 7px; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.networth { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; padding-right: 18px; border-right: 1px solid var(--hair); }
.nw-label { font-size: 0.6rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-faded); }
.nw-val { font-family: var(--font-serif); font-weight: 600; font-size: 1.5rem; letter-spacing: -0.01em; margin-top: 3px; }
.nw-asof { font-size: 0.66rem; color: var(--ink-faded); margin-top: 3px; }
.icon-btn { width: 40px; height: 40px; padding: 0; display: inline-grid; place-items: center; font-size: 1.05rem; border-radius: 9px; transition: border-color 0.2s, background 0.2s, transform 0.15s; }
.icon-btn:hover { transform: translateY(-1px); }

.segmented { display: inline-flex; background: var(--bg-elev); border: 1px solid var(--hair); border-radius: 9px; padding: 3px; }
.segmented button { padding: 7px 14px; border-radius: 6px; font-size: 0.82rem; color: var(--ink-dim); font-weight: 500; transition: all 0.2s; }
.segmented button.active { background: var(--bg-card); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn-ghost { padding: 9px 16px; border: 1px solid var(--hair); border-radius: 9px; background: var(--bg-card); font-size: 0.85rem; font-weight: 500; transition: border-color 0.2s, color 0.2s; display:inline-flex; align-items:center; gap:8px; }
.btn-ghost:hover { border-color: color-mix(in srgb,var(--ink) 24%,transparent); color: var(--ink); }
.live-badge { display:inline-flex; align-items:center; gap:8px; font-size:0.76rem; color:var(--ink-dim); padding:8px 14px; border:1px solid var(--glass-line); border-radius:20px; background:var(--glass); white-space:nowrap; }
.live-badge .lb-dot { width:7px; height:7px; border-radius:50%; background:var(--up); box-shadow:0 0 8px var(--up); animation:lbpulse 2s infinite; }
.live-badge.off { color:var(--ink-faded); }
.live-badge.off .lb-dot { background:var(--down); box-shadow:none; animation:none; }
@keyframes lbpulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ===== KPI ===== */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.kpi {
  padding: 22px 24px; background: var(--bg-card); border: none;
  border-radius: var(--r); position: relative; overflow: hidden;
  box-shadow: var(--shadow), var(--card-edge);
  transition: transform 0.22s var(--ease, ease), box-shadow 0.22s ease;
}
.kpi:hover { transform: translateY(-3px); }
.kpi.hl { background: color-mix(in srgb,var(--accent) 5%,var(--bg-card)); }
.kpi.hl::after { content:''; position:absolute; left:0; top:0; bottom:0; width:2px; background: var(--accent); }
.kpi .label { font-size: 0.7rem; color: var(--ink-faded); letter-spacing: 0.1em; text-transform: uppercase; display:flex; align-items:center; gap:8px; }
.kpi .label .ic { color: var(--accent-text); opacity: 0.8; }
.kpi .val { font-family: var(--font-serif); font-size: 1.78rem; font-weight: 600; margin: 12px 0 7px; letter-spacing: -0.015em; }
.kpi .delta { font-size: 0.8rem; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 6px; }
.delta.up { color: var(--up); background: var(--up-soft); }
.delta.down { color: var(--down); background: var(--down-soft); }
.kpi .spark { position: absolute; right: 14px; bottom: 14px; width: 90px; height: 36px; opacity: 0.9; }
.kpi .foot { font-size: 0.74rem; color: var(--ink-faded); margin-top: 8px; }

/* ===== GRID PANELS ===== */
.grid { display: grid; gap: 16px; }
.cols-2-1 { grid-template-columns: 2fr 1fr; }
.cols-1-1 { grid-template-columns: 1fr 1fr; }
.panel {
  background: var(--bg-card); border: none; border-radius: var(--r);
  padding: 26px 28px; box-shadow: var(--shadow), var(--card-edge);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--hair); }
.panel-head h3 { font-size: 1.06rem; font-weight: 600; letter-spacing: -0.01em; }
.panel-head .hint { font-size: 0.72rem; color: var(--ink-faded); text-transform: uppercase; letter-spacing: 0.08em; }
.legend { display:flex; gap:16px; flex-wrap:wrap; font-size:0.78rem; color:var(--ink-dim); }
.legend i { display:inline-block; width:9px; height:9px; border-radius:3px; margin-right:6px; vertical-align:middle; }

/* equity chart */
.chart-wrap { position: relative; }
.equity-figure { font-family: var(--font-serif); font-size: 2.1rem; font-weight: 600; letter-spacing: -0.015em; }
.equity-meta { display:flex; align-items:baseline; gap:14px; margin-bottom:6px; }
#equityChart { width: 100%; height: 280px; display: block; }
.chart-tooltip {
  position: absolute; pointer-events: none; opacity: 0; transform: translate(-50%, -120%);
  background: rgba(20,24,35,0.95); border: 1px solid var(--glass-line); border-radius: 8px;
  padding: 8px 12px; font-size: 0.78rem; white-space: nowrap; transition: opacity 0.12s; z-index:5;
  box-shadow: var(--shadow);
}
.chart-tooltip .t-val { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; color: var(--ink); }
.chart-tooltip .t-date { color: var(--ink-faded); font-size: 0.7rem; }
:root[data-theme="light"] .chart-tooltip { background: rgba(255,255,255,0.97); }

/* donut */
.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut { position: relative; width: 168px; height: 168px; flex-shrink: 0; }
.donut .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.donut .center .big { font-family: var(--font-serif); font-size: 1.55rem; font-weight: 600; letter-spacing: -0.01em; }
.donut .center .sm { font-size: 0.7rem; color: var(--ink-faded); }
.donut svg .dseg { cursor: pointer; transition: opacity 0.15s ease; }
.donut .center .big, .donut .center .sm { transition: color 0.15s ease; }
.alloc-list { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.alloc-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: 0.85rem; padding: 6px 8px; border-radius: 8px; cursor: pointer; transition: background 0.15s ease; }
.alloc-row:hover, .alloc-row.hot { background: rgba(255,255,255,0.055); }
.alloc-row .nm { display:flex; align-items:center; gap:8px; }
.alloc-row .pct { color: var(--ink-dim); font-variant-numeric: tabular-nums; }

/* positions table */
.table-scroll { overflow-x: auto; margin: 0 -4px; }
table.positions { width: 100%; border-collapse: collapse; min-width: 720px; }
table.positions th {
  text-align: left; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faded); font-weight: 500; padding: 0 14px 14px; border-bottom: 1px solid var(--line-soft);
}
table.positions th.r, table.positions td.r { text-align: right; }
table.positions td { padding: 14px; border-bottom: 1px solid var(--line-soft); font-size: 0.9rem; vertical-align: middle; }
table.positions tr:last-child td { border-bottom: none; }
table.positions tbody tr { transition: background 0.15s; }
table.positions tbody tr:hover { background: var(--glass); }
.asset { display: flex; align-items: center; gap: 12px; }
.asset .tk { width: 34px; height: 34px; border-radius: 50%; display:grid; place-items:center; font-family: var(--font-display); font-weight: 700; font-size: 0.78rem; color:#fff; flex-shrink:0; }
.asset .nm { font-weight: 600; }
.asset .full { font-size: 0.74rem; color: var(--ink-faded); }
.asset .nm a { color: inherit; text-decoration: none; transition: color 0.15s; }
.asset .nm a:hover { color: var(--accent-text); }
.pnl { font-weight: 600; font-variant-numeric: tabular-nums; }
.pnl.up { color: var(--up); }
.pnl.down { color: var(--down); }
.chip { font-size: 0.68rem; padding: 3px 9px; border-radius: 5px; font-weight: 600; letter-spacing: 0.03em; }
.chip.runner { background: var(--up-soft); color: var(--up); }
.chip.watch { background: rgba(242,180,60,0.14); color: var(--warn-text); }
.chip.scaling { background: rgba(45,125,242,0.14); color: var(--blue); }
.row-spark { width: 84px; height: 30px; }

/* ===== Historique des ajustements (timeline rebalancements) ===== */
.timeline { list-style: none; position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding: 4px 0 22px; }
.tl-item:last-child { padding-bottom: 2px; }
.tl-dot { position: absolute; left: -23px; top: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--ink-faded); border: 2px solid var(--bg-card); box-shadow: 0 0 0 1px var(--line); }
.tl-dot.buy { background: var(--up); }
.tl-dot.sell { background: var(--down); }
.tl-dot.neutral { background: var(--accent); }
.tl-top { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.tl-kind { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em; padding: 3px 10px; border-radius: 5px; border: 1px solid var(--hair); color: var(--ink-dim); background: var(--bg-elev); }
.tl-kind.buy { color: var(--up); background: var(--up-soft); border-color: transparent; }
.tl-kind.sell { color: var(--down); background: var(--down-soft); border-color: transparent; }
.tl-kind.neutral { color: var(--accent-text); background: color-mix(in srgb,var(--accent) 9%,transparent); border-color: transparent; }
.tl-date { font-size: 0.74rem; color: var(--ink-faded); }
.tl-note { font-size: 0.86rem; color: var(--ink-dim); line-height: 1.55; max-width: 64ch; }
.flux { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.flux .fx { display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; font-weight: 600; font-variant-numeric: tabular-nums; padding: 3px 9px; border-radius: 5px; border: 1px solid var(--hair); color: var(--ink); }
.flux .fx.in { background: var(--up-soft); color: var(--up); border-color: transparent; }
.flux .fx.out { background: var(--down-soft); color: var(--down); border-color: transparent; }
.flux .fx .fam-dot { margin: 0; }

/* pépites cards */
.pepites { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.pepite { padding: 20px; background: var(--tile); border: none; border-radius: var(--r); transition: transform 0.25s, background 0.25s; }
.pepite:hover { transform: translateY(-3px); background: color-mix(in srgb, var(--accent) 7%, var(--tile)); }
.pepite-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.pepite .tk { width: 38px; height: 38px; border-radius: 11px; display:grid; place-items:center; font-family: var(--font-display); font-weight:700; color:#fff; font-size:0.82rem; }
.pepite h4 { font-size: 1rem; }
.pepite .sub { font-size: 0.76rem; color: var(--ink-faded); }
.conv { display:flex; gap:4px; margin: 12px 0; }
.conv i { width: 100%; height: 5px; border-radius: 3px; background: var(--line); }
.conv i.on { background: var(--accent); }
.pepite-meta { display:flex; justify-content:space-between; font-size:0.78rem; color: var(--ink-dim); margin-top:12px; padding-top:12px; border-top:1px solid var(--line-soft); }
.pepite-meta b { color: var(--ink); font-family: var(--font-display); }

/* pépites — onglets */
.pep-head { align-items: center; }
.tabbar { display: inline-flex; background: var(--bg-elev); border: 1px solid var(--hair); border-radius: 9px; padding: 3px; flex-wrap: wrap; }
.tabbar button { padding: 8px 16px; border-radius: 6px; font-size: 0.85rem; font-weight: 600; color: var(--ink-dim); display: inline-flex; align-items: center; gap: 8px; transition: all 0.2s; }
.tabbar button:hover { color: var(--ink); }
.tabbar button.active { background: var(--bg-card); color: var(--ink); box-shadow: var(--shadow-sm); }
.tabbar button.active::after { content:''; position:absolute; }
.tabbar .cnt { font-size: 0.68rem; background: rgba(255,255,255,0.08); border-radius: 5px; padding: 1px 7px; font-variant-numeric: tabular-nums; }
.tabbar button.active .cnt { background: color-mix(in srgb,var(--accent) 20%,transparent); color: var(--accent-text); }

.native-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.native { padding: 20px 22px; background: var(--tile); border: none; border-radius: var(--r); transition: transform 0.25s, background 0.25s; }
.native:hover { transform: translateY(-3px); background: color-mix(in srgb, var(--accent) 7%, var(--tile)); }
.native-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.native-head .tk { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; color: #fff; font-size: 0.74rem; flex-shrink: 0; }
.tk.img { background: #fff !important; overflow: hidden; padding: 0; }
.tk.img img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* paire LP : logos superposés */
.pairtk { display: flex; align-items: center; flex-shrink: 0; }
.cdisc { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; background: #fff; flex-shrink: 0; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg-card); }
.cdisc img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cdisc.fallback { font-family: var(--font-display); font-weight: 700; font-size: 0.64rem; }
.native-head h4 { font-size: 1.05rem; }
.native-head .sub { font-size: 0.76rem; color: var(--ink-faded); }
.native-head .when { margin-left: auto; font-size: 0.66rem; padding: 4px 9px; border-radius: 5px; font-weight: 600; white-space: nowrap; }
.native-head .when.up { background: var(--up-soft); color: var(--up); }
.native-head .when.watch { background: rgba(242,180,60,0.14); color: var(--warn-text); }
.native-head .when.done { background: rgba(110,118,137,0.18); color: var(--ink-dim); }
.native-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0 4px; }
.native-metrics .m .k { font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faded); }
.native-metrics .m .v { font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; margin-top: 4px; }
.native-metrics .v.pnl.up { color: var(--up); }
.native-metrics .v.pnl.down { color: var(--down); }
.native .conv { margin: 14px 0; }
.native-thesis { font-size: 0.82rem; color: var(--ink-dim); line-height: 1.6; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.native.clickable { cursor: pointer; }
.native.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.native-foot { margin-top: 14px; font-size: 0.74rem; font-weight: 600; color: var(--accent-text); display: flex; align-items: center; gap: 6px; opacity: 0.82; transition: opacity 0.2s, gap 0.2s; }
.native.clickable:hover .native-foot { opacity: 1; gap: 10px; }
.native-foot span { transition: transform 0.2s; }
.native.clickable:hover .native-foot span { transform: translateX(3px); }

/* ===== Modal — fiche de synthèse ===== */
.modal-scrim { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(6,8,12,0.66); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.modal-scrim.show { opacity: 1; pointer-events: auto; }
.modal { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; position: relative;
  background: var(--bg-card); border: 1px solid var(--glass-line); border-radius: 18px; padding: 28px;
  box-shadow: 0 40px 90px -40px rgba(0,0,0,0.85); transform: translateY(12px) scale(0.985); transition: transform 0.22s ease; }
.modal-scrim.show .modal { transform: none; }
.modal-close { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--ink-dim); border: 1px solid var(--glass-line); background: var(--glass); transition: color 0.2s, border-color 0.2s; }
.modal-close:hover { color: var(--ink); border-color: var(--accent); }
.modal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; padding-right: 40px; }
.modal-head .tk.lg { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; color: #fff; font-size: 0.86rem; flex-shrink: 0; }
.modal-title h3 { font-family: var(--font-serif); font-weight: 600; font-size: 1.32rem; letter-spacing: -0.01em; }
.modal-title .msym { color: var(--ink-faded); font-weight: 500; font-size: 0.9rem; margin-left: 4px; }
.modal-sub { font-size: 0.78rem; color: var(--ink-faded); margin-top: 2px; }
.modal-status { margin-left: auto; font-size: 0.66rem; padding: 4px 9px; border-radius: 5px; font-weight: 600; white-space: nowrap; }
.modal-status.up { background: var(--up-soft); color: var(--up); }
.modal-status.watch { background: rgba(242,180,60,0.14); color: var(--warn-text); }
.modal-status.done { background: rgba(110,118,137,0.18); color: var(--ink-dim); }
.dm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.dm { background: var(--tile); border: none; border-radius: 9px; padding: 11px 13px; }
.dm-k { font-size: 0.58rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faded); }
.dm-v { font-family: var(--font-display); font-weight: 600; font-size: 0.92rem; margin-top: 4px; }
.modal .pnl.up { color: var(--up); }
.modal .pnl.down { color: var(--down); }
.asym { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 11px; margin-bottom: 20px;
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-elev));
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--hair)); }
.asym-c { flex: 1; text-align: center; }
.asym-k { font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-dim); }
.asym-v { font-family: var(--font-serif); font-weight: 600; font-size: 1.2rem; margin-top: 3px; }
.asym-v.up { color: var(--up); }
.asym-sep { font-size: 0.72rem; color: var(--ink-faded); text-transform: uppercase; letter-spacing: 0.1em; }
.dsec { margin-bottom: 18px; }
.dsec h5 { font-family: var(--font-display); font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.dsec h5.pos::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--up); }
.dsec h5.neg::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--down); }
.dsec p { font-size: 0.88rem; color: var(--ink-dim); line-height: 1.6; }
.dsec ul, .dsec ol.plan { padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.dsec ul li { position: relative; padding-left: 18px; font-size: 0.86rem; color: var(--ink-dim); line-height: 1.5; }
.dsec ul li::before { content: '·'; position: absolute; left: 4px; color: var(--accent-text); font-weight: 700; }
.dsec ol.plan { counter-reset: step; }
.dsec ol.plan li { counter-increment: step; position: relative; padding-left: 32px; font-size: 0.86rem; color: var(--ink-dim); line-height: 1.5; min-height: 22px; display: flex; align-items: center; }
.dsec ol.plan li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-family: var(--font-serif); font-size: 0.8rem; font-weight: 600; color: var(--accent-text); background: var(--bg-elev); border: 1px solid color-mix(in srgb,var(--accent) 28%,var(--hair)); }
.conv.inline { display: inline-flex; gap: 3px; width: 64px; }
.conv.inline i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.conv.inline i.on { background: var(--accent); }
.modal-foot { font-size: 0.72rem; color: var(--ink-faded); border-top: 1px solid var(--line-soft); padding-top: 14px; }

/* ===== Graphique pépite (zone d'achat · TP · SL) ===== */
.pep-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.pep-chart-head h5 { margin: 0; }
.pep-legend { display: flex; gap: 12px; flex-wrap: wrap; }
.pep-legend .leg { display: inline-flex; align-items: center; gap: 5px; font-size: 0.7rem; color: var(--ink-dim); }
.pep-legend .leg i { width: 9px; height: 9px; border-radius: 3px; }
.pep-chart { position: relative; width: 100%; height: 210px; border: 1px solid var(--glass-line); border-radius: 12px; background: var(--glass); overflow: hidden; }
.pep-chart .pep-svg { display: block; width: 100%; height: 100%; }
.pep-chart-load { display: grid; place-items: center; height: 100%; font-size: 0.8rem; color: var(--ink-faded); }
.lvl-pills { position: absolute; inset: 0; pointer-events: none; }
.lvl-pill { position: absolute; right: 8px; transform: translateY(-50%); padding: 2px 8px; border-radius: 7px; font-family: var(--font-display); font-size: 0.66rem; font-weight: 700; color: #fff; white-space: nowrap; box-shadow: 0 2px 8px -2px rgba(0,0,0,0.5); }
.lvl-pill.clamped { opacity: 0.78; }

/* sélecteur de période */
.tf-bar { display: inline-flex; gap: 3px; background: var(--bg-elev); border: 1px solid var(--hair); border-radius: 8px; padding: 3px; margin-bottom: 12px; }
.tf-bar button { padding: 5px 12px; border-radius: 5px; font-size: 0.74rem; font-weight: 600; color: var(--ink-dim); transition: all 0.15s; }
.tf-bar button:hover { color: var(--ink); }
.tf-bar button.on { background: var(--bg-card); color: var(--ink); box-shadow: var(--shadow-sm); }

/* axe des dates (abscisse) */
.x-axis { display: flex; justify-content: space-between; margin-top: 9px; padding: 0 2px; }
.x-axis span { font-size: 0.68rem; color: var(--ink-faded); font-variant-numeric: tabular-nums; }

/* curseur de navigation + infobulle */
.pep-chart { touch-action: pan-y; }
.cx { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.12s; }
.cx-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ink-faded); opacity: 0.55; transform: translateX(-0.5px); }
.cx-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); transform: translate(-50%, -50%); }
.cx-tip { position: absolute; pointer-events: none; opacity: 0; transform: translate(-50%, calc(-100% - 14px)); background: rgba(20,24,35,0.96); border: 1px solid var(--glass-line); border-radius: 8px; padding: 5px 10px; white-space: nowrap; transition: opacity 0.12s; z-index: 6; box-shadow: var(--shadow); }
:root[data-theme="light"] .cx-tip { background: rgba(255,255,255,0.97); }
.cx-tip .cx-p { font-family: var(--font-display); font-weight: 700; font-size: 0.84rem; }
.cx-tip .cx-d { font-size: 0.66rem; color: var(--ink-faded); }

/* ===== Paramètres (réglages) ===== */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.set-row:last-child { border-bottom: none; }
.set-txt { min-width: 0; }
.set-t { font-weight: 600; font-size: 0.92rem; }
.set-d { font-size: 0.78rem; color: var(--ink-faded); margin-top: 3px; line-height: 1.45; }
.seg2 { display: inline-flex; background: var(--bg-elev); border: 1px solid var(--hair); border-radius: 9px; padding: 3px; flex-shrink: 0; }
.seg2 button { padding: 7px 14px; border-radius: 6px; font-size: 0.82rem; color: var(--ink-dim); font-weight: 600; transition: all 0.2s; }
.seg2 button.on { background: var(--bg-card); color: var(--ink); box-shadow: var(--shadow-sm); }
.switch { width: 46px; height: 26px; border-radius: 20px; background: var(--line); position: relative; flex-shrink: 0; transition: background 0.2s; border: 1px solid var(--hair); }
.switch span { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 2px 6px rgba(0,0,0,0.35); }
.switch.on { background: var(--accent); }
.switch.on span { transform: translateX(20px); }

/* ===== Mode confidentialité (masque les montants) ===== */
body.private .nw-val, body.private .kpi .val, body.private .equity-figure,
body.private .donut .center .big, body.private .alloc-row .pct,
body.private .asym-v, body.private .dm-v,
body.private table.positions td.mono, body.private .native-metrics .v.mono {
  filter: blur(7px); user-select: none; pointer-events: none; transition: filter 0.15s ease;
}
@media (max-width: 560px) { .dm-grid { grid-template-columns: repeat(2, 1fr); } .asym { flex-direction: column; } .modal { padding: 22px 18px; } }

/* règle d'asymétrie */
.rules { list-style: none; display: flex; flex-direction: column; }
.rules li { display: flex; gap: 14px; align-items: flex-start; padding: 15px 0; border-bottom: 1px solid var(--line-soft); }
.rules li:first-child { padding-top: 2px; }
.rules li:last-child { border-bottom: none; }
.rules .rn { flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-family: var(--font-serif); font-weight: 600; font-size: 0.92rem; color: var(--accent-text); background: var(--bg-elev); border: 1px solid color-mix(in srgb,var(--accent) 30%,var(--hair)); }
.rules .rt { font-weight: 600; font-size: 0.92rem; margin-bottom: 3px; letter-spacing: -0.01em; }
.rules .rd { font-size: 0.82rem; color: var(--ink-dim); line-height: 1.55; }
.rules .rd b { color: var(--ink); }
.asym-foot { display: flex; align-items: center; gap: 16px; margin-top: 18px; padding: 16px 18px; border-radius: 11px;
  background: color-mix(in srgb, var(--accent) 5%, var(--bg-card));
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--hair)); }
.asym-foot .afc { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.af-k { font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faded); }
.af-v { font-family: var(--font-serif); font-weight: 600; font-size: 1.12rem; letter-spacing: -0.01em; }
.af-v.up { color: var(--up); }
.af-sep { width: 1px; align-self: stretch; background: var(--glass-line); }

/* monthly returns */
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; align-items: end; height: 150px; }
.month { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.month .bar { width: 70%; border-radius: 5px 5px 3px 3px; min-height: 3px; transition: height 0.6s ease; }
.month .bar.up { background: linear-gradient(180deg, var(--up), rgba(43,212,142,0.4)); }
.month .bar.down { background: linear-gradient(180deg, rgba(255,92,108,0.5), var(--down)); }
.month .ml { font-size: 0.68rem; color: var(--ink-faded); }

/* disclaimer */
.disclaimer { margin-top: 28px; padding: 16px 20px; border: 1px solid var(--line-soft); background: var(--bg-card); border-radius: var(--r-sm); color: var(--ink-faded); font-size: 0.77rem; line-height: 1.6; display:flex; gap:12px; align-items:flex-start; }
.disclaimer .ic { color: var(--gold); font-size: 1rem; }

.section-gap { margin-top: 16px; }

/* ===== Académie (sections pédagogiques par pilier) ===== */
.edu { padding: 40px 40px 34px; }
.edu-head { max-width: 76ch; margin-bottom: 32px; padding-bottom: 28px; border-bottom: 1px solid var(--hair); }
.edu-eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: 0.64rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 15px; }
.edu-eyebrow::before { content: ''; width: 22px; height: 1.5px; background: var(--accent); border-radius: 2px; }
.edu-title { font-family: var(--font-serif); font-weight: 600; font-size: 1.7rem; letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 14px; }
.edu-intro { font-size: 1rem; line-height: 1.7; color: var(--ink-dim); }
/* concepts clés — cartes en relief */
.concepts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 36px; }
.concept { position: relative; padding: 22px 20px 20px; border: none; border-radius: 16px; overflow: hidden;
  background: var(--tile);
  transition: transform 0.28s var(--ease), background 0.28s, box-shadow 0.28s; }
.concept::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, var(--accent), transparent 72%); opacity: 0; transition: opacity 0.28s; }
.concept:hover { transform: translateY(-4px); background: color-mix(in srgb,var(--accent) 7%, var(--tile)); box-shadow: 0 24px 52px -34px color-mix(in srgb,var(--accent) 55%, transparent); }
.concept:hover::before { opacity: 1; }
.cc-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; color: var(--accent-text); margin-bottom: 16px;
  background: linear-gradient(150deg, color-mix(in srgb,var(--accent) 22%, transparent), color-mix(in srgb,var(--accent) 6%, transparent));
  border: 1px solid color-mix(in srgb,var(--accent) 24%,var(--hair)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.08); }
.cc-t { font-family: var(--font-display); font-weight: 600; font-size: 1rem; letter-spacing: -0.01em; margin-bottom: 8px; }
.cc-d { font-size: 0.85rem; line-height: 1.6; color: var(--ink-dim); }
/* deux colonnes : cadre d'allocation + méthode */
.edu-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; margin-bottom: 8px; }
.edu-block { min-width: 0; }
.edu-h { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 20px; }
.edu-h::before { content: ''; width: 16px; height: 2px; background: var(--accent); border-radius: 2px; flex-shrink: 0; }
.edu-note { font-size: 0.79rem; color: var(--ink-faded); line-height: 1.55; margin-top: 16px; font-style: italic; }
/* cadre d'allocation — barres de proportion */
.alloc-guide { display: flex; flex-direction: column; }
.ag-row { display: grid; grid-template-columns: 12px 1fr auto; grid-template-areas: 'dot label val' 'bar bar bar' 'role role role'; column-gap: 12px; row-gap: 9px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--hair); }
.ag-row:last-child { border-bottom: none; }
.ag-dot { grid-area: dot; width: 11px; height: 11px; border-radius: 4px; }
.ag-l { grid-area: label; font-weight: 600; font-size: 0.92rem; }
.ag-v { grid-area: val; font-family: var(--font-serif); font-weight: 600; font-size: 1.18rem; text-align: right; white-space: nowrap; letter-spacing: -0.01em; }
.ag-bar { grid-area: bar; height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.ag-bar i { display: block; height: 100%; border-radius: 4px; transition: width 0.8s var(--ease); }
.ag-r { grid-area: role; font-size: 0.82rem; color: var(--ink-faded); line-height: 1.45; }
/* méthode étape par étape — timeline reliée */
.edu-steps { list-style: none; counter-reset: es; display: flex; flex-direction: column; }
.edu-steps li { counter-increment: es; position: relative; padding: 0 0 24px 46px; }
.edu-steps li:last-child { padding-bottom: 0; }
.edu-steps li::before { content: counter(es); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-serif); font-weight: 600; font-size: 0.95rem; color: var(--accent-text); background: var(--bg-card); border: 1.5px solid color-mix(in srgb,var(--accent) 38%,var(--hair)); z-index: 1; }
.edu-steps li::after { content: ''; position: absolute; left: 15.5px; top: 34px; bottom: 6px; width: 1.5px; background: linear-gradient(var(--accent), color-mix(in srgb,var(--accent) 10%, transparent)); opacity: 0.32; }
.edu-steps li:last-child::after { display: none; }
.es-t { font-weight: 600; font-size: 0.95rem; margin-bottom: 5px; padding-top: 5px; }
.es-d { font-size: 0.85rem; color: var(--ink-dim); line-height: 1.6; }
/* glossaire (accordéon natif) */
.edu-gloss { margin-top: 36px; padding-top: 30px; border-top: 1px solid var(--hair); }
.glossary { columns: 2; column-gap: 44px; }
details.gloss { break-inside: avoid; border-bottom: 1px solid var(--hair); }
details.gloss summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 2px; font-weight: 600; font-size: 0.9rem; transition: color 0.15s; }
details.gloss summary::-webkit-details-marker { display: none; }
details.gloss summary:hover { color: var(--accent-text); }
.g-plus { position: relative; width: 13px; height: 13px; flex-shrink: 0; }
.g-plus::before, .g-plus::after { content: ''; position: absolute; background: var(--ink-faded); border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }
.g-plus::before { left: 0; top: 5.5px; width: 13px; height: 2px; }
.g-plus::after { left: 5.5px; top: 0; width: 2px; height: 13px; }
details[open] .gloss-x, details[open].gloss .g-plus::after { opacity: 0; transform: scaleY(0); }
.g-def { font-size: 0.85rem; color: var(--ink-dim); line-height: 1.65; padding: 0 2px 16px; }
@media (max-width: 900px) {
  .concepts { grid-template-columns: repeat(2, 1fr); }
  .edu-cols { grid-template-columns: 1fr; gap: 32px; }
  .glossary { columns: 1; }
  .edu { padding: 30px 26px; }
}
@media (max-width: 520px) { .concepts { grid-template-columns: 1fr; } .edu { padding: 24px 18px; } .edu-title { font-size: 1.45rem; } }

/* ===== Outils / Simulateurs ===== */
.tool-h { font-family: var(--font-display); font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 12px; }
.tool-note { font-size: 0.76rem; color: var(--ink-faded); line-height: 1.5; margin-top: 16px; font-style: italic; }
.sim-grid { display: grid; grid-template-columns: 320px 1fr; gap: 28px; align-items: start; }
.sim-controls { display: flex; flex-direction: column; gap: 16px; }
.sim-field { display: flex; flex-direction: column; gap: 8px; }
.sim-field > label { font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faded); }
.sim-strong { color: var(--accent-text); font-weight: 600; letter-spacing: 0; text-transform: none; }
.sim-input { display: flex; align-items: center; gap: 8px; background: var(--bg-elev); border: 1px solid var(--hair); border-radius: var(--r-sm); padding: 0 12px; transition: border-color 0.15s; }
.sim-input:focus-within { border-color: color-mix(in srgb,var(--accent) 45%,var(--hair)); }
.sim-input input { flex: 1; min-width: 0; background: none; border: none; outline: none; color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; padding: 11px 0; -moz-appearance: textfield; }
.sim-input input::-webkit-outer-spin-button, .sim-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sim-input span, .sim-input .pre { color: var(--ink-faded); font-size: 0.9rem; font-weight: 600; }
.sim-seg { width: 100%; }
.sim-seg button { flex: 1; }
.sim-range { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px; background: var(--line); outline: none; }
.sim-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 3px solid var(--bg-card); box-shadow: 0 1px 4px rgba(0,0,0,0.35); }
.sim-range::-moz-range-thumb { width: 17px; height: 17px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 3px solid var(--bg-card); }
/* résultats simulateur */
.sim-results { display: flex; flex-direction: column; gap: 18px; }
.tool-block { }
.sa-row { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(60px,1fr) auto auto; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--hair); }
.sa-row:last-child { border-bottom: none; }
.sa-l { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 0.9rem; }
.sa-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.sa-bar { height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.sa-bar i { display: block; height: 100%; border-radius: 4px; }
.sa-v { font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; text-align: right; min-width: 44px; }
.sa-a { color: var(--ink-faded); font-size: 0.84rem; text-align: right; min-width: 66px; }
.tool-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tstat { padding: 15px 17px; background: var(--tile); border: none; border-radius: var(--r-sm); }
.tstat.hl { background: color-mix(in srgb,var(--accent) 10%,var(--tile)); }
.ts-k { font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faded); }
.ts-v { font-family: var(--font-serif); font-weight: 600; font-size: 1.35rem; letter-spacing: -0.01em; margin: 6px 0 3px; }
.ts-v.pos { color: var(--up); } .ts-v.neg { color: var(--down); }
.ts-u { font-family: var(--font-body); font-size: 0.72rem; color: var(--ink-faded); font-weight: 500; margin-left: 5px; }
.ts-f { font-size: 0.74rem; color: var(--ink-faded); }
/* graphique projection */
.sim-chart { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--hair); position: relative; }
.sim-chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.sim-chart #chart-sim { width: 100%; height: 240px; display: block; }
/* diagnostic */
.diag-top { display: flex; align-items: center; gap: 20px; margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--hair); }
.diag-gauge { position: relative; width: 96px; height: 96px; flex-shrink: 0; }
.diag-gauge svg { width: 100%; height: 100%; }
.diag-score { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ds-n { font-family: var(--font-serif); font-weight: 600; font-size: 1.6rem; line-height: 1; }
.ds-u { font-size: 0.62rem; color: var(--ink-faded); margin-top: 2px; }
.diag-verdict { min-width: 0; }
.diag-verdict p { font-size: 0.84rem; color: var(--ink-dim); line-height: 1.55; margin-top: 9px; }
.diag-list { list-style: none; display: flex; flex-direction: column; }
.diag-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--hair); }
.diag-row:last-child { border-bottom: none; }
.diag-ic { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 0.74rem; font-weight: 700; flex-shrink: 0; }
.diag-row.ok .diag-ic { color: var(--up); background: var(--up-soft); }
.diag-row.warn .diag-ic { color: var(--warn-text); background: rgba(201,162,75,0.14); }
.diag-t { font-weight: 600; font-size: 0.88rem; }
.diag-d { font-size: 0.8rem; color: var(--ink-faded); margin-top: 2px; line-height: 1.45; }
/* asymétrie */
.asy-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.asy-stats { margin-top: 4px; }
.asy-foot { margin-top: 14px; font-size: 0.82rem; color: var(--ink-dim); line-height: 1.55; padding: 13px 15px; border-radius: var(--r-sm); background: color-mix(in srgb,var(--accent) 6%,var(--bg-elev)); border: 1px solid color-mix(in srgb,var(--accent) 18%,var(--hair)); }
.asy-foot b { color: var(--ink); font-family: var(--font-display); }
@media (max-width: 760px) { .sim-grid { grid-template-columns: 1fr; gap: 22px; } }
@media (max-width: 520px) { .tool-stats { grid-template-columns: 1fr; } .asy-row { grid-template-columns: 1fr; } .diag-top { flex-direction: column; align-items: flex-start; } }

/* vues */
.view { display: none; }
.view.active { display: block; animation: fade 0.4s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Entrée en cascade des cartes (premium, façon Revolut/Apple) */
@media (prefers-reduced-motion: no-preference) {
  .view.active .kpis .kpi { animation: rise 0.55s var(--ease, cubic-bezier(.16,1,.3,1)) backwards; }
  .view.active .kpis .kpi:nth-child(1) { animation-delay: 0.04s; }
  .view.active .kpis .kpi:nth-child(2) { animation-delay: 0.10s; }
  .view.active .kpis .kpi:nth-child(3) { animation-delay: 0.16s; }
  .view.active .kpis .kpi:nth-child(4) { animation-delay: 0.22s; }
  .view.active > .grid { animation: rise 0.55s var(--ease, cubic-bezier(.16,1,.3,1)) 0.14s backwards; }
  .view.active > .panel.section-gap { animation: rise 0.55s var(--ease, cubic-bezier(.16,1,.3,1)) 0.20s backwards; }
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* table : colonnes APR / rendement */
.apr { font-family: var(--font-display); font-weight: 700; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.tag { font-size: 0.68rem; padding: 3px 9px; border-radius: 5px; font-weight: 600; background: var(--bg-elev); border: 1px solid var(--hair); color: var(--ink-dim); }
.tag.stable { color: var(--up); background: var(--up-soft); }
.tag.bluechip { color: var(--blue); background: rgba(45,125,242,0.14); }
:root[data-theme="light"] .tag.bluechip { color: var(--blue-deep); }
.tag.volatile { color: var(--warn-text); background: rgba(242,180,60,0.14); }
.fam-dot { display:inline-block; width:9px; height:9px; border-radius:3px; margin-right:8px; vertical-align:middle; }

/* jauge de cycle (P) */
.gauge { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.gauge .step { padding: 14px 12px; border-radius: var(--r-sm); background: var(--glass); border: 1px solid var(--glass-line); text-align: center; transition: all 0.2s; }
.gauge .step .gt { font-family: var(--font-display); font-weight: 600; font-size: 0.92rem; }
.gauge .step .gs { font-size: 0.7rem; color: var(--ink-faded); margin-top: 4px; }
.gauge .step.on { background: color-mix(in srgb,var(--accent) 16%,transparent); border-color: color-mix(in srgb,var(--accent) 50%,transparent); }
.gauge .step.on .gt { color: var(--accent-text); }
.cycle-note { margin-top: 14px; font-size: 0.84rem; color: var(--ink-dim); line-height: 1.55; }
.gauge { cursor: pointer; }
.gauge .step { transition: all 0.2s, transform 0.15s; }
.gauge:hover .step { border-color: color-mix(in srgb,var(--accent) 24%,var(--line)); }
.cycle-more { display: inline; margin-left: 4px; padding: 0; background: none; border: none; color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: opacity 0.15s; }
.cycle-more:hover { opacity: 0.7; }

/* ===== Fiche indice de cycle ===== */
.cyc-hero { display: flex; align-items: center; gap: 20px; margin-bottom: 18px; }
.cyc-score { font-family: var(--font-serif); font-weight: 600; font-size: 3rem; line-height: 1; letter-spacing: -0.02em; }
.cyc-score-u { font-family: var(--font-body); font-size: 0.9rem; color: var(--ink-faded); font-weight: 500; margin-left: 6px; }
.cyc-phase { display: flex; flex-direction: column; gap: 6px; }
.cyc-posture { font-size: 0.82rem; color: var(--ink-dim); }
.cyc-scale { margin-bottom: 18px; }
.cyc-track { position: relative; display: flex; height: 8px; border-radius: 5px; overflow: visible; gap: 2px; }
.cyc-track .z { flex: 1; height: 100%; }
.cyc-track .z:first-child { border-radius: 5px 0 0 5px; } .cyc-track .z:last-child { border-radius: 0 5px 5px 0; }
.cyc-marker { position: absolute; top: -6px; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 9px solid var(--ink); transform: translateX(-50%); }
.cyc-zones { display: flex; margin-top: 7px; }
.cyc-zones span { flex: 1; text-align: center; font-size: 0.66rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faded); }
.cyc-note { font-size: 0.86rem; color: var(--ink-dim); line-height: 1.6; padding: 14px 16px; border-radius: var(--r-sm); background: var(--bg-elev); border: 1px solid var(--hair); margin-bottom: 4px; }
/* décryptage de la période + que faire */
.cyc-read { margin-bottom: 14px; padding: 16px 18px; border-radius: var(--r-sm); background: var(--bg-elev); border: 1px solid var(--hair); border-left: 3px solid var(--accent); }
.cyc-read > h5 { font-family: var(--font-display); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 8px; }
.cyc-read > p { font-size: 0.9rem; color: var(--ink); line-height: 1.62; }
.cyc-actions { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--hair); }
.ca-h { font-family: var(--font-display); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 9px; }
.cyc-actions ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.cyc-actions li { position: relative; padding-left: 22px; font-size: 0.86rem; color: var(--ink-dim); line-height: 1.5; }
.cyc-actions li::before { content: '→'; position: absolute; left: 2px; top: 0; color: var(--accent-text); font-weight: 700; }
.dsec-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dsec-row h5 { margin-bottom: 0; }
.cyc-hint { font-size: 0.7rem; color: var(--ink-faded); font-style: italic; }
/* bloc pédagogique « comment lire » */
.cyc-howto { margin: 16px 0 4px; padding: 15px 16px; border-radius: var(--r-sm); background: color-mix(in srgb,var(--accent) 5%,var(--bg-elev)); border: 1px solid color-mix(in srgb,var(--accent) 16%,var(--hair)); }
.cyc-howto h5 { font-family: var(--font-display); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 8px; }
.cyc-howto p { font-size: 0.84rem; color: var(--ink-dim); line-height: 1.6; }
/* catégories d'indicateurs */
.cyc-group { margin-bottom: 6px; }
.cyc-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 2px; padding-bottom: 6px; border-bottom: 1px solid var(--hair); }
.cyc-group-head span:first-child { font-family: var(--font-display); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em; }
.cyc-group-w { font-size: 0.68rem; color: var(--ink-faded); font-variant-numeric: tabular-nums; }
.cyc-ind { padding: 13px 0; border-bottom: 1px solid var(--hair); }
.cyc-ind:last-child { border-bottom: none; }
.cyc-ind.clickable { cursor: pointer; }
.cyc-ind.clickable:hover .ci-name { color: var(--accent-text); }
.cyc-ind.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.cyc-ind-top { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.ci-name { font-weight: 600; font-size: 0.86rem; flex: 1; min-width: 0; transition: color 0.15s; }
.ci-w { font-size: 0.64rem; font-weight: 600; color: var(--ink-faded); padding: 2px 6px; border-radius: 5px; background: var(--bg-elev); border: 1px solid var(--hair); white-space: nowrap; flex-shrink: 0; }
.ci-chev { color: var(--ink-faded); font-size: 0.9rem; flex-shrink: 0; transition: transform 0.2s; line-height: 1; }
.cyc-ind.open .ci-chev { transform: rotate(180deg); color: var(--accent-text); }
.ci-learn { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.cyc-ind.open .ci-learn { max-height: 320px; }
.ci-learn p { margin-top: 10px; padding: 12px 14px; border-radius: var(--r-sm); background: color-mix(in srgb,var(--accent) 6%,var(--bg-elev)); border: 1px solid var(--hair); font-size: 0.84rem; color: var(--ink-dim); line-height: 1.62; }

/* =========================================================
   COUCHE UX PREMIUM — motion, tactile, profondeur
   (inspiration Revolut / Apple / Tesla)
   ========================================================= */
:root { --ease: cubic-bezier(.16,1,.3,1); --ease-out: cubic-bezier(.22,.61,.36,1); }
html { scroll-behavior: smooth; }

/* défilement fin & discret */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-faded); background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* transitions homogènes + retour tactile (press) sur les éléments interactifs */
.btn-ghost, .icon-btn, .tabbar button, .seg2 button, .tf-bar button, .segmented button,
.nav-item, .modal-close, .cycle-more, .pillar-tab, .native.clickable, .cyc-ind.clickable,
.gauge, .alloc-row, .sim-seg button, .faq-item summary {
  transition: transform .24s var(--ease), background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), box-shadow .25s var(--ease), opacity .2s var(--ease);
}
.btn-ghost:active, .icon-btn:active, .tabbar button:active, .seg2 button:active,
.tf-bar button:active, .segmented button:active, .nav-item:active, .modal-close:active,
.cycle-more:active, .sim-seg button:active { transform: scale(.95); }
.pillar-tab:active, .native.clickable:active, .cyc-ind.clickable:active { transform: scale(.985); }
.kpi:active, .gauge:active { transform: scale(.992); }

/* numéraux « statement » : rendu plus net pendant l'animation */
.nw-val, .kpi .val, .cyc-score, .ts-v, .equity-figure { font-variant-numeric: tabular-nums; }

/* transition de vue plus fluide (spring out) */
.view.active { animation: viewIn .55s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* focus premium */
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 65%, transparent); outline-offset: 2px; border-radius: 8px; }
button:focus:not(:focus-visible), a:focus:not(:focus-visible), [tabindex]:focus:not(:focus-visible) { outline: none; }

/* modale : ressort à l'ouverture */
.modal { transition: transform .44s var(--ease), opacity .3s ease; }
.modal-scrim { transition: opacity .32s var(--ease); }

/* mobile : la modale devient une feuille du bas (bottom sheet) */
@media (max-width: 560px) {
  .modal-scrim { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-width: none; max-height: 92vh; border-radius: 20px 20px 0 0; padding-top: 22px; transform: translateY(100%); }
  .modal-scrim.show .modal { transform: none; }
  .modal::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 3px; background: var(--line); margin: -8px auto 14px; }
  .modal-close { top: 14px; right: 14px; }
}

/* accessibilité : on respecte la réduction des animations */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* =========================================================
   ACCENT « TESLA » — profondeur, cartes flottantes, glanceable
   ========================================================= */
/* profondeur en thème sombre : vignette douce + cartes surélevées + halos subtils */
:root[data-theme="dark"] body { background-image: radial-gradient(1100px 620px at 50% -12%, rgba(255,255,255,0.035), transparent 62%); }
:root[data-theme="dark"] .panel { box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.025); }
:root[data-theme="dark"] .kpi.hl { box-shadow: 0 0 0 1px color-mix(in srgb,var(--accent) 18%,transparent), 0 22px 54px -32px color-mix(in srgb,var(--accent) 42%,transparent); }
:root[data-theme="dark"] .pillar-tab.active { box-shadow: none; }
:root[data-theme="dark"] .kpi:hover, :root[data-theme="dark"] .native:hover, :root[data-theme="dark"] .pepite:hover { box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb,var(--accent) 14%,transparent); }

/* numéraux plus grands & lisibles d'un coup d'œil */
.nw-val { font-size: 1.6rem; }
.kpi .val { font-size: 1.95rem; }
.topbar h1 { font-size: clamp(1.8rem, 3.2vw, 2.5rem); }
.equity-figure { font-size: 2.3rem; }
.cyc-score { font-size: 3.4rem; }
.donut .center .big { font-size: 1.65rem; }

/* plus d'air (desktop) */
.main { padding: 28px 36px 56px; }
.panel { padding: 24px 26px; }
.kpis { gap: 16px; }
.grid { gap: 16px; }

/* tracé animé : la ligne se dessine proprement */
.ar-line { will-change: stroke-dashoffset; }

/* topbar translucide collante, condensée au défilement (desktop) */
@media (min-width: 821px) {
  .topbar {
    position: sticky; top: 0; z-index: 30;
    margin: -28px -36px 22px; padding: 22px 36px 16px;
    background: color-mix(in srgb, var(--bg) 66%, transparent);
    -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
    border-bottom: 1px solid transparent;
    transition: padding .32s var(--ease), border-color .32s var(--ease), background .32s var(--ease);
  }
  .topbar.scrolled { padding-top: 12px; padding-bottom: 12px; border-bottom-color: var(--hair); }
  .topbar h1 { transition: font-size .32s var(--ease); }
  .topbar.scrolled h1 { font-size: 1.55rem; }
  .topbar .crumb, .topbar .sub { transition: opacity .26s var(--ease), max-height .32s var(--ease), margin .32s var(--ease); overflow: hidden; max-height: 40px; }
  .topbar.scrolled .crumb { opacity: 0; max-height: 0; margin-bottom: 0; }
  .topbar.scrolled .sub { opacity: 0; max-height: 0; margin-top: 0; }
}

/* =========================================================
   TESLA RADICAL — noir profond, chiffre héro, ultra-minimal
   ========================================================= */
:root {
  --bg: #000000; --bg-soft: #08090B; --bg-card: #0E0F13; --bg-elev: #16181D;
  --line: #272A33; --line-soft: #15171C; --hair: rgba(255,255,255,0.09);
  --shadow: 0 32px 80px -38px rgba(0,0,0,1);
  --r: 20px; --r-sm: 13px;
}
:root[data-theme="dark"] body::before { opacity: .3; }

/* respiration & profondeur accrues */
.main { padding: 34px 36px 70px; }
.kpis { gap: 18px; margin-bottom: 26px; }
.grid { gap: 18px; }
.panel { padding: 26px 30px; }
.panel-head h3 { font-size: 1.14rem; }
.kpi { padding: 26px 28px; }
.kpi .val { font-size: 2.35rem; margin: 14px 0 8px; }
@media (min-width: 821px) { .topbar { margin-top: -34px; } }

/* CHIFFRE HÉRO : le patrimoine domine la vue */
.networth { padding-right: 22px; }
.nw-label { font-size: .58rem; letter-spacing: .26em; }
.nw-val { font-size: clamp(2.1rem, 4.6vw, 3.3rem); line-height: 1; font-weight: 600; margin-top: 7px; letter-spacing: -0.02em; }
.nw-asof { margin-top: 7px; }
@media (min-width: 821px) { .topbar.scrolled .nw-val { font-size: 1.6rem; } }

/* carte KPI principale franchement accentuée (héro) */
:root[data-theme="dark"] .kpi.hl { background: linear-gradient(158deg, color-mix(in srgb, var(--accent) 17%, var(--bg-card)) 0%, var(--bg-card) 60%); border-color: color-mix(in srgb, var(--accent) 32%, transparent); }
.kpi.hl .val { color: var(--accent-text); }

/* sidebar & cartes : contraste flottant sur le noir */
:root[data-theme="dark"] .sidebar { background: #060708; }
:root[data-theme="dark"] .panel, :root[data-theme="dark"] .kpi,
:root[data-theme="dark"] .native, :root[data-theme="dark"] .pepite, :root[data-theme="dark"] .mini { box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 18px 44px -30px rgba(0,0,0,0.9); }
.ci-val { font-family: var(--font-display); font-weight: 600; font-size: 0.92rem; color: var(--accent-text); white-space: nowrap; }
.ci-bar { height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; margin-bottom: 8px; }
.ci-bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent); transition: width 0.3s ease; }
.ci-desc { font-size: 0.82rem; color: var(--ink-dim); line-height: 1.5; }

/* mini-cartes (split pools / familles) */
.mini-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mini { padding: 18px; background: var(--tile); border: none; border-radius: var(--r); }
.mini .mk { font-size: 0.7rem; color: var(--ink-faded); display:flex; align-items:center; gap:8px; text-transform: uppercase; letter-spacing: 0.08em; }
.mini .mv { font-family: var(--font-serif); font-weight: 600; font-size: 1.34rem; margin: 9px 0 4px; letter-spacing: -0.01em; }
.mini .md { font-size: 0.78rem; color: var(--ink-dim); }

/* mobile topbar / menu */
.mobile-bar { display: none; }
.scrim { display: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .cols-2-1, .cols-1-1 { grid-template-columns: 1fr; }
  .pepites { grid-template-columns: 1fr; }
  .native-grid { grid-template-columns: 1fr; }
  .mini-cards { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .gauge { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 50; width: 258px; left: 0; top: 0;
    transform: translateX(-100%); transition: transform 0.3s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); z-index: 40; }
  .mobile-bar .brand { padding: 0; }
  .burger { display: flex; flex-direction: column; gap: 5px; padding: 8px; }
  .burger span { width: 22px; height: 2px; background: var(--ink); border-radius: 2px; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 45; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .main { padding: 20px 18px 40px; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr; }
  .months { gap: 4px; }
  .donut-wrap { flex-direction: column; align-items: flex-start; }
  .native-metrics { grid-template-columns: repeat(2, 1fr); }
  .pep-head { flex-direction: column; align-items: flex-start; gap: 14px; }
}

/* ===== Comparateur : plan P.R.F. vs épargne classique ===== */
.cmp-head { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.cmp-stat { padding: 15px 17px; background: var(--tile); border: none; border-radius: var(--r-sm); }
.cmp-stat.hl { background: color-mix(in srgb, #2BD48E 12%, var(--tile)); }
.cs-k { font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faded); }
.cs-v { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 600; margin-top: 6px; letter-spacing: -0.01em; }
.cs-f { font-size: 0.74rem; color: var(--ink-faded); margin-top: 3px; }
.cmp-gap.pos { color: var(--up); }
.cmp-chart { position: relative; }
.cmp-chart #chart-cmp { width: 100%; height: 230px; display: block; }
.cmp-legend { margin-bottom: 10px; }
@media (max-width: 560px) { .cmp-head { grid-template-columns: 1fr; } }

/* ===== Cartes KPI cliquables → fiche d'analyse ===== */
.kpi.clickable { cursor: pointer; }
.kpi-go { position: absolute; top: 14px; right: 14px; font-size: 0.9rem; line-height: 1; color: var(--ink-faded); opacity: 0.32; transition: opacity 0.2s, color 0.2s, transform 0.2s; }
.kpi.clickable:hover .kpi-go, .kpi.clickable:focus-visible .kpi-go { opacity: 1; color: var(--accent-text); transform: translate(1px, -1px); }
/* Fiche KPI : phrase d'accroche + logique */
.kpi-modal-val { margin-left: auto; font-family: var(--font-serif); font-weight: 600; font-size: 1.5rem; letter-spacing: -0.01em; white-space: nowrap; }
.kpi-lead { font-family: var(--font-serif); font-size: 1.14rem; line-height: 1.5; color: var(--ink); margin: 6px 0 22px; }
.kpi-method { margin: 0; padding: 0; list-style: none; display: grid; gap: 11px; }
.kpi-method li { position: relative; padding-left: 20px; font-size: 0.9rem; line-height: 1.55; color: var(--ink-dim); }
.kpi-method li::before { content: ''; position: absolute; left: 2px; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ===== Lignes & tuiles cliquables → fiche d'analyse ===== */
.positions tr.clickable, .mini.clickable, .alloc-row.clickable, .rules li.clickable { cursor: pointer; }
.positions tbody tr.clickable { transition: background 0.18s; }
.positions tbody tr.clickable:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.positions tbody tr.clickable:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: -2px; }
.mini.clickable { transition: transform 0.18s, background 0.18s; }
.mini.clickable:hover { transform: translateY(-2px); background: color-mix(in srgb, var(--accent) 8%, var(--tile)); }
.alloc-row.clickable { border-radius: 9px; transition: background 0.18s; }
.alloc-row.clickable:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
/* règles d'asymétrie : carte cliquable + affordance */
.rules li.clickable { position: relative; border-radius: 12px; padding: 4px 6px; margin: 0 -6px; transition: background 0.18s; }
.rules li.clickable:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.rules li.clickable:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 0; }
.rule-go { position: absolute; top: 6px; right: 6px; font-size: 0.85rem; color: var(--ink-faded); opacity: 0; transition: opacity 0.2s, color 0.2s, transform 0.2s; }
.rules li.clickable:hover .rule-go, .rules li.clickable:focus-visible .rule-go { opacity: 1; color: var(--accent-text); transform: translate(1px, -1px); }
/* lien protocole dans la fiche vault */
.vault-link { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; font-weight: 600; color: var(--accent-text); text-decoration: none; padding: 9px 14px; border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line)); border-radius: 10px; transition: background 0.18s, border-color 0.18s; }
.vault-link:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }

/* ===== Vue Glossaire dédiée ===== */
.gloss-search { position: relative; display: flex; align-items: center; margin-bottom: 30px; max-width: 460px; }
.gloss-search .gs-ic { position: absolute; left: 16px; font-size: 1rem; color: var(--ink-faded); pointer-events: none; }
.gloss-search input { width: 100%; padding: 14px 16px 14px 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-elev); color: var(--ink); font-family: var(--font-body); font-size: 0.95rem; transition: border-color 0.18s, box-shadow 0.18s; }
.gloss-search input:focus { outline: none; border-color: color-mix(in srgb,var(--accent) 50%,var(--line)); box-shadow: 0 0 0 4px var(--accent-glow); }
.gloss-search input::placeholder { color: var(--ink-faded); }
.gs-count { position: absolute; right: 16px; font-size: 0.74rem; color: var(--ink-faded); font-variant-numeric: tabular-nums; }
.gloss-cat { margin-bottom: 30px; }
.gloss-cat:last-child { margin-bottom: 0; }
.gloss-cat-h { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 6px; }
.gloss-cat-h::before { content: ''; width: 16px; height: 2px; background: var(--accent); border-radius: 2px; flex-shrink: 0; }
.gloss-cat-h .gc-n { color: var(--ink-faded); letter-spacing: 0; font-weight: 500; }
.gloss-grid { columns: 2; column-gap: 44px; }
.gloss-cat.empty { display: none; }
@media (max-width: 760px) { .gloss-grid { columns: 1; } }

/* ===== Sous-onglets de la vue Outils ===== */
.subtabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.subtabs button { font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; padding: 11px 18px; border-radius: 11px; border: 1px solid var(--line); background: var(--bg-card); color: var(--ink-dim); cursor: pointer; transition: color 0.2s, border-color 0.2s, background 0.2s; }
.subtabs button:hover { color: var(--ink); border-color: color-mix(in srgb,var(--accent) 28%,var(--line)); }
.subtabs button.on { background: color-mix(in srgb,var(--accent) 12%,var(--bg-card)); border-color: color-mix(in srgb,var(--accent) 42%,var(--line)); color: var(--accent-text); }
.subtabs button:active { transform: scale(0.97); }
.tool-pane { display: none; }
.tool-pane.active { display: block; animation: fade 0.35s ease; }
@media (max-width: 560px) { .subtabs { gap: 6px; } .subtabs button { flex: 1 1 auto; font-size: 0.82rem; padding: 10px 12px; text-align: center; } }

/* ============================================================
   DA FINTECH (Finary / Apple / Revolut) — sans gras, rondeurs,
   accent présent. Code couleur P.R.F. conservé.
   ============================================================ */
/* chiffres héros : sans, gras, resserrés */
.nw-val, .kpi .val, .equity-figure, .donut .center .big,
.cyc-score-n, .ds-n, .ts-v, .cs-v, .ag-v, .mini .mv,
.kpi-modal-val, .sim-strong, .diag-score .ds-n {
  font-family: var(--font-num); font-weight: 700; letter-spacing: -0.03em;
}
.kpi .val { font-size: 2rem; margin: 13px 0 8px; }
.equity-figure { font-size: 2.3rem; }
.nw-val { font-weight: 700; }
.kpi-lead { font-weight: 500; letter-spacing: -0.015em; }
.edu-title, .modal-title h3 { letter-spacing: -0.03em; }

/* hero KPI : carte d'accent franche façon Revolut */
.kpi.hl { background: color-mix(in srgb, var(--accent) 9%, var(--bg-card)); }
:root[data-theme="dark"] .kpi.hl { background: linear-gradient(155deg, color-mix(in srgb,var(--accent) 24%,var(--bg-card)) 0%, var(--bg-card) 64%); }
.kpi.hl .val, .kpi.hl .label, .kpi.hl .label .ic { color: var(--accent-text); }

/* rondeurs cohérentes sur les petits éléments */
.delta, .tag, .apr { border-radius: 8px; }
.badge { border-radius: 7px; }
.tf-bar, .tabbar { gap: 4px; }

/* ============================================================
   HERO BALANCE CARD (Revolut / Finary) — carte d'accent PLEINE
   en dégradé de pilier, indépendante du thème. Choc visuel.
   ============================================================ */
[data-pillar="p"] .kpi.hl { background: linear-gradient(140deg, #4C8DF0 0%, #1F4FA8 100%); color: #fff; }
[data-pillar="r"] .kpi.hl { background: linear-gradient(140deg, #E6C684 0%, #B98E33 100%); color: #241A08; }
[data-pillar="f"] .kpi.hl { background: linear-gradient(140deg, #9B6BFF 0%, #6B3FE0 100%); color: #fff; }
[data-pillar="o"] .kpi.hl { background: linear-gradient(140deg, #99A1B2 0%, #5C6678 100%); color: #fff; }
.kpi.hl { box-shadow: 0 22px 46px -22px color-mix(in srgb, var(--accent) 70%, transparent); }
.kpi.hl::after { display: none; }
.kpi.hl .label, .kpi.hl .val, .kpi.hl .foot, .kpi.hl .label .ic { color: inherit; }
.kpi.hl .label { opacity: 0.82; }
.kpi.hl .foot { opacity: 0.72; }
.kpi.hl .delta { background: rgba(255,255,255,0.22); color: inherit; backdrop-filter: blur(4px); }
[data-pillar="r"] .kpi.hl .delta { background: rgba(36,26,8,0.16); }
.kpi.hl .spark path { stroke: currentColor; opacity: 0.85; }
.kpi.hl .spark path:first-child { fill: currentColor; opacity: 0.16; stroke: none; }

/* ============================================================
   FINTECH+ : pastilles d'icône colorées, chiffres imposants,
   courbes plus épaisses. (Finary / Revolut)
   ============================================================ */
.kpi .label { gap: 10px; align-items: center; }
.kpi .label .ic {
  width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0;
  display: inline-grid; place-items: center; font-size: 0.9rem; opacity: 1;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent-text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}
.kpi .val { font-size: 2.15rem; }
/* hero balance : pastille translucide */
.kpi.hl .label .ic { background: rgba(255,255,255,0.20); color: inherit; box-shadow: none; }
[data-pillar="r"] .kpi.hl .label .ic { background: rgba(36,26,8,0.14); }
/* courbes : trait plus marqué */
.ar-line { stroke-width: 2.8; }

/* Graphe d'évolution dans les fiches KPI */
.kpi-chart { position: relative; margin-top: 4px; }
.kpi-chart #kpiChart { width: 100%; height: 200px; display: block; }
.kpi-chart-fig { font-family: var(--font-num); font-weight: 700; font-size: 1.05rem; color: var(--ink); letter-spacing: -0.02em; }

/* =========================================================
   COUCHE CLARTÉ UX — 2026-07 (patterns plateforme membre)
   loader premium · bottom-nav mobile · états vides ·
   cartes mobiles · barres d'allocation · tiles diagnostic
   ========================================================= */

/* ----- Loader premium : évite le flash de valeurs provisoires ----- */
.boot-loader {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: var(--bg);
  transition: opacity .5s var(--ease), visibility .5s;
}
.boot-loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.bl-logo { width: 56px; height: 56px; animation: blpulse 1.8s ease-in-out infinite; }
.bl-name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); }
.bl-track { width: 180px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; position: relative; }
.bl-fill { position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 3px; background: var(--accent, var(--violet)); animation: blslide 1.15s var(--ease) infinite; }
.bl-msg { font-size: 0.78rem; color: var(--ink-faded); min-height: 1.2em; }
@keyframes blpulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(0.94); } }
@keyframes blslide { from { left: -42%; } to { left: 102%; } }

/* ----- Bandeau « données indisponibles » (dégradation honnête) ----- */
.stale-banner {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 20px; padding: 12px 16px; border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--gold) 9%, var(--bg-card));
  border: 1px solid color-mix(in srgb, var(--gold) 32%, var(--line));
  font-size: 0.82rem; color: var(--ink-dim); line-height: 1.5;
}
.stale-banner[hidden] { display: none; }
.stale-banner .ic { color: var(--warn-text); }
.stale-banner b { color: var(--ink); }

/* ----- Timbre de fraîcheur (topbar) ----- */
.nw-asof { display: inline-flex; align-items: center; gap: 6px; }
.nw-asof .src-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--up); flex-shrink: 0; }
.nw-asof.stale .src-dot { background: var(--gold); }

/* ----- États vides engageants (jamais un panneau nu) ----- */
.empty-state { padding: 44px 24px; text-align: center; }
.empty-state .es-ic {
  width: 46px; height: 46px; margin: 0 auto 16px; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.25rem; color: var(--accent-text);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}
.empty-state .es-t { font-family: var(--font-display); font-weight: 600; font-size: 1rem; margin-bottom: 7px; }
.empty-state .es-d { font-size: 0.85rem; color: var(--ink-dim); line-height: 1.6; max-width: 44ch; margin: 0 auto; }

/* ----- Barres d'allocation animées (liste des familles) ----- */
.alloc-row { grid-template-columns: auto 1fr auto; grid-template-areas: 'nm amt pct' 'bar bar bar'; row-gap: 7px; }
.alloc-row .nm { grid-area: nm; }
.alloc-row .amt { grid-area: amt; text-align: right; color: var(--ink-dim); font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.alloc-row .pct { grid-area: pct; font-weight: 600; color: var(--ink); min-width: 56px; text-align: right; }
.alloc-row .track { grid-area: bar; height: 5px; border-radius: 4px; background: var(--line); overflow: hidden; }
.alloc-row .track .fill { display: block; height: 100%; border-radius: 4px; width: 0; transition: width .8s cubic-bezier(.22,1,.36,1); }

/* ----- Cartes mobiles : le tableau devient illisible sous 680px ----- */
.poscards { display: none; }
@media (max-width: 680px) {
  .table-scroll:has(+ .poscards) { display: none; }
  .poscards { display: flex; flex-direction: column; gap: 10px; }
  .poscard {
    display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center;
    padding: 14px 16px; border-radius: var(--r-sm); background: var(--tile);
  }
  .poscard .tk, .poscard .pairtk { grid-row: span 2; }
  .poscard .tk { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 0.72rem; color: #fff; overflow: hidden; }
  .poscard .tk img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .poscard .pc-nm { font-weight: 600; font-size: 0.92rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .poscard .pc-sub { font-size: 0.74rem; color: var(--ink-faded); grid-column: 2; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .poscard .pc-val { font-family: var(--font-num); font-weight: 700; font-size: 0.98rem; text-align: right; font-variant-numeric: tabular-nums; }
  .poscard .pc-foot { grid-column: 3; font-size: 0.74rem; color: var(--ink-dim); text-align: right; font-variant-numeric: tabular-nums; }
  .poscard .pc-foot .apr { font-size: 0.78rem; }
}
body.private .poscard .pc-val { filter: blur(7px); user-select: none; }

/* ----- Diagnostic : tiles à verdict (valeur + cible visible) ----- */
.diag-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.dtile { position: relative; padding: 15px 16px 13px 18px; border-radius: var(--r-sm); background: var(--tile); overflow: hidden; }
.dtile::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.dtile.ok::before { background: var(--up); }
.dtile.ko::before { background: var(--gold); }
.dtile .dt-k { font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faded); }
.dtile .dt-v { font-family: var(--font-num); font-weight: 700; font-size: 1.5rem; letter-spacing: -0.02em; margin: 7px 0 4px; }
.dtile.ok .dt-v { color: var(--up); }
.dtile.ko .dt-v { color: var(--warn-text); }
.dtile .dt-c { font-size: 0.74rem; color: var(--ink-dim); }
@media (max-width: 640px) { .diag-tiles { grid-template-columns: 1fr; } }

/* ----- Bottom-nav mobile : navigation à un pouce ----- */
.bottomnav { display: none; }
@media (max-width: 820px) {
  .bottomnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
    border-top: 1px solid var(--line-soft);
  }
  .bn-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 2px 5px; border-radius: 10px; color: var(--ink-faded);
    font-size: 0.6rem; font-weight: 600; letter-spacing: 0.01em;
    transition: color .2s, background .2s;
  }
  .bn-item img { width: 21px; height: 21px; opacity: 0.5; transition: opacity .2s; }
  .bn-item.active { color: var(--accent-text); background: color-mix(in srgb, var(--accent) 9%, transparent); }
  .bn-item.active img { opacity: 1; }
  .main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
}
