/* Patrimoine : feuille de style unique, mobile first.
   Univers « Plan de ligne » : signalétique des transports publics. Bandeau de quai bleu nuit, pastilles de ligne
   par famille, police de signalétique (Overpass), quatre tailles de texte, rang porté par la graisse et l'inversion.
   Clair ou sombre selon le système, ou forcé par le réglage du compte (data-theme). */

@font-face {
  font-family: "Overpass";
  src: url("../fonts/overpass-latin-wght.woff2") format("woff2");
  /* U+00B7 (point médian) exclu : décalé à droite aux fortes graisses dans cette version, il collait au mot suivant */
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00B6, U+00B8-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Overpass";
  src: url("../fonts/overpass-latin-ext-wght.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Signalétique */
  --bandeau: #16264d;          /* panneau de quai */
  --bandeau-2: #213567;        /* survol sur le bandeau */
  --bandeau-ink: #ffffff;
  --bandeau-soft: #c3cce2;
  --signal: #ffcd00;           /* « tu es ici », focus, mise en évidence */
  --signal-ink: #16264d;
  --signal-hover: #ffe066;
  /* Fond et matière */
  --bg: #eceff4;
  --surface: #ffffff;
  --surface-2: #f3f5f9;
  --text: #0f1a33;
  --muted: #4d5872;
  --border: #d3d9e4;
  --border-strong: #6f7b95;
  --primary: #16264d;
  --primary-text: #ffffff;
  --link: #1f4fbf;
  /* États */
  --ok: #00754f;
  --ok-bg: #dff3ea;
  --ok-fill: #00a07e;
  --warn: #7a5200;
  --warn-bg: #fff4c2;
  --err: #b8001f;
  --proj-prudent: #c26a00;     /* projection, scénario prudent : se distingue du bleu nuit */
  --err-bg: #fde4e7;
  /* Mesures */
  --radius: 6px;
  --radius-sm: 4px;
  --shadow: none;
  --font: "Overpass", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* Quatre tailles de texte */
  --t-hero: clamp(2.5rem, 2rem + 3.2vw, 4.25rem);
  --t-title: 1.5rem;
  --t-body: 1rem;
  --t-small: .8125rem;
  --bandeau-h: 3.5rem;
}

/* Sombre : automatique (selon le système) sauf si le compte force « clair », ou forcé (« sombre »).
   Les deux blocs portent les mêmes valeurs. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bandeau: #0b142b;
    --bandeau-2: #172447;
    --bandeau-ink: #ffffff;
    --bandeau-soft: #a9b5d3;
    --signal: #ffd21f;
    --signal-ink: #0b142b;
    --bg: #0f1830;
    --surface: #17223f;
    --surface-2: #1d2a4c;
    --text: #e9eef8;
    --muted: #a9b5cf;
    --border: #2c3b63;
    --border-strong: #8b98b8;
    --primary: #ffd21f;
    --primary-text: #0b142b;
    --link: #8fb4ff;
    --ok: #4bd3a4;
    --ok-bg: #11392f;
    --ok-fill: #2bbf8e;
    --warn: #ffd21f;
    --warn-bg: #3a3112;
    --err: #ff7d8f;
    --proj-prudent: #a9b5cf;
  --cal-step-dark: 8%;
  --metal-or: #e8c14a; --metal-argent: #d3d9e2; --metal-platine: #9ebdeb; --metal-palladium: #dcb98c;
    --err-bg: #43192a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bandeau: #0b142b;
  --bandeau-2: #172447;
  --bandeau-ink: #ffffff;
  --bandeau-soft: #a9b5d3;
  --signal: #ffd21f;
  --signal-ink: #0b142b;
  --bg: #0f1830;
  --surface: #17223f;
  --surface-2: #1d2a4c;
  --text: #e9eef8;
  --muted: #a9b5cf;
  --border: #2c3b63;
  --border-strong: #8b98b8;
  --primary: #ffd21f;
  --primary-text: #0b142b;
  --link: #8fb4ff;
  --ok: #4bd3a4;
  --ok-bg: #11392f;
  --ok-fill: #2bbf8e;
  --warn: #ffd21f;
  --warn-bg: #3a3112;
  --err: #ff7d8f;
  --proj-prudent: #a9b5cf;
  --cal-step-dark: 8%;
  --metal-or: #e8c14a; --metal-argent: #d3d9e2; --metal-platine: #9ebdeb; --metal-palladium: #dcb98c;
  --err-bg: #43192a;
  --shadow: none;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--border-strong) var(--bg); }
body { margin: 0; font-family: var(--font); font-size: var(--t-body); line-height: 1.5; background: var(--bg); color: var(--text);
  font-feature-settings: "tnum" 1; -webkit-font-smoothing: antialiased; caret-color: var(--link); }
::selection { background: var(--signal); color: var(--signal-ink); }
/* Liens : bleu du site en gras, soulignés au survol et au focus (la graisse les distingue du texte, en plus de la couleur) */
a { color: var(--link); font-weight: 700; text-decoration: none; text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover, a:focus-visible { text-decoration: underline; }
/* Dans les tableaux, le lien se lit comme du texte ; il se révèle au survol et au focus */
td a, th a { color: inherit; font-weight: inherit; text-decoration: none; }
td a:hover, th a:hover, td a:focus-visible, th a:focus-visible { color: var(--link); text-decoration: underline; text-underline-offset: .18em; }
/* Lien d'action isolé : gras, flèche, sans soulignement */
.link-action { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; font-weight: 700; text-decoration: none; }
.link-action .icon { width: 1em; height: 1em; transition: transform .15s ease; }
.link-action:hover { text-decoration: underline; }
.link-action:hover .icon { transform: translateX(2px); }
h1 { font-size: var(--t-title); font-weight: 800; line-height: 1.2; letter-spacing: -.01em; margin: .25rem 0 1rem; text-wrap: balance; }
h2 { font-size: var(--t-body); font-weight: 800; line-height: 1.3; margin: 0 0 .75rem; }
h3 { font-size: var(--t-body); font-weight: 700; margin: 1rem 0 .4rem; }
p { margin: 0 0 .75rem; }
code { font-family: var(--mono); font-size: .92em; overflow-wrap: anywhere; }
.inline > .check { flex: 1 1 16rem; min-width: 0; }
.auth-alt { margin: 1.25rem 0 0; padding-top: 1rem; border-top: 1px solid var(--border); text-align: center; color: var(--muted); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: var(--t-small); }
.hint { color: var(--muted); font-size: var(--t-small); line-height: 1.45; margin: .25rem 0; max-width: 70ch; }
.nowrap { white-space: nowrap; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
[hidden] { display: none !important; }

/* Focus : un anneau jaune signalétique, partout et visible sur tous les fonds */
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; border-radius: var(--radius-sm); box-shadow: 0 0 0 2px var(--bandeau); }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--signal); outline-offset: 1px; border-color: var(--primary); }

/* ---- Bandeau de quai ---- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem;
  min-height: var(--bandeau-h); padding: 0 1rem; background: var(--bandeau); color: var(--bandeau-ink); }
.brand { display: inline-flex; align-items: center; gap: .55rem; min-height: var(--bandeau-h); font-weight: 800; font-size: var(--t-body);
  letter-spacing: -.01em; text-decoration: none; color: var(--bandeau-ink); }
.brand-mark { display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: var(--signal); color: var(--signal-ink); font-weight: 900; font-size: .95rem; line-height: 1; padding-top: .12em; }
.month-status { display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .65rem; border-radius: var(--radius-sm);
  background: var(--bandeau-ink); color: var(--bandeau); font-weight: 700; font-size: var(--t-small); text-decoration: none;
  margin-right: auto; white-space: nowrap; }
.month-status .dot { width: .6rem; height: .6rem; border-radius: 50%; border: 2px solid currentColor; }
.month-status.ok .dot { background: var(--ok-fill); border-color: var(--ok-fill); }
.month-status.warn .dot { background: var(--signal); border-color: var(--warn); }
@media (max-width: 599px) { .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }
.nav-toggle { margin-left: auto; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; background: transparent;
  border: 1px solid var(--bandeau-soft); border-radius: var(--radius-sm); color: var(--bandeau-ink); cursor: pointer; }
.nav-toggle .icon { width: 1.4rem; height: 1.4rem; }
.nav { display: none; flex-basis: 100%; flex-direction: column; padding: .25rem 0 .75rem; }
.nav.open { display: flex; }
.nav a, .nav .link { display: flex; align-items: center; gap: .6rem; min-height: 44px; padding: .5rem .25rem; text-decoration: none;
  color: var(--bandeau-ink); font-weight: 700; font-size: var(--t-body); border-radius: 0; text-align: left; background: none; border: 0;
  justify-content: flex-start; width: 100%; }
.nav a .icon, .nav .link .icon { color: var(--bandeau-soft); }
.nav a[aria-current="page"] { box-shadow: inset 4px 0 0 var(--signal); padding-left: .75rem; }
.nav a[aria-current="page"] .icon { color: var(--signal); }
.nav-secondary { border-top: 1px solid var(--bandeau-2); margin-top: .35rem; padding-top: .35rem; }
.nav-secondary a, .nav-secondary .link { font-weight: 500; color: var(--bandeau-soft); }
.nav-logout { margin: 0; }
/* Bouton œil : montants floutés (repérés par .amt) ; l'œil barré quand ils le sont */
.privacy-toggle { margin-left: auto; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; background: transparent;
  border: 0; border-radius: var(--radius-sm); color: var(--bandeau-soft); cursor: pointer; }
.privacy-toggle:hover { background: var(--bandeau-2); color: var(--bandeau-ink); }
.privacy-toggle .icon { width: 1.3rem; height: 1.3rem; }
.privacy-toggle[aria-pressed="true"] { color: var(--signal); }
.month-status ~ .privacy-toggle, .privacy-toggle ~ .nav-toggle { margin-left: 0; }
.privacy-toggle .when-hidden, .amounts-hidden .privacy-toggle .when-shown { display: none; }
.amounts-hidden .privacy-toggle .when-hidden { display: inline; }
/* Totaux du rapport du mois recalculés pendant la saisie (report.js réécrit le texte, sans .amt) */
.amounts-hidden :is(.amt, [data-total], [data-delta], [data-delta-short], [data-family-total], [data-family-delta], [data-conv]) {
  filter: blur(.42em); user-select: none; }
.amounts-hidden input[inputmode="decimal"] { color: transparent; text-shadow: 0 0 .5em var(--text); }
.account-menu { position: relative; }
.account-menu > summary { list-style: none; }
.account-menu > summary::-webkit-details-marker { display: none; }

@media (min-width: 960px) {
  .topbar { flex-wrap: nowrap; gap: 1.25rem; padding: 0 1.5rem; }
  .month-status { order: 3; margin-right: 0; margin-left: auto; }
  .privacy-toggle { order: 3; }
  .nav-toggle { display: none; }
  .nav { display: flex; flex-basis: auto; flex-direction: row; align-items: stretch; padding: 0; order: 2; gap: .25rem; }
  .nav-main { display: flex; align-items: stretch; gap: .25rem; }
  .nav a { min-height: var(--bandeau-h); padding: 0 .85rem; }
  .nav a:hover { background: var(--bandeau-2); }
  .nav a[aria-current="page"] { box-shadow: inset 0 -4px 0 var(--signal); padding-left: .85rem; }
  .nav-secondary { display: none; }
  .account-menu { order: 4; display: block; }
  .account-menu > summary { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: 0 .6rem; cursor: pointer;
    color: var(--bandeau-ink); font-weight: 600; border-radius: var(--radius-sm); }
  .account-menu > summary:hover, .account-menu[open] > summary { background: var(--bandeau-2); }
  .account-menu .menu { position: absolute; right: 0; top: calc(100% + .35rem); min-width: 15rem; padding: .35rem; z-index: 30;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(11, 20, 43, .22); }
  .account-menu .menu a, .account-menu .menu .link { display: flex; align-items: center; gap: .6rem; width: 100%; min-height: 40px;
    padding: .4rem .65rem; color: var(--text); text-decoration: none; font-weight: 600; border-radius: var(--radius-sm); background: none; border: 0; font-size: var(--t-body);
    justify-content: flex-start; }
  .account-menu .menu a:hover, .account-menu .menu .link:hover { background: var(--surface-2); }
  .account-menu .menu a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--signal); }
  .account-menu .menu .icon { color: var(--muted); }
  .account-menu .menu-who { padding: .4rem .65rem .5rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
  .account-menu .menu-who strong { display: block; }
}
@media (max-width: 959px) { .account-menu { display: none; } }

/* ---- Onglets de rubrique (Mois, Placements, Réglages) ---- */
.subnav { display: flex; gap: .25rem; margin: 0 0 1.25rem; border-bottom: 2px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.subnav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .9rem; text-decoration: none; color: var(--muted);
  font-weight: 700; white-space: nowrap; border-bottom: 4px solid transparent; margin-bottom: -2px; }
.subnav a:hover { color: var(--text); }
.subnav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--primary); }
:root[data-theme="dark"] .subnav a[aria-current="page"] { border-bottom-color: var(--signal); }

/* ---- Mise en page ---- */
.container { max-width: 1160px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.auth .container { padding-top: 8vh; }
.card { background: var(--surface); border: 0; border-radius: var(--radius); padding: 1.1rem 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
@media (min-width: 700px) { .container { padding: 2rem 1.5rem 4rem; } .card { padding: 1.4rem 1.6rem; } }

/* ---- Formulaires ---- */
.stack { display: flex; flex-direction: column; gap: 1rem; }
.inline { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
label { display: flex; flex-direction: column; gap: .35rem; font-weight: 700; }
label.check { flex-direction: row; align-items: center; gap: .6rem; font-weight: 500; min-height: 44px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem 1rem .8rem; margin: 0; display: flex; flex-direction: column; gap: .1rem; }
legend { padding: 0 .35rem; font-weight: 700; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="month"], input[type="search"], select, textarea {
  font: inherit; font-size: 16px; /* 16px évite le zoom automatique sur iOS */
  min-height: 46px; padding: .55rem .75rem; border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); width: 100%; font-weight: 500; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; font-weight: 400; }
input[type="file"] { font: inherit; font-size: var(--t-small); max-width: 100%; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 700; margin-right: .75rem; min-height: 40px; padding: .35rem .9rem;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); cursor: pointer; }
.inline select { width: auto; }
input[type="checkbox"], input[type="radio"] { width: 1.25rem; height: 1.25rem; accent-color: var(--primary); flex: none; }
input[type="search"] { flex: 1 1 16rem; }

button, .button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: inherit; font-weight: 700;
  padding: .55rem 1.1rem; min-height: 46px; border-radius: var(--radius-sm); border: 1.5px solid var(--border-strong); background: var(--surface);
  color: var(--text); cursor: pointer; text-decoration: none; line-height: 1.2; transition: background-color .15s ease, border-color .15s ease; }
button:hover, .button:hover { border-color: var(--text); background: var(--surface-2); }
button.primary, .button.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
button.primary:hover, .button.primary:hover { background: var(--bandeau-2); border-color: var(--bandeau-2); }
:root[data-theme="dark"] button.primary:hover, :root[data-theme="dark"] .button.primary:hover { background: var(--signal-hover); border-color: var(--signal-hover); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) button.primary:hover, :root:not([data-theme="light"]) .button.primary:hover { background: var(--signal-hover); border-color: var(--signal-hover); }
}
button.danger, .button.danger { color: var(--err); border-color: var(--err); background: transparent; }
button.danger:hover, .button.danger:hover { background: var(--err-bg); }
button.small, .button.small { min-height: 38px; padding: .3rem .8rem; font-size: var(--t-small); }
button.small.icon-only, .button.small.icon-only { width: 38px; min-width: 38px; padding: 0; }
.icon-only .icon { margin: 0; }
button.link { background: none; border: none; color: var(--link); padding: 0; min-height: 0; font-weight: 700; text-decoration: none; gap: .3rem; }
button.link:hover { background: none; text-decoration: underline; text-underline-offset: .18em; }
button.link .icon { width: 1em; height: 1em; }
/* Petits liens isolés (« détail », « paramétrer ») : en gras, soulignés au survol */
.line-auto a, .line-meta a, .lead-note a, .situation-rows .link { font-weight: 700; text-decoration: none; }
.line-auto a:hover, .line-meta a:hover { text-decoration: underline; text-underline-offset: .18em; }
button[disabled] { opacity: .45; cursor: default; }

/* ---- Messages et cartouches ---- */
.alert { display: block; padding: .8rem 1rem; border-radius: var(--radius); margin: 0 0 1rem; font-weight: 500; line-height: 1.45; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.err { background: var(--err-bg); color: var(--err); }
.alert.info { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.alert a { color: inherit; font-weight: 700; }
.alert p, .alert ul { margin: .3rem 0; }
.alert ul { padding-left: 1.2rem; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .45rem; border-radius: var(--radius-sm); font-size: var(--t-small);
  font-weight: 700; line-height: 1.5; background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.badge.ok { background: var(--ok-bg); color: var(--ok); box-shadow: none; }
.badge.warn { background: var(--warn-bg); color: var(--warn); box-shadow: none; }
.badge.err { background: var(--err-bg); color: var(--err); box-shadow: none; }
.badges { display: flex; flex-wrap: wrap; gap: .3rem; margin: .3rem 0; }
.copied::after { content: " · copié"; color: var(--ok); font-size: var(--t-small); font-weight: 700; }

/* Pastille de ligne : la couleur de la famille (data-color, posée par app.js) */
.swatch { display: inline-block; width: .95rem; height: .95rem; border-radius: 50%; background: var(--muted); vertical-align: -.1em; flex: none; }

/* ---- Listes et tableaux ---- */
.list { list-style: none; margin: 0 0 1rem; padding: 0; }
.list > li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .6rem 1rem; padding: .9rem 0; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: none; }
.list > li > .num { margin-left: auto; } /* passé à la ligne (mobile) : reste aligné à droite */
.list > li.inactive { opacity: .6; }
.user-info { flex: 1 1 260px; }
.user-info .muted { margin-left: .4rem; }
.user-actions summary { color: var(--link); font-weight: 700; }
.user-actions .stack { margin-top: .5rem; }
details > summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; gap: .5rem; margin: .2rem 0; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; flex: none; width: .5rem; height: .5rem; margin: 0 .2rem 0 .1rem; border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease; }
details[open] > summary::before { transform: rotate(45deg); }
.account-menu > summary::before { content: none; }
details .stack { padding: .5rem 0 .75rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 0 0 1rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--t-body); }
.table th, .table td { padding: .6rem .6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table thead th { color: var(--muted); font-weight: 700; font-size: var(--t-small); border-bottom: 2px solid var(--text); white-space: nowrap; }
.table tbody tr:hover td { background: var(--surface-2); }
.row-warn td { background: var(--warn-bg); }
.num, .table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--ok); }
.neg { color: var(--err); }

/* ---- 2FA ---- */
.steps { padding-left: 1.2rem; }
.steps li { margin-bottom: .8rem; }
.qr { display: block; margin: .6rem 0; background: #ffffff; border-radius: var(--radius); padding: 8px; }
.secret { display: inline-block; padding: .35rem .6rem; background: var(--surface-2); border-radius: var(--radius-sm); word-break: break-all; user-select: all; cursor: pointer; font-family: var(--mono); }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; }
.codes code { display: block; text-align: center; padding: .45rem; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 1rem; }

/* ---- Réglages, comptes, familles ---- */
.family-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; margin-bottom: .4rem; }
.family-head h2, .family-head h3 { margin: 0; font-size: var(--t-body); display: flex; align-items: center; gap: .55rem; }
.actions.compact { gap: .35rem; align-items: center; }
.actions.compact form { margin: 0; }
.notes { white-space: pre-line; margin-top: .2rem; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 600px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.card.wide-form { max-width: 680px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; }
.onboarding-accounts > li { flex-direction: column; align-items: stretch; }
.danger-zone { box-shadow: inset 0 0 0 1.5px var(--err); }
.danger-zone-inline { border-top: 1px solid var(--border); margin-top: 1.4rem; padding-top: 1rem; }
.danger-zone-inline h2 { font-size: var(--t-body); }
.danger-text { color: var(--err); }
.family-add { text-align: right; margin: .5rem 0 0; }
.family-add .link { color: var(--muted); text-decoration: none; font-weight: 700; min-height: 44px; display: inline-flex; align-items: center; }
.family-add .link:hover { color: var(--link); text-decoration: underline; }
button.line-edit { color: var(--muted); text-decoration: none; margin-left: .5rem; font-weight: 600; font-size: var(--t-small); min-height: 32px; }
button.line-edit:hover { color: var(--link); text-decoration: underline; }

/* ---- Assistant de démarrage et liste « Pour bien démarrer » ---- */
.narrow-wide { max-width: 880px; margin: 0 auto; }
.lead { font-size: var(--t-body); color: var(--muted); max-width: 68ch; }
.step-num { display: inline-grid; place-items: center; width: 1.85rem; height: 1.85rem; margin-right: .45rem; border-radius: 50%;
  background: var(--primary); color: var(--primary-text); font-size: .95rem; font-weight: 900; vertical-align: .05em; padding-top: .1em; }
.how-concepts h3, .card h3 { font-size: var(--t-body); margin: 1rem 0 .3rem; }
.how-concepts p { margin: 0; color: var(--muted); }
.situations { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.situation { border: 1.5px solid var(--border); border-radius: var(--radius); padding: .7rem .9rem; background: var(--surface); }
.situation.on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.situation-head { font-weight: 500; }
.situation-help { margin: .1rem 0 0 1.85rem; }
.situation-rows { margin: .7rem 0 0 1.85rem; display: grid; gap: .5rem; }
.situation-rows .link { justify-self: start; min-height: 40px; }
.situation-row { position: relative; padding-top: .5rem; border-top: 1px dashed var(--border); }
.situation-row.with-currency { display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .situation-row.with-currency { grid-template-columns: 2fr 2fr 1fr; } }
.situation-row:first-child { border-top: none; padding-top: 0; }
button.row-remove { position: absolute; top: .3rem; right: 0; z-index: 1; color: var(--muted); text-decoration: none; min-width: 36px; min-height: 36px; justify-content: center; }
button.row-remove:hover { color: var(--err); }
.checklist { margin: .3rem 0 .6rem; padding-left: 1.4rem; display: grid; gap: .4rem; }
.checklist li.done { color: var(--muted); }
.check-mark { color: var(--ok); font-weight: 800; }

/* ---- Chiffres clés et rapport mensuel ---- */
.month-picker select { min-width: 11rem; }
.summary { position: sticky; top: var(--bandeau-h); z-index: 5; }
.summary-mini { display: none; }
.summary-mini.shown { display: flex; gap: .5rem; align-items: baseline; position: fixed; top: var(--bandeau-h); left: 0; right: 0;
  z-index: 15; padding: .5rem max(1rem, calc((100vw - 1160px) / 2 + 1rem)); background: var(--surface); border-bottom: 2px solid var(--text); font-variant-numeric: tabular-nums; }
.summary-mini strong { color: var(--text); font-weight: 800; }
.closed-banner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; }
.closed-banner p { margin: 0; }

/* Rapport : en-tête, état du mois, synthèse */
.report-head h1 { margin: 0; }
.month-picker { display: flex; align-items: center; gap: .4rem; }
.button.icon-only { width: 44px; min-width: 44px; padding: 0; }
.button.icon-only .icon { width: 1.25em; height: 1.25em; }
.report-status { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .75rem 1rem; margin: 0 0 1.25rem; padding: .9rem 1rem;
  background: var(--bandeau); color: var(--bandeau-ink); border-radius: var(--radius); }
.report-status .stop { --stop: 1.35rem; }
.report-status .stop.here { box-shadow: 0 0 0 3px var(--bandeau), 0 0 0 6px var(--signal); }
.report-status-text { min-width: 0; }
.report-status form { grid-column: 1 / -1; }
@media (min-width: 700px) { .report-status { grid-template-columns: auto 1fr auto; } .report-status form { grid-column: auto; } }
.report-status-text p { margin: 0; color: var(--bandeau-soft); }
.report-status-text strong { color: var(--bandeau-ink); }
.report-status-count { margin-top: .25rem !important; color: var(--signal) !important; font-weight: 700; }
.report-status form { margin: 0; }
.lead-summary { display: grid; gap: 1rem 2.5rem; align-items: end; margin: 0 0 1.5rem; padding-bottom: 1rem; border-bottom: 2px solid var(--text); }
@media (min-width: 900px) { .lead-summary { grid-template-columns: auto 1fr; } }
.lead-figure { display: flex; flex-direction: column; gap: .1rem; }
.lead-label { font-size: var(--t-small); font-weight: 700; color: var(--muted); }
.lead-value { font-size: clamp(2rem, 1.6rem + 1.8vw, 2.75rem); font-weight: 800; line-height: 1.05; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.lead-delta { font-variant-numeric: tabular-nums; }
.lead-delta strong { font-weight: 800; }
.hero-facts.lead-facts { margin: 0; padding-top: 0; border-top: 0; }
.lead-facts .fact-delta { font-weight: 600; font-size: var(--t-small); }

/* Familles du rapport : chaque famille porte sa couleur de ligne */
.report-family { position: relative; overflow: hidden; padding-top: 1.35rem; }
.family-rule { position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--muted); }
.report-family .pastille { width: 1.75rem; height: 1.75rem; font-size: .85rem; }
.family-add .link .icon, .family-add-new .icon { width: 1em; height: 1em; margin-right: .25rem; }
.family-add-new { margin: -.25rem 0 1rem; }

/* Clôture : réussite et étape de confirmation */
.report-done { display: flex; gap: 1rem; align-items: flex-start; margin: 0 0 1.25rem; padding: 1.1rem 1.2rem; border-radius: var(--radius);
  background: var(--ok-bg); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--ok-fill); }
.report-done h2 { font-size: var(--t-title); margin: 0 0 .25rem; }
.report-done p { margin: 0 0 .6rem; max-width: 64ch; }
.report-done .actions { margin: .4rem 0 0; }
.report-done-mark { display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--ok-fill); color: #fff; flex: none; }
.report-done-mark .icon { width: 1.4rem; height: 1.4rem; stroke-width: 3; }
.close-step { width: min(32rem, calc(100vw - 2rem)); padding: 1.4rem 1.4rem 1.2rem; border: 0; border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border), 0 18px 48px rgba(8, 15, 33, .35); }
.close-step::backdrop { background: rgba(11, 20, 43, .55); }
.close-step h2 { font-size: var(--t-title); margin: 0 0 .2rem; }
.close-step > p { margin: .5rem 0; }
.close-recap { display: grid; grid-template-columns: 1fr; gap: .75rem 1.25rem; margin: 1rem 0; padding: .9rem 0; border-top: 2px solid var(--text); border-bottom: 1px solid var(--border); }
.close-recap dt { font-size: var(--t-small); font-weight: 700; color: var(--muted); }
@media (min-width: 480px) { .close-recap { grid-template-columns: 1fr 1fr; } }
.close-recap dd { white-space: nowrap; margin: 0; font-size: var(--t-title); font-weight: 800; font-variant-numeric: tabular-nums; }
.close-note { display: flex; gap: .5rem; align-items: flex-start; padding: .6rem .75rem; border-radius: var(--radius-sm); background: var(--surface-2); font-weight: 600; }
.close-note.err { background: var(--err-bg); color: var(--err); }
.close-note .icon { margin-top: .1em; }
.close-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; margin-top: 1.1rem; }
.family-total { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.family-total span { display: block; }
.report-lines { list-style: none; margin: 0; padding: 0; }
.report-line { display: grid; grid-template-columns: 1fr; gap: .45rem; padding: .85rem 0; border-top: 1px solid var(--border); }
@media (min-width: 700px) { .report-line { grid-template-columns: 1fr 1.1fr; align-items: start; } }
.line-label label { display: inline; font-weight: 700; }
.input-affix { display: flex; align-items: stretch; }
.input-affix input { border-top-right-radius: 0; border-bottom-right-radius: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.input-affix .affix { display: flex; align-items: center; justify-content: center; padding: 0 .75rem; min-width: 3.25rem;
  border: 1.5px solid var(--border-strong); border-left: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-2); color: var(--muted); font-weight: 700; }
.input-affix .affix-select { width: auto; border-left: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); }
.report-line.invalid input, .report-line.has-error input { border-color: var(--err); }
.field-error { color: var(--err); font-size: var(--t-small); font-weight: 700; }
.line-meta { margin-top: .2rem; }
.line-auto { text-align: right; font-variant-numeric: tabular-nums; }
.report-actions { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: .6rem; justify-content: flex-end; align-items: center;
  margin: 0 -1rem; padding: .75rem 1rem; background: var(--surface); border-top: 2px solid var(--text); }
.cash-label { margin-top: .4rem; font-weight: 700; }
.report-actions [data-missing-hint] { flex: 1 1 16rem; margin: 0; }

/* ---- Titres, crypto, métaux, prêts ---- */
.table.positions td { vertical-align: top; }
.row-actions { text-align: right; }
.row-actions details summary { color: var(--link); font-size: var(--t-small); justify-content: flex-end; }
.row-actions details[open] { min-width: 12rem; }
.inline-form { display: inline; margin: 0; }
.stack.small-gap { gap: .4rem; }
.results > li { align-items: center; }

/* ---- Tableau de bord et historique ---- */
.variations { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin-top: .9rem; font-variant-numeric: tabular-nums; font-weight: 700; }
.variation .muted { font-size: var(--t-small); font-weight: 500; }
.period-filter { display: inline-flex; flex-wrap: wrap; gap: 0; border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden;
 }
.period-filter a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 .85rem; text-decoration: none; color: var(--text);
  font-weight: 700; font-size: var(--t-small); border-left: 1px solid var(--border); }
.period-filter a:first-child { border-left: 0; }
.period-filter a:hover { background: var(--surface-2); }
.period-filter a[aria-current="page"] { background: var(--primary); color: var(--primary-text); }
.chart-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1rem; }
.chart-grid .card { margin-bottom: 0; }
@media (min-width: 900px) { .chart-grid { grid-template-columns: 1fr 1fr; } .chart-card.wide { grid-column: 1 / -1; } }
.chart-card h3 { margin: 0 0 .5rem; font-size: var(--t-body); font-weight: 800; }
.chart-box { position: relative; height: 280px; }
.chart-card.wide .chart-box { height: 320px; }
.recap { max-height: 75vh; }
.recap-table { font-size: var(--t-small); }
.recap-table th.sticky-col, .recap-table td.sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 11rem; max-width: 16rem; }
.recap-table thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; }
.recap-table thead th.sticky-col { z-index: 3; }
.recap-table th.open a { color: var(--warn); }
.recap-table .family-row th, .recap-table .family-row td { background: var(--surface-2); font-weight: 700; }
.recap-table .account-cell { padding-left: 1.2rem; }
.recap-table .total-row th, .recap-table .total-row td { border-top: 2px solid var(--text); }
.recap-table .net-row td, .recap-table .net-row th { font-weight: 800; }
td.carried { font-style: italic; color: var(--muted); }
.legend-closed { color: var(--text); font-weight: 800; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ==== Accueil : le chiffre dans une phrase, la ligne des mois, les familles comme des lignes ==== */
.hero { display: grid; grid-template-columns: 1fr; gap: 1rem 2rem; margin: .5rem 0 1.75rem; }
@media (min-width: 900px) { .hero { grid-template-columns: 1fr auto; align-items: end; } }
.hero-title { margin: 0; display: flex; flex-direction: column; gap: .15rem; }
.hero-lead { font-size: var(--t-body); font-weight: 700; color: var(--muted); letter-spacing: 0; }
.hero-figure { font-size: var(--t-hero); font-weight: 800; line-height: 1; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.hero-sentence { font-size: var(--t-body); max-width: 62ch; margin: .9rem 0 0; line-height: 1.55; }
.hero-sentence p { margin: 0; }
.hero-sentence p + p { margin-top: .5rem; }
.hero-sentence strong { font-weight: 800; white-space: nowrap; }
.hero-sentence-tag { display: block; margin-bottom: .05rem; margin-right: .35rem; font-size: var(--t-small); font-weight: 700; color: var(--muted); }
/* Le libellé à gauche, la phrase dans sa colonne : à la ligne, elle ne repasse pas sous le libellé */
@media (min-width: 600px) { .hero-sentence:has(> .hero-sentence-text) { display: flex; align-items: baseline; } .hero-sentence-tag { display: inline-block; min-width: 9.5rem; flex: 0 0 auto; margin-bottom: 0; } .hero-sentence p + p { margin-top: .3rem; } }
.hero-facts { display: flex; flex-wrap: wrap; gap: .75rem 2rem; margin: 1.1rem 0 0; padding-top: .9rem; border-top: 2px solid var(--text); }
.hero-facts div { display: flex; flex-direction: column; }
.hero-facts dt { font-size: var(--t-small); font-weight: 700; color: var(--muted); }
.hero-facts dd { margin: 0; font-weight: 800; font-size: var(--t-body); font-variant-numeric: tabular-nums; }
.hero-side { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; max-width: 22rem; }
@media (min-width: 900px) { .hero-side { align-items: flex-end; text-align: right; } }
.hero-side form { margin: 0; }
.hero-side p { margin: 0; }

/* Ligne des mois : un panneau de quai, chaque mois une station */
.month-line { background: var(--bandeau); color: var(--bandeau-ink); border-radius: var(--radius); padding: 1.1rem 1rem 1rem; margin: 0 0 2rem; }
@media (min-width: 700px) { .month-line { padding: 1.25rem 1.6rem 1.1rem; } }
.month-line-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.25rem; }
.month-line-head h2 { margin: 0; color: var(--bandeau-ink); font-size: var(--t-body); }
.month-line-next { margin: 0; flex: 1 1 18rem; color: var(--bandeau-soft); font-weight: 500; }
.here-tag { display: inline-block; margin-right: .45rem; padding: .05rem .45rem; border-radius: var(--radius-sm); background: var(--signal);
  color: var(--signal-ink); font-weight: 800; font-size: var(--t-small); }
.button.signal { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.button.signal:hover { background: var(--signal-hover); border-color: var(--signal-hover); color: var(--signal-ink); }
.button.ghost-light { background: transparent; border-color: var(--bandeau-soft); color: var(--bandeau-ink); }
.button.ghost-light:hover { background: var(--bandeau-2); color: var(--bandeau-ink); }
.stations-wrap { overflow-x: auto; margin: .9rem -1rem 0; padding: 0 1rem; scrollbar-width: thin; scrollbar-color: var(--bandeau-soft) transparent; }
.stations { --stop: 1.15rem; list-style: none; margin: 0; padding: .4rem 0 .2rem; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(max-content, 1fr); min-width: max-content; }
@media (min-width: 900px) { .stations { min-width: 0; } }
.station { position: relative; }
.station::before { content: ""; position: absolute; top: calc(.4rem + var(--stop) / 2 - 2px); left: 0; right: 0; height: 4px; background: var(--bandeau-ink); }
.station:first-child::before { left: 50%; }
.station:last-child::before { right: 50%; }
.station.ahead::before { background: repeating-linear-gradient(90deg, var(--bandeau-soft) 0 6px, transparent 6px 11px); }
.station a { position: relative; display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 0 .45rem .2rem; color: var(--bandeau-ink);
  text-decoration: none; border-radius: var(--radius-sm); min-height: 44px; }
.station a:hover .station-name { text-decoration: underline; text-underline-offset: .2em; }
.stop { display: inline-block; width: var(--stop, 1.15rem); height: var(--stop, 1.15rem); border-radius: 50%; border: 3px solid var(--bandeau-ink);
  background: var(--bandeau); flex: none; position: relative; z-index: 1; }
.station.closed .stop, .stop.closed { background: var(--bandeau-ink); }
.station.missing .stop, .stop.missing { border-style: dashed; border-color: var(--signal); }
.station.ahead .stop, .stop.ahead { border-color: var(--bandeau-soft); }
.station.here .stop, .stop.here { background: var(--signal); border-color: var(--signal); box-shadow: 0 0 0 4px var(--bandeau), 0 0 0 7px var(--signal); }
.station-name { font-weight: 800; font-size: var(--t-small); white-space: nowrap; }
.station.here .station-name { color: var(--signal); }
.station-value { font-size: var(--t-small); color: var(--bandeau-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.month-line-alert { display: flex; gap: .55rem; align-items: flex-start; margin: .9rem 0 0; padding: .6rem .8rem; border-radius: var(--radius-sm);
  background: var(--signal); color: var(--signal-ink); font-weight: 600; }
.month-line-alert a { color: inherit; font-weight: 800; }
.month-line-legend { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; margin: .8rem 0 0; color: var(--bandeau-soft); }
.month-line-legend > span { display: inline-flex; align-items: center; gap: .45rem; }
.month-line-legend .stop { --stop: .85rem; border-width: 2px; }
.month-line-legend .stop.here { box-shadow: none; }

.section-head { margin-top: .5rem; }
.section-head h2 { margin: 0; }

/* Familles : barre de répartition et lignes à pastille */
.line-bar { display: flex; height: .9rem; border-radius: 999px; overflow: hidden; margin: .4rem 0 .9rem; background: var(--surface-2); }
.line-bar span { display: block; height: 100%; min-width: 3px; }
.line-bar span + span { box-shadow: inset 2px 0 0 var(--surface); }
.family-lines { list-style: none; margin: 0; padding: 0; }
.family-lines li { display: grid; grid-template-columns: 1fr auto 4.5rem; align-items: center; gap: .75rem; padding: .55rem 0; border-top: 1px solid var(--border); }
.family-lines li.passif { border-top: 2px solid var(--text); }
.family-line-link { display: inline-flex; align-items: center; gap: .7rem; min-height: 44px; color: var(--text); text-decoration: none; font-weight: 700; }
.family-line-link:hover .family-name { text-decoration: underline; text-underline-offset: .2em; }
.pastille { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--muted); color: #fff;
  font-weight: 900; font-size: .95rem; line-height: 1; padding-top: .1em; flex: none; }
.family-value { font-weight: 800; font-size: var(--t-body); }
.family-share { text-align: right; }

/* ---- Placements : comptes en lignes, fiches ---- */
.account-head h1 { display: flex; align-items: center; gap: .7rem; }
.account-head h1 .pastille { width: 2.25rem; height: 2.25rem; font-size: 1.05rem; }
.heading-meta { display: block; font-weight: 600; letter-spacing: 0; margin-top: .1rem; }
.family-head h2 .heading-meta { font-size: var(--t-small); }
.account-lines { list-style: none; margin: 0 0 1.5rem; padding: 0; border-top: 2px solid var(--text); }
.account-lines > li { border-bottom: 1px solid var(--border); }
.account-line { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: .4rem 1rem; padding: .9rem .5rem;
  color: var(--text); text-decoration: none; border-radius: var(--radius-sm); }
.account-line:hover { background: var(--surface); }
.account-line:hover .account-line-name { text-decoration: underline; text-underline-offset: .2em; }
.account-line-main { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; min-width: 0; }
.account-line-name { font-size: var(--t-body); font-weight: 800; }
.account-line-value { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.account-line-value strong { font-size: var(--t-body); font-weight: 800; }
.account-line-go { color: var(--muted); }
.account-line:hover .account-line-go { color: var(--text); }
.account-lines.nested { margin: .25rem 0 .5rem; border-top: 0; }
.account-lines.nested .account-line { grid-template-columns: 1fr auto auto; padding-left: 0; padding-right: 0; }
.account-lines.nested .account-line:hover { background: var(--surface-2); }
@media (max-width: 599px) {
  .account-line { grid-template-columns: auto 1fr auto; }
  .account-line-value { grid-column: 2 / 3; align-items: flex-start; text-align: left; }
  .account-line-go { grid-row: 1; grid-column: 3; }
  .account-lines.nested .account-line { grid-template-columns: 1fr auto; }
  .account-lines.nested .account-line-value { grid-column: 1; }
  .account-lines.nested .account-line-go { grid-column: 2; }
}
.loan-account { position: relative; overflow: hidden; padding-top: 1.35rem; }
.loan-account-actions { margin: .5rem 0 0; }
.lead-note { grid-column: 1 / -1; margin: 0; }
.note-line { display: flex; gap: .35rem; align-items: flex-start; margin-top: .2rem; }
.note-line .icon { margin-top: .15em; color: var(--muted); }
.empty-state p:last-child { margin-bottom: 0; }
.row-actions details summary { display: inline-flex; min-height: 38px; padding: 0 .7rem; border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm); color: var(--text); font-size: var(--t-small); background: var(--surface); }
.row-actions details summary:hover { border-color: var(--text); }
.row-actions { white-space: nowrap; }
.row-actions .inline-form { margin-left: .3rem; }
.lead-summary + .account-lines { border-top: 0; }

/* Tableaux « cards » : sous 700 px, chaque ligne devient une fiche, chaque valeur porte son libellé */
@media (max-width: 699px) {
  .table.cards thead { display: none; }
  .table.cards, .table.cards tbody { display: block; }
  .table.cards tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem .9rem; padding: .85rem 0; border-bottom: 1px solid var(--border); }
  .table.cards tbody tr:hover td { background: none; }
  .table.cards td { display: block; padding: 0; border: 0; text-align: left; white-space: normal; }
  .table.cards td[data-label]::before { content: attr(data-label); display: block; font-size: var(--t-small); font-weight: 700; color: var(--muted); }
  .table.cards td.cell-main { grid-column: 1 / -1; font-weight: 700; }
  .table.cards td.cell-date { font-weight: 800; }
  .table.cards td.cell-type { color: var(--muted); font-weight: 700; }
  .table.cards td.row-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
  .table.cards td.row-actions .inline-form { margin: 0; }
  .table.cards td:empty { display: none; }
  .table.cards td.cell-date { grid-row: 1; grid-column: 1; }
  .table.cards td.cell-type { grid-row: 1; grid-column: 2; }
  .table.cards td.cell-date ~ td.row-actions { grid-row: 1; grid-column: 3; justify-content: flex-end; }
  .account-head .actions .primary { order: -1; }
}

/* ---- Historique : le tableau des mois, avec les stations du plan de ligne ---- */
.history-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1.1rem; max-width: none; margin: 0 0 .6rem; }
.history-legend > span { display: inline; }
.table .stop, .history-legend .stop { --stop: .75rem; border-width: 2px; border-color: var(--text); background: var(--surface); vertical-align: -.08em; margin-right: .35rem; }
.table .stop.closed, .history-legend .stop.closed { background: var(--text); }
.table .stop.missing, .history-legend .stop.missing { border-style: dashed; border-color: var(--warn); }
.table .stop.ahead { border-color: var(--muted); }
.recap-table .month-head a { display: inline-flex; align-items: center; color: var(--text); text-decoration: none; }
.recap-table .month-head a:hover { text-decoration: underline; }
.recap-table th.open a { color: var(--text); }
.recap-table .family-row th a { display: inline-flex; align-items: center; gap: .45rem; color: var(--text); text-decoration: none; }
.recap-table .family-row th a:hover { text-decoration: underline; }
.recap-table .pastille { width: 1.45rem; height: 1.45rem; font-size: .72rem; }
.recap-table .net-row th, .recap-table .net-row td { background: var(--bandeau); color: var(--bandeau-ink); border-top: 0; font-size: var(--t-body); }
.recap-table .variation-row th { font-weight: 600; color: var(--muted); }

/* ---- Rapports PDF, réglages ---- */
.pdf-line { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .5rem 1rem; padding: .85rem .25rem; }
.pdf-line > .stop { --stop: .9rem; border-width: 2px; border-color: var(--text); background: var(--text); }
.pdf-actions { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: flex-end; gap: .5rem; }
.pdf-regen > summary { min-height: 38px; font-size: var(--t-small); margin: 0; }
.pdf-regen[open] { flex-basis: 100%; }
@media (max-width: 599px) {
  .pdf-line { grid-template-columns: auto 1fr; }
  .pdf-actions { grid-column: 2; justify-content: flex-start; }
}
.choice-cards { display: flex; flex-wrap: wrap; gap: .5rem; }
.choice-cards .check { margin: 0; padding: .55rem .9rem; border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.choice-cards .check:has(input:checked) { border-color: var(--primary); background: var(--primary); color: var(--primary-text); font-weight: 700; }
.settings-accounts > li { padding-left: .1rem; }

/* Accueil : variation du net sur cinq périodes */
.variation-band { margin: 1.1rem 0 0; padding-top: .8rem; border-top: 2px solid var(--text); }
.variation-title { font-size: var(--t-small); font-weight: 700; margin: 0 0 .55rem; color: var(--text); }
.variation-title .muted { font-weight: 600; margin-left: .35rem; }
.variation-cells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem 1rem; margin: 0; }
@media (min-width: 700px) { .variation-cells { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.variation-cell { display: flex; flex-direction: column; min-width: 0; padding-left: .6rem; border-left: 1px solid var(--border); }
.variation-cell dt { font-size: var(--t-small); font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.variation-cell dd { margin: 0; font-variant-numeric: tabular-nums; }
.variation-pct { font-size: var(--t-title); font-weight: 800; line-height: 1.2; letter-spacing: -.01em; }
.variation-eur { font-size: var(--t-small); font-weight: 700; }
.variation-since { font-size: var(--t-small); color: var(--muted); }
.hero-sentence { margin-top: 1rem; }

/* ---- Pages publiques : un bandeau de quai en tête de carte ---- */
.auth .card.narrow { padding-top: 0; overflow: hidden; }
.auth-band { display: flex; align-items: center; gap: .6rem; margin: 0 -1rem 1.25rem; padding: .85rem 1rem; background: var(--bandeau); color: var(--bandeau-ink); }
@media (min-width: 700px) { .auth-band { margin: 0 -1.6rem 1.4rem; padding: .95rem 1.6rem; } }
.auth-band-name { font-weight: 800; font-size: var(--t-body); }
.auth-line { display: inline-flex; align-items: center; margin-left: auto; }
.auth-line .stop { --stop: .8rem; border-width: 2px; }
.auth-line .stop + .stop { margin-left: 1.1rem; position: relative; }
.auth-line .stop + .stop::before { content: ""; position: absolute; right: 100%; top: 50%; width: 1.1rem; height: 3px; margin-top: -1.5px; background: var(--bandeau-ink); }
.auth-line .stop.here { box-shadow: 0 0 0 3px var(--bandeau), 0 0 0 5px var(--signal); }
.auth .card.narrow h1 { margin-top: 0; }
.auth-links { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: .75rem 0 0; }
.auth-alt .link-action { min-height: 0; }

/* « Pour bien démarrer » / « Les prochaines étapes » : une ligne de stations verticale */
.checklist { list-style: none; padding-left: 0; margin: .5rem 0 .75rem; gap: 0; }
.checklist li { position: relative; padding: .4rem 0 .4rem 2rem; min-height: 2.2rem; }
.checklist li::before { content: ""; position: absolute; left: .3rem; top: .7rem; width: .9rem; height: .9rem; border-radius: 50%;
  border: 2px solid var(--text); background: var(--surface); z-index: 1; box-sizing: border-box; }
.checklist li::after { content: ""; position: absolute; left: calc(.3rem + .45rem - 1.5px); top: 1.4rem; bottom: -.75rem; width: 3px; background: var(--text); }
.checklist li:last-child::after { display: none; }
.checklist li.done::before { background: var(--text); }
.checklist li.done + li:not(.done)::before, .checklist li:first-child:not(.done)::before { background: var(--signal); border-color: var(--signal); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--signal); }
.checklist .check-mark { display: none; }
.checklist li a { font-weight: 700; text-decoration: none; }
.checklist li a:hover { text-decoration: underline; }

/* ---- Polish : accessibilité et mobile ---- */
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; padding: .6rem 1rem; border-radius: var(--radius-sm);
  background: var(--signal); color: var(--signal-ink); font-weight: 800; text-decoration: none; }
.skip-link:focus { top: .5rem; }
main:focus { outline: none; }
.confirm-dialog { width: min(28rem, calc(100vw - 2rem)); padding: 1.3rem 1.4rem 1.1rem; border: 0; border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border), 0 18px 48px rgba(8, 15, 33, .35); }
.confirm-dialog::backdrop { background: rgba(11, 20, 43, .55); }
.confirm-dialog h2 { font-size: var(--t-title); margin: 0 0 .4rem; }
.confirm-dialog p { margin: 0; }
.confirm-dialog .danger { background: var(--err); border-color: var(--err); color: #fff; }
.confirm-dialog .danger:hover { background: var(--err); filter: brightness(1.08); }
.table td a:not(.button), .table th a:not(.button) { display: inline-block; padding-block: .2rem; }
.table-wrap[role="region"]:focus-visible, .stations-wrap[role="region"]:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
@media (max-width: 599px) {
  .account-head .actions .button:not(.primary), .account-head .actions button:not(.primary) { min-height: 40px; padding: .35rem .75rem; font-size: var(--t-small); }
  .account-head .actions .primary { flex-basis: 100%; }
}
.heading-meta a { display: inline-block; padding-block: .25rem; color: inherit; font-weight: inherit; text-decoration: none; }
.heading-meta a:hover { color: var(--link); text-decoration: underline; text-underline-offset: .18em; }

.table .stop.here, .history-legend .stop.here { background: var(--signal); border-color: var(--signal); }
.history-legend .stop.ahead { border-color: var(--muted); }

/* ---- Revue finale ---- */
/* Ligne des mois : arrêt net sur une station, bord gauche en fondu (pas de montant coupé lisible) */
.stations-wrap { scroll-snap-type: x proximity; }
.station { scroll-snap-align: end; }
.stations-wrap[role="region"] { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 1.25rem); mask-image: linear-gradient(to right, transparent 0, #000 1.25rem); }
/* Station du mois en cours quand le mois du rapport est clôturé : c'est la prochaine étape */
.station.next .stop { border-color: var(--signal); border-style: solid; }
.station.next .station-name { color: var(--signal); }
/* Historique : la ligne du net reste visible en bas du tableau, colonne figée séparée par un filet */
.recap-table .net-row th, .recap-table .net-row td { position: sticky; bottom: 0; z-index: 2; }
.recap-table .net-row th.sticky-col { z-index: 4; }
.recap-table th.sticky-col, .recap-table td.sticky-col { box-shadow: inset -2px 0 0 var(--text); }
/* Légende et tableaux : la station « à remplir » sans le double anneau de l'accueil */
.history-legend .stop.here, .table .stop.here { box-shadow: none; background: var(--signal); border-color: var(--signal); }
/* Champs figés (mois clôturé) : visiblement non modifiables */
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); border-color: var(--border); border-style: dashed; color: var(--text); cursor: default; opacity: 1; }
.input-affix input:disabled + .affix { border-color: var(--border); border-style: dashed; border-left: none; }
.chart-empty { margin: 0; padding: 2rem 0; text-align: center; font-size: var(--t-small); }

/* Historique : colonnes aimantées juste après la colonne figée, et fondu sur son bord droit (pas de montant coupé lisible) */
.recap { scroll-snap-type: x proximity; scroll-padding-left: 11rem; }
.recap-table thead th.month-head { scroll-snap-align: start; }
.recap-table .under, .recap-table .under * { color: transparent !important; }  /* masqué à l'œil, lu par les lecteurs d'écran */
.recap-table .under .stop, .recap-table .under .badge { opacity: 0; }
.station.under .station-name, .station.under .station-value { visibility: hidden; }
/* Assistant : tableau « comment ça marche » en fiches, deux colonnes de texte sous 700 px */
@media (max-width: 699px) { .how-table.cards tr { grid-template-columns: 1fr 1fr; } }

/* ---- Objets de valeur ---- */
.valuable-lines > li { padding-bottom: .35rem; }
.revalue { margin: 0 0 .4rem; }
.revalue > summary { display: inline-flex; min-height: 38px; padding: 0 .7rem; margin: 0; border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: var(--t-small); background: var(--surface); }
.revalue > summary::before { content: none; }
.revalue > summary .icon { width: 1em; height: 1em; }
.revalue[open] > summary { border-color: var(--text); }
.revalue-form { display: grid; grid-template-columns: 1fr; gap: .6rem .9rem; align-items: end; margin-top: .6rem; padding: .8rem;
  border-radius: var(--radius-sm); background: var(--surface-2); }
@media (min-width: 760px) { .revalue-form { grid-template-columns: 1fr 1fr 1.3fr 1.5fr auto; } }
.revalue-form label { margin: 0; }
.cat-fields:not(:has(label:not([hidden]))) { display: none; }
/* Libellé et mention « (facultatif) » d'un seul tenant ; dans une rangée, les champs s'alignent sur le bas */
.label-text { display: block; }
.label-text .small { font-weight: 600; }
[data-valuable-form] .grid-2, .revalue-form { align-items: end; }

/* Période et échelle (mois / année) côte à côte, retour sur ce bloc après rechargement */
.period-controls { display: flex; flex-wrap: wrap; gap: .5rem .75rem; justify-content: flex-end; scroll-margin-top: calc(var(--bandeau-h) + 4.5rem); }
.year-notes { margin: -.25rem 0 .75rem; }

/* ---- Bilan par année (historique) ---- */
.year-summaries { margin: 0 0 1.5rem; }
.year-summaries h2 { margin-bottom: .6rem; }
.year-cards { list-style: none; margin: 0; padding: 0 0 .25rem; display: grid; grid-auto-flow: column; grid-auto-columns: min(21rem, 100%);
  gap: .9rem; overflow-x: auto; scroll-snap-type: x proximity; }
.year-card { position: relative; overflow: hidden; scroll-snap-align: start; display: flex; flex-direction: column; gap: .15rem;
  padding: 1rem 1.1rem .8rem; border-radius: var(--radius); background: var(--surface); }
.year-card-head { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.year-card-year { font-size: var(--t-title); font-weight: 800; }
.year-card-diff { font-size: var(--t-title); font-weight: 800; font-variant-numeric: tabular-nums; margin-top: .2rem; }
.year-card-range { margin: .35rem 0 .2rem; }
.year-card-facts { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .8rem; margin: .3rem 0 .4rem; padding-top: .5rem; border-top: 1px solid var(--border); }
.year-card-facts dt { font-size: var(--t-small); font-weight: 700; color: var(--muted); }
.year-card-facts dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; }
.year-card-best { margin: .1rem 0 .2rem; }
.year-card .link-action { margin-top: auto; }

/* Objectif et projection (accueil) */
.goal-card { scroll-margin-top: calc(var(--bandeau-h) + 1rem); }
.goal-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .3rem 1rem; }
.goal-head h2 { margin: 0; }
.goal-progress { height: .75rem; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin: .8rem 0 .35rem; }
.goal-progress span { display: block; height: 100%; min-width: 3px; border-radius: inherit; background: var(--primary); }
.goal-now { margin: 0 0 .7rem; font-size: var(--t-small); color: var(--muted); }
.goal-now strong { font-size: var(--t-body); color: var(--text); font-variant-numeric: tabular-nums; }
.goal-verdict { margin: .25rem 0; max-width: 70ch; line-height: 1.55; }
.goal-verdict strong { white-space: nowrap; }
.goal-scenarios { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .6rem 1.2rem; margin: 1rem 0 .4rem;
  padding-top: .8rem; border-top: 1px solid var(--border); }
.goal-scenarios dt { font-size: var(--t-small); font-weight: 700; color: var(--muted); }
.goal-scenarios .central dt { color: var(--text); }
.goal-scenarios dd { margin: 0; }
.goal-scenario-value { font-weight: 800; font-variant-numeric: tabular-nums; }
.goal-chart { height: 300px; margin: .6rem 0 .5rem; }
.goal-empty { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1.2rem; }
.goal-empty h2 { margin: 0 0 .2rem; }
.goal-empty p { margin: 0; }
.goal-delete { margin-top: 1rem; }

/* Pages légales et pied de page */
.card.legal { max-width: 46rem; margin-left: auto; margin-right: auto; padding: 1.4rem 1.5rem 1.6rem; }
.legal h1 { margin: .9rem 0 .1rem; }
.legal h2 { font-size: var(--t-body); font-weight: 800; margin: 1.6rem 0 .4rem; }
.legal p, .legal li { line-height: 1.6; max-width: 70ch; }
.legal ul { padding-left: 1.2rem; margin: .3rem 0; }
.legal li + li { margin-top: .35rem; }
.legal-lead { margin-top: 1rem; font-weight: 600; }
.legal-nav { margin-bottom: 0; }
.legal-back { margin-top: 1.8rem; }

/* Documentation de l'API (guide, référence) et clés */
.api-doc h3 { font-size: var(--t-body); font-weight: 700; margin: 1.1rem 0 .35rem; }
.api-doc ol { padding-left: 1.4rem; }
.api-doc ol li { line-height: 1.6; max-width: 70ch; }
.api-doc ol li + li { margin-top: .35rem; }
.api-doc pre { margin: .5rem 0 1rem; padding: .75rem .9rem; background: var(--surface-2); border-radius: var(--radius-sm);
  overflow-x: auto; font-size: var(--t-small); line-height: 1.5; }
.api-doc pre code { overflow-wrap: normal; white-space: pre; font-size: 1em; }
.api-method { display: inline-block; padding: .05rem .4rem; border-radius: var(--radius-sm); background: var(--primary);
  color: var(--primary-text); font-size: var(--t-small); font-weight: 800; vertical-align: .1em; }
.api-toc ul { list-style: none; padding: 0; margin: .5rem 0 0; border-top: 2px solid var(--text); }
.api-toc li { padding: .55rem 0; border-bottom: 1px solid var(--border); max-width: none; }
.api-endpoint { margin-top: 2rem; padding-top: 1.2rem; border-top: 2px solid var(--text); scroll-margin-top: 4.5rem; }
.api-endpoint h2 { margin-top: 0; overflow-wrap: anywhere; }
.api-fields td { vertical-align: top; }
@media (min-width: 700px) { .api-fields td:first-child code { white-space: nowrap; } }
.api-secret { font-size: 1rem; }
.api-example { display: block; padding: .6rem .75rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.public .container { padding-top: 4vh; }
.site-footer { padding: 1.5rem 1rem 2rem; text-align: center; font-size: var(--t-small); }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.4rem; }
.site-footer a { color: var(--muted); font-weight: 600; }
.site-footer a:hover { color: var(--text); }

/* Application installée (PWA) */
.install-steps { padding-left: 1.2rem; margin: .3rem 0 0; }
.install-steps li + li { margin-top: .3rem; }
.standalone-show { display: none; }
.standalone .standalone-hide { display: none; }
.standalone .standalone-show { display: block; }
p:has(> [data-install][hidden]) { display: none; }

/* Compte de démonstration : bandeau sous la barre, entrée sur la page de connexion */
.demo-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem 1rem;
  padding: .55rem 1rem; background: var(--bandeau-2); color: var(--bandeau-ink); font-size: var(--t-small); }
.demo-banner p { margin: 0; }
.demo-banner strong { color: var(--signal); }
.demo-banner form { margin: 0; }
.demo-banner .button { min-height: 0; padding: .3rem .8rem; font-size: var(--t-small); }
.demo-entry { margin: 1rem 0 0; padding-top: 1rem; border-top: 1px solid var(--border); text-align: center; }
.demo-entry p { margin: 0 0 .6rem; }
.demo-entry button { width: 100%; }

/* Plaques d'actifs (logos, initiales, métaux, objets) : carrées, à la taille des pastilles de famille */
.asset-mark { display: inline-grid; place-items: center; flex: none; width: 2rem; height: 2rem; border-radius: var(--radius-sm);
  overflow: hidden; vertical-align: middle; }
.asset-mark.sm { width: 1.5rem; height: 1.5rem; }
.asset-mark.logo { background: #fff; box-shadow: inset 0 0 0 1px var(--border); }  /* logos dessinés pour un fond blanc */
.asset-mark.logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.asset-mark.initials { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border);
  font-weight: 800; font-size: .66rem; letter-spacing: .02em; line-height: 1; padding-top: .1em; }
.asset-mark.sm.initials { font-size: .56rem; }
.asset-mark.object { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.asset-mark.object .icon { width: 60%; height: 60%; }
.asset-mark.metal .icon { width: 78%; height: 78%; }
.asset-mark.metal { color: var(--metal, #b38b12); background: color-mix(in srgb, var(--metal, #b38b12) 22%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--metal, #b38b12) 35%, transparent); }
.metal-or { --metal: var(--metal-or, #b38b12); }
.metal-argent { --metal: var(--metal-argent, #7d8794); }
.metal-platine { --metal: var(--metal-platine, #3f6396); }
.metal-palladium { --metal: var(--metal-palladium, #9a7650); }
/* Ligne avec plaque : la plaque à gauche, le texte à côté */
.with-mark { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.with-mark > :last-child { min-width: 0; }
/* Lignes d'objets de valeur avec plaque : même grille que les lignes de compte (plaque, texte, valeur, flèche) */
.account-lines.nested .account-line:has(> .asset-mark) { grid-template-columns: auto 1fr auto auto; }
@media (max-width: 599px) {
  .account-lines.nested .account-line:has(> .asset-mark) { grid-template-columns: auto 1fr auto; }
  .account-lines.nested .account-line:has(> .asset-mark) .account-line-value { grid-column: 2; }
  .account-lines.nested .account-line:has(> .asset-mark) .account-line-go { grid-row: 1; grid-column: 3; }
}

/* Calendrier (historique) : mois × années, intensité selon le montant */
.calendar-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; }
.calendar-head h2 { margin: 0; }
.calendar { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: var(--t-small); font-weight: 600; font-variant-numeric: tabular-nums;
  margin: .4rem 0 .2rem; --cal-step: var(--cal-step-dark, 11%); }
.calendar th, .calendar td { padding: .5rem .55rem; white-space: nowrap; }
.calendar thead th { color: var(--muted); font-weight: 700; text-align: right; padding-bottom: .3rem; }
.calendar th.sticky-col { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; color: var(--muted);
  font-weight: 700; min-width: 3.6rem; }
.calendar td { min-width: 4.4rem; text-align: right; border-radius: var(--radius-sm); }
.calendar td.cal-empty { color: var(--muted); background: transparent; }
.calendar td.cal-zero { background: var(--surface-2); color: var(--muted); }
.calendar td.cal-pos { background: color-mix(in srgb, var(--ok-fill) calc(var(--lvl, 1) * var(--cal-step)), var(--surface)); }
.calendar td.cal-neg { background: color-mix(in srgb, var(--err) calc(var(--lvl, 1) * var(--cal-step)), var(--surface)); }
.calendar .lvl-1 { --lvl: 1; } .calendar .lvl-2 { --lvl: 2; } .calendar .lvl-3 { --lvl: 3; }
.calendar .lvl-4 { --lvl: 4; } .calendar .lvl-5 { --lvl: 5; }
.calendar td.open { font-style: italic; opacity: .75; }
.calendar td.here { box-shadow: inset 0 0 0 2px var(--signal); font-weight: 800; }
.calendar tfoot th, .calendar tfoot td { font-weight: 700; }
.calendar tfoot tr.cal-total th, .calendar tfoot tr.cal-total td { border-top: 2px solid var(--text); font-weight: 800; padding-top: .6rem; }
.calendar tfoot td.pos { color: var(--ok); } .calendar tfoot td.neg { color: var(--err); }
.calendar-legend { margin-top: .5rem; }
.cal-key { display: inline-block; width: .9rem; height: .9rem; margin-right: .25rem; vertical-align: -.15em; border-radius: 3px;
  box-shadow: inset 0 0 0 2px var(--signal); }
/* Peu d'années : colonnes de largeur normale, alignées à gauche (pas de bandes étirées) */
.calendar.few { width: auto; }
.calendar.few td { min-width: 6.5rem; }
/* Sélecteur du calendrier : libellés courts sur téléphone, pour tenir sur une ligne */
.label-short { display: none; }
@media (max-width: 599px) {
  .calendar-head .label-long { display: none; }
  .calendar-head .label-short { display: inline; }
}

/* ==== Page de présentation (« / » pour les visiteurs) : un quai bleu nuit, quel que soit le thème ==== */
body.landing { --l-bg: #0f1830; --l-panel: #16264d; --l-board: #0b142b; --l-ink: #ffffff; --l-soft: #c3cce2;
  --l-mute: #a9b5d3; --l-line: rgba(195, 204, 226, .22); --l-signal: #ffcd00; --l-ok: #4bd3a4; --l-err: #ff7d8f;
  background: var(--l-bg); color: var(--l-ink); color-scheme: dark; }
body.landing ::selection { background: var(--l-signal); color: var(--l-panel); }
.landing .container { max-width: none; padding: 0; }
.landing a { color: var(--l-ink); }
.landing h1, .landing h2, .landing h3 { color: var(--l-ink); }
.landing-top, .landing-hero, .landing-stops, .landing-more, .landing-film, .landing-info { max-width: 1120px; margin: 0 auto; padding-left: 1.25rem; padding-right: 1.25rem; }
.landing-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1.1rem; padding-bottom: 1.1rem; }
.landing-top .brand { color: var(--l-ink); text-decoration: none; }
.landing-login { min-height: 0; padding: .55rem 1.1rem; font-size: var(--t-body); }

/* Premier écran */
.landing-hero { padding-top: clamp(1.5rem, 1rem + 3vw, 4rem); padding-bottom: clamp(3rem, 2rem + 4vw, 6rem); }
.landing-hero h1 { font-size: clamp(2.6rem, 1.4rem + 5vw, 5.4rem); font-weight: 900; line-height: .98; letter-spacing: -.035em;
  margin: 0 0 1.1rem; text-wrap: balance; }
.landing-title-accent { color: var(--l-signal); }
.landing-lead { font-size: clamp(1rem, .95rem + .35vw, 1.2rem); line-height: 1.55; color: var(--l-soft); max-width: 46ch; margin: 0; }
.landing-actions-hero { margin: 1.6rem 0 2.4rem; }

/* Le tableau des départs : palettes qui basculent une fois, à l'arrivée */
.departures { background: var(--l-board); border-radius: 10px; padding: 1rem 1rem .75rem;
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(255, 255, 255, .06); }
.departures-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .4rem 1rem;
  padding: 0 .35rem .8rem; font-size: var(--t-small); }
.departures-line .stop { --stop: .75rem; border-width: 2px; }
.departures-line { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--l-signal); }
.departures-note { color: var(--l-mute); font-weight: 600; }
.departures-board { width: 100%; border-collapse: separate; border-spacing: 4px; font-variant-numeric: tabular-nums; perspective: 600px; }
.departures-board thead th { color: var(--l-mute); font-size: var(--t-small); font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  text-align: left; padding: 0 .7rem .25rem; }
.departures-board thead th.num { text-align: right; }
.departures-board tbody th, .departures-board tbody td { padding: .55rem .75rem; border-radius: 4px; text-align: left; white-space: nowrap;
  font-size: clamp(.95rem, .8rem + .55vw, 1.35rem); font-weight: 800; letter-spacing: .03em; color: var(--l-ink);
  background: linear-gradient(to bottom, #182444 0 49.4%, #070d1d 49.4% 50.6%, #141f3c 50.6% 100%); }
.departures-board tbody td.num { text-align: right; }
.departures-board td.pos { color: var(--l-ok); }
.departures-board td.neg { color: var(--l-err); }
.departures-board .status { font-size: .8em; letter-spacing: .1em; color: var(--l-soft); }
/* Le mois qui vient d’arriver reste allumé en jaune */
.departures-board tr.latest th, .departures-board tr.latest td:not(.pos):not(.neg) { color: var(--l-signal); }
.departures-board tr.latest td:last-child { background: var(--l-signal); }
.departures-board tr.latest td:last-child .status { color: var(--l-panel); }
.flap { display: inline-block; transform-origin: 50% 50%; backface-visibility: hidden;
  animation: flap-in .55s cubic-bezier(.2, .9, .25, 1) both;
  animation-delay: calc(var(--r, 0) * 110ms + var(--c, 0) * 70ms + 200ms); }
.departures-board tbody tr:nth-child(2) { --r: 1; } .departures-board tbody tr:nth-child(3) { --r: 2; }
.departures-board tbody tr:nth-child(4) { --r: 3; } .departures-board tbody tr:nth-child(5) { --r: 4; }
.departures-board tbody tr:nth-child(6) { --r: 5; } .departures-board tbody tr:nth-child(7) { --r: 6; }
.departures-board tbody > tr > :nth-child(2) { --c: 1; } .departures-board tbody > tr > :nth-child(3) { --c: 2; }
.departures-board tbody > tr > :nth-child(4) { --c: 3; }
@keyframes flap-in { 0% { transform: rotateX(92deg); opacity: 0; } 55% { transform: rotateX(-14deg); opacity: 1; }
  80% { transform: rotateX(6deg); } 100% { transform: rotateX(0); opacity: 1; } }

.landing-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-top: 1.6rem; }
.landing-actions form { margin: 0; }
.landing-cta { font-size: 1.05rem; padding: .8rem 1.4rem; min-height: 52px; }
.landing-actions-note { flex-basis: 100%; margin: .2rem 0 0; color: var(--l-mute); font-size: var(--t-small); font-weight: 600; }

/* Correspondances : une ligne verticale, une station par fonctionnalité */
.landing-stops { padding-top: 2rem; padding-bottom: 5rem; }
.landing-stops h2, .landing-more h2, .landing-film h2, .landing-info h2 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.5rem); font-weight: 900; letter-spacing: -.02em;
  line-height: 1.1; margin: 0 0 2.4rem; }
.stops { list-style: none; margin: 0; padding: 0 0 0 2.4rem; position: relative; }
.stops::before { content: ""; position: absolute; left: .55rem; top: .5rem; bottom: 2rem; width: 4px; border-radius: 2px; background: var(--l-soft); opacity: .35; }
.stop-row { position: relative; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 1.5rem 3rem; align-items: center; padding-bottom: 4rem; }
.stop-row::before { content: ""; position: absolute; left: -2.4rem; top: .35rem; width: 1.35rem; height: 1.35rem; border-radius: 50%;
  background: var(--l-bg); box-shadow: inset 0 0 0 4px var(--l-ink); }
.stop-row:first-child::before { background: var(--l-signal); box-shadow: inset 0 0 0 4px var(--l-signal), 0 0 0 4px rgba(255, 205, 0, .25); }
.stop-text { align-self: start; }
.stop-text h3 { font-size: clamp(1.25rem, 1.05rem + .7vw, 1.6rem); font-weight: 800; line-height: 1.2; margin: 0 0 .6rem; }
.stop-text p { color: var(--l-soft); line-height: 1.6; margin: 0; max-width: 40ch; }
.stop-screen { margin: 0; }
.stop-screen img { display: block; width: 100%; height: auto; border-radius: 8px;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .08); }

/* Avis de sécurité : plaque émaillée bleu nuit à double filet jaune (une plaque blanche éblouissait sur la page sombre) */
.landing-notice { padding: 0 1.25rem 5rem; }
.notice-plate { max-width: 860px; margin: 0 auto; background: var(--l-panel); color: var(--l-soft); border-radius: 12px; padding: 2.2rem 2.4rem;
  box-shadow: inset 0 0 0 5px var(--l-panel), inset 0 0 0 7px var(--l-signal), 0 30px 60px -30px rgba(0, 0, 0, .8); }
.notice-plate h2 { color: var(--l-ink); display: flex; align-items: center; gap: .6rem; margin: 0 0 1.2rem;
  font-size: clamp(1.4rem, 1.1rem + 1vw, 2rem); font-weight: 900; letter-spacing: -.01em; }
.notice-plate h2 .icon { width: 1.4em; height: 1.4em; color: var(--l-signal); }
.notice-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .95rem; }
.notice-list li { position: relative; padding-left: 1.9rem; line-height: 1.55; color: var(--l-soft); }
.notice-list li::before { content: ""; position: absolute; left: 0; top: .3rem; width: .95rem; height: .95rem; border-radius: 50%;
  box-shadow: inset 0 0 0 3.5px var(--l-signal); }
.notice-list strong { color: var(--l-ink); }
.notice-foot { margin: 1.4rem 0 0; }
.landing .notice-foot a { color: var(--l-signal); }

/* Le film */
.landing-film { padding-bottom: 5rem; }
.film { display: block; width: 100%; max-width: 960px; height: auto; aspect-ratio: 16 / 9; border-radius: 10px; background: var(--l-board);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .08); }

/* Information voyageurs : un panneau à colonnes, pas des cartes */
.landing-info { padding-bottom: 4rem; }
/* « Et aussi » : le tableau de l'information voyageurs, sur trois colonnes et plusieurs rangées */
.landing-more { padding-bottom: 5rem; }
.more-board > div:nth-child(3n + 1) { padding-left: 0; border-left: 0; }
.more-board > div:nth-child(n + 4) { border-top: 1px solid var(--l-line); }
.info-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border-top: 2px solid var(--l-ink); }
.info-board > div { padding: 1.2rem 1.5rem 1.4rem 0; }
.info-board > div + div { padding-left: 1.5rem; border-left: 1px solid var(--l-line); }
.info-board dt { color: var(--l-signal); font-weight: 800; font-size: var(--t-small); letter-spacing: .1em; text-transform: uppercase; margin-bottom: .45rem; }
.info-board dd { margin: 0; color: var(--l-soft); line-height: 1.55; }
.info-board dd a { color: var(--l-ink); }
.landing-actions-end { margin-top: 2.6rem; }
.landing .site-footer a { color: var(--l-mute); }
.landing .site-footer a:hover { color: var(--l-ink); }

@media (max-width: 760px) {
  .stop-row { grid-template-columns: 1fr; gap: 1rem; padding-bottom: 3rem; }
  .info-board { grid-template-columns: 1fr; }
  .info-board > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--l-line); }
}
@media (max-width: 560px) {
  .departures { padding: .7rem .5rem .5rem; }
  .departures-board .col-var { display: none; }
  .departures-board tbody th, .departures-board tbody td { padding: .6rem .5rem; }
  .landing-actions .button { width: 100%; justify-content: center; }
  .landing-actions form { width: 100%; }
  .stops { padding-left: 2rem; }
  .stop-row::before { left: -2rem; }
}
@media (prefers-reduced-motion: reduce) { .flap { animation: none; } }

/* Assistant de démarrage : pays et devise en tête */
.region-quick { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem 1rem; margin: 0 0 1.2rem; }
.region-quick label { display: grid; gap: .25rem; font-size: var(--t-small); font-weight: 700; }

/* ---- Import de données ---- */
.import-crumb { margin: -.5rem 0 .5rem; }
.import-steps { list-style: none; margin: 1.2rem 0 .5rem; padding: 0; display: grid; gap: 1.4rem; }
.import-steps > li { padding-left: 2.3rem; position: relative; }
.import-steps h3 { margin: 0 0 .3rem -2.3rem; display: flex; align-items: center; }
.import-steps p { margin: .3rem 0; }
.import-sheets { margin: .3rem 0; padding-left: 1.1rem; display: grid; gap: .3rem; }
.import-drop { display: flex; flex-wrap: wrap; align-items: stretch; gap: .75rem; margin-top: .5rem; }
.import-file { flex: 1 1 320px; display: grid; gap: .55rem; padding: .9rem 1rem; border: 1.5px dashed var(--border); border-radius: var(--radius);
  background: var(--surface-2); cursor: pointer; }
.import-file:hover, .import-file:focus-within { border-color: var(--primary); }
.import-file-text { display: flex; align-items: center; gap: .6rem; }
.import-file-text .icon { width: 1.4rem; height: 1.4rem; flex: none; }
.import-file-text > span { display: grid; }
.import-drop > button { align-self: center; }
.import-wait { text-align: left; }
.import-progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin: .8rem 0; }
.import-progress span { display: block; height: 100%; width: 35%; border-radius: 3px; background: var(--primary); animation: import-slide 1.4s ease-in-out infinite; }
@keyframes import-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) { .import-progress span { animation: none; width: 100%; opacity: .5; } }
.import-tally, .import-counts { list-style: none; margin: .8rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.import-tally li, .import-counts li { padding: .45rem .8rem; border-radius: var(--radius-sm); background: var(--surface-2); font-variant-numeric: tabular-nums; }
.import-tally strong, .import-counts strong { font-size: 1.15rem; font-weight: 800; margin-right: .2rem; }
.import-tally .tally-ok { background: var(--ok-bg); color: var(--ok); }
.import-tally .tally-warn { background: var(--warn-bg); color: var(--warn); }
.import-tally .tally-err { background: var(--err-bg); color: var(--err); }
.import-done h2 { display: flex; align-items: center; gap: .5rem; }
.import-done h2 .icon { color: var(--ok); }
.import-done .import-counts { margin-bottom: .8rem; }
.import-choices h2 + .hint { margin-top: -.2rem; }
.import-choices h2:not(:first-of-type) { margin-top: 1.4rem; }
.import-account-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; flex: 1 1 420px; }
.import-account-fields label { display: grid; gap: .25rem; font-size: var(--t-small); font-weight: 700; }
.import-new-accounts > li > div:first-child { flex: 1 1 180px; }
.import-titles > li { align-items: center; }
.import-title-query { display: grid; flex: 1 1 200px; min-width: 0; }
.import-title-query strong { overflow-wrap: anywhere; }
.import-title-choice { flex: 2 1 320px; margin: 0; }
.import-title-choice select { width: 100%; }
.import-table td { font-size: var(--t-small); }
.import-table .badge { white-space: nowrap; }
.import-row-erreur td:first-child { box-shadow: inset 3px 0 0 var(--err); }
.import-row-ignoree td { color: var(--muted); }
.import-confirm .actions form { margin: 0; }
.import-titles > li { flex-wrap: wrap; }
.import-retry { flex: 1 0 100%; margin: 0; }
.import-retry summary { cursor: pointer; color: var(--link); font-weight: 700; min-height: 32px; display: inline-flex; align-items: center; }
.import-retry label { display: grid; gap: .25rem; max-width: 420px; margin-top: .3rem; font-weight: 700; }
.import-title-query span.small + strong + span.small { font-style: italic; }
/* Téléphone : chaque ligne de l'aperçu devient une carte, statut compris */
@media (max-width: 699px) {
  .import-table thead { display: none; }
  .import-table, .import-table tbody { display: block; }
  .import-table tr { display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .6rem; padding: .7rem 0 .7rem .6rem;
    border-bottom: 1px solid var(--border); }
  .import-table td { border: 0; padding: 0; text-align: left; }
  .import-table tbody tr:hover td { background: none; }
  .import-table .li-line { grid-column: 1; }
  .import-table .li-account { grid-column: 2; font-weight: 700; }
  .import-table .li-date { grid-column: 3; color: var(--muted); }
  .import-table .li-title, .import-table .li-detail, .import-table .li-status { grid-column: 1 / -1; }
  .import-table .li-detail.num { text-align: left; }
  .import-row-erreur td:first-child { box-shadow: none; }
  .import-row-erreur { box-shadow: inset 3px 0 0 var(--err); }
}
.import-accounts-step h2 { display: flex; align-items: center; }
.import-abandon { margin: -.25rem 0 1rem; }
.import-abandon .link { color: var(--muted); }
/* Étapes de l'import : jamais plus larges que la carte (le sélecteur de fichier imposait sa largeur) */
.import-steps { grid-template-columns: minmax(0, 1fr); }
.import-steps > li { min-width: 0; }
.import-file { min-width: 0; flex-basis: 240px; }
.import-file input[type="file"] { width: 100%; }
@media (max-width: 599px) {
  .import-steps > li { padding-left: 0; }
  .import-steps h3 { margin-left: 0; }
  .import-drop > button { width: 100%; justify-content: center; }
}

/* ---- Soutenir le projet ---- */
.support { max-width: 880px; margin: 0 auto; }
.support-intro h1 { display: flex; align-items: center; gap: .5rem; margin-top: 0; }
.support-intro h1 .icon { color: var(--err); width: 1em; height: 1em; }
.support-free { font-weight: 600; margin-bottom: 0; }
.support-steps { margin: .3rem 0 0; padding-left: 1.3rem; display: grid; gap: .45rem; line-height: 1.5; }
.support-wallets { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 820px) { .support-wallets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wallet { margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.wallet-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.wallet-head h2 { margin: 0; font-size: var(--t-body); }
.wallet-facts { margin: 0; display: grid; gap: .35rem; }
.wallet-facts div { display: grid; gap: .05rem; }
.wallet-facts dt { font-size: var(--t-small); color: var(--muted); font-weight: 700; }
.wallet-facts dd { margin: 0; }
.wallet .hint { margin: 0; }
.wallet-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .9rem; margin-top: auto; padding-top: .4rem; }
.wallet-qr { width: 148px; height: 148px; flex: none; background: #ffffff; border-radius: var(--radius-sm); padding: 4px; }
.wallet-address-box { flex: 1 1 180px; min-width: 0; display: grid; gap: .4rem; align-content: start; }
.wallet-address { display: block; padding: .5rem .6rem; background: var(--surface-2); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: .86rem; line-height: 1.45; word-break: break-all; user-select: all; }
.wallet-address-box button { justify-self: start; }
.wallet-address-box button.copied { color: var(--ok); }
.support-foot p { margin: .3rem 0; }
.wallet-title { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.wallet-logo { width: 36px; height: 36px; flex: none; border-radius: 50%; object-fit: cover; }
.situation-row .situation-split { grid-column: 1 / -1; }

/* Comptes › Vue d'ensemble : totaux et valeur de chaque compte */
.accounts-net { margin: .2rem 0 0; font-variant-numeric: tabular-nums; }
.accounts-net strong { color: var(--text); font-size: 1.15rem; }
.family-head .family-sum { margin-left: auto; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.settings-accounts > li > .user-info { flex: 1 1 260px; min-width: 0; }
.settings-accounts .account-value { font-weight: 800; font-size: 1.02rem; align-self: center; }
.account-link { color: inherit; text-decoration: none; }
.account-link:hover strong { text-decoration: underline; color: var(--link); }
.settings-accounts .account-edit { align-self: center; min-height: 36px; color: var(--muted); }
.settings-accounts .account-edit:hover { color: var(--link); }
.organize-hint { margin: -.25rem 0 .5rem; }
.organize-toggle { border-style: dashed; }
.organize-toggle.on { border-style: solid; background: var(--surface-2); }
.family-link { color: inherit; text-decoration: none; }
.family-link:hover { color: var(--link); text-decoration: underline; }
.evolution-link { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm);
  color: var(--muted); align-self: center; }
.evolution-link:hover, .evolution-link:focus-visible { color: var(--link); background: var(--surface-2); }
.evolution-link .icon { width: 1.15em; height: 1.15em; }
.lead-value-row { display: flex; align-items: center; gap: .4rem; }
.lead-value-row .evolution-link { width: 40px; height: 40px; }
.lead-value-row .evolution-link .icon { width: 1.3em; height: 1.3em; }
.how-organized { margin: 0 0 1rem; max-width: 760px; }
.how-organized summary { cursor: pointer; font-weight: 700; color: var(--link); min-height: 36px; display: inline-flex; align-items: center; }
.how-organized ul { margin: .4rem 0; padding-left: 1.2rem; display: grid; gap: .35rem; line-height: 1.5; }
.mode-help { margin-top: -.4rem; }

/* Historique › Variations : effet marché en %, couleurs du calendrier sur les lignes de famille */
.period-controls .view-filter { margin-left: .25rem; }
.recap-table td.perf-cell { --cal-step: var(--cal-step-dark, 11%); }
.recap-table td.perf-pos { background: color-mix(in srgb, var(--ok-fill) calc(var(--lvl, 1) * var(--cal-step)), var(--surface)); }
.recap-table td.perf-neg { background: color-mix(in srgb, var(--err) calc(var(--lvl, 1) * var(--cal-step)), var(--surface)); }
.recap-table td.perf-zero { background: var(--surface-2); }
.recap-table .lvl-1 { --lvl: 1; } .recap-table .lvl-2 { --lvl: 2; } .recap-table .lvl-3 { --lvl: 3; }
.recap-table .lvl-4 { --lvl: 4; } .recap-table .lvl-5 { --lvl: 5; }

/* Comptes › exemple d'organisation : vue d'ensemble en miniature, agrandie au clic */
.org-example { margin: .6rem 0 .8rem; display: grid; gap: .4rem; }
.org-example figcaption { color: var(--muted); }
.org-board { all: unset; box-sizing: border-box; cursor: zoom-in; display: grid; gap: .5rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); padding: .6rem; border-radius: var(--radius);
  background: var(--surface-2); max-height: 190px; overflow: hidden; position: relative; font-size: .82rem;
  -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.org-board:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
.org-example.open .org-board { max-height: none; cursor: zoom-out; font-size: .92rem; -webkit-mask-image: none; mask-image: none; }
.org-family { display: grid; gap: .25rem; align-content: start; background: var(--surface); border-radius: var(--radius-sm);
  padding: .5rem .6rem; box-shadow: var(--shadow); }
.org-family-head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-weight: 800; padding-bottom: .2rem;
  border-bottom: 1px solid var(--border); }
.org-family-head .pastille { width: 1.35rem; height: 1.35rem; font-size: .7rem; }
.org-account { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .1rem .5rem; align-items: center; padding: .2rem 0; }
.org-account-name { min-width: 0; }
.org-type { grid-column: 1; display: flex; align-items: center; gap: .3rem; flex-wrap: nowrap; min-width: 0; }
.org-type .badge { font-size: .72rem; }
.org-value { grid-column: 2; grid-row: 1 / span 2; font-weight: 800; font-variant-numeric: tabular-nums; }
.org-note { display: inline-block; padding: .05rem .4rem; border-radius: 999px; background: var(--signal); color: #16264d;
  font-size: .72rem; font-weight: 800; white-space: nowrap; }
.org-note-soft { background: var(--err-bg); color: var(--err); }

/* ---- Performance comparée à un indice (/historique/performance) ---- */
.perf-intro { margin: -.5rem 0 1.5rem; }
.perf-compare { margin: 0 0 2.5rem; }
.perf-compare-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem;
  margin: 0 0 1rem; padding-top: .75rem; border-top: 2px solid var(--text); }
.perf-controls { display: flex; flex-wrap: wrap; gap: .5rem; min-width: 0; }
.perf-summary { border-bottom: 0; margin-bottom: 1rem; padding-bottom: 0; }
.perf-months { margin-bottom: .75rem; }
.perf-note { margin-top: .5rem; }
.perf-more { margin: 0 0 .75rem; }
/* ---- Page d'une ligne Bourse ou crypto (/titres/<compte>/ligne/<actif>) ---- */
.price-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin: 0 0 1rem; }
.price-head h2 { margin: 0; }
.line-link { color: inherit; text-decoration: none; }
.back-link { display: inline-flex; align-items: center; gap: .2rem; margin: 0 0 .35rem; font-weight: 700; font-size: var(--t-small); color: var(--muted); text-decoration: none; }
.back-link:hover, .back-link:focus-visible { color: var(--text); text-decoration: underline; }
.back-link .icon { width: 1rem; height: 1rem; }
.line-head h1 { display: flex; align-items: center; gap: .7rem; }
.trade-actions .trade-button { min-width: 8.5rem; justify-content: center; }
.trade-dot { width: .6rem; height: .6rem; border-radius: 50%; flex: none; }
.trade-dot.buy { background: var(--ok-fill); }
.trade-dot.sell { background: var(--err); }
.price-asof { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; }
.price-asof form button { min-height: 32px; padding: .15rem .6rem; }
@media (max-width: 699px) {
  /* Téléphone : Achat et Vente côte à côte, chacun la moitié de la largeur ; Dividende en dessous */
  .line-head .trade-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .line-head .trade-actions .trade-button { order: 1; min-height: 46px; font-size: var(--t-body); padding: .55rem 1rem; }
  .line-head .trade-actions .primary { order: 0; flex-basis: auto; }
  .line-head .trade-actions .trade-extra { order: 2; grid-column: 1 / -1; justify-self: start; }
}
.line-link:hover strong, .line-link:focus-visible strong { text-decoration: underline; }
.chart-box.price-box { height: 340px; }
.price-stats { margin-top: 1rem; }
/* Faits en colonnes régulières : ceux qui passent à la ligne restent alignés sous ceux du dessus */
.hero-facts.facts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .75rem 1.25rem; }
.hero-facts.facts-grid > div { min-width: 0; }
.hero-facts.facts-grid .fact-delta { overflow-wrap: anywhere; }
@media (min-width: 700px) { .hero-facts.facts-grid { grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .75rem 2rem; } }
@media (max-width: 699px) {
  .price-head .period-filter { width: 100%; }
  .chart-box.price-box { height: 260px; }
}
/* Filtres de la page Performance : une seule ligne, qui défile de côté si elle ne tient pas (téléphone) */
.period-filter.one-line { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.period-filter.one-line::-webkit-scrollbar { display: none; }
.period-filter.one-line a { flex: none; white-space: nowrap; }
@media (max-width: 699px) {
  .perf-compare-head .perf-controls, .perf-compare-head .perf-controls .period-filter { width: 100%; }
  .page-head .period-controls:has(.one-line) { width: 100%; }
  .page-head .period-controls .period-filter.one-line { width: 100%; }
  .period-filter.one-line a { flex: 1 0 auto; justify-content: center; padding: 0 .55rem; }
}
