:root {
  --paper: #EEF1EC;
  --card: #FFFFFF;
  --ink: #16233B;
  --ink-2: #3C4A60;
  --muted: #6B7584;
  --line: #D9DFD8;
  --brass: #B8862E;
  --brass-soft: #F3E6CC;
  --gain: #1F7A55;
  --loss: #B03A2E;
  --focus: #3A6FD8;
  --night: #16233B;
  --r-lg: 18px;
  --r-sm: 8px;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E1624; --card: #16213A; --ink: #E8ECF2; --ink-2: #B9C2D0; --muted: #8A95A8;
    --line: #26334F; --night: #1B2A48; --brass: #D9A548; --brass-soft: #3A3120; --gain: #4CC38A; --loss: #F07B6C;
  }
}
*, *::before, *::after { box-sizing: inherit; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5; }
body { min-height: 100vh; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; margin: 0; line-height: 1.15; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.gain { color: var(--gain); } .loss { color: var(--loss); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { padding: 28px 18px; border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 1.35rem; font-weight: 700; margin-bottom: 26px; }
.brand svg { width: 30px; height: 30px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink-2); }
.nav a[aria-current="page"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--brass); }
.nav a svg { width: 18px; height: 18px; flex: none; }
.side .spacer { flex: 1; }
main { padding: 32px clamp(16px, 4vw, 48px) 110px; max-width: 1240px; width: 100%; min-width: 0; }
.head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.tabbar { display: none; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  main { padding-top: 20px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; text-decoration: none; color: var(--muted); padding: 4px 0; }
  .tabbar a[aria-current="page"] { color: var(--ink); font-weight: 600; }
  .tabbar svg { width: 22px; height: 22px; }
  h1 { font-size: 1.55rem; }
}

/* ---------- blocs ---------- */
.panel { background: var(--card); border-radius: var(--r-lg); padding: 20px; border: 1px solid var(--line); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }

/* le volant : l'élément signature du tableau de bord */
.hero { min-width: 0; display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 28px; align-items: center; background: var(--night); color: #F4F1E6; border-radius: 26px; padding: 28px; }

.hero .muted { color: #A8B3C4; }
.wheel { position: relative; width: 100%; aspect-ratio: 1; }
.wheel svg { width: 100%; height: 100%; display: block; }
.wheel .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.wheel .big { font-family: var(--display); font-size: clamp(1.9rem, 5vw, 2.6rem); font-weight: 700; letter-spacing: -0.03em; }
.wheel.spin svg .arcs { animation: spin 1.4s cubic-bezier(.2,.8,.2,1) both; transform-origin: 50% 50%; }
@keyframes spin { from { transform: rotate(-120deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .wheel.spin svg .arcs { animation: none; } }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 16px 18px; }
.kpi .label { font-size: 0.85rem; color: #A8B3C4; }
.kpi .value { font-family: var(--display); font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; }
.hero .gain { color: #7FD8A8; } .hero .loss { color: #FF9C8F; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; padding: 22px; } .wheel { max-width: 300px; margin: 0 auto; } }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .v { font-family: var(--display); font-size: 1.35rem; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 0.85rem; }

/* ---------- tableaux ---------- */
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 640px; }
th, td { padding: 10px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 500; color: var(--muted); font-size: 0.85rem; }
tbody tr:hover { background: color-mix(in srgb, var(--brass) 7%, transparent); }
tr.click { cursor: pointer; }
.tick { font-weight: 600; }
.sub { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--brass); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 0.78rem; background: var(--brass-soft); color: var(--ink); }
.tag.warn { background: color-mix(in srgb, var(--loss) 16%, transparent); }

/* ---------- formulaires ---------- */
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; color: var(--ink-2); }
input, select, textarea { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; min-width: 0; }
textarea { min-height: 110px; resize: vertical; }
.form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--ink); background: var(--ink); color: var(--card); padding: 10px 16px; border-radius: 99px; cursor: pointer; font-weight: 600; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.brass { background: var(--brass); border-color: var(--brass); color: #1B1406; }
.btn.small { padding: 6px 12px; font-size: 0.88rem; }
.btn.danger { background: transparent; color: var(--loss); border-color: currentColor; }
.btn[disabled] { opacity: .55; cursor: progress; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; padding: 3px; background: var(--card); }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 99px; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--card); }
.drop { border: 2px dashed var(--line); border-radius: var(--r-lg); padding: 24px; text-align: center; cursor: pointer; }
.drop.over { border-color: var(--brass); background: var(--brass-soft); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth .pitch { background: var(--night); color: #F4F1E6; padding: clamp(28px, 6vw, 72px); display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.auth .pitch h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); max-width: 14ch; }
.auth .pitch p { color: #B9C2D0; max-width: 46ch; }
.auth .pitch ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; color: #DCE2EA; }
.auth .pitch li::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 3px solid var(--brass); margin-right: 10px; vertical-align: middle; }
.auth .box { padding: clamp(28px, 6vw, 72px); display: flex; flex-direction: column; justify-content: center; gap: 16px; max-width: 460px; width: 100%; margin: 0 auto; }
@media (max-width: 820px) { .auth { grid-template-columns: 1fr; } .auth .pitch { padding-bottom: 36px; } }

.err { color: var(--loss); font-size: 0.9rem; min-height: 1.2em; }
#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--card); padding: 10px 18px; border-radius: 99px; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
dialog { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); color: var(--ink); padding: 22px; width: min(560px, 94vw); }
dialog::backdrop { background: rgb(10 16 28 / .5); }
.chartbox { position: relative; height: 260px; }
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 150px; }
.months .m { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; font-size: 0.75rem; color: var(--muted); }
.months .m i { width: 100%; border-radius: 6px 6px 2px 2px; background: var(--brass); min-height: 2px; }
.md h3 { margin: 16px 0 6px; } .md p, .md li { color: var(--ink-2); } .md ul { padding-left: 18px; }
.empty { text-align: center; padding: 40px 20px; }
.empty p { max-width: 44ch; margin: 8px auto 18px; color: var(--muted); }

/* ---------- listes lisibles sur téléphone ---------- */
.list { display: flex; flex-direction: column; }
.li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.li:last-child { border-bottom: 0; }
.li.click { cursor: pointer; }
.li.click:active { background: color-mix(in srgb, var(--brass) 8%, transparent); }
.li-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.li-main b { font-weight: 600; overflow-wrap: anywhere; }
.li-main span { color: var(--muted); font-size: .84rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.li-side { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: right; flex: none; max-width: 52%; }
.li-side b { font-weight: 600; white-space: nowrap; }
.li-side span { font-size: .84rem; color: var(--muted); white-space: nowrap; }
.li-side span.gain { color: var(--gain); } .li-side span.loss { color: var(--loss); }
.li-side.row { flex-direction: row; gap: 14px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.linkbtn { background: none; border: 0; padding: 2px 0; color: var(--muted); font-size: .84rem; text-decoration: underline; cursor: pointer; }
.linkbtn.danger { color: var(--loss); }
.only-mob { display: none; }
@media (max-width: 820px) { .only-mob { display: flex; } .only-desk { display: none; } }

/* ---------- lignes « libellé / valeur » ---------- */
.kvs { display: flex; flex-direction: column; margin-top: 6px; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv > span:not(.pill) { color: var(--ink-2); display: flex; flex-direction: column; min-width: 0; }
.kv small { color: var(--muted); font-size: .8rem; line-height: 1.35; margin-top: 2px; }
.kv > b { font-weight: 600; text-align: right; }
.pill { display: inline-flex; justify-content: center; min-width: 56px; padding: 4px 12px; border-radius: 99px; font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; flex: none; }
.p5 { background: #2E7D32; } .p4 { background: #7CB342; } .p3 { background: #D4C73A; color: #2A2400; } .p2 { background: #EE955A; } .p1 { background: #D9534F; }
.p-na { background: var(--line); color: var(--muted); }

/* ---------- fiche titre ---------- */
.back { text-decoration: none; font-size: .9rem; display: inline-block; margin-bottom: 6px; }
.fhead { margin-bottom: 16px; }
.fname { font-size: 1.45rem; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-top: 16px; }
.tabs button { background: none; border: 0; padding: 10px 12px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; font-size: 1rem; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brass); font-weight: 600; }
.scroll { overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }
.seg.scroll { display: flex; width: fit-content; }
.seg button { white-space: nowrap; }
.price { display: flex; flex-direction: column; margin-bottom: 10px; }
.price b { font-family: var(--display); font-size: 2rem; letter-spacing: -0.02em; }
#frange { margin-top: 10px; }
.range52 { margin-top: 14px; font-size: .82rem; }
.range52 .row { flex-wrap: nowrap; }
.track { position: relative; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--loss), #D4C73A, var(--gain)); margin-top: 8px; opacity: .8; }
.track i { position: absolute; top: -5px; width: 4px; height: 16px; border-radius: 2px; background: var(--ink); transform: translateX(-50%); }
.fgrid { display: grid; grid-template-columns: minmax(96px, 1.3fr) repeat(var(--n), minmax(0, 1fr)); gap: 10px 8px; font-size: .88rem; align-items: baseline; }
.fgrid b { text-align: right; color: var(--muted); font-weight: 500; }
.fgrid span.num { text-align: right; }
.fgrid > span:not(.num) { color: var(--ink-2); }
.summary { font-size: .9rem; margin-top: 12px; }

/* ---------- diversification ---------- */
.donut-wrap { display: grid; grid-template-columns: minmax(200px, 280px) 1fr; gap: 24px; align-items: center; margin-top: 12px; }
.donut { position: relative; aspect-ratio: 1; max-width: 280px; width: 100%; margin: 0 auto; }
.donut-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-c b { font-family: var(--display); font-size: 1.4rem; }
@media (max-width: 820px) { .donut-wrap { grid-template-columns: 1fr; } .donut { max-width: 240px; } }

.search { position: relative; }
.search input { width: 100%; }
#qres:not(:empty) { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 12px; margin-top: 6px; }
.check { flex-direction: row !important; align-items: center; gap: 8px; }
.alerts { padding-left: 18px; margin: 8px 0 14px; } .alerts li { margin-bottom: 8px; color: var(--ink-2); }
.hero-note { margin: 0; font-size: .85rem; }

/* ---------- ajustements téléphone ---------- */
@media (max-width: 820px) {
  main { padding-left: 14px; padding-right: 14px; }
  .head { align-items: stretch; flex-direction: column; }
  .head select { width: 100%; }
  .panel { padding: 16px; border-radius: 16px; }
  .hero { padding: 20px 16px; border-radius: 20px; gap: 18px; }
  .kpi .value { font-size: 1.2rem; }
  .form { grid-template-columns: 1fr 1fr; }
  .form label { min-width: 0; }
  .form input, .form select { width: 100%; }
  .btn { width: auto; }
  #add-tx { width: 100%; }
  .chartbox { height: 220px; }
  .stat .v { font-size: 1.2rem; }
  .months span { font-size: .65rem; }
}
html, body { overflow-x: clip; }
@media (max-width: 820px) {
  .seg.scroll { width: 100%; }
  .seg.scroll button { flex: 1; padding: 6px 6px; font-size: .86rem; }
}

/* ---------- fiche titre : lignes épurées, fond blanc, onglets soulignés ---------- */
.fx { --fx-blue: #2F5BEA; --fx-head: #F3F5F9; --fx-label: #6B7280; max-width: 760px; margin: -32px auto 0; background: var(--card); min-height: 100vh; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fx { --fx-head: #121C30; --fx-label: #9AA5B8; --fx-blue: #7EA0FF; } }
:root[data-theme="dark"] .fx { --fx-head: #121C30; --fx-label: #9AA5B8; --fx-blue: #7EA0FF; }
.fx-head { background: var(--fx-head); padding: 14px 20px 0; position: relative; }
.fx-back { position: absolute; left: 8px; top: 10px; font-size: 1.8rem; line-height: 1; text-decoration: none; color: var(--ink); padding: 4px 10px; }
.fx-id { display: flex; align-items: center; gap: 14px; padding: 30px 0 4px; }
.fx-logo { position: relative; width: 52px; height: 52px; border-radius: 50%; background: var(--card); flex: none; display: grid; place-items: center; box-shadow: 0 0 0 6px color-mix(in srgb, var(--card) 55%, transparent); overflow: hidden; }
.fx-logo img { width: 30px; height: 30px; position: absolute; z-index: 1; background: var(--card); }
.fx-logo i { font-style: normal; font-weight: 700; font-size: .95rem; color: var(--fx-label); }
.fx-id h1 { font-family: var(--body); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.01em; line-height: 1.2; overflow-wrap: anywhere; }
.fx-id p { margin: 4px 0 0; color: var(--fx-label); font-size: .95rem; }
.fx-copy { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: copy; }
.fx-more { margin-left: auto; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 1.3rem; cursor: pointer; flex: none; }
.fx-upd { color: var(--fx-label); margin: 14px 0 0; font-size: .92rem; }
.fx-tabs { display: flex; gap: 26px; margin-top: 18px; border-bottom: 1px solid var(--line); }
.fx-tabs button { background: none; border: 0; padding: 10px 0 12px; font-size: 1.02rem; color: var(--fx-label); cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.fx-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--fx-blue); }
.fx-body { padding: 4px 20px 40px; }
.fx-sec { padding: 14px 0; border-bottom: 1px solid var(--line); }
.fx-sec:last-child { border-bottom: 0; }
.fx-sec h2 { font-family: var(--body); font-size: 1.3rem; font-weight: 700; margin: 10px 0 12px; }
.fx-sec h2:empty { display: none; }
.fx-link { background: none; border: 0; padding: 0; font: inherit; color: inherit; display: inline-flex; gap: 14px; align-items: center; cursor: pointer; }
.fx-link span { font-size: 1.5rem; line-height: 1; }
.fx-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; padding: 4px 0; }
.fx-l { color: var(--fx-label); font-size: 1.04rem; display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.fx-l small { font-size: .8rem; }
.fx-v { color: var(--ink); font-size: 1.04rem; text-align: right; white-space: nowrap; }
.fx-row.sub .fx-l, .fx-row.sub .fx-v { font-style: italic; color: var(--fx-label); }
.fx-row.sub .fx-l { padding-left: 22px; }
.fx-q { width: 20px; height: 20px; border-radius: 50%; border: 1.6px solid var(--fx-label); background: none; color: var(--fx-label); font-size: .72rem; font-weight: 700; line-height: 1; padding: 0; cursor: pointer; flex: none; }
.fx-q[aria-expanded="true"] { background: var(--fx-blue); border-color: var(--fx-blue); color: #fff; }
.fx-help { margin: -2px 0 8px; padding: 10px 12px; background: var(--fx-head); border-radius: 10px; font-size: .88rem; color: var(--ink-2); }
.fx-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 64px; height: 30px; padding: 0 14px; border-radius: 99px; color: #fff; font-weight: 600; font-style: normal; font-size: .98rem; }
.fx-g5 { background: #2E7D32; } .fx-g4 { background: #86B04E; } .fx-g3 { background: #CBD646; } .fx-g2 { background: #F0A04B; } .fx-g1 { background: #E0544B; }
.fx-teal { background: #4A9C82; } .fx-na { background: var(--line); color: var(--fx-label); }
.fx-price { display: flex; flex-direction: column; gap: 6px; }
.fx-price > b { font-family: var(--body); font-size: 2.1rem; font-weight: 800; letter-spacing: -0.02em; }
.fx-price .gain { color: #3E9A7E; }
.fx-chart { position: relative; height: 260px; margin: 12px -20px 0; }
.fx-range { display: flex; justify-content: space-between; gap: 4px; margin-top: 10px; }
.fx-range button { flex: 1; background: none; border: 0; padding: 8px 0; border-radius: 10px; font-size: 1rem; color: var(--ink); cursor: pointer; }
.fx-range button[aria-pressed="true"] { background: color-mix(in srgb, var(--fx-blue) 12%, transparent); }
.fx-text { color: var(--fx-label); font-size: .95rem; margin: 12px 0 0; }
.fx-note { color: var(--fx-label); font-size: .85rem; margin: 12px 0 0; }
.fx-bar { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: var(--line); margin-right: 10px; vertical-align: middle; overflow: hidden; }
.fx-bar i { display: block; height: 100%; background: #4A9C82; }
.fx .fgrid { font-size: .92rem; }
@media (max-width: 820px) {
  .fx { margin: -20px -14px 0; }
  .fx-tabs { gap: 22px; margin-left: -20px; margin-right: -20px; padding: 0 20px; max-width: none; }
}
@media (min-width: 821px) { .fx { border-radius: 0 0 20px 20px; overflow: clip; } }

/* matrice des scores par action */
.smx { display: flex; flex-direction: column; }
.smx-r { display: grid; grid-template-columns: minmax(64px, 1.4fr) repeat(7, minmax(0, 1fr)); gap: 5px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.smx-r:last-child { border-bottom: 0; }
.smx-r[data-open] { cursor: pointer; }
.smx-h { position: sticky; top: env(safe-area-inset-top, 0px); background: var(--card); z-index: 2; padding: 4px 0 8px; }
.smx-h button { background: none; border: 0; padding: 4px 0; font-size: .74rem; color: var(--muted); cursor: pointer; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smx-h button:first-child { text-align: left; }
.smx-h button[aria-pressed="true"] { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.smx-n { display: flex; flex-direction: column; min-width: 0; }
.smx-n b { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smx-n small { color: var(--muted); font-size: .72rem; }
.sc { display: flex; align-items: center; justify-content: center; height: 30px; border-radius: 8px; color: #fff; font-weight: 700; font-size: .9rem; font-variant-numeric: tabular-nums; }
.sc.p3 { color: #2A2400; }
.sc-na { background: var(--line); color: var(--muted); font-weight: 400; }
.smx-r > .sc:last-child { outline: 2px solid var(--ink); outline-offset: -2px; }

/* rangées d'onglets : défilement horizontal uniquement, jamais vertical */
.scroll { overflow-y: hidden; overscroll-behavior-x: contain; touch-action: pan-x; -webkit-overflow-scrolling: touch; }
.fx-tabs { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 15; background: var(--fx-head); overflow-x: auto; overflow-y: hidden; }
.fx-tabs button { flex: none; }
.fx-head { overflow: visible; }
.fx-tabs, .fx-tabs button { touch-action: pan-x; }
.fx-tabs { margin: 0 !important; padding: 18px 20px 0 !important; max-width: none; }
.fx-head { padding-bottom: 0; }

/* pas de zoom involontaire : iOS zoome sur les champs sous 16 px et au double-tap */
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
input, select, textarea { font-size: 16px !important; }
button, a, .li, [data-open] { touch-action: manipulation; }

/* explorer */
.bigsearch { position: relative; }
.bigsearch input { width: 100%; padding: 14px 16px 14px 44px; border-radius: 14px; background: var(--card); }
.bigsearch svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 6px 12px; font-size: .9rem; cursor: pointer; }
.star { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--fx-label); padding: 4px; }
.star[aria-pressed="true"] { color: #F2B84B; }
.headbtn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; text-decoration: none; color: var(--ink); flex: none; }
.headbtn svg { width: 20px; height: 20px; }
.head-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }

/* impact d'un ajout */
.verdict { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 14px; margin: 6px 0 4px; }
.verdict b { font-size: 1.05rem; }
.verdict.good { background: color-mix(in srgb, #2E7D32 12%, transparent); }
.verdict.mid { background: color-mix(in srgb, #CBD646 20%, transparent); }
.verdict.bad { background: color-mix(in srgb, #E0544B 12%, transparent); }
.proscons { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 10px; }
.proscons li { display: flex; gap: 10px; align-items: flex-start; font-size: .96rem; color: var(--ink-2); }
.proscons li::before { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: #fff; margin-top: 1px; }
.proscons.pro li::before { content: "+"; background: #2E7D32; }
.proscons.con li::before { content: "−"; background: #E0544B; }
.amount { display: flex; gap: 10px; align-items: center; }
.amount input[type=range] { flex: 1; accent-color: var(--fx-blue); padding: 0; border: 0; background: none; }
.amount input[type=number] { width: 110px; text-align: right; }
.delta { font-size: .85rem; margin-left: 6px; }

/* valorisation */
.vchart { position: relative; height: 320px; margin: 4px -20px 0; }
.vlegend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; margin-top: 10px; font-size: .78rem; color: var(--fx-label); }
.vlegend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.vverdict { text-align: center; font-size: 1.15rem; line-height: 1.8; margin: 18px 0 10px; }
.vpill { display: inline-block; padding: 2px 14px; border-radius: 99px; font-weight: 700; }
.vpill.v-bad { background: #F5C6C6; color: #7A1D1D; } .vpill.v-good { background: #BFE8D0; color: #0E5A34; } .vpill.v-mid { background: #F6E2AE; color: #5C4300; }
.vkpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.vkpis > div { background: var(--fx-head); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.vkpis span { color: var(--fx-label); font-size: .82rem; } .vkpis b { font-size: 1.15rem; } .vkpis small { color: var(--fx-label); font-size: .75rem; }
.v-buy { color: #0E7A4A; }
.vzone { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; font-size: .92rem; }
.vzone.v-good { background: #DDF3E6; color: #0E5A34; } .vzone.v-mid { background: #FBF1D3; color: #5C4300; } .vzone.v-bad { background: #FBE3E3; color: #7A1D1D; }
.vparams { display: block; margin: 16px auto 0; background: var(--fx-blue); color: #fff; border: 0; border-radius: 99px; padding: 12px 26px; font-weight: 600; font-size: 1rem; cursor: pointer; }
.vpanel { margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--fx-head); }
.vpanel input[type=range] { width: 100%; padding: 0; border: 0; background: none; accent-color: var(--fx-blue); }
.chip[aria-pressed="true"] { background: var(--fx-blue, #2F5BEA); border-color: transparent; color: #fff; }
.chip[disabled] { opacity: .4; }
.vhead { display: flex; justify-content: space-between; color: var(--fx-label); border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 6px; }
.vrow { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; }
.vrow > div { display: flex; flex-direction: column; }
.vrow > div:last-child { text-align: right; white-space: nowrap; }
.vrow b { font-weight: 500; } .vrow small { color: var(--fx-label); font-size: .78rem; }
.vrow.off { opacity: .45; }
.goalbar { height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 10px; }
.goalbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brass), #1F7A55); border-radius: 99px; }
.nx .li-main span { -webkit-line-clamp: 3; }
.nx-pro { color: #1F7A55 !important; } .nx-con { color: #B03A2E !important; }
#bench { margin-top: 10px; }
.warnbox { background: #FBE9D0; color: #6B4300; border-radius: 14px; padding: 12px 14px; margin: 0 0 12px; font-size: .92rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .warnbox { background: #3A2E17; color: #F3D9A8; } }
.heat { display: grid; grid-template-columns: 26px repeat(12, minmax(0, 1fr)); gap: 3px; font-size: .7rem; align-items: center; }
.heat b { color: var(--muted); font-weight: 500; text-align: center; }
.heat i { font-style: normal; height: 26px; border-radius: 5px; background: var(--brass); display: grid; place-items: center; color: #1B1406; font-weight: 600; font-variant-numeric: tabular-nums; font-size: .66rem; }
.announce { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; background: var(--night); color: #F4F1E6; border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; font-size: .92rem; }
.announce button { background: none; border: 0; color: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 4px; }
#atabs button { font-size: .86rem; }
.li-main .tag { display: inline-block; width: auto; color: var(--ink); font-size: .74rem; vertical-align: 2px; margin-left: 4px; }

/* page de connexion : la moitié gauche reste toujours sombre et lisible, clair ou sombre */
.auth .pitch .brand { color: #F4F1E6; }
.auth .pitch h1 { color: #F4F1E6; }
.auth .box { background: var(--paper); }
@media (min-width: 821px) { .auth .box form { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 24px; } }

/* listes réduites et sections repliables */
.morebtn { display: block; width: 100%; margin-top: 6px; padding: 10px; border: 1px dashed var(--line); border-radius: 12px; background: none; color: var(--ink-2); font-weight: 600; cursor: pointer; }
.foldable { cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; user-select: none; }
.foldable::after { content: ""; flex: none; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: 0 4px 4px 0; transition: transform .2s; }
.folded .foldable::after { transform: rotate(-45deg); margin-bottom: 0; }
section.panel.folded > :not(h2):not(.row), section.panel.folded > .row > :not(h2),
section.fx-sec.folded > :not(h2) { display: none !important; }
section.panel.folded > .row:not(:has(> h2)) { display: none !important; }
section.panel.folded { padding-bottom: 16px; }
.row > h2.foldable { flex: 1; }
[hidden] { display: none !important; }
.updbar { position: fixed; left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 60; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--night); color: #F4F1E6; padding: 12px 14px; border-radius: 14px; box-shadow: 0 8px 24px rgb(0 0 0 / .25); }
.updbar button { background: var(--brass); color: #1B1406; border: 0; border-radius: 99px; padding: 8px 14px; font-weight: 700; cursor: pointer; }
@media (min-width: 821px) { .updbar { left: auto; right: 24px; bottom: 24px; max-width: 420px; } }
.viewas { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #7A1D1D; color: #fff; padding: 10px 14px; font-size: .9rem; }
.viewas button { background: #fff; color: #7A1D1D; border: 0; border-radius: 99px; padding: 6px 12px; font-weight: 700; cursor: pointer; flex: none; }

/* ---------- téléphone : mise en page en colonne, sans position fixe ----------
   iOS (surtout en appli installée) décale parfois les éléments « position: fixed » au milieu de l'écran.
   La barre d'onglets devient un simple bloc en bas, et seule la zone de contenu défile. */
@media (max-width: 820px) {
  :root { padding-bottom: 0; }
  html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  body { min-height: 0; }
  #app { height: 100%; display: flex; flex-direction: column; }
  #app > .shell { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  #app > .auth { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  main#view { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; padding-bottom: 28px; }
  .tabbar { position: static; flex: none; }
  .viewas { position: static; flex: none; }
  .fx-tabs, .smx-h { top: 0 !important; }
  .updbar { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

/* thème sombre forcé depuis Mon compte */
:root[data-theme="dark"] {
    --paper: #0E1624; --card: #16213A; --ink: #E8ECF2; --ink-2: #B9C2D0; --muted: #8A95A8;
    --line: #26334F; --night: #1B2A48; --brass: #D9A548; --brass-soft: #3A3120; --gain: #4CC38A; --loss: #F07B6C;
}
:root[data-theme="dark"] { color-scheme: dark; } :root[data-theme="light"] { color-scheme: light; }

.acc-hero { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; }
.acc-avatar { width: 58px; height: 58px; border-radius: 50%; background: var(--night); color: #F4F1E6; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 1.3rem; flex: none; box-shadow: 0 0 0 4px var(--brass-soft); }
.pwmeter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.pwmeter i { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.danger-zone { border-color: color-mix(in srgb, var(--loss) 40%, var(--line)); }
details summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
#acc-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#acc-stats .panel { padding: 12px; }
#acc-stats .v { font-size: 1.1rem; }
#acc-stats .muted { font-size: .75rem; }
.form > label:only-child { grid-column: 1 / -1; }

/* réseau */
.tabbar { grid-template-columns: repeat(7, 1fr) !important; }
.tabbar a { font-size: 10px !important; }
.tabbar svg { width: 21px !important; height: 21px !important; }
.pcard { margin-bottom: 12px; cursor: pointer; }
.acc-avatar.sm { width: 44px; height: 44px; font-size: 1rem; box-shadow: 0 0 0 3px var(--brass-soft); }
.pbio { font-size: .88rem; color: var(--ink-2); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.pstats span { display: flex; flex-direction: column; background: var(--paper); border-radius: 10px; padding: 8px 10px; }
.pstats small { color: var(--muted); font-size: .74rem; } .pstats b { font-variant-numeric: tabular-nums; }
.chip.sm { font-size: .78rem; padding: 3px 9px; }
label.chip { display: inline-flex; gap: 6px; align-items: center; }
label.chip input { width: auto; padding: 0; }
.check.big { font-weight: 600; color: var(--ink); font-size: 1rem; }
.feedtxt { color: var(--ink) !important; -webkit-line-clamp: 3 !important; font-size: .93rem !important; }
.feedtxt a { text-decoration: none; }
#u-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#u-stats .panel { padding: 12px; } #u-stats .v { font-size: 1.1rem; }
dialog.legal { width: min(720px, 96vw); max-height: 88vh; display: flex; flex-direction: column; padding: 18px; }
dialog.legal[open] { display: flex; }
.legal-body { overflow-y: auto; flex: 1; padding-right: 4px; }
.legal-body h2 { font-size: 1.3rem; } .legal-body h3 { margin: 16px 0 4px; font-size: 1rem; }
.legal-body p, .legal-body li { font-size: .92rem; line-height: 1.55; color: var(--ink-2); }
.legal-body ul { padding-left: 18px; }
.legal-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.legal-links { font-size: .82rem; color: var(--muted); margin: 8px 0 0; }
.legal-links a { color: var(--muted); }
.bell { position: relative; }
.bell-badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--loss); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center; }
.li.notif { text-decoration: none; color: inherit; }
.li.notif.unread b::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--loss); margin-left: 8px; vertical-align: 2px; }
.kv.toggle { cursor: pointer; }
.kv.toggle input { width: 22px; height: 22px; flex: none; accent-color: var(--brass); }

/* réglages en lignes : libellé à gauche, interrupteur à droite */
label.kv { flex-direction: row !important; align-items: center !important; justify-content: space-between; gap: 16px; font-size: 1rem; }
label.kv > span { flex: 1; min-width: 0; text-align: left; align-items: flex-start; }
label.kv > span small { display: block; }
label.kv select { flex: none; width: auto; min-width: 84px; padding: 8px 10px; }
.kv.toggle input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; cursor: pointer;
  width: 50px; height: 30px; border-radius: 99px; background: var(--line); border: 0; padding: 0; margin: 0;
  transition: background .2s;
}
.kv.toggle input[type="checkbox"]::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .2s;
}
.kv.toggle input[type="checkbox"]:checked { background: var(--gain); }
.kv.toggle input[type="checkbox"]:checked::after { transform: translateX(20px); }
.kv.toggle input[type="checkbox"]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* profil public */
.pp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.pp-sticky { position: sticky; top: 20px; }
@media (max-width: 980px) { .pp-grid { grid-template-columns: 1fr; } .pp-sticky { position: static; } }
.pp-main, .pp-side { min-width: 0; }
.pp-stats { flex-wrap: wrap; }
.pp-hero { border-width: 2px; }
.pp-hero.on { border-color: color-mix(in srgb, var(--gain) 55%, var(--line)); }
.rgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 10px; }
.rcard { position: relative; display: flex !important; flex-direction: row !important; gap: 12px; align-items: flex-start; padding: 14px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; color: var(--ink) !important; transition: border-color .15s, background .15s; }
.rcard input { position: absolute; opacity: 0; pointer-events: none; }
.rcard .ricon { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--paper); color: var(--muted); }
.rcard .ricon svg { width: 20px; height: 20px; }
.rcard b { display: block; font-size: .98rem; } .rcard small { color: var(--muted); font-size: .82rem; line-height: 1.35; }
.rcard.on { border-color: var(--brass); background: color-mix(in srgb, var(--brass) 8%, transparent); }
.rcard.on .ricon { background: var(--brass); color: #1B1406; }
.rcard:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.prefix-in { display: flex; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); }
.prefix-in > span { padding-left: 12px; color: var(--muted); }
.prefix-in input { border: 0 !important; background: none !important; flex: 1; min-width: 0; }
.chip.tog { cursor: pointer; }
.pchips { display: flex; flex-wrap: wrap; gap: 8px; }
.pchip { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: 99px; background: var(--paper); }
.pchip b { display: block; font-size: .9rem; } .pchip small { color: var(--muted); font-size: .75rem; }
.acc-avatar.xs { width: 32px; height: 32px; font-size: .85rem; box-shadow: none; flex: none; }
.pp-stats { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: .84rem; color: var(--muted); }
.pp-stats b { color: var(--ink); }
.pcard.dim { opacity: .45; filter: grayscale(.6); }
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; padding: 12px 0; background: linear-gradient(transparent, var(--paper) 30%); }

/* champs avec unité, cases à cocher dans les formulaires, encadré de note */
.suffix-in { display: flex; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); }
.suffix-in input { border: 0 !important; background: none !important; flex: 1; min-width: 0; width: 100% !important; }
.suffix-in > span { padding-right: 12px; color: var(--muted); }
.form label.check { grid-column: 1 / -1; flex-direction: row !important; align-items: center !important; gap: 10px; }
.form label.check input, label.check input { width: auto !important; flex: none; }
.kv.toggle input[type="checkbox"] { width: 50px !important; min-width: 50px; }
.note-box { background: var(--paper); border-radius: 12px; padding: 12px 14px; }
.note-box p { margin: 0; font-size: .86rem; color: var(--ink-2); line-height: 1.5; }
.note-box p + p { margin-top: 6px; font-size: .78rem; }

/* barre d'enregistrement : vraie barre pleine largeur collée en bas, sans dégradé par-dessus le contenu */
.savebar { position: sticky; bottom: 0; z-index: 6; display: flex; gap: 10px; align-items: center; margin: 16px -14px 0; padding: 12px 14px; background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgb(0 0 0 / .06); }
.savebar .btn { flex: 1; }
.savebar #sp-dirty { display: none; }
.savebar.dirty::before { content: "Modifications non enregistrées"; position: absolute; top: -26px; left: 14px; font-size: .78rem; color: var(--brass); background: var(--card); padding: 2px 10px; border-radius: 99px; border: 1px solid var(--line); }
@media (min-width: 821px) { .savebar { margin: 16px 0 0; border: 1px solid var(--line); border-radius: 16px; bottom: 16px; } .savebar .btn { flex: none; } }

/* bulle d'information fiscale */
.lbl-row { display: flex; align-items: center; gap: 8px; }
.info-btn { width: 22px; height: 22px; border-radius: 50%; border: 1.6px solid var(--muted); background: none; color: var(--muted); font: italic 700 .8rem Georgia, serif; line-height: 1; padding: 0; cursor: pointer; flex: none; }
.info-btn:hover, .info-btn:focus-visible { border-color: var(--brass); color: var(--brass); }
.tx-ex { background: var(--paper); border-radius: 12px; padding: 12px 14px; margin: 10px 0 4px; font-size: .9rem; }
.tx-ex table, .tx-wht { width: 100%; min-width: 0; border-collapse: collapse; margin-top: 8px; font-size: .86rem; }
.tx-ex th, .tx-ex td { padding: 6px 4px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tx-ex th:first-child, .tx-ex td:first-child { text-align: left; white-space: normal; }
.tx-wrap { overflow-x: auto; }
.tx-wht td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; white-space: normal; }
.tx-wht td:nth-child(2) { white-space: nowrap; }
.tx-wht td:nth-child(3) { color: var(--muted); font-size: .8rem; }
@media (max-width: 820px) { dialog.legal { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 20px 20px 0 0; } }

/* agenda */
.ev-month { font-size: 1.35rem; margin: 18px 0 8px; text-transform: capitalize; }
.ev-week { font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px 64px; }
.ev-day { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 10px; margin-bottom: 12px; }
.ev-date { display: flex; flex-direction: column; align-items: center; padding-top: 10px; line-height: 1.15; }
.ev-date small { font-size: .7rem; color: var(--muted); font-weight: 600; }
.ev-date b { font-family: var(--display); font-size: 1.5rem; }
.ev-date.today b { background: var(--gain); color: #fff; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 1.2rem; margin: 2px 0; }
.ev-list { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ev-card { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px; box-shadow: 0 2px 10px rgb(0 0 0 / .04); }
.ev-card[data-open] { cursor: pointer; }
.ev-logo { width: 42px; height: 42px; border-radius: 50%; background: var(--night); color: #F4F1E6; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.ev-logo.flag { background: var(--paper); font-size: 1.5rem; }
.ev-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ev-cat { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; }
.ev-cat svg { width: 14px; height: 14px; }
.ev-title { font-weight: 600; font-size: .98rem; line-height: 1.25; overflow-wrap: anywhere; }
.ev-sub { font-size: .8rem; color: var(--muted); }
.ev-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; max-width: 42vw; }
.ev-right small { font-size: .75rem; color: var(--muted); line-height: 1.3; }
.ev-big { font-family: var(--display); font-size: 1.35rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.cat-div .ev-cat, .cat-div .ev-big { color: #E08A2E; }
.cat-rec .ev-cat { color: var(--gain); }
.cat-earn .ev-cat { color: #8E6BD8; }
.cat-eco .ev-cat, .ev-big.eco { color: #5B7CFA; }
.ev-imp { color: var(--loss); font-weight: 600; }
.ev-mini { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.evm { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 8px; align-items: center; }
.evm-d { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.evm-d b { font-family: var(--display); font-size: 1.15rem; } .evm-d small { font-size: .68rem; color: var(--muted); }
.evm .ev-card { padding: 10px 12px; grid-template-columns: 34px minmax(0, 1fr) auto; border-radius: 14px; box-shadow: none; }
.evm .ev-logo { width: 34px; height: 34px; font-size: .75rem; }
.evm .ev-big { font-size: 1.05rem; }
@media (max-width: 420px) { .ev-card { grid-template-columns: 36px minmax(0, 1fr); } .ev-card .ev-right { grid-column: 2; align-items: flex-start; text-align: left; max-width: none; } .ev-logo { width: 36px; height: 36px; } }
.earn-text { font-size: .95rem; line-height: 1.6; color: var(--ink-2); margin: 14px 0 10px; }
.earn-text b { color: var(--ink); }

/* téléphone : l'appli occupe l'écran de façon fixe ; seule la zone de contenu défile.
   Évite que la page entière glisse sous la barre d'état d'iOS (en-tête et onglets qui « sautent »). */
@media (max-width: 820px) {
  :root { padding-top: 0 !important; padding-bottom: 0 !important; }
  #app { position: fixed; inset: 0; height: auto !important; padding-top: env(safe-area-inset-top, 0px); display: flex; flex-direction: column; background: var(--paper); }
  #app > .shell { min-height: 0 !important; height: auto; flex: 1; }
  #app > .auth { min-height: 0 !important; }
  .fx-head { padding-top: 6px; }
}
/* la zone qui défile n'a plus de marge en haut : les barres collantes (onglets d'une fiche) touchent vraiment le haut */
@media (max-width: 820px) {
  main#view { padding-top: 0 !important; }
  main#view > .announce { margin-top: 14px; }
  #viewin { padding-top: 20px; }
}
.soon { display: inline-block; margin: 2px 0 6px; padding: 3px 12px; border-radius: 99px; background: var(--brass-soft); color: var(--ink); font-size: .8rem; font-weight: 700; letter-spacing: .02em; }
.drop[aria-disabled="true"] { cursor: default; }

/* grand écran : on utilise la largeur disponible */
main { max-width: 1720px; }
.head-top { flex: 1; min-width: 0; }
.head-top > .row { margin-left: auto; }
.dash-cols .dash-lines { grid-column: 1 / -1; }
@media (min-width: 1500px) {
  .dash-cols { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr); }
  .dash-cols .dash-lines { grid-column: auto; }
  .dash-cols .chartbox { height: 320px; }
}
@media (min-width: 821px) { .head:has(.head-top) { flex-wrap: nowrap; align-items: flex-start; } }
@media (min-width: 1100px) { .hero .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Mon compte : catégories */
.acc-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 20px; align-items: start; }
.acc-nav { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 8px; }
.acc-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: none; border: 0; border-radius: 12px; padding: 10px; cursor: pointer; color: var(--ink); }
.acc-item:hover { background: var(--paper); }
.acc-item.on { background: color-mix(in srgb, var(--brass) 14%, transparent); }
.acc-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--paper); color: var(--ink-2); flex: none; }
.acc-ic svg { width: 19px; height: 19px; }
.acc-item.on .acc-ic { background: var(--brass); color: #1B1406; }
.acc-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.acc-txt b { font-weight: 600; font-size: .95rem; }
.acc-txt small { color: var(--muted); font-size: .78rem; line-height: 1.3; }
.acc-chev { color: var(--muted); font-size: 1.3rem; display: none; }
.acc-content { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.acc-content > [data-cat] { margin-top: 0 !important; }
.acc-me { display: none; }
@media (max-width: 820px) { .acc-layout.menu-only .acc-me { display: flex; align-items: center; gap: 12px; padding: 12px 10px 14px; border-bottom: 1px solid var(--line); } .acc-me b { display: block; } .acc-me small { color: var(--muted); word-break: break-all; } }
@media (min-width: 821px) { .acc-back { display: none !important; } }
@media (max-width: 820px) {
  .acc-layout { grid-template-columns: 1fr; }
  .acc-layout.menu-only .acc-content { display: none; }
  .acc-layout.has-active .acc-nav { display: none; }
  .acc-nav { position: static; padding: 4px; }
  .acc-item { padding: 12px 10px; border-bottom: 1px solid var(--line); border-radius: 0; }
  .acc-item:last-child { border-bottom: 0; }
  .acc-item.on { background: none; }
  .acc-item.on .acc-ic { background: var(--paper); color: var(--ink-2); }
  .acc-chev { display: block; }
}
@media (max-width: 820px) { .head.acc-active h1 { display: none; } .head.acc-active { margin-bottom: 6px; } }
