/* Feuille de style du site crypto */

:root {
    --fond: #f6f7f9;
    --fond-carte: #ffffff;
    --encre: #16202c;
    --encre-douce: #5b6875;
    --bordure: #dfe4ea;
    --accent: #1f6f5c;
    --accent-clair: #e7f2ef;
    --accent-fonce: #175647;
    --alerte: #a3261f;
    --entete: #16202c;
    --rayon: 10px;
}

* { box-sizing: border-box; }

/* Les blocs masqués le sont quel que soit leur mode d'affichage (flex, grid...) */
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--encre);
    background: var(--fond);
}

h1, h2 { line-height: 1.25; }

/* Titre réservé aux lecteurs d'écran */
.hors-ecran {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* --- En-tête ----------------------------------------------------------- */

.entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: var(--entete);
    color: #fff;
}

.marque {
    display: flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.marque-signe {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--accent);
    font-size: 17px;
}

.compte { display: flex; align-items: center; gap: 12px; }

/* --- Horloge de l'en-tête ------------------------------------------------ */

.horloge {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 12px;
    font-size: 13px;
    line-height: 1.3;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--rayon);
}

.horloge-jour { font-weight: 600; }

.horloge-heure {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-variant-numeric: tabular-nums;
    cursor: default;
}

.drapeau {
    flex: 0 0 auto;
    width: 18px;
    height: 12px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
}

/* --- Boutons ------------------------------------------------------------ */

.bouton {
    font: inherit;
    padding: 9px 18px;
    border-radius: var(--rayon);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.bouton-principal {
    background: var(--accent);
    color: #fff;
}
.bouton-principal:hover { background: var(--accent-fonce); }

.bouton-entete {
    background: transparent;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
}
.bouton-entete:hover { background: rgba(255, 255, 255, 0.12); }

.bouton:disabled { opacity: 0.6; cursor: default; }

/* --- Pastille du compte connecté ---------------------------------------- */

.pastille {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.04em;
    cursor: pointer;
}
.pastille:hover { background: var(--accent-fonce); }
.pastille:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.menu-compte { position: relative; }

.menu-deroulant {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 230px;
    padding: 12px;
    background: var(--fond-carte);
    color: var(--encre);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    box-shadow: 0 12px 28px rgba(22, 32, 44, 0.16);
    z-index: 10;
}

.menu-identite { font-weight: 600; }

.menu-courriel {
    margin: 2px 0 10px;
    font-size: 14px;
    color: var(--encre-douce);
    overflow-wrap: anywhere;
}

.menu-version {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--bordure);
    font-size: 12px;
    color: var(--encre-douce);
}

.menu-version p { margin: 2px 0; }

.menu-action {
    width: 100%;
    padding: 8px 10px;
    font: inherit;
    text-align: left;
    background: transparent;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    cursor: pointer;
}
.menu-action:hover { background: var(--fond); }

/* --- Contenu ------------------------------------------------------------ */

main {
    max-width: 980px;
    margin: 0 auto;
    padding: 28px 24px 64px;
}

.accroche-actions:not(:empty) { margin-bottom: 28px; }

.accroche-bienvenue {
    margin: 0;
    padding: 12px 16px;
    background: var(--accent-clair);
    border-radius: var(--rayon);
    font-weight: 600;
}

.espace {
    margin-top: 32px;
    padding: 24px;
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
}
.espace h2 { margin: 0 0 8px; font-size: 20px; }
.espace-vide { margin: 0; color: var(--encre-douce); }

.pied {
    padding: 24px;
    border-top: 1px solid var(--bordure);
    color: var(--encre-douce);
    font-size: 14px;
    text-align: center;
}
.pied p { margin: 0; }

/* --- Dialogue de connexion ---------------------------------------------- */

.dialogue {
    width: min(420px, calc(100vw - 32px));
    padding: 26px;
    border: 1px solid var(--bordure);
    border-radius: 14px;
    background: var(--fond-carte);
    color: var(--encre);
}
.dialogue::backdrop { background: rgba(22, 32, 44, 0.5); }
.dialogue h2 { margin: 0 0 18px; font-size: 22px; }

.dialogue-fermer-forme { margin: 0; }

.dialogue-fermer {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 32px;
    height: 32px;
    font-size: 22px;
    line-height: 1;
    color: var(--encre-douce);
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}
.dialogue-fermer:hover { background: var(--fond); }

.onglets {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    padding: 4px;
    background: var(--fond);
    border-radius: var(--rayon);
}

.onglet {
    flex: 1;
    padding: 8px;
    font: inherit;
    font-size: 15px;
    color: var(--encre-douce);
    background: transparent;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
}
.onglet.actif {
    background: var(--fond-carte);
    color: var(--encre);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(22, 32, 44, 0.12);
}

.google { margin-bottom: 4px; }
#bouton-google { display: flex; justify-content: center; min-height: 44px; }

.separateur {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--encre-douce);
    font-size: 14px;
}
.separateur::before,
.separateur::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--bordure);
}

.google-indisponible {
    margin: 0 0 18px;
    padding: 10px 12px;
    background: var(--fond);
    border: 1px solid var(--bordure);
    border-radius: 8px;
    color: var(--encre-douce);
    font-size: 14px;
}

.formulaire { display: grid; gap: 14px; }

.champ { display: grid; gap: 5px; }
.champ label { font-size: 14px; font-weight: 600; }

.champ input {
    font: inherit;
    padding: 10px 12px;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    background: var(--fond-carte);
    color: var(--encre);
}
.champ input:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
}

.aide { margin: 0; font-size: 13px; color: var(--encre-douce); }
.liste-aide { margin: 6px 0; padding-left: 18px; }
.liste-aide li { margin: 3px 0; }

.erreur {
    margin: 0;
    padding: 10px 12px;
    background: #fdeeed;
    border: 1px solid #f2c6c3;
    border-radius: 8px;
    color: var(--alerte);
    font-size: 14px;
}

/* --- Administration ------------------------------------------------------ */

.menu-role {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
}

.menu-action-lien {
    display: block;
    margin-bottom: 8px;
    color: inherit;
    text-decoration: none;
}

.fil { margin-bottom: 8px; font-size: 14px; color: var(--encre-douce); }
.fil a { color: var(--accent); }

main h1:not(.hors-ecran) { margin: 0 0 20px; font-size: clamp(26px, 3.5vw, 32px); }

.onglets-page { max-width: 320px; margin-bottom: 20px; }

.tableau-defilant { overflow-x: auto; }

.tableau {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    font-size: 15px;
}

.tableau th,
.tableau td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--bordure);
    vertical-align: middle;
}

.tableau thead th {
    font-size: 13px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--encre-douce);
}

.tableau tbody tr:last-child td { border-bottom: 0; }
.tableau tbody tr:hover { background: var(--fond); }

.cellule-identite { display: flex; align-items: center; gap: 12px; }
.cellule-nom { display: block; font-weight: 600; }
.cellule-courriel { display: block; font-size: 13px; color: var(--encre-douce); }

.pastille-petite {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    font-size: 12px;
    cursor: default;
}

/* Interrupteur */
.bascule {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.bascule input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.bascule-curseur {
    position: absolute;
    inset: 0;
    background: #c7ced6;
    border-radius: 999px;
    transition: background-color 0.15s;
    pointer-events: none;
}

.bascule-curseur::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.15s;
}

.bascule input:checked + .bascule-curseur { background: var(--accent); }
.bascule input:checked + .bascule-curseur::before { transform: translateX(20px); }
.bascule input:focus-visible + .bascule-curseur { outline: 2px solid var(--accent); outline-offset: 2px; }
.bascule input:disabled { cursor: default; }
.bascule input:disabled + .bascule-curseur { opacity: 0.5; }

/* --- Bandeau de cours dans l'en-tête ------------------------------------- */

.entete-droite { display: flex; align-items: center; gap: 14px; }

.encart-marche { display: flex; align-items: center; gap: 14px; }

.ticker { display: flex; align-items: center; gap: 4px; }

/* Chaque cours est un bouton : il ouvre le graphique des 24 dernières heures */
.ticker-actif {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 3px 8px;
    font: inherit;
    font-size: 13px;
    color: inherit;
    white-space: nowrap;
    background: transparent;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    transition: background-color 0.15s;
}
.ticker-actif:hover { background: rgba(255, 255, 255, 0.18); }
.ticker-actif:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

.ticker-symbole { font-weight: 600; letter-spacing: 0.03em; }
.ticker-prix { color: rgba(255, 255, 255, 0.85); }

.variation { font-size: 13px; font-weight: 600; }
.variation-hausse { color: #2f9e6b; }
.variation-baisse { color: #d0574f; }

.entete .variation-hausse { color: #6ee7b7; }
.entete .variation-baisse { color: #fca5a5; }

/* --- Blocs défilants : marchés et actualités ----------------------------- */

.bloc-defilant + .bloc-defilant { margin-top: 36px; }

.bloc-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

/* En-tête à trois parts : titre à gauche, action au centre exact du bloc, outils à droite */
.bloc-entete-centre {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "titre action outils";
    align-items: center;
}
.bloc-entete-centre .bloc-titre { grid-area: titre; }
.bloc-entete-centre .bloc-action-centre { grid-area: action; }
.bloc-entete-centre .bloc-outils { grid-area: outils; justify-self: end; }

.bloc-titre {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 22px;
}

.bloc-icone {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    padding: 4px;
    color: var(--accent);
    background: var(--accent-clair);
    border-radius: 8px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.bloc-outils {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.marche-horodatage { margin: 0; font-size: 13px; color: var(--encre-douce); }

.fleches { display: flex; gap: 6px; }

.fleche {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--encre);
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.fleche:hover:not(:disabled) {
    color: var(--accent);
    background: var(--accent-clair);
    border-color: var(--accent);
}
.fleche:disabled { opacity: 0.35; cursor: default; }
.fleche:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.fleche svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Variante réduite, pour un bouton posé à l'intérieur d'une vignette */
.fleche-mini { width: 26px; height: 26px; }
.fleche-mini svg { width: 15px; height: 15px; }

.piste {
    display: flex;
    gap: 14px;
    margin-top: 16px;
    padding: 2px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
}
.piste::-webkit-scrollbar { display: none; }
.piste:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--rayon); }

.piste > * { flex: 0 0 auto; scroll-snap-align: start; }

.piste-vide { margin: 0; padding: 14px 0; color: var(--encre-douce); }

/* La vignette porte deux boutons : ouvrir le graphique du cours sur 24 h,
   et rafraîchir le cours sans attendre le relevé automatique */
.carte-cours {
    position: relative;
    width: 196px;
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
}
.carte-cours:hover { border-color: var(--accent); }

.carte-cours-ouvrir {
    display: block;
    width: 100%;
    padding: 14px 16px;
    font: inherit;
    color: inherit;
    text-align: left;
    background: none;
    border: 0;
    border-radius: var(--rayon);
    cursor: pointer;
}
.carte-cours-ouvrir:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Posé dans le coin, à hauteur du prix, qui lui réserve sa place */
.carte-rafraichir { position: absolute; right: 10px; bottom: 11px; }

.carte-cours-haut {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.carte-symbole { font-weight: 700; letter-spacing: 0.03em; }
.carte-nom { display: block; margin: 2px 0 8px; font-size: 13px; color: var(--encre-douce); }
.carte-prix { display: block; padding-right: 30px; font-size: 19px; font-weight: 600; }

.carte-actu {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    width: 285px;
    padding: 16px;
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
}
.carte-actu:hover { border-color: var(--accent); }

.carte-actu-titre {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--encre);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
}
.carte-actu-titre:hover { color: var(--accent); text-decoration: underline; }

.actu-meta { margin: 0; font-size: 13px; color: var(--encre-douce); }

/* --- Adaptation aux petits écrans ---------------------------------------- */

@media (max-width: 1100px) {
    .horloge-jour { display: none; }
}

@media (max-width: 860px) {
    .ticker { display: none; }
}

@media (max-width: 640px) {
    .horloge { gap: 10px; padding: 5px 9px; font-size: 12px; }
    .bloc-outils { width: 100%; justify-content: space-between; }

    /* Trop étroit pour trois parts : titre et outils en haut, action centrée dessous */
    .bloc-entete-centre {
        grid-template-columns: 1fr auto;
        grid-template-areas: "titre outils" "action action";
    }
    .bloc-entete-centre .bloc-outils { width: auto; }
    .bloc-entete-centre .bloc-action-centre { justify-self: center; }
}

@media (max-width: 520px) {
    .entete { padding: 12px 16px; gap: 10px; }
    main { padding: 24px 16px 48px; }
    .carte-actu { width: min(285px, calc(100vw - 60px)); }
}

/* --- Bouton de devise ---------------------------------------------------- */

.devise {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    font: inherit;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}
.devise:hover { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.5); }
.devise:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* --- Espace connecté : colonne de gauche et contenu ---------------------- */

.disposition {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

/* La colonne de gauche empile ses panneaux et les suit au défilement.
   C'est elle qui colle, pas chaque panneau : sinon ils se chevaucheraient. */
.colonne-laterale {
    position: sticky;
    top: 24px;
    display: grid;
    gap: 24px;
    min-width: 0;
}

/* Les colonnes ne s'élargissent jamais au-delà de leur piste de grille :
   sinon la colonne de gauche déborde sur les opérations */
.colonne-laterale > *,
.colonne-principale { min-width: 0; }

/* Chaque bloc défile dans sa propre hauteur */
.defilement-bloc {
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}
#liste-detentions { max-height: 45vh; padding-right: 6px; }
#pv-contenu { max-height: 35vh; padding-right: 6px; }

.defilement-operations {
    max-height: calc(100vh - 220px);
    min-height: 240px;
    overflow-x: auto;
    margin-top: 12px;
}
/* Le bloc gère lui-même les deux axes : l'en-tête du tableau reste visible */
.defilement-operations .tableau-defilant { overflow: visible; }
.defilement-operations .tableau thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--fond-carte);
}

.panneau {
    padding: 20px;
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
}
.panneau .bloc-titre { margin: 0 0 12px; font-size: 18px; }

.colonne-principale > .espace:first-child { margin-top: 0; }
.espace .bloc-titre { margin: 0; font-size: 20px; }

/* --- Logo d'une crypto --------------------------------------------------- */

.logo-crypto {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}
.logo-crypto img { width: 100%; height: 100%; border-radius: 50%; }

/* Pastille affichée si le logo ne peut pas être chargé */
.logo-repli {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--accent-clair);
    color: var(--accent);
    font-size: 9px;
    font-weight: 700;
}

/* --- Cryptos détenues ---------------------------------------------------- */

.liste-detentions { list-style: none; margin: 0; padding: 0; }

/* Chaque ligne est un lien vers la page de la crypto */
.detention {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 6px;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--bordure);
    border-radius: 6px;
    transition: background-color 0.15s;
}
.liste-detentions li:last-child .detention { border-bottom: 0; }
.detention:hover { background: var(--fond); }
.detention:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.detention-texte { display: flex; flex-direction: column; flex: 1; min-width: 0; }

.detention-libelle {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.detention-symbole { font-size: 12px; color: var(--encre-douce); letter-spacing: 0.04em; }

/* Quantité, cours unitaire et valeur empilés à droite de la ligne */
.detention-chiffres {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.detention-quantite {
    font-size: 13px;
    font-weight: 700;
    color: var(--encre-douce);
    overflow-wrap: anywhere;
}

.detention-prix {
    font-size: 12px;
    color: var(--encre-douce);
    white-space: nowrap;
}

.detention-total {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

.detentions-releve { margin: 10px 0 0; font-size: 12px; }

.detention-vide { padding: 6px 0; color: var(--encre-douce); font-size: 14px; }

/* --- Plus-values de cession ---------------------------------------------- */

.annee-barre {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.annee-courante { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

.pv-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 4px;
    background: var(--fond);
    border-radius: var(--rayon);
}
.pv-total-libelle { font-size: 13px; color: var(--encre-douce); }

/* En-tête d'un panneau : titre à gauche, commande à droite */
.panneau-entete { margin-bottom: 12px; }
.panneau .panneau-entete .bloc-titre { margin: 0; }

/* Bascule € / % : les deux unités restent visibles, l'active est mise en avant */
.bascule-unite {
    display: inline-flex;
    padding: 2px;
    font: inherit;
    background: var(--fond);
    border: 1px solid var(--bordure);
    border-radius: 999px;
    cursor: pointer;
}
.bascule-unite:hover { border-color: var(--accent); }
.bascule-unite:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.bascule-choix {
    min-width: 24px;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--encre-douce);
    text-align: center;
}
.bascule-choix.actif { background: var(--accent); color: #fff; }

/* L'année en cours n'est pas close : son total est signalé comme estimé */
.pv-etiquette {
    display: inline-block;
    margin-right: 8px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--accent-clair);
    color: var(--accent-fonce);
    font-size: 12px;
    font-weight: 600;
}
.pv-total-montant { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }

.liste-pv { list-style: none; margin: 0; padding: 0; }

.pv-ligne {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--bordure);
}
.pv-ligne:last-child { border-bottom: 0; }

.pv-texte { display: flex; flex-direction: column; flex: 1; min-width: 0; }

.pv-libelle {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pv-detail { font-size: 12px; color: var(--encre-douce); }

.pv-montant {
    margin-left: auto;
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.pv-gain { color: #2f9e6b; }
.pv-perte { color: #d0574f; }

/* Une réserve ne masque pas le chiffre : elle dit de s'en méfier */
.pv-reserve {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--alerte);
}

.pv-vide { padding: 6px 0; margin: 0; color: var(--encre-douce); font-size: 14px; }

/* La convention retenue pour le staking, sous le chiffre qu'elle détermine */
.pv-convention { margin-top: 10px; }
.pv-convention a { color: var(--accent); }

/* --- Tableau des opérations ---------------------------------------------- */

.tableau-operations { min-width: 560px; }

.cellule-nombre {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tableau-operations .cellule-identite { gap: 8px; }
.tableau-operations .cellule-nom { font-weight: 600; letter-spacing: 0.02em; }

.cellule-actions { text-align: right; white-space: nowrap; }

.etiquette-sens {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.etiquette-achat { background: var(--accent-clair); color: var(--accent-fonce); }
.etiquette-vente { background: #fdeeed; color: var(--alerte); }
/* Le staking fait entrer de la crypto sans contrepartie en argent : ni la
   couleur d'un achat, ni celle d'une vente */
.etiquette-staking { background: #ecebfa; color: #4b41a8; }

.montant-entree { color: #1f7a4d; font-weight: 600; }
.montant-sortie { color: var(--encre); font-weight: 600; }

/* --- Compteur et défilement infini --------------------------------------- */

/* Collé au titre du bloc, qui est déjà une ligne flex */
.compteur {
    padding: 2px 10px;
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    background: var(--accent-clair);
    border-radius: 999px;
}

/* Invisible, mais jamais en display:none : sans surface, elle n'entrerait
   jamais dans le champ de l'observateur qui déclenche la suite */
.sentinelle { height: 1px; }

.etat-suite { margin: 12px 0 0; text-align: center; }

/* --- Titre portant un compteur et une action ----------------------------- */

.titre-compte {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.titre-compte .compteur { font-size: 15px; }

.etiquette-importee { background: var(--accent-clair); color: var(--accent-fonce); }
.etiquette-doublon { background: #fdf3dc; color: #8a6d1f; }
.etiquette-rejetee { background: #fdeeed; color: var(--alerte); }

/* --- Pagination ---------------------------------------------------------- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 16px;
}

.pagination-position { font-size: 14px; color: var(--encre-douce); }

/* --- Bouton rond d'ajout ------------------------------------------------- */

.zone-ajout { display: flex; justify-content: center; margin-top: 20px; }

/* Au-dessus d'une table : l'espace passe sous le bouton */
.zone-ajout-haut { margin: 0 0 14px; }

.bouton-rond {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    font: inherit;
    font-size: 28px;
    line-height: 1;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(31, 111, 92, 0.35);
    transition: background-color 0.15s, transform 0.15s;
}
.bouton-rond:hover { background: var(--accent-fonce); transform: translateY(-1px); }
.bouton-rond:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.bouton-rond span { margin-top: -3px; }

/* --- Boutons secondaires ------------------------------------------------- */

.bouton-discret {
    background: var(--fond-carte);
    color: var(--encre);
    border-color: var(--bordure);
    text-decoration: none;
    display: inline-block;
}
.bouton-discret:hover { background: var(--fond); border-color: var(--accent); color: var(--accent); }

.bouton-danger { background: transparent; color: var(--alerte); border-color: #f2c6c3; }
.bouton-danger:hover { background: #fdeeed; }

.bouton-petit { padding: 5px 12px; font-size: 14px; }

/* Bouton réduit à une icône : son libellé passe par aria-label et l'infobulle */
.bouton-icone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--encre-douce);
    cursor: pointer;
}
.bouton-icone svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.bouton-icone:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bouton-icone-danger:hover { color: var(--alerte); background: #fdeeed; border-color: #f2c6c3; }

/* Masqué à l'écran, lu par les lecteurs d'écran */
.visuellement-masque {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.actions-dialogue { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.actions-dialogue .bouton-danger { margin-right: auto; }

.note-vente { margin: 0; }

/* Le formulaire d'opération réutilise les styles du dialogue de connexion */
.champ select {
    font: inherit;
    padding: 10px 12px;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    background: var(--fond-carte);
    color: var(--encre);
}
.champ select:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
}

/* --- Filtres de la page des opérations ----------------------------------- */

.filtres {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 14px;
}

.champ-filtre { min-width: 150px; }
.champ-filtre label { font-size: 13px; }

.resume-filtres { margin: 0 0 14px; font-size: 14px; color: var(--encre-douce); }

/* --- Bouton de rafraîchissement ------------------------------------------ */

@keyframes tourne {
    to { transform: rotate(360deg); }
}
.fleche-tourne svg { animation: tourne 0.8s linear infinite; }

/* --- Adaptation aux petits écrans ---------------------------------------- */

@media (max-width: 780px) {
    .disposition { grid-template-columns: 1fr; }
    .colonne-laterale { position: static; }
    .defilement-operations { max-height: 70vh; }
    .filtres > .champ-filtre { flex: 1 1 140px; min-width: 0; }
}

/* --- Messages de succès et liens en bouton -------------------------------- */

.succes {
    margin: 0;
    padding: 10px 12px;
    background: var(--accent-clair);
    border: 1px solid #bcdcd3;
    border-radius: 8px;
    color: var(--accent-fonce);
    font-size: 14px;
}

.lien-bouton {
    padding: 0;
    font: inherit;
    font-size: 14px;
    color: var(--accent);
    background: transparent;
    border: 0;
    text-decoration: underline;
    cursor: pointer;
}
.lien-bouton:hover { color: var(--accent-fonce); }

.ligne-oubli { margin: 0; text-align: center; }

/* --- Pages étroites : profil, réinitialisation ---------------------------- */

.page-etroite { max-width: 560px; }
.page-etroite .espace { margin-top: 0; }

/* --- Cases à cocher des formulaires --------------------------------------- */

.champ-case { display: grid; gap: 4px; }

.champ-case-ligne { display: flex; align-items: center; gap: 10px; }
.champ-case-ligne input { width: 16px; height: 16px; margin: 0; cursor: pointer; }
.champ-case-ligne label { font-size: 14px; font-weight: 600; cursor: pointer; }

.champ-case .aide { margin-left: 26px; }

/* --- Résultat d'une création de compte ------------------------------------ */

.resultat-creation { display: grid; gap: 10px; }

.champ-lien {
    font: inherit;
    font-size: 13px;
    padding: 8px 10px;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    background: var(--fond);
    color: var(--encre);
}

/* --- Administration : onglets et relevé ----------------------------------- */

.onglets-larges { max-width: 560px; }

.encadre-releve {
    margin: 18px 0;
    padding: 16px;
    background: var(--fond);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
}

.encadre-titre { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
.encadre-releve .filtres { margin-bottom: 0; align-items: flex-end; }
.encadre-releve .champ-case { align-self: center; }
.encadre-releve .aide { margin-top: 12px; }

#tableau-cryptos, #tableau-plateformes { min-width: 520px; }
#tableau-valeurs { min-width: 720px; }

.cellule-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* --- Page élargie hors connexion et en administration -------------------- */
/* Sans espace connecté à afficher, les blocs défilants n'ont aucune raison
   de rester dans la colonne de lecture : ils prennent la largeur disponible,
   ce qui met simplement plus de cartes à l'écran. La synthèse de déclaration
   en profite aussi, pour montrer le formulaire 2086 sans défilement. */

body.page-large main { max-width: 1720px; }
body.page-moyenne main { max-width: 1280px; }

/* --- Logo dans les cartes de cours ---------------------------------------- */

.carte-identite { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.carte-identite .logo-crypto { width: 22px; height: 22px; }
.carte-identite .logo-repli { font-size: 8px; }

/* --- Aperçu du logo dans la fiche crypto ---------------------------------- */

.apercu-logo { display: flex; align-items: center; gap: 12px; min-height: 32px; }
.apercu-logo img { border-radius: 50%; }
.apercu-logo .aide { margin: 0; }

/* --- Colonnes triables ---------------------------------------------------- */

.tableau th.triable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.tableau th.triable:hover { color: var(--accent); }
.tableau th.triable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* La flèche n'apparaît que sur la colonne réellement triée */
.tableau th.triable::after {
    content: "↕";
    margin-left: 6px;
    opacity: 0.35;
    font-size: 11px;
}
.tableau th[aria-sort="ascending"]::after { content: "↑"; opacity: 1; }
.tableau th[aria-sort="descending"]::after { content: "↓"; opacity: 1; }
.tableau th[aria-sort] { color: var(--accent); }

/* --- Champs obligatoires -------------------------------------------------- */

.obligatoire {
    margin-left: 4px;
    color: var(--alerte);
    font-weight: 700;
    text-decoration: none;
    cursor: help;
}

/* --- Boîte de confirmation ------------------------------------------------ */

.confirmation-question { margin: 0 0 4px; }
.dialogue .aide + .aide { margin-top: -4px; }

/* --- Pavé numérique d'aide à la saisie ------------------------------------ */

.pave {
    position: fixed;
    z-index: 100;
    display: grid;
    gap: 8px;
    padding: 10px;
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    box-shadow: 0 12px 28px rgba(22, 32, 44, 0.22);
}

.pave-grille {
    display: grid;
    grid-template-columns: repeat(3, 44px);
    gap: 6px;
}

.pave-bas { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.pave-touche {
    height: 40px;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    color: var(--encre);
    background: var(--fond);
    border: 1px solid var(--bordure);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.1s, border-color 0.1s;
}
.pave-touche:hover { background: var(--accent-clair); border-color: var(--accent); color: var(--accent); }
.pave-touche:active { transform: translateY(1px); }

.pave-large { font-size: 13px; font-weight: 500; }

/* --- Case de confirmation d'une suppression ------------------------------- */

.champ-case-alerte {
    padding: 12px;
    background: #fdeeed;
    border: 1px solid #f2c6c3;
    border-radius: 8px;
}
.champ-case-alerte label { font-weight: 600; }

/* L'interrupteur des fiches garde sa taille propre dans une ligne de formulaire */
.champ-case-ligne .bascule { flex: 0 0 44px; }

/* --- Bandeau de l'en-tête : cours et actualités --------------------------- */

.encart-bloc {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    font: inherit;
    color: inherit;
    text-align: left;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--rayon);
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}
.encart-bloc:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.4);
}
.encart-bloc:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Le bloc des cours n'est pas cliquable : ce sont les cours qu'il contient qui
   le sont, chacun ouvrant son graphique. Il garde le cadre, pas le survol. */
.encart-cours { gap: 4px; padding: 3px 5px; cursor: default; }
.encart-cours:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

/* Accès à la liste complète, seul repère quand le bandeau est masqué */
.encart-tout {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    color: rgba(255, 255, 255, 0.75);
    background: transparent;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.encart-tout svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.encart-tout:hover { color: #fff; background: rgba(255, 255, 255, 0.18); }
.encart-tout:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

.encart-actus {
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-width: 260px;
    min-width: 0;
}

.encart-actu {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* --- Boîtes « tout voir » -------------------------------------------------- */

.dialogue-large {
    width: min(760px, calc(100vw - 32px));
    max-height: min(80vh, 720px);
    display: flex;
    flex-direction: column;
}
.dialogue-large h2 { margin-bottom: 10px; }
.dialogue-large > .aide { margin: 0 0 14px; }

.grille-cours-popup {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(186px, 1fr));
    gap: 12px;
    overflow-y: auto;
    padding: 2px;
}
.grille-cours-popup .carte-cours { width: auto; }

.liste-actus-popup {
    list-style: none;
    margin: 0;
    padding: 0 4px 0 0;
    overflow-y: auto;
}

.liste-actus-popup li {
    padding: 12px 0;
    border-bottom: 1px solid var(--bordure);
}
.liste-actus-popup li:last-child { border-bottom: 0; }

.liste-actus-popup a {
    display: block;
    color: var(--encre);
    font-weight: 500;
    text-decoration: none;
}
.liste-actus-popup a:hover { color: var(--accent); text-decoration: underline; }

@media (max-width: 1100px) {
    .encart-actus { display: none; }
}

/* --- Graphique d'un cours sur 24 h ---------------------------------------- */

/* Écran peu haut : c'est la boîte qui défile, le tracé garde sa hauteur */
.dialogue-graphique { width: min(720px, calc(100vw - 32px)); overflow-y: auto; }

.graphique-entete {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.graphique-prix { margin-left: auto; font-size: 20px; font-weight: 600; }
.graphique-rafraichir { flex: 0 0 auto; }

/* Sous cette largeur, le tracé défile plutôt que de rendre l'échelle illisible */
.graphique-zone { flex: 0 0 auto; margin: 16px 0 10px; overflow-x: auto; }

.graphique {
    display: block;
    width: 100%;
    min-width: 480px;
    height: auto;
}

.graphique-hausse { color: #2f9e6b; }
.graphique-baisse { color: #d0574f; }
.graphique-neutre { color: var(--accent); }

.graphique-grille { stroke: var(--bordure); stroke-dasharray: 3 4; }
.graphique-echelle, .graphique-heure { fill: var(--encre-douce); font-size: 12px; }
.graphique-aire { stroke: none; }

.graphique-trait {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.graphique-repere { stroke: var(--encre-douce); stroke-dasharray: 3 3; }
.graphique-pastille { fill: currentColor; stroke: var(--fond-carte); stroke-width: 2; }

.graphique-pied {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 16px;
    font-size: 13px;
}
.graphique-lecture { margin: 0; font-weight: 600; }
.graphique-bornes { margin: 0; color: var(--encre-douce); }

/* --- Déclaration fiscale ------------------------------------------------- */

/* La liste des années reprend le bloc « Mes plus-values » de l'accueil */
.decl-panneau { max-width: 760px; }
.decl-note { margin-top: 12px; }
.decl-sous-titre { margin: -12px 0 20px; font-size: 14px; }

.decl-annee-repere {
    flex: none;
    min-width: 58px;
    padding: 6px 0;
    border-radius: var(--rayon);
    background: var(--accent-clair);
    color: var(--accent-fonce);
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.decl-annee-droite {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

@media (max-width: 560px) {
    .decl-annee { flex-wrap: wrap; }
    .decl-annee-droite { width: 100%; justify-content: space-between; }
}

/* Ce qui se reporte sur la 2042-C : la case, lisible d'un coup d'œil */
.decl-report { margin-bottom: 24px; }

.decl-case-carte {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 14px 16px;
    background: var(--fond);
    border-radius: var(--rayon);
}

.decl-case {
    flex: none;
    padding: 8px 14px;
    border: 2px solid var(--accent);
    border-radius: 6px;
    color: var(--accent-fonce);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}

.decl-case-texte { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 220px; }
.decl-case-libelle { font-weight: 600; }
.decl-case-aide { font-size: 13px; color: var(--encre-douce); }

.decl-case-montant { display: flex; flex-direction: column; align-items: flex-end; margin-left: auto; }
.decl-case-valeur { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.decl-case-exact { font-size: 12px; color: var(--encre-douce); font-variant-numeric: tabular-nums; }

.decl-faits { margin: 14px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.7; }
.decl-faits strong { font-variant-numeric: tabular-nums; }

.decl-exoneration {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: var(--rayon);
    background: var(--accent-clair);
    color: var(--accent-fonce);
    font-size: 14px;
}

/* Le formulaire 2086 comme en ligne : une colonne par cession, cinq par page,
   une ligne par case. Largeurs fixes : les pages se suivent sans que les
   colonnes bougent. */
.tableau-2086 { table-layout: fixed; max-width: 1240px; min-width: 900px; }
.tableau-2086 thead th {
    vertical-align: bottom;
    white-space: normal;
    line-height: 1.25;
    text-transform: none;
    letter-spacing: 0;
}
.tableau-2086 thead .decl-ligne { width: 330px; }

.ligne-2086 {
    display: inline-block;
    min-width: 34px;
    padding: 1px 6px;
    margin-bottom: 4px;
    border-radius: 4px;
    background: var(--accent-clair);
    color: var(--accent-fonce);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
/* La case reste visible quand le tableau défile à l'horizontale */
.tableau-2086 .decl-ligne {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--fond-carte);
    text-align: left;
}
.tableau-2086 tbody tr:hover .decl-ligne { background: var(--fond); }
.decl-ligne .ligne-2086 { margin: 0 10px 0 0; vertical-align: middle; }
.decl-ligne-libelle { font-weight: 500; }

/* En-tête de colonne : le numéro de cession, puis la crypto vendue */
.decl-cession { text-align: right; }
.decl-cession-numero { display: block; color: var(--encre); font-weight: 700; }
.decl-cession-crypto { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; text-align: left; }
.decl-vente-texte { display: flex; flex-direction: column; line-height: 1.2; }
.decl-vente-crypto { font-weight: 600; color: var(--encre); }
.decl-vente-quantite { font-size: 12px; font-weight: 400; color: var(--encre-douce); font-variant-numeric: tabular-nums; }

/* Les blocs du formulaire : 213 à 218, 220 à 223, puis le résultat */
.tableau-2086 .decl-groupe th,
.tableau-2086 .decl-groupe td { border-top: 2px solid var(--bordure); }

.tableau-2086 td { white-space: nowrap; }
.decl-pv { font-weight: 700; }

.tableau-2086 .decl-incomplete { background: #fdf3f2; }

/* Valeur à reporter sur impots.gouv.fr : un clic la sélectionne en entier,
   signe et barres de la date compris, puis la copie. Le symbole € reste hors
   de la sélection. */
.valeur-copiable {
    -webkit-user-select: all;
    user-select: all;
    padding: 1px 3px;
    border-radius: 4px;
    cursor: copy;
    transition: background-color 0.2s;
}
.valeur-copiable:hover { background: var(--fond); }
.valeur-copiee,
.valeur-copiee:hover { background: var(--accent-clair); color: var(--accent-fonce); }
.montant-unite { color: var(--encre-douce); -webkit-user-select: none; user-select: none; }

/* Toast de confirmation, à côté de la valeur copiée (position posée par le
   script) : vert après une copie, rouge quand le navigateur la refuse */
.toast {
    position: fixed;
    z-index: 50;
    padding: 4px 10px;
    color: #fff;
    background: #2f9e6b;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(22, 32, 44, 0.18);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transform: translate(-4px, -50%);
    transition: opacity 0.15s, transform 0.15s;
    pointer-events: none;
}
.toast-visible { opacity: 1; transform: translate(0, -50%); }

/* Remplissage d'impots.gouv.fr par un favori, et sa méthode */
.decl-remplissage {
    margin: 16px 0;
    padding: 14px 16px;
    background: var(--fond);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
}
.decl-remplissage-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.decl-favori { cursor: grab; }
.decl-methode { margin-top: 12px; font-size: 14px; }
.decl-methode summary { cursor: pointer; font-weight: 600; }
.decl-methode ol { margin: 8px 0; padding-left: 22px; line-height: 1.6; }
.decl-methode .aide { margin-top: 6px; }
.toast-erreur { background: var(--alerte); }

/* Légende des lignes du formulaire */
.decl-legende { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px 0; }
.decl-legende dt { margin-top: 10px; font-weight: 600; }
.decl-legende dt:first-child { margin-top: 0; }
.decl-legende dd { margin: 0 0 0 44px; font-size: 14px; color: var(--encre-douce); }

/* --- Page d'une crypto du portefeuille ------------------------------------ */

.titre-crypto {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.titre-crypto-logo { display: inline-flex; }
.titre-crypto .compteur { font-size: 15px; }

.indicateurs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.indicateur {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 14px 16px;
    background: var(--fond);
    border-radius: var(--rayon);
}

.indicateur-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.indicateur-libelle { font-size: 13px; color: var(--encre-douce); }

.indicateur-valeur {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}
.indicateur-valeur.variation-hausse { color: #2f9e6b; }
.indicateur-valeur.variation-baisse { color: #d0574f; }

.indicateur-note { font-size: 12px; color: var(--encre-douce); }

.indicateurs-releve { margin: 14px 0 0; font-size: 12px; }

/* Choix de l'unité de la performance : euro ou pourcentage */
.bascule-unite {
    display: inline-flex;
    padding: 2px;
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-radius: 7px;
}
.bascule-unite-choix {
    min-width: 28px;
    padding: 2px 8px;
    font: inherit;
    font-size: 13px;
    color: var(--encre-douce);
    background: transparent;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
}
.bascule-unite-choix[aria-pressed="true"] {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}
.bascule-unite-choix:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.onglets-periode { margin: 0; min-width: 320px; }
/* « 24 h », « 1 an » : la valeur et son unité restent sur la même ligne */
.onglets-periode .onglet { padding: 6px 10px; font-size: 14px; white-space: nowrap; }

/* --- Téléphone (Galaxy S21 : 360 px de large) ----------------------------- */

/* La page défile d'elle-même au doigt : les colonnes empilées n'ont plus
   besoin de leur propre défilement, qui piégerait le geste */
@media (max-width: 780px) {
    #liste-detentions,
    #pv-contenu { max-height: none; padding-right: 0; }
    .defilement-operations { max-height: 65vh; }
}

@media (max-width: 480px) {
    /* En-tête : le signe de la marque suffit, et le bandeau passe à la ligne
       plutôt que de déborder */
    .marque-texte { display: none; }
    .entete { padding: 10px 12px; gap: 8px; }
    .entete-droite {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 8px;
        min-width: 0;
    }
    .encart-marche { gap: 8px; }
    .encart-bloc { padding: 4px 8px; }
    .horloge { gap: 8px; padding: 4px 8px; }
    /* Seule l'heure de Paris reste : New York est lisible sur ordinateur */
    .horloge-heure + .horloge-heure { display: none; }
    .menu-deroulant { max-width: calc(100vw - 24px); }

    /* Contenu */
    main { padding: 18px 12px 40px; }
    .espace,
    .panneau { padding: 16px; }
    .espace { margin-top: 20px; }
    .disposition,
    .colonne-laterale { gap: 16px; }
    .bloc-titre { font-size: 19px; }
    .pied { padding: 18px 12px; font-size: 13px; }

    /* Onglets trop nombreux pour la largeur : ils défilent à l'horizontale */
    .onglets-page,
    .onglets-larges { max-width: none; overflow-x: auto; scrollbar-width: none; }
    .onglets-page::-webkit-scrollbar { display: none; }
    .onglets-page .onglet { flex: 0 0 auto; padding: 8px 12px; }
    .onglets-periode { min-width: 0; width: 100%; }
    .onglets-periode .onglet { padding: 6px 4px; }

    /* Cartes de cours : un peu plus de deux à l'écran */
    .carte-cours { width: 160px; }
    .carte-cours-ouvrir { padding: 12px; }
    .carte-prix { font-size: 17px; }
    .grille-cours-popup { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

    /* Filtres : un champ par ligne */
    .filtres > .champ-filtre { flex: 1 1 100%; }

    /* Boîtes de dialogue : toute la largeur utile, défilement si le clavier
       du téléphone réduit la hauteur */
    .dialogue {
        width: calc(100vw - 16px);
        max-width: none;
        max-height: calc(100dvh - 16px);
        padding: 20px 16px;
        overflow-y: auto;
    }
    .dialogue h2 { font-size: 20px; padding-right: 36px; }
    .dialogue-large,
    .dialogue-graphique { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
    .actions-dialogue { flex-direction: column-reverse; align-items: stretch; }
    .actions-dialogue .bouton { width: 100%; }
    .actions-dialogue .bouton-danger { margin-right: 0; }

    /* Graphique : il tient dans la largeur plutôt que de défiler */
    .graphique { min-width: 0; }
    .graphique-prix { font-size: 18px; }

    /* Indicateurs de la page d'une crypto : deux par ligne */
    .indicateurs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .indicateur { padding: 12px; }
    .indicateur-valeur { font-size: 17px; }

    /* Déclaration */
    .decl-case-texte { min-width: 0; flex-basis: 100%; }
    .decl-case-montant { margin-left: 0; align-items: flex-start; }
    .decl-case-valeur { font-size: 22px; }
    .decl-legende dd { margin-left: 0; }

    /* Tableaux d'opérations : chaque ligne devient une carte, chaque cellule
       une ligne « libellé : valeur » (le libellé vient de data-libelle) */
    .tableau-cartes { min-width: 0; }
    .tableau-cartes thead { display: none; }
    .tableau-cartes,
    .tableau-cartes tbody,
    .tableau-cartes tr,
    .tableau-cartes td { display: block; width: 100%; }
    .tableau-cartes tr {
        padding: 10px 12px;
        margin-bottom: 10px;
        border: 1px solid var(--bordure);
        border-radius: var(--rayon);
        background: var(--fond-carte);
    }
    .tableau-cartes tbody tr:last-child { margin-bottom: 0; }
    .tableau-cartes tbody tr:hover { background: var(--fond-carte); }
    .tableau-cartes td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 4px 0;
        text-align: right;
        border-bottom: 0;
    }
    .tableau-cartes td[data-libelle]::before {
        content: attr(data-libelle);
        flex: 0 0 auto;
        font-size: 13px;
        color: var(--encre-douce);
        text-align: left;
    }
    /* La crypto sert de titre à la carte */
    .tableau-cartes td:first-child {
        padding-bottom: 8px;
        margin-bottom: 4px;
        border-bottom: 1px solid var(--bordure);
    }
    .tableau-cartes td:first-child::before { content: none; }
    .tableau-cartes .cellule-actions { justify-content: flex-end; padding-top: 8px; }
    .tableau-cartes .cellule-actions .bouton { width: 100%; }
    /* Le bloc défilant garde son en-tête collant pour les autres tableaux */
    .defilement-operations .tableau-cartes thead th { position: static; }
}

/* --- Écrans tactiles : des cibles assez grandes pour le doigt ------------- */

@media (pointer: coarse) {
    .fleche,
    .bouton-icone,
    .devise { width: 40px; height: 40px; }
    .fleche-mini { width: 36px; height: 36px; }
    .encart-tout { width: 36px; height: 36px; }
    .pastille { width: 40px; height: 40px; }
    .pastille-petite { width: 32px; height: 32px; }
    .dialogue-fermer { width: 40px; height: 40px; top: 8px; right: 8px; }
    .bouton-petit { padding: 8px 14px; }
    .menu-action { padding: 11px 12px; }
    .champ-case-ligne input { width: 20px; height: 20px; }
    .bascule-unite-choix,
    .bascule-choix { padding: 4px 10px; }
    .carte-rafraichir { bottom: 8px; }

    /* Le glisser horizontal du doigt lit les valeurs du graphique,
       le glisser vertical fait toujours défiler la page */
    .graphique { touch-action: pan-y; }
}

/* Le survol reste « collé » après un toucher : réservé aux souris */
@media (hover: none) {
    .tableau tbody tr:hover { background: transparent; }
    .carte-cours:hover,
    .carte-actu:hover { border-color: var(--bordure); }
}
