/* ==========================================================================
   XAlpha — design system
   Sombre par défaut, clair au choix. Bords fins, densité maîtrisée,
   aucune dépendance externe.
   ========================================================================== */

/* --- Jetons : thème sombre (défaut) ------------------------------------- */
/* --- Palettes ------------------------------------------------------------
   Deux palettes, deux clartés, et le client choisit depuis Mon compte.
   Elles ne se distinguent que par leurs jetons : aucune règle de mise en
   page ne connaît la couleur choisie.

   « Croix » met le rouge suisse en accent. « Granit » le range et rend
   l'accent neutre. Ce n'est pas une coquetterie : sur un écran où le rouge
   veut déjà dire « perte », en faire aussi la couleur des boutons et de la
   courbe, c'est demander à un même rouge de dire deux choses. Croix
   l'assume — la perte y vire au corail pour s'en écarter ; Granit refuse
   l'ambiguïté et garde le rouge pour la marque, l'alerte et la perte.

   --suisse est à part et ne change jamais de rôle : c'est la couleur de la
   marque, rouge dans les deux palettes, seulement montée en clarté sur
   fond sombre où le rouge d'imprimerie s'éteindrait.
   --------------------------------------------------------------------- */

/* Croix, sombre — la palette par défaut. */
:root {
    --bg:            #0b0c0e;
    --bg-grid:       #0e1013;
    --surface:       #141619;
    --surface-2:     #191c20;
    --surface-3:     #202429;
    --border:        #262a30;
    --border-strong: #343a42;

    --text:          #edeff2;
    --text-dim:      #9aa0a8;
    --text-faint:    #6b7178;

    --suisse:        #e4483b;

    --accent:        #e4483b;
    --accent-hover:  #f05a4d;
    --accent-soft:   rgba(228,72,59,.14);
    --accent-ring:   rgba(228,72,59,.35);

    --pos:           #3fb47c;
    --pos-soft:      rgba(63,180,124,.13);
    --neg:           #ff7a6b;
    --neg-soft:      rgba(255,122,107,.13);
    --sur-neg:       #2a0c07;
    --warn:          #d9a441;
    --warn-soft:     rgba(217,164,65,.13);
    --info:          #7fa8c9;
    --info-soft:     rgba(127,168,201,.13);

    --shadow:        0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28);
    --shadow-sm:     0 1px 2px rgba(0,0,0,.35);

    --r-sm: 6px;
    --r:    9px;
    --r-lg: 14px;

    --sidebar-w: 232px;
    --topbar-h:  56px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;

    color-scheme: dark;
}

/* Croix, clair — du papier, pas du sombre inversé : les gris tirent vers le
   chaud et le rouge reprend sa densité d'imprimerie. */
[data-theme="light"] {
    --bg:            #f3f4f5;
    --bg-grid:       #edeef0;
    --surface:       #ffffff;
    --surface-2:     #fafafb;
    --surface-3:     #f0f1f3;
    --border:        #e2e4e7;
    --border-strong: #c8ccd1;

    --text:          #101214;
    --text-dim:      #5c636b;
    --text-faint:    #8a9099;

    --suisse:        #d52b1e;

    --accent:        #d52b1e;
    --accent-hover:  #be2418;
    --accent-soft:   rgba(213,43,30,.09);
    --accent-ring:   rgba(213,43,30,.30);

    --pos:           #17845a;
    --pos-soft:      rgba(23,132,90,.10);
    --neg:           #c9402f;
    --neg-soft:      rgba(201,64,47,.10);
    --warn:          #9a6b14;
    --warn-soft:     rgba(154,107,20,.11);
    --info:          #2c6e9b;
    --info-soft:     rgba(44,110,155,.10);

    --shadow:        0 1px 2px rgba(16,18,20,.07), 0 8px 24px rgba(16,18,20,.06);
    --shadow-sm:     0 1px 2px rgba(16,18,20,.07);

    color-scheme: light;
}

/* --- Palette « Granit » --------------------------------------------------
   Elle ne redéfinit que ce qui la distingue : l'accent devient neutre, et
   le rouge redescend au rang de signal. Le fond, les traits et le vert
   restent ceux de Croix — deux palettes, pas deux thèmes à maintenir.

   Les sélecteurs portent deux attributs pour passer devant [data-theme] à
   spécificité égale, quel que soit l'ordre du fichier. */
[data-palette="granit"]:not([data-theme="light"]) {
    --accent:        #e7e9ec;
    --accent-hover:  #ffffff;
    --accent-soft:   rgba(231,233,236,.10);
    --accent-ring:   rgba(231,233,236,.26);
    /* L'accent est clair : l'étiquette du bouton principal doit passer en
       foncé, sinon elle disparaît dedans. */
    --sur-accent:    #0b0c0e;

    --neg:           #e4483b;
    --neg-soft:      rgba(228,72,59,.13);
}
[data-palette="granit"][data-theme="light"] {
    --accent:        #101214;
    --accent-hover:  #2a2e33;
    --accent-soft:   rgba(16,18,20,.06);
    --accent-ring:   rgba(16,18,20,.22);

    --neg:           #d52b1e;
    --neg-soft:      rgba(213,43,30,.10);
}

/* --- Réinitialisation ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p  { margin: 0 0 10px; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

code, .mono, kbd { font-family: var(--mono); font-size: .92em; }

:focus-visible {
    outline: 2px solid var(--accent-ring);
    outline-offset: 2px;
    border-radius: 3px;
}

::selection { background: var(--accent-soft); }

/* Barres de défilement discrètes */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border: 3px solid var(--bg);
    border-radius: 6px;
}

/* --- Utilitaires --------------------------------------------------------- */
.row      { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.col      { display: flex; flex-direction: column; gap: 10px; }
.wrap     { flex-wrap: wrap; }
.grow     { flex: 1 1 auto; min-width: 0; }
.right    { margin-left: auto; }
.center   { text-align: center; }
.ta-right { text-align: right; }
.nowrap   { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden   { display: none !important; }

.dim   { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.pos   { color: var(--pos); }
.neg   { color: var(--neg); }
.warnc { color: var(--warn); }

.xs { font-size: 11px; }
.sm { font-size: 12px; }
.lg { font-size: 16px; }
.xl { font-size: 22px; }
.b  { font-weight: 600; }

.mt0 { margin-top: 0; }
.mt1 { margin-top: 8px; }
.mt2 { margin-top: 16px; }
.mt3 { margin-top: 24px; }
.mb1 { margin-bottom: 8px; }
.mb2 { margin-bottom: 16px; }
.mb3 { margin-bottom: 24px; }

.tabular { font-variant-numeric: tabular-nums; }

/* --- Squelette d'application --------------------------------------------- */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--topbar-h);
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}
/* Le cartouche tient lieu de première lettre : c'est le même signe que
   l'icône de l'application installée. Il garde le rouge de la marque quelle
   que soit la palette — un logo qui change de couleur n'est plus un logo. */
.brand-mark {
    width: 26px; height: 26px;
    border-radius: 5px;
    background: var(--suisse);
    display: grid; place-items: center;
    color: #fff; font-weight: 700; font-size: 14px;
    flex: 0 0 auto;
}
.brand-name { font-weight: 650; letter-spacing: -.02em; font-size: 15px; }
.brand-tag {
    font-size: 9px; text-transform: uppercase; letter-spacing: .09em;
    color: var(--text-faint); border: 1px solid var(--border);
    padding: 1px 5px; border-radius: 4px;
}

.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; }
.nav-label {
    font-size: 10px; text-transform: uppercase; letter-spacing: .09em;
    color: var(--text-faint); padding: 14px 8px 5px;
}
.nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: var(--r-sm);
    color: var(--text-dim); font-size: 13px; font-weight: 500;
    text-decoration: none;
    transition: background .12s, color .12s;
}
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.on svg { color: var(--accent); }
.nav svg { width: 16px; height: 16px; flex: 0 0 auto; opacity: .9; }
.nav .badge-count {
    margin-left: auto; background: var(--neg); color: #fff;
    font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 9px;
    min-width: 18px; text-align: center;
}
/* Posée à zéro, masquée jusqu'à ce qu'il y ait quelque chose à voir : elle
   apparaît alors sans que la page ait été rechargée. */
.nav .badge-count[hidden] { display: none; }

.sidebar-foot { padding: 10px; border-top: 1px solid var(--border); flex: 0 0 auto; }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: var(--topbar-h);
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; gap: 12px;
    padding: 0 20px;
    position: sticky; top: 0; z-index: 20;
}

.content { padding: 20px; flex: 1 1 auto; }
.content-narrow { max-width: 880px; margin: 0 auto; }

/* --- Cartes -------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
}
.card-head {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
}
.card-head h2, .card-head h3 { font-size: 13px; font-weight: 600; }
.card-body { padding: 16px; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Deux colonnes de largeurs inégales : liste + détail, ou contenu + panneau.
   Définies ici plutôt qu'en style direct sur la page, sinon aucune règle
   d'adaptation ne pourrait les empiler sur un petit écran. */
.split-side { display: grid; gap: 14px; align-items: start;
              grid-template-columns: 330px minmax(0, 1fr); }

/* Zones défilantes d'une liste et de son fil de discussion. */
.list-scroll   { max-height: 70vh; overflow-y: auto; }
.thread-scroll { max-height: 52vh; overflow-y: auto; }
.split-wide { display: grid; gap: 14px;
              grid-template-columns: 1.6fr minmax(0, 1fr); }

/* --- Tuiles de statistique ----------------------------------------------- */
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 14px 16px;
    display: flex; flex-direction: column; gap: 5px;
    min-width: 0;
}
.stat-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-faint); font-weight: 600;
    display: flex; align-items: center; gap: 6px;
}
.stat-value {
    font-size: 23px; font-weight: 620; letter-spacing: -.02em;
    font-variant-numeric: tabular-nums; line-height: 1.15;
}
.stat-sub { font-size: 12px; color: var(--text-dim); }

/* --- Badges -------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px; border-radius: 20px;
    font-size: 11px; font-weight: 600; line-height: 1.6;
    border: 1px solid transparent; white-space: nowrap;
}
.badge-ok   { background: var(--pos-soft);    color: var(--pos);    border-color: color-mix(in srgb, var(--pos) 22%, transparent); }
.badge-err  { background: var(--neg-soft);    color: var(--neg);    border-color: color-mix(in srgb, var(--neg) 22%, transparent); }
.badge-warn { background: var(--warn-soft);   color: var(--warn);   border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.badge-info { background: var(--info-soft);   color: var(--info);   border-color: color-mix(in srgb, var(--info) 22%, transparent); }
.badge-mut  { background: var(--surface-3);   color: var(--text-dim); border-color: var(--border); }
.badge-acc  { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }

.dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; background: var(--text-faint); }
.dot-ok   { background: var(--pos); box-shadow: 0 0 0 3px var(--pos-soft); }
.dot-err  { background: var(--neg); box-shadow: 0 0 0 3px var(--neg-soft); }
.dot-mut { background: var(--text-faint); }
.dot-warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.dot-live { animation: pulse 2s ease-in-out infinite; }

/* --- Tableaux ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
    text-align: left; font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-faint);
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    white-space: nowrap;
    position: sticky; top: 0;
}
table.tbl td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr { transition: background .1s; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl.compact td { padding: 7px 12px; }

.row-click { cursor: pointer; }

/* --- Boutons ------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 7px 13px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit; font-size: 13px; font-weight: 500;
    cursor: pointer;
    transition: background .12s, border-color .12s, opacity .12s;
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.btn:active { transform: translateY(.5px); }
.btn:disabled, .btn.is-busy { opacity: .55; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

/* Le texte du bouton passe par un jeton : sur une palette à accent clair,
   un blanc écrit en dur rendrait l'étiquette invisible. */
.btn-primary {
    background: var(--accent); border-color: var(--accent); color: var(--sur-accent, #fff);
}
.btn-primary:hover {
    background: var(--accent-hover); border-color: var(--accent-hover);
    color: var(--sur-accent, #fff);
}

.btn-danger { background: var(--neg); border-color: var(--neg); color: var(--sur-neg, #fff); }
.btn-danger:hover { background: color-mix(in srgb, var(--neg) 85%, #000); color: var(--sur-neg, #fff); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-icon { padding: 6px; }
.btn-block { width: 100%; }

/* --- Formulaires --------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label {
    font-size: 12px; font-weight: 600; color: var(--text-dim);
    display: flex; align-items: center; gap: 6px;
}
.field .hint { font-size: 11px; color: var(--text-faint); }

input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="date"], input[type="search"],
select, textarea {
    width: 100%;
    padding: 8px 11px;
    background: var(--bg-grid);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }
textarea { resize: vertical; min-height: 78px; line-height: 1.5; }

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2399a1b0' stroke-width='1.6'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    background-size: 15px;
    padding-right: 30px;
}

.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 13px; }
.check input[type="checkbox"] {
    width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--accent); cursor: pointer; flex: 0 0 auto;
}

.input-group { display: flex; gap: 6px; align-items: center; }
.input-group input { flex: 1 1 auto; }

/* --- Messages ------------------------------------------------------------ */
.alert {
    padding: 10px 13px;
    border-radius: var(--r-sm);
    border: 1px solid;
    font-size: 13px;
    display: flex; align-items: flex-start; gap: 9px;
    margin-bottom: 14px;
}
.alert svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }
.alert-err  { background: var(--neg-soft);  border-color: color-mix(in srgb, var(--neg) 30%, transparent);  color: var(--neg); }
.alert-ok   { background: var(--pos-soft);  border-color: color-mix(in srgb, var(--pos) 30%, transparent);  color: var(--pos); }
.alert-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.alert-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); color: var(--info); }
/* Ce que le client a personnalisé lui-même, par opposition à ce qu'il subit :
   l'accent le distingue des alertes, qui signalent toutes un état à corriger. */
.alert-acc  { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--text); }

/* --- Notifications transitoires ------------------------------------------ */
.toasts {
    position: fixed; bottom: 18px; right: 18px; z-index: 200;
    display: flex; flex-direction: column; gap: 8px; max-width: 340px;
}
.toast {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-left: 3px solid var(--accent);
    border-radius: var(--r-sm);
    padding: 10px 13px;
    box-shadow: var(--shadow);
    font-size: 13px;
    animation: toast-in .18s ease-out;
}
.toast.ok  { border-left-color: var(--pos); }
.toast.err { border-left-color: var(--neg); }
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* --- Fenêtres modales ---------------------------------------------------- */
.modal-back {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(3px);
    display: grid; place-items: center;
    padding: 20px;
    animation: fade .14s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    width: 100%; max-width: 540px;
    max-height: 88vh;
    display: flex; flex-direction: column;
    animation: modal-in .16s ease-out;
}
.modal.wide { max-width: 800px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

.modal-head {
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px; flex: 0 0 auto;
}
.modal-body { padding: 18px; overflow-y: auto; flex: 1 1 auto; }
.modal-foot {
    padding: 12px 18px; border-top: 1px solid var(--border);
    display: flex; gap: 8px; justify-content: flex-end; flex: 0 0 auto;
    background: var(--surface-2);
}

/* --- Onglets ------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
    padding: 8px 13px; font-size: 13px; font-weight: 500;
    color: var(--text-dim); cursor: pointer;
    border: 0; background: none; font-family: inherit;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: color .12s, border-color .12s;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }

/* --- État vide et chargement --------------------------------------------- */
.empty {
    padding: 44px 20px; text-align: center; color: var(--text-faint);
}
.empty svg { width: 34px; height: 34px; opacity: .35; margin-bottom: 10px; }
.empty-title { font-size: 14px; font-weight: 600; color: var(--text-dim); margin-bottom: 3px; }

.skel {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.3s infinite;
    border-radius: 4px;
    height: 12px;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.spinner {
    width: 15px; height: 15px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Bascule de thème ---------------------------------------------------- */
.theme-btn {
    width: 32px; height: 32px;
    display: grid; place-items: center;
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: var(--r-sm);
    cursor: pointer; color: var(--text-dim);
    transition: color .12s, background .12s;
}
.theme-btn:hover { color: var(--text); background: var(--surface-3); }
.theme-btn svg { width: 16px; height: 16px; }
[data-theme="light"] .icon-moon { display: none; }
.icon-sun { display: none; }
[data-theme="light"] .icon-sun { display: block; }

/* --- Pages d'authentification -------------------------------------------- */
.auth-page {
    min-height: 100vh;
    display: grid; place-items: center;
    padding: 20px;
    background:
        radial-gradient(1000px 500px at 50% -10%, var(--accent-soft), transparent 65%),
        var(--bg);
}
.auth-card {
    width: 100%; max-width: 396px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 30px;
    box-shadow: var(--shadow);
}
.auth-brand {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; margin-bottom: 6px;
}
.auth-brand .brand-mark { width: 32px; height: 32px; font-size: 15px; }
.auth-brand .brand-name { font-size: 19px; }
.auth-sub { text-align: center; color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }
.auth-foot { text-align: center; margin-top: 20px; font-size: 11px; color: var(--text-faint); }

/* --- Barre de progression ------------------------------------------------ */
.bar {
    height: 5px; background: var(--surface-3);
    border-radius: 3px; overflow: hidden;
}
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.bar > i.pos { background: var(--pos); }
.bar > i.neg { background: var(--neg); }
.bar > i.warn { background: var(--warn); }

/* --- Graphiques ---------------------------------------------------------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-text { fill: var(--text-faint); font-size: 10px; font-family: var(--font); }
.chart .line-pos { stroke: var(--pos); stroke-width: 1.75; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-neg { stroke: var(--neg); stroke-width: 1.75; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-acc { stroke: var(--accent); stroke-width: 1.75; fill: none; stroke-linejoin: round; stroke-linecap: round; }

/* --- Messagerie ---------------------------------------------------------- */
.thread { display: flex; flex-direction: column; gap: 12px; padding: 4px; }
.msg { max-width: 76%; display: flex; flex-direction: column; gap: 4px; }
.msg-in  { align-self: flex-start; }
.msg-out { align-self: flex-end; align-items: flex-end; }
.msg-bubble {
    padding: 9px 13px; border-radius: 12px; font-size: 13px;
    border: 1px solid var(--border); background: var(--surface-2);
    white-space: pre-wrap; word-break: break-word; line-height: 1.5;
}
.msg-out .msg-bubble {
    background: var(--accent); border-color: var(--accent);
    color: var(--sur-accent, #fff);
}
.msg-meta { font-size: 10px; color: var(--text-faint); padding: 0 3px; }

/* --- Pièces jointes ------------------------------------------------------
   Deux états, deux rendus. Avant l'envoi, une étiquette qu'on peut retirer.
   Après, une vignette qu'on regarde ou un fichier qu'on ouvre. */

.pj-attente { display: flex; flex-wrap: wrap; gap: 6px; }
.pj-attente:not(:empty) { margin-bottom: 8px; }
.pj-chip {
    display: inline-flex; align-items: center; gap: 7px; max-width: 260px;
    padding: 5px 7px 5px 10px; border-radius: 999px; font-size: 12px;
    background: var(--surface-3); border: 1px solid var(--border);
    white-space: nowrap; overflow: hidden;
}
.pj-chip > :first-child { overflow: hidden; text-overflow: ellipsis; }
.pj-encours { opacity: .6; }
.pj-ote {
    border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1;
    color: var(--text-faint); padding: 0 2px;
}
.pj-ote:hover { color: var(--accent); }
.pj-spin {
    width: 11px; height: 11px; border-radius: 50%; flex: none;
    border: 2px solid var(--border-strong); border-top-color: var(--accent);
    animation: pj-tourne .7s linear infinite;
}
@keyframes pj-tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pj-spin { animation: none; } }

/* Un fichier lâché sur la barre : le geste doit se voir reconnu. */
.pj-survol { outline: 2px dashed var(--accent); outline-offset: -4px; }

.pj-jointes { display: flex; flex-wrap: wrap; gap: 6px; }
.msg-out .pj-jointes { justify-content: flex-end; }

.pj-vignette {
    display: block; border-radius: var(--r-sm); overflow: hidden;
    border: 1px solid var(--border); line-height: 0; background: var(--surface-3);
}
.pj-vignette img {
    display: block; max-width: 220px; max-height: 160px;
    width: auto; height: auto; object-fit: cover;
}
.pj-vignette:hover { border-color: var(--accent); }

.pj-fichier {
    display: inline-flex; align-items: center; gap: 8px; max-width: 240px;
    padding: 8px 11px; border-radius: var(--r-sm); font-size: 12.5px;
    background: var(--surface-3); border: 1px solid var(--border);
    color: var(--text); text-decoration: none;
}
.pj-fichier:hover { border-color: var(--accent); }
.pj-fichier svg { width: 15px; height: 15px; flex: none; color: var(--text-faint); }

/* --- Bloc de code / clé ------------------------------------------------- */
.keybox {
    font-family: var(--mono); font-size: 12px;
    background: var(--bg-grid); border: 1px solid var(--border-strong);
    border-radius: var(--r-sm); padding: 11px 13px;
    word-break: break-all; line-height: 1.6;
    display: flex; align-items: center; gap: 10px;
}
.keybox .grow { user-select: all; }

/* --- Adaptation aux petits écrans ---------------------------------------- */
@media (max-width: 1100px) {
    .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; z-index: 90; left: 0; top: 0;
        width: var(--sidebar-w);
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: var(--shadow);
    }
    .sidebar.open { transform: none; }
    .g2, .g3, .g4,
    .split-side, .split-wide { grid-template-columns: 1fr; }
    .content { padding: 14px; }
    .topbar { padding: 0 14px; }
    .hide-sm { display: none !important; }

    /* Une liste et son détail empilés : la liste est raccourcie pour que le
       détail reste atteignable sans défilement interminable. */
    .list-scroll { max-height: 34vh; }
    .thread-scroll { max-height: 46vh; }

    /* Les fenêtres occupent l'écran plutôt que de flotter au centre. */
    .modal-back { padding: 8px; align-items: flex-start; }
    .modal { max-height: 94vh; }
    .modal-foot { flex-wrap: wrap; }
    .modal-foot .btn { flex: 1 1 auto; }

    /* Les champs passent en pleine largeur, empilés. */
    .input-group { flex-direction: column; align-items: stretch; }
    .input-group .btn { width: 100%; }

    /* iOS agrandit la page dès qu'un champ descend sous 16 px. */
    input[type="text"], input[type="password"], input[type="email"],
    input[type="number"], input[type="date"], input[type="search"],
    select, textarea { font-size: 16px; }

    .stat-value { font-size: 20px; }
    h1 { font-size: 17px; }

    /* Cibles tactiles : un bouton doit rester attrapable au pouce. */
    .btn { min-height: 36px; }
    .nav a { padding: 11px 10px; }
}
@media (min-width: 861px) {
    .only-sm { display: none !important; }
}

@media print {
    .sidebar, .topbar, .btn { display: none !important; }
    .app { grid-template-columns: 1fr; }
}

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

/* --- Vérification anti-robot --------------------------------------------
   Une case et un libellé, dans l'esprit des widgets que les visiteurs
   connaissent. Le contrôle réel est la preuve de calcul faite en arrière-plan
   par antirobot.js ; ce qui suit n'en est que la mise en scène.            */
.antirobot {
    display: flex; align-items: center; gap: 11px;
    padding: 12px 14px; margin-bottom: 14px;
    background: var(--bg-grid);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    cursor: pointer; user-select: none;
    transition: border-color .15s, background .15s;
}
.antirobot:hover  { border-color: var(--accent); }
.antirobot:focus  { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

.antirobot-case {
    width: 21px; height: 21px; flex: 0 0 auto;
    border: 1.5px solid var(--border-strong);
    border-radius: 3px; background: var(--surface);
    position: relative; transition: .15s;
}
.antirobot-txt   { font-size: 14px; cursor: pointer; }
.antirobot-etat  { margin-left: auto; font-size: 12px; color: var(--text-faint); }

/* Calcul en cours : la case tourne, comme un chargement. */
.antirobot.en-cours .antirobot-case {
    border-color: var(--accent);
    border-top-color: transparent;
    border-radius: 50%;
    animation: ar-tourne .7s linear infinite;
}
@keyframes ar-tourne { to { transform: rotate(360deg); } }

/* Résolu : coche verte. */
.antirobot.ok { border-color: var(--pos); }
.antirobot.ok .antirobot-case {
    background: var(--pos); border-color: var(--pos);
}
.antirobot.ok .antirobot-case::after {
    content: ""; position: absolute; left: 6.5px; top: 2.5px;
    width: 5px; height: 10px;
    border: solid #fff; border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.antirobot.echec { border-color: var(--neg); }
.antirobot.echec .antirobot-etat { color: var(--neg); }

.antirobot-noscript {
    padding: 11px 13px; margin-bottom: 14px;
    background: rgba(240,82,107,.1);
    border: 1px solid var(--neg); border-radius: var(--r-sm);
    font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
    .antirobot.en-cours .antirobot-case { animation-duration: 2.5s; }
}

/* --- Supervision : bandeau de présence ------------------------------------
   Une case par quart d'heure. Les cases se serrent d'elles-mêmes quand la
   fenêtre s'allonge : sept jours font 672 cases, elles doivent tenir sur la
   largeur sans que la page défile.                                          */
.mon-bande {
    display: flex; gap: 2px; align-items: stretch;
    height: 30px; width: 100%;
}
.mon-bande.vide {
    border-radius: 3px;
    background: repeating-linear-gradient(
        45deg, var(--bg-grid), var(--bg-grid) 5px,
        transparent 5px, transparent 10px);
}
.mon-case {
    flex: 1 1 0; min-width: 1px;
    border-radius: 2px;
    background: var(--surface-3);
    transition: background .15s;
}
.mon-case.on { background: var(--pos); }
.mon-case:hover { background: var(--accent); }

.mon-ligne .card-body { padding: 15px 16px; }

@media (max-width: 720px) {
    .mon-bande { height: 24px; gap: 1px; }
}

/* --- Carte du réseau de parrainage ----------------------------------------
   Les cartes sont du HTML posé au-dessus d'un calque SVG qui ne porte que les
   traits : le texte reste net à tous les niveaux de zoom, ce qu'un rendu
   entièrement en SVG ne permettrait pas.                                     */
.reseau {
    position: relative; overflow: hidden;
    height: min(62vh, 620px);
    background:
        radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0) 0 0 / 26px 26px,
        var(--bg-grid);
    cursor: grab; touch-action: none;
}
.reseau.glisse { cursor: grabbing; }

.reseau-scene { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.reseau-liens { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }

.rl    { fill: none; stroke: var(--border-strong); stroke-width: 1.6; }
.rl-ok { stroke: var(--pos); stroke-width: 2; opacity: .75; }

.rn {
    position: absolute; display: flex; flex-direction: column; justify-content: center;
    gap: 5px; padding: 10px 13px; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    box-shadow: 0 2px 10px rgba(0,0,0,.28);
    transition: border-color .15s, transform .15s, box-shadow .15s;
}
.rn:hover, .rn:focus-visible {
    border-color: var(--accent); outline: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
.rn-stop { border-color: color-mix(in srgb, var(--neg) 45%, var(--border-strong)); }

.rn-tete { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rn-nom  { font-size: 13.5px; font-weight: 620; }
.rn-bas  { display: flex; align-items: center; gap: 7px; }

.rn-compte {
    font-size: 11px; font-weight: 640; padding: 1px 7px; border-radius: 9px;
    background: var(--accent-soft); color: var(--accent);
}

.reseau-vide { position: absolute; inset: 0; display: grid; place-items: center; }

@media (max-width: 720px) {
    .reseau { height: 58vh; }
}

/* Séparateur entre les arbres et les membres arrivés seuls. */
.rn-titre {
    position: absolute; left: 0;
    font-size: 11.5px; font-weight: 640; letter-spacing: .07em;
    text-transform: uppercase; color: var(--text-faint);
    padding-bottom: 7px; white-space: nowrap;
}

/* Tranche pendant laquelle le marché était fermé.
   Un indigo franc : le silence y est normal, il ne doit donc ressembler ni à
   une présence (vert) ni à une absence (gris). Un simple hachuré du gris de
   fond ne se distinguait pas assez à cette taille de case. */
.mon-case.clos          { background: #4457a8; }
.dot-clos               { background: #4457a8; box-shadow: 0 0 0 3px rgba(68,87,168,.22); }
.mon-case.clos:hover    { background: #5a6fc9; }

/* --- Choix du moyen de règlement -------------------------------------- */

/* Des lignes plutôt que des vignettes : le logo, le nom et le montant se
   lisent d'un seul balayage, et l'ajout d'un moyen ne casse pas la grille. */
.moyens { display: flex; flex-direction: column; gap: 10px; }

.moyen {
    display: flex; align-items: center; gap: 14px; width: 100%;
    padding: 14px 16px; text-align: left; cursor: pointer;
    background: var(--surface-2, var(--surface)); color: var(--text);
    border: 1px solid var(--border); border-radius: 6px;
    font-family: inherit; font-size: 15px;
    transition: border-color .15s, background .15s, transform .12s;
}
.moyen:hover:not(:disabled) {
    border-color: var(--accent);
    transform: translateY(-1px);
}
.moyen:disabled { cursor: default; }
.moyen svg { flex: 0 0 auto; }
.moyen-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.moyen-txt b { font-weight: 620; }

/* Moyen annoncé mais pas encore ouvert. */
.moyen-off { opacity: .5; }
.moyen-off:hover { border-color: var(--border); transform: none; }

/* ---------------------------------------------------------------------- */
/* Premiers pas et aperçu de la stratégie                                  */
/*                                                                        */
/* Ces deux blocs ne s'affichent qu'avant la souscription. Ils doivent     */
/* guider sans culpabiliser : une étape faite s'efface visuellement, une   */
/* étape restante porte son bouton.                                       */
/* ---------------------------------------------------------------------- */

.jauge {
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.jauge > span {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width .35s ease;
}

.etape-pas {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 660;
    background: var(--surface-2);
    border: 1px solid var(--border-strong, var(--border));
    color: var(--text-dim);
}
.etape-pas.faite {
    background: var(--pos);
    border-color: var(--pos);
    color: #fff;
}

/* Les mois de la stratégie : une grille dense, lisible d'un coup d'œil. */
.mois-strat {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
    gap: 6px;
}
.ms {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 7px 4px;
    text-align: center;
}
.ms-l { display: block; font-size: 11px; color: var(--text-faint); }
.ms-v { display: block; font-size: 13.5px; font-weight: 640;
        font-variant-numeric: tabular-nums; margin-top: 2px; }

/* ---------------------------------------------------------------------- */
/* Bandeau d'aperçu                                                        */
/*                                                                        */
/* Volontairement voyant et non refermable : on ne doit jamais oublier     */
/* qu'on regarde l'espace de quelqu'un d'autre.                           */
/* ---------------------------------------------------------------------- */
.apercu-bandeau {
    /* Toute la largeur : sans cette ligne, le bandeau prend la colonne du
       menu et pousse celui-ci dans celle du contenu. */
    grid-column: 1 / -1;
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 9px 18px;
    background: var(--warn);
    color: #1a1204;
    font-size: 13px;
    line-height: 1.45;
}
.apercu-bandeau b { font-weight: 680; }
.apercu-bandeau a {
    color: #1a1204;
    font-weight: 660;
    text-decoration: underline;
    white-space: nowrap;
}

@font-face {
    font-family: "Marcellus";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/assets/fonts/marcellus-400.woff2") format("woff2");
    unicode-range: U+0000-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: "IBM Plex Mono";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/assets/fonts/plexmono-400.woff2") format("woff2");
    unicode-range: U+0000-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: "IBM Plex Mono";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/assets/fonts/plexmono-500.woff2") format("woff2");
    unicode-range: U+0000-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;
}

:root {
    --carte-serif: "Marcellus", "Times New Roman", Times, Georgia, serif;
    --carte-mono:  "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo,
                   Consolas, monospace;
}

/* --- Carte de membre -----------------------------------------------------
   Un objet, pas un encart. Elle ne suit pas le theme du lecteur : une carte
   est une matiere, et son metal ne change pas parce qu'on allume la lumiere.
   Les couleurs sont donc ecrites en dur, volontairement.

   Proportion ISO 7810 ID-1 : celle d'une carte qu'on tient. */
.xcarte {
    position: relative;
    aspect-ratio: 1.586;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 7% 7.5%;
    color: #e9ecf1;
    isolation: isolate;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .30), 0 18px 40px -16px rgba(0, 0, 0, .55);
}
.xcarte::after {
    /* La tranche : c'est elle qui fait exister l'objet. */
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .10);
    pointer-events: none;
}
.xca-mini { border-radius: 10px; }
.xca-mini::after { border-radius: 10px; }

.xca-tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.xca-pied { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; }

.xca-marque {
    font-family: var(--carte-serif);
    font-size: clamp(15px, 2.6cqw, 21px);
    letter-spacing: .04em;
    line-height: 1;
}
.xca-rang {
    font-family: var(--carte-mono);
    font-size: clamp(8px, 1.25cqw, 10px);
    letter-spacing: .24em;
    text-transform: uppercase;
    text-align: right;
    line-height: 1.5;
}
.xca-titulaire {
    font-weight: 500;
    font-size: clamp(11px, 1.85cqw, 15px);
    letter-spacing: .10em;
    text-transform: uppercase;
}
.xca-detail {
    font-family: var(--carte-mono);
    font-size: clamp(8px, 1.25cqw, 10.5px);
    letter-spacing: .10em;
    text-transform: uppercase;
    line-height: 1.7;
    opacity: .72;
}
.xca-montant {
    font-family: var(--carte-mono);
    font-size: clamp(10px, 1.6cqw, 13px);
    letter-spacing: .04em;
    text-align: right;
    line-height: 1.5;
    white-space: nowrap;
}
.xca-montant span { opacity: .70; }

/* Le numero occupe la carte, comme sur une lithographie numerotee. */
.xca-numero {
    font-family: var(--carte-mono);
    font-weight: 500;
    font-size: clamp(26px, 6.4cqw, 52px);
    letter-spacing: .04em;
    line-height: .95;
    margin-top: auto;
}
.xca-numero span {
    font-size: .34em;
    letter-spacing: .22em;
    display: block;
    opacity: .68;
    margin-bottom: 6px;
}

/* La dorure traverse le texte en degrade, comme un marquage a chaud attrape
   la lumiere. Elle ne touche que quatre endroits. */
.xca-foil {
    background-image: linear-gradient(104deg,
        #8a6b1f 0%, #c8a44c 26%, #ebd9a3 44%, #c8a44c 60%, #8a6b1f 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.xca-guilloche {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: .30;
    z-index: -1;
}

/* --- Les cinq matieres, du mat au grave --- */
.xca-decouverte {
    /* Plat, volontairement : ni grain brosse ni reflet. La seule carte de la
       serie qui ne renvoie pas la lumiere. */
    background: linear-gradient(158deg, #2a2f36 0%, #23272d 55%, #1c2025 100%);
    color: #c3c9d1;
}
.xca-decouverte .xca-marque, .xca-decouverte .xca-rang { color: #d7dce2; }
.xca-decouverte .xca-titulaire { color: #e6eaef; }
.xca-decouverte::after { border-color: rgba(255, 255, 255, .07); }

.xca-founder {
    background:
        radial-gradient(120% 90% at 12% 0%, #1b2028 0%, rgba(27, 32, 40, 0) 62%),
        linear-gradient(158deg, #141920 0%, #0e1116 46%, #090c10 100%);
}
.xca-founder .xca-titulaire { color: #f2f4f7; }

/* Chronometer : la seule carte claire d'une gamme entièrement en métaux
   sombres. Elle se remarque à l'ouverture du menu sans avoir à crier, et la
   croix reste le seul endroit coloré de l'objet. */
.xca-chronometer {
    background:
        repeating-linear-gradient(101deg,
            rgba(0, 0, 0, .022) 0 1px, rgba(0, 0, 0, 0) 1px 3px),
        linear-gradient(158deg, #ffffff 0%, #eff1f3 46%, #d6dade 100%);
    color: #14181c;
}
.xca-chronometer .xca-marque,
.xca-chronometer .xca-rang      { color: #10141a; }
.xca-chronometer .xca-titulaire { color: #0d1116; }
.xca-chronometer .xca-detail    { opacity: .62; }
.xca-chronometer::after         { border-color: rgba(0, 0, 0, .10); }

/* La croix se pose au milieu de la marge droite, au-dessus de la ligne de
   pied : plus bas, elle percuterait le montant. */
.xca-croix {
    position: absolute;
    right: 8%;
    top: 34%;
    width: 16cqw;
    height: 16cqw;
}

/* Sur les deux petits formats, la marge haute n'existe pas : la croix
   descend à mi-hauteur du bord droit, où rien ne la dispute. */
.xca-mini .xca-croix,
.xca-apercu .xca-croix {
    top: 50%;
    right: 6.5%;
    transform: translateY(-50%);
    width: 15cqw;
    height: 15cqw;
}

/* La mention d'origine, exactement comme sur un cadran de montre : centrée,
   minuscule, très espacée. Elle ne se lit pas de loin — elle se trouve. */
.xca-origine {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 3.4%;
    text-align: center;
    font-family: var(--carte-mono, ui-monospace, monospace);
    font-size: clamp(4.5px, 3.4cqw, 6.5px);
    letter-spacing: .42em;
    text-transform: uppercase;
    opacity: .5;
}

.xca-standard {
    background:
        repeating-linear-gradient(97deg,
            rgba(255, 255, 255, .028) 0 1px, rgba(0, 0, 0, 0) 1px 3px),
        linear-gradient(158deg, #565e67 0%, #4a5158 52%, #343a40 100%);
}
.xca-standard .xca-marque, .xca-standard .xca-rang { color: #e4e8ed; }

.xca-premium {
    background:
        repeating-linear-gradient(97deg,
            rgba(255, 255, 255, .045) 0 1px, rgba(0, 0, 0, 0) 1px 3px),
        linear-gradient(158deg, #b7bec5 0%, #9aa3ab 48%, #6e777f 100%);
    color: #1a1e24;
}
.xca-premium .xca-marque, .xca-premium .xca-rang { color: #10141a; }
.xca-premium .xca-titulaire { color: #0d1116; }
.xca-premium .xca-detail { opacity: .62; }
.xca-premium::after { border-color: rgba(255, 255, 255, .30); }

.xca-elite {
    background:
        radial-gradient(100% 120% at 82% 8%, rgba(127, 168, 201, .12) 0%, rgba(127, 168, 201, 0) 55%),
        linear-gradient(158deg, #0b0f14 0%, #05070a 60%, #020406 100%);
}
.xca-elite .xca-marque, .xca-elite .xca-rang { color: #7fa8c9; }
.xca-elite::after {
    border-color: rgba(127, 168, 201, .26);
    box-shadow: inset 0 0 0 3px rgba(127, 168, 201, .05);
}

/* --- Apercu d'une formule ------------------------------------------------
   Assez pour voir l'objet, pas assez pour croire l'avoir : la moitie basse
   reste le champ nu de la carte, et aucun nom n'y figure. */
.xca-apercu-hote {
    container-type: inline-size;
    width: 46%;
    min-width: 92px;
    max-width: 132px;
    margin-bottom: 12px;
}
.xca-apercu {
    /* L'ombre portee de la grande carte serait de trop a cette taille : elle
       ferait flotter une miniature au-dessus d'une tuile qui, elle, est plate. */
    box-shadow: 0 1px 2px rgba(0, 0, 0, .28);
    border-radius: 8px;
}
.xca-apercu::after { border-radius: 8px; }
.xca-apercu .xca-tete { gap: 5px; }
.xca-apercu .xca-marque { font-size: clamp(10px, 13cqw, 15px); }
.xca-apercu .xca-rang {
    font-size: clamp(5px, 5.4cqw, 8px);
    letter-spacing: .12em;
    /* Passer a la ligne plutot que d'etre tranche : un rang coupe en son
       milieu ne se lit pas, et la carte a de la place en hauteur. */
    white-space: normal;
    min-width: 0;
}
/* Une formule qui n'est pas encore ouverte se montre en retrait, comme le
   reste de sa tuile. */
.xca-eteint { opacity: .55; }

/* Les tailles de texte suivent la largeur de la carte et non celle de la
   fenetre : la vignette du menu et la grande carte sont le meme composant. */
.xca-hote { container-type: inline-size; }
.sidebar-foot .xca-hote { margin-bottom: 10px; }

/* --- Choix d'apparence (Mon compte) --------------------------------------
   Une palette se choisit à l'œil, pas au nom : chaque option porte un
   échantillon de ce qu'elle donnera — le fond, un trait, et la pastille
   d'accent qui est justement ce qui distingue les deux.

   Les échantillons sont écrits en dur et non avec les jetons courants :
   ils doivent montrer la palette proposée, pas celle qui est active. */
.choix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choix-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choix-opt {
    display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
    padding: 12px; text-align: left; cursor: pointer;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--r); color: var(--text); font: inherit;
    transition: border-color .14s, background .14s;
}
.choix-opt:hover { border-color: var(--border-strong); }
.choix-opt:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.choix-opt b { font-size: 13.5px; font-weight: 600; }
.choix-opt .hint { margin: 0; }
/* L'option retenue se double d'un trait : un simple fond teinté se
   remarque à peine quand l'accent est déjà discret. */
.choix-opt[aria-checked="true"] {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 1px var(--accent);
}
.choix-opt[aria-checked="true"] b::after {
    content: "\2713";
    margin-left: 6px; color: var(--accent); font-weight: 700;
}

/* Sélecteur du compte à régler. Même langage visuel que le choix
   d'apparence : le client reconnaît le geste d'un écran à l'autre. */
.cibles {
    display: grid; gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
}
.cible .badge { margin-top: 2px; }
.cible .hint  { margin-top: 2px; }

/* Formulaire encore fermé : aucune cible choisie. Il reste lisible — le
   client doit voir ce qui l'attend — mais rien n'y répond. */
.verrouille { opacity: .42; pointer-events: none; user-select: none; }

.choix-vue {
    width: 100%; height: 44px; margin-bottom: 7px; position: relative;
    border-radius: var(--r-sm); overflow: hidden;
    border: 1px solid rgba(127,127,127,.28);
}
.vue-fond { position: absolute; inset: 0; }
.vue-trait {
    position: absolute; left: 9px; right: 34px; top: 15px; height: 3px;
    border-radius: 2px; background: rgba(155,161,169,.55);
}
.vue-pastille {
    position: absolute; right: 9px; top: 11px; width: 18px; height: 18px;
    border-radius: 5px;
}
.vue-croix .vue-fond { background: linear-gradient(160deg, #191c20, #0b0c0e); }
.vue-croix .vue-pastille { background: #e4483b; }
.vue-granit .vue-fond { background: linear-gradient(160deg, #191c20, #0b0c0e); }
.vue-granit .vue-pastille { background: #e7e9ec; }
[data-theme="light"] .vue-croix .vue-fond,
[data-theme="light"] .vue-granit .vue-fond { background: linear-gradient(160deg, #ffffff, #eceef0); }
[data-theme="light"] .vue-croix .vue-pastille { background: #d52b1e; }
[data-theme="light"] .vue-granit .vue-pastille { background: #101214; }

@media (max-width: 560px) {
    .choix, .choix-3 { grid-template-columns: 1fr; }
    .choix-vue { height: 38px; }
}

/* =========================================================================
   Mise en route
   Un parcours en jalons, dont la plupart des étapes se valident sur constat.
   Les états ne sont pas décoratifs : « constaté » ne se clique pas, et une
   étape en attente ne doit jamais ressembler à une étape faite.
   ========================================================================= */

.avance { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.avance-chiffre {
    font-family: var(--mono); font-size: 26px; font-variant-numeric: tabular-nums;
}
.avance .jauge { flex: 1 1 220px; }

.jalon { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.jalon + .jalon { margin-top: 12px; }
.jalon-tete {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.jalon-num {
    flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center; font-size: 12px; font-weight: 660;
    background: var(--surface-3); border: 1px solid var(--border-strong);
    color: var(--text-dim);
}
.jalon.fini .jalon-num { background: var(--pos); border-color: var(--pos); color: var(--bg); }
.jalon.encours .jalon-num {
    background: var(--accent); border-color: var(--accent); color: var(--sur-accent, #fff);
}
.jalon-tete h3 { font-size: 14.5px; }
.jalon-tete .sous { font-size: 12px; color: var(--text-dim); }
.jalon-corps { padding: 4px 16px 14px; }

/* --- Le jalon est un <details> ---------------------------------------
   Le dépliement est donc natif et survit à un script qui ne se charge pas.
   Reste à effacer la flèche que le navigateur dessine lui-même, et à lui
   substituer un chevron qui suit le thème. */
.jalon > summary { list-style: none; cursor: pointer; user-select: none; }
.jalon > summary::-webkit-details-marker { display: none; }
.jalon > summary::marker { content: ''; }
.jalon > summary:hover { background: var(--surface-2); }
.jalon > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.jalon:not([open]) > summary { border-bottom: 0; }
.jalon-nom { min-width: 0; }

.jalon-etat {
    margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none;
}
.jalon-reste, .jalon-duree, .jalon-cout {
    font-family: var(--mono); font-size: 11.5px; font-variant-numeric: tabular-nums;
    color: var(--text-faint);
}
/* Le coût ne se découvre pas au milieu d'une manipulation : il est annoncé
   sur le bandeau, avant même qu'on ouvre l'étape. */
.jalon-cout { color: var(--warn); }
.jalon-chevron {
    width: 16px; height: 16px; flex: none; color: var(--text-faint);
    transition: transform .18s;
}
.jalon[open] > summary .jalon-chevron { transform: rotate(180deg); color: var(--text-dim); }

/* Le texte d'ouverture du jalon : ce qu'on dirait à l'oral avant de montrer. */
.jalon-dit {
    font-size: 13.5px; line-height: 1.65; color: var(--text-dim);
    margin: 14px 0 4px; max-width: 70ch;
}
.jalon-dit b { color: var(--text); font-weight: 600; }
.jalon-note {
    font-size: 13px; line-height: 1.6; color: var(--text-dim); margin: 8px 0 0;
    padding: 10px 12px; border-radius: var(--r-sm);
    background: var(--surface-2); border: 1px solid var(--border);
}

/* --- La vidéo du jalon -----------------------------------------------
   Pleine largeur mais bornée : au-delà, elle avale la liste des points et
   l'étape n'a plus l'air d'en avoir. Comme celle d'une étape, le lecteur
   n'est posé qu'au clic. */
.jalon-video {
    margin-top: 14px; max-width: 620px; border: 1px solid var(--border);
    border-radius: var(--r-sm); overflow: hidden; background: var(--surface-3);
}
.jalon-video-declic {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 14px 16px; cursor: pointer; font: inherit; font-size: 13.5px;
    font-weight: 600; background: none; border: 0; color: var(--text); text-align: left;
}
.jalon-video-declic:hover { background: var(--surface-2); }
.jalon-video-declic .lire {
    flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center; font-size: 12px;
    background: var(--accent); color: var(--sur-accent, #fff);
}
.jalon-video-cadre { display: none; aspect-ratio: 16 / 9; background: #000; }
.jalon-video.on .jalon-video-cadre { display: block; }
.jalon-video.on .jalon-video-declic .lire { background: var(--surface-3); color: var(--text-dim); }
.jalon-video-cadre iframe { width: 100%; height: 100%; border: 0; display: block; }

@media (max-width: 560px) {
    .jalon-duree, .jalon-cout { display: none; }
}

.pas { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.pas:last-child { border-bottom: 0; }
.pas-case {
    flex: 0 0 auto; width: 22px; height: 22px; margin-top: 1px; border-radius: 6px;
    display: grid; place-items: center; font-size: 12px; font-weight: 700;
    background: var(--surface-3); border: 1px solid var(--border-strong);
    color: var(--text-faint); font-family: inherit; padding: 0;
}
button.pas-case { cursor: pointer; }
button.pas-case:hover { border-color: var(--accent); }
button.pas-case:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.pas.fait .pas-case { background: var(--pos); border-color: var(--pos); color: var(--bg); }

.pas-corps { min-width: 0; flex: 1 1 auto; }
.pas-titre {
    font-size: 13.5px; font-weight: 600;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.pas.fait .pas-titre { color: var(--text-dim); }
.pas-dit { font-size: 13px; color: var(--text-dim); margin-top: 4px; line-height: 1.6; }
.pas-dit b { color: var(--text); font-weight: 600; }
.pas-dit code {
    background: var(--surface-3); border: 1px solid var(--border);
    padding: 1px 5px; border-radius: 4px; font-size: 12px; font-family: var(--mono);
}
.pas-preuve {
    display: inline-flex; align-items: center; gap: 6px; margin-top: 7px;
    font-family: var(--mono); font-size: 11px; letter-spacing: .04em; color: var(--pos);
}
.pas-preuve.pas-attente { color: var(--text-faint); }
.pas-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 9px; }

/* Le lecteur n'est posé qu'au clic : cinq cadres distants chargés d'emblée
   ralentiraient une page que la plupart parcourent sans en ouvrir aucun. */
.pas-video {
    margin-top: 10px; border: 1px solid var(--border); border-radius: var(--r-sm);
    overflow: hidden; background: var(--surface-3);
}
.pas-video-declic {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 10px 12px; cursor: pointer; font: inherit; font-size: 13px;
    background: none; border: 0; color: var(--text); text-align: left;
}
.pas-video-declic:hover { background: var(--surface-2); }
.pas-video-declic .lire {
    flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center; font-size: 10px;
    background: var(--accent); color: var(--sur-accent, #fff);
}
.pas-video-cadre { display: none; aspect-ratio: 16 / 9; background: #000; }
.pas-video.on .pas-video-cadre { display: block; }
.pas-video-cadre iframe { width: 100%; height: 100%; border: 0; display: block; }

/* Le trajet d'un signal, sur la page « Comment ça marche ». */
.fil { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fil-etape {
    border: 1px solid var(--border); border-radius: var(--r-sm);
    padding: 13px; background: var(--surface-2);
}
.fil-etape .num {
    font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
    color: var(--accent); display: block; margin-bottom: 6px;
}
.fil-etape h4 { font-size: 13px; margin-bottom: 5px; }
.fil-etape p { font-size: 12.5px; color: var(--text-dim); margin: 0; line-height: 1.6; }

@media (max-width: 860px) {
    .fil { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .voies { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .fil { grid-template-columns: 1fr; }
}

/* Vignette de moyen de paiement à titre indicatif : mêmes repères visuels
   que celles du règlement, mais rien à cliquer. Sans facture il n'y a ni
   montant à convertir ni adresse à produire — le curseur doit le dire. */
.moyen-inerte { cursor: default; opacity: .85; }
/* Deux classes pour passer devant .moyen:hover:not(:disabled), qui vaut
   autant a specificite egale et gagnerait sinon par son ordre. */
.moyen.moyen-inerte:hover {
    border-color: var(--border); transform: none;
    background: var(--surface-2, var(--surface));
}
