/* Peaks AI Lab — couleurs et typographie de Peaks (thème sombre). */
:root {
  --bg: #0A0D16; --bg-2: #0E1220; --surface: #10152A; --surface-2: #151B33; --field: #0B0F1D;
  --line: #222A45; --line-2: #2E3758;
  --text: #EDEFF7; --text-2: #A6ACC6; --text-3: #6C7391;
  --accent: #20D0ED; --accent-ink: #04222A; --violet: #A98DFF;
  --good: #3DD68C; --bad: #FF4D6D; --warn: #FFC24B;
  --r: 16px; --r-s: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-ar: "SF Arabic", "Geeza Pro", "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; } /* sous la barre du haut (collante) : un titre amené à l'écran n'est jamais caché */
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
code { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; color: var(--text-2); margin: 16px 0 8px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ar { font-family: var(--font-ar); }
[dir="rtl"] { text-align: right; }

/* ---------------------------------------------------------------- en-tête */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 10px 24px; background: rgba(10, 13, 22, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 17px; white-space: nowrap; }
.brand svg { width: 26px; height: 26px; color: var(--accent); }
.brand span { color: var(--text-2); font-weight: 500; }
.brand.big { font-size: 22px; margin-bottom: 18px; }
.brand.big svg { width: 34px; height: 34px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; border: 0; background: none; padding: 8px 14px; border-radius: 999px; color: var(--text-2); cursor: pointer; font-weight: 600; font-size: 14px; }
.tabs button:hover { color: var(--text); background: var(--surface); }
.tabs button.on { color: var(--text); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
.as { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.as select { width: auto; max-width: 260px; padding: 6px 30px 6px 10px; font-size: 13.5px; border-radius: 999px; }
/* en ligne (0.7) : la personne connectée, « View as » (super admin), « Sign out » */
.as.me label { display: flex; align-items: center; gap: 8px; }
.as.me .who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.as.me .who b { color: var(--text); font-size: 13.5px; font-weight: 600; }
.as.me .who small { font-size: 11.5px; }
.as.me .btn.s { padding: 5px 12px; }

main { max-width: 1360px; margin: 0 auto; padding: 22px 24px 80px; }
.tab { display: none; }
.tab.on { display: block; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- éléments communs */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card + .card, #runArea, .notready + .card { margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field > span em { font-style: normal; font-weight: 400; color: var(--text-3); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.grow { flex: 1; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], input:not([type]), select, textarea {
  width: 100%; background: var(--field); border: 1px solid var(--line-2); border-radius: var(--r-s); padding: 10px 12px; outline: none; transition: border-color .15s;
}
textarea { resize: vertical; min-height: 44px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(32, 208, 237, .15); }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: right 14px top 52%, right 9px top 52%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
::placeholder { color: var(--text-3); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; flex: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 9px 16px; font-weight: 600; font-size: 14px; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #46507A; background: #1B2240; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn svg { width: 18px; height: 18px; }
.btn small { font-weight: 500; color: var(--text-3); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { background: #4BDCF2; }
.btn.big { padding: 13px 24px; font-size: 16px; }
.btn.s { padding: 6px 12px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: rgba(255, 77, 109, .4); background: transparent; }
.btn.wide { width: 100%; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .18); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 30px 16px; text-align: center; color: var(--text-2); }
.empty p { margin: 0 0 8px; }
.err { color: var(--bad); }
.bad-box, .ok-box, .warn-box { border-radius: var(--r-s); padding: 10px 12px; font-size: 13.5px; overflow-wrap: anywhere; }
.warn-box { border: 1px solid rgba(255, 194, 75, .35); background: rgba(255, 194, 75, .07); color: #FFDDA0; }
.bad-box { border: 1px solid rgba(255, 77, 109, .35); background: rgba(255, 77, 109, .08); color: #FFB3C0; }
.ok-box { border: 1px solid rgba(61, 214, 140, .35); background: rgba(61, 214, 140, .07); color: #B5F2D3; }
.ok-box img { border-radius: 10px; margin-top: 8px; max-width: 420px; width: 100%; }
.notready { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14.5px; padding: 12px 14px; }
.shake { animation: shake .4s ease-in-out; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.yes { color: var(--good); font-weight: 600; }
.no { color: var(--warn); font-weight: 600; }
.row-end { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
.row-start { display: flex; gap: 8px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin: 12px 0; }

/* ---------------------------------------------------------------- connexion au labo */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.gate-card { width: min(460px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.gate-card h1 { font-size: 20px; }
.gate-card p { margin: 0; }

/* ---------------------------------------------------------------- la demande */
.req { display: flex; flex-direction: column; gap: 16px; }
.req-head p { margin: 6px 0 0; max-width: 820px; }
.req-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; }
.for-me { padding: 10px 12px; border-radius: var(--r-s); background: var(--bg-2); border: 1px solid var(--line-2); font-weight: 600; }
.drop { position: relative; border: 1.5px dashed var(--line-2); border-radius: var(--r-s); background: var(--field); padding: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 64px; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: rgba(32, 208, 237, .06); }
.drop input[type="file"], .icon-btn input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-in { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text-2); font-size: 14px; padding: 4px 6px; border-radius: 8px; }
.drop-in:hover { color: var(--text); }
.drop-in svg { width: 24px; height: 24px; color: var(--accent); }
.drop-in small { display: block; color: var(--text-3); font-size: 12px; }
.drop:focus-within { border-color: var(--accent); }
.previews { display: flex; flex-wrap: wrap; gap: 8px; }
.pv { position: relative; width: 58px; height: 58px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line-2); }
.pv img { width: 100%; height: 100%; object-fit: cover; }
.pv button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .7); color: #fff; font-size: 13px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.opts { display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center; padding: 12px 14px; border-radius: var(--r-s); background: var(--bg-2); border: 1px solid var(--line); }
.opt { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.opt select { width: auto; padding: 5px 28px 5px 10px; }
.go { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- le circuit */
.pipe-card { padding: 14px 16px; }
.pipe { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--steps, 5), minmax(0, 1fr)); gap: 8px; }
.pipe li[hidden] { display: none; }
.pipe li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); color: var(--text-3); min-width: 0; }
.pipe li b { display: block; font-size: 14px; color: var(--text-2); }
.pipe li small { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pipe li > div { min-width: 0; }
.pipe .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--surface-2); color: var(--text-3); flex: none; }
.pipe li.run { border-color: rgba(32, 208, 237, .5); color: var(--text-2); }
.pipe li.run b { color: var(--text); }
.pipe li.run .n { background: var(--accent); color: var(--accent-ink); animation: pulse 1.4s ease-in-out infinite; }
.pipe li.done .n { background: var(--good); color: #062214; }
.pipe li.done b { color: var(--text); }
.pipe li.warn .n { background: var(--warn); color: #2A1E00; }
.pipe li.bad .n { background: var(--bad); color: #2A0710; }
.pipe li.skip { opacity: .55; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(32, 208, 237, .5); } 50% { box-shadow: 0 0 0 6px rgba(32, 208, 237, 0); } }
.pipe-info { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--text-2); }
.pipe-info span:empty { display: none; }
#runTitle { color: var(--text); font-weight: 600; margin-right: auto; }
.brief { display: flex; flex-direction: column; gap: 8px; }
.brief p { margin: 0; }
.brief .req-text { color: var(--text-2); font-style: italic; }
.pthumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.pthumbs img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line-2); }
.resume, .write-err { margin-top: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }

/* ---------------------------------------------------------------- YouTube : ce que l'IA a regardé */
.research { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.research p { margin: 0; }
.research .bh small { font-weight: 500; }
.insights { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; color: var(--text-2); font-size: 14px; }
.ytgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 10px; }
.ytv { display: flex; flex-direction: column; gap: 5px; text-decoration: none; color: var(--text); min-width: 0; padding: 6px; border-radius: 12px; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.ytv:hover { background: var(--surface-2); border-color: var(--line-2); }
.ytim { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); }
.ytim img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ytim i { position: absolute; left: 6px; bottom: 6px; font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: rgba(5, 8, 16, .8); color: #fff; }
.ytt { font-size: 13.5px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ytv small { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ytv small.why { color: var(--text-3); white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.xr { color: var(--good); font-weight: 700; }
.ytl { display: grid; grid-auto-flow: column; grid-auto-columns: 172px; gap: 6px; overflow-x: auto; max-width: 100%; padding-bottom: 4px; scrollbar-width: thin; }
.ytv.s { padding: 4px; }
.ytv.s .ytt { font-size: 12.5px; }
.ytc { font-size: 12px; }
.linkish { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }

/* ---------------------------------------------------------------- les propositions */
.ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 18px; margin-top: 16px; align-items: start; }
.ic { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; transition: border-color .2s, box-shadow .2s, opacity .2s; min-width: 0; }
.ic.kept { border-color: rgba(61, 214, 140, .55); box-shadow: 0 0 0 1px rgba(61, 214, 140, .25); }
.ic.dropped { opacity: .55; }
.thumb { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #141A33, #0D1124); border-bottom: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.tph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text-3); font-size: 13.5px; padding: 16px; text-align: center; overflow: auto; }
.tph.run { color: var(--text-2); }
.tph.err { color: #FFB3C0; font-size: 12.5px; }
.tph .spin { width: 22px; height: 22px; }
.tbar { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; opacity: 0; transition: opacity .15s; }
.thumb:hover .tbar, .thumb:focus-within .tbar { opacity: 1; }
@media (hover: none) { .tbar { opacity: 1; } }
.tbar button, .tbar a { border: 0; background: rgba(5, 8, 16, .78); color: #fff; font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 8px; cursor: pointer; text-decoration: none; backdrop-filter: blur(4px); }
.tbar button:hover, .tbar a:hover { background: rgba(5, 8, 16, .95); }
.cbody { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.b { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
/* quelle IA a écrit l'idée : le super admin seulement, le temps du training */
.b.ai.claude { background: rgba(217, 119, 87, .16); border-color: rgba(217, 119, 87, .6); color: #F4B9A3; }
.b.ai.openai { background: rgba(61, 214, 140, .12); border-color: rgba(61, 214, 140, .55); color: #A2EDC9; }
.ic h3 { font-size: 19px; line-height: 1.5; font-weight: 700; color: var(--text); margin: 0; }
.alts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.alts li { color: var(--text-2); font-size: 15px; }
.alts li::before { content: "• "; color: var(--text-3); }
.lbl { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; color: var(--text-3); margin-bottom: 4px; }
.hook { background: var(--bg-2); border-radius: 12px; padding: 10px 14px; border-right: 3px solid var(--accent); }
.hook p, .idea { margin: 0; font-size: 15.5px; line-height: 1.75; }
.sect ol { margin: 8px 0 0; padding: 0 22px 0 0; display: flex; flex-direction: column; gap: 4px; font-size: 15px; line-height: 1.7; }
.sect details summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.sect details summary::-webkit-details-marker { display: none; }
.sect details summary .lbl { margin: 0; }
.sect details summary::after { content: "▾"; color: var(--text-3); font-size: 13px; transition: transform .15s; }
.sect details[open] summary::after { transform: rotate(180deg); }
.why { margin: 0; font-size: 13.5px; color: var(--text-2); font-style: italic; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }
.fbb { border: 1px solid var(--line-2); background: var(--bg-2); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 13.5px; cursor: pointer; color: var(--text-2); }
.fbb:hover { color: var(--text); border-color: #46507A; }
.fbb.keep.on { background: rgba(61, 214, 140, .16); border-color: var(--good); color: var(--good); }
.fbb.rej.on { background: rgba(255, 77, 109, .14); border-color: var(--bad); color: var(--bad); }
.acts .btn { margin-left: auto; }

/* ---------------------------------------------------------------- Training */
.chat { display: flex; flex-direction: column; padding: 0; height: calc(100vh - 150px); min-height: 480px; }
.chat-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-head .field select { width: auto; min-width: 200px; padding-top: 7px; padding-bottom: 7px; }
.chat-head .grow { flex: 1; }
.chat-log { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; flex-direction: column; gap: 6px; max-width: 86%; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg .who { font-size: 12px; color: var(--text-3); font-weight: 600; }
.bub { padding: 10px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); white-space: pre-wrap; word-wrap: break-word; line-height: 1.6; }
.msg.me .bub { background: rgba(32, 208, 237, .12); border-color: rgba(32, 208, 237, .3); border-bottom-right-radius: 4px; }
.msg.ai .bub { border-bottom-left-radius: 4px; }
.msg.pending .bub { opacity: .6; }
.msg.failed .bub { border-color: var(--bad); }
.msg.typing .bub { display: flex; align-items: center; gap: 10px; color: var(--text-2); }
.msg .imgs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.msg .imgs img { width: 120px; height: 90px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line-2); }
.starters { display: flex; flex-direction: column; gap: 8px; align-items: center; margin-top: 14px; }
.starters button { border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text-2); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 13.5px; max-width: 100%; }
.starters button:hover { color: var(--text); }
.composer { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { resize: none; max-height: 180px; }
.icon-btn { position: relative; width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { color: var(--text); }
.icon-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- historique */
.hist-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.runs { display: flex; flex-direction: column; gap: 10px; }
.hrun { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
.hrun .rt { aspect-ratio: 16 / 9; border-radius: 9px; overflow: hidden; background: linear-gradient(135deg, #141A33, #0D1124); }
.hrun .rt img { width: 100%; height: 100%; object-fit: cover; }
.hrun b { display: block; }
.hrun p { margin: 2px 0; color: var(--text-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hrun .ft { font-family: var(--font-ar); color: var(--text); }
.hrun small { color: var(--text-3); font-size: 12.5px; }
.hrun .ra { display: flex; gap: 6px; }

/* ---------------------------------------------------------------- Training 0.4 : un chat, le sujet, « Undo » */
.pv.pdf { width: auto; min-width: 130px; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 8px 30px 8px 10px; background: var(--bg-2); }
.pv.pdf span { font-weight: 800; color: var(--accent); font-size: 12px; }
.pv.pdf small { font-size: 11.5px; color: var(--text-2); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line-2); }
.seg button { border: 0; background: none; color: var(--text-2); font-weight: 600; font-size: 13.5px; padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.seg button:disabled { opacity: .5; cursor: default; }
.msg .imgs .pdf { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text-2); font-size: 13px; text-decoration: none; }
.msg .test img { width: min(480px, 100%); aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; border: 1px solid var(--line-2); display: block; }
.msg .undo { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); }
.msg.undone .bub { opacity: .55; text-decoration: line-through; }
.msg.fb .bub { background: rgba(169, 141, 255, .08); border-color: rgba(169, 141, 255, .35); }
.why-opts { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 12px; }
.why-opts label { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; font-weight: 600; }
.why-opts label:has(input:checked) { border-color: var(--accent); background: rgba(32, 208, 237, .1); }
.dlg-why textarea { width: 100%; }

/* ---------------------------------------------------------------- 0.6 : la voix (le micro à côté des champs) */
.mic { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text-2); cursor: pointer; transition: background .15s, color .15s, box-shadow .1s; }
.mic svg { width: 20px; height: 20px; }
.mic:hover { color: var(--text); }
.mic:disabled { opacity: .45; cursor: default; }
.mic[hidden] { display: none; }
.rec .mic { background: var(--bad); border-color: var(--bad); color: #fff; box-shadow: 0 0 0 calc(3px + var(--lvl, 0) * 9px) rgba(255, 77, 109, .28); }
.ta-mic { position: relative; }
.field .ta-mic textarea { padding-right: 56px; }
.field .ta-mic:has(.mic[hidden]) textarea { padding-right: 12px; } /* pas de micro (ChatGPT pas relié) : toute la largeur */
.field .ta-mic .mic { position: absolute; right: 8px; bottom: 8px; width: 38px; height: 38px; }
.composer-row.ta-mic { position: static; }
.rec textarea { border-color: rgba(255, 77, 109, .55); }
.mic-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); padding: 6px 10px; border-radius: var(--r-s); background: var(--bg-2); border: 1px solid var(--line); }
.mic-status[hidden] { display: none; }
.mic-status b { color: var(--text); font-variant-numeric: tabular-nums; }
.mic-status .btn { margin-left: auto; padding: 5px 12px; }
.mic-status .btn.s.primary { order: 9; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: blink 1s ease-in-out infinite; flex: none; }
@keyframes blink { 50% { opacity: .25; } }
.field .mic-status { margin-bottom: 6px; }

/* ---------------------------------------------------------------- 0.6 : les priorités (rouge, orange, vert) */
.pdot { display: inline-block; width: 13px; height: 13px; border-radius: 50%; border: 0; padding: 0; flex: none; vertical-align: -1px; background: var(--warn); }
button.pdot { cursor: pointer; width: 15px; height: 15px; margin-top: 3px; box-shadow: 0 0 0 3px rgba(255, 255, 255, .06); }
button.pdot:hover, button.pdot:focus-visible { box-shadow: 0 0 0 3px rgba(255, 255, 255, .22); outline: none; }
.pdot.p3 { background: var(--bad); }
.pdot.p2 { background: #FF9F43; }
.pdot.p1 { background: var(--good); }
.learned { list-style: none; margin: 0; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); font-size: 13.5px; }
.learned li { display: flex; gap: 9px; align-items: flex-start; line-height: 1.5; }
.learned li span { min-width: 0; overflow-wrap: anywhere; }
.learned li.gone > span { text-decoration: line-through; color: var(--text-3); }
.learned .st { font-style: normal; font-size: 12px; color: var(--text-3); white-space: nowrap; margin-left: auto; padding-left: 8px; }
.learned .st.ok { color: var(--text-3); }
.msg .learned { max-width: 100%; }
.pmenu { position: absolute; z-index: 60; display: flex; flex-direction: column; gap: 2px; padding: 6px; border-radius: 12px; background: #1A2140; border: 1px solid var(--line-2); box-shadow: 0 12px 30px rgba(0, 0, 0, .5); width: 290px; }
.pmenu button { display: grid; grid-template-columns: 16px auto; column-gap: 10px; align-items: center; text-align: left; border: 0; background: none; color: var(--text); padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; }
.pmenu button:hover, .pmenu button.on { background: var(--surface-2); }
.pmenu button small { grid-column: 2; color: var(--text-3); font-size: 12px; }
.off-box { margin: 10px 16px 0; }
#trainStop { flex: none; }

/* ---------------------------------------------------------------- 0.6 : l'historique du Training */
.thist { display: flex; flex-direction: column; gap: 12px; }
.th-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.th-head h2 { margin: 0; }
.thist > p { margin: 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.th-filters { display: flex; gap: 10px 16px; flex-wrap: wrap; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.th-filters .field.inline { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.th-filters select { width: auto; min-width: 160px; padding-top: 7px; padding-bottom: 7px; }
.th-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 10px; }
.person { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.person.on { border-color: var(--accent); }
.person.off { border-color: rgba(255, 194, 75, .45); }
.person small { color: var(--text-3); font-size: 12px; }
.pname { display: flex; flex-direction: column; align-items: flex-start; border: 0; background: none; color: var(--text); padding: 0; cursor: pointer; font: inherit; text-align: left; }
.pname small { color: var(--text-2); }
.pacts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pacts .btn { padding: 6px 12px; font-size: 13px; }
.th-list { display: flex; flex-direction: column; gap: 12px; }
.lesson { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.lesson.undone { opacity: .6; }
.lesson.seed { background: var(--bg-2); border-style: dashed; }
.lh { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
.lh .lundo { margin-left: auto; }
.lh small { color: var(--text-3); font-size: 12.5px; }
.src { font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-2); }
.src-keep { color: var(--good); border-color: rgba(61, 214, 140, .45); }
.src-dismiss { color: var(--bad); border-color: rgba(255, 77, 109, .45); }
.src-chat { color: var(--accent); border-color: rgba(32, 208, 237, .45); }
.lrem ul, .lprio ul { margin: 4px 0 0; padding-left: 18px; color: var(--text-3); font-size: 13px; }
.lrem li { text-decoration: line-through; }
.lprio li { display: flex; gap: 6px; align-items: center; list-style: none; margin-left: -18px; }
.lrefs { display: flex; gap: 10px; flex-wrap: wrap; }
.lrefs figure { margin: 0; width: 150px; display: flex; flex-direction: column; gap: 4px; }
.lrefs img { width: 150px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line-2); }
.lrefs figcaption { font-size: 12px; color: var(--text-2); }
.lrefs figure.gone { opacity: .45; }
.lmsg summary { cursor: pointer; font-size: 12.5px; color: var(--text-3); }
.lmsg p { margin: 8px 0 0; padding: 8px 12px; border-radius: 10px; white-space: pre-wrap; font-size: 13.5px; overflow-wrap: anywhere; }
.lmsg .q { background: rgba(32, 208, 237, .08); }
.lmsg .a { background: var(--bg-2); color: var(--text-2); }

/* ---------------------------------------------------------------- 0.6 : Develop (une proposition, en versions) */
.btn.dev { border-color: rgba(169, 141, 255, .5); }
.btn.dev .vc { color: var(--violet); font-weight: 700; }
#wsView { display: flex; flex-direction: column; gap: 14px; }
#wsView[hidden] { display: none; }
.ws-top { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.ws-top h1 { margin: 0; font-size: 22px; }
.ws-grid { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 16px; align-items: start; }
.ws-base { position: sticky; top: 74px; display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 90px); overflow-y: auto; border-radius: var(--r); }
.ws-basehead { display: flex; align-items: center; gap: 10px; padding: 2px 4px 0; } /* la colonne défile : rien n'est coupé au bord */
.ws-basehead .lbl { margin: 0; }
.ws-chat { height: calc(100vh - 140px); min-height: 520px; }
.ws-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.ws-quick button { border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); border-radius: 999px; padding: 7px 13px; cursor: pointer; font-weight: 600; font-size: 13px; }
.ws-quick button:hover { border-color: var(--violet); }
.ws-quick button:disabled { opacity: .5; cursor: default; }
.ws-count { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.ws-count label { cursor: pointer; }
.ws-count input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ws-count label span { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--bg-2); font-weight: 700; }
.ws-count input:checked + span { border-color: var(--accent); background: rgba(32, 208, 237, .14); color: var(--text); }
.ws-count input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.ws-versions { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; width: 100%; }
.msg.ai:has(.ws-versions) { max-width: 100%; width: 100%; }
.ic.version h3 { font-size: 17px; }
.b.mode-same { color: var(--text-2); }
.b.mode-edit, .b.mode-new { color: var(--violet); border-color: rgba(169, 141, 255, .45); }

/* ---------------------------------------------------------------- réglages */
.set-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.set-grid .card + .card { margin-top: 0; }
.set-grid .card h2 { margin-bottom: 6px; }
.conn { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); margin-top: 12px; }
.conn .th { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.conn .th b { margin-right: auto; font-size: 15px; }
.conn p { margin: 0; }
.keyform { display: flex; gap: 8px; }
.keyform input { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 13.5px; }
.res:empty { display: none; }
.pay { margin-top: 14px; padding: 14px; border-radius: 12px; border: 1px dashed var(--line-2); }
.pay h3 { margin-top: 0; }
.pay ul { margin: 0 0 8px; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-2); }
.pay b { color: var(--text); }
.pay p { margin: 0; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; font-size: 14px; margin: 10px 0 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.prices { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 8px; }
.prices td, .prices th { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.prices th { color: var(--text-3); font-size: 12px; font-weight: 600; }
.journal { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; }
.journal li { padding: 8px 10px; border-radius: 10px; background: var(--bg-2); font-size: 13.5px; }
.journal small { color: var(--text-2); }
.err-list small { color: #FFB3C0; }

/* ---------------------------------------------------------------- toasts, fenêtre */
.toasts { position: fixed; left: 50%; top: 66px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; width: min(560px, calc(100% - 32px)); pointer-events: none; }
.toast { pointer-events: auto; background: #1A2140; border: 1px solid var(--line-2); border-left: 4px solid var(--accent); border-radius: 12px; padding: 11px 14px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); animation: tin .2s ease-out; overflow-wrap: anywhere; }
.toast.good { border-left-color: var(--good); }
.toast.bad { border-left-color: var(--bad); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
dialog { border: 1px solid var(--line-2); background: var(--surface); color: var(--text); border-radius: 18px; padding: 0; width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: rgba(3, 5, 10, .7); backdrop-filter: blur(3px); }
.dlg-in { position: relative; padding: 20px; display: flex; flex-direction: column; gap: 12px; overflow: auto; max-height: calc(100vh - 50px); }
.dlg-in h2 { padding-right: 70px; line-height: 1.4; }
.dlg-x { position: absolute; top: 14px; right: 14px; }

/* ---------------------------------------------------------------- écrans moyens et téléphones */
@media (max-width: 1000px) {
  /* les onglets passent sous le logo : « Settings » n'est jamais caché derrière « Account (test) » */
  .top { flex-wrap: wrap; gap: 8px 12px; }
  .tabs { order: 3; flex-basis: 100%; }
  .as { margin-left: auto; }
  html { scroll-padding-top: 112px; } /* la barre du haut sur deux lignes */
}
@media (max-width: 1100px) {
  .set-grid { grid-template-columns: minmax(0, 1fr); }
  .ws-grid { grid-template-columns: minmax(0, 1fr); }
  .ws-base { position: static; max-height: none; }
  .chat.ws-chat { height: auto; min-height: 0; } /* deux classes : plus fort que « .chat » des téléphones */
  .ws-chat .chat-log { max-height: none; overflow: visible; }
}
@media (max-width: 760px) {
  .top { padding: 8px 16px; gap: 8px 10px; flex-wrap: wrap; }
  .tabs { order: 3; flex-basis: 100%; }
  .as { margin-left: auto; }
  .as span { display: none; }
  .as.me span.who { display: flex; }
  .as.me .who small { display: none; }
  .as select { max-width: 190px; }
  main { padding: 14px 16px 70px; }
  .card { padding: 16px; }
  .req-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .opts { gap: 10px 18px; }
  .go .btn.big { width: 100%; }
  .pipe { gap: 4px; }
  .pipe-card { padding: 10px; }
  .pipe li { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 6px; }
  .pipe li b { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pipe li small { display: none; }
  .pipe .n { width: 22px; height: 22px; font-size: 12px; }
  .msg { max-width: 94%; }
  .chat { height: calc(100vh - 190px); }
  .hrun { grid-template-columns: 96px minmax(0, 1fr); }
  .hrun .ra { grid-column: 1 / -1; justify-content: flex-end; }
  .keyform { flex-direction: column; }
  .chat-head .grow { display: none; }
  .chat-head { padding: 12px; gap: 8px; }
  .chat-head .field.inline { flex-basis: 100%; }
  .chat-head .field.inline > span { white-space: nowrap; }
  .chat-head .field select { flex: 1; min-width: 0; width: 100%; }
  .chat-head > .btn.s { padding: 6px 12px; font-size: 13px; }
  .toasts { top: auto; bottom: 16px; }
  .th-filters .field.inline { flex-basis: 100%; }
  .th-filters .field.inline > span { min-width: 54px; } /* les deux listes alignées */
  .th-filters select { flex: 1; min-width: 0; }
  .ws-top h1 { font-size: 19px; }
  .learned li { flex-wrap: wrap; }
  .learned li > span { flex: 1 1 0; } /* la pastille et le texte sur la même ligne */
  .learned .st { flex-basis: 100%; margin-left: 0; padding-left: 24px; white-space: normal; }
  /* le champ du chat sur toute la largeur, les boutons dessous (comme l'app Claude sur téléphone) */
  .composer-row { flex-wrap: wrap; }
  .composer-row textarea { flex: 1 1 100%; order: -1; }
  .composer-row .mic { margin-left: auto; }
  .composer-row .mic[hidden] + .btn, .composer-row:not(:has(.mic)) .btn.primary { margin-left: auto; }
  .pmenu { width: min(290px, calc(100vw - 16px)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
