/* FINCO COMPTA — charte jaune, écriture noire */
:root {
  --ink: #0e0e0e;
  --side: #fff7d1;
  --side-2: #ffeeaa;
  --side-border: #f2e3a3;
  --side-text: #0e0e0e;
  --side-muted: #7a6a2c;
  --brand: #ffd200;
  --brand-600: #e8bd00;
  --brand-700: #b89300;
  --brand-100: #ffeb99;
  --brand-50: #fff6cc;
  --brand-25: #fffbea;
  --bg: #fffdf6;
  --navy: #041c66;      /* couleurs du logo FinCo Experts */
  --green: #1edd88;
  --card: #ffffff;
  --text: #17171a;
  --muted: #6b6b72;
  --faint: #9b9ba2;
  --border: #e6e6e1;
  --border-2: #d7d7d0;
  --pos: #12804a;
  --neg: #b42318;
  --info-bg: #e8eefc;
  --info-tx: #1d3a8a;
  --ok-bg: #e4f5ea;
  --ok-tx: #14653a;
  --warn-bg: #fff1d6;
  --warn-tx: #8a5a00;
  --err-bg: #fde8e7;
  --err-tx: #a01f17;
  --violet-bg: #efeafd;
  --violet-tx: #5b3fc4;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 16, 16, .05), 0 1px 3px rgba(16, 16, 16, .06);
  --shadow-lg: 0 12px 32px rgba(16, 16, 16, .14), 0 2px 6px rgba(16, 16, 16, .08);
  --side-w: 214px;
  --top-h: 52px;
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text); background: var(--bg); line-height: 1.4;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration: none; }
a.link, .link { color: #1d4ed8; cursor: pointer; }
a.link:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; margin: 0 0 10px; }
h3 { font-size: 14px; font-weight: 650; margin: 0 0 8px; }
small, .muted { color: var(--muted); }
.faint { color: var(--faint); }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
svg.ic { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- sidebar */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side);
  color: var(--side-text); display: flex; flex-direction: column; z-index: 40;
  border-right: 1px solid var(--side-border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px 18px; font-weight: 800; letter-spacing: .02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: var(--brand);
  display: grid; place-items: center; font-weight: 900; font-size: 15px; }
.brand small { display: block; color: var(--side-muted); font-weight: 500; font-size: 10.5px; letter-spacing: .08em; }
.sidebar .brand { flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px 18px 16px; }
.brand-logo { height: 44px; width: auto; display: block; }
.brand-txt { color: var(--navy); font-size: 10.5px; font-weight: 800; letter-spacing: .14em; white-space: nowrap; }
.brand-txt small { display: inline; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; }
.brand-txt small::before { content: " · "; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.nav-bottom { margin-top: auto; padding: 8px 8px 12px; display: flex; flex-direction: column; gap: 2px;
  border-top: 1px solid var(--side-border); }
.nav-bottom kbd { color: var(--side-muted); background: none; border-color: rgba(0, 0, 0, .25); }
.nav-item { position: relative; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--side-text);
  font-weight: 550; font-size: 13.5px; cursor: pointer; width: 100%; background: none; border: 0; text-align: left; font-family: inherit; }
.nav-link:hover, .nav-item:hover > .nav-link { background: var(--side-2); }
.nav-item.active > .nav-link { background: var(--brand); color: var(--ink); font-weight: 650;
  box-shadow: inset 3px 0 0 var(--ink), 0 1px 2px rgba(120, 90, 0, .18); }
.nav-link .badge { margin-left: auto; background: var(--ink); color: var(--brand); }
.flyout {
  display: none; position: fixed; left: calc(var(--side-w) - 4px); top: 8px; bottom: 8px; width: 264px;
  background: #fff; color: var(--text); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 14px 10px;
  overflow-y: auto; z-index: 50; border: 1px solid var(--border);
}
/* ouverture pilotée par finco.js (délai de fermeture + tolérance aux trajets en diagonale) */
.nav-item.open > .flyout, .nav-item:has(:focus-visible) > .flyout { display: block; }
.nav-item.open > .nav-link { background: var(--side-2); }
.nav-item.active.open > .nav-link { background: var(--brand); }
/* pont invisible entre le menu et le panneau : la souris ne « sort » jamais en chemin */
.flyout::before { content: ""; position: absolute; top: 0; bottom: 0; left: -18px; width: 18px; }
.flyout-title { font-size: 17px; font-weight: 700; padding: 2px 8px 12px; display: flex; justify-content: space-between; align-items: center; }
.flyout-sec { font-size: 12px; font-weight: 650; color: var(--muted); padding: 10px 8px 4px; }
.flyout a { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 6px; font-size: 13px; }
.flyout a:hover { background: var(--brand-25); }
.flyout a.cur { background: var(--brand-50); font-weight: 600; }
.flyout hr { margin: 8px 6px; }
.flyout .btn { width: 100%; justify-content: center; margin: 3px 0; }

/* ---------------------------------------------------------------- topbar */
.main { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 20px;
  background: var(--brand-25); border-bottom: 1px solid var(--side-border); position: sticky; top: 0; z-index: 30;
}
.topbar .center { display: flex; align-items: center; gap: 6px; margin: 0 auto; }
.cab { white-space: nowrap; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 7px; padding: 4px 10px 4px 5px;
  font-size: 12px; font-weight: 650; letter-spacing: .02em; background: #fafaf8; }
.cab .av-img { width: 22px; height: 22px; border-radius: 5px; background: #fff; }
.topbar select { border: 1px solid var(--border); border-radius: 7px; padding: 6px 28px 6px 10px; font-weight: 650; font-size: 13px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center;
  appearance: none; font-family: inherit; color: var(--text); }
.topbar select.dossier { min-width: 340px; }
.right { display: flex; align-items: center; gap: 10px; }
.fx { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); border: 1px solid var(--border);
  border-radius: 7px; padding: 4px 8px; background: #fafaf8; white-space: nowrap; }
.fx b { color: var(--text); font-weight: 650; }
.fx .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pos); }
.fx .dot.off { background: #c0c0b8; }
.fx button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; display: grid; }
.fx button:hover { color: var(--text); }
.fx button.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--side-border); border-radius: 8px; padding: 2px; }
.seg button, .seg a { border: 0; background: none; padding: 5px 10px; border-radius: 6px; font-weight: 650; font-size: 12px;
  cursor: pointer; color: var(--muted); font-family: inherit; }
.seg .on { background: var(--brand); color: var(--ink); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--ink); display: grid; place-items: center;
  font-weight: 750; font-size: 12px; cursor: pointer; border: 1.5px solid var(--ink); }
.menu { position: relative; }
.menu-pop { display: none; position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--border);
  border-radius: 9px; box-shadow: var(--shadow-lg); min-width: 220px; padding: 6px; z-index: 60; }
.menu.open .menu-pop { display: block; }
.menu-pop a, .menu-pop button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 6px;
  font-size: 13px; background: none; border: 0; cursor: pointer; font-family: inherit; color: var(--text); text-align: left; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--bg); }
.menu-pop .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

/* ---------------------------------------------------------------- layout */
.content { padding: 22px 26px 60px; flex: 1; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 340px; }
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .g2, .g3 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.mt { margin-top: 16px; } .mt2 { margin-top: 24px; } .mb { margin-bottom: 16px; }
.right-al, .num { text-align: right; }
.center-al { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.card-b { padding: 16px 18px; }
.card-h { padding: 12px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-h h2, .card-h h3 { margin: 0; }
.card-f { padding: 10px 18px; border-top: 1px solid var(--border); text-align: center; }
.kpis { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; min-width: 210px; box-shadow: var(--shadow); }
.kpi .lbl { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 21px; font-weight: 650; margin-top: 4px; letter-spacing: -.01em; }
.kpi .val small { font-size: 12px; font-weight: 500; }
.kpi .trend { font-size: 12px; margin-top: 2px; }
.kpi.accent { background: var(--brand-50); color: var(--ink); border-color: var(--side-border); }
.kpi.accent .lbl { color: var(--side-muted); }
.kpi.accent .val { color: var(--ink); }
.kpi.click { cursor: pointer; }
.kpi.click:hover { border-color: var(--brand-600); }
.empty { text-align: center; padding: 38px 20px; color: var(--muted); }
.empty .big { font-size: 30px; margin-bottom: 6px; }
/* pastilles d'icônes (remplacent les émojis) */
.ico-tile { width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand-50); color: var(--navy); border: 1px solid var(--side-border); }
.ico-tile svg.ic { width: 20px; height: 20px; stroke-width: 1.7; }
.ico-tile.sm { width: 32px; height: 32px; border-radius: 8px; }
.ico-tile.sm svg.ic { width: 16px; height: 16px; }
.ico-tile.ok { background: var(--ok-bg); color: var(--ok-tx); border-color: #c9ebd5; }
.ico-tile.warn { background: var(--warn-bg); color: var(--warn-tx); border-color: #f2d7a1; }
.ico-tile.info { background: var(--info-bg); color: var(--info-tx); border-color: #c8d6f7; }
.empty-ico { width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-50); color: var(--navy); }
.empty-ico svg.ic { width: 22px; height: 22px; }
.empty-ico.ok { background: var(--ok-bg); color: var(--ok-tx); }
.warn-count { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 650; margin-top: 2px; }
.kpi .warn-count, .val .warn-count { display: inline-flex; margin: 0; }
.warn-count svg.ic { color: var(--warn-tx); width: 18px; height: 18px; }
.badge svg.ic, .note svg.ic { width: 13px; height: 13px; vertical-align: -2px; }
.inline-ico svg.ic { width: 14px; height: 14px; vertical-align: -2px; color: var(--muted); }
.drop { border: 2px dashed var(--border-2); border-radius: 10px; padding: 22px; text-align: center; color: var(--muted); background: #fcfcfa; }
.drop.over { border-color: var(--brand-600); background: var(--brand-25); }
/* cartes « Déposez vos documents » : icône + titre + boutons alignés */
.drop.depot { display: flex; align-items: center; gap: 14px; padding: 16px; text-align: left; }
.depot-corps { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.depot-corps b { color: var(--text); }
.depot-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.depot-actions .btn { margin: 0; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 7px; border: 1px solid var(--border-2);
  background: #fff; color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; font-family: inherit; white-space: nowrap;
  line-height: 1.25; }
.btn:hover { background: #f4f4f0; }
.btn.primary { background: var(--brand); color: var(--ink); border-color: var(--brand-600); box-shadow: 0 1px 2px rgba(120, 90, 0, .2); }
.btn.primary:hover { background: #ffc800; }
.btn.yellow { background: var(--brand); color: var(--ink); border-color: var(--brand-600); }
.btn.yellow:hover { background: var(--brand-600); }
.btn.outline { border-color: var(--ink); }
.btn.danger { color: var(--neg); border-color: #f0c2bd; }
.btn.danger:hover { background: var(--err-bg); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: #efefea; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.xs { padding: 2px 7px; font-size: 11.5px; border-radius: 6px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn { border: 1px solid var(--border); background: #fff; border-radius: 6px; width: 26px; height: 26px; display: inline-grid;
  place-items: center; cursor: pointer; color: var(--ink); }
.icon-btn:hover { border-color: var(--brand-600); background: var(--brand-25); }
.icon-btn svg.ic { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- badges & chips */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 5px; font-size: 12px; font-weight: 600;
  background: #ececea; color: #3a3a3f; white-space: nowrap; }
.badge.round { border-radius: 999px; padding: 1px 7px; font-size: 11px; }
.b-ok, .b-justifiee, .b-payee, .b-valide, .b-accepte, .b-deposee { background: var(--ok-bg); color: var(--ok-tx); }
.b-info, .b-non_justifiee, .b-validee, .b-envoye, .b-ouvert { background: var(--info-bg); color: var(--info-tx); }
.b-warn, .b-partielle, .b-brouillard, .b-comptabilisee, .b-brouillon { background: var(--warn-bg); color: var(--warn-tx); }
.b-err, .b-refuse, .b-retard, .b-annulee { background: var(--err-bg); color: var(--err-tx); }
.b-violet { background: var(--violet-bg); color: var(--violet-tx); }
.b-dark, .b-cloture, .b-facture { background: var(--brand); color: var(--ink); }
.b-ignoree { background: #ececea; color: #77777d; }
.b-yellow { background: var(--brand-50); color: #6b5300; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--border-2); border-radius: 7px;
  background: #fff; font-size: 13px; font-weight: 550; cursor: pointer; font-family: inherit; color: var(--text); }
.chip:hover { border-color: var(--ink); }
.chip.on { background: var(--brand-50); border-color: var(--brand-600); }
.chip select, .chip input { border: 0; background: transparent; font: inherit; color: inherit; padding: 0; outline: none; }
.chip input[type=date] { width: 122px; }
.chip input[type=search], .chip input[type=text] { width: 230px; }
.chip .x { color: var(--muted); font-weight: 700; }
.chips > select { width: auto; min-width: 170px; padding-top: 5px; padding-bottom: 5px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 0; }
.tabs a { padding: 9px 12px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: inline-flex; gap: 6px; align-items: center; }
.tabs a.on { color: var(--text); border-bottom-color: var(--ink); }
.tabs a .badge { font-size: 11px; padding: 0 6px; }
.tabs a.on .badge { background: var(--ink); color: var(--brand); }

/* ---------------------------------------------------------------- tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; }
.tbl th { text-align: left; font-size: 12px; font-weight: 650; color: #44444a; padding: 10px 12px; border-bottom: 1px solid var(--border);
  background: #fff; position: sticky; top: var(--top-h); z-index: 2; white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid #efefea; vertical-align: middle; }
.tbl-wrap .tbl th { position: static; }   /* en-tête collant inopérant dans un conteneur défilant */
.tbl tbody tr:hover td { background: #fbfbf7; }
.tbl tr.clickable { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; }
.tbl tr.total td { font-weight: 700; background: #fafaf6; border-top: 1px solid var(--border-2); }
.tbl tr.grand td { font-weight: 800; background: var(--brand-100); color: var(--ink); }
.tbl tr.sub td { font-weight: 650; background: #fcfcf8; }
.tbl tr.section td { background: #f3f3ee; font-weight: 700; font-size: 12px; letter-spacing: .02em; text-transform: uppercase; color: #444; }
.tbl tr.muted td { color: var(--faint); }
.tbl.compact td, .tbl.compact th { padding: 6px 10px; }
.tbl .chk { width: 34px; }
.tbl tfoot td { font-weight: 700; background: #fafaf6; }
.ref { display: inline-block; min-width: 26px; font-weight: 700; font-size: 11.5px; color: #555; }
.amt.pos { color: var(--pos); }
.amt.neg { color: var(--text); }
.neg-red { color: var(--neg); }
.pos-green { color: var(--pos); }
.ellipsis { max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; gap: 6px; align-items: center; padding: 10px 12px; font-size: 13px; color: var(--muted); }
.pager a { padding: 2px 8px; border-radius: 5px; }
.pager a.on { background: var(--brand); color: var(--ink); font-weight: 700; }
.src-dot { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10px; font-weight: 800;
  color: #fff; background: #3b3b40; }
.src-dot.banque { background: #1f3b73; } .src-dot.caisse { background: #6b4c00; } .src-dot.mobile_money { background: #c1121f; }
.src-dot.usd { box-shadow: 0 0 0 2px var(--brand); }

/* ---------------------------------------------------------------- forms */
label { font-size: 12.5px; font-weight: 600; color: #3b3b40; display: block; margin-bottom: 4px; }
.f { margin-bottom: 12px; }
.f .hint { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=password], input[type=search],
input[type=month], input:not([type]), select, textarea {
  width: 100%; border: 1px solid var(--border-2); border-radius: 7px; padding: 7px 10px; font: inherit; background: #fff;
  color: var(--text); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255, 210, 0, .35); }
input.num, .num input { text-align: right; }
textarea { min-height: 70px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid.g3c { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.inline-check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.inline-check input { width: auto; }
table.edit td { padding: 4px 4px; }
table.edit input, table.edit select { padding: 6px 7px; border-radius: 6px; }
table.edit .del { color: var(--muted); cursor: pointer; border: 0; background: none; font-size: 16px; }
table.edit .del:hover { color: var(--neg); }
.balance-bar { display: flex; gap: 18px; align-items: center; padding: 10px 14px; border-radius: 8px; background: #fafaf6; border: 1px solid var(--border); margin-top: 10px; }
.balance-bar.ok { background: var(--ok-bg); border-color: #bfe6cc; }
.balance-bar.ko { background: var(--err-bg); border-color: #f3c6c2; }

/* ---------------------------------------------------------------- flash */
.flashes { padding: 12px 26px 0; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 10px 14px; border-radius: 8px; font-size: 13px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.flash.success { background: var(--ok-bg); color: var(--ok-tx); border-color: #bfe6cc; }
.flash.error { background: var(--err-bg); color: var(--err-tx); border-color: #f3c6c2; }
.flash.info { background: var(--info-bg); color: var(--info-tx); border-color: #c8d6f7; }
.flash.warning { background: var(--warn-bg); color: var(--warn-tx); border-color: #f2d7a1; }
.flash .close { margin-left: auto; cursor: pointer; opacity: .6; }
.note { background: var(--brand-25); border: 1px solid #f1e3a0; border-radius: 8px; padding: 10px 14px; font-size: 12.5px; color: #5a4800; }

/* ---------------------------------------------------------------- modal / drawer */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 10, 10, .42); display: none; z-index: 90; align-items: flex-start; justify-content: center; padding-top: 8vh; }
.modal-bg.open { display: flex; }
.modal { background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); width: min(620px, 94vw); max-height: 84vh; overflow: auto; }
.modal.lg { width: min(880px, 96vw); }
.modal-h { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-h h3 { margin: 0; font-size: 15px; }
.modal-h .x { margin-left: auto; cursor: pointer; border: 0; background: none; font-size: 20px; color: var(--muted); }
.modal-b { padding: 16px 18px; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 96vw); background: #fff; box-shadow: var(--shadow-lg);
  z-index: 80; display: flex; flex-direction: column; border-left: 1px solid var(--border); }
.drawer-h { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.drawer-b { padding: 16px 18px; overflow-y: auto; flex: 1; }

/* assistant */
.assistant { position: fixed; left: calc(var(--side-w) + 10px); bottom: 10px; width: 420px; height: min(640px, 82vh); background: #fff;
  border-radius: 12px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); z-index: 85; display: none; flex-direction: column; }
.assistant.open { display: flex; }
.assistant .hd { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; font-weight: 650; }
.assistant .bd { flex: 1; overflow-y: auto; padding: 14px; }
.assistant .ft { padding: 10px; border-top: 1px solid var(--border); }
.assistant .hello { text-align: center; padding: 14px 6px; }
.assistant .orb { width: 46px; height: 46px; border-radius: 50%; margin: 0 auto 10px; background: radial-gradient(circle at 30% 30%, #fff3a8, var(--brand) 45%, #111 100%); }
.assistant .sugg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.assistant .sugg button { border: 1px solid var(--border-2); border-radius: 8px; background: #fff; padding: 9px; font-size: 12px; text-align: left; cursor: pointer; font-family: inherit; }
.assistant .sugg button:hover { border-color: var(--brand-600); background: var(--brand-25); }
.msg { margin-bottom: 12px; }
.msg.q { text-align: right; }
.msg.q span { display: inline-block; background: var(--brand); color: var(--ink); padding: 8px 12px; border-radius: 12px 12px 2px 12px; max-width: 85%; text-align: left; }
.msg.a .bubble { background: #f6f6f2; border-radius: 12px 12px 12px 2px; padding: 10px 12px; font-size: 13px; }
.msg.a .bubble b { display: block; margin-bottom: 3px; }
.msg.a .acc { display: flex; gap: 8px; padding: 3px 0; font-size: 12.5px; }
.msg.a .acc code { font-weight: 700; min-width: 48px; }

/* search */
.search-res a { display: flex; gap: 10px; padding: 8px 10px; border-radius: 6px; align-items: center; }
.search-res a:hover, .search-res a.sel { background: var(--brand-25); }
.search-res .grp { font-size: 11px; font-weight: 700; color: var(--muted); padding: 10px 10px 4px; text-transform: uppercase; letter-spacing: .04em; }
kbd { white-space: nowrap; border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; font-size: 11px; background: #fafaf8; }

/* inbox / lists */
.list-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f0f0eb; }
.list-row:last-child { border-bottom: 0; }
.list-row .t { flex: 1; min-width: 0; }
.list-row .t div:first-child { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .t div + div { font-size: 12px; color: var(--muted); }
.check-ok { color: var(--pos); font-weight: 800; }
.check-ko { color: var(--neg); font-weight: 800; }
.progress { height: 6px; background: #ececea; border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--ink); }
.progress > div.y { background: var(--brand-600); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: #ececea; }
.chart text { font-size: 11px; fill: #77777d; }

/* ---------------------------------------------------------------- login */
.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--brand-50);
  background-image: radial-gradient(60% 50% at 15% 10%, rgba(255, 210, 0, .30), transparent 60%), radial-gradient(50% 60% at 90% 90%, rgba(255, 210, 0, .18), transparent 60%); }
.login-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 20px 0; }
.login-card { width: min(410px, 92vw); background: #fff; border-radius: 16px; padding: 34px 30px 26px; box-shadow: var(--shadow-lg);
  border-top: 5px solid var(--brand); }
.login-logo { display: block; width: 200px; height: auto; margin: 0 auto 14px; }
.login-app { text-align: center; color: var(--navy); font-weight: 800; letter-spacing: .22em; font-size: 13px; }
.login-sub { text-align: center; color: var(--muted); font-size: 12.5px; margin: 4px 0 22px; }
.login-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--side-muted); }
.login-foot img { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- impression */
.doc { background: #fff; max-width: 860px; margin: 0 auto; padding: 36px 40px; border: 1px solid var(--border); border-radius: 10px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 3px solid var(--ink); padding-bottom: 14px; }
.doc-title { font-size: 26px; font-weight: 800; letter-spacing: .02em; }
.doc .yellow-bar { height: 6px; background: var(--brand); margin: 0 -40px 20px; }
.etat-head { text-align: center; margin-bottom: 14px; }
.etat-head .ent { font-weight: 700; }
.etat-cabinet { position: absolute; top: 0; right: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.etat-cabinet img { height: 34px; width: auto; }
.etat-cabinet span { font-size: 10.5px; color: var(--muted); }
.logo-titre { height: 46px; width: auto; max-width: 180px; object-fit: contain; display: block; }
.etat-logo { position: absolute; top: 0; left: 0; max-height: 56px; max-width: 150px; object-fit: contain; }
.dos-logo { height: 30px; width: auto; max-width: 96px; object-fit: contain; background: #fff; border: 1px solid var(--side-border);
  border-radius: 6px; padding: 2px 4px; display: block; }
.logo-zone { width: 160px; height: 90px; flex: none; border: 1px dashed var(--border-2); border-radius: 10px; display: grid;
  place-items: center; background: #fff; text-align: center; font-size: 12px; }
.logo-zone img { max-width: 140px; max-height: 76px; object-fit: contain; }
@media (max-width: 1100px) { .etat-logo { position: static; display: block; margin: 0 auto 8px; } }
@media (max-width: 1100px) { .etat-cabinet { position: static; align-items: center; margin-bottom: 8px; } }
@media print {
  .sidebar, .topbar, .no-print, .flashes, .assistant, .page-head .actions, .chips { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  body { background: #fff; font-size: 11px; }
  .card, .doc { box-shadow: none; border: 0; }
  .tbl th { position: static; }
  .tbl tr.grand td { background: var(--brand) !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
