/* Arrimo — DA Vexy (Switzer, blanc, gris légers) + touches de rouge D-Groupe */
:root {
  --bg: #fafafa; --blanc: #fff; --gris: #f3f3f2; --ligne: #e8e8e8; --ligne2: #dcdcdc;
  --texte: #111; --doux: #6f6f6f; --pale: #a3a3a3;
  --rouge: #ba2a0a; --rouge-doux: #fbeeea; --vert: #2f7d4f; --vert-doux: #eaf4ee; --ambre: #a86a00; --ambre-doux: #fbf3e2;
  --sans: "Switzer", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --r: 14px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--texte); font: 400 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; font-weight: inherit; }
button, input, select { font: inherit; color: inherit; }
b, strong { font-weight: 500; }
svg { flex: none; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Structure ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.cote { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px; padding: 26px 18px; background: var(--blanc); border-right: 1px solid var(--ligne); }
.marque { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.marque img { width: 34px; height: 34px; object-fit: contain; }
.marque span { display: grid; line-height: 1.15; }
.marque b { font-size: 19px; letter-spacing: -.02em; }
.marque small { color: var(--doux); font-size: 12px; }
.client { display: grid; gap: 6px; padding: 0 8px; }
.client span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--pale); }
select, input[type=text], input[type=number], input[type=search] {
  height: 38px; padding: 0 12px; border: 1px solid var(--ligne2); border-radius: 10px; background: var(--blanc); outline: none; transition: border-color .2s; min-width: 0;
}
select:focus, input:focus { border-color: var(--texte); }
#nav { display: grid; gap: 2px; }
#nav a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--doux); transition: background .2s, color .2s; }
#nav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#nav a:hover { background: var(--gris); color: var(--texte); }
#nav a.actif { background: var(--gris); color: var(--texte); font-weight: 500; }
#nav a.actif svg { stroke: var(--rouge); }
.vexy { margin-top: auto; padding: 0 8px; font-size: 12px; color: var(--pale); display: flex; align-items: center; gap: 4px; }
.vexy b { color: var(--texte); font-weight: 500; }
.vexy i { width: 5px; height: 5px; border-radius: 50%; background: var(--texte); margin-top: 3px; }

.vue { padding: 40px clamp(16px, 4vw, 56px) 80px; max-width: 1240px; width: 100%; outline: none; animation: entre .45s var(--ease); }
@keyframes entre { from { opacity: 0; transform: translateY(6px); } }
.entete { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 32px; }
.entete h1 { font-weight: 300; font-size: clamp(30px, 3.6vw, 46px); letter-spacing: -.035em; line-height: 1.05; }
.entete p { color: var(--doux); margin-top: 8px; max-width: 62ch; }
.surtitre { font-size: 12px; text-transform: uppercase; letter-spacing: .09em; color: var(--rouge); margin-bottom: 10px; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Composants ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--ligne2); background: var(--blanc); cursor: pointer; white-space: nowrap; transition: border-color .2s, background .2s, transform .15s; }
.btn:hover { border-color: var(--texte); }
.btn:active { transform: scale(.98); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn.plein { background: var(--rouge); border-color: var(--rouge); color: #fff; }
.btn.plein:hover { background: #a02308; }
.btn.noir { background: var(--texte); border-color: var(--texte); color: #fff; }
.btn.petit { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.lien { border: 0; background: none; padding: 0; height: auto; color: var(--doux); }
.btn.lien:hover { color: var(--texte); }
.btn:disabled { opacity: .45; pointer-events: none; }

.carte { background: var(--blanc); border: 1px solid var(--ligne); border-radius: var(--r); padding: 24px; }
.carte h2 { font-size: 16px; font-weight: 500; margin-bottom: 4px; }
.carte .sous { color: var(--doux); font-size: 13px; margin-bottom: 18px; }
.grille { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.kpi { padding: 20px 22px; }
.kpi .v { font-size: 38px; font-weight: 300; letter-spacing: -.04em; line-height: 1.1; }
.kpi .l { color: var(--doux); font-size: 13px; margin-top: 2px; }
.kpi .d { font-size: 12px; color: var(--pale); margin-top: 10px; }
.kpi.rouge .v { color: var(--rouge); }

.puce { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--gris); color: var(--doux); }
.puce::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.puce.mesure { background: var(--vert-doux); color: var(--vert); }
.puce.a_mesurer, .puce.bloquee { background: var(--rouge-doux); color: var(--rouge); }
.puce.partiel, .puce.a_verifier { background: var(--ambre-doux); color: var(--ambre); }
.puce.calculee { background: var(--vert-doux); color: var(--vert); }

/* Anneau de progression */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 40px; align-items: center; padding: 32px; }
.anneau { position: relative; width: 190px; height: 190px; }
.anneau svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.anneau circle { fill: none; stroke-width: 10; }
.anneau .fond { stroke: var(--gris); }
.anneau .val { stroke: var(--rouge); stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease); }
.anneau .c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.anneau .c b { font-size: 44px; font-weight: 300; letter-spacing: -.04em; line-height: 1; }
.anneau .c span { color: var(--doux); font-size: 12px; margin-top: 6px; }
.chiffres { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.chiffres div b { display: block; font-size: 30px; font-weight: 300; letter-spacing: -.03em; }
.chiffres div span { color: var(--doux); font-size: 13px; }
.chiffres .rouge b { color: var(--rouge); }

.barre { height: 6px; border-radius: 99px; background: var(--gris); overflow: hidden; }
.barre i { display: block; height: 100%; background: var(--texte); border-radius: inherit; transition: width 1s var(--ease); }
.barre.rouge i { background: var(--rouge); }

.liste { display: grid; }
.liste > * { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; padding: 11px 0; border-top: 1px solid var(--ligne); }
.liste > *:first-child { border-top: 0; }
.liste .barre { grid-column: 1 / -1; }
a.ligne-lien:hover { color: var(--rouge); }

.remarques { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.remarques li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; color: var(--texte); }
.remarques li svg { width: 18px; height: 18px; margin-top: 2px; fill: none; stroke: var(--rouge); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.remarques small { display: block; color: var(--doux); font-size: 13px; }

/* Tableaux */
.tableau-wrap { overflow-x: auto; border: 1px solid var(--ligne); border-radius: var(--r); background: var(--blanc); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; font-size: 12px; color: var(--doux); padding: 12px 14px; border-bottom: 1px solid var(--ligne); white-space: nowrap; background: var(--blanc); position: sticky; top: 0; }
td { padding: 11px 14px; border-top: 1px solid var(--ligne); vertical-align: middle; }
tbody tr:first-child td { border-top: 0; }
tbody tr.clic { cursor: pointer; transition: background .15s; }
tbody tr.clic:hover { background: #fcfcfb; }
td.code { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 500; }
td.des { color: var(--doux); max-width: 360px; }
td.r, th.r { text-align: right; }
.vide { color: var(--pale); }

.outils { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.outils input[type=search] { flex: 1 1 260px; }
.filtres { display: flex; flex-wrap: wrap; gap: 6px; }
.filtre { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--ligne2); background: var(--blanc); cursor: pointer; font-size: 13px; color: var(--doux); }
.filtre.actif { background: var(--texte); border-color: var(--texte); color: #fff; }
.filtre b { font-weight: 500; margin-left: 4px; }

/* Dépôt de fichier */
.depot { display: grid; place-items: center; gap: 10px; text-align: center; padding: 48px 24px; border: 1.5px dashed var(--ligne2); border-radius: var(--r); background: var(--blanc); cursor: pointer; transition: border-color .2s, background .2s; }
.depot:hover, .depot.survol { border-color: var(--rouge); background: #fffdfc; }
.depot svg { width: 34px; height: 34px; fill: none; stroke: var(--rouge); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.depot b { font-size: 17px; font-weight: 500; }
.depot span { color: var(--doux); font-size: 13px; }
.depot input { display: none; }

/* Alerte bloquante */
.alerte { border: 1px solid #f0c9bf; background: var(--rouge-doux); border-radius: var(--r); padding: 22px 24px; display: grid; gap: 14px; }
.alerte h2 { color: var(--rouge); font-size: 17px; font-weight: 500; display: flex; gap: 10px; align-items: center; }
.alerte h2 svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.alerte .tableau-wrap { border-color: #f0c9bf; }

/* Résultat */
.verdict { padding: 32px; display: grid; gap: 20px; }
.verdict .phrase { font-size: clamp(26px, 3vw, 38px); font-weight: 300; letter-spacing: -.03em; line-height: 1.15; }
.verdict .phrase em { font-style: normal; color: var(--rouge); font-weight: 400; }
.mini { display: flex; flex-wrap: wrap; gap: 28px; }
.mini div b { display: block; font-size: 22px; font-weight: 400; letter-spacing: -.02em; }
.mini div span { font-size: 12px; color: var(--doux); }
.pourquoi { font-size: 13px; color: var(--doux); display: grid; gap: 4px; }
.pourquoi b { color: var(--texte); }

.camion { padding: 24px; display: grid; gap: 16px; }
.camion-tete { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; align-items: baseline; }
.camion-tete h3 { font-size: 18px; font-weight: 500; }
.camion-tete span { color: var(--doux); font-size: 13px; }
.plan { width: 100%; height: auto; display: block; }
.plan .caisse { fill: #fcfcfb; stroke: var(--texte); stroke-width: 1.5; }
.plan .cabine { fill: var(--gris); stroke: var(--ligne2); }
.plan .obj { stroke: #fff; stroke-width: 1; transition: opacity .2s; }
.plan .obj.complete { fill: #3a3a3a; }
.plan .obj.mixte { fill: var(--rouge); }
.plan .obj.hors { fill: #a3a3a3; }
.plan { margin: 0 auto; }
.plan text { font: 500 17px var(--sans); fill: #fff; pointer-events: none; }
.plan .cote-txt { fill: var(--doux); font-weight: 400; font-size: 15px; }
details.detail-pal summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; padding: 6px 0; }
details.detail-pal summary::-webkit-details-marker { display: none; }
details.detail-pal summary::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .2s; }
details.detail-pal[open] summary::before { transform: rotate(45deg); }
details.detail-pal .palettes { margin-top: 12px; }
.plan g:hover .obj { opacity: .8; }
.legende { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--doux); }
.legende i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pal { border: 1px solid var(--ligne); border-radius: 12px; padding: 14px 16px; background: var(--blanc); font-size: 13px; }
.pal-tete { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.pal-tete b { font-size: 14px; }
.pal-tete span { color: var(--doux); }
.pal ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.pal li { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.pal li em { font-style: normal; color: var(--doux); }
.pastille { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* Modale */
.modale { position: fixed; inset: 0; z-index: 50; background: rgba(17, 17, 17, .28); display: grid; place-items: center; padding: 16px; animation: fondu .2s; }
.modale[hidden] { display: none; }
@keyframes fondu { from { opacity: 0; } }
.boite { background: var(--blanc); border-radius: 18px; width: min(680px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, .18); animation: monte .3s var(--ease); }
@keyframes monte { from { transform: translateY(14px); opacity: 0; } }
.boite h2 { font-size: 22px; font-weight: 400; letter-spacing: -.02em; }
.boite .sous { color: var(--doux); margin: 4px 0 20px; font-size: 14px; }
.boite .pied { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.champs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.champ { display: grid; gap: 5px; font-size: 12px; color: var(--doux); }
.champ input, .champ select { width: 100%; color: var(--texte); font-size: 15px; }
.champ.l2 { grid-column: span 2; }
.champ.l4 { grid-column: 1 / -1; }
fieldset { border: 0; padding: 0; margin: 22px 0 0; }
legend { font-weight: 500; font-size: 14px; margin-bottom: 10px; padding: 0; }
.aide { font-size: 12px; color: var(--pale); margin-top: 8px; }
.coche { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; margin-right: 20px; cursor: pointer; }
.coche input { width: 16px; height: 16px; accent-color: var(--rouge); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; background: var(--texte); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; transition: .3s var(--ease); pointer-events: none; z-index: 60; }
.toast.vu { opacity: 1; transform: translate(-50%, 0); }
.charge { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: tourne .7s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
.note { font-size: 12px; color: var(--pale); }
.sep { height: 32px; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .cote { position: sticky; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--ligne); }
  .client { padding: 0; margin-left: auto; grid-template-columns: auto; }
  .client span { display: none; }
  #nav { order: 3; width: 100%; display: flex; overflow-x: auto; gap: 4px; }
  #nav a { white-space: nowrap; padding: 7px 10px; }
  .vexy { display: none; }
  .vue { padding: 28px 16px 64px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; justify-items: center; gap: 28px; padding: 24px; }
  .chiffres { grid-template-columns: repeat(2, 1fr); width: 100%; }
  .champs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 901px) and (max-width: 1150px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Impression : plan de chargement pour le quai ---------- */
@media print {
  .cote, .actions, .no-print, .toast { display: none !important; }
  .app { display: block; }
  .vue { padding: 0; max-width: none; animation: none; }
  body { background: #fff; font-size: 12px; }
  .carte, .pal { border-color: #ccc; break-inside: avoid; }
  .camion { break-inside: avoid; }
  .plan .obj.mixte { fill: #ba2a0a; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .plan .obj.complete, .plan .obj.hors { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
