/* ============ ERP Gestion — design system v1.30 (SaaS moderne) ============ */
:root {
  --surface-1: #ffffff;
  --page: #f4f6fa;
  --ink: #111827;
  --ink-2: #4b5563;
  --muted: #8a94a6;
  --gridline: #eceff4;
  --baseline: #d7dce6;
  --border: #e5e9f0;
  --series-1: #3567d6;
  --series-1-strong: #2450b0;
  --series-1-soft: #eaf0fc;
  --good: #16a34a;
  --warning: #f59e0b;
  --serious: #ea7c46;
  --critical: #dc2f2f;
  --sidebar-bg: #101a2c;
  --sidebar-ink: #aeb9cc;
  --radius: 12px;
  --shadow-1: 0 1px 2px rgba(16, 26, 44, .05), 0 1px 3px rgba(16, 26, 44, .04);
  --shadow-2: 0 8px 28px rgba(16, 26, 44, .12);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--page);
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: 21px; margin: 0 0 2px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 8px; font-weight: 700; }
h3 { font-size: 14.5px; margin: 0 0 10px; font-weight: 700; }
a { color: var(--series-1); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mb8 { margin-bottom: 8px; }
.mt4 { margin-top: 4px; }
.ta-r { text-align: right; }
.ta-c { text-align: center; }
.nowrap { white-space: nowrap; }
em { color: var(--critical); font-style: normal; }

/* ---------- Coque ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 252px; flex-shrink: 0; background: var(--sidebar-bg); color: var(--sidebar-ink);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent;
}
.brand { font-size: 17px; font-weight: 700; color: #fff; padding: 16px 16px 12px; letter-spacing: .2px; }
.brand-logo { display: block; width: 100%; max-height: 76px; object-fit: contain; filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.15)); }
.sidebar nav { flex: 1; padding: 2px 10px 12px; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #64748f; padding: 16px 10px 4px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin: 1px 0; color: var(--sidebar-ink);
  text-decoration: none; font-size: 13px; border-radius: 8px; cursor: pointer;
  background: none; border: 0; width: 100%; text-align: left; font-family: inherit; line-height: 1.35;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-item.active { background: var(--series-1); color: #fff; font-weight: 600; box-shadow: 0 2px 8px rgba(53, 103, 214, .4); }
.nav-icon { width: 18px; text-align: center; opacity: .8; font-size: 13px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: #dc2f2f; color: #fff; border-radius: 99px;
  padding: 0 7px; font-size: 10.5px; font-weight: 700; line-height: 17px;
}
/* Groupes repliables */
.nav-group-head {
  display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0;
  color: #8b98ae; padding: 8px 10px; margin-top: 6px; cursor: pointer; font-family: inherit;
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; border-radius: 8px;
}
.nav-group-head:hover { color: #d6deeb; background: rgba(255,255,255,.04); }
.nav-group-head .chev { margin-left: auto; font-size: 10px; transition: transform .15s; opacity: .7; }
.nav-group-head.open .chev { transform: rotate(90deg); }
.nav-group-items { overflow: hidden; }
.nav-group-items .nav-item { padding-left: 14px; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,0.08); padding: 8px 10px; }
.logout { color: #e9a0a0; }
.burger { display: none; }
.content { flex: 1; min-width: 0; padding: 22px 28px 60px; max-width: 1320px; }

/* ---------- En-tête de page ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cartes ---------- */
.card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow-1);
}
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.detail-grid .card, .card { min-width: 0; }
.detail-grid .card { margin-bottom: 14px; }
.info-rows > div { display: flex; gap: 10px; padding: 4px 0; }
.info-rows span { color: var(--muted); min-width: 130px; flex-shrink: 0; }

/* ---------- Boutons ---------- */
.btn {
  border: 1px solid transparent; border-radius: 9px; padding: 7px 14px; font-size: 13px;
  cursor: pointer; font-family: inherit; font-weight: 600; white-space: nowrap; transition: all .12s;
}
.btn-primary { background: var(--series-1); color: #fff; box-shadow: 0 1px 2px rgba(53,103,214,.35); }
.btn-primary:hover { background: var(--series-1-strong); box-shadow: 0 3px 10px rgba(53,103,214,.35); }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--baseline); }
.btn-secondary:hover { background: #f4f6fa; border-color: #b9c2d4; }
.btn-danger { background: #fff; color: var(--critical); border-color: #f1b9b9; }
.btn-danger:hover { background: #fdf0f0; border-color: var(--critical); }
.btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
.link { background: none; border: 0; color: var(--series-1); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.link.danger { color: var(--critical); }

/* ---------- Formulaires ---------- */
.input {
  width: 100%; padding: 7px 10px; border: 1px solid var(--baseline); border-radius: 9px;
  font: inherit; background: #fff; color: var(--ink); transition: border-color .12s, box-shadow .12s;
}
.input:focus { outline: none; border-color: var(--series-1); box-shadow: 0 0 0 3px rgba(53, 103, 214, .15); }
.input:disabled { background: #f2f4f8; color: var(--ink-2); }
textarea.input { resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-grid.one-col { grid-template-columns: 1fr; }
.form-grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.field-span { grid-column: 1 / -1; }
.modal-actions { margin-top: 14px; display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Barre de liste ---------- */
.listbar { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.listbar .search { max-width: 340px; }
.listbar select.input { width: auto; }
.listbar-actions { display: flex; gap: 8px; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; background: var(--surface-1); }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--baseline);
  white-space: nowrap; background: #fafbfd;
}
.table td { padding: 8px 10px; border-bottom: 1px solid var(--gridline); vertical-align: middle; font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #f7f9fd; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #eef3fc; }
.empty { color: var(--muted); padding: 28px; text-align: center; background: var(--surface-1); border: 1px dashed var(--baseline); border-radius: var(--radius); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-gray { background: #eef0f4; color: #4b5563; }
.badge-blue { background: #e5edfb; color: #2450b0; }
.badge-teal { background: #dcf5ec; color: #0d7a55; }
.badge-green { background: #ddf3e0; color: #14682a; }
.badge-orange { background: #fdeee2; color: #b4491f; }
.badge-red { background: #fce5e5; color: #a32e2e; }
.badge-violet { background: #eae7f8; color: #4a3aa7; }
.stock-bas { color: var(--critical); font-weight: 600; }
.marge-pos { color: #14682a; font-weight: 600; }

/* ---------- Fenêtres modales ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16, 26, 44, .5); backdrop-filter: blur(2px); display: flex;
  align-items: flex-start; justify-content: center; padding: 4vh 12px; z-index: 100; overflow-y: auto;
}
.modal { background: var(--surface-1); border-radius: 14px; width: 560px; max-width: 100%; padding: 0 0 16px; box-shadow: var(--shadow-2); }
.modal-wide { width: 880px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 8px; }
.modal-head h3 { margin: 0; font-size: 15.5px; }
.modal-close { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 4px 18px 0; }

/* ---------- Notifications ---------- */
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 300; }
.toast { padding: 11px 16px; border-radius: 10px; color: #fff; font-weight: 500; box-shadow: var(--shadow-2); max-width: 380px; }
.toast-succes { background: #15803d; }
.toast-erreur { background: var(--critical); }

/* ---------- Onglets ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--gridline); margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 13px;
  cursor: pointer; font: inherit; color: var(--ink-2); font-weight: 500; border-radius: 8px 8px 0 0;
}
.tab:hover { background: #f2f5fa; color: var(--ink); }
.tab.active { color: var(--series-1-strong); border-bottom-color: var(--series-1); font-weight: 700; }

/* ---------- Extras (PJ / commentaires / historique) ---------- */
.extras-body { padding: 2px 0 6px; }
.pj-row, .hist-row { display: flex; gap: 10px; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--gridline); flex-wrap: wrap; }
.pj-row:last-child, .hist-row:last-child { border-bottom: 0; }
.com-row { padding: 8px 0; border-bottom: 1px solid var(--gridline); }
.com-head { margin-bottom: 2px; }
.com-add { display: flex; gap: 8px; margin-top: 10px; align-items: flex-start; }
.com-add textarea { flex: 1; }

/* ---------- Éditeur de lignes ---------- */
.lines-table .input { padding: 5px 7px; }
.lines-footer { display: flex; justify-content: space-between; align-items: flex-start; margin-top: 10px; gap: 12px; flex-wrap: wrap; }
.totals { margin-left: auto; min-width: 260px; }
.totals > div { display: flex; justify-content: space-between; padding: 3px 0; }
.totals-ttc { border-top: 1px solid var(--baseline); font-size: 15px; padding-top: 6px !important; }
.ajust { background: #fdf8ec; border-color: #ecdcae; margin-top: 6px; }

/* ---------- Tuiles KPI ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile-link { text-decoration: none; color: inherit; }
.tile {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; height: 100%; box-shadow: var(--shadow-1); transition: box-shadow .15s, transform .15s;
}
.tile-link:hover .tile { box-shadow: var(--shadow-2); transform: translateY(-1px); border-color: #c9d6f2; }
.tile-label { font-size: 12px; color: var(--ink-2); margin-bottom: 4px; font-weight: 600; }
.tile-value { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.tile-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.tile-alerte { border-left: 4px solid var(--warning); }
.tile-critique { border-left: 4px solid var(--critical); }
.tile-info { border-left: 4px solid var(--series-1); }
/* KPI dashboard */
.kpi-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 16px; margin-bottom: 8px; }
.kpi-blue { background: var(--series-1-soft); }
.kpi-green { background: #e2f6e7; }
.kpi-orange { background: #fdeee2; }
.kpi-red { background: #fce5e5; }
.kpi-violet { background: #eae7f8; }

/* ---------- Graphique ---------- */
.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; }
.chart-tick { font-size: 10.5px; fill: var(--muted); font-family: inherit; }
.chart-tip {
  position: absolute; transform: translate(-50%, -110%); background: #101a2c; color: #fff;
  padding: 6px 10px; border-radius: 8px; font-size: 12.5px; pointer-events: none; white-space: nowrap;
  box-shadow: var(--shadow-2);
}
/* Graphique barres verticales (dashboard) */
.vbars { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 8px; }
.vbar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; min-width: 0; }
.vbar-fill { width: 100%; max-width: 46px; background: var(--series-1); border-radius: 6px 6px 0 0; min-height: 2px; transition: height .25s; }
.vbar-fill.neg { background: var(--critical); }
.vbar-val { font-size: 10.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vbar-lab { font-size: 10.5px; color: var(--muted); white-space: nowrap; }

/* ---------- Sections ---------- */
.section-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); font-weight: 700;
  margin: 24px 0 12px; padding-bottom: 6px; border-bottom: 2px solid var(--gridline);
}
.section-title:first-of-type { margin-top: 4px; }

/* ---------- Barres de progression ---------- */
.prog-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.prog-label { min-width: 190px; color: var(--ink-2); font-size: 13px; }
.prog-track { flex: 1; height: 9px; background: var(--gridline); border-radius: 5px; overflow: hidden; }
.prog-fill { height: 100%; background: var(--series-1); border-radius: 5px; min-width: 2px; }
.prog-fill.depasse { background: var(--critical); }
.prog-pct { min-width: 48px; text-align: right; }

/* ---------- Barres horizontales ---------- */
.hbars { display: flex; flex-direction: column; gap: 6px; }
.hbar-row { display: flex; align-items: center; gap: 10px; }
.hbar-label { min-width: 130px; font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-label.small-label { min-width: 74px; color: var(--muted); font-size: 12px; }
.hbar-track { flex: 1; height: 13px; background: transparent; border-radius: 4px; }
.hbar-fill { height: 100%; background: var(--series-1); border-radius: 4px; min-width: 2px; transition: width .2s; }
.hbar-fill.s1 { background: var(--series-1); }
.hbar-fill.s2 { background: #eb6834; }
.hbar-fill.s3 { background: #16a37a; }
.hbar-value { min-width: 96px; text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ---------- Légende ---------- */
.legend { display: flex; gap: 16px; margin-bottom: 10px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.legend-chip { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend-chip.s1 { background: var(--series-1); }
.legend-chip.s2 { background: #eb6834; }
.legend-chip.s3 { background: #16a37a; }

/* ---------- Groupes de barres ---------- */
.gbars { display: flex; flex-direction: column; gap: 14px; }
.gbar-title { font-weight: 600; font-size: 13.5px; text-decoration: none; display: inline-block; margin-bottom: 3px; }
.gbar-group .hbar-row { padding: 1px 0; }

/* ---------- Balance âgée ---------- */
.balance-table td { font-variant-numeric: tabular-nums; }
.bal-1 { background: #fdf6e3; }
.bal-2 { background: #fdeee2; }
.bal-3 { background: #fbdcd2; color: #8a3618; font-weight: 600; }
.bal-4 { background: #fce5e5; color: #a32e2e; font-weight: 700; }
.balance-total td { border-top: 2px solid var(--baseline); background: #f6f8fb; }

/* ---------- Comparatif d'offres ---------- */
.comp-table td, .comp-table th { vertical-align: top; }
.comp-best { background: #eef8ef; }
.comp-rejetee { opacity: .5; }
.comp-total td { border-top: 2px solid var(--baseline); font-size: 15px; }
.consult-list { max-height: 300px; overflow-y: auto; margin-top: 10px; border: 1px solid var(--gridline); border-radius: 10px; }
.consult-item { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--gridline); cursor: pointer; }
.consult-item:last-child { border-bottom: 0; }
.consult-item:hover { background: #f2f6fc; }
.consult-item input { width: 16px; height: 16px; }

/* ---------- Connexion ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #101a2c 0%, #1b2d4a 100%); }
.login-card {
  background: var(--surface-1); border-radius: 16px; padding: 34px 36px; width: 360px; max-width: 92vw;
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 24px 70px rgba(0,0,0,.4);
}
.login-card h1 { text-align: center; }
.login-card p { text-align: center; margin: 0; }
.login-logo { font-size: 34px; text-align: center; }
.login-logo-img { max-width: 220px; max-height: 110px; margin: 0 auto; display: block; border-radius: 8px; }

/* ---------- Impression ---------- */
.print-page { max-width: 820px; margin: 0 auto; padding: 18px; }
.print-bar { display: flex; justify-content: space-between; margin-bottom: 14px; }
.print-doc { background: #fff; border: 1px solid var(--gridline); padding: 34px 38px; min-height: 1000px; display: flex; flex-direction: column; }
.print-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #101a2c; padding-bottom: 14px; }
.print-logo { max-height: 72px; max-width: 240px; display: block; margin-bottom: 8px; }
.print-soc { font-size: 20px; font-weight: 700; }
.print-soc-sub { font-size: 12px; color: #444; }
.print-title { text-align: right; }
.print-title h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: 1px; }
.print-parties { display: flex; gap: 16px; margin: 18px 0; }
.print-box { flex: 1; border: 1px solid #ccc; border-radius: 6px; padding: 10px 12px; font-size: 13px; }
.print-box-title { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: #666; margin-bottom: 5px; font-weight: 700; }
.print-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 4px; }
.print-table th { background: #101a2c; color: #fff; padding: 7px 8px; text-align: left; }
.print-table td { border: 1px solid #d5d5d0; padding: 6px 8px; }
.print-totaux { display: flex; justify-content: flex-end; margin-top: 12px; }
.print-totaux table { border-collapse: collapse; min-width: 260px; font-size: 13px; }
.print-totaux td { padding: 5px 10px; border: 1px solid #d5d5d0; }
.print-ttc td { font-weight: 700; background: #f0f4fa; font-size: 14px; }
.print-sign { display: flex; justify-content: flex-end; margin-top: 30px; }
.print-sign > div { width: 260px; }
.print-sign-zone { height: 90px; border: 1px dashed #bbb; border-radius: 6px; }
.print-footer { margin-top: auto; padding-top: 26px; font-size: 10.5px; color: #666; text-align: center; border-top: 1px solid #ddd; }

@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .print-page { max-width: none; padding: 0; }
  .print-doc { border: 0; padding: 0; min-height: auto; }
  .content { padding: 0; }
}

/* ---------- Divers ---------- */
.approb-banner { border-left: 4px solid var(--warning); background: #fdf8ec; }
.art-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.art-chip { background: #eef3fc; border: 1px solid #cfdef6; border-radius: 999px; padding: 3px 12px; font-size: 12px; }

/* ---------- Rôles & permissions ---------- */
.roles-layout { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
.roles-list h3 { margin-bottom: 8px; }
.role-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: 13.5px; }
.role-item:hover { background: #f0f3f9; }
.role-item.active { background: var(--series-1); color: #fff; }
.role-item.active .muted { color: #cdd8e6; }
.perm-table th.perm-col { font-size: 11.5px; white-space: nowrap; user-select: none; }
.perm-table td, .perm-table th { padding: 8px 6px; }
.perm-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--series-1); cursor: pointer; }
.perm-table input[type="checkbox"]:disabled { cursor: default; }

/* ---------- Audit ---------- */
.diff-list { flex-basis: 100%; margin-top: 4px; display: grid; gap: 3px; }
.diff-row { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; padding: 3px 8px; background: #f5f7fb; border-radius: 7px; flex-wrap: wrap; }
.diff-champ { font-weight: 700; min-width: 130px; color: var(--series-1-strong); }
.diff-avant { color: #b4491f; text-decoration: line-through; word-break: break-word; }
.diff-arrow { color: var(--muted); }
.diff-apres { color: #14682a; font-weight: 600; word-break: break-word; }
.audit-detail td { background: #fbfcfe; }
.hist-row { flex-wrap: wrap; }

/* ---------- Rapports ---------- */
.rapports-layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.rapports-groupe { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 12px 0 4px; }
.rapports-groupe:first-child { margin-top: 0; }
.rapport-item { padding: 7px 10px; border-radius: 9px; cursor: pointer; font-size: 13px; }
.rapport-item:hover { background: #f0f3f9; }
.rapport-item.active { background: var(--series-1); color: #fff; }
.rapport-barre { background: #eef1f6; border-radius: 4px; height: 12px; min-width: 120px; overflow: hidden; }
.rapport-barre > div { height: 100%; background: var(--series-1); border-radius: 4px; }
.rapport-barre > div.neg { background: var(--critical); }

/* ---------- Inventaires ---------- */
.inv-ecart-pos { color: #14682a; font-weight: 600; }
.inv-ecart-neg { color: var(--critical); font-weight: 600; }

/* ---------- Adaptation mobile ---------- */
@media (max-width: 1100px) { .form-grid-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .roles-layout, .rapports-layout { grid-template-columns: 1fr; }
  .burger {
    display: block; position: fixed; top: 10px; left: 10px; z-index: 60;
    background: var(--sidebar-bg); color: #fff; border: 0; border-radius: 9px;
    font-size: 18px; padding: 8px 12px; cursor: pointer;
  }
  .sidebar { position: fixed; left: -270px; transition: left .2s; z-index: 50; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .sidebar.open { left: 0; }
  .content { padding: 58px 14px 60px; }
}
@media (max-width: 700px) { .form-grid-6 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { min-width: 0; }
  .tile-value { font-size: 17px; overflow-wrap: anywhere; }
  .page-head { flex-direction: column; }
  .prog-label { min-width: 110px; }
  .hbar-label { min-width: 84px; }
  .hbar-value { min-width: 76px; }
}

/* ---------- Fonctions IA (v1.32) ---------- */
.ia-chat { min-height: 260px; max-height: 55vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px; }
.ia-accueil { text-align: center; padding: 24px 12px; }
.ia-exemples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.ia-exemple { background: var(--series-1-soft); border: 1px solid #cfdef6; color: var(--series-1-strong); border-radius: 999px; padding: 6px 14px; cursor: pointer; font: inherit; font-size: 12.5px; }
.ia-exemple:hover { background: #dbe7fb; }
.ia-msg { display: flex; }
.ia-msg.user { justify-content: flex-end; }
.ia-msg .ia-bulle { max-width: 85%; padding: 10px 14px; border-radius: 14px; }
.ia-msg.user .ia-bulle { background: var(--series-1); color: #fff; border-bottom-right-radius: 4px; }
.ia-msg.ia .ia-bulle { background: #f2f5fa; border-bottom-left-radius: 4px; }
.ia-prop { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--gridline); flex-wrap: wrap; }
.ia-prop:last-child { border-bottom: 0; }
.ia-score { width: 90px; height: 9px; background: #eef1f6; border-radius: 5px; overflow: hidden; }
.ia-score > div { height: 100%; background: linear-gradient(90deg, #16a37a, #3567d6); border-radius: 5px; }
