:root {
  --void: #050507;
  --deck: #0B0D12;
  --panel: #10131A;
  --raise: #161A23;
  --line: rgba(255,255,255,.08);
  --line-2: rgba(255,255,255,.14);
  --ink: #F2F4F7;
  --ink-2: #C9CED6;
  --muted: #8A909A;
  --cyan: #7FF0FF;
  --pink: #FF8AD8;
  --amber: #FFC46B;
  --violet: #B49CFF;
  --green: #7CF2A8;
  --red: #FF7A7A;
  --chrome: linear-gradient(180deg, #FFFFFF 0%, #D9DEE6 38%, #7C838E 55%, #F2F4F7 72%, #9AA0AA 100%);
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --f-display: 'Michroma', 'Chakra Petch', sans-serif;
  --f-tech: 'Chakra Petch', 'Inter', sans-serif;
  --f-body: 'Inter', system-ui, -apple-system, sans-serif;
  --rail: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--void); color: var(--ink); font: 15px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
::selection { background: rgba(127,240,255,.25); }
.muted { color: var(--muted); }
.tech { font-family: var(--f-tech); letter-spacing: .02em; }
[hidden] { display: none !important; }

/* ---------- Structure ---------- */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 22px 14px; border-right: 1px solid var(--line); background: linear-gradient(180deg, #07080B, var(--void)); }
.brand { display: flex; flex-direction: column; gap: 2px; padding: 4px 10px 22px; }
.brand b { font-family: var(--f-display); font-weight: 400; font-size: 17px; letter-spacing: .06em; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand span { font-family: var(--f-tech); font-size: 12px; color: var(--muted); letter-spacing: .08em; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); color: var(--ink-2); font-family: var(--f-tech); font-weight: 600; font-size: 14.5px; letter-spacing: .03em; }
.nav a:hover { background: var(--panel); text-decoration: none; color: var(--ink); }
.nav a.on { background: var(--raise); color: var(--ink); box-shadow: inset 2px 0 0 var(--cyan); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav .badge { margin-left: auto; }
.rail-foot { margin-top: auto; display: grid; gap: 10px; }
.main { min-width: 0; padding: 30px clamp(18px, 3.4vw, 48px) 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: clamp(20px, 2.2vw, 26px); letter-spacing: .03em; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.page-head h1.mtitle { margin-top: 8px; font-family: var(--f-tech); font-weight: 600; font-size: clamp(20px, 2vw, 26px); letter-spacing: .01em; line-height: 1.25; }

/* ---------- Éléments ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); font-family: var(--f-tech); font-weight: 600; letter-spacing: .04em; font-size: 14px; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: rgba(255,255,255,.3); background: var(--raise); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--cyan); color: #04121A; border-color: transparent; }
.btn.primary:hover { background: #A6F6FF; }
.btn.danger { color: var(--red); border-color: rgba(255,122,122,.35); background: transparent; }
.btn.ok { color: #04140B; background: var(--green); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--pink); color: #1A0613; font: 700 12px/1 var(--f-tech); }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line-2); font: 600 12.5px/1 var(--f-tech); letter-spacing: .04em; color: var(--ink-2); white-space: nowrap; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-running { color: var(--cyan); border-color: rgba(127,240,255,.35); }
.st-running i { animation: pulse 1.4s ease-in-out infinite; }
.st-waiting { color: var(--pink); border-color: rgba(255,138,216,.4); }
.st-queued { color: var(--amber); border-color: rgba(255,196,107,.35); }
.st-done { color: var(--green); border-color: rgba(124,242,168,.3); }
.st-failed, .st-interrupted { color: var(--red); border-color: rgba(255,122,122,.35); }
.st-cancelled { color: var(--muted); }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .st-running i, .typing i { animation: none !important; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r-lg); }
.field { width: 100%; background: var(--deck); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 12px 14px; outline: none; transition: border-color .15s; }
.field:focus { border-color: rgba(127,240,255,.6); }
textarea.field { resize: vertical; min-height: 90px; line-height: 1.55; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* ---------- Agents (couleurs) ---------- */
.ag { --c: var(--ink-2); }
.ag-chef { --c: #E8ECF2; }
.ag-crea { --c: var(--pink); }
.ag-seo { --c: var(--cyan); }
.ag-audit { --c: var(--amber); }
.ag-theme { --c: var(--violet); }
.ag-produits { --c: #8FE3A0; }
.ag-images { --c: #FF9F6B; }
.ag-analyste { --c: #6FB7FF; }
.ag-reseaux { --c: #F7A8FF; }
.ag-veille { --c: #D8E36A; }
.ag-service { --c: #9EE8E0; }
.ag-designs { --c: #FFD36F; }
.ag-noe { --c: var(--green); }
.ag-sys { --c: var(--red); }
.tag { display: inline-flex; align-items: center; gap: 7px; font: 700 12.5px/1 var(--f-tech); letter-spacing: .05em; color: var(--c); }
.tag::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); transform: rotate(45deg); }

/* ---------- Console de commande ---------- */
.command { position: relative; padding: 22px; border-radius: 22px; background: radial-gradient(120% 140% at 0% 0%, rgba(127,240,255,.10), transparent 55%), radial-gradient(120% 140% at 100% 100%, rgba(255,138,216,.08), transparent 55%), var(--panel); border: 1px solid var(--line-2); }
.command h2 { margin: 0 0 14px; font-family: var(--f-display); font-weight: 400; font-size: clamp(18px, 2vw, 22px); letter-spacing: .02em; }
.command textarea { min-height: 96px; font-size: 16px; background: rgba(5,5,7,.6); }
.command-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line-2); font: 600 13px/1 var(--f-tech); letter-spacing: .03em; color: var(--ink-2); cursor: pointer; }
.seg span:hover { border-color: rgba(255,255,255,.3); }
.seg input:checked + span { border-color: var(--c, var(--cyan)); color: var(--c, var(--cyan)); background: rgba(255,255,255,.04); }
.seg input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }
.command-row .btn.primary { margin-left: auto; height: 44px; padding: 0 22px; }
.ideas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ideas button { border: 0; background: rgba(255,255,255,.04); color: var(--ink-2); border-radius: 999px; padding: 7px 13px; font-size: 13px; }
.ideas button:hover { background: rgba(255,255,255,.08); color: var(--ink); }

/* ---------- Équipe ---------- */
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 34px 0 14px; }
.section-title h3 { margin: 0; font: 600 16px/1.2 var(--f-tech); letter-spacing: .04em; }
.team { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.member { position: relative; padding: 16px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.member::after { content: ""; position: absolute; inset: auto 0 0 0; height: 2px; background: var(--c); opacity: .5; }
.member.busy { border-color: color-mix(in srgb, var(--c) 40%, transparent); }
.member.busy::after { opacity: 1; }
.member .role { margin-top: 10px; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.member .now { margin-top: 12px; font: 600 12.5px/1.3 var(--f-tech); color: var(--ink-2); }
.typing { display: inline-flex; gap: 3px; margin-right: 6px; vertical-align: middle; }
.typing i { width: 4px; height: 4px; border-radius: 50%; background: var(--c); animation: pulse 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }

/* ---------- Liste des missions ---------- */
.missions { display: grid; gap: 8px; }
.mrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 16px; padding: 14px 18px; border-radius: var(--r-md); background: var(--panel); border: 1px solid var(--line); color: var(--ink); }
.mrow:hover { border-color: var(--line-2); background: var(--raise); text-decoration: none; }
.mrow .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .meta { display: flex; gap: 12px; margin-top: 3px; font-size: 13px; color: var(--muted); }
.mrow .agents { display: flex; gap: 10px; }
.filters { display: flex; gap: 6px; }

/* ---------- Mission ---------- */
.mission { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 26px; align-items: start; }
.timeline { display: grid; gap: 4px; }
.ev { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 9px 0; }
.ev .who { padding-top: 2px; }
.ev .what { min-width: 0; }
.ev-text .what { color: var(--ink); }
.ev-tool .what { color: var(--muted); font-size: 13.5px; }
.ev-tool .what b { color: var(--ink-2); font-weight: 500; }
.ev-user .what { padding: 12px 14px; border-radius: var(--r-md); background: rgba(124,242,168,.06); border: 1px solid rgba(124,242,168,.18); }
.ev-delegate .what { padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--panel); }
.ev-delegate summary { cursor: pointer; list-style: none; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ev-delegate summary::-webkit-details-marker { display: none; }
.ev-delegate .brief { margin-top: 10px; color: var(--ink-2); font-size: 14px; white-space: pre-wrap; }
.ev-result .what { padding: 18px 20px; border-radius: var(--r-lg); background: linear-gradient(180deg, rgba(127,240,255,.07), rgba(127,240,255,.02)); border: 1px solid rgba(127,240,255,.25); }
.ev-error .what { color: var(--red); }
.ev-done .what { color: var(--muted); font-size: 13.5px; }
.ev-decision .what { font-size: 13.5px; }
.arrow { color: var(--muted); }
.md p { margin: 0 0 10px; } .md p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 6px 0 10px; padding-left: 20px; } .md li { margin: 3px 0; }
.md h1, .md h2, .md h3, .md h4 { font: 600 15px/1.3 var(--f-tech); letter-spacing: .03em; margin: 14px 0 8px; }
.md code { font-family: ui-monospace, monospace; font-size: 13px; background: rgba(255,255,255,.06); padding: 1px 5px; border-radius: 5px; }
.md pre { overflow: auto; background: var(--deck); padding: 12px; border-radius: var(--r-sm); }
.md table { border-collapse: collapse; width: 100%; font-size: 13.5px; margin: 8px 0; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line-2); padding: 6px 9px; text-align: left; vertical-align: top; }
.md th { background: rgba(255,255,255,.04); font-family: var(--f-tech); }
.reply { position: sticky; bottom: 0; margin-top: 18px; padding: 14px 0 0; background: linear-gradient(180deg, transparent, var(--void) 30%); }
.reply-box { display: flex; gap: 10px; align-items: flex-end; padding: 10px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line-2); }
.reply-box textarea { flex: 1; min-height: 46px; max-height: 220px; border: 0; background: transparent; padding: 8px; }
.side { position: sticky; top: 24px; display: grid; gap: 16px; }
.side .card { padding: 16px; }
.side h4 { margin: 0 0 12px; font: 600 14px/1.2 var(--f-tech); letter-spacing: .05em; color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat b { display: block; font: 600 18px/1.2 var(--f-tech); }
.stat span { font-size: 12px; color: var(--muted); }

/* ---------- Validations ---------- */
.approval { padding: 16px; border-radius: var(--r-lg); background: linear-gradient(180deg, rgba(255,138,216,.08), rgba(255,138,216,.02)); border: 1px solid rgba(255,138,216,.35); display: grid; gap: 12px; }
.approval .q { font-weight: 600; }
.approval details { font-size: 13px; color: var(--muted); }
.approval details pre { max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; background: var(--deck); padding: 10px; border-radius: var(--r-sm); color: var(--ink-2); }
.approval .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.approval.done { background: var(--panel); border-color: var(--line); }
.approval textarea { min-height: 44px; font-size: 14px; }

/* ---------- Livrables ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.side .gallery { grid-template-columns: repeat(2, 1fr); }
.tile { position: relative; display: flex; flex-direction: column; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--deck); text-align: left; padding: 0; color: var(--ink); }
.tile:hover { border-color: var(--line-2); }
.tile .thumb { aspect-ratio: 4 / 5; display: grid; place-items: center; background: #0A0C10; overflow: hidden; }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile .doc { font: 700 22px/1 var(--f-tech); color: var(--muted); letter-spacing: .1em; }
.tile .cap { padding: 9px 10px; display: grid; gap: 4px; }
.tile .cap b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .cap span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Agents ---------- */
.agents-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.agent-card { padding: 20px; display: grid; gap: 14px; border-top: 2px solid var(--c); }
.agent-card h3 { margin: 0; font: 600 18px/1.2 var(--f-tech); letter-spacing: .03em; color: var(--c); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 9px; border-radius: 999px; background: rgba(255,255,255,.05); font-size: 12.5px; color: var(--ink-2); }
.chip.warn { background: rgba(255,138,216,.1); color: var(--pink); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font: 600 13px/1 var(--f-tech); color: var(--ink-2); }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--raise); border: 1px solid var(--line-2); position: relative; margin: 0; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked { background: rgba(127,240,255,.25); }
.switch input:checked::after { transform: translateX(16px); background: var(--cyan); }

/* ---------- Divers ---------- */
.usage { padding: 12px; border-radius: var(--r-md); background: var(--panel); border: 1px solid var(--line); font-size: 12.5px; display: grid; gap: 6px; }
.usage .bar { height: 4px; border-radius: 4px; background: var(--raise); overflow: hidden; }
.usage .bar i { display: block; height: 100%; background: var(--cyan); }
.status-list { display: grid; gap: 10px; }
.status-list .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); background: var(--panel); border: 1px solid var(--line); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.dot.on { background: var(--green); } .dot.off { background: var(--red); } .dot.mid { background: var(--amber); }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(2,2,4,.78); backdrop-filter: blur(6px); }
.modal-box { width: min(980px, 100%); max-height: 92vh; overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 20px; padding: 18px; }
.modal-box header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.modal-box img { display: block; max-width: 100%; max-height: 74vh; margin: 0 auto; border-radius: var(--r-md); }
.modal-box pre { white-space: pre-wrap; word-break: break-word; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: grid; gap: 8px; }
.toast { padding: 12px 16px; border-radius: var(--r-md); background: var(--raise); border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: 360px; font-size: 14px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(60% 50% at 50% 30%, rgba(127,240,255,.08), transparent 70%), var(--void); }
.login form { width: min(380px, 100%); display: grid; gap: 14px; padding: 30px; }
.login h1 { margin: 0 0 6px; font-family: var(--f-display); font-weight: 400; font-size: 22px; letter-spacing: .06em; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mobile-bar { display: none; }

@media (max-width: 1100px) {
  .mission { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; z-index: 40; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .rail.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.6); }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 30; padding: 12px 16px; background: rgba(5,5,7,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
  .mobile-bar b { font-family: var(--f-display); font-weight: 400; letter-spacing: .06em; font-size: 14px; }
  .main { padding: 20px 16px 80px; }
  .mrow { grid-template-columns: auto minmax(0, 1fr); }
  .mrow .agents, .mrow .when { display: none; }
  .ev { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .command-row .btn.primary { width: 100%; margin-left: 0; }
}
