:root {
  --bg: #f6f1e7; --surface: #fffdf8; --surface-2: #f1eadc; --line: #e4dccb; --ink: #23302e; --ink-2: #5d6b68; --ink-3: #8a9693;
  --teal: #5fb3a6; --teal-ink: #2a776c; --teal-soft: #e2f1ed; --coral: #ef8354; --coral-ink: #b9502a; --coral-soft: #fde6da;
  --gold: #c9972b; --gold-soft: #faefd2; --violet-soft: #ece6f8; --ok: #3f9a5e; --ok-soft: #e1f2e6;
  --r: 12px; --r-s: 8px; --shadow: 0 1px 2px rgb(35 48 46 / .06), 0 4px 14px rgb(35 48 46 / .06);
  --z-nav: 10; --z-chat: 20; --z-toast: 60;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 24px; } h2 { font-size: 17px; } h3 { font-size: 14px; }
p { margin: 0; text-wrap: pretty; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal-ink); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); } .small { font-size: 13px; }
.boot { padding: 40px; color: var(--ink-2); }
:focus-visible { outline: 2px solid var(--teal-ink); outline-offset: 2px; border-radius: 6px; }

/* boutons et champs */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; white-space: nowrap; transition: transform .12s ease-out, background-color .12s ease-out; }
a.btn { text-decoration: none; color: var(--ink); } a.btn.primary { color: #fff; }
.btn:hover { background: var(--surface-2); } .btn:active { transform: scale(.97); }
.btn.primary { background: var(--teal-ink); border-color: var(--teal-ink); color: #fff; } .btn.primary:hover { background: #226359; }
.btn.danger { color: var(--coral-ink); } .btn.danger.solid { background: var(--coral-ink); border-color: var(--coral-ink); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; } .btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 4px 10px; font-size: 13px; } .btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 999px; border: 0; background: transparent; font-size: 16px; }
.icon-btn:hover { background: var(--surface-2); }
input[type=text], input[type=password], input[type=date], input[type=url], input[type=number], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r-s); background: #fff; }
textarea { resize: vertical; min-height: 70px; }
label.field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.err { color: var(--coral-ink); font-size: 13px; font-weight: 600; min-height: 1.2em; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* écran de connexion */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.auth-card img { width: 120px; height: 120px; object-fit: contain; border-radius: 24px; justify-self: center; background: #fff; }
.auth-card h1 { text-align: center; }

/* structure */
.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr) auto; height: 100dvh; }
.nav { background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; z-index: var(--z-nav); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; font-weight: 800; font-size: 20px; }
.brand img { width: 40px; height: 40px; border-radius: 12px; background: #fff; object-fit: contain; border: 1px solid var(--line); }
.nav a.item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 600; }
.nav a.item:hover { background: var(--surface-2); } .nav a.item[aria-current=page] { background: var(--teal-soft); color: var(--teal-ink); }
.nav .ico { width: 22px; text-align: center; }
.count { margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--coral); color: #fff; font-size: 12px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.nav .spacer { flex: 1; }
.nav .who { display: flex; align-items: center; gap: 8px; padding: 8px; font-size: 13px; }
.avatar { width: 26px; height: 26px; border-radius: 999px; display: inline-grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; flex: none; background: var(--c, var(--teal)); }
.avatar.agent { border-radius: 9px; }
.main { overflow-y: auto; padding: 22px 26px 60px; }
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head .sub { color: var(--ink-2); font-size: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.stat b { display: block; font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; } .stat span { color: var(--ink-2); font-size: 13px; }
.cols { display: grid; gap: 14px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); margin-top: 14px; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; } .bar i { display: block; height: 100%; background: var(--c, var(--teal)); border-radius: 99px; }
.pole-row { display: grid; grid-template-columns: 150px 1fr 60px; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.dot { width: 9px; height: 9px; border-radius: 99px; background: var(--c, var(--ink-3)); display: inline-block; flex: none; }
.feed { display: grid; gap: 8px; font-size: 13.5px; } .feed time { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.feed > div { display: flex; gap: 8px; justify-content: space-between; }
.empty { text-align: center; padding: 28px 16px; color: var(--ink-2); display: grid; gap: 10px; justify-items: center; }
.banner { background: var(--gold-soft); border: 1px solid #ecd9a4; border-radius: var(--r); padding: 12px 16px; margin-bottom: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* tâches */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters select, .filters input { width: auto; padding: 6px 10px; border-radius: 999px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; }
.chip[aria-pressed=true] { background: var(--ink); color: #fff; border-color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-weight: 600; font-size: 13px; } .seg button[aria-pressed=true] { background: var(--teal-soft); color: var(--teal-ink); }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: var(--surface-2); border-radius: var(--r); padding: 10px; min-height: 120px; display: grid; gap: 8px; align-content: start; }
.col.over { outline: 2px dashed var(--teal-ink); }
.col h3 { display: flex; align-items: center; gap: 8px; padding: 2px 4px 4px; } .col h3 .n { margin-left: auto; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tcard { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c, var(--line)); border-radius: 10px; padding: 10px 11px; display: grid; gap: 7px; text-align: left; width: 100%; }
.tcard:hover { box-shadow: var(--shadow); } .tcard .t { font-weight: 650; line-height: 1.3; }
.tcard .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.tag { padding: 1px 8px; border-radius: 99px; background: var(--surface-2); font-size: 12px; font-weight: 600; }
.tag.haute { background: var(--coral-soft); color: var(--coral-ink); } .tag.basse { color: var(--ink-3); }
.tag.live { background: var(--teal-soft); color: var(--teal-ink); }
.list { display: grid; gap: 18px; } .list h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.trow { display: grid; grid-template-columns: minmax(0, 1fr) 130px 110px 96px 70px; gap: 10px; align-items: center; padding: 9px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; width: 100%; text-align: left; margin-bottom: 6px; }
.trow:hover { box-shadow: var(--shadow); } .trow .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 650; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); white-space: nowrap; }
.st.en_cours { background: var(--teal-soft); color: var(--teal-ink); } .st.revue_chef { background: var(--violet-soft); color: #5b46a8; }
.st.a_valider { background: var(--coral-soft); color: var(--coral-ink); } .st.termine { background: var(--ok-soft); color: #2c7446; } .st.bloque { background: #f3dada; color: #9c3535; }

/* tiroir de tâche et fenêtres */
dialog { border: 0; padding: 0; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgb(35 48 46 / .25); }
dialog::backdrop { background: rgb(35 48 46 / .35); }
dialog.drawer { margin: 0 0 0 auto; height: 100dvh; max-height: none; width: min(680px, 100vw); max-width: none; overflow-y: auto; }
dialog.modal { border-radius: 18px; width: min(480px, calc(100vw - 32px)); padding: 22px; }
dialog.modal.wide { width: min(720px, calc(100vw - 32px)); }
.drawer-head { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px 18px; display: flex; gap: 8px; align-items: center; z-index: 1; }
.drawer-body { padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.title-input { font-size: 20px; font-weight: 750; border: 1px solid transparent; padding: 4px 6px; margin-left: -6px; background: transparent; }
.title-input:hover, .title-input:focus { border-color: var(--line); background: #fff; }
.section > h3 { text-transform: none; color: var(--ink-2); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.sub { display: flex; gap: 8px; align-items: center; padding: 5px 0; } .sub input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--teal-ink); flex: none; }
.sub span { flex: 1; } .sub.done span { color: var(--ink-3); text-decoration: line-through; }
.sub .icon-btn { opacity: 0; } .sub:hover .icon-btn, .sub .icon-btn:focus-visible { opacity: 1; }
.deliv { background: #fff; border: 1px solid var(--line); border-radius: var(--r-s); padding: 14px; max-height: 420px; overflow-y: auto; }
.note { background: var(--violet-soft); border-radius: var(--r-s); padding: 12px 14px; }
.comment { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; } .comment b { margin-right: 6px; }
.md > * + * { margin-top: .6em; } .md h4 { margin: 1em 0 .2em; font-size: 15px; } .md ul, .md ol { margin: 0; padding-left: 1.3em; }
.md code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: .92em; } .md pre { background: var(--surface-2); padding: 10px; border-radius: 8px; overflow-x: auto; font-size: 13px; }
.md pre code { background: none; padding: 0; } .md table { border-collapse: collapse; font-size: 13.5px; } .md td, .md th { border: 1px solid var(--line); padding: 4px 8px; text-align: left; }

/* conversation */
.chat { width: 400px; border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; height: 100dvh; z-index: var(--z-chat); }
.chat[hidden] { display: none; }
.chat-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.chat-head select { flex: 1; font-weight: 700; }
.chat-role { padding: 6px 14px; font-size: 12.5px; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 9px 12px; border-radius: 14px; background: var(--surface-2); font-size: 14.5px; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--teal-soft); } .msg.system { align-self: center; background: transparent; color: var(--ink-3); font-size: 12.5px; text-align: center; }
.msg .by { font-size: 11.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 2px; }
.msg .eval { display: flex; gap: 6px; margin-top: 8px; align-items: center; font-size: 12.5px; color: var(--ink-2); }
.live { display: flex; gap: 8px; align-items: center; padding: 8px 14px; font-size: 13px; color: var(--teal-ink); background: var(--teal-soft); }
.live .pulse { width: 8px; height: 8px; border-radius: 99px; background: var(--teal-ink); animation: pulse 1.2s ease-in-out infinite; flex: none; }
@keyframes pulse { 50% { opacity: .3; transform: scale(.7); } }
.composer { border-top: 1px solid var(--line); padding: 10px 12px; display: grid; gap: 8px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.composer textarea { min-height: 62px; max-height: 200px; }
.composer .opts { display: flex; gap: 6px; align-items: center; } .composer .opts select { width: auto; padding: 4px 8px; font-size: 12.5px; border-radius: 999px; }
.pj { display: flex; gap: 6px; flex-wrap: wrap; } .pj .chip { font-weight: 500; }
.chat-fab { position: fixed; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); z-index: var(--z-chat); box-shadow: var(--shadow); }

/* bureau */
.office-wrap { position: relative; height: calc(100dvh - 150px); min-height: 440px; border-radius: 18px; overflow: hidden; background: #fbf7ee; border: 1px solid var(--line); }
.office-wrap canvas { display: block; }
.office-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.office-label { position: absolute; left: 0; top: 0; pointer-events: auto; border: 0; background: transparent; display: grid; justify-items: center; gap: 4px; padding: 0; will-change: transform; }
.ol-name { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px 2px 8px; font-size: 12.5px; box-shadow: var(--shadow); }
.ol-name i { width: 8px; height: 8px; border-radius: 99px; background: var(--ink-3); }
.office-label[data-state=running] .ol-name i { background: var(--teal-ink); animation: pulse 1.2s ease-in-out infinite; }
.office-label[data-state=queued] .ol-name i { background: var(--gold); }
.ol-bubble { max-width: 210px; background: var(--ink); color: #fff; padding: 5px 10px; border-radius: 12px; font-size: 12px; line-height: 1.3; text-align: left; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ol-bubble[data-kind=badge] { background: var(--coral); font-weight: 700; }
.office-sign { position: absolute; left: 0; top: 0; font-weight: 800; font-size: 13px; color: var(--ink-2); background: rgb(255 253 248 / .85); padding: 3px 12px; border-radius: 99px; border: 1px solid var(--line); white-space: nowrap; }

/* divers */
.agent-card { display: grid; gap: 8px; } .agent-card .top { display: flex; gap: 10px; align-items: center; }
.tree { font-size: 14px; } .tree details { margin-left: 4px; } .tree summary { cursor: pointer; padding: 4px 0; font-weight: 650; }
.tree .file { display: flex; gap: 8px; align-items: center; padding: 4px 0 4px 20px; } .tree .file a { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; color: var(--ink); } .tree .file a:hover { text-decoration: underline; }
.demo-frame { width: 100%; height: 70dvh; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.notif { display: grid; gap: 8px; } .notif .card { display: grid; gap: 8px; } .notif .card.done { opacity: .6; }
.drop { border: 2px dashed var(--line); border-radius: var(--r); padding: 18px; text-align: center; color: var(--ink-2); } .drop.over { border-color: var(--teal-ink); background: var(--teal-soft); }
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: var(--z-toast); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 99px; font-size: 14px; box-shadow: var(--shadow); animation: rise .18s ease-out; }
.toast.bad { background: var(--coral-ink); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.menu-btn { display: none; }

@media (max-width: 1180px) { .chat { position: fixed; right: 0; top: 0; width: min(420px, 100vw); box-shadow: -10px 0 40px rgb(35 48 46 / .18); } .cols { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); } .menu-btn { display: grid; }
  .nav { position: fixed; inset: 0 auto 0 0; width: 250px; transform: translateX(-100%); transition: transform .18s ease-out; box-shadow: var(--shadow); }
  .nav.open { transform: none; } .main { padding: 14px 14px 80px; } .grid2 { grid-template-columns: 1fr; }
  .trow { grid-template-columns: minmax(0, 1fr) auto; } .trow > :nth-child(n+3) { display: none; } .pole-row { grid-template-columns: 110px 1fr 50px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
