/* =====================================================================
   components.css : boutons, cartes, KPI, tableaux, onglets, modales,
   recherche globale, notifications, infobulles, jauges, chat…
   ===================================================================== */

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 550; font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; border-radius: 7px; }
.btn.icon { width: 34px; padding: 0; }
.btn.icon.sm { width: 28px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn .dot-count {
  position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 10px; background: var(--crit); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--surface);
}
.btn.has-dot { position: relative; }
.spin .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Contrôle segmenté ---------- */
.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-3); border-radius: 9px; border: 1px solid var(--border);
}
.seg button {
  border: 0; background: transparent; padding: 0 11px; height: 28px; border-radius: 7px;
  font-size: 12.5px; font-weight: 550; color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Menus déroulants ---------- */
.dd { position: relative; display: inline-block; }
.dd-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; min-width: 220px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow-lg);
  padding: 6px; display: none;
}
.dd.open .dd-menu { display: block; animation: rise .16s var(--ease); }
.dd-menu.left { right: auto; left: 0; }
.dd-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 9px; border: 0; background: transparent; border-radius: 7px;
  font-size: 13px; text-align: left; cursor: pointer; color: var(--text);
}
.dd-item:hover { background: var(--surface-3); text-decoration: none; }
.dd-item.on { font-weight: 650; }
.dd-item .check { margin-left: auto; color: var(--primary); visibility: hidden; }
.dd-item.on .check { visibility: visible; }
.dd-sep { height: 1px; background: var(--border); margin: 5px 2px; }
.dd-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; padding: 6px 9px 4px; }
.dd-menu label.dd-item input { margin: 0; accent-color: var(--primary); }

.mkt-btn .flag, .flag {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 18px; padding: 0 4px; border-radius: 4px;
  font-size: 10px; font-weight: 750; letter-spacing: .03em;
  background: var(--primary-soft); color: var(--primary);
}
.flag.all { background: var(--accent-soft); color: var(--accent); }

/* ---------- Champs ---------- */
.input, .select, textarea.input {
  height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input-icon { position: relative; display: inline-flex; align-items: center; }
.input-icon .ic { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 32px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: var(--border-strong); cursor: pointer; transition: background .2s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); }
input[type=range] { accent-color: var(--primary); width: 100%; }

/* ---------- Cartes ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); min-width: 0;
}
.card-h {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 14px 16px 0;
}
.card-h h2 { display: flex; align-items: center; gap: 8px; }
.card-h .sub { font-size: 12px; color: var(--muted); font-weight: 450; }
.card-b { padding: 14px 16px 16px; }
.card-b.flush { padding: 8px 0 0; }
.card.link { cursor: pointer; transition: transform .18s var(--ease), box-shadow .18s, border-color .18s; }
.card.link:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card-f { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; }

/* ---------- KPI ---------- */
.kpi { position: relative; padding: 14px 16px 12px; overflow: hidden; display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.kpi:hover { text-decoration: none; }
.kpi::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--kpi-c, var(--primary)); opacity: .9; }
.kpi-top { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.kpi-ic { width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--kpi-c, var(--primary)) 14%, transparent); color: var(--kpi-c, var(--primary)); }
.kpi-ic .ic { width: 15px; height: 15px; }
.kpi-val { font-size: 25px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-top: 4px; }
.kpi-val small { font-size: 13px; font-weight: 550; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.kpi-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.kpi-spark { height: 34px; margin: 6px -4px -2px; }
.kpi-arrow { position: absolute; right: 12px; top: 12px; color: var(--muted); opacity: 0; transition: opacity .15s, transform .15s; }
.card.link:hover .kpi-arrow { opacity: 1; transform: translate(2px, -2px); }

.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 650; font-size: 12px; padding: 1px 6px; border-radius: 20px; }
.delta.up { color: var(--good); background: var(--good-soft); }
.delta.down { color: var(--crit); background: var(--crit-soft); }
.delta.flat { color: var(--text-2); background: var(--surface-3); }

/* ---------- Badges / pastilles ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px;
  background: var(--surface-3); color: var(--text-2);
}
.badge .ic { width: 12px; height: 12px; stroke-width: 2.2; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.crit { background: var(--crit-soft); color: var(--crit); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.outline { background: transparent; border: 1px solid var(--border); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; font-weight: 550; color: var(--text-2); cursor: pointer;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.chip .n { font-size: 11px; background: var(--surface-3); color: var(--text-2); border-radius: 10px; padding: 0 6px; }
.chip.on .n { background: var(--surface); color: var(--primary); }

/* ---------- Infobulles ---------- */
[data-tip] { position: relative; }
.tip-ic { display: inline-flex; color: var(--muted); cursor: help; vertical-align: -3px; }
.tip-ic .ic { width: 14px; height: 14px; }
#tooltip {
  position: fixed; z-index: 200; max-width: 280px; pointer-events: none;
  background: #151a2e; color: #eef0f6; font-size: 12px; line-height: 1.45; font-weight: 450;
  padding: 8px 10px; border-radius: 8px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
#tooltip.show { opacity: 1; transform: none; }
:root[data-theme="dark"] #tooltip { background: #eceef5; color: #151a2e; }

/* ---------- Tableaux ---------- */
.tbl-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; }
.tbl-tools .grow { flex: 1; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-weight: 600; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  padding: 9px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none;
}
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th .sort-ic { display: inline-block; width: 10px; margin-left: 3px; opacity: .35; }
.tbl th.sorted { color: var(--text); }
.tbl th.sorted .sort-ic { opacity: 1; color: var(--primary); }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.click { cursor: pointer; }
.tbl .num { text-align: right; }
.tbl th.num { text-align: right; }
.tbl td.wrap { white-space: normal; min-width: 220px; }
.tbl tfoot td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--border); }
.tbl-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.pager { display: flex; gap: 4px; align-items: center; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.empty .ic { width: 30px; height: 30px; margin-bottom: 6px; color: var(--border-strong); }

.prod-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.prod-cell .thumb { width: 38px; height: 38px; }
.prod-cell b { display: block; font-weight: 600; color: var(--text); max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
.prod-cell small { color: var(--muted); font-size: 11.5px; }
.thumb { border-radius: 9px; background: var(--surface-3); border: 1px solid var(--border); flex: none; object-fit: cover; display: block; }

.minibar { display: inline-block; width: 64px; height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; vertical-align: middle; margin-left: 6px; }
.minibar i { display: block; height: 100%; border-radius: 6px; background: var(--primary); }

/* ---------- Onglets ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 14px; border: 0; background: transparent; cursor: pointer; white-space: nowrap;
  font-weight: 550; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--primary); border-bottom-color: var(--primary); }
.tab .ic { width: 16px; height: 16px; }
.tab-panel { display: none; }
.tab-panel.on { display: block; animation: rise .25s var(--ease); }

/* ---------- Modale ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(10, 13, 28, .45);
  display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%; max-width: 560px; max-height: 80vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
  transform: translateY(8px) scale(.99); transition: transform .18s var(--ease);
}
.overlay.show .modal { transform: none; }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-b { padding: 16px 18px; overflow-y: auto; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Recherche globale (Ctrl+K) ---------- */
.cmdk { max-width: 640px; }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cmdk-in input { flex: 1; border: 0; background: transparent; font-size: 16px; outline: none; }
.cmdk-in input:focus-visible { box-shadow: none; }
.cmdk-list { max-height: 56vh; overflow-y: auto; padding: 6px; }
.cmdk-group { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; padding: 10px 10px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; cursor: pointer; color: var(--text); }
.cmdk-item:hover { text-decoration: none; }
.cmdk-item .ci { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--text-2); flex: none; overflow: hidden; }
.cmdk-item .ci img { width: 30px; height: 30px; }
.cmdk-item b { font-weight: 600; display: block; }
.cmdk-item small { color: var(--muted); font-size: 12px; }
.cmdk-item .go { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.cmdk-item.sel { background: var(--primary-soft); }
.cmdk-item.sel .go { color: var(--primary); }
.cmdk-foot { display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); }
mark { background: color-mix(in srgb, var(--s5) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- Panneau notifications ---------- */
.notif-panel { width: 380px; padding: 0; }
.notif-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.notif.unread { background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
.notif p { margin: 0; font-size: 12.8px; }
.notif small { color: var(--muted); font-size: 11.5px; }
.sev-dot { width: 28px; height: 28px; flex: none; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.sev-dot .ic { width: 15px; height: 15px; }
.sev-dot.crit { background: var(--crit-soft); color: var(--crit); }
.sev-dot.warn { background: var(--warn-soft); color: var(--warn); }
.sev-dot.info { background: var(--info-soft); color: var(--info); }
.sev-dot.good { background: var(--good-soft); color: var(--good); }

/* ---------- Toasts ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 380px;
  padding: 11px 14px; border-radius: 11px; background: #151a2e; color: #eef0f6; box-shadow: var(--shadow-lg);
  font-size: 13px; animation: rise .2s var(--ease);
}
.toast .ic { color: #5ee3a1; }
.toast.warn .ic { color: #ffc35a; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .2s; }

/* ---------- Alertes (liste) ---------- */
.alert-row { display: flex; align-items: flex-start; gap: 11px; padding: 11px 16px; border-top: 1px solid var(--border); color: var(--text); }
.alert-row:first-child { border-top: 0; }
.alert-row:hover { background: var(--surface-2); text-decoration: none; }
.alert-row p { margin: 0; font-size: 13px; }
.alert-row small { color: var(--muted); font-size: 11.5px; }
.alert-row .go { margin-left: auto; align-self: center; color: var(--muted); }

/* ---------- Timeline / activité ---------- */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: flex; gap: 11px; padding: 9px 16px; position: relative; }
.tl li::before { content: ""; position: absolute; left: 30px; top: 38px; bottom: -6px; width: 1px; background: var(--border); }
.tl li:last-child::before { display: none; }
.tl .when { margin-left: auto; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.tl p { margin: 0; font-size: 13px; }
.tl small { color: var(--muted); }

/* ---------- Progression / jauges ---------- */
.prog { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.prog i { display: block; height: 100%; border-radius: 8px; background: var(--primary); transition: width .8s var(--ease); }
.prog.good i { background: var(--good); }
.prog.warn i { background: var(--warn); }
.prog.crit i { background: var(--crit); }
.goal { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; }
.goal-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.goal-top b { font-size: 13px; }
.goal-val { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.goal-val small { font-size: 12px; color: var(--muted); font-weight: 500; }
.goal-line { display: flex; gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.goal-line:first-child { border-top: 0; }
.ring { position: relative; width: 64px; height: 64px; flex: none; }
.ring svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .bg { stroke: var(--surface-3); }
.ring .fg { stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.ring span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }

/* Barre de stock / couverture */
.cover-bar { position: relative; height: 8px; border-radius: 8px; background: var(--surface-3); width: 110px; overflow: hidden; display: inline-block; vertical-align: middle; }
.cover-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px; }

/* Cascade de rentabilité */
.wf { display: flex; flex-direction: column; gap: 7px; }
.wf-row { display: grid; grid-template-columns: 150px 1fr 96px; align-items: center; gap: 10px; font-size: 13px; }
.wf-row .lab { color: var(--text-2); }
.wf-row .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.wf-track { position: relative; height: 22px; border-radius: 6px; background: var(--surface-2); }
.wf-track i { position: absolute; top: 0; bottom: 0; border-radius: 5px; }
.wf-row.total .lab, .wf-row.total .val { color: var(--text); font-weight: 750; }
.wf-row.total { padding-top: 7px; border-top: 1px dashed var(--border-strong); }

/* ---------- Divers ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 3px; border-radius: 2px; width: 14px; }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 200px; }
.chart-box.xs { height: 150px; }
.chart-box.lg { height: 330px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.info-strip {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 11px;
  background: var(--info-soft); color: var(--text); font-size: 13px; border: 1px solid color-mix(in srgb, var(--info) 25%, transparent);
}
.info-strip .ic { color: var(--info); }
.info-strip.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.info-strip.warn .ic { color: var(--warn); }
.info-strip.good { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.info-strip.good .ic { color: var(--good); }
.mini-stats { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.mini-stat { background: var(--surface-2); border-radius: 9px; padding: 8px 10px; }
.mini-stat > span { display: block; font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.mini-stat b { font-size: 15px; font-variant-numeric: tabular-nums; }
.v2-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px;
  background: linear-gradient(90deg, var(--accent-soft), transparent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  font-size: 13px;
}
.v2-banner .ic { color: var(--accent); }

/* Cartes produits (vue cartes) */
.pcard { display: flex; flex-direction: column; gap: 12px; padding: 14px; color: var(--text); }
.pcard:hover { text-decoration: none; }
.pcard-h { display: flex; gap: 12px; align-items: flex-start; }
.pcard-h .thumb { width: 54px; height: 54px; }
.pcard-h b { display: block; font-weight: 650; line-height: 1.3; }
.pcard-h small { color: var(--muted); font-size: 11.5px; }

/* ---------- Assistant IA ---------- */
.chat-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; height: calc(100vh - var(--top-h) - 150px); min-height: 520px; }
.chat-side { display: flex; flex-direction: column; overflow: hidden; }
.chat-side .card-b { overflow-y: auto; flex: 1; }
.chat-hist { display: flex; flex-direction: column; gap: 2px; }
.chat-hist button { text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.chat-hist button:hover { background: var(--surface-3); color: var(--text); }
.chat-hist button.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.chat-main { display: flex; flex-direction: column; overflow: hidden; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 10px; max-width: 860px; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg .av { width: 30px; height: 30px; border-radius: 9px; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.msg.me .av { background: var(--surface-3); color: var(--text-2); }
.msg.ai .av { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }
.bubble { padding: 11px 14px; border-radius: 13px; font-size: 13.5px; line-height: 1.55; min-width: 0; }
.msg.me .bubble { background: var(--primary); color: var(--primary-ink); border-top-right-radius: 4px; }
.msg.ai .bubble { background: var(--surface-2); border: 1px solid var(--border); border-top-left-radius: 4px; }
.bubble h4 { font-size: 13.5px; margin: 10px 0 5px; }
.bubble h4:first-child { margin-top: 0; }
.bubble ul { margin: 4px 0 8px; padding-left: 18px; }
.bubble .used { margin-top: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.bubble .used summary { cursor: pointer; padding: 8px 11px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.bubble .used table { font-size: 12px; }
.typing span { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-input { border-top: 1px solid var(--border); padding: 12px; display: flex; gap: 8px; align-items: flex-end; }
.chat-input textarea { flex: 1; min-height: 40px; max-height: 140px; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.suggest button { text-align: left; }

/* Codes d'état technique */
.state { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.state.good { color: var(--good); } .state.warn { color: var(--warn); } .state.crit { color: var(--crit); } .state.info { color: var(--info); } .state.muted { color: var(--muted); }
