:root {
  --navy: #072536; --marine: #0B3D59; --gold: #C5A059; --gold-text: #8F7330;
  --cream: #F6F3EC; --cream-2: #F5EFE3; --line: #E6DCC7; --line-2: #D5CBB5;
  --text: #1F3346; --muted: #5F6E7A; --white: #fff;
  --ok-bg: #E1F1E6; --ok: #1C5E3A; --warn-bg: #F8EDD5; --warn: #6B4A00; --bad-bg: #F8E3E0; --bad: #8A2A24;
  --r: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--cream); font-family: Jost, system-ui, sans-serif; color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--marine); } a:hover { color: var(--gold-text); }
h1, h2, h3, .serif { font-family: Cinzel, Georgia, serif; font-weight: 500; color: var(--navy); margin: 0; }
h1 { font-size: 28px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
.mono, code, textarea.q { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 13px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
input, select, textarea, button { font-family: inherit; font-size: 15px; color: var(--text); }
input, select, textarea { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--white); outline-color: var(--gold); width: 100%; }
textarea { resize: vertical; min-height: 64px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
.req { font-size: 12px; color: var(--gold-text); font-weight: 500; margin-left: 4px; }

.btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 10px; padding: 10px 18px; font-weight: 500; cursor: pointer; border: 1px solid var(--navy); background: var(--navy); color: var(--cream); text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--marine); color: var(--cream); }
.btn.ghost { background: transparent; color: var(--navy); }
.btn.ghost:hover { background: var(--cream-2); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--marine); cursor: pointer; text-decoration: underline; font-size: inherit; }

/* En-tête */
.top { background: var(--navy); border-bottom: 3px solid var(--gold); color: var(--cream); }
.top-in { max-width: 1360px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; gap: 32px; }
.logo { font-family: Cinzel, serif; font-weight: 600; letter-spacing: .14em; font-size: 17px; color: var(--cream); text-decoration: none; }
.logo span { color: var(--gold); }
.nav { display: flex; gap: 22px; flex: 1; }
.nav a { color: var(--cream); text-decoration: none; font-size: 14px; padding: 20px 0 18px; border-bottom: 2px solid transparent; }
.nav a.on { border-color: var(--gold); }
.who { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.gauge { display: flex; flex-direction: column; gap: 4px; min-width: 170px; }
.gauge-bar { height: 5px; background: rgba(246,243,236,.18); border-radius: 3px; overflow: hidden; }
.gauge-bar i { display: block; height: 100%; background: var(--gold); }
.gauge.alert .gauge-bar i { background: #E3B341; } .gauge.full .gauge-bar i { background: #D9695F; }
.top .link { color: var(--cream); }

main { max-width: 1360px; margin: 0 auto; padding: 32px 24px 80px; display: flex; flex-direction: column; gap: 24px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.card.gold { border-top: 3px solid var(--gold); }
.row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.or { align-self: center; font-family: Cinzel, serif; color: var(--gold-text); }

/* Étapes */
.steps { display: flex; gap: 8px; }
.step { flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--white); border: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.step b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--cream-2); color: var(--navy); }
.step.on { border-color: var(--navy); color: var(--navy); font-weight: 500; }
.step.on b, .step.done b { background: var(--navy); color: var(--cream); }
.step.link-step { cursor: pointer; }

/* Agents */
.agent { display: flex; align-items: center; gap: 14px; }
.medal { width: 48px; height: 48px; border-radius: 50%; background: var(--navy); border: 2px solid var(--gold); color: var(--gold); display: grid; place-items: center; font-family: Cinzel, serif; font-size: 20px; flex: none; box-shadow: inset 0 0 0 3px var(--navy), inset 0 0 0 4px rgba(197,160,89,.5); }
.medal.sm { width: 32px; height: 32px; font-size: 14px; }
.agent .name { font-family: Cinzel, serif; color: var(--navy); font-size: 17px; }

/* Pastilles */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); cursor: pointer; font-size: 14px; }
.chip.on { background: var(--navy); border-color: var(--navy); color: var(--cream); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.navy { background: var(--navy); color: var(--cream); } .pill.cream { background: var(--cream-2); color: var(--gold-text); }
.lot { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; font-weight: 600; font-size: 13px; }
.lot.A { background: var(--ok-bg); color: var(--ok); } .lot.B { background: var(--warn-bg); color: var(--warn); } .lot.C { background: var(--cream-2); color: var(--muted); }

.notice { border-radius: 10px; padding: 12px 16px; font-size: 14px; }
.notice.warn { background: var(--warn-bg); color: var(--warn); } .notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.ok { background: var(--ok-bg); color: var(--ok); } .notice.info { background: var(--cream-2); color: var(--text); border-left: 3px solid var(--gold); }

/* Viviers */
.vivier { display: grid; grid-template-columns: 28px 1fr; gap: 14px; }
.vivier.off { opacity: .55; }
.q { background: var(--cream); border-color: var(--line-2); min-height: 52px; }

/* Tableaux et classeur */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { padding: 10px 18px; border: 0; background: none; cursor: pointer; border-bottom: 3px solid transparent; font-size: 14px; color: var(--muted); }
.tab.on { border-color: var(--gold); color: var(--navy); font-weight: 500; }
.sheet-wrap { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.sheet-wrap.nopanel { grid-template-columns: 1fr; }
.scroll { overflow: auto; max-height: 640px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th { position: sticky; top: 0; background: var(--navy); color: var(--cream); font-weight: 500; text-align: left; padding: 9px 10px; white-space: nowrap; z-index: 1; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.sel td { background: #FBF6EA; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--cream); }
td select { padding: 4px 6px; font-size: 13px; border-radius: 6px; width: auto; }
.panel { position: sticky; top: 16px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.kpi { background: var(--cream); border-radius: 10px; padding: 12px 14px; }
.kpi b { display: block; font-family: Cinzel, serif; font-size: 22px; color: var(--navy); font-weight: 500; }
.bar { height: 6px; background: var(--cream-2); border-radius: 3px; overflow: hidden; min-width: 90px; }
.bar i { display: block; height: 100%; background: var(--gold); }

/* Connexion */
.login { min-height: 100vh; background: var(--navy); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 36px; padding: 48px 16px; }
.login .logo { font-size: 24px; }
.login .card { width: 100%; max-width: 440px; border-top: 3px solid var(--gold); padding: 36px; display: flex; flex-direction: column; gap: 20px; }
.login .foot { color: var(--gold); font-size: 13px; letter-spacing: .08em; }

.loading { display: grid; place-items: center; gap: 12px; padding: 64px; text-align: center; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: var(--cream); padding: 12px 20px; border-radius: 10px; border-left: 3px solid var(--gold); z-index: 10; max-width: 90vw; }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .grid2, .grid3, .sheet-wrap { grid-template-columns: 1fr; }
  .top-in { height: auto; flex-wrap: wrap; padding: 12px 16px; gap: 12px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .steps { flex-direction: column; }
  main { padding: 20px 16px 60px; }
}

/* Classeur façon Excel : grille, lots en couleur, en-têtes figés, onglets de feuilles */
.sheet { border-radius: 4px; }
table.grid { font-size: 13px; }
table.grid th { background: #0B3D59; color: #fff; font-weight: 600; border-right: 1px solid #2a5a75; }
table.grid td { border: 1px solid #DADCE0; padding: 6px 8px; background: var(--white); }
table.grid td.name { font-weight: 500; white-space: nowrap; }
table.grid td.wrap { min-width: 220px; max-width: 360px; }
table.grid.frozen th:nth-child(-n+4), table.grid.frozen td:nth-child(-n+4) { position: sticky; z-index: 2; }
table.grid.frozen th:nth-child(-n+4) { z-index: 3; }
table.grid.frozen :is(th, td):nth-child(1) { left: 0; min-width: 52px; }
table.grid.frozen :is(th, td):nth-child(2) { left: 52px; min-width: 44px; }
table.grid.frozen :is(th, td):nth-child(3) { left: 96px; min-width: 70px; }
table.grid.frozen :is(th, td):nth-child(4) { left: 166px; box-shadow: 2px 0 0 #C5A059; }
.lotcell { font-weight: 600; text-align: center; }
.lotcell.A, td.lotcell.A { background: #D9EAD3 !important; color: #1C5E3A; }
.lotcell.B, td.lotcell.B { background: #FFF2CC !important; color: #6B4A00; }
span.lotcell { padding: 1px 8px; border-radius: 4px; background: var(--cream-2); }
input.note { padding: 4px 6px; font-size: 13px; border-radius: 4px; min-width: 180px; }
.sheettabs { display: flex; gap: 2px; border-bottom: 2px solid #0B3D59; overflow-x: auto; }
.sheettabs + .scroll, .sheettabs + .card, .sheettabs + .row, .sheettabs + .notice { margin-top: -12px; }
.sheettab { padding: 8px 16px; border: 1px solid #DADCE0; border-bottom: 0; background: #F1F3F4; cursor: pointer; font-size: 13px; color: var(--muted); border-radius: 6px 6px 0 0; white-space: nowrap; }
.sheettab.on { background: #0B3D59; color: #fff; font-weight: 600; }
.sheet-title { color: #0B3D59; }
.gold-text { color: #C5A059; font-weight: 500; }
.fiche-text { white-space: pre-wrap; font-size: 14px; background: var(--cream); border-radius: 8px; padding: 16px; max-height: 480px; overflow: auto; }
table.grid td.mid { min-width: 160px; }
/* Onglet Candidats lisible : une ligne courte, détail au clic */
table.cands td { vertical-align: middle; padding: 8px 10px; }
table.cands tr:nth-child(even):not(.detail) td:not(.lotcell) { background: #FAFAF7; }
table.cands tr.sel td:not(.lotcell) { background: #FBF6EA !important; }
table.cands td.num { text-align: center; white-space: nowrap; }
table.cands .bar { height: 4px; margin-top: 4px; min-width: 48px; }
table.cands .name { font-weight: 600; color: var(--navy); white-space: nowrap; }
table.cands .ellipsis, table.cands td.ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.cands tr.detail td { background: #FFFDF8; border-left: 3px solid #C5A059; padding: 16px 20px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
/* Panneau de droite du classeur */
.with-drawer { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
.with-drawer.open { grid-template-columns: minmax(0, 1fr) 400px; }
.with-drawer.open table.cands td:nth-child(5), .with-drawer.open table.cands th:nth-child(5),
.with-drawer.open table.cands td:nth-child(7), .with-drawer.open table.cands th:nth-child(7) { display: none; }
.drawer { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; background: var(--white); border: 1px solid var(--line); border-top: 3px solid #C5A059; border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 8px 24px rgba(7,37,54,.08); }
.drawer .name { font-weight: 600; color: var(--navy); font-size: 17px; }
.drawer-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--gold-text); margin-bottom: 6px; font-weight: 600; }
.gres { border: 1px solid #DADCE0; border-radius: 8px; padding: 10px 12px; background: #fff; font-family: Arial, sans-serif; }
.gres-t { color: #1a0dab; font-size: 16px; line-height: 1.3; }
.gres-x { color: #4d5156; font-size: 13px; margin-top: 4px; line-height: 1.45; }
table.kv td { border: 0; border-bottom: 1px solid var(--line); padding: 5px 0; font-size: 13px; }
table.kv td:first-child { color: var(--muted); width: 130px; }
.crit { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; color: var(--muted); }
.crit.ok { color: var(--ok); }
.drawer textarea { font-size: 13px; }
@media (max-width: 1100px) { .with-drawer.open { grid-template-columns: 1fr; } }

/* Parler à la Cour : conversation à gauche, travail des agents à droite */
.chat-layout { display: grid; grid-template-columns: minmax(0, 760px); justify-content: center; gap: 20px; align-items: start; }
.chat-layout.with-panel { grid-template-columns: 420px minmax(0, 1fr); justify-content: stretch; }
.chat { position: sticky; top: 16px; height: calc(100vh - 140px); display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.chat-thread { flex: 1; overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg.me { justify-content: flex-end; }
.msg-who { font-family: Cinzel, serif; color: var(--navy); font-size: 13px; margin-bottom: 2px; }
.msg-text { white-space: pre-wrap; font-size: 14px; line-height: 1.5; background: var(--cream); border-radius: 4px 12px 12px 12px; padding: 10px 14px; max-width: 100%; overflow-wrap: anywhere; }
.msg.me .msg-text { background: var(--navy); color: var(--cream); border-radius: 12px 4px 12px 12px; max-width: 85%; }
.typing { color: var(--muted); font-style: italic; }
.chat-input { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--line); background: var(--cream); }
.chat-input textarea { min-height: 48px; resize: none; }
.chips-ex { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin-left: 42px; }
.chips-ex .chip { font-size: 13px; text-align: left; }
.chat-panel:empty { display: none; }
@media (max-width: 1100px) { .chat-layout.with-panel { grid-template-columns: 1fr; } .chat { position: static; height: 70vh; } }
.progress { height: 8px; background: var(--cream-2); border-radius: 4px; overflow: hidden; margin: 8px 0 4px; }
.progress i { display: block; height: 100%; background: var(--gold); transition: width .6s ease; }
/* Volume trouvé, paquets et requêtes à copier (panneau de la conversation) */
.paquet { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.paquet input, .paquet select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.queries summary { cursor: pointer; }
.query { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.query code { display: block; font-size: 12px; background: var(--cream-2); padding: 8px; border-radius: 6px; white-space: pre-wrap; word-break: break-word; user-select: all; }
.query > div:last-child { display: flex; gap: 6px; }
.paquet select { width: auto; }

/* Offre lue et questions d'Aliénor (03/11/2026) */
.offre-texte { white-space: pre-wrap; font-size: 14px; line-height: 1.55; max-height: 520px; overflow: auto; }
mark.src { background: #F3E7C9; color: inherit; border-radius: 3px; padding: 0 2px; }
mark.src sup { color: var(--gold-text); font-weight: 600; margin-left: 2px; }
.src-ok { color: var(--marine); font-style: italic; margin-top: 4px; }
.src-warn { color: var(--gold-text); margin-top: 4px; }
.question { border-top: 1px solid var(--line); padding-top: 12px; }
