/* Immat & Go — interface de gestion. Thème clair, épuré, couleurs de statut cohérentes. */
:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e4e8ee;
  --border-strong: #cfd6e0;
  --text: #0f1b2d;
  --text-2: #475569;
  --muted: #74819a;
  --brand: #163a70;
  --primary: #2a6fd6;
  --primary-hover: #1f5cb8;
  --primary-soft: #eaf2fd;
  --focus: 0 0 0 3px rgba(42, 111, 214, .22);
  /* statuts */
  --gris: #5b6577;   --gris-bg: #eef1f5;
  --bleu: #1f5cb8;   --bleu-bg: #e7f0fc;
  --orange: #a95a00; --orange-bg: #fff2e0;
  --rouge: #c0262d;  --rouge-bg: #fdeceb;
  --vert: #157a3c;   --vert-bg: #e5f5ea;
  /* séries graphiques (palette validée) */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .05), 0 1px 3px rgba(15, 27, 45, .04);
  --shadow-lg: 0 12px 40px rgba(15, 27, 45, .16);
  --sidebar: 252px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 620; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 14px; font-weight: 620; }
p { margin: 0; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.block { display: block; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pad { padding: 12px 16px; }
.spacer { flex: 1; }
.ic { flex-shrink: 0; vertical-align: -3px; }
.ic.flip { transform: rotate(180deg); }
.c-rouge { color: var(--rouge); } .c-orange { color: var(--orange); } .c-vert { color: var(--vert); } .c-bleu { color: var(--bleu); }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
[hidden] { display: none !important; }

/* ------------------------------------------------------------ Boutons & champs */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible, .icon-btn:focus-visible, input:focus, select:focus, textarea:focus { outline: none; box-shadow: var(--focus); border-color: var(--primary); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--rouge); border-color: var(--rouge); color: #fff; }
.btn-danger:hover { background: #a11f25; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--gris-bg); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn-ok { color: var(--vert); } .btn-ok:hover { background: var(--vert-bg); border-color: var(--vert); }
.btn-ko { color: var(--rouge); } .btn-ko:hover { background: var(--rouge-bg); border-color: var(--rouge); }
.btn-wa { color: #0f7a43; }
.btn.disabled { opacity: .45; pointer-events: none; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; }
.icon-btn:hover { background: var(--gris-bg); color: var(--text); text-decoration: none; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.link:hover { text-decoration: underline; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 10px; min-height: 34px; width: 100%; transition: border-color .12s, box-shadow .12s; }
textarea { resize: vertical; line-height: 1.45; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--primary); }
input:disabled, select:disabled, textarea:disabled, input[readonly] { background: var(--surface-2); color: var(--text-2); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: 12.5px; font-weight: 560; color: var(--text-2); }
.field small { color: var(--muted); font-size: 11.5px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: pointer; font-size: 13.5px; }
.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.inline input { width: auto; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.form-actions.left { justify-content: flex-start; margin: 0 0 14px; }
.form-error { margin: 0 20px 12px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--rouge-bg); color: var(--rouge); font-size: 13px; }
.login .form-error { margin: 0 0 12px; }

/* ------------------------------------------------------------ Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 560; white-space: nowrap; line-height: 18px; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-gris { color: var(--gris); background: var(--gris-bg); }
.b-bleu { color: var(--bleu); background: var(--bleu-bg); }
.b-orange { color: var(--orange); background: var(--orange-bg); }
.b-rouge { color: var(--rouge); background: var(--rouge-bg); }
.b-vert { color: var(--vert); background: var(--vert-bg); }
.prio { font-size: 11.5px; color: var(--muted); }
.tag { display: inline-block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 650; color: var(--muted); background: var(--gris-bg); padding: 1px 6px; border-radius: 4px; }
.auto-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: #6a4bc4; background: #f1edfc; padding: 1px 7px 1px 5px; border-radius: 999px; }
.plate { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 600; letter-spacing: .03em; padding: 1px 6px;
  border: 1px solid var(--border-strong); border-left: 4px solid #2c4fa5; border-right: 4px solid #2c4fa5; border-radius: 4px; background: #fff; white-space: nowrap; }
.chip { display: inline-block; padding: 2px 8px; margin: 2px 2px 0 0; background: var(--orange-bg); color: var(--orange); border-radius: 999px; font-size: 12px; }
.dot-alert { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--rouge); color: #fff; font-size: 11px; font-weight: 700; }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #dfe7f5; color: var(--brand); font-size: 10.5px; font-weight: 700; flex-shrink: 0; }
.avatar.lg { width: 34px; height: 34px; font-size: 12px; }

/* Ancienneté ANTS */
.age { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.age i { width: 9px; height: 9px; border-radius: 50%; }
.age small { font-weight: 450; color: var(--muted); font-size: 11px; }
.age-normale i { background: var(--vert); }
.age-surveiller { color: var(--orange); } .age-surveiller i { background: #e48b0c; }
.age-prolongee { color: var(--rouge); } .age-prolongee i { background: var(--rouge); }
.age-critique { color: #fff; background: var(--rouge); padding: 1px 8px; border-radius: 999px; } .age-critique i { background: #fff; } .age-critique small { color: #ffe1e1; }
.legend-bar .age-critique { padding: 1px 8px; }

/* Progression */
.progress { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.progress .bar { flex: 1; height: 7px; border-radius: 4px; background: var(--gris-bg); overflow: hidden; }
.progress .bar span { display: block; height: 100%; border-radius: 4px; }
.progress b { font-size: 12.5px; min-width: 34px; text-align: right; }
.progress.sm { min-width: 90px; } .progress.sm .bar { height: 5px; }
.f-vert { background: var(--vert); } .f-bleu { background: var(--primary); } .f-orange { background: #e48b0c; } .f-gris { background: #b4bdcb; } .f-rouge { background: var(--rouge); }
.exc { color: var(--orange); font-size: 11px; font-weight: 600; }

/* ------------------------------------------------------------ Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, #dce8fb 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #e2efe8 0%, transparent 55%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px 30px 24px; box-shadow: var(--shadow-lg); }
.login-card h1 { margin: 26px 0 4px; font-size: 21px; }
.login-card > p { margin-bottom: 20px; font-size: 13.5px; }
.login-foot { margin-top: 18px; font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.pw { position: relative; } .pw input { padding-right: 40px; } .pw .icon-btn { position: absolute; right: 3px; top: 2px; }

/* ------------------------------------------------------------ Structure */
#app { min-height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; }
.brand b { display: block; font-size: 15px; letter-spacing: -.01em; }
.brand small { display: block; color: var(--muted); font-size: 11.5px; }
.brand.big .logo { width: 42px; height: 42px; border-radius: 11px; }
.brand.big b { font-size: 18px; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 30; }
.sidebar .brand { padding: 18px 18px 14px; }
.new-btn { margin: 0 14px 10px; width: auto; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.nav-group { margin-top: 10px; }
.nav-title { display: block; padding: 6px 10px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #98a3b6; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--text-2); font-weight: 520; font-size: 13.5px; }
.sidebar nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 620; }
.sidebar nav a span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cnt { font-style: normal; font-size: 11px; font-weight: 650; min-width: 20px; text-align: center; padding: 1px 6px; border-radius: 9px; background: var(--gris-bg); color: var(--text-2); }
.cnt.c-rouge { background: var(--rouge-bg); color: var(--rouge); }
.cnt.c-orange { background: var(--orange-bg); color: var(--orange); }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); }
.me > div:nth-child(2) { flex: 1; min-width: 0; }
.me b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-actions { display: flex; }
.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; height: 60px; padding: 0 28px; background: rgba(244, 246, 249, .88); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 620px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px; padding: 0 10px; height: 38px; color: var(--muted); }
.search:focus-within { box-shadow: var(--focus); border-color: var(--primary); }
.search input { border: 0; padding: 0; min-height: 0; height: 100%; background: transparent; box-shadow: none !important; }
.search kbd { font: 11px ui-monospace, monospace; border: 1px solid var(--border-strong); border-radius: 4px; padding: 1px 6px; color: var(--muted); }
.search-results { position: absolute; top: 44px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; max-height: 70vh; overflow: auto; }
.search-results a { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 7px; color: var(--text); }
.search-results a:hover { background: var(--surface-2); text-decoration: none; }
.search-results span { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-results em { font-style: normal; color: var(--muted); font-size: 12px; }
.sr-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 4px; }
.sr-empty { padding: 12px; color: var(--muted); }
.topbar-right { margin-left: auto; color: var(--muted); font-size: 13px; text-transform: capitalize; white-space: nowrap; }
#page { flex: 1; transition: opacity .15s; }
#page.loading { opacity: .6; }
.page { padding: 24px 28px 48px; max-width: 1480px; animation: fade .18s ease-out; }
@keyframes fade { from { transform: translateY(3px); } to { transform: none; } }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; font-size: 13.5px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }

/* ------------------------------------------------------------ Cartes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-flat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 18px; }
.list-card { padding: 0; overflow: hidden; }
.count { font-style: normal; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--gris-bg); padding: 1px 8px; border-radius: 9px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 18px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 16px; color: var(--muted); text-align: center; }
.empty .ic { color: #b4bdcb; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin: 12px 0; }
.notice .ic { margin-top: 1px; }
.n-info { background: var(--bleu-bg); color: #174a94; }
.n-warn { background: var(--orange-bg); color: #7d4300; }

/* ------------------------------------------------------------ Vue d'ensemble */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 15px 13px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); transition: transform .12s, box-shadow .12s, border-color .12s; }
.kpi:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(15, 27, 45, .08); border-color: var(--border-strong); }
.kpi b { font-size: 26px; font-weight: 680; letter-spacing: -.02em; line-height: 1.1; }
.kpi-label { font-size: 12.5px; color: var(--text-2); font-weight: 540; padding-right: 30px; min-height: 36px; line-height: 1.4; }
.kpi-ico { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; }
.k-bleu .kpi-ico { background: var(--bleu-bg); color: var(--bleu); }
.k-gris .kpi-ico { background: var(--gris-bg); color: var(--gris); }
.k-orange .kpi-ico { background: var(--orange-bg); color: var(--orange); }
.k-rouge .kpi-ico { background: var(--rouge-bg); color: var(--rouge); }
.k-vert .kpi-ico { background: var(--vert-bg); color: var(--vert); }
.kpi.alert { border-color: #f3c2c0; } .kpi.alert b { color: var(--rouge); }
.priorities { border-top: 3px solid var(--primary); }
.prio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.prio-block { border: 1px solid var(--border); border-radius: 9px; padding: 12px 12px 8px; background: var(--surface-2); min-width: 0; }
.prio-block header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.prio-block h4 { font-size: 13px; flex: 1; }
.pb-ico { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; }
.pb-ico.c-orange { background: var(--orange-bg); } .pb-ico.c-rouge { background: var(--rouge-bg); } .pb-ico.c-bleu { background: var(--bleu-bg); }
.pb-count { font-weight: 700; font-size: 13px; min-width: 26px; text-align: center; padding: 1px 8px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); }
.prio-block ul { list-style: none; margin: 0; padding: 0; }
.prio-block li a { display: flex; flex-direction: column; gap: 1px; padding: 6px 6px; border-radius: 6px; color: var(--text); }
.prio-block li a:hover { background: var(--surface); text-decoration: none; }
.prio-block li b { font-size: 13px; font-weight: 600; }
.prio-block li span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prio-block li .miss { color: var(--orange); }
.prio-block li .badge, .prio-block li .age { align-self: flex-start; margin-top: 2px; }
.pb-empty { color: var(--muted); font-size: 12.5px; padding: 6px; }
.more { display: block; font-size: 12.5px; padding: 4px 6px; }
.hint-line { display: inline-flex; gap: 6px; align-items: center; margin-top: 12px; font-size: 13px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.feed li:last-child { border-bottom: 0; }
.feed small { color: var(--muted); font-size: 11.5px; }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex-shrink: 0; }
.feed-dot.auto { background: #8a6de0; }
.feed.full li { padding: 9px 0; }
.diff { display: flex; flex-direction: column; gap: 1px; margin-top: 3px; font-size: 12px; color: var(--text-2); }
.seg { display: inline-flex; background: var(--gris-bg); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button, .seg a, .seg label { border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 560; padding: 4px 11px; border-radius: 6px; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.seg .on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg a:hover { text-decoration: none; }
.seg.small { margin-bottom: 10px; }

/* Graphiques */
.chart { position: relative; min-height: 240px; }
.chart-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.chart-legend i, .tip i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.chart-box { position: relative; }
.chart svg { display: block; max-width: 100%; }
.chart .grid { stroke: #edf0f4; stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10.5px; }
.chart .cross { stroke: #c4ccd8; stroke-dasharray: 3 3; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: 8px; padding: 8px 10px; font-size: 12px; min-width: 150px; z-index: 5; }
.tip b { display: block; margin-bottom: 4px; }
.tip div { display: flex; align-items: center; gap: 4px; color: var(--text-2); }
.tip strong { margin-left: auto; color: var(--text); padding-left: 10px; }
.barlist { display: flex; flex-direction: column; gap: 4px; }
.barrow { display: grid; grid-template-columns: minmax(120px, 210px) 1fr 64px; align-items: center; gap: 12px; padding: 5px 6px; border-radius: 6px; color: var(--text); font-size: 13px; }
a.barrow:hover { background: var(--surface-2); text-decoration: none; }
.bl-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.bl-track { height: 10px; background: var(--gris-bg); border-radius: 5px; overflow: hidden; }
.bl-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--series-1); min-width: 3px; }
.bl-val { text-align: right; font-weight: 650; }
.bl-val small { color: var(--muted); font-weight: 450; margin-left: 6px; font-size: 11px; }

/* ------------------------------------------------------------ Tableaux */
.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar select { width: auto; min-width: 140px; max-width: 220px; height: 34px; padding: 5px 8px; }
.toolbar.more-filters { background: var(--surface-2); }
.card-flat.toolbar { border-bottom: 1px solid var(--border); }
.search-sm { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 9px; height: 34px; min-width: 240px; color: var(--muted); background: var(--surface); }
.search-sm.wide { flex: 1; max-width: 520px; }
.search-sm:focus-within { box-shadow: var(--focus); border-color: var(--primary); }
.search-sm input { border: 0; padding: 0; min-height: 0; height: 100%; box-shadow: none !important; }
.table-meta { padding: 8px 16px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; }
.table td { padding: 10px 12px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr[data-id] { cursor: pointer; }
.table tbody tr:hover { background: #f7f9fc; }
.table.compact td { padding: 6px 10px; }
.table.compact input, .table.compact select { min-height: 30px; padding: 4px 8px; }
.card > .table-wrap { margin: 0 -20px -18px; }
.card > .table-wrap .table th:first-child, .card > .table-wrap .table td:first-child { padding-left: 20px; }
.th-sort, th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sorted::after { content: ' ↓'; } th.sorted.asc::after { content: ' ↑'; }
.cell-2 b { display: block; font-weight: 600; } .cell-2 small { color: var(--muted); font-size: 12px; }
.next { font-size: 12.5px; }
.row-prolongee { background: #fffaf3; } .row-critique { background: #fff5f5; }
.legend-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: 38px; z-index: 15; min-width: 230px; max-height: 420px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px; }
.menu-title { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; padding: 4px 6px 6px; }
.menu .check { padding: 2px 6px; margin: 2px 0; font-size: 13px; }
.menu .btn { margin: 6px 4px 2px; }
.menu-item { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 2px 8px; border-radius: 6px; }
.menu-item:hover { background: var(--surface-2); }
.menu-item a { flex: 1; padding: 5px 0; color: var(--text); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.chip-f { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-2); font-size: 13px; font-weight: 540; }
.chip-f:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); }
.chip-f.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip-f em { font-style: normal; font-size: 11.5px; opacity: .8; }
.chip-select { width: auto; border-radius: 999px; height: 32px; min-height: 0; padding: 3px 10px; }

/* ------------------------------------------------------------ Fiche dossier */
.dossier-head { padding: 20px 22px 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 20px; }
.dh-title { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.dh-main h1 a { color: var(--text); }
.dh-main p { margin-top: 4px; font-size: 13.5px; }
.dh-actions { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.state-strip { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 16px -22px 0; border-top: 1px solid var(--border); }
.ss { display: flex; flex-direction: column; gap: 5px; padding: 12px 18px; border-right: 1px solid var(--border); min-width: 0; align-items: flex-start; }
.ss:last-child { border-right: 0; }
.ss > span:first-child { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ss small { color: var(--muted); font-size: 11.5px; }
.ss .progress { width: 100%; }
.ss.next b { font-size: 13.5px; color: var(--primary); }
.dossier-head .notice { grid-column: 1 / -1; margin: 0 -22px; border-radius: 0 0 var(--radius) var(--radius); }
.dossier-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.dossier-main { padding: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; }
.tabs button { border: 0; background: none; font: inherit; font-weight: 560; color: var(--text-2); padding: 13px 12px 11px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs em { font-style: normal; font-size: 11px; background: var(--gris-bg); color: var(--text-2); padding: 0 6px; border-radius: 8px; }
.tab-body { padding: 18px 20px 20px; }
.side-card { padding: 14px 16px; margin-bottom: 14px; }
.side-card .card-head { margin-bottom: 8px; }
.side-card h3 { display: flex; align-items: center; gap: 7px; }
.kv { display: grid; grid-template-columns: 118px 1fr; gap: 6px 10px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.other { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.other a { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.notes { font-size: 13px; }
#save-notes { margin-top: 8px; }
.notes-view { white-space: pre-wrap; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; margin-top: 10px; font-size: 13px; }
.comp-head { display: flex; align-items: center; gap: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 6px; flex-wrap: wrap; }
.comp-big { display: flex; align-items: center; gap: 10px; }
.comp-big b { font-size: 30px; font-weight: 700; letter-spacing: -.02em; color: var(--orange); }
.comp-big.ok b { color: var(--vert); }
.comp-big span { font-size: 13px; color: var(--text-2); max-width: 140px; }
.comp-missing { flex: 1; font-size: 13px; min-width: 240px; }
.comp-actions { display: flex; gap: 6px; }
.doclist { display: flex; flex-direction: column; }
.doc { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; padding: 12px 4px 12px 14px; border-bottom: 1px solid #eef1f5; border-left: 3px solid transparent; }
.doc.s-conforme { border-left-color: var(--vert); }
.doc.s-non_recu { border-left-color: #c8cfda; }
.doc.s-recu, .doc.s-a_verifier { border-left-color: #e48b0c; }
.doc.s-non_conforme, .doc.s-a_remplacer, .doc.s-expire { border-left-color: var(--rouge); }
.doc.is-na { opacity: .6; border-left-color: transparent; }
.doc-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.doc-info > small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.doc-info .reason { color: #5c6c86; }
.doc-info .doc-note { color: var(--orange); }
.files { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.file { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; flex-wrap: wrap; }
.file small { color: var(--muted); }
.file .icon-btn { width: 24px; height: 24px; }
.file.old { opacity: .75; }
details.old summary { font-size: 12px; color: var(--muted); cursor: pointer; }
.doc-ctrl { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.state-select { width: 156px; height: 32px; min-height: 0; padding: 4px 8px; font-weight: 560; font-size: 12.5px; }
.st-conforme { color: var(--vert); background: var(--vert-bg); border-color: #b9e1c7; }
.st-non_conforme, .st-a_remplacer, .st-expire { color: var(--rouge); background: var(--rouge-bg); border-color: #f2c0bd; }
.st-a_verifier, .st-recu { color: var(--orange); background: var(--orange-bg); border-color: #f2d4a8; }
.doc-btns { display: flex; gap: 2px; align-items: center; }
details.na { margin-top: 12px; }
details.na summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 6px 0; }
.preview { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: 8px; object-fit: contain; background: var(--surface-2); }
.ants-top { display: flex; gap: 18px; align-items: center; margin: 14px 0 18px; flex-wrap: wrap; }
.ants-age-card { display: flex; flex-direction: column; align-items: flex-start; padding: 14px 18px; border-radius: 10px; background: var(--gris-bg); min-width: 180px; }
.ants-age-card b { font-size: 34px; line-height: 1; font-weight: 700; }
.ants-age-card span { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.ants-age-card small { font-size: 12px; margin-top: 4px; color: var(--muted); }
.lv-normale { background: var(--vert-bg); } .lv-normale b { color: var(--vert); }
.lv-surveiller { background: var(--orange-bg); } .lv-surveiller b { color: var(--orange); }
.lv-prolongee { background: var(--rouge-bg); } .lv-prolongee b { color: var(--rouge); }
.lv-critique { background: var(--rouge); } .lv-critique b, .lv-critique span, .lv-critique small { color: #fff; }
.ants-kv { flex: 1 1 380px; min-width: 260px; grid-template-columns: 140px 1fr; }
.ants-form { border-top: 1px solid var(--border); padding-top: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 20px 0 10px; flex-wrap: wrap; }
.tab-body > .section-head:first-child { margin-top: 0; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; }
.timeline li { position: relative; display: flex; gap: 14px; padding: 0 0 16px; }
.timeline li::before { content: ''; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--primary); margin-top: 3px; flex-shrink: 0; }
.ev-refus .tl-dot, .ev-demande_complement .tl-dot { background: var(--rouge); box-shadow: 0 0 0 1px var(--rouge); }
.ev-edition_titre .tl-dot, .ev-validation .tl-dot, .ev-cloture .tl-dot { background: var(--vert); box-shadow: 0 0 0 1px var(--vert); }
.ev-verification .tl-dot { background: #b4bdcb; box-shadow: 0 0 0 1px #b4bdcb; }
.timeline li > div { position: relative; flex: 1; font-size: 13px; }
.timeline small { color: var(--muted); }
.timeline p { margin: 3px 0; color: var(--text-2); }
.tl-del { position: absolute; right: 0; top: -4px; }

/* Tâches */
.tasklist { list-style: none; margin: 0; padding: 0; }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 11px 6px; border-bottom: 1px solid #eef1f5; }
.task:last-child { border-bottom: 0; }
.tcheck { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; cursor: pointer; margin-top: 1px; flex-shrink: 0; color: #fff; padding: 0; }
.tcheck:hover { border-color: var(--vert); }
.task.done .tcheck { background: var(--vert); border-color: var(--vert); }
.task.done .ttitle b { text-decoration: line-through; color: var(--muted); }
.tcheck.ro { cursor: default; }
.tmain { flex: 1; min-width: 0; }
.ttitle { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ttitle b { font-weight: 600; }
.tmain small { color: var(--muted); font-size: 12.5px; }
.tmain p { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.tmeta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; white-space: nowrap; }
.task.overdue { background: linear-gradient(90deg, #fff5f5, transparent 60%); }
.buckets { padding: 4px 20px 12px; }
.bucket { margin-top: 14px; }
.bucket h3 { display: flex; align-items: center; gap: 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); padding-bottom: 4px; border-bottom: 2px solid var(--border); }
.bucket h3 em { font-style: normal; font-size: 11.5px; background: var(--gris-bg); padding: 0 7px; border-radius: 8px; }
.bucket.b-rouge h3 { color: var(--rouge); border-color: #f2c0bd; }
.bucket.b-bleu h3 { color: var(--bleu); border-color: #bcd3f5; }
.quick-dates { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }

/* Échanges */
.exlist { list-style: none; margin: 0; padding: 0; }
.exlist li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid #eef1f5; font-size: 13px; }
.exlist li:last-child { border-bottom: 0; }
.ex-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--gris-bg); color: var(--text-2); flex-shrink: 0; }
.exlist li.relance .ex-ico { background: var(--orange-bg); color: var(--orange); }
.ex-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ex-top small { color: var(--muted); margin-left: 4px; }
.exlist p { margin-top: 3px; color: var(--text-2); white-space: pre-wrap; }
.msg-actions { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 14px; }
.dot-rouge, .dot-bleu, .dot-gris { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-rouge { background: var(--rouge); } .dot-bleu { background: var(--primary); } .dot-gris { background: #b4bdcb; }
ul.simple { list-style: none; margin: 0; padding: 0; }
ul.simple li { padding: 7px 0; border-bottom: 1px solid #eef1f5; font-size: 13px; }
ul.simple li:last-child { border-bottom: 0; }
.files-list li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Statistiques */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat span { display: block; font-size: 12.5px; color: var(--text-2); font-weight: 540; }
.stat b { display: block; font-size: 26px; font-weight: 680; margin: 2px 0; letter-spacing: -.02em; }
.stat small { color: var(--muted); font-size: 11.5px; }
.delay span { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-2); font-weight: 560; }
.delay b { display: block; font-size: 24px; margin: 6px 0 4px; }
.delay b small { font-size: 12px; font-weight: 450; color: var(--muted); }
.delay > small { color: var(--muted); font-size: 12px; }

/* Paramètres */
.settings { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 76px; }
.settings-nav a { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 8px; color: var(--text-2); font-weight: 540; }
.settings-nav a:hover { background: var(--surface); text-decoration: none; }
.settings-nav a.on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.settings-body h2 { margin: 18px 0 8px; }
.settings-body h2:first-child { margin-top: 0; }
.settings-body h3 { margin: 18px 0 8px; }
.settings-body > p { margin-bottom: 12px; }
.settings-body details { margin: 10px 0; }
.settings-body details summary { cursor: pointer; font-weight: 560; padding: 6px 0; }
.rules { list-style: none; margin: 0 0 10px; padding: 0; }
.rules li { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid #eef1f5; }
.rules p { font-size: 13px; color: var(--text-2); margin: 2px 0; }
.switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; margin-top: 2px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cdd4de; border-radius: 11px; transition: background .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--vert); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:disabled + span { opacity: .6; cursor: default; }
.on-static { display: grid; place-items: center; background: var(--vert-bg); color: var(--vert); border-radius: 11px; }
.tpl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.tpl { border: 1px solid var(--border); border-radius: 9px; padding: 12px; background: var(--surface-2); }
.tpl.off { opacity: .55; }
.tpl-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.tpl pre { white-space: pre-wrap; font: 12.5px/1.5 inherit; font-family: inherit; margin: 0; color: var(--text-2); }
.roles-help { font-size: 13px; color: var(--text-2); padding-left: 18px; margin: 0 0 14px; }
.checks { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.checks li { display: flex; gap: 8px; padding: 5px 0; color: var(--text-2); }
.checks .ic { color: var(--vert); margin-top: 2px; }

/* ------------------------------------------------------------ Modales & toasts */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(15, 27, 45, .42); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; animation: fade .15s; }
.modal-wrap.out { opacity: 0; transition: opacity .15s; }
.modal { width: 100%; max-width: 520px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 860px; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal header h3 { font-size: 16px; }
.modal-body { padding: 18px 20px 6px; }
.modal-body > p { margin-bottom: 12px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.steps section { padding-bottom: 8px; margin-bottom: 14px; border-bottom: 1px dashed var(--border); }
.steps section:last-child { border-bottom: 0; }
.steps h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--primary); margin-bottom: 10px; }
.docs-preview { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; margin-bottom: 8px; }
.docs-preview ul { margin: 6px 0 0; padding-left: 18px; columns: 2; }
.docs-preview small { color: var(--muted); margin-left: 4px; }
.client-pick { margin-bottom: 10px; }
#client-results { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.pick { display: flex; gap: 10px; align-items: center; text-align: left; border: 1px solid var(--border); background: var(--surface); padding: 8px 10px; border-radius: 7px; cursor: pointer; font: inherit; }
.pick:hover { border-color: var(--primary); background: var(--primary-soft); }
.pick span { color: var(--muted); font-size: 12.5px; }
.chosen { display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: var(--vert-bg); border-radius: 8px; margin-top: 8px; flex-wrap: wrap; }
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 10px; background: #0f1b2d; color: #fff; padding: 11px 12px 11px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13px; animation: slide .2s ease-out; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .2s; }
.toast span { flex: 1; }
.toast .x { background: none; border: 0; color: #9fb0c8; cursor: pointer; padding: 2px; display: grid; }
.toast .btn { background: #fff; color: var(--text); border: 0; }
.t-err { background: #8f1d22; }
.t-auto { background: #3d2f7a; }
@keyframes slide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ Responsive (tablette) */
@media (max-width: 1280px) {
  .state-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ss:nth-child(3) { border-right: 0; }
  .ss:nth-child(n+4) { border-top: 1px solid var(--border); }
  .dossier-body { grid-template-columns: minmax(0, 1fr) 300px; }
  .form-grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  :root { --sidebar: 0px; }
  .sidebar { width: 264px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .page { padding: 18px 16px 40px; }
  .dossier-body, .grid-2, .grid-3, .settings { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .topbar-right { display: none; }
}
@media (max-width: 700px) {
  .form-grid, .form-grid.g3, .form-grid.g4, .form-grid.g2 { grid-template-columns: minmax(0, 1fr); }
  .state-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ss { border-right: 0 !important; border-top: 1px solid var(--border); }
  .dossier-head { grid-template-columns: 1fr; }
  .dh-actions { justify-content: flex-start; }
  .doc { grid-template-columns: 1fr; }
  .doc-ctrl { align-items: flex-start; }
  .barrow { grid-template-columns: 110px 1fr 54px; }
  .search kbd { display: none; }
  .docs-preview ul { columns: 1; }
  .search-sm { min-width: 0; flex: 1; }
}
.bl-fill.f-vert { background: var(--vert); } .bl-fill.f-bleu { background: var(--primary); } .bl-fill.f-orange { background: #e48b0c; }
.bl-fill.f-gris { background: #9aa5b6; } .bl-fill.f-rouge { background: var(--rouge); }
.table td.c-number, .table td.c-plate, .table td.c-received, .table td.c-ants_sent, .table td.c-ants_age, .table td.c-ants_request,
.table td.c-ants_check, .table td.c-status, .table td.c-payment, .table td.c-completeness, .cell-2 small, .cell-2 b { white-space: nowrap; }
.table td.c-procedure { min-width: 150px; }
.table td.c-next_action { min-width: 170px; }
.toolbar .search-sm { min-width: 210px; }
.table .mono, .table .plate { white-space: nowrap; }
.tag-blue { color: var(--bleu); background: var(--bleu-bg); }
.plate-total { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; margin: 2px 0 6px; font-size: 13px; }
.plate-total b { font-size: 18px; }
h3.sub { margin: 18px 0 10px; }
.hours-warn { margin-top: 0; }

/* Accueil employés */
.home-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.home-head h1 { font-size: 24px; }
.home-head p { margin-top: 4px; text-transform: none; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.worklist { padding: 0; overflow: hidden; }
.wl-tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--border); }
.wl-tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; font: inherit; font-weight: 560; color: var(--text-2); padding: 10px 9px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.wl-tabs button em { font-style: normal; font-size: 11.5px; background: var(--gris-bg); padding: 0 7px; border-radius: 9px; }
.wl-tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.wl-tabs button.on em { background: var(--primary-soft); color: var(--primary); }
.wl-tabs button:disabled { opacity: .45; cursor: default; }
.wl { list-style: none; margin: 0; padding: 0; }
.wl-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 11px 16px; border-bottom: 1px solid #eef1f5; border-left: 3px solid transparent; transition: background .1s, opacity .25s; }
.wl-item:hover { background: #f8fafc; }
.wl-item.late { border-left-color: var(--rouge); }
.wl-item.done-out { opacity: 0; }
.wl-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--gris-bg); color: var(--text-2); }
.k-relance .wl-ico { background: var(--orange-bg); color: var(--orange); }
.k-piece .wl-ico { background: var(--bleu-bg); color: var(--bleu); }
.k-ants .wl-ico { background: #eef0fb; color: #3b4fb8; }
.k-blocage .wl-ico { background: var(--rouge-bg); color: var(--rouge); }
.k-tache .wl-ico { background: var(--vert-bg); color: var(--vert); }
.wl-main { display: flex; flex-direction: column; min-width: 0; color: var(--text); }
.wl-main:hover { text-decoration: none; }
.wl-main b { font-weight: 600; }
.wl-main span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-due { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12px; }
.wl-empty { list-style: none; }
.msg-mini, .recent { list-style: none; margin: 0 0 10px; padding: 0; }
.msg-mini a, .recent a { display: flex; flex-direction: column; gap: 1px; padding: 8px 6px; border-radius: 7px; color: var(--text); font-size: 13px; }
.recent a { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; }
.recent a > div { display: flex; flex-direction: column; min-width: 0; }
.msg-mini a:hover, .recent a:hover { background: var(--surface-2); text-decoration: none; }
.msg-mini span, .recent span { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-mini small { color: var(--muted); font-size: 11px; }
.side-card h3 .cnt { margin-left: 4px; }

/* Messagerie */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); padding: 0; min-height: 560px; overflow: hidden; }
.threads { list-style: none; margin: 0; padding: 0; border-right: 1px solid var(--border); overflow-y: auto; max-height: 72vh; }
.threads li a { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 12px 16px; border-bottom: 1px solid #eef1f5; color: var(--text); }
.threads li a:hover { background: var(--surface-2); text-decoration: none; }
.threads li.on a { background: var(--primary-soft); }
.threads li.unread b { font-weight: 700; }
.threads li.closed a { opacity: .6; }
.th-top { display: flex; justify-content: space-between; gap: 8px; }
.th-top small { color: var(--muted); white-space: nowrap; }
.threads span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.threads em { font-style: normal; }
.dot-new { position: absolute; left: 6px; top: 18px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.conv { display: flex; flex-direction: column; min-width: 0; }
.conv-empty { margin: auto; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.conv-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.bubbles { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; max-height: 56vh; }
.bubble { display: flex; gap: 10px; max-width: 80%; }
.bubble > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; }
.bubble.me { align-self: flex-end; flex-direction: row-reverse; }
.bubble.me > div { background: var(--primary-soft); border-color: #cfe0f8; }
.b-head { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; }
.b-head small { color: var(--muted); }
.bubble p { white-space: pre-wrap; margin-top: 3px; font-size: 13.5px; }
.reply { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); align-items: flex-end; }
.recipients { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check { border: 1px solid var(--border-strong); border-radius: 999px; padding: 4px 10px; margin: 0; font-size: 13px; }

/* Fichiers importés, indicateur traité */
.import-box { background: #fffaf0; border: 1px dashed #efcf98; border-radius: 9px; padding: 4px 14px 10px; margin: 10px 0 14px; }
.import-box .section-head { margin: 8px 0 4px; }
.imp-group { padding: 4px 0; }
.imp-file { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; flex-wrap: wrap; }
.imp-file select { width: auto; min-width: 200px; height: 28px; min-height: 0; padding: 2px 6px; font-size: 12.5px; }
.treated { color: var(--vert); font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }
@media (max-width: 1080px) { .home-grid, .inbox { grid-template-columns: minmax(0, 1fr); } .threads { max-height: 280px; border-right: 0; border-bottom: 1px solid var(--border); } }
@media (max-width: 700px) { .wl-item { grid-template-columns: 30px minmax(0, 1fr); } .wl-due, .wl-item .btn { grid-column: 2; justify-self: start; } }
