:root {
  --ink: #23212c; --muted: #6d6a7c; --bg: #f2f1f6; --surface: #fff; --line: #dfdce8;
  --plum: #5b3f86; --plum-soft: #ece6f5; --mint: #dcf1e7; --mint-ink: #1d6b4a;
  --danger: #b3261e; --radius: 10px;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--plum); outline-offset: 2px; }

/* Barre du haut */
.top { display: flex; align-items: center; gap: 1.5rem; padding: .7rem 1.2rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.1rem; }
.brand .muted { font-weight: 400; font-size: .9rem; }
#tabs { display: flex; gap: .2rem; flex: 1; flex-wrap: wrap; }
#tabs button { border: 0; background: none; padding: .45rem .8rem; border-radius: 999px; cursor: pointer; color: var(--muted); }
#tabs button.on { background: var(--plum-soft); color: var(--plum); font-weight: 600; }
.top-actions { display: flex; gap: .5rem; align-items: center; }

.btn { border: 1px solid var(--line); background: var(--surface); padding: .45rem .9rem; border-radius: 8px; cursor: pointer; display: inline-block; }
.btn:hover { border-color: var(--plum); }
.btn.primary { background: var(--plum); border-color: var(--plum); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: none; }
.btn.sm { padding: .15rem .5rem; font-size: .85rem; }

.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: 110%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem; min-width: 240px; box-shadow: 0 8px 24px rgba(35, 33, 44, .12); }
.menu-pop a, .menu-pop .linklike { display: block; padding: .5rem .7rem; border-radius: 6px; color: inherit; text-decoration: none; cursor: pointer; }
.menu-pop a:hover, .menu-pop .linklike:hover { background: var(--bg); }

.filters { display: flex; gap: .6rem; padding: .8rem 1.2rem; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { border: 1px solid var(--line); border-radius: 8px; padding: .45rem .7rem; background: var(--surface); }
.filters input { flex: 1; min-width: 220px; max-width: 420px; }

/* Pipeline */
.pipeline { display: grid; grid-template-columns: repeat(6, minmax(210px, 1fr)); gap: .8rem; padding: 0 1.2rem 2rem; overflow-x: auto; }
.col { background: #e9e7f0; border-radius: var(--radius); padding: .6rem; min-height: 60vh; transition: background .15s; }
.col.over { background: var(--plum-soft); }
.col h2 { font-size: .9rem; margin: .2rem .3rem .7rem; display: flex; justify-content: space-between; }
.col h2 span { color: var(--muted); font-weight: 400; }
.drop { display: flex; flex-direction: column; gap: .5rem; }
.card { background: var(--surface); border-radius: 8px; padding: .6rem; display: flex; gap: .6rem; cursor: pointer; border: 1px solid transparent; }
.card:hover { border-color: var(--plum); }
.card.dragging { opacity: .4; }
.col[data-stage="Embauché"] .card { border-left: 3px solid var(--mint-ink); }
.av { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--plum-soft); color: var(--plum); display: grid; place-items: center; font-size: .8rem; font-weight: 700; }
.cbody { min-width: 0; flex: 1; }
.cname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmeta { display: flex; flex-wrap: wrap; gap: .25rem; margin: .25rem 0; }
.iv { font-size: .82rem; color: var(--plum); }
.cfoot { display: flex; gap: .6rem; font-size: .78rem; color: var(--muted); align-items: center; flex-wrap: wrap; }
.chip { font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.chip.res { background: var(--mint); color: var(--mint-ink); }
.dec { font-size: .72rem; padding: .05rem .45rem; border-radius: 4px; background: #f6e2e0; color: var(--danger); }
.dec.d-Embauché { background: var(--mint); color: var(--mint-ink); }
.empty { color: var(--muted); text-align: center; padding: 1rem; }

/* Listes */
.listview { padding: 0 1.2rem 2rem; }
.sect { font-size: 1rem; margin: 1rem 0 .5rem; }
.tablewrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th { text-align: left; font-weight: 600; color: var(--muted); padding: .6rem .8rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .55rem .8rem; border-bottom: 1px solid var(--bg); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--plum-soft); }
.tname { font-weight: 600; }

/* Fiche */
#drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--surface); box-shadow: -10px 0 30px rgba(35, 33, 44, .15); overflow-y: auto; z-index: 10; padding: 1.1rem 1.3rem 3rem; }
body.drawer-open::after { content: ""; position: fixed; inset: 0; background: rgba(35, 33, 44, .25); z-index: 9; }
.dhead { display: flex; gap: .5rem; align-items: center; }
.big { font-size: 1.35rem; font-weight: 700; border: 0; border-bottom: 1px dashed var(--line); flex: 1; padding: .2rem 0; }
.flags { display: flex; gap: .3rem; margin: .4rem 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem .9rem; margin: .8rem 0; }
.full { grid-column: 1 / -1; display: block; margin: .6rem 0; }
label { display: flex; flex-direction: column; gap: .2rem; font-size: .82rem; color: var(--muted); }
label input, label select, label textarea { border: 1px solid var(--line); border-radius: 7px; padding: .45rem .6rem; color: var(--ink); background: var(--surface); font-size: .95rem; }
textarea { resize: vertical; width: 100%; }
.lab { font-size: .82rem; color: var(--muted); display: block; margin-bottom: .3rem; }
#drawer h3 { font-size: .85rem; margin: 1rem 0 .4rem; color: var(--ink); }
.toggles { display: flex; flex-wrap: wrap; gap: .35rem; }
.tg { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: .3rem .75rem; cursor: pointer; font-size: .88rem; }
.tg.on { background: var(--plum); border-color: var(--plum); color: #fff; }
.pre { margin: 1rem 0; border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .9rem; }
.pre summary { cursor: pointer; font-weight: 600; }
.dactions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.dsec { border-top: 1px solid var(--line); margin-top: 1.4rem; }
.file { display: flex; gap: .6rem; align-items: center; padding: .3rem 0; }
.file a { color: var(--plum); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legacy { font-size: .82rem; background: #fff6dd; padding: .5rem .7rem; border-radius: 7px; }
.uploads { display: flex; gap: .5rem; margin-top: .5rem; }
.addnote { display: flex; gap: .5rem; align-items: flex-end; }
.hist { list-style: none; padding: 0; margin: .8rem 0; }
.hist li { border-left: 2px solid var(--plum-soft); padding: .2rem 0 .6rem .8rem; }
.hmeta { font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: .3rem; }
.htext { white-space: pre-wrap; }
.pad { padding: 1rem 0; }

#toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .6rem 1.1rem; border-radius: 8px; z-index: 20; }
#toast.bad { background: var(--danger); }

/* Connexion */
body.login { display: grid; place-items: center; min-height: 100vh; }
.login-box { background: var(--surface); padding: 2rem; border-radius: 14px; width: min(380px, 92vw); display: flex; flex-direction: column; gap: .8rem; border: 1px solid var(--line); }
.login-box h1 { margin: 0; color: var(--plum); }
.login-box p { margin: 0; }
.err { color: var(--danger); }

@media (max-width: 700px) {
  .grid2 { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(6, 80vw); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.mic { background: var(--bg); border-radius: 8px; padding: .6rem; margin: .7rem 0; }
.micbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.mic textarea { border: 1px solid var(--line); border-radius: 7px; padding: .45rem .6rem; background: var(--surface); }
.btn.rec { background: var(--danger); border-color: var(--danger); color: #fff; }
.small { font-size: .82rem; font-style: italic; min-height: 1em; }
textarea.ai, input.ai, select.ai { border-color: var(--plum); background: var(--plum-soft); }

#tabs .n { font-size: .75rem; background: var(--bg); border-radius: 999px; padding: 0 .4rem; margin-left: .2rem; color: var(--muted); }
#tabs .n:empty { display: none; }
#tabs button.on .n { background: #fff; }
.accueil { padding: 0 1.2rem 2rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .8rem; margin: 1rem 0; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.kpi b { display: block; font-size: 1.9rem; color: var(--plum); line-height: 1.1; }
.kpi span { color: var(--muted); font-size: .9rem; }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: .8rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.panel h2 { font-size: .95rem; margin: .2rem 0 .6rem; }
.row { display: grid; grid-template-columns: 9rem 1fr; gap: .1rem .6rem; padding: .45rem .3rem; border-top: 1px solid var(--bg); cursor: pointer; border-radius: 6px; }
.row:hover { background: var(--plum-soft); }
.row .muted { grid-column: 2; font-size: .85rem; }
.sect-head { display: flex; justify-content: space-between; align-items: center; margin: 1rem 0 .6rem; }
.sect-head .sect { margin: 0; }
.prio { font-size: .75rem; padding: .05rem .5rem; border-radius: 999px; background: var(--bg); }
.prio.p-Haute { background: #fff1d6; color: #8a5a00; }
.prio.p-Urgente { background: #f6e2e0; color: var(--danger); }
tr.dim td { opacity: .55; }
.feed { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.feed li { padding: .55rem .9rem; border-top: 1px solid var(--bg); cursor: pointer; display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: baseline; }
.feed li:hover { background: var(--plum-soft); }
.feed li.day { background: var(--bg); font-weight: 600; font-size: .85rem; cursor: default; }
.feed .htext { flex-basis: 100%; }
[hidden] { display: none !important; }
.row { grid-template-columns: 11.5rem 1fr; }
.row .prio { justify-self: start; }

/* Fiche à onglets */
#drawer { padding-top: 0; }
.dtop { position: sticky; top: 0; background: var(--surface); z-index: 2; padding-top: 1rem; border-bottom: 1px solid var(--line); margin: 0 -1.3rem 1rem; padding-left: 1.3rem; padding-right: 1.3rem; }
.dhead { align-items: flex-start; }
.big-av { width: 46px; height: 46px; font-size: 1rem; }
.dtitle { flex: 1; min-width: 0; }
.dtitle h2 { margin: 0; font-size: 1.3rem; }
.dsub { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .25rem; font-size: .9rem; }
.dsub a { color: var(--plum); font-weight: 600; text-decoration: none; margin-right: .3rem; }
.chip.stage { background: var(--plum-soft); color: var(--plum); }
.dlast { font-size: .82rem; color: var(--muted); margin-top: .35rem; }
.dnav { display: flex; gap: .4rem; flex-wrap: wrap; margin: .7rem 0 .2rem; }
.grow { flex: 1; }
.dtabs { display: flex; gap: .2rem; margin-top: .6rem; }
.dtabs button { border: 0; background: none; padding: .55rem .8rem; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.dtabs button.on { color: var(--plum); border-bottom-color: var(--plum); font-weight: 600; }
.dtabs .n { font-size: .72rem; background: var(--bg); border-radius: 999px; padding: 0 .35rem; }
.dtabs .n:empty { display: none; }
.savebar { position: sticky; bottom: -3rem; background: var(--surface); padding: .8rem 0; border-top: 1px solid var(--line); margin-top: 1rem; display: flex; gap: .8rem; align-items: center; }
.pre-t { font-size: 1rem !important; margin-top: .2rem !important; }
.req-nr { font-size: .75rem; }
.small-note { font-size: .8rem; margin: -.3rem 0 .6rem; }
.hmeta { width: 100%; }
.editbar { display: flex; gap: .4rem; margin-top: .3rem; }
.archbar { display: flex; gap: .5rem; margin: .2rem 0 .8rem; }
.archbar select { border: 1px solid var(--line); border-radius: 8px; padding: .4rem .6rem; background: var(--surface); }
.btn[disabled] { opacity: .4; cursor: default; }

/* Postes à combler */
.kicker { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.postes { display: grid; gap: .6rem; }
.poste { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; display: flex; gap: 1rem; align-items: flex-start; cursor: pointer; }
.poste:hover { border-color: var(--plum); }
.poste-main { flex: 1; min-width: 0; }
.poste h3 { margin: 0 0 .35rem; font-size: 1.05rem; }
.poste-meta { display: flex; gap: .35rem; flex-wrap: wrap; }
.poste-notes { margin: .5rem 0 0; white-space: pre-wrap; }
.poste-foot { font-size: .8rem; color: var(--muted); margin-top: .5rem; }
.vide-poste { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 2.5rem 1rem; text-align: center; background: var(--surface); }
.vide-poste h3 { margin: 0 0 .3rem; }
.vide-poste p { margin: 0 0 1rem; }
/* Fenêtre modale */
#modal { position: fixed; inset: 0; background: rgba(35, 33, 44, .35); z-index: 30; display: grid; place-items: center; padding: 1rem; }
#modal[hidden] { display: none !important; }
.mbox { background: var(--surface); border-radius: 14px; width: min(520px, 100%); padding: 1.4rem 1.5rem; position: relative; box-shadow: 0 20px 50px rgba(35, 33, 44, .25); display: flex; flex-direction: column; gap: .7rem; }
.mbox h2 { margin: .1rem 0 .3rem; font-size: 1.35rem; }
.mbox .grid2 { margin: 0; }
.mclose { position: absolute; top: .8rem; right: .8rem; }
.mactions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .4rem; }
