/* Neo : interface web (client de l'API). Thème sombre par défaut + clair, police Geist servie par Neo. */
@font-face { font-family: Geist; src: url('/polices/Geist-Variable.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/polices/GeistMono-Variable.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root, [data-theme="sombre"] {
  --bg: #0B0C0F; --bg2: #101115; --panel: #15161A; --panel2: #1B1C21; --panel3: #23242A;
  --bord: rgba(255,255,255,.07); --bord2: rgba(255,255,255,.12);
  --texte: #ECEDEF; --texte2: #A1A3AD; --texte3: #6C6E78;
  --accent: #2A6BFF; --accent2: #5B8CFF; --accent-txt: #7FA6FF; --accent-doux: rgba(42,107,255,.14); --accent-bord: rgba(42,107,255,.35);
  --vert: #3DD68C; --vert-doux: rgba(61,214,140,.12);
  --orange: #F5A524; --orange-doux: rgba(245,165,36,.13);
  --rouge: #F3322C; --rouge-doux: rgba(243,50,44,.13);
  --ombre: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px -12px rgba(0,0,0,.5);
  --ombre-haute: 0 24px 64px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06);
  --halo: radial-gradient(600px 300px at 50% -80px, rgba(42,107,255,.16), transparent 70%);
  --voile: rgba(0,0,0,.55);
  color-scheme: dark;
}
[data-theme="clair"] {
  --bg: #FAFAFB; --bg2: #F3F4F6; --panel: #FFFFFF; --panel2: #F5F6F8; --panel3: #ECEEF2;
  --bord: rgba(15,18,30,.08); --bord2: rgba(15,18,30,.14);
  --texte: #0F1117; --texte2: #555A66; --texte3: #8A8F9C;
  --accent: #2A6BFF; --accent2: #2A6BFF; --accent-txt: #1F5BEB; --accent-doux: rgba(42,107,255,.08); --accent-bord: rgba(42,107,255,.3);
  --vert: #12A150; --vert-doux: rgba(18,161,80,.09);
  --orange: #C27803; --orange-doux: rgba(194,120,3,.1);
  --rouge: #D92B25; --rouge-doux: rgba(217,43,37,.08);
  --ombre: 0 1px 2px rgba(15,18,30,.04), 0 6px 20px -8px rgba(15,18,30,.1);
  --ombre-haute: 0 24px 64px rgba(15,18,30,.18), 0 0 0 1px rgba(15,18,30,.08);
  --halo: radial-gradient(600px 300px at 50% -80px, rgba(42,107,255,.08), transparent 70%);
  --voile: rgba(15,18,30,.35);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Geist, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--texte); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent-txt); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent-doux); }
.mono { font-family: "Geist Mono", ui-monospace, monospace; }
.cache { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.ico { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico.xs { width: 13px; height: 13px; stroke-width: 2; }
.ico.lg { width: 20px; height: 20px; }
kbd { font-family: "Geist Mono", monospace; font-size: 10.5px; line-height: 16px; padding: 0 5px; border: 1px solid var(--bord2); border-bottom-width: 2px; border-radius: 5px; color: var(--texte3); background: var(--panel2); }

/* Logo */
.logo { width: 28px; height: 28px; border-radius: 9px; flex: none; display: grid; place-items: center; color: #fff; font-weight: 750; font-size: 15px; letter-spacing: -.6px;
  background: linear-gradient(145deg, #4C86FF 0%, #2A6BFF 55%, #1B4FD1 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 4px 14px -4px rgba(42,107,255,.7); }
.logo.sm { width: 22px; height: 22px; border-radius: 7px; font-size: 12px; }
.logo.xl { width: 52px; height: 52px; border-radius: 16px; font-size: 27px; }
.marque { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 15px; letter-spacing: -.2px; }

/* Boutons et champs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 9px;
  border: 1px solid var(--bord2); background: var(--panel); color: var(--texte); font-weight: 500; font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background .15s, transform .1s, border-color .15s, opacity .15s; }
.btn:hover { background: var(--panel2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primaire { background: var(--accent); border-color: transparent; color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.2); }
.btn.primaire:hover { background: #3A77FF; }
.btn.danger { color: var(--rouge); border-color: color-mix(in srgb, var(--rouge) 35%, transparent); background: var(--rouge-doux); }
.btn.fantome { border-color: transparent; background: transparent; color: var(--texte2); }
.btn.fantome:hover { background: var(--panel2); color: var(--texte); }
.btn.carre { width: 34px; padding: 0; }
.btn.petit { height: 28px; padding: 0 9px; font-size: 12px; }
.btn.petit.carre { width: 28px; }
.btn.large { width: 100%; height: 40px; font-size: 14px; }

.champ { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.champ label, .etiquette { font-size: 12.5px; font-weight: 550; color: var(--texte2); }
.champ .aide { font-size: 12px; color: var(--texte3); }
.entree, select.entree, textarea.entree {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--bord2); background: var(--panel2); outline: none;
  transition: border-color .15s, box-shadow .15s; }
textarea.entree { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.entree:focus { border-color: var(--accent-bord); box-shadow: 0 0 0 3px var(--accent-doux); }
.entree.code { font-family: "Geist Mono", monospace; font-size: 20px; letter-spacing: 6px; text-align: center; height: 48px; }
.case { display: flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; padding: 4px 0; }
.case input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

/* Pastilles et badges */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--bord2);
  background: var(--panel); color: var(--texte2); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
button.pill { cursor: pointer; }
button.pill:hover { color: var(--texte); border-color: var(--accent-bord); }
.pill .point { width: 6px; height: 6px; border-radius: 50%; background: var(--vert); box-shadow: 0 0 0 3px var(--vert-doux); }
.pill.accent { color: var(--accent-txt); border-color: var(--accent-bord); background: var(--accent-doux); }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11.5px; font-weight: 550; background: var(--panel3); color: var(--texte2); white-space: nowrap; }
.badge.vert { background: var(--vert-doux); color: var(--vert); }
.badge.orange { background: var(--orange-doux); color: var(--orange); }
.badge.rouge { background: var(--rouge-doux); color: var(--rouge); }
.badge.bleu { background: var(--accent-doux); color: var(--accent-txt); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 650; color: #fff; flex: none; background: linear-gradient(135deg, #7C5CFF, #2A6BFF); }
.inter { width: 34px; height: 20px; border-radius: 99px; background: var(--panel3); border: 1px solid var(--bord2); position: relative; flex: none; cursor: pointer; transition: background .2s; padding: 0; }
.inter::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--texte3); transition: transform .2s cubic-bezier(.3,.7,.4,1), background .2s; }
.inter[aria-checked="true"] { background: var(--accent); border-color: transparent; }
.inter[aria-checked="true"]::after { transform: translateX(14px); background: #fff; }

/* Animations */
.curseur { display: inline-block; width: 7px; height: 15px; border-radius: 2px; background: var(--accent); vertical-align: -2px; margin-left: 2px; animation: cligne 1s steps(2) infinite; }
@keyframes cligne { 50% { opacity: 0; } }
.miroite { background: linear-gradient(90deg, var(--texte3) 0%, var(--texte) 45%, var(--texte3) 90%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: miroite 1.8s linear infinite; }
@keyframes miroite { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.apparait { animation: apparait .4s cubic-bezier(.2,.7,.3,1) both; }
@keyframes apparait { from { opacity: 0; transform: translateY(6px); } }
.tourne { animation: tourne 1s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ───────── Structure ───────── */
.app { display: grid; grid-template-columns: 272px minmax(0, 1fr) 320px; height: 100dvh; }
.app.sans-contexte { grid-template-columns: 272px minmax(0, 1fr); }

/* Colonne des conversations (maquette A) */
.side { background: var(--bg2); border-right: 1px solid var(--bord); display: flex; flex-direction: column; min-height: 0; }
.side-haut { padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 10px; }
.side-haut .ligne { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.nouveau { width: 100%; justify-content: flex-start; height: 36px; }
.nouveau kbd { margin-left: auto; }
.recherche { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border-radius: 9px; color: var(--texte3); border: 1px solid transparent; }
.recherche:focus-within { border-color: var(--accent-bord); background: var(--panel); }
.recherche input { border: 0; background: transparent; outline: none; flex: 1; min-width: 0; font-size: 13px; color: var(--texte); }
.side-liste { flex: 1; overflow: auto; padding: 0 8px 12px; }
.titre-section { font-size: 11.5px; font-weight: 550; color: var(--texte3); padding: 14px 8px 6px; display: flex; align-items: center; justify-content: space-between; }
.conv { display: flex; align-items: center; gap: 9px; min-height: 34px; padding: 6px 9px; border-radius: 8px; color: var(--texte2); font-size: 13.5px; cursor: pointer; text-decoration: none; }
.conv:hover { background: var(--panel); color: var(--texte); text-decoration: none; }
.conv.active { background: var(--panel2); color: var(--texte); box-shadow: inset 0 0 0 1px var(--bord); }
.conv .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .extrait { display: block; font-size: 11.5px; color: var(--texte3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .ico { color: var(--texte3); }
.vide-liste { padding: 18px 10px; font-size: 12.5px; color: var(--texte3); text-align: center; }
.side-bas { border-top: 1px solid var(--bord); padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.lien-side { display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 9px; border-radius: 8px; color: var(--texte2); font-size: 13.5px; text-decoration: none; cursor: pointer; background: none; border: 0; width: 100%; }
.lien-side:hover, .lien-side.active { background: var(--panel); color: var(--texte); text-decoration: none; }
.lien-side .badge { margin-left: auto; }
.moi { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: 10px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.moi:hover { background: var(--panel); }
.moi .nom { font-size: 13px; font-weight: 550; line-height: 1.2; }
.moi .sous { font-size: 11.5px; color: var(--texte3); }
.moi > .ico { margin-left: auto; color: var(--texte3); }
.conso { margin: 4px 9px 6px; }
.jauge { height: 4px; border-radius: 99px; background: var(--panel3); overflow: hidden; }
.jauge i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 99px; transition: width .6s cubic-bezier(.2,.7,.3,1); }
.jauge.orange i { background: var(--orange); }
.jauge.rouge i { background: var(--rouge); }
.conso .legende { display: flex; justify-content: space-between; font-size: 11px; color: var(--texte3); margin-top: 5px; }

/* Zone centrale (maquette B) */
.centre { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); background-image: var(--halo); }
.barre { height: 56px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 16px 0 22px; border-bottom: 1px solid var(--bord); }
.barre h1 { font-size: 14px; font-weight: 600; margin: 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.barre h1.modifiable { cursor: text; }
.barre .droite { margin-left: auto; display: flex; gap: 8px; align-items: center; flex: none; }
.fil { flex: 1; overflow: auto; overscroll-behavior: contain; }
.colonne { max-width: 760px; margin: 0 auto; padding: 22px 28px 30px; }
.page { max-width: 980px; margin: 0 auto; padding: 22px 28px 60px; }
.page h2 { font-size: 20px; letter-spacing: -.3px; margin: 4px 0 4px; }
.page .intro { color: var(--texte2); margin: 0 0 20px; max-width: 640px; }

/* Messages */
.msg-u { display: flex; justify-content: flex-end; margin: 18px 0 18px; }
.msg-u .bulle { max-width: 80%; background: var(--panel2); border: 1px solid var(--bord); padding: 10px 14px; border-radius: 16px 16px 4px 16px; font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.r { border: 1px solid var(--bord); background: var(--panel); border-radius: 16px; padding: 14px 18px 10px; box-shadow: var(--ombre); margin-bottom: 8px; }
.r-tete { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.r-tete .nom { font-weight: 600; font-size: 13.5px; }
.r-tete .badge { margin-left: auto; }
.r-corps { font-size: 14.5px; line-height: 1.62; overflow-wrap: anywhere; }
.r-corps p { margin: 0 0 10px; }
.r-corps p:last-child { margin-bottom: 4px; }
.r-corps ul, .r-corps ol { margin: 0 0 10px; padding-left: 20px; }
.r-corps li { margin: 2px 0; }
.r-corps strong { font-weight: 600; }
.r-corps code { font-family: "Geist Mono", monospace; font-size: 12.5px; background: var(--panel2); padding: 1px 5px; border-radius: 5px; }
.r-corps .titre-md { font-weight: 650; margin: 12px 0 6px; }
.r-corps .table-md { overflow-x: auto; margin: 4px 0 12px; border: 1px solid var(--bord); border-radius: 10px; }
.r-corps table { width: 100%; border-collapse: collapse; font-size: 13px; }
.r-corps th { text-align: left; font-weight: 550; font-size: 11.5px; color: var(--texte3); padding: 8px 12px; border-bottom: 1px solid var(--bord); background: var(--panel2); }
.r-corps td { padding: 8px 12px; border-bottom: 1px solid var(--bord); }
.r-corps tr:last-child td { border-bottom: 0; }
.r-corps .mention { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--orange); background: var(--orange-doux); border-radius: 9px; padding: 8px 10px; margin-top: 8px; }
.etapes { display: flex; flex-direction: column; gap: 2px; margin: 0 0 10px; }
.etape { position: relative; padding-left: 27px; font-size: 12.5px; color: var(--texte2); line-height: 26px; height: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.etape .rond { position: absolute; left: 0; top: 4px; width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; background: var(--vert-doux); color: var(--vert); }
.etape .rond.encours { background: var(--accent-doux); color: var(--accent-txt); }
.etape .rond.refuse { background: var(--rouge-doux); color: var(--rouge); }
.etape b { color: var(--texte); font-weight: 550; margin-right: 5px; }
.etape .duree { color: var(--texte3); font-family: "Geist Mono", monospace; font-size: 11px; margin-left: 5px; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.sources .pill { height: 24px; font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.r-pied { display: flex; align-items: center; gap: 2px; border-top: 1px solid var(--bord); margin: 6px -18px 0; padding: 6px 12px 0; color: var(--texte3); }
.r-pied .droite { margin-left: auto; font-size: 11.5px; }
.note-memoire { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--texte3); margin: 4px 2px 18px; }
.note-memoire .ico { color: var(--accent-txt); }
.avertissement { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--orange); background: var(--orange-doux); border-radius: 10px; padding: 9px 12px; margin: 0 0 12px; }
.erreur-msg { color: var(--rouge); background: var(--rouge-doux); }

/* Accueil d'une nouvelle conversation */
.accueil { max-width: 680px; margin: 0 auto; padding: 9vh 28px 20px; text-align: center; }
.accueil h2 { font-size: 26px; letter-spacing: -.6px; margin: 18px 0 6px; }
.accueil p { color: var(--texte2); margin: 0 0 24px; }
.accueil .logo.xl { margin: 0 auto; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; text-align: left; }
.suggestion { text-align: left; border: 1px solid var(--bord); background: var(--panel); border-radius: 14px; padding: 12px 14px; cursor: pointer; transition: border-color .15s, transform .15s; display: flex; gap: 10px; align-items: flex-start; }
.suggestion:hover { border-color: var(--accent-bord); transform: translateY(-1px); }
.suggestion .ico { color: var(--accent-txt); margin-top: 2px; }
.suggestion b { display: block; font-size: 13.5px; font-weight: 600; }
.suggestion span { font-size: 12.5px; color: var(--texte3); }
.choix-boutique { margin: 0 auto 18px; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--texte2); }
.choix-boutique select { height: 30px; border-radius: 99px; border: 1px solid var(--bord2); background: var(--panel); padding: 0 10px; }

/* Compositeur */
.compo-zone { padding: 8px 28px 18px; flex: none; }
.raccourcis { max-width: 760px; margin: 0 auto 10px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.raccourcis::-webkit-scrollbar { display: none; }
.raccourcis .pill { height: 30px; flex: none; }
.compo { max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--bord2); background: var(--panel); border-radius: 16px; padding: 7px 7px 7px 14px; box-shadow: var(--ombre-haute); transition: border-color .15s; }
.compo:focus-within { border-color: var(--accent-bord); }
.compo textarea { flex: 1; border: 0; background: transparent; outline: none; resize: none; font-size: 14.5px; line-height: 1.5; padding: 7px 0; max-height: 200px; min-height: 22px; }
.envoyer { width: 36px; height: 36px; border-radius: 11px; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; box-shadow: 0 6px 18px -6px rgba(42,107,255,.8); transition: opacity .15s, transform .1s; }
.envoyer:disabled { opacity: .35; box-shadow: none; cursor: default; }
.envoyer:active { transform: scale(.95); }
.envoyer.stop { background: var(--panel3); color: var(--texte); box-shadow: none; }
.compo-info { max-width: 760px; margin: 7px auto 0; display: flex; justify-content: space-between; font-size: 11.5px; color: var(--texte3); padding: 0 6px; }

/* Panneau de contexte (maquette B) */
.ctx { border-left: 1px solid var(--bord); background: var(--bg2); overflow: auto; padding: 16px 16px 24px; }
.ctx h3 { font-size: 11.5px; font-weight: 550; color: var(--texte3); margin: 20px 4px 8px; display: flex; justify-content: space-between; align-items: center; }
.ctx h3:first-child { margin-top: 2px; }
.carte-boutique { border: 1px solid var(--bord); border-radius: 14px; padding: 14px; background: var(--panel); }
.carte-boutique .haut { display: flex; align-items: center; gap: 10px; }
.carte-boutique .ic { width: 36px; height: 36px; border-radius: 11px; background: var(--accent-doux); color: var(--accent-txt); display: grid; place-items: center; flex: none; }
.carte-boutique .n { font-weight: 600; }
.carte-boutique .s { font-size: 12px; color: var(--texte3); }
.carte-boutique .chiffres { display: grid; grid-template-columns: repeat(2, 1fr); margin-top: 12px; border-top: 1px solid var(--bord); padding-top: 12px; gap: 8px; }
.carte-boutique .chiffres div { font-size: 11.5px; color: var(--texte3); }
.carte-boutique .chiffres b { display: block; font-size: 16px; color: var(--texte); font-weight: 650; }
.liste { border: 1px solid var(--bord); border-radius: 12px; background: var(--panel); overflow: hidden; }
.item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--bord); font-size: 13px; min-width: 0; }
.item:last-child { border-bottom: 0; }
.item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: 11.5px; color: var(--texte3); }
.item .badge { margin-left: auto; flex: none; }
.item .ic { width: 26px; height: 26px; border-radius: 8px; background: var(--panel2); display: grid; place-items: center; color: var(--texte2); flex: none; }
.outils { display: flex; flex-wrap: wrap; gap: 6px; }
.outils .pill { height: 26px; font-size: 12px; }
.ctx .vide { font-size: 12.5px; color: var(--texte3); padding: 10px 4px; }

/* Cartes et tableaux (pages) */
.carte { border: 1px solid var(--bord); border-radius: 14px; background: var(--panel); box-shadow: var(--ombre); }
.carte + .carte { margin-top: 14px; }
.carte-tete { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--bord); }
.carte-tete h3 { margin: 0; font-size: 14px; font-weight: 600; }
.carte-tete .droite { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.carte-corps { padding: 16px; }
.tableau-zone { overflow-x: auto; }
.tableau { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tableau th { text-align: left; font-weight: 500; font-size: 11.5px; color: var(--texte3); padding: 9px 14px; border-bottom: 1px solid var(--bord); white-space: nowrap; }
.tableau td { padding: 10px 14px; border-bottom: 1px solid var(--bord); vertical-align: middle; }
.tableau tr:last-child td { border-bottom: 0; }
.tableau tr.cliquable { cursor: pointer; }
.tableau tr.cliquable:hover td { background: var(--panel2); }
.tableau .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tableau .gris { color: var(--texte3); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tuile { border: 1px solid var(--bord); border-radius: 14px; background: var(--panel); padding: 14px 16px; }
.tuile .t { font-size: 12px; color: var(--texte3); font-weight: 500; }
.tuile .v { font-size: 24px; font-weight: 650; letter-spacing: -.5px; margin: 2px 0 8px; }
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--bord); margin: 0 0 20px; overflow-x: auto; scrollbar-width: none; }
.onglets::-webkit-scrollbar { display: none; }
.onglet { padding: 10px 12px; font-size: 13px; color: var(--texte2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.onglet:hover { color: var(--texte); text-decoration: none; }
.onglet.actif { color: var(--texte); border-bottom-color: var(--accent); font-weight: 550; }
.verrou { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--bord); border-radius: 12px; padding: 12px 14px; background: var(--panel2); font-size: 12.5px; color: var(--texte2); margin-bottom: 16px; }
.verrou .ico { color: var(--texte3); margin-top: 2px; }
.ligne-reglage { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--bord); }
.ligne-reglage:last-child { border-bottom: 0; }
.ligne-reglage .t { flex: 1; min-width: 0; }
.ligne-reglage .t b { display: block; font-weight: 550; font-size: 13.5px; }
.ligne-reglage .t span { font-size: 12.5px; color: var(--texte3); }
.grille2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.matrice th.groupe { text-align: center; }
.matrice td.coche { text-align: center; }
.matrice .source td { background: var(--panel2); font-size: 11.5px; color: var(--texte3); font-weight: 550; padding: 6px 14px; }
.fait { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--bord); }
.fait:last-child { border-bottom: 0; }
.fait .t { flex: 1; min-width: 0; }
.fait .t small { display: block; font-size: 11.5px; color: var(--texte3); margin-top: 1px; }
.fait input.entree { height: 34px; }

/* Écran de connexion */
.connexion { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); background-image: var(--halo); overflow: auto; }
.connexion .boite { width: 100%; max-width: 380px; }
.connexion .entete { text-align: center; margin-bottom: 24px; }
.connexion .entete .logo { margin: 0 auto; }
.connexion .entete h1 { font-size: 22px; letter-spacing: -.4px; margin: 14px 0 4px; }
.connexion .entete p { color: var(--texte2); margin: 0; font-size: 13.5px; }
.connexion .carte { padding: 22px; }
.connexion .pied { text-align: center; font-size: 12px; color: var(--texte3); margin-top: 18px; }
.qr { display: grid; place-items: center; background: #fff; border-radius: 12px; padding: 10px; width: 196px; margin: 4px auto 12px; }
.qr svg { width: 176px; height: 176px; display: block; }
.secret { font-family: "Geist Mono", monospace; font-size: 12.5px; text-align: center; word-break: break-all; color: var(--texte2); background: var(--panel2); border-radius: 9px; padding: 8px; margin-bottom: 14px; }
.codes-secours { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; font-family: "Geist Mono", monospace; font-size: 14px; text-align: center; margin: 12px 0; }
.codes-secours div { background: var(--panel2); border-radius: 8px; padding: 6px; }
.message-erreur { color: var(--rouge); font-size: 13px; margin: -4px 0 12px; min-height: 0; }
.message-ok { color: var(--vert); font-size: 13px; margin: 0 0 12px; }

/* Modale, menu, notification */
.voile { position: fixed; inset: 0; background: var(--voile); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fondu .15s ease both; }
@keyframes fondu { from { opacity: 0; } }
.modale { width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--bord2); border-radius: 16px; box-shadow: var(--ombre-haute); animation: apparait .2s cubic-bezier(.2,.7,.3,1) both; }
.modale.large { max-width: 720px; }
.modale-tete { display: flex; align-items: center; gap: 10px; padding: 16px 18px 6px; }
.modale-tete h3 { margin: 0; font-size: 15.5px; }
.modale-tete .btn { margin-left: auto; }
.modale-corps { padding: 10px 18px 6px; }
.modale-pied { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; flex-wrap: wrap; }
.menu { position: fixed; z-index: 60; min-width: 220px; background: var(--panel); border: 1px solid var(--bord2); border-radius: 12px; box-shadow: var(--ombre-haute); padding: 5px; animation: apparait .14s ease both; }
.menu button { display: flex; align-items: center; gap: 9px; width: 100%; height: 34px; padding: 0 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-size: 13.5px; color: var(--texte); text-align: left; }
.menu button:hover { background: var(--panel2); }
.menu button.danger { color: var(--rouge); }
.menu hr { border: 0; border-top: 1px solid var(--bord); margin: 4px 2px; }
.toasts { position: fixed; z-index: 70; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--texte); color: var(--bg); padding: 9px 14px; border-radius: 10px; font-size: 13px; box-shadow: var(--ombre-haute); animation: apparait .2s ease both; max-width: calc(100vw - 32px); }
.toast.erreur { background: var(--rouge); color: #fff; }
.chargement { display: grid; place-items: center; height: 100dvh; }

/* ───────── Tablette : panneau de contexte masqué ───────── */
@media (max-width: 1199px) {
  .app, .app.sans-contexte { grid-template-columns: 260px minmax(0, 1fr); }
  .app > .ctx { display: none; }
}

/* ───────── Mobile (maquette B) ───────── */
.tabbar, .mobile-seul { display: none; }
@media (max-width: 760px) {
  .app, .app.sans-contexte { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .app > .side { display: none; }
  .bureau-seul { display: none !important; }
  .mobile-seul { display: flex; }
  .logo.mobile-seul { display: grid; }
  .barre { padding: 0 10px 0 14px; height: 54px; padding-top: env(safe-area-inset-top); height: calc(54px + env(safe-area-inset-top)); }
  .barre h1 { flex: 1; font-size: 14px; }
  .colonne { padding: 14px 14px 18px; }
  .page { padding: 16px 14px 40px; }
  .r { padding: 13px 14px 9px; border-radius: 14px; }
  .r-pied { margin: 6px -14px 0; }
  .msg-u .bulle { max-width: 88%; }
  .compo-zone { padding: 6px 10px 10px; }
  .compo-info { display: none; }
  .accueil { padding: 4vh 16px 10px; }
  .accueil h2 { font-size: 22px; }
  .suggestions { grid-template-columns: minmax(0, 1fr); }
  .etape .duree { display: none; }
  .ctx-mobile { display: flex; align-items: center; gap: 10px; border: 1px solid var(--bord); background: var(--panel); border-radius: 12px; padding: 9px 12px; margin-bottom: 14px; font-size: 13px; text-decoration: none; color: var(--texte); }
  .ctx-mobile .ico { color: var(--accent-txt); }
  .ctx-mobile .badge { margin-left: auto; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--bord); background: color-mix(in srgb, var(--bg2) 92%, transparent); backdrop-filter: blur(14px); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tab-b { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 500; color: var(--texte3); padding: 4px 0; text-decoration: none; border: 0; background: none; cursor: pointer; }
  .tab-b:hover { text-decoration: none; }
  .tab-b .ico { width: 22px; height: 22px; }
  .tab-b.actif { color: var(--accent-txt); }
  .page-mobile { padding: 10px 12px 30px; }
  .page-mobile .ctx { border: 0; background: none; padding: 0; overflow: visible; }
  .grille2 { grid-template-columns: minmax(0, 1fr); }
  .tableau.adaptatif thead { display: none; }
  .tableau.adaptatif tr { display: block; border-bottom: 1px solid var(--bord); padding: 8px 0; }
  .tableau.adaptatif td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 4px 14px; }
  .tableau.adaptatif td::before { content: attr(data-l); color: var(--texte3); font-size: 12px; }
  .tableau.adaptatif td.num { text-align: right; }
  .modale { border-radius: 16px 16px 0 0; align-self: end; max-height: calc(100dvh - 40px); }
  .voile { padding: 0; }
}
.ctx-mobile { display: none; }
@media (max-width: 760px) { .ctx-mobile { display: flex; } }

/* Corrections après relecture des captures */
.app.sans-contexte > .ctx { display: none; }
.matrice td.coche .case { justify-content: center; }
.carte-tete .droite input.entree[type="search"] { width: 260px; }
.r-corps li .curseur, .r-corps p .curseur { margin-left: 4px; }
.mobile-bloc { display: none; }
@media (max-width: 760px) {
  .mobile-bloc { display: block; }
  .tableau.adaptatif td:first-child::before { content: none; }
  .tableau.adaptatif td:first-child { padding-top: 6px; }
  .mobile-bloc .raccourcis { margin-bottom: 12px; }
}
.cases { display: flex; gap: 18px; flex-wrap: wrap; }
