/* Interface reprise du KMS (page « KMS Local ») : jaune #FBE74D, bleu pétrole #2B657C, neutres Chakra, Montserrat + Open Sans. */
:root {
  --brand: #FBE74D; --brand-50: #FEFCF0; --brand-600: #F5DB2A; --brand-700: #E5C91F;
  --sec: #2B657C; --sec-50: #E8F1F5; --sec-100: #D1E3EB; --sec-200: #A3C7D7; --sec-300: #75ABC3; --sec-400: #478FAF; --sec-600: #245A70; --sec-700: #1E4E64; --sec-800: #174258;
  --n50: #FAFAFA; --n100: #F5F5F5; --n200: #EEEEEE; --n300: #E0E0E0; --n400: #BDBDBD; --n500: #9E9E9E; --n600: #757575; --n700: #616161; --n800: #424242; --n900: #212121;
  --green: #38A169; --green-600: #2F855A; --green-50: #F0FFF4; --green-100: #C6F6D5; --green-200: #9AE6B4; --green-800: #22543D;
  --red: #E53E3E; --red-600: #C53030; --red-50: #FFF5F5; --red-100: #FED7D7; --red-300: #FC8181;
  --orange: #DD6B20; --orange-50: #FFFAF0; --orange-100: #FEEBC8; --orange-700: #9C4221;
  --signal: #DD6B20; --signal-bg: #FEEBC8;
  --sys: -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", Arial, "Liberation Sans", system-ui, sans-serif;
  --body: "Open Sans", var(--sys);
  --heading: "Montserrat", var(--sys);
  --mono: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, .05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -1px rgba(0, 0, 0, .06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--n50); color: var(--n800); font: 16px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 3px solid rgba(66, 153, 225, .6); outline-offset: 1px; }
textarea:focus, input:focus, select:focus { outline: none; }
[hidden] { display: none !important; }
a { color: inherit; }
code, pre, .mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.fi { width: 1em; height: 1em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -0.125em; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-bottom-color: transparent; border-left-color: transparent; border-radius: 50%; animation: spin .45s linear infinite; color: var(--sec); flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ barre latérale jaune */
.app { display: flex; height: 100dvh; min-height: 520px; }
.ksb { width: 240px; flex: none; background: var(--brand); border-right: 1px solid var(--n200); position: relative; display: flex; flex-direction: column; }
.ksb-fold { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; color: var(--n900); font-size: 14px; }
.ksb-fold:hover { background: rgba(0, 0, 0, .06); }
.ksb-title { height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0 32px; text-align: center; }
.ksb-title b { font: 900 24px/1.1 var(--heading); color: var(--n900); letter-spacing: .5px; }
.ksb-title span { font-size: 12px; color: var(--n700); line-height: 1.25; margin-top: 2px; }
.ksb-user { margin: 4px 16px 12px; padding: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--sec); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 500; }
.ksb-user .nm { font-size: 14px; font-weight: 500; color: var(--n900); margin-top: 6px; }
.ksb-user .ml { font-size: 12px; color: var(--n700); display: flex; justify-content: space-between; align-items: center; }
.ksb-user .ml button { color: var(--n700); font-size: 14px; padding: 2px; border-radius: 4px; display: grid; place-items: center; }
.ksb-user .ml button:hover { color: var(--n900); background: rgba(0, 0, 0, .06); }
.ksb-nav { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.ksb-link { display: flex; align-items: center; gap: 14px; margin: 0 16px; padding: 16px 18px; border-radius: 8px; font-size: 16px; color: var(--n900); text-align: left; white-space: nowrap; }
.ksb-link .fi { font-size: 18px; }
.ksb-link:hover { background: rgba(0, 0, 0, .05); }
.ksb-link[aria-current=page] { background: var(--sec); color: #fff; box-shadow: var(--shadow-md); }
.ksb-foot { margin-top: auto; padding: 14px 20px; font-size: 11px; color: var(--n700); display: flex; align-items: center; gap: 6px; }
.ksb-foot img { height: 13px; }
.ksb-rail { display: none; width: 28px; flex: none; background: var(--brand); border-right: 1px solid var(--n200); }
.ksb-rail button { margin: 12px 0 0 2px; width: 24px; height: 24px; display: grid; place-items: center; color: var(--n900); border-radius: 6px; }
body.ksb-folded .ksb { display: none; }
body.ksb-folded .ksb-rail { display: block; }

/* ------------------------------------------------------------ colonne des conversations */
.lp { width: 250px; flex: none; background: #fff; border-right: 1px solid var(--n200); display: flex; flex-direction: column; min-height: 0; }
.lp-top { padding: 12px 12px 8px; }
.seg { display: flex; background: var(--n100); border-radius: 6px; padding: 3px; gap: 3px; margin-bottom: 12px; }
.seg button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 4px 6px; border-radius: 4px; font-size: 13px; font-weight: 600; color: var(--n700); }
.seg button[aria-current=page] { background: #fff; color: var(--sec-700); box-shadow: var(--shadow-sm); }
.btn-new { width: 100%; height: 32px; border-radius: 6px; background: var(--sec); color: #fff; font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-new:hover { background: var(--sec-600); }
.lp-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; min-height: 0; }
.grp { font-size: 13px; font-weight: 600; color: var(--n700); margin: 12px 8px 4px; }
.conv { display: flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.conv:hover { background: var(--n100); }
.conv[aria-current=true] { background: var(--sec-50); }
.conv .tx { flex: 1; min-width: 0; }
.conv .tt { font-size: 14px; color: var(--n900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .st { font-size: 11px; color: var(--n700); display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .act { display: none; gap: 2px; }
.conv:hover .act { display: flex; }
.conv .act button { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 4px; color: var(--n800); font-size: 13px; }
.conv .act button:hover { background: var(--n200); }
.badge-new { font-size: 10.5px; font-weight: 700; color: var(--green-800); background: var(--green-100); padding: 0 4px; border-radius: 2px; }
.lp-empty { font-size: 12px; color: var(--n600); padding: 8px; }
.lp-bottom { border-top: 1px solid var(--n200); padding: 10px 12px; font-size: 12px; }
.lp-model { display: flex; align-items: center; gap: 8px; color: var(--n800); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot-ok { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.lp-settings { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--n900); font-size: 13px; padding: 2px 4px; border-radius: 4px; }
.lp-settings:hover { background: var(--n100); }
.lp-rail { width: 48px; flex: none; border-right: 1px solid var(--n200); background: #fff; display: none; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; }
.lp-rail button { width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; color: var(--n700); font-size: 16px; }
.lp-rail button:hover { background: var(--n100); }
.lp-rail button[aria-current=page] { background: var(--sec-50); color: var(--sec-700); }

/* ------------------------------------------------------------ centre */
.center { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--n50); position: relative; }
.hdr { height: 48px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--n200); }
.hdr h1 { font: 700 16px/1.2 var(--heading); color: var(--n800); margin: 0; flex: 1; min-width: 64px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--sec-200); background: var(--sec-50); color: var(--sec-700); border-radius: 999px; padding: 2px 10px; font-size: 13px; white-space: nowrap; }
.btn-out { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border: 1px solid var(--n300); border-radius: 6px; color: var(--sec-700); font-size: 14px; font-weight: 700; background: #fff; white-space: nowrap; }
.btn-out:hover { background: var(--n100); }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; color: var(--n800); font-size: 16px; }
.icon-btn:hover { background: var(--n100); }
.scroll { flex: 1; overflow-y: auto; min-height: 0; position: relative; display: flex; flex-direction: column; }
.thread { display: flex; flex-direction: column; gap: 12px; max-width: 860px; width: 100%; margin: 0 auto; padding: 16px; flex: 1 0 auto; }
.drop-over { position: absolute; inset: 8px; z-index: 5; background: rgba(255, 255, 255, .92); border: 2px dashed var(--sec-400); border-radius: 8px; display: grid; place-items: center; font-size: 14px; pointer-events: none; }

/* écran vide */
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.empty h2 { font: 700 20px/1.2 var(--heading); color: var(--n800); margin: 0 0 8px; }
.empty p { font-size: 14px; color: var(--n700); max-width: 560px; margin: 0 0 12px; }
.note { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; text-align: left; border-radius: 6px; padding: 8px 12px; margin: 0 0 20px; max-width: 560px; color: var(--sec-800); background: var(--sec-50); border: 1px solid var(--sec-100); }
.note .fi { margin-top: 3px; }
.sugg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 620px; width: 100%; }
.sugg-grid button { border: 1px solid var(--n300); background: #fff; border-radius: 6px; padding: 12px 16px; font-size: 14px; color: var(--n800); line-height: 1.35; }
.sugg-grid button:hover { background: var(--n100); }

/* messages */
.u-msg { align-self: flex-end; max-width: 85%; background: var(--sec-50); border-radius: 8px; padding: 8px 12px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; color: var(--n900); }
.u-files { align-self: flex-end; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 85%; margin-top: -6px; }
.fchip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; border: 1px solid var(--n300); background: #fff; border-radius: 6px; padding: 2px 8px; color: var(--n800); max-width: 280px; cursor: pointer; }
.fchip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fchip:hover { border-color: var(--sec-300); }
.fchip .rm { color: var(--n600); font-size: 13px; }
.a-text { font-size: 16px; line-height: 1.6; color: var(--n900); }
.a-text p { margin: 0 0 10px; }
.a-text p:last-child { margin-bottom: 0; }
.a-text h3 { font: 700 16px var(--heading); margin: 14px 0 6px; color: var(--n800); }
.a-text ul, .a-text ol { margin: 4px 0 10px; padding-left: 24px; }
.a-text li { margin: 2px 0; }
.a-text code { font-size: 13px; background: var(--n100); border-radius: 4px; padding: 0 4px; }
.a-text pre { background: var(--n100); border-radius: 6px; padding: 12px 16px; overflow-x: auto; font-size: 14px; }
.a-text pre code { background: none; padding: 0; }
.a-text table { border-collapse: collapse; margin: 6px 0 12px; font-size: 14px; width: 100%; background: #fff; }
.a-text th, .a-text td { border: 1px solid var(--n300); padding: 6px 8px; text-align: left; vertical-align: top; }
.a-text th { font-weight: 700; background: var(--n100); }
.a-text blockquote { margin: 6px 0; padding: 2px 12px; border-left: 3px solid var(--sec-200); color: var(--n700); }
.caret { display: inline-block; width: 7px; height: 15px; background: var(--sec); vertical-align: -2px; animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.thinking { font-size: 12px; color: var(--n600); }
.thinking summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.thinking summary::-webkit-details-marker { display: none; }
.thinking .tb { white-space: pre-wrap; border-left: 2px solid var(--n300); padding: 4px 0 4px 10px; margin-top: 4px; max-height: 200px; overflow-y: auto; }
.fin { display: flex; justify-content: center; align-items: center; gap: 10px; font-size: 12px; color: var(--n700); }
.fin button { font-size: 12px; color: var(--sec-700); text-decoration: underline; }
.err-box { display: flex; gap: 8px; align-items: flex-start; background: var(--red-50); color: #9B2C2C; border-radius: 6px; padding: 8px; font-size: 14px; }

/* ligne d'outil (KMS) */
.tool { border: 1px solid var(--n200); border-radius: 6px; background: #fff; overflow: hidden; }
.tool-h { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; text-align: left; }
.tool-h:hover { background: var(--n50); }
.tool-h .fi { color: var(--sec); }
.tool-h b { font-size: 12px; font-weight: 700; flex: none; color: var(--n900); }
.tool-h .sm { font: 12px var(--mono); color: var(--n700); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-h .mt { font-size: 12px; color: var(--n600); flex: none; }
.tool-h .ok { color: var(--green-600); } .tool-h .ko { color: var(--red-600); }
.tool-h .chev { color: var(--n500); }
.tool-b { padding: 0 12px 12px; font-size: 12px; }

/* carte d'agent (reprise de la carte « Recherche documentaire ») */
.kcard { border: 1px solid var(--sec-200); border-radius: 6px; background: #fff; overflow: hidden; }
.kcard.failed { border-color: var(--red-300); }
.kcard-h { padding: 12px 16px; background: #fff; }
.kcard.running .kcard-h { background: var(--sec-50); }
.kcard-t { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kcard-t > .fi { color: var(--sec-700); font-size: 16px; }
.kcard-t b { font-size: 15px; font-weight: 700; color: var(--n900); }
.kcard-t .pill { font-size: 12px; padding: 0 8px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.kcard-t .tm { margin-left: auto; display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--n800); font-variant-numeric: tabular-nums; }
.kcard-q { font-size: 14px; color: var(--n900); margin: 8px 0; }
.kprog { height: 6px; background: var(--n200); border-radius: 999px; overflow: hidden; margin: 6px 0 8px; }
.kprog > i { display: block; height: 100%; background: var(--sec); border-radius: 999px; transition: width .4s; }
.phases { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 4px 0 6px; }
.ph { font-size: 13px; padding: 1px 10px; border-radius: 999px; border: 1px solid var(--n300); color: var(--n800); background: #fff; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.ph.done { border-color: var(--green-200); background: var(--green-50); color: var(--green-800); }
.ph.on { background: var(--sec); border-color: var(--sec); color: #fff; font-weight: 600; }
.ph.on .spinner { color: #fff; width: 10px; height: 10px; }
.ph-sep { color: var(--n500); font-size: 12px; }
.kcard-msg { font-size: 13px; color: var(--n800); }
.kcard-b { border-top: 1px solid var(--n200); padding: 12px 16px; }
.kh { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--n700); text-transform: uppercase; letter-spacing: .025em; margin: 0 0 6px; }
.kcard-b .kh:not(:first-child) { margin-top: 14px; }
.lnk { font-size: 14px; color: var(--sec-700); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.lnk:hover { text-decoration: underline; }
.steps { list-style: none; margin: 6px 0 0; padding: 0 0 0 8px; }
.step { display: grid; grid-template-columns: 40px 18px 1fr auto; gap: 4px; align-items: start; font-size: 13px; color: var(--n900); padding: 2px 0; }
.step .t { color: var(--n700); font-variant-numeric: tabular-nums; }
.step .ic { color: var(--n700); padding-top: 2px; }
.step .ic.warn { color: var(--orange); }
.step .ic.err { color: var(--red-600); }
.step .det { color: var(--n600); }
.step .rz { grid-column: 3 / 5; }
.step .st { font-size: 12px; color: var(--n600); white-space: nowrap; }
.step .st.ok { color: var(--green-600); }
.step[data-level=warn] .lbl { color: var(--orange-700); }
.stream { font: 11px/1.5 var(--mono); color: var(--n700); background: var(--n50); border: 1px solid var(--n200); border-radius: 6px; padding: 6px 8px; max-height: 160px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; margin: 4px 0 2px; }
.stream.rs { font-family: var(--body); font-style: italic; }
.mini-link { font-size: 12px; color: var(--sec-700); text-decoration: underline; }
.prod { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 15px; color: var(--n900); }
.prod > .fi { color: var(--n700); }
.prod .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; text-align: left; }
.prod .nm:hover { text-decoration: underline; }
.prod .rs { font-size: 12px; color: var(--n600); white-space: nowrap; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
.pg { min-width: 26px; height: 22px; padding: 0 7px; border-radius: 6px; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; background: var(--sec); color: #fff; }
.pg.lt { background: #fff; color: var(--n800); border: 1px solid var(--n300); font-weight: 400; }
.pg:hover { filter: brightness(1.08); }
.pg.on { outline: 2px solid var(--brand-700); }

/* au-dessus de la saisie */
.status-line { max-width: 860px; margin: 0 auto 4px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--n800); padding: 0 16px; width: 100%; }
.status-line .tm { color: var(--n600); font-variant-numeric: tabular-nums; }

/* zone de saisie */
.composer-wrap { flex: none; padding: 0 16px 0; }
.composer { max-width: 860px; margin: 0 auto; background: #fff; border: 1px solid var(--sec-400); border-radius: 6px; }
.composer:focus-within { border-color: var(--sec); box-shadow: 0 0 0 1px var(--sec); }
.composer.drag { border-style: dashed; background: var(--sec-50); }
.composer textarea { display: block; width: 100%; border: 0; resize: none; background: transparent; padding: 14px 12px 6px; font-size: 15px; min-height: 48px; max-height: 240px; line-height: 1.5; color: var(--n900); }
.composer textarea::placeholder { color: var(--n600); }
.att { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 0; }
.att:empty { display: none; }
.cbar { display: flex; align-items: center; gap: 8px; padding: 4px 8px 8px 12px; }
.cbar .clip { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; color: var(--n700); font-size: 16px; }
.cbar .clip:hover { background: var(--n100); }
.cbar .hint { flex: 1; font-size: 12px; color: var(--n700); }
.mem { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--n800); white-space: nowrap; }
.mem i { width: 40px; height: 4px; background: var(--n200); border-radius: 99px; overflow: hidden; display: block; }
.mem i b { display: block; height: 100%; background: #3182CE; }
.btn-plus { width: 32px; height: 32px; border: 1px solid var(--sec-400); color: var(--sec); border-radius: 6px; display: grid; place-items: center; font-size: 16px; background: #fff; }
.btn-plus:hover { background: var(--sec-50); }
.btn-send { width: 32px; height: 32px; border-radius: 6px; background: var(--sec); color: #fff; display: grid; place-items: center; font-size: 15px; }
.btn-send:disabled { background: var(--sec-200); opacity: 1; }
.btn-stop { height: 32px; padding: 0 12px; border: 1px solid var(--red-300); color: var(--red-600); border-radius: 6px; font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; background: #fff; }
.btn-stop:hover { background: var(--red-50); }
.legal { text-align: center; font-size: 11px; color: var(--n700); padding: 6px 16px 8px; }
.legal button { text-decoration: underline; font-size: 11px; color: var(--n800); }
.menu { position: fixed; z-index: 60; background: #fff; border: 1px solid var(--n200); border-radius: 6px; box-shadow: var(--shadow-lg); padding: 6px 0; min-width: 300px; max-width: 420px; }
.menu .mt { font-size: 12px; font-weight: 700; color: var(--n700); padding: 4px 12px; text-transform: uppercase; letter-spacing: .025em; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 7px 12px; font-size: 14px; color: var(--n800); }
.menu button:hover { background: var(--n100); }
.menu button small { display: block; font-size: 12px; color: var(--n600); }
.menu hr { border: 0; border-top: 1px solid var(--n200); margin: 6px 0; }

/* ------------------------------------------------------------ panneau Plan / fichiers */
.sp { width: 290px; flex: none; background: #fff; border-left: 1px solid var(--n200); overflow-y: auto; display: flex; flex-direction: column; }
.sp-sec { padding: 12px; border-bottom: 1px solid var(--n200); }
.sp-t { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--n700); text-transform: uppercase; letter-spacing: .025em; margin-bottom: 8px; width: 100%; text-align: left; }
.sp-t .n { font-weight: 400; text-transform: none; }
.sp-p { font-size: 12px; color: var(--n600); margin: 0; }
.todo { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--n900); margin: 2px 0; }
.todo .bx { width: 14px; height: 14px; margin-top: 2px; border: 1px solid var(--n400); border-radius: 2px; display: grid; place-items: center; flex: none; font-size: 10px; }
.todo.done { color: var(--n500); }
.todo.done .tx { text-decoration: line-through; }
.todo.warn .bx { border-color: var(--orange); color: var(--orange); }
.todo .spinner { width: 9px; height: 9px; border-width: 1px; }
.sp-prog { height: 4px; background: var(--n200); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.sp-prog i { display: block; height: 100%; background: #3182CE; }
.cwd { font: 12px var(--mono); word-break: break-all; margin-bottom: 8px; color: var(--n900); }
.btn-xs { height: 24px; padding: 0 8px; border: 1px solid var(--n300); border-radius: 6px; font-size: 12px; font-weight: 700; color: var(--n800); background: #fff; }
.btn-xs:hover { background: var(--n100); }
.dropz { border: 1px dashed var(--n300); border-radius: 6px; padding: 12px; text-align: center; font-size: 12px; color: var(--n700); cursor: pointer; margin-bottom: 8px; }
.dropz:hover, .dropz.over { border-color: var(--sec-400); background: var(--sec-50); }
.flist { display: flex; flex-direction: column; }
.fitem { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 4px; border-radius: 2px; color: var(--n900); cursor: pointer; }
.fitem:hover { background: var(--n100); }
.fitem .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.fitem .ey { color: var(--n500); }
.fitem .dl { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 4px; color: var(--n700); }
.fitem .dl:hover { background: var(--n200); }
.fitem.on { background: var(--sec-50); }
.fsub { font-size: 11px; color: var(--n600); padding: 6px 4px 2px; border-top: 1px solid var(--n200); margin-top: 6px; }

/* ------------------------------------------------------------ Panneau (visualisation) */
.pan { width: 50%; max-width: 980px; min-width: 420px; flex: none; background: #fff; border-left: 1px solid var(--n200); display: flex; flex-direction: column; min-height: 0; position: relative; }
.pan-resize { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 3; }
.pan-h { display: flex; align-items: center; gap: 10px; padding: 10px 12px 8px 16px; border-bottom: 1px solid var(--n200); }
.pan-h .tt { flex: 1; min-width: 0; }
.pan-h h2 { font: 700 15px/1.3 var(--heading); color: var(--n800); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pan-h .kd { font-size: 12px; color: var(--n600); }
.pan-tabs { display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--n200); overflow-x: auto; flex: none; background: var(--n50); }
.ptab { display: flex; align-items: center; gap: 6px; padding: 6px 10px; font-size: 12px; color: var(--n700); border-bottom: 2px solid transparent; white-space: nowrap; max-width: 220px; }
.ptab span { overflow: hidden; text-overflow: ellipsis; }
.ptab[aria-current=page] { color: var(--sec-700); border-bottom-color: var(--sec); font-weight: 600; background: #fff; }
.ptab .x { opacity: .6; font-style: normal; } .ptab .x:hover { opacity: 1; color: var(--red-600); }
.pan-tb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--n200); flex: none; }
.pan-tb .sep { width: 1px; height: 18px; background: var(--n300); margin: 0 2px; }
.pan-c { flex: 1; min-height: 0; overflow: auto; padding: 16px; }
.pan-c.flush { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--n300); background: #fff; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--n800); white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--n100); }
.btn.pri { background: var(--sec); border-color: var(--sec); color: #fff; }
.btn.pri:hover { background: var(--sec-600); }
.btn.on { background: var(--sec-50); border-color: var(--sec-300); color: var(--sec-700); }

/* contenus des visualiseurs */
.card { border: 1px solid var(--n200); border-radius: 6px; padding: 12px 14px; margin-bottom: 12px; background: #fff; }
.card h3 { font: 700 15px/1.3 var(--heading); color: var(--n800); margin: 0 0 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sub { color: var(--n600); font-size: 13px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.kpi { border: 1px solid var(--n200); border-radius: 6px; padding: 8px 12px; background: #fff; }
.kpi .k { font-size: 11px; font-weight: 700; color: var(--n600); text-transform: uppercase; letter-spacing: .025em; }
.kpi .v { font: 700 22px/1.3 var(--heading); color: var(--n800); }
.kpi .v.ok { color: var(--green-600); } .kpi .v.warn { color: var(--orange); } .kpi .v.bad { color: var(--red-600); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 700; font-size: 12px; color: var(--n700); padding: 6px 8px; border-bottom: 1px solid var(--n300); background: var(--n50); }
table.t td { padding: 6px 8px; border-bottom: 1px solid var(--n200); vertical-align: top; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--sec-50); }
.id { font: 600 12px var(--mono); white-space: nowrap; }
.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 2px; white-space: nowrap; background: var(--n100); color: var(--n800); text-transform: uppercase; letter-spacing: .02em; }
.chip.ok { background: var(--green-100); color: var(--green-800); }
.chip.warn { background: var(--orange-100); color: var(--orange-700); }
.chip.bad { background: var(--red-100); color: #9B2C2C; }
.chip.ink { background: var(--sec-50); color: var(--sec-700); text-transform: none; font-family: var(--mono); }
.blk { font: 600 11px var(--mono); padding: 0 5px; border-radius: 4px; background: var(--n100); color: var(--n800); margin: 1px 2px 1px 0; display: inline-block; cursor: pointer; border: 1px solid var(--n200); text-decoration: none; }
.blk:hover { background: var(--sec-50); color: var(--sec-700); border-color: var(--sec-200); }
.finding { border: 1px solid var(--n200); border-left: 3px solid var(--n400); border-radius: 0 6px 6px 0; padding: 8px 12px; margin-bottom: 8px; cursor: pointer; background: #fff; }
.finding:hover { background: var(--n50); }
.finding.bad { border-left-color: var(--red); } .finding.warn { border-left-color: var(--orange); } .finding.info { border-left-color: var(--sec-300); }
.finding .fh { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 2px; }
.finding p { margin: 3px 0; font-size: 13px; }
.finding .reco { color: var(--green-800); }
ul.plain { margin: 6px 0; padding-left: 18px; font-size: 14px; }
.gauge { display: flex; gap: 14px; align-items: center; }
.gauge svg { width: 74px; height: 74px; flex: none; }
.empty-r { color: var(--n600); text-align: center; padding: 40px 20px; font-size: 14px; }
.empty-r h3 { font: 700 17px var(--heading); color: var(--n800); margin: 0 0 6px; }
.dg-wrap { flex: 1; position: relative; min-height: 0; background-color: #fff; background-image: radial-gradient(var(--n300) 1px, transparent 1px); background-size: 18px 18px; }
.dg-canvas { position: absolute; inset: 0; }
.dg-status { display: flex; gap: 8px; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--n200); font-size: 12px; flex: none; flex-wrap: wrap; }
.dg-notes { padding: 10px 14px; border-top: 1px solid var(--n200); font-size: 13px; max-height: 140px; overflow: auto; flex: none; }
.dg-notes ul { margin: 4px 0 0; padding-left: 18px; }
.fd-svg { display: block; cursor: grab; user-select: none; }
.fd-svg.dragging { cursor: grabbing; }
.fd-title { font: 700 13px var(--heading); fill: var(--n800); }
.fd-edge { fill: none; stroke: #4A5568; stroke-width: 1.3; }
.fd-arrowhead { fill: #4A5568; }
.fd-neg { fill: #fff; stroke: #4A5568; stroke-width: 1.3; }
.fd-box { stroke: #2D3748; stroke-width: 1.3; fill: #fff; }
.fd-io-band { fill: var(--sec-50); }
.fd-DI .fd-io-band { fill: var(--brand-50); }
.fd-AL .fd-out { fill: #FFFAF0; stroke: var(--orange); }
.fd-DO .fd-out { fill: var(--sec-50); stroke: var(--sec-700); }
.fd-io-type { font: 700 9.5px var(--mono); fill: var(--sec-700); }
.fd-DI .fd-io-type { fill: #975A16; }
.fd-io-type2 { font: 700 9px var(--mono); fill: var(--n500); }
.fd-tag { font: 600 11.5px var(--mono); fill: var(--n900); }
.fd-sub { font: 10.5px var(--body); fill: var(--n700); }
.fd-strong { font-weight: 600; fill: var(--n800); }
.fd-sym { font: 600 15px var(--mono); fill: var(--n900); text-anchor: middle; }
.fd-sym-s { font-size: 12px; }
.fd-port { font: 600 9px var(--mono); fill: var(--n700); }
.fd-label { font: 600 10.5px var(--body); fill: var(--n700); }
.fd-req { font: 600 9.5px var(--mono); fill: var(--sec); text-anchor: middle; }
.fd-val { font: 600 11px var(--mono); fill: var(--signal); }
.fd-prog { fill: var(--signal); }
.fd-node { cursor: pointer; }
.fd-node:hover .fd-box { stroke: var(--sec); stroke-width: 2; }
.fd-has-hl .fd-node, .fd-has-hl .fd-edge { opacity: .2; }
.fd-has-hl .fd-node.fd-hl, .fd-has-hl .fd-edge.fd-hl { opacity: 1; }
.fd-has-hl .fd-node.fd-hl .fd-box { stroke: var(--red); stroke-width: 2.4; }
.fd-simulating .fd-edge { stroke: #CBD5E0; }
.fd-simulating .fd-edge.fd-on { stroke: var(--signal); stroke-width: 2.4; }
.fd-simulating .fd-edge.fd-real { stroke: var(--sec-400); stroke-dasharray: 4 3; }
.fd-simulating .fd-node.fd-on .fd-box { stroke: var(--signal); stroke-width: 2.3; fill: var(--signal-bg); }
.fd-simulating .fd-AL.fd-on .fd-out, .fd-simulating .fd-DO.fd-on .fd-out { fill: var(--signal); stroke: #9C4221; }
.fd-simulating .fd-DO.fd-on text, .fd-simulating .fd-AL.fd-on text { fill: #fff; }
.dg-pop { position: absolute; z-index: 5; width: 290px; background: #fff; border: 1px solid var(--n200); border-radius: 6px; box-shadow: var(--shadow-lg); padding: 12px 14px; font-size: 13px; }
.dg-pop h4 { font: 700 14px var(--heading); margin: 0 0 2px; color: var(--n800); }
.dg-pop dl { display: grid; grid-template-columns: 84px 1fr; gap: 3px 8px; margin: 8px 0 0; }
.dg-pop dt { color: var(--n600); }
.dg-pop dd { margin: 0; font: 12px var(--mono); word-break: break-word; }
.simpanel { position: absolute; top: 10px; left: 10px; z-index: 4; width: 250px; max-height: calc(100% - 20px); overflow: auto; background: #fff; border: 1px solid var(--n200); border-radius: 6px; box-shadow: var(--shadow-lg); font-size: 13px; }
.simpanel header { padding: 8px 12px; border-bottom: 1px solid var(--n200); display: flex; justify-content: space-between; align-items: center; font: 700 14px var(--heading); }
.simsec { padding: 8px 12px; border-bottom: 1px solid var(--n200); }
.simsec:last-child { border-bottom: 0; }
.ss-t { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .025em; color: var(--n700); margin-bottom: 5px; }
.sim-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 0; }
.sim-row .nm { font: 600 11.5px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sim-row input[type=number] { width: 76px; padding: 2px 6px; font: 12px var(--mono); border: 1px solid var(--n300); border-radius: 4px; }
input[type=range] { width: 100%; accent-color: var(--sec); }
.toggle { position: relative; width: 34px; height: 19px; border-radius: 10px; background: var(--n300); flex: none; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle.on { background: var(--sec); }
.toggle.on::after { left: 17px; }
.lamp { width: 14px; height: 14px; border-radius: 50%; background: var(--n200); border: 1px solid var(--n400); flex: none; }
.lamp.on { background: var(--signal); border-color: #9C4221; box-shadow: 0 0 8px rgba(221, 107, 32, .6); }
.simclock { font: 11.5px var(--mono); color: var(--n600); }
.code-view { background: #1A202C; color: #E2E8F0; font: 12px/1.6 var(--mono); padding: 10px 0; overflow: auto; flex: 1; min-height: 0; }
.code-view .ln { display: flex; }
.code-view .ln.hl { background: rgba(251, 231, 77, .18); }
.code-view .num { width: 46px; flex: none; text-align: right; padding-right: 14px; color: #4A5568; user-select: none; }
.code-view .src { white-space: pre; padding-right: 20px; }
.k-kw { color: #90CDF4; } .k-ty { color: #9AE6B4; } .k-cm { color: #718096; font-style: italic; } .k-st { color: #FBD38D; } .k-nu, .k-tm { color: #F6AD55; } .k-var { color: #F7FAFC; }
.code-side { border-top: 1px solid var(--n200); max-height: 40%; overflow: auto; padding: 10px 14px; flex: none; }
.sc { border: 1px solid var(--n200); border-radius: 6px; margin-bottom: 8px; overflow: hidden; background: #fff; }
.sc-h { display: flex; gap: 10px; align-items: center; padding: 8px 12px; cursor: pointer; }
.sc-h:hover { background: var(--n50); }
.sc-h .ttl { flex: 1; font-size: 13px; }
.sc-b { border-top: 1px solid var(--n200); padding: 8px 12px 10px; display: none; overflow-x: auto; }
.sc.open .sc-b { display: block; }
.mini { font: 11.5px var(--mono); }
.ok-t { color: var(--green-600); font-weight: 700; } .bad-t { color: var(--red-600); font-weight: 700; }
.txt-view { white-space: pre-wrap; font: 12.5px/1.6 var(--mono); margin: 0; background: var(--n100); border-radius: 6px; padding: 12px; }
.img-view { max-width: 100%; border: 1px solid var(--n200); border-radius: 6px; }
.file-list .prod { border-bottom: 1px solid var(--n100); padding: 6px 2px; }
.file-list h4 { font-size: 12px; font-weight: 700; color: var(--n700); text-transform: uppercase; letter-spacing: .025em; margin: 14px 0 6px; }

/* ------------------------------------------------------------ dialogues (Chakra Modal) */
.dialog-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .48); z-index: 50; display: grid; place-items: start center; padding: 64px 16px 16px; overflow: auto; }
.dialog { background: #fff; border-radius: 6px; width: min(512px, 100%); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: calc(100dvh - 80px); }
.dialog.wide { width: min(1000px, 100%); }
.dialog header { padding: 16px 24px 8px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dialog header h2 { font: 600 20px/1.3 var(--heading); margin: 0; color: var(--n800); }
.dialog .db { padding: 8px 24px; overflow: auto; flex: 1; font-size: 14px; }
.dialog footer { padding: 16px 24px; display: flex; justify-content: flex-end; gap: 12px; align-items: center; }
.field { margin-bottom: 14px; }
.field label { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; color: var(--n800); margin-bottom: 6px; }
.field select, .field input, .field textarea { width: 100%; border: 1px solid var(--n300); border-radius: 6px; background: #fff; padding: 7px 12px; font-size: 15px; }
.field select:focus, .field input:focus, .field textarea:focus { border-color: #3182CE; box-shadow: 0 0 0 1px #3182CE; }
.field textarea { resize: vertical; min-height: 120px; }
textarea.code { font: 12px/1.5 var(--mono); white-space: pre; }
.err { color: var(--red-600); font-size: 13px; }
.kb-grid { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.kb-item { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border: 1px solid var(--n200); border-radius: 6px; margin-bottom: 6px; cursor: pointer; font-size: 13px; }
.kb-item:hover, .kb-item.on { border-color: var(--sec-300); background: var(--sec-50); }
.kb-view { white-space: pre-wrap; font: 12px/1.55 var(--mono); max-height: 60vh; overflow: auto; margin: 0; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #2D3748; color: #fff; padding: 10px 16px; border-radius: 6px; font-size: 14px; z-index: 100; box-shadow: var(--shadow-lg); }

/* ------------------------------------------------------------ connexion (KMS) */
.login { min-height: 100dvh; display: grid; place-items: center; background: #F7FAFC; padding: 16px; }
.login-card { width: 100%; max-width: 384px; background: #fff; border-radius: 6px; box-shadow: var(--shadow-lg); padding: 32px; }
.login-card h1 { font: 800 30px/1.2 var(--heading); text-align: center; margin: 0; color: var(--n900); letter-spacing: .5px; }
.login-card .sub { text-align: center; color: var(--n700); font-size: 16px; margin: 6px 0 32px; }
.login-card label { display: block; font-size: 16px; font-weight: 500; margin-bottom: 8px; color: var(--n800); }
.login-card label i { color: var(--red); font-style: normal; margin-left: 2px; }
.login-card .inp { position: relative; margin-bottom: 20px; }
.login-card input { width: 100%; height: 40px; border: 1px solid var(--n300); border-radius: 6px; padding: 0 40px 0 16px; font-size: 16px; }
.login-card input:focus { border-color: #3182CE; box-shadow: 0 0 0 1px #3182CE; }
.login-card .eye { position: absolute; right: 8px; top: 8px; width: 24px; height: 24px; display: grid; place-items: center; color: var(--n800); }
.login-card .go { width: 100%; height: 48px; background: var(--brand); color: var(--n900); font-weight: 700; font-size: 18px; border-radius: 6px; margin-top: 12px; }
.login-card .go:hover { background: var(--brand-600); }
.login-card .foot { text-align: center; font-size: 14px; color: var(--n700); margin: 24px 0 0; }
.login-card .foot img { height: 13px; vertical-align: -1px; margin: 0 3px; }

@media (max-width: 1599px) { body.pan-open .lp { display: none; } body.pan-open .lp-rail { display: flex; } }
@media (max-width: 1100px) { .sp { display: none; } .pan { min-width: 0; position: absolute; top: 0; right: 0; bottom: 0; width: min(100%, 720px); z-index: 20; box-shadow: var(--shadow-lg); } }
@media (max-width: 860px) { .ksb, .ksb-rail { display: none !important; } .lp { display: none; } .lp-rail { display: flex; } .sugg-grid { grid-template-columns: 1fr; } .kb-grid { grid-template-columns: 1fr; } .cbar .hint { display: none; } }
