:root {
  --navy: #0d1f33;
  --navy-2: #16304d;
  --navy-3: #22446b;
  --brass: #d9a55b;
  --brass-d: #b07f36;
  --bg: #f4f2ee;
  --surface: #ffffff;
  --line: #e3dfd7;
  --line-2: #efece6;
  --text: #17212c;
  --muted: #6b7380;
  --ok: #1f7a4d;
  --ok-bg: #e4f3ea;
  --warn: #a35a00;
  --warn-bg: #fdf0dc;
  --bad: #b3261e;
  --bad-bg: #fbe7e5;
  --info: #1d5fa8;
  --info-bg: #e5eef9;
  --purple: #6a3fa0;
  --purple-bg: #efe8f8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(13, 31, 51, .06), 0 4px 16px rgba(13, 31, 51, .05);
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.45; }
a { color: var(--navy-3); }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
h4 { font-size: 14px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.thin { font-weight: 400; }
.lead { font-size: 15px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--bad); }
.pos { color: var(--ok); }
.big { font-size: 18px; font-weight: 600; }
.accent { color: var(--brass-d); }

/* ---------- barre du haut ---------- */
.topbar { position: sticky; top: 0; z-index: 20; height: 56px; background: var(--navy); color: #fff; display: flex; align-items: center; gap: 24px; padding: 0 20px; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 18px; letter-spacing: .02em; }
.logo b { color: var(--brass); }
.role-switch { display: flex; align-items: center; gap: 4px; background: rgba(255,255,255,.07); padding: 4px; border-radius: 9px; }
.role-switch .seg { background: transparent; color: #c8d3e0; border: 0; }
.role-switch .seg.on { background: var(--brass); color: var(--navy); }
.op-select { margin-left: 6px; background: var(--navy-2); color: #fff; border: 1px solid var(--navy-3); border-radius: 6px; padding: 5px 8px; font: inherit; }
.whoami { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.verified { background: rgba(31,122,77,.18); color: #7fd6a6; border: 1px solid rgba(127,214,166,.35); padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.verified.sm { background: var(--ok-bg); color: var(--ok); border-color: transparent; padding: 0 5px; }
.who { color: #e8edf3; }

/* ---------- mise en page ---------- */
.layout { display: flex; min-height: calc(100vh - 56px); }
.nav { width: 230px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line); padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 56px; height: calc(100vh - 56px); }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; }
.nav-item:hover { background: var(--line-2); }
.nav-item.on { background: var(--navy); color: #fff; }
.nav-ic { width: 18px; text-align: center; opacity: .8; }
.nav-item .badge { margin-left: auto; }
.nav-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line-2); }
.nav-note { font-size: 11px; color: var(--muted); margin-top: 6px; }
.badge { display: inline-block; background: var(--brass); color: var(--navy); font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 7px; line-height: 18px; }
.main { flex: 1; min-width: 0; padding: 28px 32px 120px; max-width: 1480px; }

.page-head { margin-bottom: 18px; }
.page-head.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-block; font-size: 13px; text-decoration: none; color: var(--muted); margin-bottom: 6px; }
.back:hover { color: var(--text); }
.sec { margin-top: 26px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.notice { background: var(--info-bg); color: var(--info); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.note-box { background: var(--line-2); border-radius: 8px; padding: 10px 12px; margin-top: 10px; font-style: italic; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* ---------- boutons ---------- */
.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { border-color: #cfc9be; background: #faf9f6; }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.primary:hover { background: var(--navy-2); }
.btn.lg { padding: 11px 28px; font-size: 15px; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--bad); border-color: #e9b9b5; }
.btn.ghost-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--navy-3); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 2px; }
.icon-btn { background: none; border: 0; font-size: 16px; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { background: var(--line-2); }
.seg { font: inherit; font-weight: 600; font-size: 13px; padding: 6px 14px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--muted); }
.seg.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.seg-row { display: flex; gap: 6px; margin-bottom: 16px; }
.actions-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; align-items: center; }
.actions-row.left { justify-content: flex-start; }

/* ---------- formulaires ---------- */
.fld { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.fld > span { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.fld.inline { flex-direction: row; align-items: center; margin: 0; }
input, select, textarea { font: inherit; color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(217,165,91,.45); border-color: var(--brass-d); }
input[type=checkbox], input[type=radio] { accent-color: var(--navy); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chk-line { display: flex; align-items: center; gap: 8px; margin: 6px 0 12px; }
.info { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--muted); background: none; font-size: 10px; line-height: 1; padding: 0; cursor: pointer; color: var(--muted); }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 13px; }
.checks label { display: flex; gap: 6px; align-items: center; color: var(--text); font-weight: 400; }

/* ---------- recherche ---------- */
.search-card { padding: 22px 24px 18px; }
.search-grid { display: grid; grid-template-columns: minmax(200px, 1.6fr) 36px minmax(200px, 1.6fr) 1fr .8fr .6fr; gap: 12px; align-items: end; }
.search-grid.row2 { grid-template-columns: 1.4fr 1.2fr 1.2fr; max-width: 900px; }
.search-grid.ret { grid-template-columns: auto 180px 140px; justify-content: start; margin-top: 4px; }
.ret-label { font-weight: 600; padding-bottom: 20px; color: var(--muted); }
.swap { height: 38px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 50%; background: #fff; cursor: pointer; font-size: 16px; color: var(--navy-3); }
.swap:hover { background: var(--line-2); }
.ap-field { position: relative; }
.ap-list { display: none; position: absolute; top: 100%; left: 0; right: 0; min-width: 320px; z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(13,31,51,.16); margin-top: 4px; max-height: 330px; overflow: auto; }
.ap-list.open { display: block; }
.ap-opt { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.ap-opt:hover, .ap-opt.hl { background: #faf6ee; }
.ap-codes { display: block; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 1px; }
.ap-empty { padding: 10px 12px; color: var(--muted); font-size: 13px; }

.results { margin-top: 8px; }
.res-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 18px 0 10px; flex-wrap: wrap; }
.res-head h2 { margin-bottom: 2px; }
.vat-note { display: inline-block; margin-top: 6px; font-size: 12px; background: var(--info-bg); color: var(--info); padding: 3px 10px; border-radius: 20px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { font: inherit; font-size: 12px; padding: 5px 11px; border-radius: 20px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.chip span { color: var(--muted); margin-left: 3px; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.on span { color: var(--brass); }

/* ---------- tableaux ---------- */
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fbfaf7; white-space: nowrap; }
.tbl th.num { text-align: right; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #fbf8f2; }
.tbl tr.sel td { background: #fbf4e6; }
.tbl tr.dim td { opacity: .55; }
.tbl tr.tot td { font-weight: 700; border-top: 1px solid var(--line); }
.modal .tbl td { padding: 8px 10px; }
.chk { width: 36px; }
.chk input { width: 17px; height: 17px; }
.ac-model { font-weight: 600; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 4px; margin: 4px 4px 0 0; font-weight: 600; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.info { background: var(--info-bg); color: var(--info); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.cat-pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px; background: var(--line-2); white-space: nowrap; }
.c-piston, .c-turboprop { background: #eef3e6; color: #4a6a1f; }
.c-vlj, .c-light { background: #e7f0f7; color: #245a86; }
.c-midsize, .c-supermid { background: #f1ebf7; color: #5d3b8a; }
.c-heavy, .c-ulr { background: #f8ece1; color: #8a4a12; }
.c-airliner { background: var(--navy); color: var(--brass); }

.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; white-space: nowrap; vertical-align: middle; }
.mini { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; margin-right: 2px; }
.st-pending { background: var(--line-2); color: var(--muted); }
.st-quoted { background: var(--info-bg); color: var(--info); }
.st-declined { background: var(--bad-bg); color: var(--bad); }
.st-counter { background: var(--warn-bg); color: var(--warn); }
.st-counter2 { background: var(--purple-bg); color: var(--purple); }
.st-agreed { background: var(--ok-bg); color: var(--ok); }

.sel-bar { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 120px); background: var(--navy); color: #fff; padding: 10px 12px 10px 20px; border-radius: 12px; display: flex; gap: 12px; align-items: center; box-shadow: 0 12px 40px rgba(13,31,51,.35); transition: transform .2s, visibility .2s; z-index: 25; visibility: hidden; }
.sel-bar.show { transform: translate(-50%, 0); visibility: visible; }
.sel-bar .btn.primary { background: var(--brass); border-color: var(--brass); color: var(--navy); }

/* ---------- demande / comparateur ---------- */
.trip-sum .leg { padding: 4px 0; }
.leg-n { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 11px; align-items: center; justify-content: center; margin-right: 8px; }
.trip-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); color: var(--muted); font-size: 13px; }

.cmp-wrap { padding: 0; }
.cmp { border-collapse: separate; border-spacing: 0; width: 100%; }
.cmp th, .cmp td { border-bottom: 1px solid var(--line-2); padding: 9px 12px; vertical-align: top; }
.cmp-lbl { position: sticky; left: 0; background: #fbfaf7; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 190px; z-index: 1; border-right: 1px solid var(--line); }
.cmp thead .cmp-lbl { background: #fbfaf7; }
.cmp-col { min-width: 200px; text-align: left; font-weight: 400; background: #fff; border-left: 1px solid var(--line-2); position: relative; }
.cmp-col.best { background: #fbf4e6; box-shadow: inset 0 3px 0 var(--brass); }
.best-flag { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--brass-d); margin-bottom: 4px; }
.cmp-op { font-weight: 700; }
.cmp-ac { font-size: 13px; }
.cmp-col .pill { margin-top: 6px; }
.cmp-cell { border-left: 1px solid var(--line-2); font-size: 13px; }
.cmp-cell.tot { font-weight: 700; }
.cmp-cell.big { font-size: 16px; }
.cmp tr.sep td, .cmp tr.sep th { border-top: 2px solid var(--line); }
.cmp-cell.act { display: table-cell; }
.cmp-cell.act .btn { display: block; width: 100%; margin-bottom: 6px; }
.cmp tr.actions td, .cmp tr.actions th { background: #fbfaf7; border-bottom: 0; }
.ln { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 4px; }
.ln.ok { background: var(--ok-bg); color: var(--ok); }
.ln.unk { background: var(--warn-bg); color: var(--warn); }
.ln.na { background: var(--line-2); color: var(--muted); }
.counter-box { background: var(--purple-bg); border-radius: 6px; padding: 6px 8px; margin-bottom: 8px; }
.inc { display: flex; gap: 6px; align-items: center; font-size: 12px; margin: 8px 0 6px; font-weight: 600; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 110px 80px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.tl-at { color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-by { font-weight: 700; font-size: 12px; }
.by-broker .tl-by { color: var(--navy-3); }
.by-operator .tl-by { color: var(--brass-d); }
.rfq-list { padding-left: 18px; margin: 8px 0 16px; }
.rfq-list li { margin-bottom: 4px; }

/* ---------- offre client ---------- */
.offer-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 20px; align-items: start; }
.offer-config { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
.margin-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.margin-in { display: flex; gap: 4px; }
.margin-in input { width: 80px; }
.margin-out { grid-column: 1 / -1; font-size: 12px; color: var(--ok); }
.offer-doc-wrap { background: #e9e6df; border-radius: var(--radius); padding: 24px; }
.offer-doc { background: #fff; max-width: 820px; margin: 0 auto; padding: 44px 48px; box-shadow: 0 2px 12px rgba(0,0,0,.08); font-size: 13px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 3px solid var(--navy); }
.doc-brand { font-size: 20px; font-weight: 700; color: var(--navy); }
.doc-ref { text-align: right; }
.doc-title { font-size: 16px; font-weight: 700; color: var(--brass-d); text-transform: uppercase; letter-spacing: .06em; }
.doc-muted { color: var(--muted); font-size: 12px; }
.doc-client { margin-top: 18px; }
.doc-msg { margin: 12px 0 4px; }
.offer-doc h4 { text-transform: uppercase; font-size: 11px; letter-spacing: .08em; color: var(--navy-3); margin: 22px 0 8px; }
.doc-tbl { width: 100%; border-collapse: collapse; }
.doc-tbl th { text-align: left; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 4px; }
.doc-tbl td { padding: 7px 4px; border-bottom: 1px solid var(--line-2); }
.doc-opt { border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-bottom: 14px; break-inside: avoid; }
.doc-opt-head { display: flex; justify-content: space-between; gap: 20px; }
.doc-opt-n { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--brass-d); font-weight: 700; }
.doc-opt-ac { font-size: 17px; font-weight: 700; color: var(--navy); }
.doc-price { min-width: 220px; }
.doc-pl { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
.doc-pl.big { font-size: 17px; font-weight: 700; color: var(--navy); border-top: 1px solid var(--line); padding-top: 4px; margin-top: 4px; }
.doc-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.doc-cols h5 { margin: 0 0 4px; font-size: 12px; }
.doc-cols ul { margin: 0; padding-left: 16px; font-size: 12px; }
.doc-foot { margin-top: 26px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 10.5px; color: var(--muted); }

/* ---------- opérateur ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; cursor: pointer; color: var(--muted); }
.tab span { font-size: 11px; background: var(--line-2); border-radius: 10px; padding: 0 6px; margin-left: 4px; }
.tab.on { color: var(--navy); border-bottom-color: var(--brass); }
.counter-card { border-color: #d7c3ef; }
.counter-grid { display: flex; gap: 40px; margin-bottom: 12px; }
.inline-num { width: 130px; }
.qlines { border: 1px solid var(--line); border-radius: 8px; margin: 4px 0 16px; }
.qline { display: grid; grid-template-columns: 260px 1fr 130px; gap: 12px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line-2); }
.qline:last-child { border-bottom: 0; }
.qline.missing { background: #fff8ec; }
.qline.missing .ql-lbl::after { content: " · à qualifier"; color: var(--warn); font-weight: 600; font-size: 11px; }
.ql-lbl { font-weight: 600; font-size: 13px; }
.ql-rad { display: flex; gap: 6px; flex-wrap: wrap; }
.rad { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 20px; cursor: pointer; }
.rad:has(input:checked) { border-color: var(--navy); background: #f1f4f8; font-weight: 600; }
.rad.onInvoice:has(input:checked) { border-color: var(--warn); background: var(--warn-bg); color: var(--warn); }
.ql-amt:disabled { background: var(--line-2); }
.q-total { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; background: #fbfaf7; border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; }
.q-total > div { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.q-total span { font-size: 11px; color: var(--muted); }
.q-total .big b { font-size: 20px; color: var(--navy); }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfcac0; border-radius: 20px; cursor: pointer; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(16px); }
.unav { padding-left: 18px; font-size: 13px; }
.unav-add { display: flex; gap: 8px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.kpi-v { font-size: 24px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.kpi-l { font-size: 12px; color: var(--muted); }
.vat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.vat-cell { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.vat-cell span { width: 26px; }
.vat-cell input { width: 70px; }

/* ---------- modales / toasts ---------- */
.modal-root { display: none; }
.modal-root.open { display: block; }
.modal-back { position: fixed; inset: 0; background: rgba(13,31,51,.45); z-index: 50; }
.modal { position: fixed; z-index: 51; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(540px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(13,31,51,.3); }
.modal.wide { width: min(820px, calc(100vw - 32px)); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: #fff; z-index: 2; }
.modal-head h3 { margin: 0; }
.modal-body { padding: 18px 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-actions .btn.danger.ghost { margin-right: auto; }
.onb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 12px 0; }
.onb { background: #fbfaf7; border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; }
.onb h4 { margin: 0 0 6px; }
.onb ul { margin: 0; padding-left: 18px; }
.toast-root { position: fixed; top: 68px; right: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(13,31,51,.25); font-weight: 600; max-width: 380px; transition: opacity .4s, transform .4s; }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--bad); }
.toast.out { opacity: 0; transform: translateY(-6px); }
pre.err { white-space: pre-wrap; color: var(--bad); }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .search-grid { grid-template-columns: 1fr 36px 1fr; }
  .search-grid.row2 { grid-template-columns: 1fr 1fr 1fr; }
  .offer-layout { grid-template-columns: 1fr; }
  .offer-config { position: static; max-height: none; }
}
@media (max-width: 820px) {
  .nav { display: none; }
  .main { padding: 18px 16px 120px; }
  .topbar { gap: 10px; padding: 0 12px; }
  .whoami { display: none; }
  .role-switch .seg { padding: 6px 9px; }
  .ret-label { padding-bottom: 0; }
  .search-grid, .search-grid.ret, .form-grid.two, .onb-grid, .doc-cols, .checks { grid-template-columns: 1fr; }
  .swap { display: none; }
  .qline { grid-template-columns: 1fr; }
  .offer-doc { padding: 24px 18px; }
}

/* ---------- impression : uniquement le document client ---------- */
@media print {
  @page { margin: 12mm; }
  body { background: #fff; }
  .topbar, .nav, .no-print, .toast-root, .modal-root, .sel-bar { display: none !important; }
  .layout, .main { display: block; padding: 0; margin: 0; max-width: none; }
  .offer-layout { display: block; }
  .offer-doc-wrap { background: none; padding: 0; }
  .offer-doc { box-shadow: none; padding: 0; max-width: none; }
}

/* ---------- base mondiale ---------- */
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 0 14px; padding: 16px 18px 4px; }
.res-count { margin: 4px 0 8px; font-size: 13px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 70px; gap: 10px; align-items: center; font-size: 13px; padding: 4px 0; }
.bar-row b { text-align: right; font-variant-numeric: tabular-nums; }
.bar { background: var(--line-2); border-radius: 4px; height: 12px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--navy-3); border-radius: 4px; }
.lookup { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.lookup .btn { margin-bottom: 12px; }
#ac_lookup_res .notice { margin: 0 0 12px; }
@media (max-width: 820px) { .filters, .two-col, .lookup { grid-template-columns: 1fr; } }
.tbl td .tag.info { display: block; width: max-content; margin-top: 3px; }
.tbl td a.small { white-space: nowrap; }

/* ---------- conformité ---------- */
.cp-banner { border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px; border: 1px solid; }
.cp-banner.ok { background: var(--ok-bg); border-color: #b9dfc9; }
.cp-banner.warn { background: var(--warn-bg); border-color: #f0d4a8; }
.cp-banner.bad { background: var(--bad-bg); border-color: #efbdb8; }
.cp-banner-head { display: flex; gap: 10px; align-items: center; }
.cp-banner ul { margin: 8px 0 0; padding-left: 0; list-style: none; font-size: 13px; }
.cp-banner li { margin: 4px 0; }
.cp-alerts { border-top: 1px dashed rgba(0,0,0,.12); padding-top: 6px !important; }
.stepper { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 0; }
.step { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.step-ic { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; background: var(--line-2); color: var(--muted); flex-shrink: 0; }
.step.done .step-ic { background: var(--ok); color: #fff; }
.step.ko .step-ic { background: var(--bad); color: #fff; }
.step.todo .step-ic { background: var(--warn-bg); color: var(--warn); border: 1px solid #f0d4a8; }
.step.na { opacity: .5; }
.step-l small { display: block; font-weight: 400; color: var(--muted); font-size: 10px; }
.step-sep { width: 18px; height: 2px; background: var(--line); margin: 0 6px; }
.cp-docs td { vertical-align: top; }
.act-cell { white-space: nowrap; }
.act-cell .btn { margin: 0 4px 4px 0; }
.cp-flag { margin-top: 6px; font-size: 11px; font-weight: 700; color: var(--bad); background: var(--bad-bg); border-radius: 4px; padding: 3px 6px; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
details.notice summary { cursor: pointer; font-weight: 600; }
details.notice ul { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.psp-demo { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: #fbfaf7; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 13px; }
.psp-demo div { display: flex; flex-direction: column; }
.psp-demo span { color: var(--muted); font-size: 11px; }
.psp-line { color: var(--muted); font-size: 11px; margin-top: 2px; }
.cp-docs .pill { white-space: normal; }
a.verified { text-decoration: none; }
.verified.cp-REVIEW_REQUIRED { background: rgba(217,165,91,.2); color: #f3c98a; border-color: rgba(243,201,138,.4); }
.verified.cp-BLOCKED { background: rgba(179,38,30,.25); color: #ffb4ad; border-color: rgba(255,180,173,.4); }

/* ---------- espace client / réservation ---------- */
body.client-mode .nav { display: none; }
body.client-mode .main { max-width: 1000px; margin: 0 auto; }
.client-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 14px; border-bottom: 3px solid var(--navy); margin-bottom: 14px; }
.client-ref { text-align: right; }
.client-steps { margin: 16px 0; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 14px; }
.opt-card { display: block; border: 2px solid var(--line); border-radius: 10px; padding: 14px 16px; cursor: pointer; background: #fff; position: relative; }
.opt-card:hover { border-color: #cfc9be; }
.opt-card.on, .opt-card:has(input:checked) { border-color: var(--brass); background: #fffaf1; }
.opt-card input { position: absolute; top: 14px; right: 14px; }
.opt-card .small { margin-top: 6px; }
.opt-price { font-size: 22px; font-weight: 700; color: var(--navy); margin-top: 8px; font-variant-numeric: tabular-nums; }
.contract-sum { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 12px 0; }
.contract-sum > div { background: #fbfaf7; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; }
.contract-sum span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.contract-sum b { font-size: 15px; color: var(--navy); }
.contract-sum small { color: var(--muted); font-size: 12px; }
.psp-demo.big b { font-size: 18px; }
.confirm { text-align: center; }
.confirm .contract-sum, .confirm .doc-tbl, .confirm p.small { text-align: left; }
.confirm-ic { width: 54px; height: 54px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 28px; display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; }
.contract-page .offer-doc.contract { max-width: 820px; }
.contract h1 { font-size: 22px; color: var(--navy); }
.contract h4 { margin-top: 18px; }
.draft-band { background: var(--warn-bg); color: var(--warn); font-weight: 700; text-align: center; padding: 6px; border-radius: 6px; margin-bottom: 14px; letter-spacing: .05em; font-size: 12px; }
@media print { body.client-mode .notice, body.client-mode .client-steps { display: none; } .contract-page .offer-doc { padding: 0; } }
@media (max-width: 820px) { .search-grid.row2 { grid-template-columns: 1fr; } .client-head { flex-direction: column; align-items: flex-start; } .client-ref { text-align: left; } }

/* ---------- mission / clearance ---------- */
.mission-box { margin-top: 6px; border: 1px dashed var(--line); border-radius: 8px; padding: 10px 14px; }
.mission-box summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.mission-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0 12px; margin-top: 10px; align-items: end; }
.ms-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 10px; }
.ms-head .pill { white-space: normal; }
.ms-head > div { background: #fbfaf7; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.ms-head span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ops-box { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 14px 0; background: #fcfbf8; }
.ops-box h3 { margin-top: 0; }
.ops-tbl select { min-width: 150px; }
.ops-tbl input { width: 100%; }
.ops-tbl tr.nf td { background: var(--bad-bg); }
.checks.three { grid-template-columns: repeat(3, 1fr); }
.chk-line.decl { align-items: flex-start; font-size: 12.5px; background: var(--info-bg); padding: 10px 12px; border-radius: 8px; }
.chk-line.decl input { margin-top: 3px; }
.doc-status { margin-top: 6px; font-size: 11.5px; font-weight: 600; padding: 4px 8px; border-radius: 4px; }
.doc-status.ok { background: var(--ok-bg); color: var(--ok); }
.doc-status.warn { background: var(--warn-bg); color: var(--warn); }
.ms-line { grid-column: 1 / -1; }
.results-tbl td .pill { white-space: normal; }
@media (max-width: 820px) { .ms-head, .checks.three { grid-template-columns: 1fr 1fr; } }

/* ---------- multilingue ---------- */
.lang-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.lang-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); border-radius: 20px; padding: 4px 10px; cursor: pointer; background: #fff; }
.lang-chip input { display: none; }
.lang-chip span { font-weight: 400; color: var(--muted); }
.lang-chip.on { border-color: var(--navy); background: #f1f4f8; }
.lang-chip small { color: var(--muted); font-weight: 400; }
.lang-tabs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.lang-tab { font: inherit; font-size: 12px; font-weight: 600; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 5px 10px; cursor: pointer; }
.lang-tab.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.doc-lang { display: none; }
.doc-lang.active { display: block; }
@media print {
  .doc-lang { display: block !important; }
  .doc-lang.pb { break-before: page; page-break-before: always; }
}
.ui-lang { display: flex; gap: 2px; margin-left: 8px; }
.ui-lang button { font: inherit; font-size: 11px; font-weight: 700; background: transparent; color: #c8d3e0; border: 1px solid rgba(255,255,255,.2); border-radius: 5px; padding: 2px 6px; cursor: pointer; }
.ui-lang button.on { background: #fff; color: var(--navy); }

/* ---------- avis vérifiés ---------- */
.rating { font-weight: 700; color: var(--brass-d); white-space: nowrap; }
.rating small { font-weight: 400; color: var(--muted); }
.rating.new { font-weight: 600; color: var(--muted); font-size: 12px; }
h1 .rating { font-size: 18px; margin-left: 8px; }
.stars { color: var(--brass); letter-spacing: 1px; }
.stars .off { color: #d9d4ca; }
.review { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 10px; }
.review .tag { display: inline-block; width: auto; margin: 0 0 0 4px; vertical-align: middle; }
.review.hidden-rv { opacity: .55; border-style: dashed; }
.rv-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.rv-crit { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.rv-crit b { color: var(--text); margin-left: 3px; }
.rv-comment { margin: 10px 0 0; font-style: italic; }
.rv-reply { margin-top: 10px; background: #f6f4ef; border-left: 3px solid var(--brass); padding: 8px 12px; font-size: 13px; border-radius: 0 6px 6px 0; }
.rv-actions { display: flex; gap: 8px; margin-top: 10px; }
.rv-actions input { flex: 1; }
.rv-tbl td { padding: 6px 10px; }
.rv-stars { white-space: nowrap; }
.rv-stars label { cursor: pointer; font-size: 24px; color: #d9d4ca; }
.rv-stars input { display: none; }
.rv-stars label:has(input:checked) span, .rv-stars:has(label:nth-child(2) input:checked) label:nth-child(-n+1) span,
.rv-stars:has(label:nth-child(3) input:checked) label:nth-child(-n+2) span, .rv-stars:has(label:nth-child(4) input:checked) label:nth-child(-n+3) span,
.rv-stars:has(label:nth-child(5) input:checked) label:nth-child(-n+4) span { color: var(--brass); }
.link-btn.plain { text-decoration: none; color: var(--text); font-weight: 600; text-align: left; }
.link-btn.plain:hover { text-decoration: underline; }
.client-lang { display: flex; gap: 4px; justify-content: flex-end; margin-bottom: 6px; }

/* ---------- Mode serveur : connexion, compte, synchronisation ---------- */
body.login-mode .topbar > :not(.logo):not(.ui-lang), body.login-mode .nav { display: none; }
body.login-mode .ui-lang { margin-left: auto; }
body.login-mode .layout { display: block; }
.login-wrap { min-height: calc(100vh - 120px); display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; padding: 28px; }
.login-card h1 { font-size: 20px; margin: 6px 0 18px; }
.login-card .btn.lg { width: 100%; margin-top: 4px; }
.login-card input { width: 100%; }
.login-logo { display: flex; align-items: center; gap: 10px; font-size: 20px; color: var(--navy); }
.login-err { color: var(--bad); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.user-chip { font: inherit; font-size: 12px; background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.22); border-radius: 20px; padding: 4px 11px; cursor: pointer; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.user-chip:hover { background: rgba(255,255,255,.16); }
.role-fixed { color: rgba(255,255,255,.75); font-size: 13px; font-weight: 600; }
.sync-status { font-size: 11px; color: var(--muted); display: block; margin-top: 6px; }
.sync-status.s-error, .sync-status.s-offline { color: var(--bad); font-weight: 600; }
.sync-status.s-saving { color: var(--info); }
