/* DermaGen ERP — thème « verre dépoli » : fond dégradé lavande-rose, cartes blanches arrondies, accent violet.
   Charte : Inter, violet #8d7bf0. Toutes les classes de l'application sont conservées. */
:root {
  --page: #efecf9;
  --white: #ffffff;
  --glass: rgba(255,255,255,.78);
  --glass-strong: rgba(255,255,255,.92);
  --card: #f6f4fc;
  --ink: #17151f;
  --ink-2: #4e4a5e;
  --grey-t: #8d8899;
  --grey-lt: #ddd9ea;
  --line: rgba(118,99,185,.12);
  --purple: #8d7bf0;
  --purple-dk: #6f5be0;
  --purple-lt: #b9aefc;
  --purple-pale: #efeafe;
  --purple-glow: rgba(141,123,240,.38);
  --green: #2f9e6b; --green-bg: #e3f6ec;
  --amber: #c98a00; --amber-bg: #fff3d4;
  --red: #d64545;  --red-bg: #fde6e6;
  --blue: #3b73d6; --blue-bg: #e6eefc;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(60,40,120,.04), 0 10px 30px rgba(60,40,120,.08);
  --shadow-lift: 0 2px 4px rgba(60,40,120,.05), 0 18px 44px rgba(60,40,120,.14);
  --sidebar-w: 268px;
  --ease: cubic-bezier(.19,1,.22,1);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, 'Segoe UI', 'Helvetica Neue', sans-serif;
  font-size: 14px; color: var(--ink); min-height: 100vh;
  background:
    radial-gradient(ellipse 70% 55% at 8% 0%,   rgba(196,180,255,.55) 0%, rgba(196,180,255,0) 70%),
    radial-gradient(ellipse 60% 50% at 95% 10%, rgba(255,196,230,.55) 0%, rgba(255,196,230,0) 70%),
    radial-gradient(ellipse 70% 60% at 85% 95%, rgba(176,196,255,.55) 0%, rgba(176,196,255,0) 70%),
    radial-gradient(ellipse 55% 45% at 15% 100%, rgba(255,214,236,.5) 0%, rgba(255,214,236,0) 70%),
    linear-gradient(160deg, #f2eefb 0%, #f6edf7 50%, #eef0fb 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--purple-dk); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.015em; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0 0 8px; }
small { color: var(--grey-t); }
pre { white-space: pre-wrap; font-size: 12px; background: var(--card); padding: 12px; border-radius: 12px; }
::selection { background: var(--purple-lt); color: #fff; }

/* Splash */
#splash { position: fixed; inset: 0; background: #f3eefb; display: grid; place-content: center; text-align: center; z-index: 999; }
#splash img { height: 72px; margin: 0 auto 14px; filter: drop-shadow(0 10px 24px var(--purple-glow)); }
#splash p { color: var(--grey-t); }

/* ---------- Barre latérale ---------- */
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--glass); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  border-right: 1px solid rgba(255,255,255,.7); box-shadow: 8px 0 40px rgba(60,40,120,.06);
  display: flex; flex-direction: column; z-index: 50; transition: transform .35s var(--ease);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 24px 22px 14px; }
.brand img { height: 34px; width: auto; filter: drop-shadow(0 6px 14px var(--purple-glow)); }
.brand strong { font-size: 13px; font-weight: 700; letter-spacing: .22em; color: var(--ink); }
#nav { flex: 1; overflow-y: auto; padding: 4px 14px 12px; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--grey-t); padding: 18px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 7px 10px 7px 7px; margin: 2px 0; border-radius: 14px;
  color: var(--ink-2); font-weight: 500; transition: background .2s, color .2s;
}
.nav-item:hover { background: rgba(255,255,255,.75); color: var(--ink); }
.nav-item.active { background: var(--purple); color: #fff; box-shadow: 0 8px 20px var(--purple-glow); }
.nav-icon {
  width: 32px; height: 32px; display: grid; place-items: center; flex: none;
  border-radius: 10px; background: var(--purple-pale); color: var(--purple-dk); font-size: 15px;
  transition: background .2s, color .2s;
}
.nav-item.active .nav-icon { background: rgba(255,255,255,.22); color: #fff; }
.sidebar-foot { margin: 10px 14px 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(255,255,255,.6); font-size: 12px; line-height: 1.5; }

/* ---------- Coquille ---------- */
#shell { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
#topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px;
  padding: 16px 32px; background: rgba(243,239,251,.65); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
#topbar .topbar-text { flex: 1; min-width: 0; }
#topbar .greeting { font-size: 12.5px; color: var(--grey-t); font-weight: 500; margin-bottom: 1px; }
#topbar h1 { font-size: 22px; letter-spacing: -.02em; }
#menu-btn { display: none; }
#global-search {
  width: 300px; border-radius: 999px; padding: 10px 18px 10px 40px;
  background: var(--glass-strong) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238d8899' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") 15px 50% no-repeat;
  border: 1px solid rgba(255,255,255,.9); box-shadow: var(--shadow);
}
.topbar-avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--purple-lt), var(--purple-dk)); color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .04em;
  box-shadow: 0 8px 20px var(--purple-glow);
}
#main { padding: 10px 32px 60px; flex: 1; max-width: 1400px; width: 100%; }

@media (max-width: 960px) {
  #sidebar { transform: translateX(-100%); box-shadow: 0 0 60px rgba(60,40,120,.25); background: var(--glass-strong); }
  #sidebar.open { transform: none; }
  #shell { margin-left: 0; }
  #menu-btn { display: inline-flex; }
  #global-search { display: none; }
  #main, #topbar { padding-left: 16px; padding-right: 16px; }
}

/* ---------- Cartes et grilles ---------- */
.card {
  background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.85); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 24px; margin-bottom: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { flex: 1; }
.card-head a.muted { font-weight: 500; color: var(--purple-dk); }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  position: relative; background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.85); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px 16px 20px; transition: transform .25s var(--ease), box-shadow .25s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.stat::before { content: ''; position: absolute; top: 18px; right: 18px; width: 10px; height: 10px; border-radius: 50%; background: var(--purple); box-shadow: 0 0 0 4px var(--purple-pale); }
.stat.warn::before { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-bg); }
.stat.danger::before { background: var(--red); box-shadow: 0 0 0 4px var(--red-bg); }
.stat.good::before { background: var(--green); box-shadow: 0 0 0 4px var(--green-bg); }
.stat-label { font-size: 12px; color: var(--grey-t); font-weight: 500; padding-right: 24px; }
.stat-value { font-size: 28px; font-weight: 700; margin: 6px 0 2px; letter-spacing: -.03em; }
.stat-sub { font-size: 12px; color: var(--ink-2); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 18px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.subtitle { color: var(--grey-t); font-size: 13px; margin-top: 3px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.9); background: var(--glass-strong); color: var(--ink); font: inherit; font-weight: 500;
  cursor: pointer; transition: all .2s; white-space: nowrap; box-shadow: 0 2px 8px rgba(60,40,120,.06);
}
.btn:hover { background: #fff; box-shadow: var(--shadow); transform: translateY(-1px); }
.btn.primary { background: var(--purple); border-color: transparent; color: #fff; box-shadow: 0 8px 20px var(--purple-glow); }
.btn.primary:hover { background: var(--purple-dk); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: rgba(255,255,255,.7); }
.btn.danger { background: var(--red-bg); border-color: transparent; color: var(--red); box-shadow: none; }
.btn.danger:hover { background: #f8d5d5; }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.icon-btn { border: none; background: transparent; font: inherit; font-size: 16px; cursor: pointer; padding: 6px 9px; border-radius: 10px; color: var(--ink-2); }
.icon-btn:hover { background: var(--purple-pale); color: var(--purple-dk); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; white-space: nowrap; }
.row-actions .btn { padding: 4px 9px; font-size: 12px; box-shadow: none; }

/* ---------- Formulaires ---------- */
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--glass-strong); border: 1px solid rgba(118,99,185,.16);
  border-radius: var(--radius-sm); padding: 10px 13px; width: 100%; outline: none; transition: border .2s, box-shadow .2s, background .2s;
}
input:hover, select:hover, textarea:hover { background: #fff; }
input:focus, select:focus, textarea:focus { border-color: var(--purple); background: #fff; box-shadow: 0 0 0 4px var(--purple-pale); }
input[type="search"].search { max-width: 340px; border-radius: 999px; padding-left: 16px; }
input[type="checkbox"] { width: auto; accent-color: var(--purple); }
textarea { resize: vertical; min-height: 60px; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; grid-column: span 2; }
.field.cols-1 { grid-column: span 1; }
.field.cols-2 { grid-column: span 2; }
.field.cols-3 { grid-column: span 3; }
.field.cols-4 { grid-column: span 4; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.field label i { color: var(--red); font-style: normal; }
.field small { font-size: 11.5px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; padding-top: 22px; cursor: pointer; }
.form-section { grid-column: span 4; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--purple-dk); margin-top: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
@media (max-width: 700px) { .form-grid { grid-template-columns: repeat(2, 1fr); } .field.cols-3, .field.cols-4, .form-section { grid-column: span 2; } }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select { width: auto; min-width: 160px; border-radius: 999px; padding-left: 16px; }
.toolbar .spacer { flex: 1; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.55); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--grey-t); font-weight: 600; background: rgba(239,234,254,.55); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.7); }
tr.clickable { cursor: pointer; }
td.right, th.right { text-align: right; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }
td .muted, .muted { color: var(--grey-t); font-size: 12.5px; }
.strong { font-weight: 600; }
.empty { padding: 34px; text-align: center; color: var(--grey-t); background: rgba(255,255,255,.5); border: 1px dashed rgba(118,99,185,.22); border-radius: 16px; }
tfoot td { font-weight: 600; background: rgba(239,234,254,.55); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--card); color: var(--ink-2); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.purple { background: var(--purple-pale); color: var(--purple-dk); }

/* ---------- Modales ---------- */
body.modal-open { overflow: hidden; }
.modal-overlay { position: fixed; inset: 0; background: rgba(60,40,120,.28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; animation: fade .2s; }
.modal { background: var(--glass-strong); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border: 1px solid rgba(255,255,255,.9); border-radius: 24px; width: 100%; max-width: 640px; box-shadow: 0 30px 80px rgba(60,40,120,.3); animation: rise .3s var(--ease); }
.modal.wide { max-width: 1040px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 12px; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 8px 24px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.confirm-text { font-size: 14.5px; line-height: 1.5; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes rise { from { transform: translateY(14px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ---------- Lignes répétées (BC, formulations) ---------- */
.lines { border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.5); border-radius: 16px; overflow: hidden; grid-column: span 4; }
.lines table { font-size: 13px; }
.lines td { padding: 6px 8px; }
.lines input, .lines select { padding: 7px 9px; border-radius: 10px; }
.lines .del { color: var(--red); }
.lines-foot { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: rgba(239,234,254,.55); font-size: 13px; }
.totals { margin-left: auto; width: 320px; max-width: 100%; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.totals div:last-child { border-bottom: none; font-weight: 700; font-size: 15px; }

/* ---------- Notifications ---------- */
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 13.5px; box-shadow: var(--shadow-lift); animation: rise .3s var(--ease); max-width: 360px; }
.toast.err { background: var(--red); }
.toast.warn { background: var(--amber); }
.toast.out { opacity: 0; transition: opacity .3s; }

/* ---------- Détails (fiche) ---------- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 20px; }
.detail-grid div { padding: 6px 0; border-bottom: 1px solid var(--line); }
.detail-grid dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--grey-t); margin-bottom: 2px; }
.detail-grid dd { margin: 0; font-weight: 500; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--grey-t); margin: 8px 0 12px; font-size: 13px; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.55); }
.back:hover { color: var(--ink); background: #fff; }
.week-head { display: flex; align-items: center; gap: 10px; margin: 22px 0 10px; }
.week-head h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--purple-dk); background: var(--purple-pale); padding: 5px 12px; border-radius: 999px; }
.week-head::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.pct-ok { color: var(--green); font-weight: 600; }
.pct-bad { color: var(--red); font-weight: 600; }
.progress { height: 6px; background: var(--purple-pale); border-radius: 999px; overflow: hidden; min-width: 80px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--purple-lt), var(--purple)); border-radius: 999px; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { border-bottom: 1px solid var(--line); }
.checklist .check { padding-top: 4px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list .badge { cursor: pointer; }
.tag-list .badge:hover { background: var(--red-bg); color: var(--red); }
.info { background: var(--purple-pale); border-radius: var(--radius-sm); padding: 12px 16px; font-size: 13px; color: var(--purple-dk); margin-bottom: 14px; }
.warnbox { background: var(--amber-bg); border-radius: var(--radius-sm); padding: 12px 16px; font-size: 13px; color: var(--amber); margin-bottom: 14px; }
.kv { display: flex; gap: 6px; font-size: 13px; }
.kv b { min-width: 120px; color: var(--grey-t); font-weight: 500; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.timeline li:last-child { border-bottom: none; }
.timeline .when { color: var(--grey-t); min-width: 90px; }

@media print {
  body { background: #fff; }
  #sidebar, #topbar, .page-head .actions, .row-actions, .toolbar { display: none !important; }
  #shell { margin: 0; }
  .card, .stat { box-shadow: none; border: 1px solid #ddd; background: #fff; backdrop-filter: none; }
}

/* ---------- Assistante chimiste (chat) ---------- */
.chat-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; height: calc(100vh - 118px); min-height: 520px; }
.chat-side { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 16px; min-height: 0; }
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.chat-item { display: block; padding: 10px 12px; border-radius: 14px; color: var(--ink); transition: background .2s; }
.chat-item:hover { background: rgba(255,255,255,.75); }
.chat-item.active { background: var(--purple-pale); }
.chat-item-title { font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-side-foot { font-size: 12px; line-height: 1.5; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.55); }
.chat-main { display: flex; flex-direction: column; margin: 0; padding: 0; min-height: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.skill-switch { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(255,255,255,.6); border: 1px solid rgba(255,255,255,.9); }
.skill-tab { font: inherit; font-size: 12.5px; font-weight: 500; padding: 7px 12px; border-radius: 999px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; transition: all .2s; white-space: nowrap; }
.skill-tab:hover { background: rgba(255,255,255,.9); }
.skill-tab.on { background: var(--purple); color: #fff; box-shadow: 0 6px 16px var(--purple-glow); }
.chat-avatar, .msg-avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 18px; color: #fff; background: linear-gradient(135deg, var(--purple-lt), var(--purple-dk)); box-shadow: 0 6px 16px var(--purple-glow); }
.msg-avatar { width: 32px; height: 32px; font-size: 15px; margin-top: 2px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.chat-welcome { max-width: 720px; margin: auto; text-align: center; padding: 20px 0; }
.chat-welcome h3 { font-size: 20px; margin-bottom: 8px; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chip { font: inherit; font-size: 13px; padding: 9px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.9); background: var(--glass-strong); color: var(--ink-2); cursor: pointer; box-shadow: 0 2px 8px rgba(60,40,120,.06); transition: all .2s; text-align: left; }
.chip:hover { background: var(--purple-pale); color: var(--purple-dk); transform: translateY(-1px); }
.msg { display: flex; gap: 10px; max-width: 86%; }
.msg.user { align-self: flex-end; flex-direction: column; align-items: flex-end; }
.msg.assistant { align-self: flex-start; }
.msg-body { padding: 12px 16px; border-radius: 18px; font-size: 14px; line-height: 1.55; }
.msg.user .msg-body { background: var(--purple); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 8px 20px var(--purple-glow); white-space: pre-wrap; }
.msg.assistant .msg-body { background: var(--glass-strong); border: 1px solid rgba(255,255,255,.9); border-bottom-left-radius: 6px; box-shadow: var(--shadow); }
.msg-time { font-size: 11px; color: var(--grey-t); margin: 4px 6px 0; }
.msg-status { font-size: 12px; color: var(--purple-dk); margin: 6px 6px 0; display: flex; align-items: center; gap: 6px; }
.msg-status[hidden] { display: none; }
.msg-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--purple-lt); animation: typing 1s infinite ease-in-out; }
.md a { color: var(--purple-dk); text-decoration: underline; text-decoration-color: var(--purple-lt); } .md a:hover { color: var(--purple); }
.md p { margin: 0 0 8px; } .md p:last-child { margin-bottom: 0; }
.md h3, .md h4 { margin: 10px 0 6px; font-size: 14.5px; } .md h3:first-child, .md h4:first-child { margin-top: 0; }
.md ul, .md ol { margin: 4px 0 8px; padding-left: 20px; } .md li { margin: 2px 0; }
.md code { background: var(--purple-pale); color: var(--purple-dk); padding: 1px 5px; border-radius: 6px; font-size: 12.5px; }
.md pre { background: #1d1a2b; color: #f3f0ff; padding: 10px 12px; border-radius: 12px; overflow-x: auto; margin: 6px 0 8px; }
.md .table-wrap { margin: 6px 0 8px; } .md table { font-size: 13px; } .md th, .md td { padding: 7px 10px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--purple-lt); animation: typing 1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }
.chat-composer { padding: 14px 22px 18px; border-top: 1px solid var(--line); background: rgba(255,255,255,.35); }
.chat-composer-row { display: flex; gap: 10px; align-items: flex-end; }
.chat-composer-row + .chat-composer-row { margin-top: 10px; }
.chat-composer select { width: auto; max-width: 100%; border-radius: 999px; padding: 8px 14px; font-size: 13px; }
.chat-composer textarea { flex: 1; border-radius: 18px; min-height: 48px; resize: none; }
.chat-send { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--purple); color: #fff; font-size: 18px; cursor: pointer; box-shadow: 0 8px 20px var(--purple-glow); flex: none; transition: transform .2s, background .2s; }
.chat-send:hover { background: var(--purple-dk); transform: translateY(-1px); }
.chat-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }
@media (max-width: 960px) { .chat-layout { grid-template-columns: 1fr; height: auto; } .chat-side { order: 2; } .chat-main { min-height: 70vh; } .msg { max-width: 100%; } }

/* ---------- Connexion ---------- */
body.login-open { overflow: hidden; }
#login { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 20px; background: inherit; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: fade .3s; transition: opacity .35s ease; }
#login.out { opacity: 0; pointer-events: none; }
.login-card { width: 100%; max-width: 420px; background: var(--glass-strong); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border: 1px solid rgba(255,255,255,.9); border-radius: 26px; box-shadow: var(--shadow-lift); padding: 34px 32px 26px; text-align: center; animation: rise .4s var(--ease); }
.login-logo { height: 56px; margin: 0 auto 14px; filter: drop-shadow(0 10px 24px var(--purple-glow)); }
.login-card h1 { font-size: 22px; letter-spacing: -.02em; margin-bottom: 6px; }
.login-card form { margin-top: 20px; text-align: left; display: flex; flex-direction: column; gap: 12px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.login-card label.login-remember { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--ink-2); }
.login-submit { justify-content: center; width: 100%; padding: 12px 18px; margin-top: 4px; font-size: 14.5px; }
.login-error { background: var(--red-bg); color: var(--red); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; }
.login-ok { background: var(--green-bg); color: var(--green); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; }
.login-foot a { color: var(--purple-dk); }
.login-foot { font-size: 12px; margin-top: 16px; }

/* ---------- Menu utilisateur ---------- */
.topbar-user { position: relative; flex: none; }
.topbar-avatar { border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: 13px; letter-spacing: .04em; transition: transform .2s; }
.topbar-avatar:hover { transform: translateY(-1px); }
.user-menu { position: absolute; right: 0; top: 48px; min-width: 200px; background: var(--glass-strong); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid rgba(255,255,255,.9); border-radius: 16px; box-shadow: var(--shadow-lift); padding: 8px; display: none; z-index: 60; }
.user-menu.open { display: block; animation: rise .2s var(--ease); }
.user-menu-name { font-weight: 600; font-size: 13px; padding: 8px 12px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-menu a, .user-menu button { display: block; width: 100%; text-align: left; font: inherit; font-size: 13.5px; color: var(--ink); background: transparent; border: 0; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.user-menu a:hover, .user-menu button:hover { background: var(--purple-pale); color: var(--purple-dk); }

/* ---------- Profil ---------- */
.profile-hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.profile-hero h2 { font-size: 22px; }
.profile-avatar { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 20px; letter-spacing: .04em; box-shadow: 0 10px 24px var(--purple-glow); flex: none; }
.list-avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 11px; }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.color-dot { width: 28px; height: 28px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; transition: transform .15s; }
.color-dot:hover { transform: scale(1.1); }
.color-dot.on { border-color: #fff; box-shadow: 0 0 0 2px var(--ink); }
@media (max-width: 960px) { .user-menu { right: 0; } }

/* ---------- Fiches théoriques ---------- */
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 8px; }
.recipe-card { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; border-radius: var(--radius); background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid rgba(255,255,255,.85); box-shadow: var(--shadow); color: var(--ink); transition: transform .25s var(--ease), box-shadow .25s; }
.recipe-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.recipe-card.phase-T { border-top: 4px solid var(--purple); } .recipe-card.phase-N { border-top: 4px solid var(--green); }
.recipe-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.recipe-name { font-weight: 600; font-size: 15.5px; letter-spacing: -.01em; line-height: 1.25; }
.recipe-desc { font-size: 12.5px; color: var(--grey-t); line-height: 1.45; flex: 1; }
.recipe-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); padding-top: 8px; border-top: 1px solid var(--line); }
/* ---------- Mode opératoire en étapes ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.step-chip { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.9); box-shadow: 0 2px 8px rgba(60,40,120,.05); }
.step-no { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--purple); color: #fff; font-size: 12px; font-weight: 700; }
.step-text { flex: 1; line-height: 1.5; font-size: 13.5px; }
.step-text[data-edit-step] { cursor: text; border-radius: 8px; padding: 0 4px; } .step-text[data-edit-step]:hover { background: var(--purple-pale); }
.step-chip .del { color: var(--red); margin: -4px -6px 0 0; }
.step-add { display: flex; gap: 8px; margin-top: 12px; } .step-add input { flex: 1; }
.steps-editor { display: flex; flex-direction: column; gap: 6px; }
.step-row { display: flex; align-items: center; gap: 8px; } .step-row input { flex: 1; } .step-row .del { color: var(--red); }
.step-row .step-no { width: 24px; height: 24px; font-size: 11px; }
/* ---------- Fil de discussion d'une fiche ---------- */
.reco-thread { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.reco-thread:empty { margin-top: 0; }
.reco-thread .msg { max-width: 92%; }
.reco-composer { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.reco-composer input { flex: 1; border-radius: 999px; padding: 11px 16px; }
.reco-send { width: 42px; height: 42px; font-size: 16px; }
.reco-card { border-left: 4px solid var(--purple); }
.reco-icon { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, var(--purple-lt), var(--purple-dk)); color: #fff; font-size: 13px; margin-right: 6px; vertical-align: -6px; }
.reco-body { font-size: 14px; line-height: 1.55; }
.page-head .actions select { width: auto; border-radius: 999px; padding-left: 16px; }
