/* Atelier RODA69 — feuille de style */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../vendor/inter/inter-latin-wght-normal.woff2') format('woff2-variations');
}

:root {
  --bg: #0b1020; --bg2: #0e1530; --panel: #121a35; --panel2: #172247; --hover: #1b2852;
  --line: #233059; --line2: #2f3e72; --txt: #e9edf8; --mut: #9ba7c9; --mut2: #6e7ba3;
  --acc: #4f8cff; --acc2: #3b74ea; --acc-bg: #4f8cff1f; --orange: #ff8a3d; --orange-bg: #ff8a3d1c;
  --ok: #2fbf71; --ok-bg: #2fbf711f; --warn: #f5b041; --warn-bg: #f5b0411f; --err: #ff6161; --err-bg: #ff61611c;
  --radius: 14px; --radius-s: 9px;
  --shadow: 0 18px 50px -24px #000d; --shadow-s: 0 6px 20px -12px #000c;
  --viewer: radial-gradient(120% 90% at 30% 10%, #1d2b58 0%, #0d1430 70%);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f5fb; --bg2: #eef1f8; --panel: #ffffff; --panel2: #f6f8fd; --hover: #eef2fb;
  --line: #e0e5f0; --line2: #cfd7e8; --txt: #141b30; --mut: #5b6788; --mut2: #8a94b0;
  --acc: #2f6fec; --acc2: #2459c9; --acc-bg: #2f6fec14; --orange: #e86f1f; --orange-bg: #e86f1f14;
  --ok: #1d9a58; --ok-bg: #1d9a5814; --warn: #b7791f; --warn-bg: #b7791f14; --err: #d93838; --err-bg: #d9383812;
  --shadow: 0 18px 50px -28px #1b2a5a55; --shadow-s: 0 6px 20px -14px #1b2a5a55;
  --viewer: radial-gradient(120% 90% at 30% 10%, #ffffff 0%, #e4e9f5 75%);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.5 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--txt); -webkit-font-smoothing: antialiased;
}
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 19px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 10px; }
code, pre, textarea.code { font-family: ui-monospace, 'JetBrains Mono', 'Cascadia Code', Menlo, monospace; font-size: 13px; }
.mut { color: var(--mut); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.hidden { display: none !important; }
.ic { width: 18px; height: 18px; stroke-width: 2; flex: none; vertical-align: -3px; }
.ic.s { width: 15px; height: 15px; }
.ic.l { width: 22px; height: 22px; }
.ic.xl { width: 34px; height: 34px; stroke-width: 1.6; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.gap-s { gap: 6px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Mise en page ─────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 18px 14px; background: var(--bg2); border-right: 1px solid var(--line); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 750; letter-spacing: .04em; }
.brand-logo { width: 34px; height: 34px; flex: none; }
.brand small { display: block; font-weight: 500; letter-spacing: 0; color: var(--mut); font-size: 12px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px; color: var(--mut);
  font-weight: 550; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; font: inherit;
}
.nav-item:hover { background: var(--hover); color: var(--txt); text-decoration: none; }
.nav-item.active { background: var(--acc-bg); color: var(--txt); }
.nav-item.active .ic { color: var(--acc); }
.nav-label { padding: 16px 11px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--mut2); font-weight: 650; }
.nav-project { font-weight: 500; font-size: 14px; padding: 7px 11px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.main { min-width: 0; padding: 28px 34px 60px; max-width: 1400px; width: 100%; }
.topbar { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--mut); margin-top: 6px; }
.crumb { color: var(--mut); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.crumb a { color: var(--mut); }

/* ── Composants ───────────────────────────────────────────── */
.card { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card.pad-l { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border-radius: 10px;
  border: 1px solid var(--line2); background: var(--panel2); color: var(--txt); font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--hover); border-color: var(--mut2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: #fff; }
.btn.primary:hover { background: var(--acc2); }
.btn.orange { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--mut); }
.btn.ghost:hover { background: var(--hover); color: var(--txt); }
.btn.danger { color: var(--err); }
.btn.danger:hover { background: var(--err-bg); border-color: var(--err); }
.btn.s { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.l { padding: 13px 20px; font-size: 15px; border-radius: 12px; }
.btn.icon { padding: 7px; }
.btn.block { width: 100%; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--panel2); color: var(--mut); border: 1px solid var(--line); white-space: nowrap;
}
.chip.acc { background: var(--acc-bg); color: var(--acc); border-color: transparent; }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.err { background: var(--err-bg); color: var(--err); border-color: transparent; }
.chip.orange { background: var(--orange-bg); color: var(--orange); border-color: transparent; }
button.chip { cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; }
button.chip.on { background: var(--acc); color: #fff; border-color: var(--acc); }

.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-weight: 700; font-size: 13px; color: #fff; text-transform: uppercase;
}
.avatar.s { width: 22px; height: 22px; font-size: 11px; }
.avatar.l { width: 40px; height: 40px; font-size: 16px; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--mut); font-weight: 550; }
input, select, textarea {
  font: inherit; color: var(--txt); background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px;
  padding: 9px 12px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-bg); }
textarea { resize: vertical; min-height: 80px; }
textarea.code { min-height: 340px; line-height: 1.55; tab-size: 4; white-space: pre; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--acc); }
input[type="color"] { padding: 2px; height: 40px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }

.progress { height: 8px; background: var(--panel2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--acc), #7aa8ff); border-radius: 99px; transition: width .4s; }
.progress.ok > i { background: linear-gradient(90deg, var(--ok), #5fd896); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 20px; overflow-x: auto; }
.tab {
  padding: 10px 14px; border: 0; background: none; color: var(--mut); font: inherit; font-weight: 600; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 8px; align-items: center; white-space: nowrap;
}
.tab:hover { color: var(--txt); text-decoration: none; }
.tab.active { color: var(--txt); border-bottom-color: var(--acc); }
.tab .count { font-size: 11px; background: var(--panel2); border-radius: 99px; padding: 1px 7px; color: var(--mut); }

.empty { text-align: center; padding: 38px 20px; color: var(--mut); border: 1.5px dashed var(--line2); border-radius: var(--radius); }
.empty .ic.xl { color: var(--mut2); margin-bottom: 8px; }
.empty h3 { color: var(--txt); margin-bottom: 6px; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item.click { cursor: pointer; border-radius: 8px; }
.list-item.click:hover { background: var(--hover); }

.kpi { display: flex; gap: 14px; align-items: center; }
.kpi-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.kpi-val { font-size: 26px; font-weight: 750; line-height: 1.1; }
.kpi-lab { color: var(--mut); font-size: 13px; }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid; }
.banner.orange { background: var(--orange-bg); border-color: #ff8a3d55; }
.banner.acc { background: var(--acc-bg); border-color: #4f8cff55; }
.banner.warn { background: var(--warn-bg); border-color: #f5b04155; }

/* ── Projets ──────────────────────────────────────────────── */
.project-card { cursor: pointer; transition: border-color .15s, transform .15s; position: relative; overflow: hidden; }
.project-card:hover { border-color: var(--line2); transform: translateY(-2px); }
.project-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c, var(--acc)); }
.project-head { position: relative; padding: 22px 24px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); margin-bottom: 4px; overflow: hidden; }
.project-head::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--c, var(--acc)); }
.steps { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.step { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); font-size: 13px; }
.step .mini { width: 46px; height: 5px; background: var(--line); border-radius: 9px; overflow: hidden; }
.step .mini > i { display: block; height: 100%; background: var(--ok); }

/* ── Tâches (tableau) ─────────────────────────────────────── */
.board { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 16px; align-items: start; overflow-x: auto; }
.column { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 200px; }
.column.drop { border-color: var(--acc); background: var(--acc-bg); }
.column-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; font-weight: 650; }
.column-head .count { color: var(--mut); font-weight: 600; font-size: 13px; }
.cards { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.task-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; cursor: grab;
  display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-s); transition: border-color .15s;
}
.task-card:hover { border-color: var(--line2); }
.task-card.dragging { opacity: .5; }
.task-card.done .task-title { text-decoration: line-through; color: var(--mut); }
.task-title { font-weight: 600; font-size: 14px; line-height: 1.35; }
.task-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--mut); }
.quick-add { display: flex; gap: 6px; margin-bottom: 10px; }
.quick-add input { padding: 8px 10px; font-size: 14px; }
.due.late { color: var(--err); font-weight: 650; }
.due.soon { color: var(--warn); font-weight: 650; }

/* ── Pièces ───────────────────────────────────────────────── */
.part-card { padding: 0; overflow: hidden; cursor: pointer; transition: border-color .15s, transform .15s; display: flex; flex-direction: column; }
.part-card:hover { border-color: var(--line2); transform: translateY(-2px); }
.part-thumb { aspect-ratio: 4 / 3; background: var(--viewer); display: grid; place-items: center; position: relative; color: var(--mut2); }
.part-thumb img { width: 100%; height: 100%; object-fit: contain; }
.part-thumb .badges { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.part-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px; border-radius: var(--radius); border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; text-align: left; font: inherit; color: var(--txt); transition: border-color .15s, background .15s; }
.choice:hover { border-color: var(--acc); background: var(--acc-bg); }
.choice .ic.xl { color: var(--acc); }
.choice b { font-size: 15px; }
.choice span { color: var(--mut); font-size: 13px; }

.part-layout { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 18px; align-items: start; }
.viewer-wrap { position: relative; border-radius: var(--radius); border: 1px solid var(--line); background: var(--viewer); overflow: hidden; height: min(68vh, 640px); min-height: 360px; }
.viewer-wrap canvas { display: block; width: 100% !important; height: 100% !important; touch-action: none; }
.viewer-tools { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.viewer-tools .btn { background: color-mix(in srgb, var(--panel) 80%, transparent); backdrop-filter: blur(6px); }
.viewer-info { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.viewer-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--mut); padding: 20px; }
.viewer-msg img { max-width: 70%; max-height: 70%; }
.side-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side-actions .btn { justify-content: flex-start; white-space: normal; min-width: 0; text-align: left; line-height: 1.25; }
.param-row { display: grid; grid-template-columns: 1fr 120px; align-items: center; gap: 10px; }
.param-row label { font-size: 13px; color: var(--mut); font-weight: 550; }
.param-row input { padding: 7px 10px; text-align: right; }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.specs dt { color: var(--mut); }
.specs dd { margin: 0; font-weight: 550; }
.version { display: flex; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.version:last-child { border-bottom: 0; }
.version-num { width: 38px; height: 38px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.version.current .version-num { background: var(--acc); color: #fff; border-color: var(--acc); }

/* ── Fichiers & liens ─────────────────────────────────────── */
.dropzone { border: 1.5px dashed var(--line2); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--mut); transition: all .15s; }
.dropzone.over { border-color: var(--acc); background: var(--acc-bg); color: var(--txt); }
.folder { margin-bottom: 18px; }
.folder-head { display: flex; align-items: center; gap: 8px; font-weight: 650; margin-bottom: 6px; color: var(--mut); font-size: 13px; text-transform: none; }
.res-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--panel2); border: 1px solid var(--line); }
.res-thumb { width: 64px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; background: var(--panel2); }
.upload-bar { height: 6px; border-radius: 9px; background: var(--panel2); overflow: hidden; }
.upload-bar > i { display: block; height: 100%; background: var(--acc); width: 0; transition: width .2s; }

/* ── Assistant IA ─────────────────────────────────────────── */
.chat-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; height: calc(100vh - 210px); min-height: 520px; }
.chat-list { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.conv { padding: 9px 11px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.conv:hover { background: var(--hover); }
.conv.active { background: var(--acc-bg); border-color: #4f8cff40; }
.conv-title { font-weight: 600; font-size: 14px; }
.chat { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 12px; max-width: 900px; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-body { min-width: 0; }
.msg.user .bubble { background: var(--acc); color: #fff; border-radius: 16px 16px 4px 16px; padding: 10px 14px; white-space: pre-wrap; }
.msg.assistant .bubble { padding: 2px 0; }
.bot { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, var(--acc), var(--orange)); color: #fff; flex: none; }
.md p { margin: 0 0 10px; }
.md p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 4px 0 10px; padding-left: 22px; }
.md pre { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; }
.md code { background: var(--bg2); padding: 1px 5px; border-radius: 5px; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; margin: 8px 0; }
.md td, .md th { border: 1px solid var(--line); padding: 5px 9px; }
.tool-line { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mut); padding: 5px 10px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); margin: 2px 6px 6px 0; }
.tool-line.ok .ic { color: var(--ok); }
.tool-line.ko .ic { color: var(--err); }
.ev-card { margin: 8px 0; border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; background: var(--panel2); max-width: 460px; }
.ev-card .mini-viewer { height: 220px; background: var(--viewer); position: relative; }
.ev-card .ev-foot { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-input { border-top: 1px solid var(--line); padding: 12px; display: flex; gap: 10px; align-items: flex-end; background: var(--panel); }
.chat-input textarea { min-height: 46px; max-height: 200px; resize: none; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.suggestions button { font: inherit; font-size: 13px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line2); background: var(--panel2); color: var(--txt); cursor: pointer; }
.suggestions button:hover { border-color: var(--acc); background: var(--acc-bg); }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--mut); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--shadow); z-index: 60; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .25s; }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer .chat { flex: 1; border: 0; border-radius: 0; }

/* ── Modales, notifications ───────────────────────────────── */
.overlay { position: fixed; inset: 0; background: #050914b3; backdrop-filter: blur(3px); z-index: 80; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; box-shadow: var(--shadow); animation: pop .18s; }
.modal.wide { width: min(780px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.modal-body { padding: 12px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 20px 20px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; align-items: center; }
.toast { background: var(--panel2); border: 1px solid var(--line2); color: var(--txt); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; animation: pop .2s; max-width: 92vw; }
.toast.err { border-color: var(--err); }
.toast.ok .ic { color: var(--ok); }
.toast.err .ic { color: var(--err); }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--line2); border-top-color: var(--acc); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; flex: none; }
.spinner.l { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 60px; }

/* ── Connexion ────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1100px 600px at 10% -10%, #1b2a5c 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #3a1f12 0%, transparent 55%), var(--bg); }
:root[data-theme="light"] .login { background: radial-gradient(1100px 600px at 10% -10%, #dfe8ff 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #ffe6d4 0%, transparent 55%), var(--bg); }
.login-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 32px 28px; box-shadow: var(--shadow); }
.login-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.err-text { color: var(--err); font-size: 14px; min-height: 20px; }

/* ── FreeCAD ──────────────────────────────────────────────── */
.fc-hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 22px; align-items: center; }
.fc-steps { counter-reset: s; display: flex; flex-direction: column; gap: 12px; }
.fc-steps li { list-style: none; display: flex; gap: 12px; align-items: flex-start; }
.fc-steps li::before { counter-increment: s; content: counter(s); width: 26px; height: 26px; border-radius: 50%; background: var(--acc-bg); color: var(--acc); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .part-layout { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fc-hero { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 70; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow); }
  .app.menu-open .sidebar { transform: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg2); position: sticky; top: 0; z-index: 50; }
  .main { padding: 18px 16px 50px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .card, .main > * { min-width: 0; }
  .board { grid-template-columns: repeat(3, minmax(250px, 85vw)); }
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .chat-list { flex-direction: row; overflow-x: auto; }
  .conv { min-width: 180px; }
  .chat { height: 70vh; }
  .side-actions { grid-template-columns: 1fr; }
  h1 { font-size: 22px; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-val { font-size: 21px; }
  .kpi-ic { width: 38px; height: 38px; }
}

/* ══ Version CAO : machines, canva, panneau d'élément ═══════════════════════ */
.machine-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.machine-head h1 { font-size: 22px; }
.machine-head .dot { width: 12px; height: 12px; }
.iconbar { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; color: var(--mut); font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 7px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button.on { background: var(--panel); color: var(--txt); box-shadow: var(--shadow-s); }
.cao { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; height: calc(100vh - 190px); min-height: 480px; }
.cao.with-panel { grid-template-columns: minmax(0, 1fr) 360px; }
.cao-main { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: var(--viewer); overflow: hidden; min-height: 0; }
.cao-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.cao-float { position: absolute; display: flex; gap: 6px; z-index: 2; }
.cao-float.tr { top: 10px; right: 10px; }
.cao-float.bl { bottom: 10px; left: 10px; }
.cao-float .btn { background: color-mix(in srgb, var(--panel) 85%, transparent); backdrop-filter: blur(6px); }
.schema { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; user-select: none; }
.schema.panning { cursor: grabbing; }
.schema .edge { fill: none; stroke: var(--line2); stroke-width: 2; }
.schema .nd rect.box { fill: var(--panel); stroke: var(--line2); stroke-width: 1.2; rx: 12; }
.schema .nd.asm rect.box { stroke: var(--acc); stroke-width: 1.6; fill: color-mix(in srgb, var(--acc) 7%, var(--panel)); }
.schema .nd.root rect.box { fill: var(--acc); stroke: var(--acc); }
.schema .nd.root text { fill: #fff; }
.schema .nd.root .sub { fill: #ffffffcc; }
.schema .nd.sel rect.box { stroke: var(--orange); stroke-width: 2.6; }
.schema .nd.drop rect.box { stroke: var(--ok); stroke-width: 3; stroke-dasharray: 6 4; }
.schema .nd.dragging { opacity: .55; }
.schema .nd { cursor: pointer; }
.schema text { fill: var(--txt); font: 600 13px Inter, system-ui, sans-serif; }
.schema .sub { fill: var(--mut); font-weight: 500; font-size: 11px; }
.schema .badge rect { fill: var(--orange); }
.schema .badge text { fill: #fff; font-size: 11px; font-weight: 700; }
.schema .lock { fill: var(--orange); font-size: 11px; font-weight: 600; }
.schema .thumbbg { fill: var(--panel2); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-y: auto; min-height: 0; display: flex; flex-direction: column; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.panel-head h3 { font-size: 16px; flex: 1; min-width: 0; }
.panel-sec { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-sec:last-child { border-bottom: 0; }
.panel-sec h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--mut2); margin: 0 0 8px; display: flex; align-items: center; justify-content: space-between; }
.mini3d { height: 190px; border-radius: 12px; background: var(--viewer); position: relative; overflow: hidden; border: 1px solid var(--line); }
.actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.actions .btn { flex-direction: column; gap: 3px; padding: 8px 4px; font-size: 11px; font-weight: 600; }
.actions .btn .ic { width: 19px; height: 19px; }
.vrow { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.vrow:last-child { border-bottom: 0; }
.vnum { width: 30px; height: 26px; border-radius: 7px; background: var(--panel2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.vrow.cur .vnum { background: var(--acc); color: #fff; border-color: var(--acc); }
.pl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pl-grid label { font-size: 11px; color: var(--mut); display: flex; flex-direction: column; gap: 3px; }
.pl-grid input { padding: 6px 8px; font-size: 13px; }
.menu { position: absolute; z-index: 90; background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 230px; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; color: var(--txt); font: inherit; font-size: 14px; border-radius: 8px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--hover); }
.ia-dock { position: fixed; right: 16px; bottom: 16px; z-index: 55; }
.ia-fab { width: 54px; height: 54px; border-radius: 16px; border: 0; cursor: pointer; color: #fff; background: linear-gradient(135deg, var(--acc), var(--orange)); box-shadow: var(--shadow); display: grid; place-items: center; }
.undo { margin-top: 8px; }
.tool-line.sous { margin-left: 18px; font-size: 12px; }
.machine-card { cursor: pointer; display: flex; gap: 12px; align-items: center; }
.sidebar .machine-link { display: flex; align-items: center; gap: 10px; padding: 8px 11px; border-radius: 10px; color: var(--mut); font-weight: 550; font-size: 14px; }
.sidebar .machine-link:hover { background: var(--hover); color: var(--txt); text-decoration: none; }
.sidebar .machine-link.active { background: var(--acc-bg); color: var(--txt); }
@media (max-width: 1100px) { .cao.with-panel { grid-template-columns: minmax(0, 1fr) 320px; } }
@media (max-width: 860px) {
  .cao, .cao.with-panel { grid-template-columns: 1fr; height: auto; }
  .cao-main { height: 60vh; }
  .panel { max-height: none; }
}

/* Assistant : réflexion à voix haute, notes des sous-agents, consignes */
.pensee { margin: 2px 0 8px; border-left: 3px solid var(--line2); padding: 2px 0 2px 10px; }
.pensee summary { cursor: pointer; font-size: 12px; color: var(--mut); list-style: none; display: inline-flex; gap: 6px; align-items: center; }
.pensee summary::-webkit-details-marker { display: none; }
.pensee-txt { font-size: 13px; color: var(--mut); font-style: italic; max-height: 220px; overflow-y: auto; }
.pensee-txt p { margin: 6px 0; white-space: pre-wrap; }
.notes-agent { margin: -2px 0 6px 26px; font-size: 12px; color: var(--mut); border-left: 2px solid var(--line); padding-left: 8px; display: flex; flex-direction: column; gap: 3px; }
.consigne { font-size: 13px; background: var(--orange-bg); border: 1px solid #ff8a3d55; border-radius: 10px; padding: 6px 10px; margin: 4px 0 8px; }

/* Captures jointes à un message */
.pieces { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 0 12px; }
.pieces:not(:empty) { padding-top: 10px; border-top: 1px solid var(--line); }
.piece { position: relative; }
.piece img { height: 64px; border-radius: 8px; border: 1px solid var(--line2); display: block; }
.piece button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--err); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.piece button .ic { width: 12px; height: 12px; }

/* Fil de travail de l'IA, suivi en direct (comme Claude Code) */
.fil { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fil > .md { margin: 2px 0; }
.etape { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--mut); line-height: 1.45; min-width: 0; }
.etape > .ic, .etape > .spinner { flex: none; margin-top: 2px; }
.etape > span { min-width: 0; overflow-wrap: anywhere; }
.etape.ok > .ic { color: var(--ok); }
.etape.ko > .ic { color: var(--err); }
.etape.run { color: var(--txt); }
.etape .det { color: var(--mut2); }
.etape.petit { font-size: 12px; }
.fil .pensee { margin: 0; }
.fil .pensee summary { display: flex; width: 100%; min-width: 0; }
.apercu-pensee { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: italic; opacity: .75; }
.pensee[open] .apercu-pensee { display: none; }
.fil .pensee-txt { max-height: 260px; }
.agent { border-left: 2px solid var(--line2); padding-left: 10px; }
.agent > summary, .cheminement > summary { list-style: none; cursor: pointer; }
.agent > summary::-webkit-details-marker, .cheminement > summary::-webkit-details-marker { display: none; }
.agent-fil { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 4px 20px; }
.agent-fil .note { font-size: 12px; color: var(--txt); opacity: .85; white-space: pre-wrap; overflow-wrap: anywhere; }
.agent-fil .note.pensee-note { color: var(--mut); font-style: italic; opacity: 1; }
.cheminement > summary { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mut); padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel2); }
.cheminement[open] > summary { margin-bottom: 8px; }
.cheminement > .fil { border-left: 2px solid var(--line); padding-left: 10px; }
.vignette { height: 56px; border-radius: 8px; cursor: zoom-in; border: 1px solid var(--line2); }
.en-travail { color: var(--ok); font-weight: 600; }
.agent-etat { margin: 4px 0 0 20px; font-size: 12px; color: var(--acc); }

/* Cinématique (onglet CAO) */
.cine-bar { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 5; display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(640px, calc(100% - 32px)); }
.cine-ctl, .cine-vide { display: flex; align-items: center; gap: 10px; padding: 8px 12px; width: 100%; flex-wrap: wrap; }
.cine-vide { justify-content: center; }
.cine-ctl input[type=range] { flex: 1; min-width: 120px; accent-color: var(--acc); }
.cine-ctl select { padding: 4px 8px; width: auto; }
.cine-angle { min-width: 36px; text-align: right; font-variant-numeric: tabular-nums; color: var(--mut); }
.cine-desc { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .seg button { padding: 6px 8px; font-size: 12px; } }
