/* Portail — feuille unique. Jetons d'abord (clair, puis sombre), puis composants. */
:root {
  color-scheme: light dark;
  --papier: #f4f1ea;
  --papier-2: #ebe7de;
  --carte: #fffdf8;
  --encre: #1c1a17;
  --encre-2: #585349;
  --encre-3: #6b655a;
  --trait: #e0dacf;
  --trait-2: #cbc3b5;
  --accent: #3b4f9b;
  --accent-2: #2c3c78;
  --accent-doux: #e3e7f6;
  --accent-encre: #fff;
  --danger: #b4432c;
  --danger-doux: #f8e3dd;
  --ok: #2f7f6f;
  --ok-doux: #dcefe9;
  --selection: #cdd5f1;
  --ombre: 0 1px 2px rgba(28, 26, 23, .05), 0 10px 28px -14px rgba(28, 26, 23, .22);
  --ombre-haute: 0 2px 4px rgba(28, 26, 23, .06), 0 18px 40px -16px rgba(28, 26, 23, .3);
  --rayon: 14px;
  --rayon-s: 9px;
  --police: "Avenir Next", "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", Menlo, Consolas, monospace;
  /* teintes d'app : --c = fond du monogramme (texte blanc), --c-doux = halo */
  --ardoise: #4b5563; --ardoise-doux: #e4e6ea;
  --sauge: #2f7a65;   --sauge-doux: #dbeee7;
  --ocre: #a06a16;    --ocre-doux: #f6e9d1;
  --brique: #b3462f;  --brique-doux: #f7e1db;
  --prune: #7a3e7c;   --prune-doux: #efe0ef;
  --marine: #2e4f8f;  --marine-doux: #dfe6f5;
  --cuivre: #9a5a2a;  --cuivre-doux: #f3e4d8;
  --olive: #66752a;   --olive-doux: #e8ecd6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --papier: #17161a;
    --papier-2: #1f1e24;
    --carte: #232228;
    --encre: #ece8e0;
    --encre-2: #b9b3a8;
    --encre-3: #948d82;
    --trait: #34323b;
    --trait-2: #46434e;
    --accent: #93a3e8;
    --accent-2: #b0bdf2;
    --accent-doux: #2a3152;
    --accent-encre: #15192e;
    --danger: #e08a78;
    --danger-doux: #4a2620;
    --ok: #7cc4b3;
    --ok-doux: #1f3a34;
    --selection: #3a4470;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .6);
    --ombre-haute: 0 2px 4px rgba(0, 0, 0, .35), 0 18px 40px -16px rgba(0, 0, 0, .7);
    --ardoise-doux: #2f333c; --sauge-doux: #1d3a32; --ocre-doux: #3e2f14; --brique-doux: #422119;
    --prune-doux: #3a2140; --marine-doux: #1f2c4d; --cuivre-doux: #3c2816; --olive-doux: #2c3318;
  }
}
[data-couleur="ardoise"] { --c: var(--ardoise); --c-doux: var(--ardoise-doux); }
[data-couleur="sauge"]   { --c: var(--sauge);   --c-doux: var(--sauge-doux); }
[data-couleur="ocre"]    { --c: var(--ocre);    --c-doux: var(--ocre-doux); }
[data-couleur="brique"]  { --c: var(--brique);  --c-doux: var(--brique-doux); }
[data-couleur="prune"]   { --c: var(--prune);   --c-doux: var(--prune-doux); }
[data-couleur="marine"]  { --c: var(--marine);  --c-doux: var(--marine-doux); }
[data-couleur="cuivre"]  { --c: var(--cuivre);  --c-doux: var(--cuivre-doux); }
[data-couleur="olive"]   { --c: var(--olive);   --c-doux: var(--olive-doux); }

/* ---- base ---- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--police); color: var(--encre); background: var(--papier); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
::selection { background: var(--selection); color: var(--encre); }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.012em; text-wrap: balance; }
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0 0 .6em; }
.muted { color: var(--encre-3); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; left: -9999px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---- boutons et champs ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: var(--rayon-s); border: 1px solid var(--trait-2); background: var(--carte); color: var(--encre); cursor: pointer; font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .15s; }
.btn:hover { border-color: var(--encre-3); background: var(--papier-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primaire { background: var(--accent); border-color: var(--accent); color: var(--accent-encre); }
.btn.primaire:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { color: var(--danger); border-color: var(--danger-doux); background: var(--danger-doux); }
.btn.danger:hover { border-color: var(--danger); }
.btn.discret { border-color: transparent; background: transparent; color: var(--encre-2); }
.btn.discret:hover { background: var(--papier-2); color: var(--encre); }
.btn.petit { min-height: 32px; padding: 0 10px; font-size: 14px; }
.btn.icone { width: 36px; min-height: 36px; padding: 0; border-color: transparent; background: transparent; color: var(--encre-2); }
.btn.icone:hover { background: var(--papier-2); color: var(--encre); }
.btn.icone svg { width: 18px; height: 18px; }
.btn.chargement { position: relative; color: transparent; }
.btn.chargement::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; color: var(--accent-encre); animation: tourne .7s linear infinite; }
.btn:not(.primaire).chargement::after { color: var(--encre-2); }
@keyframes tourne { to { transform: rotate(360deg); } }

input[type="text"], input[type="password"], input[type="url"], textarea, select {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--rayon-s); border: 1px solid var(--trait-2); background: var(--carte); color: var(--encre); caret-color: var(--accent); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 72px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--encre-3); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); }
input[aria-invalid="true"] { border-color: var(--danger); }
.champ { display: grid; gap: 6px; }
.champ > label { font-size: 14px; font-weight: 600; color: var(--encre-2); }
.champ .aide { font-size: 13px; color: var(--encre-3); }
.champ.ligne { grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.champ.ligne > label { font-weight: 500; color: var(--encre); }
.interrupteur { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.interrupteur input { position: absolute; opacity: 0; width: 0; height: 0; }
.interrupteur .piste { width: 40px; height: 24px; border-radius: 999px; background: var(--trait-2); position: relative; transition: background .15s; flex: none; }
.interrupteur .piste::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.interrupteur input:checked + .piste { background: var(--accent); }
.interrupteur input:checked + .piste::after { transform: translateX(16px); }
.interrupteur input:focus-visible + .piste { outline: 2px solid var(--accent); outline-offset: 2px; }
.interrupteur input:disabled + .piste { opacity: .5; }

.chip { display: inline-flex; align-items: center; white-space: nowrap; min-height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .01em; background: var(--papier-2); color: var(--encre-2); }
.chip.accent { background: var(--accent-doux); color: var(--accent-2); }
.chip.ok { background: var(--ok-doux); color: var(--ok); }
.chip.danger { background: var(--danger-doux); color: var(--danger); }
.erreur { color: var(--danger); background: var(--danger-doux); padding: 10px 12px; border-radius: var(--rayon-s); font-size: 14px; }

/* ---- connexion ---- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; }
.login-boite { width: min(400px, 100%); display: grid; gap: 22px; }
.login-marque { display: flex; align-items: center; gap: 12px; }
.login-marque .logo { width: 44px; height: 44px; }
.login-marque b { font-size: 22px; letter-spacing: -.01em; }
.login-marque small { display: block; color: var(--encre-3); font-size: 14px; font-weight: 400; }
.login form { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 24px; display: grid; gap: 16px; box-shadow: var(--ombre); }
.login form .btn { min-height: 46px; margin-top: 4px; }
.login .pied { color: var(--encre-3); font-size: 14px; text-align: center; }

/* ---- coque ---- */
.coque { min-height: 100vh; display: flex; flex-direction: column; }
.barre { display: flex; align-items: center; gap: 12px; padding: 12px max(16px, env(safe-area-inset-left)) 12px max(16px, env(safe-area-inset-right)); border-bottom: 1px solid var(--trait); background: var(--papier); position: sticky; top: 0; z-index: 5; }
.barre .marque { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; color: var(--encre); }
.barre .marque:hover { text-decoration: none; }
.barre .marque .logo { width: 28px; height: 28px; }
.barre .onglets { display: flex; gap: 2px; margin-left: 8px; }
.barre .onglets a { padding: 7px 11px; border-radius: 999px; color: var(--encre-2); font-weight: 500; font-size: 15px; }
.barre .onglets a:hover { background: var(--papier-2); text-decoration: none; }
.barre .onglets a.actif { background: var(--accent-doux); color: var(--accent-2); }
.barre .qui { margin-left: auto; position: relative; }
.barre .qui > button { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 6px 0 4px; border-radius: 999px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--encre); }
.barre .qui > button:hover, .barre .qui > button[aria-expanded="true"] { background: var(--papier-2); border-color: var(--trait); }
.barre .qui > button svg { width: 16px; height: 16px; color: var(--encre-3); }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-encre); font-size: 12px; font-weight: 700; letter-spacing: .02em; flex: none; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon-s); box-shadow: var(--ombre-haute); padding: 6px; display: grid; z-index: 20; transform-origin: top right; animation: surgit .14s cubic-bezier(.2, .8, .2, 1); }
.menu .qui-menu { padding: 8px 10px 10px; border-bottom: 1px solid var(--trait); margin-bottom: 6px; font-size: 14px; color: var(--encre-2); }
.menu .qui-menu b { display: block; color: var(--encre); font-size: 15px; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 6px; border: 0; background: none; color: var(--encre); cursor: pointer; font-size: 15px; }
.menu a:hover, .menu button:hover { background: var(--papier-2); text-decoration: none; }
.menu svg { width: 16px; height: 16px; color: var(--encre-3); }
@keyframes surgit { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.contenu { flex: 1; width: 100%; max-width: 880px; margin: 0 auto; padding: 28px max(16px, env(safe-area-inset-left)) 64px max(16px, env(safe-area-inset-right)); }
.entete { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.entete .sous { color: var(--encre-3); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- accueil : une carte par groupe, apps en haut, liens web en bas ---- */
.app-liste.liens { gap: 6px; flex: 0 0 auto; }
.app-liste.liens.apres { margin-top: 18px; padding-top: 14px; border-top: 1px dashed color-mix(in srgb, var(--c) 35%, var(--trait)); }
.app-lien.lien-web { min-height: 34px; padding: 6px 10px; font-size: 13px; font-weight: 500; color: var(--encre-2); background: transparent; }
.app-lien.lien-web:hover { color: var(--encre); background: var(--carte); }
.app-lien.lien-web .app-pastille { width: 18px; height: 18px; font-size: 8px; box-shadow: none; background: color-mix(in srgb, var(--c) 70%, var(--carte)); }
.contenu.large { max-width: 1600px; }
.bento { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; align-items: stretch; }
.bento.peu { grid-template-columns: repeat(auto-fit, minmax(240px, 420px)); }
.carte { position: relative; overflow: hidden; display: flex; flex-direction: column; background: var(--carte); border: 1px solid var(--trait); border-radius: 20px; padding: 18px; box-shadow: var(--ombre); transition: transform .22s cubic-bezier(.2, .8, .2, 1), box-shadow .22s; }
.carte:hover { transform: translateY(-3px); box-shadow: 0 20px 50px -20px color-mix(in srgb, var(--c) 50%, transparent), var(--ombre); }
.carte-fond { position: absolute; inset: 0; z-index: 0; opacity: .5; background: radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--c) 22%, transparent), transparent 60%); pointer-events: none; }
.carte > * { position: relative; z-index: 1; }
.carte-tete { display: flex; align-items: center; gap: 10px; }
.carte-logo { width: 46px; height: 46px; flex: none; background: var(--c); border-radius: 13px; display: grid; place-items: center; padding: 8px; box-shadow: 0 6px 18px -6px var(--c), 0 0 0 1px rgba(0,0,0,.05); overflow: hidden; color: #fff; }
.carte-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.carte-logo.invert img { filter: brightness(0) invert(1); }
.carte-initiale { font-weight: 700; font-size: 20px; }
.carte-titres { flex: 1; min-width: 0; }
.carte-titre { font-size: 16px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.carte-compte { font-size: 11px; font-weight: 600; letter-spacing: .05em; background: color-mix(in srgb, var(--c) 16%, transparent); color: color-mix(in srgb, var(--c) 70%, var(--encre)); padding: 3px 8px; border-radius: 99px; flex: none; }
.app-liste { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.app-lien { display: flex; align-items: center; gap: 9px; padding: 9px 10px; background: color-mix(in srgb, var(--encre) 3%, transparent); border: 1px solid transparent; border-radius: 11px; color: var(--encre); font-size: 13.5px; font-weight: 500; min-height: 40px; transition: background .15s, border-color .15s, box-shadow .15s, transform .15s; }
.app-lien:hover { text-decoration: none; background: var(--carte); border-color: color-mix(in srgb, var(--c) 50%, transparent); box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--c) 40%, transparent); transform: translateX(2px); }
.app-pastille { width: 22px; height: 22px; border-radius: 50%; background: var(--c); color: #fff; flex: none; display: grid; place-items: center; font-size: 9px; font-weight: 700; letter-spacing: .02em; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 20%, transparent); transition: box-shadow .15s; }
.app-lien:hover .app-pastille { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 30%, transparent); }
.app-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-meta { font-size: 10px; color: var(--encre-3); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; flex: none; }
@media (prefers-color-scheme: dark) {
  .app-lien { background: rgba(255,255,255,.04); }
  .app-lien:hover { background: rgba(255,255,255,.08); }
}
@media (max-width: 640px) { .bento { grid-template-columns: 1fr; } .carte { border-radius: 16px; padding: 16px; } }
.bonjour { margin-bottom: 26px; }
.bonjour h1 { font-size: clamp(28px, 4vw, 34px); }
.bonjour .sous { color: var(--encre-3); margin-top: 4px; font-size: 16px; }
.outils { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 640px) { .outils { grid-template-columns: 1fr 1fr; gap: 12px; } }
.outil { display: flex; align-items: center; gap: 14px; padding: 14px 16px 14px 14px; background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); color: var(--encre); min-height: 76px; box-shadow: var(--ombre); transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s, border-color .18s; }
.outil:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--ombre-haute); border-color: var(--c, var(--trait-2)); }
.outil:active { transform: translateY(0); }
.outil .mono { width: 46px; height: 46px; border-radius: 12px; background: var(--c); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 17px; letter-spacing: .01em; flex: none; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.outil .texte { min-width: 0; flex: 1; }
.outil .texte > b { display: block; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.outil .texte > span { display: block; color: var(--encre-3); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outil .fleche { width: 20px; height: 20px; color: var(--encre-3); flex: none; transition: transform .18s, color .18s; }
.outil:hover .fleche { color: var(--c); transform: translateX(2px); }
.vide { border: 1px dashed var(--trait-2); border-radius: var(--rayon); padding: 36px 24px; text-align: center; color: var(--encre-3); display: grid; gap: 6px; justify-items: center; }
.vide svg { width: 36px; height: 36px; color: var(--trait-2); margin-bottom: 6px; }
.vide b { color: var(--encre-2); font-weight: 600; }
.squelette { display: grid; gap: 10px; }
.squelette div { height: 76px; border-radius: var(--rayon); background: linear-gradient(90deg, var(--papier-2), var(--carte), var(--papier-2)); background-size: 200% 100%; animation: brille 1.2s ease-in-out infinite; }
@keyframes brille { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---- blocs et tableaux ---- */
.bloc { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 20px; box-shadow: var(--ombre); }
.bloc + .bloc { margin-top: 16px; }
.bloc h2 { margin-bottom: 14px; }
.tableau { width: 100%; border-collapse: collapse; font-size: 15px; }
.tableau th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--encre-3); font-weight: 600; padding: 0 10px 10px; border-bottom: 1px solid var(--trait); }
.tableau td { padding: 11px 10px; border-bottom: 1px solid var(--trait); vertical-align: middle; }
.tableau tr:last-child td { border-bottom: 0; }
.tableau tr.inactif td { color: var(--encre-3); }
.tableau .acts { text-align: right; white-space: nowrap; }
.tableau .acts .btn + .btn { margin-left: 4px; }
.defile { overflow-x: auto; margin: 0 -20px; padding: 0 20px; -webkit-overflow-scrolling: touch; }
.ligne-app { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ligne-app .mono { width: 34px; height: 34px; border-radius: 9px; background: var(--c); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.ligne-app .texte { min-width: 0; }
.ligne-app .texte > b { display: block; font-weight: 600; }
.ligne-app .texte > span { display: block; color: var(--encre-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 44ch; }
.personne { display: flex; align-items: center; gap: 10px; }
.personne .texte > b { display: block; font-weight: 600; white-space: nowrap; }
.personne .texte > span { display: block; color: var(--encre-3); font-size: 13px; font-family: var(--mono); }

/* ---- grille des accès ---- */
.grille { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; }
.grille th, .grille td { padding: 10px; border-bottom: 1px solid var(--trait); }
.grille thead th { position: sticky; top: 0; background: var(--carte); z-index: 1; vertical-align: bottom; text-align: center; font-weight: 600; font-size: 14px; }
.grille thead th:first-child, .grille tbody th { position: sticky; left: 0; background: var(--carte); text-align: left; font-weight: 600; z-index: 2; }
.grille thead th:first-child { z-index: 3; }
.grille thead th .mono { width: 30px; height: 30px; border-radius: 8px; background: var(--c); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; margin: 0 auto 6px; }
.grille td { text-align: center; }
.grille tbody tr:hover th, .grille tbody tr:hover td { background: var(--papier-2); }
.grille tr.inactif th { color: var(--encre-3); }
.case { appearance: none; width: 24px; height: 24px; border-radius: 7px; border: 1.5px solid var(--trait-2); background: var(--carte); cursor: pointer; display: inline-grid; place-items: center; vertical-align: middle; transition: background .12s, border-color .12s; position: relative; }
.case:hover { border-color: var(--encre-3); }
.case:checked { background: var(--accent); border-color: var(--accent); }
.case:checked::after { content: ""; width: 6px; height: 11px; border: solid var(--accent-encre); border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
.case:disabled { opacity: .4; cursor: default; }
.case.attente { opacity: .6; }
.grille-mobile { display: none; }
@media (max-width: 640px) {
  .grille-bureau { display: none; }
  .grille-mobile { display: grid; gap: 14px; }
  .grille-mobile .bloc { padding: 16px; }
  .grille-mobile .bloc h3 { margin-bottom: 8px; }
  .grille-mobile label { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--trait); cursor: pointer; }
  .grille-mobile label .ligne-app { flex: 1; }
}

/* ---- pastilles de couleur (formulaire app) ---- */
.couleurs { display: flex; gap: 8px; flex-wrap: wrap; }
.couleurs label { position: relative; width: 32px; height: 32px; border-radius: 9px; background: var(--c); cursor: pointer; display: grid; place-items: center; }
.couleurs input { position: absolute; opacity: 0; width: 0; height: 0; }
.couleurs label::after { content: ""; position: absolute; inset: -4px; border-radius: 12px; border: 2px solid transparent; transition: border-color .12s; }
.couleurs input:checked + span::after, .couleurs label:has(input:checked)::after { border-color: var(--encre); }
.couleurs label:has(input:focus-visible)::after { border-color: var(--accent); }

/* ---- mot de passe à montrer une fois ---- */
.secret { display: flex; align-items: center; gap: 10px; background: var(--papier-2); border-radius: var(--rayon-s); padding: 12px 14px; font-family: var(--mono); font-size: 20px; letter-spacing: .06em; justify-content: space-between; }

/* ---- modales et toasts ---- */
.modale-fond { position: fixed; inset: 0; background: rgba(20, 18, 16, .45); display: grid; place-items: end center; z-index: 50; padding: 0; animation: fond .15s; }
@media (min-width: 640px) { .modale-fond { place-items: center; padding: 24px; } }
@keyframes fond { from { opacity: 0; } }
.modale { width: min(480px, 100%); max-height: 92vh; overflow: auto; background: var(--carte); border-radius: var(--rayon) var(--rayon) 0 0; box-shadow: var(--ombre-haute); animation: monte .2s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; }
@media (min-width: 640px) { .modale { border-radius: var(--rayon); } .modale.large { width: min(640px, 100%); } }
@keyframes monte { from { transform: translateY(12px); opacity: 0; } }
.modale .tete { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; }
.modale .corps { padding: 16px 20px 20px; display: grid; gap: 14px; }
.modale .pied { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); flex-wrap: wrap; }
#toasts { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast { background: var(--encre); color: var(--papier); padding: 11px 14px; border-radius: var(--rayon-s); box-shadow: var(--ombre-haute); font-size: 14px; animation: monte .2s cubic-bezier(.2, .8, .2, 1); }
.toast.erreur { background: var(--danger); color: #fff; }
.segments { display: inline-flex; background: var(--papier-2); border-radius: 999px; padding: 3px; gap: 2px; }
.segments button, .segments a { border: 0; color: var(--encre-2); text-decoration: none; background: none; padding: 6px 12px; border-radius: 999px; cursor: pointer; color: var(--encre-2); font-weight: 500; font-size: 14px; }
.segments button.actif, .segments a.actif { background: var(--carte); color: var(--encre); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

@media (max-width: 640px) {
  .contenu { padding-top: 20px; }
  h1 { font-size: 24px; }
  .barre .onglets { display: none; }
  .masque-mobile { display: none !important; }
  .bloc { padding: 16px; }
  .defile { margin: 0 -16px; padding: 0 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
