:root {
  --bg: #f4f6f7;
  --card: #ffffff;
  --ink: #17212b;
  --ink-2: #3c4855;
  --muted: #6b7682;
  --line: #e3e7ea;
  --line-2: #eef1f3;
  --accent: #0f5e5a;
  --accent-2: #12807a;
  --accent-soft: #e4f2f0;
  --danger: #b42318;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .18);

  --slate-bg: #eef1f4;  --slate-fg: #475467;
  --indigo-bg: #eef0ff; --indigo-fg: #3a3fbf;
  --amber-bg: #fff4dc;  --amber-fg: #a15c00;
  --blue-bg: #e6f1fd;   --blue-fg: #175cd3;
  --violet-bg: #f3edff; --violet-fg: #6b3fd4;
  --green-bg: #e3f6ea;  --green-fg: #1a7f45;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
a { color: var(--accent-2); }

/* ── Boutons & champs ───────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #f8fafb; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ok { background: var(--green-fg); border-color: var(--green-fg); color: #fff; }
.btn.warn { color: var(--amber-fg); border-color: #f1d9a6; background: var(--amber-bg); }
.btn.small { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--danger); }
.link { background: none; border: 0; padding: 0; color: var(--accent-2); font: inherit; font-weight: 500; cursor: pointer; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent;
  font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--line-2); color: var(--ink); }

label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
input, select, textarea {
  width: 100%; font: inherit; font-weight: 400; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  padding: 10px 12px; min-height: 42px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent-2); }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.grid3 { display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ── Démarrage ──────────────────────────────────── */
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Authentification ───────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, #d9eeeb 0%, transparent 60%), var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--card); border-radius: 18px;
  padding: 28px; box-shadow: var(--shadow-lg); display: grid; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 18px; }
.logo { width: 42px; height: 42px; border-radius: 12px; background: var(--accent); display: grid; place-items: center; flex: none; }
.logo svg { width: 24px; height: 24px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--line-2); border-radius: 10px; padding: 4px; }
.tab { border: 0; background: transparent; padding: 9px; border-radius: 8px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.google { width: 100%; }
.notice-card { text-align: center; }
.notice-card .big-icon { font-size: 40px; }

/* ── En-tête ────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar-in { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.topbar .brand h1 { font-size: 15.5px; }
.topbar .brand p { font-size: 12.5px; }
.topbar .logo { width: 36px; height: 36px; border-radius: 10px; }
.topbar .spacer { flex: 1; }
.who { text-align: right; font-size: 13px; line-height: 1.25; }
.who b { display: block; }
@media (max-width: 560px) { .who { display: none; } }
.tag { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--accent-soft); color: var(--accent); padding: 2px 8px; border-radius: 99px; }

/* ── Mise en page ───────────────────────────────── */
.container { max-width: 1180px; margin: 0 auto; padding: 22px 16px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 24px; }
.nav-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.nav-tab { border: 0; background: none; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nav-tab.active { color: var(--accent); border-color: var(--accent); }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--amber-bg); color: var(--amber-fg); font-size: 12px; margin-left: 4px; }

/* ── Stats ──────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; margin-bottom: 16px; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(3, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.stat:hover { border-color: #cfd6db; }
.stat.active { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-soft); }
.stat .n { font-size: 24px; font-weight: 700; }
.stat .l { font-size: 12.5px; color: var(--muted); font-weight: 500; }

/* ── Filtres ────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 320px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 6px 12px; font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; color: var(--ink-2); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ── Cartes cas ─────────────────────────────────── */
.case-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.case-card {
  text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: grid; gap: 8px; box-shadow: var(--shadow);
  transition: border-color .15s, transform .1s;
}
.case-card:hover { border-color: #c9d2d8; transform: translateY(-1px); }
.case-card.attention { border-color: #f1cf86; box-shadow: 0 0 0 3px #fff4dc; }
.cc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ref { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.cc-title { font-size: 16.5px; font-weight: 700; }
.cc-sub { font-size: 13.5px; color: var(--ink-2); }
.cc-cab { font-size: 13px; color: var(--accent); font-weight: 600; }
.progress { height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent-2); border-radius: 99px; transition: width .3s; }
.cc-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.cc-alert { font-size: 12.5px; font-weight: 600; color: var(--amber-fg); }
.late { color: var(--danger); font-weight: 600; }
.empty { grid-column: 1 / -1; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px 20px; text-align: center; color: var(--muted); }

/* ── Badges ─────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-slate { background: var(--slate-bg); color: var(--slate-fg); }
.b-indigo { background: var(--indigo-bg); color: var(--indigo-fg); }
.b-amber { background: var(--amber-bg); color: var(--amber-fg); }
.b-blue { background: var(--blue-bg); color: var(--blue-fg); }
.b-violet { background: var(--violet-bg); color: var(--violet-fg); }
.b-green { background: var(--green-bg); color: var(--green-fg); }

/* ── Étapes ─────────────────────────────────────── */
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); }
.stepper li { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; font-size: 12px; color: var(--muted); }
.stepper li::before { content: ""; position: absolute; top: 7px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.stepper li:first-child::before { display: none; }
.stepper .dot { position: relative; z-index: 1; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--line); }
.stepper li.done .dot { background: var(--accent-2); border-color: var(--accent-2); }
.stepper li.done::before, .stepper li.current::before { background: var(--accent-2); }
.stepper li.current .dot { border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--accent-soft); }
.stepper li.current { color: var(--ink); font-weight: 600; }
@media (max-width: 560px) { .stepper .lbl { font-size: 9.5px; padding: 0 1px; } }

/* ── Modale ─────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 32, .45); z-index: 50; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 920px; max-height: calc(100vh - 40px); overflow: auto; background: var(--bg); border-radius: 18px; box-shadow: var(--shadow-lg); }
.modal.narrow { max-width: 720px; }
.modal-head { position: sticky; top: 0; z-index: 2; background: var(--card); border-bottom: 1px solid var(--line); padding: 14px 18px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-head h3 { font-size: 19px; margin-top: 2px; }
.modal-body { padding: 18px; display: grid; gap: 14px; }
@media (max-width: 640px) {
  .modal-backdrop { padding: 0; place-items: stretch; }
  .modal { max-height: 100vh; height: 100%; border-radius: 0; }
}
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; align-content: start; }
.panel h4 { font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; white-space: pre-wrap; word-break: break-word; }

.callout { border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; }
.callout.amber { background: var(--amber-bg); border: 1px solid #f1d9a6; }
.callout.teal { background: var(--accent-soft); border: 1px solid #c4e2de; }
.callout h4 { font-size: 15px; }

/* ── Fichiers ───────────────────────────────────── */
.file-group { display: grid; gap: 6px; }
.file-group > .lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 10px; text-decoration: none; color: inherit; background: #fbfcfc; }
.file:hover { border-color: var(--line); background: #f6f8f9; }
.file .ext { flex: none; width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; background: var(--accent-soft); color: var(--accent); text-transform: uppercase; }
.file .ext.img { background: var(--violet-bg); color: var(--violet-fg); }
.file .ext.doc { background: var(--blue-bg); color: var(--blue-fg); }
.file .meta { min-width: 0; flex: 1; }
.file .name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .sz { font-size: 12px; color: var(--muted); }
.file .dl-ico { color: var(--muted); font-size: 18px; }

.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; background: #fbfcfc; cursor: pointer; transition: border-color .15s, background .15s; display: grid; gap: 4px; }
.dropzone:hover, .dropzone.over { border-color: var(--accent-2); background: var(--accent-soft); }
.dropzone b { color: var(--accent); }
.picked { display: grid; gap: 6px; }
.picked .file { background: #fff; }
.upl { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }

/* ── Schéma dentaire ────────────────────────────── */
.teeth { display: grid; gap: 6px; background: #fbfcfc; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.arch { display: grid; grid-template-columns: repeat(8, 1fr) 6px repeat(8, 1fr); gap: 3px; }
.arch .mid { background: var(--line); width: 2px; justify-self: center; }
.tooth { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 6px 0; font: inherit; font-size: 11.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; font-variant-numeric: tabular-nums; }
.tooth:hover { border-color: var(--accent-2); }
.tooth.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.teeth-sel { font-size: 13px; color: var(--muted); }
@media (max-width: 420px) { .tooth { font-size: 10px; padding: 5px 0; } .arch { gap: 2px; } }

/* ── Historique ─────────────────────────────────── */
.timeline { display: grid; gap: 10px; }
.ev { display: grid; grid-template-columns: 32px 1fr; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--line-2); color: var(--ink-2); }
.avatar.lab { background: var(--accent); color: #fff; }
.ev-head { font-size: 13px; color: var(--muted); }
.ev-head b { color: var(--ink); }
.ev-text { margin-top: 3px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.bubble { background: var(--line-2); border-radius: 4px 12px 12px 12px; padding: 8px 12px; display: inline-block; max-width: 100%; }
.msg-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }

/* ── Praticiens ─────────────────────────────────── */
.people { display: grid; gap: 8px; }
.person { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; flex-wrap: wrap; }
.person .info { flex: 1; min-width: 200px; }
.person .info b { display: block; }
.section-title { font-size: 15px; margin: 20px 0 10px; }

/* ── Toasts ─────────────────────────────────────── */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; animation: up .2s; }
.toast.err { background: var(--danger); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

.setup { max-width: 640px; margin: 60px auto; padding: 0 16px; }
.setup .panel { gap: 10px; }
code { background: var(--line-2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }

/* ── Tableau de bord ────────────────────────────── */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.dash-head h2 { font-size: 24px; }
.dash-head p::first-letter { text-transform: uppercase; }
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 14px; }
@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { text-align: left; font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 2px; box-shadow: var(--shadow); }
.kpi[data-go] { cursor: pointer; }
.kpi[data-go]:hover { border-color: #c9d2d8; }
.kpi:disabled { cursor: default; opacity: 1; }
.kpi-n { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi-l { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.kpi-s { font-size: 12px; color: var(--muted); }
.kpi.bad { border-color: #f3c3bd; background: #fff6f5; }
.kpi.bad .kpi-n { color: var(--danger); }
.kpi.good .kpi-n { color: var(--green-fg); }
.kpi.warn { border-color: #f1d9a6; background: #fffaf0; }
.kpi.warn .kpi-n { color: var(--amber-fg); }

.dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.dgrid.wide { grid-template-columns: 1.7fr 1fr; }
@media (max-width: 900px) { .dgrid, .dgrid.wide { grid-template-columns: 1fr; } }
.panel h4 { display: flex; align-items: center; gap: 8px; }
.pill { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); font-size: 12px; letter-spacing: 0; }
.pill.bad { background: #fde7e4; color: var(--danger); }
.pill.warnp { background: var(--amber-bg); color: var(--amber-fg); }

.hbars { display: grid; gap: 4px; }
.hbar { display: grid; grid-template-columns: 140px 1fr auto; align-items: center; gap: 10px; font: inherit; color: inherit; text-align: left; background: none; border: 0; padding: 6px 4px; border-radius: 8px; cursor: pointer; }
.hbar:hover { background: var(--line-2); }
.hbar.static { cursor: default; }
.hbar.static:hover { background: none; }
.hbars.compact .hbar { grid-template-columns: 150px 1fr 28px; padding: 3px 0; }
.hbar-l { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 14px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--accent-2); border-radius: 0 4px 4px 0; min-width: 0; }
.hbar-n { font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
@media (max-width: 480px) { .hbar, .hbars.compact .hbar { grid-template-columns: 100px 1fr auto; } }

.cols { position: relative; display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; height: 170px; align-items: end; padding-top: 18px; }
.col { position: relative; height: 100%; display: grid; grid-template-rows: auto 1fr auto; justify-items: center; cursor: default; }
.col-n { font-size: 11px; font-weight: 600; color: var(--ink-2); height: 14px; }
.col-bar { align-self: end; width: 70%; max-width: 26px; background: var(--accent-2); border-radius: 4px 4px 0 0; }
.col:hover .col-bar { background: var(--accent); }
.col-l { font-size: 10.5px; color: var(--muted); height: 16px; padding-top: 3px; white-space: nowrap; border-top: 1px solid var(--line); width: 100%; text-align: center; }
.tip { position: absolute; top: -8px; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 12px; padding: 5px 9px; border-radius: 8px; white-space: nowrap; pointer-events: none; }

.dlist { display: grid; gap: 4px; }
.dempty { padding: 6px 2px; }
.drow { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; text-align: left; font: inherit; color: inherit; background: none; border: 0; border-top: 1px solid var(--line-2); padding: 9px 4px; cursor: pointer; }
.drow:first-child { border-top: 0; }
.drow:hover { background: var(--line-2); border-radius: 8px; }
.drow-main { display: grid; min-width: 0; }
.drow-main b, .drow-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drow-right { display: grid; justify-items: end; font-size: 13.5px; white-space: nowrap; }
@media (max-width: 520px) { .drow { grid-template-columns: 1fr auto; } .drow-mid { display: none; } }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 560px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 9px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table td b, .table td span.small { display: block; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--line-2); }

/* ── Stockage / archives ────────────────────────── */
.file.archived .ext { background: var(--line-2); color: var(--muted); }
div.file.archived { cursor: default; }
.gauge-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.gauge-txt b { font-size: 20px; }
.gauge { position: relative; height: 12px; border-radius: 6px; background: var(--line-2); }
.gauge-fill { display: block; height: 100%; border-radius: 6px; background: var(--accent-2); }
.gauge.warn .gauge-fill { background: #d98a00; }
.gauge.bad .gauge-fill { background: var(--danger); }
.gauge-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-2); border-radius: 1px; }

/* ── Facturation ────────────────────────────────── */
.kpis4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .kpis4 { grid-template-columns: repeat(2, 1fr); } }
.kpis4 .kpi-n { font-size: 22px; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--muted); padding: 7px 12px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.table tbody tr.nohover { cursor: default; }
.table tbody tr.nohover:hover { background: none; }
.table tr.cancelled td { color: var(--muted); }
.table tr.cancelled td b { text-decoration: line-through; }
.table td span.small.late { display: block; }
.inv-lines input { min-height: 34px; padding: 6px 8px; font-size: 13.5px; }
.inv-lines input[type=checkbox] { width: 18px; min-height: 18px; accent-color: var(--accent); }
.inv-lines .w-qty { width: 64px; text-align: right; }
.inv-lines .w-pu { width: 104px; text-align: right; }
.inv-lines input.missing { border-color: #f1b6ae; background: #fff6f5; }
.inv-lines tr.off td { opacity: .45; }
.inv-lines td:nth-child(4) { min-width: 220px; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.totals dt { color: var(--ink-2); }
.totals dd { margin: 0; text-align: right; font-weight: 600; }
.totals .ttc { border-top: 1px solid var(--line); padding-top: 8px; font-size: 17px; font-weight: 700; color: var(--accent); }
.tarifs input, .tarifs select { min-height: 36px; padding: 6px 8px; }
.tarifs input { width: 110px; text-align: right; }

/* ── Praticiens : gestion ───────────────────────── */
.person-actions { gap: 6px; }
.person.is-suspended { opacity: .7; }
.note-int { display: block; margin-top: 3px; color: var(--ink-2); }

/* ── Types de travaux & tarifs spéciaux ─────────── */
.add-type { display: grid; grid-template-columns: 1fr 110px 170px auto; gap: 8px; align-items: center; }
.add-type input, .add-type select { min-height: 36px; padding: 6px 8px; }
@media (max-width: 640px) { .add-type { grid-template-columns: 1fr 1fr; } .add-type #nt-name { grid-column: 1 / -1; } }
.icon-btn.small-x { width: 30px; height: 30px; font-size: 20px; }
.tag-special { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 600; color: var(--violet-fg); background: var(--violet-bg); padding: 1px 7px; border-radius: 99px; }
td .tag-special { display: block; width: max-content; margin-left: auto; }

/* ── Sous-traitance ─────────────────────────────── */
.seg-full { display: flex; }
.seg-full button { flex: 1; }
.stepper.steps5 { grid-template-columns: repeat(5, 1fr); }
.tag-sub { display: inline-block; vertical-align: middle; font-size: 11px; font-weight: 600; color: var(--indigo-fg); background: var(--indigo-bg); padding: 1px 7px; border-radius: 99px; }
label.chk { display: flex; flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 500; color: var(--ink); }
label.chk input { width: 18px; min-height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.person .info > span.small { display: block; }
.grid-prix select, .grid-prix input { min-height: 36px; padding: 6px 8px; }
.grid-prix input { width: 100px; }
.grid-prix td:nth-child(2) select { min-width: 160px; }
.tag-kind { display: inline-block; vertical-align: middle; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; padding: 1px 6px; border-radius: 5px; }
.tag-kind.cad { background: var(--indigo-bg); color: var(--indigo-fg); }
.tag-kind.cam { background: var(--blue-bg); color: var(--blue-fg); }
label.inline-sel { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-size: 13px; }
label.inline-sel select { min-height: 34px; padding: 4px 8px; width: auto; }
.kt { font-weight: 600; color: var(--ink-2); }

/* ── Téléchargement groupé ──────────────────────── */
.zipbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line-2); }
.zipbar label.chk { margin-right: auto; font-size: 13px; }
.file-line { display: flex; align-items: center; gap: 8px; }
.file-line .fchk { width: 18px; min-height: 18px; flex: none; accent-color: var(--accent); }
.file-line .file { flex: 1; min-width: 0; }

/* ── Visualisation des fichiers ─────────────────── */
.prev-btn { flex: none; font-size: 18px; width: 40px; height: 40px; border: 1px solid var(--line-2); background: #fbfcfc; }
.prev-btn:hover { background: var(--accent-soft); border-color: var(--accent-2); }
#preview-root { position: fixed; inset: 0; z-index: 80; background: rgba(15, 23, 32, .72); display: flex; flex-direction: column; animation: fade .15s; }
.pv-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.pv-title { display: grid; min-width: 0; }
.pv-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-body { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; padding: 12px; }
.pv-body .spinner { border-color: rgba(255,255,255,.3); border-top-color: #fff; }
.pv-frame { width: 100%; height: 100%; border: 0; border-radius: 10px; background: #fff; }
.pv-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; background: #fff; }
.pv-3d { width: 100%; height: 100%; border-radius: 10px; overflow: hidden; }
.pv-3d canvas { display: block; width: 100% !important; height: 100% !important; touch-action: none; }
.pv-hint { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); background: rgba(255,255,255,.85); padding: 4px 10px; border-radius: 99px; color: var(--ink-2); }
.pv-msg { background: var(--card); border-radius: 12px; padding: 20px; max-width: 460px; text-align: center; display: grid; gap: 10px; }
@media (max-width: 640px) { .pv-body { padding: 0; } .pv-frame, .pv-3d { border-radius: 0; } }
.panel.drop-over { outline: 2px dashed var(--accent-2); outline-offset: -6px; background: var(--accent-soft); }
.picked-sum { display: flex; justify-content: space-between; align-items: center; }

/* ── Groupes de fichiers ────────────────────────── */
.fg { border: 1px solid var(--line); border-radius: 12px; background: #fbfcfc; overflow: hidden; }
.fg-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; }
.fg-head .gchk { width: 18px; min-height: 18px; flex: none; accent-color: var(--accent); }
.gchk-ph { width: 18px; flex: none; }
.fg-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 6px 4px; font: inherit; color: inherit; text-align: left; cursor: pointer; border-radius: 8px; }
.fg-toggle:hover { background: var(--line-2); }
.fg-caret { color: var(--muted); transition: transform .15s; flex: none; }
.fg.open .fg-caret { transform: rotate(90deg); }
.fg-main { display: grid; min-width: 0; }
.fg-main b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fg-body { display: grid; gap: 6px; padding: 4px 10px 10px 36px; border-top: 1px solid var(--line-2); background: #fff; }
.file-group { gap: 8px; }

/* ── Conception non validée ─────────────────────── */
.rv { display: inline-block; vertical-align: middle; margin-left: 6px; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.rv-ko { background: #fde7e4; color: var(--danger); }
.rv-ok { background: var(--green-bg); color: var(--green-fg); }
.callout.redesign { background: #fff6f5; border: 1px solid #f3c3bd; }
.callout.redesign h4 { color: var(--danger); }
.redesign-note { background: #fff; border-left: 3px solid var(--danger); border-radius: 6px; padding: 8px 12px; font-size: 14px; white-space: pre-wrap; }
.case-card.redo { border-color: #f3c3bd; box-shadow: 0 0 0 3px #fff0ee; }
.cc-alert.redesign-alert { color: var(--danger); }
.b-teal { background: var(--accent-soft); color: var(--accent); }

/* Rémunérations & relevés */
.pay-panel { margin-bottom: 14px; }
.pay-panel tfoot td { border-top: 2px solid var(--line, #e3e7ea); }
.pay-panel .kt { margin-right: 4px; }
details.panel > summary { cursor: pointer; list-style-position: inside; }
details.panel[open] > summary { margin-bottom: 10px; }
.pay-panel td.num, .pay-panel th.num { white-space: nowrap; }
.pay-rates input, .pay-rates select { width: 100%; min-width: 0; }
.pay-rates td:first-child { width: 52%; }
.pay-rates td:nth-child(2) { width: 120px; }
.pay-rates td:nth-child(3) { width: 165px; }
.pay-rates [data-rw]:empty { display: none; }
.pay-rates [data-rw] { display: block; margin-top: 4px; }
.sanc-cell { display: inline-flex; flex-direction: column; align-items: flex-end; text-decoration: none; }
.sanc-cell:hover span:first-child { text-decoration: underline; }
.sanc-table input[data-mo] { min-width: 140px; }
.sanc-table tr.off td:not(:nth-child(6)) { opacity: .45; text-decoration: line-through; }
.sanc-table input[type=checkbox] { width: 18px; height: 18px; min-width: 0; padding: 0; }
.sanc-table td:nth-child(5) input { max-width: 110px; }

/* Travail à refaire */
.tag-redo { display: inline-block; font-size: 11.5px; font-weight: 700; color: #9a3412; background: #ffedd5; border: 1px solid #fdba74; border-radius: 999px; padding: 1px 8px; vertical-align: middle; white-space: nowrap; }
.case-card.is-redo { border-left: 4px solid #f97316; }
.redo-box { border-color: #fed7aa; }
.redo-dd { color: #9a3412; font-weight: 600; }
.redo-dd .muted { display: block; font-weight: 400; }
.b-cyan { background: #e0f7fa; color: #0e7490; }

/* Cas annulé */
.case-card.is-cancelled { opacity: .62; }
.case-card.is-cancelled .cc-title { text-decoration: line-through; }
.cancelled-alert { color: var(--ink-2, #475467) !important; }
.cancelled-box { background: #f2f4f7; border-color: #d0d5dd; }
.cancel-panel { border-color: #fecdca; }
.cancel-panel > summary { cursor: pointer; }
.danger-txt { color: #b42318; }
.cancel-panel[open] { display: grid; gap: 10px; }

/* Partage de fichiers du cas avec un sous-traitant */
.share-box { display: grid; gap: 8px; }
.share-box > summary { list-style: none; justify-self: start; cursor: pointer; }
.share-box > summary::-webkit-details-marker { display: none; }
.share-box[open] { border: 1px solid var(--line, #e3e7ea); border-radius: 10px; padding: 10px; }
.share-list { display: grid; gap: 4px; max-height: 220px; overflow: auto; }
.warn-txt { color: #b54708; display: block; }

/* Noms de fichiers longs : la colonne ne s'élargit plus, le nom passe sur 2 lignes, les boutons restent visibles */
.grid2 > *, .grid3 > *, .dgrid > *, .modal-body > *, .panel, .file-group, .fg, .fg-body { min-width: 0; }
.file-line, .file { min-width: 0; max-width: 100%; }
.file .name { white-space: normal; overflow-wrap: anywhere; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.file .dl-ico, .file-line .icon-btn, .file-line .prev-btn, .file .icon-btn { flex: none; }
.file-line .prev-btn { width: 40px; height: 40px; }
.pv-title { flex: 1; }
.pv-head > .row { flex: none; flex-wrap: nowrap; }
@media (max-width: 560px) { .pv-head #pv-dl { font-size: 0; padding: 6px 10px; } .pv-head #pv-dl::before { content: "⬇"; font-size: 15px; } }
.tag-noval { display: inline-block; font-size: 11.5px; font-weight: 700; color: #067647; background: #dcfae6; border: 1px solid #abefc6; border-radius: 999px; padding: 1px 8px; vertical-align: middle; white-space: nowrap; }
.noval-chk { margin-top: 4px; }

/* Travail urgent */
.case-card.is-urgent { border: 2px solid #f04438; box-shadow: 0 0 0 3px #fee4e2; }
.urgent-banner { margin: -2px 0 6px; align-self: flex-start; display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .06em; color: #fff; background: #d92d20; border-radius: 6px; padding: 2px 9px; }
.tag-urgent { display: inline-block; font-size: 11.5px; font-weight: 800; color: #b42318; background: #fee4e2; border: 1px solid #fda29b; border-radius: 999px; padding: 1px 8px; vertical-align: middle; white-space: nowrap; }
.urgent-box { border-color: #fecdca; }

/* Cycles / relance d'un travail livré */
.tag-cycle { display: inline-block; font-size: 11.5px; font-weight: 700; color: #5925dc; background: #f4f3ff; border: 1px solid #d9d6fe; border-radius: 999px; padding: 1px 8px; vertical-align: middle; white-space: nowrap; }
.tag-etape { display: inline-block; font-size: 11.5px; font-weight: 700; color: #026aa2; background: #f0f9ff; border: 1px solid #b9e6fe; border-radius: 999px; padding: 1px 8px; vertical-align: middle; white-space: nowrap; }
.relaunch-box { border-color: #d9d6fe; }
.relaunch-box[open] { display: grid; gap: 10px; }
.relaunch-box > summary { cursor: pointer; }
.sub-details > summary { cursor: pointer; color: var(--accent); }
.sub-details[open] > summary { margin-bottom: 8px; }
.cycles-dd > div { margin-bottom: 6px; }
.file.file-ko { opacity: .7; cursor: not-allowed; border-style: dashed; }
.file.file-ko .ko-msg { color: var(--danger); font-weight: 600; }
.prev-btn:disabled { opacity: .35; cursor: not-allowed; }

/* Types, matériaux & délais */
.cat-table input, .cat-table select { width: 100%; min-width: 70px; }
.cat-table td:first-child { min-width: 180px; }
.mat-list { display: flex; flex-wrap: wrap; gap: 6px; }
.mat-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border: 1px solid var(--line, #e3e7ea); border-radius: 999px; font-size: 13px; background: #fff; }
.mat-chip button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 16px; line-height: 1; padding: 0 4px; }
.mat-chip button:hover { color: var(--danger); }
.cat-table td:nth-child(3) select { min-width: 125px; }
.cat-table td:nth-child(2) input, .cat-table td:nth-child(4) input, .cat-table td:nth-child(5) input { max-width: 120px; }

/* Délais par étape */
.modal.wide { max-width: 1100px; }
.delay-table input { min-width: 64px; max-width: 90px; }
.delay-table th.num { font-size: 12px; vertical-align: bottom; }
.delay-table .def-row td { background: #f6fef9; }
.step-d { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.step-timer { margin: 10px 0 0; font-size: 13px; color: var(--ink-2); }
.step-timer.late { color: var(--danger); }
.cc-alert.step-late { color: var(--danger); }
.reject-box { margin-top: 10px; display: grid; gap: 8px; }
.reject-box > summary { cursor: pointer; color: var(--danger); justify-self: start; }
.reject-box[open] { border: 1px solid #fecdca; border-radius: 10px; padding: 10px; background: #fffbfa; }
.deliver-box { display: grid; gap: 8px; padding: 10px; margin: 8px 0; border: 1px solid #abefc6; background: #f6fef9; border-radius: 10px; }
.btn.danger-outline { color: var(--danger); border-color: #fecdca; background: #fff; }
.rm-box { display: grid; gap: 8px; margin-top: 10px; }
.file-line .del-btn { flex: none; width: 40px; height: 40px; color: var(--danger); }
.file-line .del-btn:hover { background: #fee4e2; border-color: #fecdca; }

/* Notifications (cloche) */
.bell-wrap { position: relative; }
.bell { position: relative; font-size: 18px; width: 40px; height: 40px; }
.bell.has { animation: bell-ring .9s ease 1; }
@keyframes bell-ring { 0%,100% { transform: rotate(0) } 20% { transform: rotate(14deg) } 40% { transform: rotate(-12deg) } 60% { transform: rotate(8deg) } 80% { transform: rotate(-4deg) } }
.bell-n { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #d92d20; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface, #fff); }
.bell-panel { position: absolute; right: 0; top: calc(100% + 8px); width: min(420px, calc(100vw - 24px)); max-height: min(70vh, 560px); display: flex; flex-direction: column;
  background: var(--surface, #fff); border: 1px solid var(--line, #e3e7ea); border-radius: 12px; box-shadow: 0 12px 32px rgba(16,24,40,.16); z-index: 60; overflow: hidden; }
.bp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line, #e3e7ea); }
.bp-head > b { margin-right: auto; }
.bp-list { overflow: auto; }
.bp-item { display: flex; gap: 10px; width: 100%; text-align: left; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line, #eef0f2); background: none; cursor: pointer; font: inherit; color: inherit; align-items: flex-start; }
.bp-item:hover { background: var(--bg, #f7f9fa); }
.bp-item.unread { background: #f0f9ff; }
.bp-ico { flex: none; width: 28px; height: 28px; display: grid; place-items: center; font-size: 16px; }
.bp-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.bp-ref, .bp-time { font-size: 12px; color: var(--muted); }
.bp-text { font-size: 12.5px; color: var(--ink-2, #475467); overflow-wrap: anywhere; }
.bp-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #1570ef; margin-top: 8px; }
.bp-empty { padding: 18px 14px; }
@media (max-width: 560px) { .bell-panel { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; } }

/* CBCT / DICOM : G-Rad Viewer */
.cbct-btn { flex: none; font-size: 18px; width: 40px; height: 40px; border: 1px solid var(--line-2); background: #fbfcfc; }
.cbct-btn:hover { background: var(--accent-soft); border-color: var(--accent-2); }
.fg-head .cbct-gbtn { flex: none; white-space: nowrap; margin-left: 6px; }
@media (max-width: 560px) { .fg-head { flex-wrap: wrap; } .fg-head .cbct-gbtn { margin-left: 34px; } }

/* Visionneuse : décision du dentiste */
.pv-decide { flex: none; background: var(--card, #fff); border-top: 1px solid var(--line); padding: 12px 16px; display: grid; gap: 10px; box-shadow: 0 -6px 18px rgba(16,24,40,.08); }
.pvd-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.pvd-q { display: grid; gap: 2px; }
.pvd-modif { display: grid; gap: 8px; }
.pvd-modif textarea { width: 100%; }
@media (max-width: 560px) { .pvd-row .row { width: 100%; } .pvd-row .row .btn { flex: 1; } }

/* Cas refusé par le labo — à refaire */
.cc-alert.rejected-alert { color: #b42318; font-weight: 600; }
.rejected-box { background: #fef3f2; border-color: #fecdca; }
.reject-case-box { margin: 8px 0; display: grid; gap: 8px; }
.reject-case-box > summary { cursor: pointer; color: var(--danger); }
.reject-case-box[open] { border: 1px solid #fecdca; background: #fffbfa; border-radius: 10px; padding: 10px; }
.b-red { background: #fee4e2; color: #b42318; }

/* ===== Messagerie ===== */
.chat-btn { position: relative; font-size: 18px; width: 40px; height: 40px; }
#chat-root { position: fixed; inset: 0; z-index: 900; }
.chat-shade { position: absolute; inset: 0; background: rgba(15, 23, 42, .35); }
.chat-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(900px, 100vw); background: var(--card, #fff); display: flex; box-shadow: -8px 0 30px rgba(0,0,0,.18); }
.chat-panel.solo { width: min(520px, 100vw); }
.chat-side { width: 300px; flex: none; border-right: 1px solid var(--line, #e5e7eb); display: flex; flex-direction: column; min-height: 0; }
.chat-side-head, .chat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line, #e5e7eb); }
.chat-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-new { padding: 10px 12px; border-bottom: 1px solid var(--line, #e5e7eb); }
.chat-new select { width: 100%; }
.chat-list { overflow-y: auto; flex: 1; }
.chat-item { position: relative; display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line, #f1f5f9); padding: 10px 28px 10px 14px; cursor: pointer; font: inherit; color: inherit; }
.chat-item:hover { background: var(--line-2); }
.chat-item.on { background: var(--accent-soft); }
.chat-item.unread b { font-weight: 800; }
.chat-item .bp-dot { position: absolute; right: 12px; top: 50%; }
.ci-top { display: flex; justify-content: space-between; gap: 6px; min-width: 0; }
.ci-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-time, .ci-kind { font-size: .75rem; color: var(--muted, #64748b); flex: none; }
.ci-last { font-size: .85rem; color: var(--muted, #64748b); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 6px; background: var(--bg, #f8fafc); }
.chat-empty { margin: auto; text-align: center; padding: 20px; }
.chat-empty p:first-child { font-size: 2rem; margin: 0; }
.chat-day { align-self: center; font-size: .75rem; color: var(--muted, #64748b); background: rgba(100,116,139,.1); border-radius: 99px; padding: 2px 10px; margin: 8px 0 4px; }
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 80%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg-who { font-size: .75rem; color: var(--muted, #64748b); margin: 0 6px 2px; }
.msg-bubble { background: var(--card, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 14px 14px 14px 4px; padding: 8px 12px; overflow-wrap: anywhere; line-height: 1.4; }
.msg.mine .msg-bubble { background: var(--accent); color: #fff; border-color: var(--accent); border-radius: 14px 14px 4px 14px; }
.msg-time { font-size: .7rem; color: var(--muted, #94a3b8); margin: 2px 6px 0; }
.msg-case { display: block; margin-top: 6px; font: inherit; font-size: .8rem; background: var(--accent-soft); color: var(--accent); border: 0; border-radius: 8px; padding: 3px 8px; cursor: pointer; }
.msg.mine .msg-case { background: rgba(255,255,255,.2); color: #fff; }
.chat-compose { border-top: 1px solid var(--line, #e5e7eb); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.chat-compose select { width: 100%; font-size: .85rem; }
.chat-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-row textarea { flex: 1; resize: none; min-height: 40px; max-height: 140px; }
.chat-back { display: none; }
@media (max-width: 720px) {
  .chat-panel, .chat-panel.solo { width: 100vw; }
  .chat-panel.lab .chat-side { width: 100%; border-right: 0; }
  .chat-panel.lab .chat-main { display: none; }
  .chat-panel.lab.thread-open .chat-side { display: none; }
  .chat-panel.lab.thread-open .chat-main { display: flex; }
  .chat-back { display: inline-flex; }
  .msg { max-width: 90%; }
}

/* Envoi automatique en fabrication */
.auto-fab { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 12px; margin: 6px 0 10px; border: 1px dashed var(--line); border-radius: 10px; }
.auto-fab.on { border: 1px solid #b7e1d6; background: var(--accent-soft); }
