/* VEKA CRM · charte graphique (guide d'octobre 2026) : jetons clair / nuit, DM Sans, DM Mono */
@font-face { font-family: 'DM Sans'; src: url(/fonts/DMSans-400.ttf) format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url(/fonts/DMSans-500.ttf) format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url(/fonts/DMSans-600.ttf) format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'DM Mono'; src: url(/fonts/DMMono-400.ttf) format('truetype'); font-weight: 400; font-display: swap; }

:root, [data-theme="clair"] {
  --marine: #030973; --bleu: #1E90FF;
  --fond: #F6F7FB; --surface: #FFFFFF; --surface-2: #EEF1F7; --selection: #EAF3FF;
  --bordure: #E2E6EF; --bordure-champ: #787E99;
  --texte: #13163A; --texte-2: #525874; --texte-3: #646A88; --titre: #030973; --lien: #0B6BD0;
  --primaire: #030973; --primaire-survol: #1A2499; --sur-primaire: #FFFFFF; --focus: #0B6BD0;
  --succes: #0D7A55; --succes-doux: #E2F4EC; --alerte: #9A5B00; --alerte-doux: #FFF1D6; --danger: #C0341D; --danger-doux: #FDEBE7;
  --graphe-1: #1E90FF; --graphe-2: #030973; --graphe-3: #9CCBFF;
  --ombre-flottante: 0 4px 16px rgba(3, 9, 115, 0.10), 0 1px 3px rgba(3, 9, 115, 0.08);
  --voile: rgba(3, 9, 115, .28);
  color-scheme: light;
}
[data-theme="nuit"] {
  --fond: #080B26; --surface: #0F1335; --surface-2: #171C47; --selection: #16245F;
  --bordure: #262C5E; --bordure-champ: #6A719C;
  --texte: #ECEEF8; --texte-2: #B0B5D3; --texte-3: #8C92B8; --titre: #FFFFFF; --lien: #6CB4FF;
  --primaire: #1E90FF; --primaire-survol: #4AA6FF; --sur-primaire: #030973; --focus: #6CB4FF;
  --succes: #4FD1A0; --succes-doux: #0F2E2F; --alerte: #F5B94A; --alerte-doux: #2E2414; --danger: #FF8A73; --danger-doux: #3A1A22;
  --graphe-2: #B0C4FF; --graphe-3: #3B4A8F;
  --ombre-flottante: 0 4px 16px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.35);
  --voile: rgba(0, 0, 0, .55);
  color-scheme: dark;
}
:root {
  --espace-1: 4px; --espace-2: 8px; --espace-3: 12px; --espace-4: 16px; --espace-5: 20px; --espace-6: 24px; --espace-8: 32px; --espace-12: 48px;
  --rayon-s: 4px; --rayon-m: 8px; --rayon-rond: 999px;
  --hauteur-controle: 36px; --hauteur-controle-s: 28px; --hauteur-ligne: 48px; --largeur-nav: 240px;
  --police: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --police-mono: 'DM Mono', ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 400 14px/20px var(--police); color: var(--texte); background: var(--fond); -webkit-font-smoothing: antialiased; }
a { color: var(--lien); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--titre); margin: 0; font-weight: 600; }
h1 { font-size: 28px; line-height: 36px; letter-spacing: -0.01em; }
h2 { font-size: 20px; line-height: 28px; }
h3 { font-size: 16px; line-height: 24px; margin: var(--espace-5) 0 var(--espace-3); }
.card h3:first-child, .card-head h3 { margin-top: 0; }
.etiquette, .table th { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--texte-3); }
b, strong { font-weight: 600; }
button { font: inherit; cursor: pointer; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[disabled], .disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--texte); border: 1px solid var(--bordure-champ); border-radius: var(--rayon-s); padding: 7px 10px; background: var(--surface); width: 100%; min-width: 0; min-height: var(--hauteur-controle); }
textarea { line-height: 20px; }
input::placeholder, textarea::placeholder { color: var(--texte-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.muted { color: var(--texte-3); } .small { font-size: 13px; line-height: 18px; } .block { display: block; }
.pre { white-space: pre-wrap; margin: 0; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.num, .tab { font-variant-numeric: tabular-nums; }
.link { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--lien); }
.loading { padding: 40px 20px; text-align: center; color: var(--texte-3); }
.empty { padding: var(--espace-5); color: var(--texte-2); background: var(--surface); border: 1px dashed var(--bordure); border-radius: var(--rayon-m); }
.txt-urgent { color: var(--danger); }
.ok { color: var(--succes); font-weight: 500; }
.warn { color: var(--alerte); font-weight: 500; }
.nowrap { white-space: nowrap; }
.ico { display: inline-block; vertical-align: -3px; flex: none; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--espace-2); height: var(--hauteur-controle); padding: 0 14px;
  border: 1px solid var(--bordure-champ); background: var(--surface); color: var(--texte); border-radius: var(--rayon-s);
  font-weight: 500; white-space: nowrap; transition: background-color 120ms, border-color 120ms, color 120ms; text-decoration: none; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--primaire); border-color: var(--primaire); color: var(--sur-primaire); }
.btn.primary:hover { background: var(--primaire-survol); border-color: var(--primaire-survol); }
.btn.ghost { border-color: var(--bordure-champ); background: var(--surface); }
.btn.discret { border-color: transparent; background: transparent; color: var(--lien); padding: 0 8px; }
.btn.discret:hover { background: var(--surface-2); }
.btn.danger-ghost { background: transparent; color: var(--danger); border-color: transparent; margin-right: auto; }
.btn.danger-ghost:hover { background: var(--danger-doux); }
.btn.small { height: var(--hauteur-controle-s); padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.busy { opacity: .6; pointer-events: none; }
.icon-btn { display: inline-grid; place-items: center; width: var(--hauteur-controle); height: var(--hauteur-controle); border: 0; background: transparent; color: var(--texte-2); border-radius: var(--rayon-s); }
.icon-btn:hover { background: var(--surface-2); color: var(--titre); }

/* Badges : toujours un mot, la couleur confirme ; pastille avant le mot */
.badge { display: inline-flex; align-items: center; gap: var(--espace-1); height: 20px; padding: 0 8px; border-radius: var(--rayon-s); font-size: 12px; line-height: 16px; font-weight: 500; white-space: nowrap;
  background: var(--surface-2); color: var(--texte-2); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: var(--rayon-rond); background: currentColor; flex: none; }
.badge.nodot::before { display: none; }
.urg-retard, .t-danger, .prod-danger, .q-mauvais, .dep-late { background: var(--danger-doux); color: var(--danger); }
.urg-urgent, .t-alerte, .is-en_cours, .q-moyen, .dep { background: var(--alerte-doux); color: var(--alerte); }
.urg-proche, .t-info, .is-planifiee, .prod-en_cours, .st-BAT_VEKA, .st-BAT_CLIENT { background: var(--selection); color: var(--lien); }
.t-succes, .is-terminee, .prod-fait, .q-bon { background: var(--succes-doux); color: var(--succes); }
.t-neutre, .prod-a_faire, .is-annulee { background: var(--surface-2); color: var(--texte-2); }
/* Catégorie reprise de l'ancien planning : pastille de sa couleur */
.badge.cat { background: var(--surface-2); color: var(--texte-2); }
.badge.cat::before { display: block; background: var(--cat); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px 0 4px; border-radius: var(--rayon-rond); background: var(--surface-2); font-size: 13px; color: var(--texte-2); }
.chip:not(:has(.avatar)) { padding-left: 10px; }
a.chip:hover { text-decoration: none; background: var(--selection); }
.ref { font: 400 13px/18px var(--police-mono); color: var(--texte-2); }
.mat { display: inline-block; font-size: 12px; line-height: 16px; padding: 2px 6px; border-radius: var(--rayon-s); background: var(--surface-2); color: var(--texte-2); }
.avatar { display: inline-grid; place-items: center; border-radius: var(--rayon-rond); background: var(--selection); color: var(--titre); font-weight: 600; flex: none; letter-spacing: .02em; }
.avatars { display: flex; gap: 4px; margin-top: 4px; } .avatars.wide { flex-wrap: wrap; gap: 6px; margin: 0; }
.meta { display: flex; align-items: center; gap: var(--espace-1); font-size: 13px; line-height: 18px; color: var(--texte-3); }
.meta.danger { color: var(--danger); } .meta.alerte { color: var(--alerte); }

/* Connexion */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--fond); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon-m); padding: var(--espace-8) var(--espace-6); display: grid; gap: var(--espace-4); }
.login-card img { width: 200px; margin: 0 auto; }
[data-theme="nuit"] .login-card .logo-clair, :root:not([data-theme="nuit"]) .login-card .logo-nuit { display: none; }
.tagline { text-align: center; margin: -8px 0 8px; color: var(--texte-3); font-size: 13px; }

/* Structure */
.shell { display: grid; grid-template-columns: var(--largeur-nav) 1fr; min-height: 100%; }
.side { background: var(--surface); border-right: 1px solid var(--bordure); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: var(--espace-5) var(--espace-3); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: var(--espace-2); padding: 0 var(--espace-3) var(--espace-6); color: var(--titre); }
.brand:hover { text-decoration: none; }
.brand .logo-clair { width: 150px; }
.brand .logo-nuit { display: none; height: 28px; }
.brand .nom-produit { display: none; font-size: 16px; line-height: 24px; font-weight: 600; }
[data-theme="nuit"] .brand .logo-clair { display: none; }
[data-theme="nuit"] .brand .logo-nuit, [data-theme="nuit"] .brand .nom-produit { display: block; }
.side nav { display: grid; gap: 2px; }
.nav-group { margin: var(--espace-4) var(--espace-3) var(--espace-1); }
.nav-group:first-child { margin-top: 0; }
.side nav a { display: flex; align-items: center; gap: var(--espace-3); color: var(--texte-2); height: var(--hauteur-controle); padding: 0 var(--espace-3); border-radius: var(--rayon-s); font-weight: 500; transition: background-color 120ms; }
.side nav a:hover { background: var(--surface-2); text-decoration: none; }
.side nav a.active { background: var(--selection); color: var(--titre); }
.side nav a.active .ico { color: var(--bleu); }
.side nav a .count-nav { margin-left: auto; font-size: 12px; font-weight: 500; background: var(--surface-2); border-radius: var(--rayon-rond); padding: 0 7px; color: var(--texte-2); }
.side-user { margin-top: auto; display: flex; gap: var(--espace-3); align-items: center; padding: var(--espace-3); border-radius: var(--rayon-m); cursor: pointer; position: relative; border-top: 1px solid var(--bordure); }
.side-user:hover { background: var(--surface-2); }
.side-user b { display: block; color: var(--texte); font-weight: 500; }
.side-user small { display: block; color: var(--texte-3); font-size: 13px; }
.user-menu { position: absolute; bottom: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon-m); box-shadow: var(--ombre-flottante); padding: 6px; display: grid; z-index: 5; }
.user-menu button, .mobile-menu button, .mobile-menu a { display: flex; align-items: center; gap: var(--espace-2); text-align: left; border: 0; background: none; height: var(--hauteur-controle); padding: 0 10px; border-radius: var(--rayon-s); color: var(--texte); font-weight: 500; }
.user-menu button:hover, .mobile-menu button:hover, .mobile-menu a:hover { background: var(--surface-2); text-decoration: none; }
.main { min-width: 0; }
.page { padding: var(--espace-6); max-width: 1328px; }
.page.wide-page { max-width: none; }
@media (min-width: 1441px) { .page { padding: var(--espace-8) var(--espace-12); max-width: calc(1280px + 2 * var(--espace-12)); } .page.wide-page { max-width: none; } }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--espace-4); margin-bottom: var(--espace-6); flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--texte-2); }
.head-actions { display: flex; gap: var(--espace-2); align-items: center; flex-wrap: wrap; }
.head-meta { display: flex; flex-wrap: wrap; gap: var(--espace-2); align-items: center; margin-top: var(--espace-2); }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; margin-bottom: var(--espace-2); }
.bottom-nav, .mobile-menu { display: none; }

/* Cartes : surface + bordure, pas d'ombre */
.card { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon-m); padding: var(--espace-5); margin-bottom: var(--espace-6); }
.card.flush { padding: 0; overflow: auto; }
.card.full { grid-column: 1 / -1; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: var(--espace-3); margin-bottom: var(--espace-4); flex-wrap: wrap; }
.card-head h3 { display: flex; align-items: center; gap: var(--espace-2); }
.card-head h3 .ico { color: var(--texte-3); }
.cards-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--espace-6); align-items: start; }
.cards-2 > .card { margin: 0; }
.cards-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--espace-6); align-items: start; }
dl { display: grid; grid-template-columns: 170px 1fr; gap: var(--espace-2) var(--espace-3); margin: 0; }
dt { color: var(--texte-2); } dd { margin: 0; }
.inline-select { width: auto; min-height: var(--hauteur-controle-s); padding: 2px 8px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--espace-6); margin-bottom: var(--espace-6); }
.kpi { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon-m); padding: var(--espace-5); color: var(--texte); display: grid; gap: var(--espace-1); }
a.kpi:hover { background: var(--surface-2); text-decoration: none; }
.kpi > span { font-size: 13px; color: var(--texte-2); font-weight: 500; display: flex; align-items: center; gap: var(--espace-2); }
.kpi > b { font-size: 32px; line-height: 40px; font-weight: 600; letter-spacing: -0.02em; color: var(--titre); font-variant-numeric: tabular-nums; }
.kpi > small { font-size: 13px; color: var(--texte-3); }
.kpi.hot > b { color: var(--danger); }
.kpi-detail { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--texte-2); }
.kpi-detail b { color: var(--titre); font-variant-numeric: tabular-nums; }

/* Listes */
.list { display: grid; gap: var(--espace-2); }
.list-row { display: flex; align-items: center; gap: var(--espace-3); padding: var(--espace-3); border-radius: var(--rayon-m); border: 1px solid var(--bordure); background: var(--surface); color: var(--texte); text-align: left; width: 100%; transition: background-color 120ms; }
.list-row:hover { background: var(--surface-2); text-decoration: none; }
.list-row b { color: var(--texte); font-weight: 500; }
.date-box { display: grid; place-items: center; min-width: 48px; padding: 4px; border-radius: var(--rayon-s); background: var(--selection); color: var(--titre); line-height: 1.1; font-variant-numeric: tabular-nums; }
.date-box b { font-size: 16px; font-weight: 600; } .date-box small { font-size: 12px; font-weight: 500; }
.date-box.big { min-width: 60px; } .date-box.big b { font-size: 20px; }

/* Tableaux */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 0 var(--espace-3); height: 40px; background: var(--surface-2); border-bottom: 1px solid var(--bordure); white-space: nowrap; }
.table td { padding: var(--espace-3); height: var(--hauteur-ligne); border-bottom: 1px solid var(--bordure); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.clickable { cursor: pointer; } .table tr.clickable:hover td { background: var(--surface-2); }
.table tr.off td { opacity: .45; }
.table.compact td { padding: 4px; height: auto; }
.card:not(.flush) > .table th:first-child { border-top-left-radius: var(--rayon-s); }
.cell-input { border-color: transparent; } .cell-input:hover { border-color: var(--bordure-champ); }

/* Filtres */
.filters { display: flex; flex-wrap: wrap; gap: var(--espace-2); align-items: center; margin-bottom: var(--espace-4); }
.filters > select { width: auto; }
.search-wrap { position: relative; flex: 0 1 380px; min-width: 200px; }
.search-wrap .ico { position: absolute; left: 10px; top: 10px; color: var(--texte-3); pointer-events: none; }
.search-wrap input { padding-left: 34px; }
.toggle { display: inline-flex; gap: var(--espace-2); align-items: center; font-size: 14px; color: var(--texte-2); cursor: pointer; padding: 0 6px; white-space: nowrap; }
.toggle input { width: 16px; height: 16px; min-height: 0; accent-color: var(--primaire); }
.seg { display: inline-flex; max-width: 100%; overflow-x: auto; background: var(--surface); border: 1px solid var(--bordure-champ); border-radius: var(--rayon-s); padding: 2px; gap: 2px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 3px; font-weight: 500; color: var(--texte-2); white-space: nowrap; transition: background-color 120ms; }
.seg button:hover { background: var(--surface-2); }
.seg button.active { background: var(--selection); color: var(--titre); box-shadow: inset 0 -2px 0 var(--bleu); }
.seg.small button { height: 24px; padding: 0 9px; font-size: 13px; }
.seg button.active.s-en_cours { background: var(--selection); color: var(--lien); box-shadow: none; }
.seg button.active.s-fait { background: var(--succes-doux); color: var(--succes); box-shadow: none; }

/* Pipeline (kanban) */
.status-counts { display: flex; gap: var(--espace-2); overflow-x: auto; margin-bottom: var(--espace-4); padding-bottom: 2px; }
.sc { flex: none; display: flex; align-items: center; gap: var(--espace-2); border: 1px solid var(--bordure); background: var(--surface); border-radius: var(--rayon-s); height: var(--hauteur-controle-s); padding: 0 10px; transition: background-color 120ms; }
.sc:hover { background: var(--surface-2); }
.sc span { font-size: 13px; color: var(--texte-2); }
.sc b { font-weight: 600; color: var(--titre); font-variant-numeric: tabular-nums; }
.sc.off { opacity: .45; }
.board { display: grid; grid-template-columns: repeat(var(--cols, 9), minmax(248px, 1fr)); gap: var(--espace-4); overflow-x: auto; padding-bottom: var(--espace-3); align-items: start; }
.col { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon-m); min-height: 200px; transition: background-color 120ms; }
.col.over { background: var(--selection); outline: 2px dashed var(--bleu); outline-offset: -2px; }
.col header { display: flex; justify-content: space-between; align-items: flex-start; padding: var(--espace-3) var(--espace-3) var(--espace-2); }
.col header b { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--texte-3); }
.col header small { display: block; font-size: 13px; color: var(--texte-3); }
.count { background: var(--surface-2); border-radius: var(--rayon-rond); padding: 0 8px; font-weight: 500; font-size: 12px; color: var(--texte-2); font-variant-numeric: tabular-nums; }
.col-total { padding: 0 var(--espace-3) var(--espace-2); font-size: 13px; font-weight: 500; color: var(--titre); font-variant-numeric: tabular-nums; }
.col-body { display: grid; gap: var(--espace-2); padding: 0 var(--espace-2) var(--espace-3); }
.kcard { display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon-m); padding: var(--espace-3) var(--espace-4); color: var(--texte); cursor: grab; transition: background-color 120ms, border-color 120ms; }
.kcard:hover { border-color: var(--bordure-champ); text-decoration: none; }
.kcard:active { box-shadow: var(--ombre-flottante); }
.kcard-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.kcard-title { font-size: 14px; font-weight: 500; color: var(--texte); }
.kcard-sub { font-size: 13px; line-height: 18px; color: var(--lien); }
.mats { display: flex; flex-wrap: wrap; gap: 4px; }
.kcard-foot { display: flex; align-items: center; gap: var(--espace-2); font-size: 13px; padding-top: 6px; border-top: 1px solid var(--bordure); margin-top: 2px; }
.kcard-date { color: var(--texte-2); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kcard-date.danger { color: var(--danger); }
.amount { margin-left: auto; font-weight: 600; color: var(--titre); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kmove { margin-left: auto; display: inline-grid; place-items: center; border: 1px solid var(--bordure-champ); background: var(--surface); border-radius: var(--rayon-s); width: 28px; height: 28px; color: var(--texte-2); flex: none; }
.amount + .kmove { margin-left: 0; }
.kmove:hover { background: var(--primaire); color: var(--sur-primaire); border-color: var(--primaire); }
.progress { display: grid; gap: 4px; }
.progress .bar { height: 6px; background: var(--surface-2); border-radius: var(--rayon-rond); overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--bleu); border-radius: var(--rayon-rond); }
.progress small { font-size: 12px; color: var(--texte-3); font-variant-numeric: tabular-nums; }
.add-card { border: 1px dashed var(--bordure-champ); background: transparent; border-radius: var(--rayon-m); height: var(--hauteur-controle); color: var(--lien); font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.add-card:hover { background: var(--surface-2); }

/* Fiche affaire : étapes en chevrons */
.stepper { display: flex; gap: 2px; margin-bottom: var(--espace-6); overflow-x: auto; }
.step { flex: 1 0 96px; border: 0; height: 36px; padding: 0 18px; font-size: 13px; font-weight: 500; color: var(--texte-2); background: var(--surface-2); white-space: nowrap;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); transition: background-color 120ms; }
.step:disabled:not(.current) { cursor: not-allowed; opacity: .55; }
.step:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: var(--rayon-s) 0 0 var(--rayon-s); }
.step:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 10px 50%); border-radius: 0 var(--rayon-s) var(--rayon-s) 0; }
.step.done { background: var(--selection); color: var(--titre); }
.step.current { background: var(--bleu); color: var(--marine); font-weight: 600; }
.step:hover:not(.current) { background: var(--selection); color: var(--titre); }
.tabs { display: flex; gap: var(--espace-1); margin-bottom: var(--espace-6); border-bottom: 1px solid var(--bordure); overflow-x: auto; }
.tabs button { border: 0; background: none; height: 40px; padding: 0 var(--espace-3); font-weight: 500; color: var(--texte-2); box-shadow: inset 0 -2px 0 transparent; white-space: nowrap; }
.tabs button:hover { color: var(--titre); }
.tabs button.active { color: var(--titre); box-shadow: inset 0 -2px 0 var(--bleu); }
.tabs em { font-style: normal; background: var(--surface-2); border-radius: var(--rayon-rond); padding: 0 7px; margin-left: 6px; font-size: 12px; font-variant-numeric: tabular-nums; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; }
.timeline li { display: grid; grid-template-columns: 12px 1fr; gap: var(--espace-3); padding: var(--espace-2) 0; position: relative; }
.timeline li > span { width: 10px; height: 10px; border-radius: var(--rayon-rond); background: var(--selection); border: 2px solid var(--bleu); margin-top: 5px; }
.timeline .tl-title { color: var(--texte); }
.timeline .tl-meta { font-size: 13px; color: var(--texte-3); }
.survey-block { border-top: 1px solid var(--bordure); padding-top: var(--espace-4); margin-top: var(--espace-4); }
.survey-block:first-of-type { border: 0; margin: 0; padding: 0; }
.print-head { display: flex; gap: var(--espace-5); align-items: center; margin-bottom: var(--espace-4); }
.print-head img { width: 150px; } .print-head p { margin: 2px 0; }
.print-head .no-print { margin-left: auto; display: flex; gap: var(--espace-2); }

/* Fabrication */
.mat-summary { display: flex; gap: var(--espace-3); overflow-x: auto; padding-bottom: 4px; margin-bottom: var(--espace-5); }
.mat-tile { flex: none; min-width: 170px; text-align: left; border: 1px solid var(--bordure); background: var(--surface); border-radius: var(--rayon-m); padding: var(--espace-3) var(--espace-4); display: grid; gap: 2px; transition: background-color 120ms; }
.mat-tile:hover { background: var(--surface-2); }
.mat-tile b { color: var(--titre); font-weight: 500; } .mat-tile span { font-size: 13px; color: var(--texte-2); font-variant-numeric: tabular-nums; }
.mat-tile em { font-style: normal; font-size: 12px; font-weight: 500; color: var(--danger); display: flex; align-items: center; gap: 4px; }
.prod-group { margin-bottom: var(--espace-8); }
.prod-group h2 { margin-bottom: var(--espace-3); font-size: 16px; line-height: 24px; display: flex; align-items: center; gap: var(--espace-2); }
.prod-group h2 small { font-size: 13px; font-weight: 400; color: var(--texte-3); }
.prod-list { display: grid; gap: var(--espace-2); }
.prod-row { display: grid; grid-template-columns: 1fr auto; gap: var(--espace-3); align-items: center; background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon-m); padding: var(--espace-3) var(--espace-4); }
.prod-row.st-fait { opacity: .6; }
.prod-top { display: flex; flex-wrap: wrap; gap: var(--espace-2); align-items: center; font-size: 13px; color: var(--texte-2); }
.prod-top b { color: var(--texte); font-weight: 500; font-size: 14px; }
.prod-desc { display: flex; flex-wrap: wrap; gap: var(--espace-3); align-items: center; margin-top: 4px; font-variant-numeric: tabular-nums; }
.prod-desc b { color: var(--titre); font-weight: 600; }
.machine-select { min-height: var(--hauteur-controle); }

/* Planning des poses */
.week-grid { display: grid; background: var(--bordure); gap: 1px; border: 1px solid var(--bordure); border-radius: var(--rayon-m); overflow: auto; }
.week-grid > div { background: var(--surface); }
.wg-corner { background: var(--surface-2) !important; padding: var(--espace-3); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--texte-3); display: flex; align-items: end; position: sticky; left: 0; z-index: 2; }
.wg-day { padding: var(--espace-3); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--texte-3); text-align: center; background: var(--surface-2) !important; }
.wg-day.today { color: var(--titre); box-shadow: inset 0 -2px 0 var(--bleu); }
.wg-row-head { display: flex; align-items: center; gap: var(--espace-2); padding: var(--espace-3); position: sticky; left: 0; z-index: 1; }
.wg-row-head b { font-weight: 500; }
.wg-row-head small { display: block; color: var(--texte-3); font-size: 12px; }
.wg-cell { min-height: 76px; padding: 6px; display: grid; gap: 4px; align-content: start; }
.wg-cell.today { background: var(--selection) !important; }
/* Glisser-déposer et vue jour */
button.wg-day { border: 0; font-family: inherit; cursor: pointer; }
button.wg-day:hover { color: var(--titre); }
.wg-cell.over, .mg-cell.over { background: var(--selection) !important; box-shadow: inset 0 0 0 2px var(--bleu); }
.pblock[draggable="true"] { cursor: grab; }
.week-grid.one-day .pblock b { white-space: normal; }
.first-up::first-letter { text-transform: uppercase; }

/* Calendrier lisible : en-tête, légende, blocs teintés par catégorie */
.plan-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--espace-3); margin-bottom: var(--espace-4); }
.plan-nav { display: flex; align-items: center; gap: var(--espace-2); flex-wrap: wrap; min-width: 0; }
.plan-title { margin: 0 0 0 var(--espace-2); font-size: 24px; line-height: 32px; }
.plan-count { font-size: 14px; }
.plan-actions { display: flex; flex-wrap: wrap; gap: var(--espace-2); align-items: center; }
.plan-filters { display: flex; flex-wrap: wrap; gap: var(--espace-3); align-items: center; margin-bottom: var(--espace-3); }
.btn.icon-only { width: var(--hauteur-controle); padding: 0; justify-content: center; }
.cat-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--rayon-rond); border: 1px solid var(--bordure); background: var(--surface); color: var(--texte-2); font: inherit; font-size: 13px; cursor: pointer; transition: opacity 120ms, background-color 120ms; }
.cat-chip::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--cat); flex: none; }
.cat-chip:hover { background: var(--surface-2); }
.cat-chip.on { border-color: var(--cat); background: color-mix(in srgb, var(--cat) 14%, var(--surface)); color: var(--titre); font-weight: 500; }
.cat-chip.dim { opacity: .55; }
.hint { margin: var(--espace-2) 0 var(--espace-3); }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--lien); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.wg-day { display: flex; align-items: baseline; justify-content: center; gap: 6px; }
.wg-day b { font-size: 18px; font-weight: 600; letter-spacing: 0; color: var(--texte); }
.wg-day.today b { color: var(--sur-primaire); background: var(--primaire); border-radius: var(--rayon-rond); padding: 0 7px; }
.wg-row-head { background: var(--surface) !important; }
.veh-ico { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: var(--texte-2); display: grid; place-items: center; flex: none; }
.wg-empty { padding: var(--espace-6); text-align: center; color: var(--texte-3); }
.wg-cell.has-conflict { box-shadow: inset 0 0 0 2px var(--danger); }

.pblock { --cat: var(--bleu); text-align: left; width: 100%; border: 1px solid color-mix(in srgb, var(--cat) 30%, var(--bordure)); border-left: 4px solid var(--cat); background: color-mix(in srgb, var(--cat) 10%, var(--surface)); border-radius: var(--rayon-s); padding: 6px 8px; display: grid; gap: 2px; color: var(--texte); font: inherit; cursor: pointer; transition: background-color 120ms, box-shadow 120ms; min-width: 0; }
.pblock:hover { background: color-mix(in srgb, var(--cat) 18%, var(--surface)); box-shadow: var(--ombre-flottante); }
.pb-top { display: flex; align-items: center; gap: 6px; min-height: 18px; }
.pb-time { font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--texte-2); font-variant-numeric: tabular-nums; }
.pb-top .pb-status { margin-left: auto; }
.pb-title { font-size: 14px; line-height: 18px; font-weight: 600; color: var(--titre); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-detail { font-size: 13px; line-height: 17px; color: var(--texte); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pb-sub { font-size: 12px; color: var(--texte-3); }
.pb-meta { font-size: 12px; color: var(--texte-2); display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pb-meta .ico { flex: none; }
.pb-flag { font-size: 11px; font-weight: 600; color: var(--alerte); background: var(--alerte-doux); border-radius: var(--rayon-s); padding: 0 5px; line-height: 16px; white-space: nowrap; }
.pb-status { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; flex: none; }
.pb-status.ok { background: var(--succes); color: var(--surface); }
.pb-status.run { background: var(--bleu); color: #fff; }
.pb-status.off { background: var(--texte-3); color: var(--surface); }
.pb-conflict { font-size: 12px; font-weight: 600; color: var(--danger); display: flex; align-items: center; gap: 4px; }
.pblock.tentative, .mg-chip.tentative, .ag-card.tentative { border-style: dashed; border-left-style: solid; }
.pblock.conflict { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.pblock.s-terminee { opacity: .75; }
.pblock.s-annulee { opacity: .55; }
.pblock.s-annulee .pb-title { text-decoration: line-through; }
.week-grid.one-day .pb-title { white-space: normal; }
.pabs { --cat: var(--texte-3); display: flex; align-items: center; gap: 6px; width: 100%; border: 1px dashed var(--bordure-champ); background: var(--surface-2); color: var(--texte-2); border-radius: var(--rayon-rond); padding: 2px 10px; font: inherit; font-size: 12px; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pabs::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--cat); flex: none; }
.pabs:hover { background: var(--selection); }

/* Mois */
.mg-top { display: flex; align-items: center; justify-content: space-between; }
.mg-count { font-size: 11px; color: var(--texte-3); font-variant-numeric: tabular-nums; padding-right: 4px; }
.mg-chip { background: color-mix(in srgb, var(--cat) 12%, var(--surface)); }
.mg-chip:hover { background: color-mix(in srgb, var(--cat) 22%, var(--surface)); }
.mg-time { font-weight: 600; color: var(--texte-2) !important; font-variant-numeric: tabular-nums; }
.mg-abs { display: flex; align-items: center; gap: 4px; border: 0; background: none; font: inherit; font-size: 11px; color: var(--texte-3); padding: 1px 6px; cursor: pointer; text-align: left; }
.mg-abs:hover { color: var(--titre); }

/* Agenda (liste par jour) */
.agenda { display: grid; gap: var(--espace-5); }
.ag-day h3 { display: flex; align-items: baseline; gap: var(--espace-2); flex-wrap: wrap; font-size: 16px; line-height: 24px; margin: 0 0 var(--espace-2); color: var(--titre); }
.ag-day.today h3 { box-shadow: inset 3px 0 var(--bleu); padding-left: var(--espace-2); }
.ag-day > .muted { margin: 0; }
.ag-print { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; color: var(--lien); }
.ag-abs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--texte-3); margin: 0 0 var(--espace-2); }
.ag-card { --cat: var(--bleu); display: flex; gap: var(--espace-4); width: 100%; text-align: left; border: 1px solid var(--bordure); border-left: 5px solid var(--cat); background: var(--surface); border-radius: var(--rayon-m); padding: var(--espace-3) var(--espace-4); margin-bottom: var(--espace-2); font: inherit; color: var(--texte); cursor: pointer; transition: background-color 120ms; }
.ag-card:hover { background: color-mix(in srgb, var(--cat) 8%, var(--surface)); }
.ag-card.s-terminee { opacity: .75; }
.ag-card.s-annulee { opacity: .55; } .ag-card.s-annulee .ag-title b { text-decoration: line-through; }
.ag-time { flex: none; width: 64px; white-space: nowrap; display: grid; align-content: start; font-variant-numeric: tabular-nums; }
.ag-time b { font-size: 18px; line-height: 24px; color: var(--titre); }
.ag-time small { font-size: 13px; color: var(--texte-3); }
.ag-title { display: flex; align-items: center; gap: var(--espace-2); flex-wrap: wrap; }
.ag-title b { font-size: 16px; line-height: 22px; color: var(--titre); font-weight: 600; }
.ag-cat { display: flex; align-items: center; gap: 6px; color: var(--texte-2); font-size: 13px; }
.ag-cat::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--cat); }
.ag-meta { display: flex; flex-wrap: wrap; gap: 4px var(--espace-4); align-items: center; margin-top: 6px; font-size: 13px; color: var(--texte-2); }
.ag-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.avatars { display: inline-flex; } .avatars > * + * { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); border-radius: 50%; }

/* Choix des techniciens et véhicules : occupé / libre visible tout de suite */
.tech-chip { cursor: pointer; font: inherit; font-weight: 500; }
.tech-chip.free:not(.on) { border-color: color-mix(in srgb, var(--succes) 45%, var(--bordure)); }
.tech-chip.busy { border-style: solid !important; border-color: var(--alerte); background: var(--alerte-doux); color: var(--texte); }
.tech-chip.busy.on { border-color: var(--danger); background: var(--danger-doux); box-shadow: 0 0 0 1px var(--danger); }
.chip-busy { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--alerte); margin-left: 2px; }
.tech-chip.busy.on .chip-busy { color: var(--danger); }
.chip-free { font-size: 12px; font-weight: 500; color: var(--succes); margin-left: 2px; }
.swap-box { margin-top: var(--espace-3); border: 1px solid var(--alerte); background: var(--alerte-doux); border-radius: var(--rayon-m); padding: var(--espace-3); display: grid; gap: var(--espace-3); }
.swap-row { display: flex; align-items: center; gap: var(--espace-3); flex-wrap: wrap; color: var(--texte); font-size: 14px; }
.swap-row > .ico { color: var(--alerte); flex: none; }
.swap-row .grow { flex: 1 1 260px; }
.swap-pick { display: flex; align-items: center; gap: var(--espace-2); font-weight: 500; }
.swap-pick > span { white-space: nowrap; }
.swap-pick select { min-height: var(--hauteur-controle); }

/* Atelier : kanban des fabrications et grand écran */
.aboard { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(260px, 1fr)); gap: var(--espace-4); align-items: start; overflow-x: auto; padding-bottom: var(--espace-2); }
.acol { background: var(--surface-2); border-radius: var(--rayon-m); display: flex; flex-direction: column; min-height: 240px; border-top: 4px solid var(--col, var(--bordure-champ)); transition: box-shadow 120ms; }
.acol.over { box-shadow: inset 0 0 0 2px var(--bleu); background: var(--selection); }
.acol-fabrication { --col: var(--bleu); } .acol-controle { --col: #EA580C; } .acol-valide { --col: var(--succes); }
.acol > header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--espace-2); padding: var(--espace-3) var(--espace-4); }
.acol > header b { display: block; color: var(--titre); font-size: 16px; } .acol > header small { color: var(--texte-3); font-size: 12px; }
.acol .count { font-weight: 600; font-size: 14px; color: var(--texte-2); background: var(--surface); border-radius: var(--rayon-rond); padding: 2px 10px; font-variant-numeric: tabular-nums; }
.acol-body { display: grid; gap: var(--espace-2); padding: 0 var(--espace-2) var(--espace-3); }
.acol-empty { text-align: center; color: var(--texte-3); font-size: 13px; border: 1px dashed var(--bordure-champ); border-radius: var(--rayon-m); padding: var(--espace-5) var(--espace-3); margin: 0; }
.acard { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon-m); padding: var(--espace-3); display: grid; gap: 4px; box-shadow: 0 1px 2px rgba(3, 9, 115, .05); }
.acard[draggable="true"] { cursor: grab; }
.acard.u-retard { box-shadow: inset 4px 0 var(--danger); } .acard.u-urgent { box-shadow: inset 4px 0 var(--alerte); } .acard.prio { box-shadow: inset 4px 0 var(--danger); }
.acard.sel { border-color: var(--bleu); background: var(--selection); }
.acard-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.acard-top input { width: 16px; height: 16px; min-height: 0; accent-color: var(--primaire); }
.acard-date { margin-left: auto; color: var(--texte-2); font-weight: 500; white-space: nowrap; }
.acard-date.late { color: var(--danger); }
.acard-client { color: var(--titre); font-size: 15px; font-weight: 600; }
.acard-title { color: var(--texte-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.acard-foot { display: flex; align-items: center; gap: var(--espace-3); flex-wrap: wrap; margin-top: 4px; font-size: 13px; }
.acard-foot .btn { margin-left: auto; }
.acard-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; border-top: 1px solid var(--bordure); padding-top: 8px; }
.acard-list li { display: grid; gap: 4px; font-size: 13px; }
.acard-list small { display: block; color: var(--texte-3); font-size: 12px; }
.acard-items { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; font-size: 14px; color: var(--texte); }
.acard-items small { color: var(--texte-3); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--bordure-champ); }
.dot.prod-en_cours { background: #EA580C; } .dot.prod-fait { background: var(--succes); }
.mat.on { background: var(--selection); color: var(--bleu); font-weight: 600; }
.acard-ctl { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sup-chips { display: flex; flex-wrap: wrap; gap: var(--espace-2); margin: 0 0 var(--espace-4); }
.sup-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--rayon-rond); border: 1px solid var(--bordure); background: var(--surface); color: var(--texte-2); font: inherit; font-size: 13px; cursor: pointer; transition: background-color 120ms; }
.sup-chip:hover { background: var(--surface-2); }
.sup-chip b { font-weight: 600; color: var(--texte); font-variant-numeric: tabular-nums; }
.sup-chip.hot b { color: var(--danger); }
.sup-chip.on { border-color: var(--bleu); background: var(--selection); color: var(--titre); font-weight: 500; }
.soon-toggle { display: flex; align-items: center; gap: 6px; width: 100%; margin-top: var(--espace-2); padding: var(--espace-2) var(--espace-3); border: 1px dashed var(--bordure-champ); border-radius: var(--rayon-m); background: transparent; color: var(--texte-2); font: inherit; font-size: 13px; cursor: pointer; }
.soon-toggle:hover { background: var(--surface); } .soon-toggle .link-btn { margin-left: auto; }
.soon-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; padding: 6px var(--espace-3); border-radius: var(--rayon-s); color: var(--texte-2); font-size: 13px; text-decoration: none; opacity: .8; }
.soon-row { width: 100%; border: 0; background: none; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.peek-title { display: flex; align-items: center; gap: var(--espace-2); flex-wrap: wrap; margin: 0 0 var(--espace-3); font-size: 16px; } .peek-title b { color: var(--titre); }
.peek-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--espace-3); margin: 0 0 var(--espace-4); }
.peek-grid dt { font-size: 12px; color: var(--texte-3); } .peek-grid dd { margin: 2px 0 0; color: var(--texte); }
.ref.link-btn { font: 400 13px/18px var(--police-mono); }
.soon-row:hover { background: var(--surface); opacity: 1; } .soon-row b { color: var(--texte); font-weight: 500; } .soon-row small { margin-left: auto; }
.ready { background: var(--surface); border: 1px solid var(--bordure); border-left: 4px solid var(--succes); border-radius: var(--rayon-m); margin-bottom: var(--espace-4); }
.ready > header { display: flex; align-items: center; gap: var(--espace-3); flex-wrap: wrap; padding: var(--espace-2) var(--espace-3); }
.ready-toggle { display: flex; align-items: center; gap: var(--espace-2); background: none; border: 0; font: inherit; color: var(--texte); cursor: pointer; padding: 4px; flex-wrap: wrap; text-align: left; }
.ready-toggle b { color: var(--titre); } .ready-toggle .link-btn { font-size: 13px; } .ready-toggle small { color: var(--texte-3); font-size: 13px; }
.ready .count { font-weight: 600; font-size: 13px; color: var(--succes); background: var(--succes-doux); border-radius: var(--rayon-rond); padding: 1px 9px; font-variant-numeric: tabular-nums; }
.ready > header .btn { margin-left: auto; }
.ready-list { display: grid; border-top: 1px solid var(--bordure); max-height: 280px; overflow-y: auto; }
.ready-row { display: grid; grid-template-columns: auto 1fr auto; gap: var(--espace-3); align-items: center; padding: var(--espace-2) var(--espace-4); border-bottom: 1px solid var(--bordure); }
.ready-row:last-child { border-bottom: 0; }
.ready-row.sel { background: var(--selection); }
.ready-row input { width: 18px; height: 18px; min-height: 0; accent-color: var(--primaire); }
.ready-row b { color: var(--titre); font-weight: 600; } .ready-row small { display: block; color: var(--texte-3); font-size: 13px; }
.screen-groups { columns: 2 520px; column-gap: var(--espace-5); }
.screen-groups .prod-group { break-inside: avoid; margin-bottom: var(--espace-5); }
.prod-group.big h2 { font-size: 24px; line-height: 30px; } .prod-group.big h2 small { font-size: 15px; }
.prod-group.big .prod-row { grid-template-columns: 1fr auto; } .prod-group.big .prod-top { font-size: 15px; } .prod-group.big .prod-top b { font-size: 18px; }
.prod-group.big .prod-desc { font-size: 17px; }
.prod-row.u-retard { box-shadow: inset 4px 0 var(--danger); } .prod-row.u-urgent { box-shadow: inset 4px 0 var(--alerte); }
.group-bar { display: flex; align-items: center; gap: var(--espace-3); flex-wrap: wrap; margin-bottom: var(--espace-3); }
/* Grand écran : lisible à 4 mètres */
.screen { min-height: 100vh; background: var(--fond); padding: var(--espace-4) var(--espace-5); display: flex; flex-direction: column; gap: var(--espace-4); }
.screen-head { display: flex; align-items: center; gap: var(--espace-4); }
.screen-head img { height: 40px; } .screen-head .logo-nuit { display: none; }
[data-theme="nuit"] .screen-head .logo-clair { display: none; } [data-theme="nuit"] .screen-head .logo-nuit { display: block; }
.screen-head h1 { margin: 0; font-size: 32px; line-height: 40px; }
.screen-date { margin-left: auto; font-size: 22px; color: var(--texte-2); font-variant-numeric: tabular-nums; }
.screen-board { flex: 1; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); }
.screen .acol > header b { font-size: 24px; line-height: 30px; } .screen .acol > header small { font-size: 15px; }
.screen .acol .count { font-size: 22px; padding: 4px 14px; }
.screen .acard { padding: var(--espace-4); gap: 6px; }
.screen .acard-top { font-size: 15px; } .screen .acard-top .ref { font-size: 15px; }
.screen .acard-client { font-size: 22px; line-height: 28px; }
.screen .acard-title { font-size: 17px; line-height: 23px; }
.screen .mat { font-size: 14px; }
.screen .progress small { font-size: 14px; }
@media (max-width: 768px) { .aboard { grid-template-columns: repeat(var(--cols, 4), 84vw); scroll-snap-type: x mandatory; } .acol { scroll-snap-align: start; } }

/* Chiffres */
.table-scroll { overflow-x: auto; }
.card-head.pad, p.pad { padding: var(--espace-4) var(--espace-5) 0; }
td.ellipsis { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--espace-2) var(--espace-4); margin: var(--espace-3) 0; }
.kpi .up { color: var(--succes); font-weight: 600; } .kpi .down { color: var(--danger); font-weight: 600; }
.chart-legend { display: flex; gap: var(--espace-4); font-size: 13px; color: var(--texte-2); margin-bottom: var(--espace-2); }
.chart-legend span, .chart-tip span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sw.cur { background: var(--bleu); } .sw.prev { background: var(--bordure-champ); opacity: .55; }
.chart-box { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--bordure); stroke-width: 1; }
.chart .axis { stroke: var(--bordure-champ); stroke-width: 1; }
.chart .tick { fill: var(--texte-3); font-size: 11px; font-family: var(--police); }
.chart .b-cur { fill: var(--bleu); } .chart .b-prev { fill: var(--bordure-champ); opacity: .55; }
.chart .hit { fill: transparent; } .chart g:hover .hit { fill: var(--selection); opacity: .5; }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--bordure); box-shadow: var(--ombre-flottante); border-radius: var(--rayon-s); padding: 6px 10px; font-size: 13px; display: grid; gap: 2px; pointer-events: none; white-space: nowrap; color: var(--texte); }
.chart-tip b { font-variant-numeric: tabular-nums; }
.fig-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: var(--espace-6); margin-bottom: var(--espace-6); align-items: start; }
.fig-grid > .card { overflow-x: auto; margin: 0; }
.breakdown td:first-child { width: 45%; min-width: 160px; }
@media (max-width: 768px) { .fig-grid { grid-template-columns: 1fr; } }
.bd-label { font-weight: 500; color: var(--texte); }
.bd-bar { height: 4px; background: var(--surface-2); border-radius: 2px; margin-top: 4px; }
.bd-bar i { display: block; height: 100%; background: var(--bleu); border-radius: 2px; }
.figures-page .search-wrap { max-width: 320px; }

/* Droits par rôle */
.rights-wrap { overflow-x: auto; }
.rights { min-width: 980px; }
.rights th[scope="row"] { font-weight: 500; color: var(--texte); white-space: nowrap; text-transform: none; letter-spacing: 0; font-size: 14px; }
.rights td { vertical-align: top; min-width: 132px; }
.rights td .cell-input { width: 100%; }
.rights td .scope { margin-top: 4px; font-size: 12px; color: var(--texte-2); }
.rights td.lvl-ecriture { background: var(--succes-doux); }
.rights td.lvl-lecture { background: var(--selection); }
.rights td.lvl-aucun select:first-child { color: var(--texte-3); }

/* Mode test des e-mails */
.test-band { display: flex; align-items: center; gap: 6px; justify-content: center; background: var(--alerte-doux); color: var(--alerte); font-size: 13px; font-weight: 500; padding: 4px var(--espace-4); border-bottom: 1px solid color-mix(in srgb, var(--alerte) 35%, transparent); }
.test-band a { color: inherit; text-decoration: underline; }
.test-card { border-color: var(--alerte); }

/* Import de devis */
.quote-lines td { vertical-align: top; }
.quote-lines td small { display: block; color: var(--texte-3); white-space: pre-line; max-width: 520px; }
.quote-lines input[type=checkbox] { width: 18px; height: 18px; margin: 2px 0 0; }
.quote-lines tr.off td { opacity: .5; }
/* Calendrier du mois : toutes les interventions */
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--bordure); gap: 1px; border: 1px solid var(--bordure); border-radius: var(--rayon-m); overflow: hidden; }
.mg-head { background: var(--surface-2); padding: var(--espace-2); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--texte-3); text-align: center; }
.mg-cell { background: var(--surface); min-height: 118px; padding: 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mg-cell.out { background: var(--fond); }
.mg-cell.out .mg-day { color: var(--texte-3); }
.mg-cell.today { background: var(--selection); }
.mg-day { align-self: flex-start; border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: var(--texte-2); padding: 2px 6px; border-radius: var(--rayon-s); cursor: pointer; }
.mg-day:hover { background: var(--surface-2); color: var(--titre); }
.mg-cell.today .mg-day { background: var(--primaire); color: var(--sur-primaire); }
.mg-chip { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--cat); background: var(--surface-2); color: var(--texte); font: inherit; font-size: 12px; line-height: 18px; padding: 1px 6px; border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.mg-chip span { color: var(--texte-3); }
.mg-chip:hover { background: var(--selection); }
.mg-chip.s-terminee { border-left-color: var(--succes); }
.mg-chip.s-annulee { text-decoration: line-through; opacity: .6; }
.mg-more { border: 0; background: transparent; font: inherit; font-size: 12px; color: var(--lien); text-align: left; padding: 1px 6px; cursor: pointer; }
/* Documents et commentaires */
.file-list { list-style: none; margin: var(--espace-2) 0; padding: 0; display: grid; gap: 4px; }
.file-list li { display: flex; align-items: center; gap: var(--espace-2); padding: 6px 8px; border: 1px solid var(--bordure); border-radius: var(--rayon-s); background: var(--surface); }
.file-list li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comments { display: grid; gap: var(--espace-3); }
.comment { display: flex; gap: var(--espace-2); align-items: flex-start; }
.comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--espace-2); }
.comment-head b { font-weight: 500; }
.comment-actions { margin-left: auto; display: inline-flex; gap: 2px; }
.comment p.pre { margin: 2px 0 0; }
.toggle.wrap { white-space: normal; padding: 0; }
.color-input { width: 36px; height: 28px; padding: 2px; border: 1px solid var(--bordure-champ); border-radius: var(--rayon-s); background: var(--surface); cursor: pointer; }
/* Médiathèque */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--espace-3); }
.media-card { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon-m); overflow: hidden; display: flex; flex-direction: column; }
.media-thumb { display: grid; place-items: center; height: 140px; background: var(--surface-2); border: 0; padding: 0; color: var(--texte-3); cursor: pointer; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-info { padding: var(--espace-2) var(--espace-3); display: grid; gap: 2px; min-width: 0; }
.media-info b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-info small { font-size: 12px; color: var(--texte-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-select { height: var(--hauteur-controle); }

.day-list { display: grid; gap: var(--espace-5); }
.day-list h3 { margin: 0 0 var(--espace-2); font-size: 14px; }
.day-list h3::first-letter { text-transform: uppercase; }
.day-list section.today h3 { color: var(--lien); }
.day-card { display: flex; gap: var(--espace-3); align-items: center; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--bordure); border-left: 3px solid var(--bleu); border-radius: var(--rayon-m); padding: var(--espace-3); margin-bottom: var(--espace-2); color: var(--texte); }
.day-card:hover { background: var(--surface-2); }
.day-card.s-terminee { border-left-color: var(--succes); }
.day-card b { font-weight: 500; }
.day-card small { display: flex; align-items: flex-start; gap: 6px; color: var(--texte-3); font-size: 13px; line-height: 18px; }
.day-card small svg { flex-shrink: 0; margin-top: 2px; }
.dc-time { font-size: 16px; font-weight: 600; color: var(--titre); min-width: 56px; font-variant-numeric: tabular-nums; }
.interv-view .iv-head { display: flex; gap: var(--espace-3); align-items: center; margin-bottom: var(--espace-4); }
.iv-dl { grid-template-columns: 120px 1fr; margin-bottom: var(--espace-4); }
.iv-dl dt { display: flex; align-items: center; gap: 6px; }
.callout { background: var(--surface-2); border-radius: var(--rayon-m); padding: var(--espace-3) var(--espace-4); margin-bottom: var(--espace-3); border-left: 3px solid var(--bleu); }
.callout.warn { background: var(--alerte-doux); border-left-color: var(--alerte); color: var(--texte); font-weight: 400; }
.callout.ok-box { background: var(--succes-doux); border-left-color: var(--succes); }
.callout > b { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--texte-2); }
.callout p { margin: 4px 0 0; }
.iv-items { padding-left: 18px; margin: 0; display: grid; gap: 4px; }
.full-input { width: 100%; }
.tech-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.tech-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--bordure-champ); background: var(--surface); border-radius: var(--rayon-rond); height: 32px; padding: 0 12px 0 3px; font-weight: 500; color: var(--texte-2); }
.tech-chip.on { border-color: var(--bleu); background: var(--selection); color: var(--titre); }
.tech-chip.busy:not(.on) { border-style: dashed; }

/* Prises de cote */
.survey-item { border: 1px solid var(--bordure); border-radius: var(--rayon-m); padding: var(--espace-4); margin-bottom: var(--espace-3); background: var(--surface); }
.si-head { display: flex; gap: var(--espace-2); align-items: center; margin-bottom: var(--espace-3); }
.si-head b { color: var(--texte-3); font-variant-numeric: tabular-nums; }
.si-label { font-weight: 500; }
.si-photos { display: flex; gap: var(--espace-3); align-items: flex-start; flex-wrap: wrap; margin-top: var(--espace-3); }

/* Photos */
.photo-add { cursor: pointer; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--espace-2); margin-top: var(--espace-3); flex: 1; min-width: 200px; }
.photo-grid figure { margin: 0; position: relative; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--rayon-s); cursor: zoom-in; display: block; border: 1px solid var(--bordure); }
.photo-grid figcaption { font-size: 12px; margin-top: 3px; } .photo-grid figcaption small { display: block; color: var(--texte-3); }
.photo-del { position: absolute; top: 4px; right: 4px; border: 0; border-radius: var(--rayon-rond); width: 24px; height: 24px; display: grid; place-items: center; background: rgba(0,0,0,.6); color: #fff; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 100; display: grid; place-items: center; cursor: zoom-out; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--rayon-s); }

/* Fenêtres et formulaires */
.modal-back { position: fixed; inset: 0; background: var(--voile); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade 200ms; }
.modal { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon-m); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--ombre-flottante); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: var(--espace-4) var(--espace-6); border-bottom: 1px solid var(--bordure); }
.modal-head h2 { font-size: 20px; line-height: 28px; }
.modal-body { padding: var(--espace-6); overflow: auto; }
.modal-body h3 { font-size: 16px; margin: var(--espace-6) 0 var(--espace-3); }
.modal-body h3 small { font-weight: 400; font-size: 13px; color: var(--texte-3); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--espace-2); padding: var(--espace-4) var(--espace-6); border-top: 1px solid var(--bordure); flex-wrap: wrap; }
body.modal-open { overflow: hidden; }
@keyframes fade { from { opacity: 0; } }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--espace-4); }
.form-grid.tight { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--espace-3); }
.field { display: grid; gap: 6px; align-content: start; }
.field > span { font-size: 14px; font-weight: 500; color: var(--texte-2); display: flex; justify-content: space-between; gap: var(--espace-2); }
.field.full { grid-column: 1 / -1; }
.field .aide { font-size: 13px; color: var(--texte-3); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset[disabled] { opacity: .6; cursor: not-allowed; }
.colors { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: var(--rayon-rond); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--bordure); }
.swatch.on { box-shadow: 0 0 0 2px var(--titre); }

/* Signature */
.sigpad { position: relative; border: 1px dashed var(--bordure-champ); border-radius: var(--rayon-m); background: #FFFFFF; margin: var(--espace-2) 0 var(--espace-3); height: 200px; }
.sigpad canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; border-radius: var(--rayon-m); }
.sigpad .sig-hint { position: absolute; left: 14px; bottom: 10px; font-size: 13px; color: #646A88; pointer-events: none; }
.sigpad button { position: absolute; right: 8px; top: 8px; }
.toggle.big { font-size: 14px; color: var(--texte); padding: 6px 0; }

/* Plan de charge */
.plan-table .table { min-width: 1800px; }
.plan-table td:nth-child(2) { min-width: 240px; }
.plan-table td:nth-child(n+9) { min-width: 130px; }
.plan-table tr.u-retard td:first-child { box-shadow: inset 3px 0 var(--danger); }
.plan-table tr.u-urgent td:first-child { box-shadow: inset 3px 0 var(--alerte); }
.wide-cell { min-width: 200px; max-width: 280px; }
.plan-cards { display: none; }
.inline-select.st { font-weight: 500; }

/* Notification */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); opacity: 0; background: var(--texte); color: var(--surface); padding: 10px 16px; border-radius: var(--rayon-m); font-weight: 500; z-index: 200; transition: opacity 200ms, transform 200ms; box-shadow: var(--ombre-flottante); display: flex; gap: 8px; align-items: center; }
.toast.error { background: var(--danger); color: #fff; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Navigation repliée en icônes sous 1024 px */
@media (max-width: 1024px) and (min-width: 769px) {
  .shell { grid-template-columns: 68px 1fr; }
  .side { padding: var(--espace-4) var(--espace-2); }
  .brand { justify-content: center; padding: 0 0 var(--espace-5); }
  .brand .logo-clair, .brand .nom-produit { display: none !important; }
  .brand .logo-nuit { display: block; }
  .side nav a { justify-content: center; padding: 0; }
  .side nav a span, .nav-group, .side-user > div, .count-nav { display: none; }
  .side-user { justify-content: center; padding: var(--espace-2); }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
/* Téléphone */
@media (max-width: 768px) {
  .plan-title { font-size: 18px; line-height: 24px; margin-left: 0; flex-basis: 100%; order: -1; }
  .plan-actions { width: 100%; } .plan-actions .seg { flex: 1; }
  .ag-card { gap: var(--espace-3); padding: var(--espace-3); }
  .ag-time { width: 54px; } .ag-time b { font-size: 15px; }
  .cat-legend { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; } .cat-chip { flex: none; }
  .swap-pick { flex: 1 1 100%; } .swap-pick > span { white-space: nowrap; }
.swap-pick select { flex: 1; }
  .mg-cell { min-height: 72px; padding: 2px; }
  .mg-chip { font-size: 11px; padding: 0 3px; border-left-width: 2px; }
  .mg-chip span { display: none; }
  .mg-head { font-size: 10px; letter-spacing: 0; padding: 4px 0; }
  .seg button { padding: 0 10px; }
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .page { padding: var(--espace-4) var(--espace-4) 96px; }
  h1 { font-size: 22px; line-height: 28px; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: var(--espace-3); }
  .kpi { padding: var(--espace-4); } .kpi > b { font-size: 24px; line-height: 32px; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--bordure); z-index: 40; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 8px 2px 6px; color: var(--texte-2); font-size: 12px; font-weight: 500; cursor: pointer; }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav a.active { color: var(--titre); box-shadow: inset 0 2px 0 var(--bleu); }
  .bottom-nav a.active .ico { color: var(--bleu); }
  .mobile-menu { display: block; position: fixed; inset: 0; background: var(--voile); z-index: 45; }
  .mobile-menu > div { position: absolute; bottom: 70px; left: 12px; right: 12px; background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon-m); padding: 8px; display: grid; box-shadow: var(--ombre-flottante); }
  .mobile-menu p { margin: 4px 10px 8px; color: var(--texte-3); }
  .board { grid-template-columns: repeat(var(--cols, 9), 84vw) !important; scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .form-grid, .form-grid.tight { grid-template-columns: 1fr 1fr; }
  .prod-row { grid-template-columns: 1fr; }
  dl, .iv-dl { grid-template-columns: 1fr; gap: 2px; } dd { margin-bottom: var(--espace-2); }
  .search-wrap { flex: 1 1 100%; }
  .filters > select { flex: 1; }
  .modal-back { padding: 0; place-items: end stretch; }
  .modal { max-height: 94vh; border-radius: var(--rayon-m) var(--rayon-m) 0 0; }
  .modal-body, .modal-head, .modal-foot { padding-left: var(--espace-4); padding-right: var(--espace-4); }
  .card { overflow-x: auto; padding: var(--espace-4); }
  /* Sous 768 px, les tableaux deviennent des listes de cartes */
  .plan-table { display: none; }
  .plan-cards { display: grid; gap: var(--espace-2); }
  .stepper .step:not(.current) { display: none; }
  .stepper .step.current { clip-path: none; border-radius: var(--rayon-s); }
  .stepper::after { content: attr(data-pos); align-self: center; margin-left: var(--espace-3); color: var(--texte-3); font-size: 13px; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Impression de la fiche de fabrication */
@media print {
  :root { --fond: #fff; }
  .side, .bottom-nav, .page-head, .stepper, .tabs, .no-print { display: none !important; }
  .shell { display: block; } body { background: #fff; color: #13163A; }
  .page { padding: 0; } .card { border: 0; padding: 0; }
}
