/* ============================================================
   Aplomb — Nuit ardoise. Design system de l'app de relevé.
   Palette navy/cobalt/bleu vif, typo Hanken Grotesk.
   ============================================================ */
:root {
  /* Couleurs */
  --bg: #F4F7FB;
  --surface: #FFFFFF;
  --navy: #0B2240;
  --ink: #0B2240;          /* texte principal / titres */
  --muted: #6B7794;        /* texte secondaire */
  --muted-2: #8B95AC;      /* labels, sous-titres */
  --faint: #9BA4BB;        /* placeholders, méta */
  --line: #E9EDF4;         /* contour des cartes */
  --line-2: #E4EAF3;       /* contour des boutons icône */
  --accent: #2563EB;       /* cobalt — action */
  --accent-soft: #E8EFFC;  /* fond doux (avatar, sélection) */
  --highlight: #54A8FF;    /* bleu vif (sur navy) */
  --track: #EDF1F7;        /* piste des barres claires */
  --danger: #C2362B;
  --success: #1E7D3C;
  --success-soft: #E2F0E6;

  /* Rayons */
  --radius: 18px;          /* cartes */
  --radius-sm: 15px;       /* champs, cartes étage */
  --radius-xs: 13px;       /* boutons icône, segments, tuiles */
  --radius-btn: 17px;      /* bouton primaire */
  --pill: 99px;

  /* Ombres */
  --shadow-card: 0 1px 2px rgba(11, 34, 64, 0.03);
  --shadow-btn: 0 10px 22px rgba(37, 99, 235, 0.30);

  --font: 'Hanken Grotesk Variable', 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --maxw: 640px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; } /* l'attribut hidden l'emporte même sur .chip{display:inline-flex} */
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.app { max-width: var(--maxw); margin: 0 auto; min-height: 100vh; }

/* ---------- barre de navigation (détail / éditeur / réglages) ---------- */
header.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px calc(12px) 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: var(--bg);
}
header.bar .title { flex: 1; min-width: 0; }
header.bar h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.bar .sub { font-size: 12.5px; color: var(--muted-2); font-weight: 600; }

/* bouton icône carré (retour, réglages, menu) */
.iconbtn {
  flex: 0 0 auto;
  border: 1px solid var(--line-2); background: var(--surface); color: #41496A;
  width: 42px; height: 42px; border-radius: var(--radius-xs);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; cursor: pointer;
}
.iconbtn:active { background: var(--track); }
header.bar .iconbtn[data-back] { width: 40px; height: 40px; border-radius: 12px; }

.badge {
  font-size: 12px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); padding: 5px 11px; border-radius: var(--pill); white-space: nowrap;
}

main { padding: 4px 16px calc(108px + var(--safe-b)); }

/* ---------- en-tête de l'accueil (logo + titre + stats) ---------- */
.home-head { padding: 6px 16px 4px; }
.home-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.home-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand svg { width: 22px; height: 22px; flex: 0 0 auto; }
.brand h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.025em; margin: 0; }
.sync-line { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 13px; color: var(--muted); font-weight: 600; padding-left: 1px; }
.sync-line i { font-size: 15px; color: var(--accent); }
.stats { display: flex; gap: 8px; margin-top: 16px; }
.stat { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xs); padding: 11px 13px; }
.stat .num { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.stat .lbl { font-size: 11.5px; color: var(--muted-2); margin-top: 1px; }
.stat.navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.stat.navy .num { color: var(--highlight); }
.stat.navy .lbl { color: rgba(255, 255, 255, 0.72); }

/* ---------- cartes (chantier / étage / châssis) ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 13px 14px; margin-bottom: 11px;
  display: flex; align-items: center; gap: 13px; cursor: pointer;
  box-shadow: var(--shadow-card);
}
.card:active { border-color: var(--accent-soft); }
.card .grow { flex: 1; min-width: 0; }
.card h3 { margin: 0; font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; }
.card p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .chev { color: #C2CBDC; font-size: 18px; flex: 0 0 auto; }
.thumb { width: 46px; height: 60px; flex: 0 0 auto; }

/* avatar à initiales / pastille d'icône */
.avatar {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
}
.avatar.glyph { font-size: 20px; font-weight: 400; }

.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted-2); padding: 48px 16px; font-weight: 500; }
.empty i { font-size: 38px; display: block; margin-bottom: 10px; opacity: .45; color: var(--faint); }

/* ---------- carte navy (résumé du chantier) ---------- */
.navy-card { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 17px; margin: 4px 0 16px; }
.navy-card .lbl { font-size: 12.5px; color: #8FA6C6; }
.navy-card .row2 { display: flex; justify-content: space-between; align-items: flex-end; }
.navy-card .big { font-size: 27px; font-weight: 800; margin-top: 3px; letter-spacing: -0.02em; }
.navy-card .big small { color: #6E84A6; font-size: 17px; font-weight: 700; }
.navy-card .pill { font-size: 13px; font-weight: 700; background: rgba(84, 168, 255, 0.18); color: var(--highlight); padding: 6px 11px; border-radius: var(--pill); }

/* pastille de statut / ratio */
.pill { padding: 5px 10px; border-radius: var(--pill); font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.gray { background: var(--track); color: #7C879F; }
.pill.blue { background: var(--accent-soft); color: var(--accent); }
.pill.green { background: var(--success-soft); color: var(--success); }

.section-h { font-size: 11.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; margin: 14px 2px 11px; }

/* ---------- champs ---------- */
label.field { display: block; font-size: 12px; font-weight: 700; color: var(--muted-2); margin-bottom: 12px; }
input[type="text"], input[type="number"], input[type="url"], input[type="password"] {
  width: 100%; margin-top: 6px; height: 46px; padding: 0 14px;
  font-family: var(--font); font-size: 16px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
input::placeholder { color: var(--faint); }
input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* zone de commentaire (chantier / étage / châssis) */
.notewrap { display: block; margin: 4px 0 14px; }
textarea.notefield {
  width: 100%; min-height: 60px; padding: 11px 14px; resize: vertical;
  font-family: var(--font); font-size: 15px; line-height: 1.4; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
textarea.notefield::placeholder { color: var(--faint); }
textarea.notefield:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
/* référence/repère mis en avant sur la carte d'un châssis */
.cref { color: var(--accent); font-weight: 800; }

/* champ de cote « gros cobalt » (Largeur / Hauteur / Quantité) */
.numfield { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 14px 12px; margin-bottom: 10px; }
.numfield .lbl { font-size: 11px; font-weight: 700; color: var(--faint); }
.numfield .box { display: flex; align-items: baseline; gap: 4px; margin-top: 3px; }
.numfield input { height: auto; margin: 0; padding: 0; border: none; background: transparent; font-size: 30px; font-weight: 800; letter-spacing: -0.02em; color: var(--accent); }
.numfield input:focus { outline: none; }
.numfield .unit { font-size: 13px; color: var(--faint); font-weight: 600; }

/* stepper (− valeur +) */
.stepper { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.stepper button { width: 40px; height: 40px; border-radius: 12px; border: none; font-size: 22px; font-weight: 700; cursor: pointer; font-family: var(--font); display: inline-flex; align-items: center; justify-content: center; }
.stepper button:active { transform: scale(0.95); }
.stepper .minus { background: var(--track); color: #41496A; }
.stepper .plus { background: var(--accent); color: #fff; }
.stepper .val { font-size: 19px; font-weight: 800; }

/* quantité : rangée compacte (cf. maquette refonte) */
.qtyrow { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 9px 14px; margin-bottom: 10px; }
.qtyrow .qlbl { font-size: 13px; font-weight: 600; color: #5A678A; }
.qtyrow .stepper { margin-top: 0; gap: 16px; justify-content: flex-end; }
.qtyrow .stepper button { width: 34px; height: 34px; border-radius: 9px; font-size: 19px; }
.qtyrow .stepper .minus { background: #F1F4F9; color: #41496A; }
.qtyrow .stepper .val { font-size: 18px; min-width: 14px; text-align: center; }
/* bouton « Interpréter le croquis » : texte cobalt (cf. maquette) */
#interpretBtn { color: var(--accent); }

/* contrôle segmenté (cobalt = sélectionné) */
.seg { display: flex; gap: 6px; flex: 1; min-width: 0; }
.seg button {
  flex: 1; min-width: 0; padding: 11px 4px; border-radius: var(--radius-xs);
  border: 1px solid var(--line); background: var(--surface); color: #5A678A;
  font-size: 13px; font-weight: 600; font-family: var(--font); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.seg button.on { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.seg.sm button { padding: 9px 2px; font-size: 12.5px; }

/* ---------- éditeur de travées / parties ---------- */
.sec-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px; margin-bottom: 10px; }
.sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sec-head .grow { flex: 1; font-size: 13px; color: var(--muted-2); font-weight: 600; }
.sec-n {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
}
.mini {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700;
  padding: 7px 11px; cursor: pointer; color: var(--accent);
  background: var(--accent-soft); border: none; border-radius: var(--pill);
}
.cell-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.cell-tag { flex: 0 0 auto; width: 26px; font-size: 11px; color: var(--muted-2); text-align: right; font-weight: 600; }
.cell-row select {
  flex: 1; min-width: 0;
  height: 44px; padding: 0 12px; font-family: var(--font); font-size: 16px;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-xs);
  appearance: none; -webkit-appearance: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cell-row select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.dim { display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto; font-size: 12px; color: var(--muted-2); font-weight: 600; }
.dim .dim-input {
  width: 60px; height: 40px; margin-top: 0; text-align: right; padding: 0 8px; font-size: 15px; font-weight: 700;
  color: var(--accent); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-xs);
  appearance: none; -webkit-appearance: none;
}
.dim .dim-input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 600; padding: 11px 14px; cursor: pointer;
  background: var(--surface); color: #5A678A;
  border: 1px solid var(--line); border-radius: var(--radius-xs);
}
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.chip i { font-size: 16px; }
/* affichage progressif : rangée « Ajouter un détail » + pastilles en pointillé */
.extras { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 16px; }
.extras-lbl { font-size: 12px; font-weight: 600; color: var(--faint); margin-right: 2px; }
.chip.add { color: #5A678A; font-weight: 700; border-style: solid; border-color: var(--line); border-radius: var(--pill); padding: 7px 12px; font-size: 12.5px; }
.chip.add i { font-size: 13px; }
.chip.add:active { background: var(--accent-soft); }

.previewbox {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
  padding: 12px; min-height: 220px; box-shadow: var(--shadow-card);
}

/* ---------- boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; height: 52px; font-family: var(--font); font-size: 16px; font-weight: 700; cursor: pointer;
  border-radius: var(--radius-xs); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink);
}
.btn i { font-size: 18px; }
.btn:active { transform: scale(0.99); }
.btn:disabled { cursor: default; opacity: 0.6; }
.btn:disabled:active { transform: none; }
.btn.primary { height: 56px; background: var(--accent); border: none; color: #fff; border-radius: var(--radius-btn); box-shadow: var(--shadow-btn); }
.btn.danger { color: var(--danger); border-color: rgba(194, 54, 43, 0.4); background: var(--surface); box-shadow: none; }
.btn.block { margin-top: 10px; }

/* bouton primaire ancré en bas (sous le pouce) */
.fab {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0;
  width: min(var(--maxw), 100%); padding: 14px 16px calc(20px + var(--safe-b)); z-index: 6;
  background: linear-gradient(to top, var(--bg) 72%, rgba(244, 247, 251, 0));
  pointer-events: none;
}
.fab .btn { pointer-events: auto; }

.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; }
.qty { font-size: 13px; color: var(--muted-2); font-weight: 700; }
.delete-x { flex: 0 0 auto; color: var(--danger); font-size: 18px; padding: 4px; cursor: pointer; }

/* ---------- zone de croquis ---------- */
.sketchwrap {
  position: relative; background: var(--surface);
  border: 1px dashed #C5CEDE; border-radius: var(--radius);
  height: 320px; overflow: hidden;
}
#sketch { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.sketch-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--faint); font-size: 14px; font-weight: 500; pointer-events: none;
}
/* vue compacte du croquis : une fois saisi, il se réduit (l'image est mise à l'échelle par CSS ; le dessin est désactivé tant qu'on n'a pas ré-agrandi) */
.sketchwrap.compact { height: 132px; cursor: pointer; transition: height 0.18s ease; }
.sketchwrap.compact #sketch { pointer-events: none; }
.sketch-expand { position: absolute; right: 8px; bottom: 8px; display: none; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 5px 10px; border-radius: var(--pill); pointer-events: none; }
.sketch-expand i { font-size: 14px; }
.sketchwrap.compact .sketch-expand { display: inline-flex; }

/* ---------- photo du châssis (carte + éditeur d'annotation) ---------- */
.photo-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: flex; gap: 13px; align-items: center; box-shadow: var(--shadow-card); }
.photo-thumb { width: 92px; height: 104px; flex: 0 0 auto; border-radius: 11px; overflow: hidden; position: relative; border: 1px solid var(--line); background: var(--track); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-badge { position: absolute; left: 5px; top: 5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: var(--pill); background: var(--accent); color: #fff; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.photo-card .photo-meta { font-size: 13px; color: #5A678A; line-height: 1.45; }
.photo-actions { display: flex; gap: 8px; margin-top: 10px; }
.photo-actions .btn { flex: 1; width: auto; height: 42px; font-size: 13.5px; }
.photo-actions .iconbtn { width: 44px; height: 42px; }

/* éditeur plein écran (sombre) */
.pa-ov { position: fixed; inset: 0; z-index: 60; background: #11151C; display: flex; flex-direction: column; }
.pa-top { flex: none; display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 12px; }
.pa-top .pa-icon { width: 40px; height: 40px; flex: 0 0 auto; border: none; border-radius: 12px; background: rgba(255, 255, 255, 0.1); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; }
.pa-top .pa-ttl { flex: 1; min-width: 0; }
.pa-top .pa-ttl .t1 { font-size: 15.5px; font-weight: 800; letter-spacing: -0.02em; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pa-top .pa-ttl .t2 { font-size: 12px; color: #8FA6C6; }
.pa-top .pa-ok { flex: 0 0 auto; height: 40px; padding: 0 16px; border: none; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; font-family: var(--font); display: flex; align-items: center; gap: 7px; cursor: pointer; }
.pa-stage { flex: 1; min-height: 0; position: relative; margin: 0 10px; border-radius: 16px; overflow: hidden; background: #0B0E13; }
.pa-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.pa-dockwrap { flex: none; padding: 12px 12px calc(20px + var(--safe-b)); display: flex; justify-content: center; }
.pa-dock { display: flex; align-items: center; gap: 5px; max-width: 100%; overflow-x: auto; background: #fff; border-radius: 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28); padding: 9px 11px; }
.pa-dock .pa-tool { width: 42px; height: 42px; flex: 0 0 auto; border: none; border-radius: 12px; background: transparent; color: #41496A; display: flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; }
.pa-dock .pa-tool.on { background: var(--accent); color: #fff; }
.pa-dock .pa-undo { background: var(--track); color: #5A678A; margin-left: 4px; }
.pa-dock .pa-div { width: 1px; height: 28px; background: var(--line); margin: 0 4px; flex: 0 0 auto; }
.pa-dock .pa-col { width: 26px; height: 26px; flex: 0 0 auto; border-radius: var(--pill); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.pa-dock .pa-col.on { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- bannières ---------- */
.banner { margin-top: 10px; padding: 11px 13px; border-radius: var(--radius-sm); font-size: 14px; border: 1px solid var(--line); background: var(--surface); }
.banner.ok { background: var(--accent-soft); border-color: rgba(37, 99, 235, 0.22); color: #1f4fc0; }
.banner.warn { background: rgba(194, 54, 43, 0.07); border-color: rgba(194, 54, 43, 0.28); color: var(--danger); }
.banner a { color: var(--accent); font-weight: 700; }
@keyframes spin { to { transform: rotate(360deg); } }
#interpretBtn:disabled { opacity: .7; }
#interpretBtn:disabled .ti-loader { display: inline-block; animation: spin 0.8s linear infinite; }

.coh-fix { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.coh-fix button {
  font-size: 12px; font-weight: 600; padding: 7px 11px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-family: var(--font);
}
.coh-fix button:active { transform: scale(0.98); }

/* total de l'étage : carte pleine (cf. maquette refonte) */
.totalbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: #EEF2F8; border-radius: 14px; margin-top: 2px; }
.totalbar .muted { font-size: 13px; color: var(--muted-2); }
.totalbar strong { font-size: 14px; font-weight: 700; }

/* bannière « nouvelle version disponible » */
.update-bar {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%);
  width: min(var(--maxw), 100%); z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
.update-bar .grow { flex: 1; min-width: 0; }
.update-bar button { border: none; cursor: pointer; font-size: 14px; font-weight: 700; border-radius: 8px; display: inline-flex; align-items: center; }
.update-bar .up-reload { background: #fff; color: var(--accent); padding: 7px 13px; }
.update-bar .up-close { background: transparent; color: #fff; padding: 7px; font-size: 16px; }

/* ---------- panneau (groupe de réglages) ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow-card); }
.panel > .panel-h { font-size: 13px; font-weight: 700; color: var(--ink); margin: 0 0 4px; }
.panel > .panel-sub { font-size: 13px; color: var(--muted-2); margin: 0 0 12px; }

/* ---------- écran de lancement (splash) ---------- */
.splash {
  position: fixed; inset: 0; z-index: 50; background: var(--navy); color: #EAF3FF;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity 0.45s ease; padding-bottom: 40px;
}
.splash.hide { opacity: 0; pointer-events: none; }
.splash .logo-box { width: 120px; height: 120px; border-radius: 30px; background: rgba(84, 168, 255, 0.10); border: 1px solid rgba(84, 168, 255, 0.22); display: flex; align-items: center; justify-content: center; }
.splash .word { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; margin-top: 24px; }
.splash .tag { font-size: 14px; color: #8FA6C6; margin-top: 6px; }

/* ---------- écrans d'authentification (immersif : haut navy + feuille blanche) ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; background: var(--navy); }
.auth-brand { flex: none; padding: calc(34px + env(safe-area-inset-top, 0px)) 30px 26px; display: flex; flex-direction: column; align-items: center; text-align: center; color: #EAF3FF; }
.auth-brand.compact { align-items: flex-start; text-align: left; padding-bottom: 22px; }
.auth-logobox { width: 74px; height: 74px; border-radius: 21px; background: rgba(84, 168, 255, 0.10); border: 1px solid rgba(84, 168, 255, 0.22); display: flex; align-items: center; justify-content: center; }
.auth-back { width: 38px; height: 38px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.06); color: #EAF3FF; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.auth-word { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin-top: 18px; }
.auth-brand.compact .auth-word { font-size: 25px; }
.auth-tag { font-size: 14px; color: #8FA6C6; margin-top: 5px; line-height: 1.4; }

.auth-sheet { flex: 1; background: var(--bg); border-radius: 30px 30px 0 0; padding: 28px 24px calc(8px + var(--safe-b)); color: var(--ink); display: flex; flex-direction: column; }
.auth-title { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.auth-fields { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.auth-flbl { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted-2); margin-bottom: 0; }
.auth-flbl .auth-field { margin-top: 6px; }
.auth-field { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 0 14px; height: 52px; }
.auth-field input { flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0; border: none; background: transparent; font-family: var(--font); font-size: 15px; font-weight: 600; color: var(--ink); }
.auth-field input:focus { outline: none; }
.auth-field input::placeholder { color: var(--faint); font-weight: 600; }
.auth-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10); }
.auth-field:focus-within .ficon { stroke: var(--accent); }
.auth-eye { flex: 0 0 auto; border: none; background: transparent; padding: 0; cursor: pointer; display: flex; }
.auth-eye.on svg { stroke: var(--accent); }
.auth-link { background: none; border: none; padding: 0; cursor: pointer; font-family: var(--font); color: var(--accent); font-size: 13px; font-weight: 700; }
.auth-link.lgl { font-size: inherit; }
.verify-ic { font-size: 42px; text-align: center; margin: 4px 0 6px; }
.verify-tx { text-align: center; color: var(--muted); font-size: 14.5px; line-height: 1.55; margin: 0 0 20px; }
.local-note { display: flex; gap: 8px; align-items: flex-start; background: var(--accent-soft); color: var(--navy); border-radius: var(--radius-sm); padding: 11px 13px; font-size: 13px; line-height: 1.45; font-weight: 600; margin: 0 0 16px; }
.local-note i { color: var(--accent); font-size: 16px; flex: 0 0 auto; margin-top: 1px; }
.local-note strong { font-weight: 800; }
.auth-link-row { text-align: right; padding-right: 2px; }

/* liens légaux (réglages) */
.legal-links { margin: 22px 2px 6px; text-align: center; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 8px; }
.legal-links .auth-link { color: var(--muted-2); font-weight: 600; font-size: 12.5px; }
.legal-links span { color: var(--faint); font-size: 12.5px; }

/* pages légales */
main.legal { max-width: var(--maxw); margin: 0 auto; padding: 4px 16px 40px; }
main.legal h3 { font-size: 15px; color: var(--ink); margin: 22px 0 7px; }
main.legal p, main.legal li { font-size: 14px; line-height: 1.6; color: var(--ink); margin: 0 0 10px; }
main.legal ul { padding-left: 20px; margin: 0 0 12px; }
main.legal li { margin-bottom: 5px; }
main.legal b { font-weight: 700; }
main.legal .legal-note { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 12.5px; color: var(--navy); font-weight: 600; margin: 6px 0 16px; }

/* corbeille */
main.trash { max-width: var(--maxw); margin: 0 auto; padding: 4px 16px 40px; }
.trash-note { font-size: 13px; line-height: 1.5; color: var(--navy); background: var(--accent-soft); border-radius: var(--radius-sm); padding: 12px 14px; margin: 4px 0 14px; font-weight: 600; }
.trash-card { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.trash-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.trash-txt { min-width: 0; }
.trash-txt h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trash-txt p { margin: 1px 0 0; font-size: 12.5px; color: var(--muted-2); }
.trash-exp { display: block; margin-top: 3px; font-size: 11.5px; color: var(--faint); font-weight: 600; }
.trash-restore { flex: 0 0 auto; width: auto; height: 42px; padding: 0 16px; font-size: 14px; gap: 6px; }
.auth-msg { margin-top: 14px; }
.auth-submit { margin-top: 18px; }
.auth-sep { display: flex; align-items: center; gap: 12px; margin: 18px 0; }
.auth-sep i { flex: 1; height: 1px; background: var(--line-2); }
.auth-sep span { font-size: 12px; color: var(--faint); font-weight: 600; }
.auth-social { display: flex; gap: 10px; }
.auth-soc { flex: 1; height: 52px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-2); display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font); font-size: 14px; font-weight: 700; color: var(--ink); cursor: pointer; }
.auth-soc:active { background: var(--track); }
.auth-foot { margin-top: auto; padding: 18px 0 8px; text-align: center; font-size: 13.5px; color: var(--muted); }

/* jauge de robustesse du mot de passe */
.auth-strength { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-left: 2px; }
.auth-strength .bars { display: flex; gap: 4px; flex: 1; }
.auth-strength .bars i { flex: 1; height: 4px; border-radius: var(--pill); background: var(--line-2); }
.auth-strength .bars i.on { background: var(--success); }
.auth-strength .lbl { font-size: 11px; font-weight: 700; color: var(--success); }

/* case à cocher CGU */
.auth-cgu { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; cursor: pointer; }
.auth-cgu input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; } /* masqué mais focusable (clavier/lecteur d'écran) */
.auth-cgu input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.auth-cgu .box { width: 22px; height: 22px; flex: 0 0 auto; margin-top: 1px; border-radius: 7px; border: 1.5px solid #C5CEDE; background: var(--surface); display: flex; align-items: center; justify-content: center; }
.auth-cgu .box svg { opacity: 0; }
.auth-cgu input:checked + .box { background: var(--accent); border-color: var(--accent); }
.auth-cgu input:checked + .box svg { opacity: 1; }
.auth-cgu .txt { font-size: 11.5px; line-height: 1.45; color: var(--muted); }

/* ============================================================
   Écran de connexion « split-screen » (reproduction Connexion-reference)
   Téléphone : empilé (marque + feuille). iPad/ordinateur : 2 panneaux.
   position:fixed → plein écran (échappe au conteneur centré du bureau).
   ============================================================ */
.login { position: fixed; inset: 0; display: flex; flex-direction: column; background: #0B2240; overflow: hidden; }
.lg-brand { position: relative; overflow: hidden; flex: none; background: #0B2240; color: #EAF3FF; padding: calc(40px + env(safe-area-inset-top, 0px)) 30px 26px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.lg-bp { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; pointer-events: none; }
.lg-logo { position: relative; display: flex; align-items: center; gap: 11px; font-size: 23px; font-weight: 800; letter-spacing: -.03em; color: #EAF3FF; }
.lg-logo svg { width: 30px; height: 30px; flex: 0 0 auto; }
.lg-pitch { position: relative; margin-top: 16px; }
.lg-tagline { font-size: 14px; color: #8FA6C6; }
.lg-h1, .lg-bsub, .lg-pills { display: none; }
.lg-h1 { font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.lg-bsub { color: #A9BBD4; line-height: 1.5; }
.lg-pill { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); border-radius: 99px; padding: 8px 14px; font-size: 13px; font-weight: 600; color: #C7D6EC; }

.lg-form { flex: 1; min-height: 0; overflow: auto; background: #F4F7FB; color: #0B2240; border-radius: 30px 30px 0 0; margin-top: 8px; display: flex; flex-direction: column; padding: 28px 26px calc(10px + env(safe-area-inset-bottom, 0px)); }
.lg-card { width: 100%; max-width: 430px; margin: 0 auto; display: flex; flex-direction: column; flex: 1; }
.lg-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.lg-subtitle { display: none; font-size: 14.5px; color: #6B7794; margin-top: 6px; }
.lg-fields { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.lg-flbl { display: none; font-size: 12.5px; font-weight: 700; color: #8B95AC; margin: 2px 0 -5px 2px; }
.lg-field { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #E4EAF3; border-radius: 13px; padding: 0 15px; height: 54px; }
.lg-field input { flex: 1; min-width: 0; border: none; background: transparent; font: 600 15px var(--font); color: #0B2240; height: 100%; }
.lg-field input:focus { outline: none; }
.lg-field input::placeholder { color: #9BA4BB; font-weight: 600; }
.lg-field:focus-within { border-color: #2563EB; box-shadow: inset 0 0 0 1px #2563EB; }
.lg-field:focus-within .ficon { stroke: #2563EB; }
.lg-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lg-remember { display: none; align-items: center; gap: 8px; font-size: 13px; color: #5A678A; font-weight: 600; }
.lg-check { width: 18px; height: 18px; flex: 0 0 auto; border-radius: 5px; background: #2563EB; display: flex; align-items: center; justify-content: center; }
.lg-row .auth-link { margin-left: auto; }
.lg-submit { margin-top: 18px; border-radius: 15px; }
.lg-sep { display: flex; align-items: center; gap: 12px; margin: 18px 0; }
.lg-sep i { flex: 1; height: 1px; background: #E4EAF3; }
.lg-sep span { font-size: 12px; color: #9BA4BB; font-weight: 600; }
.lg-social { display: flex; gap: 11px; }
.lg-social .auth-soc { border-radius: 13px; }
.lg-foot { margin-top: auto; padding: 22px 0 6px; text-align: center; font-size: 13.5px; color: #6B7794; }

/* iPad portrait : marque en haut (42%) + formulaire dessous */
@media (min-width: 700px) and (orientation: portrait) {
  .lg-brand { height: 42vh; align-items: flex-start; text-align: left; padding: 48px 50px; }
  .lg-pitch { margin-top: auto; }
  .lg-tagline { display: none; }
  .lg-h1 { display: block; font-size: 34px; }
  .lg-bsub { display: block; font-size: 15.5px; margin-top: 14px; max-width: 440px; }
  .lg-form { border-radius: 0; margin-top: 0; align-items: center; justify-content: center; }
  .lg-card { flex: none; }
  .lg-subtitle, .lg-flbl, .lg-remember { display: block; }
  .lg-remember { display: flex; }
}

/* iPad paysage + ordinateur : deux panneaux côte à côte */
@media (orientation: landscape) and (min-width: 900px) {
  .login { flex-direction: row; }
  .lg-brand { width: 46%; max-width: 620px; height: auto; align-items: flex-start; text-align: left; padding: 48px; }
  .lg-pitch { margin-top: auto; }
  .lg-tagline { display: none; }
  .lg-h1 { display: block; font-size: 38px; }
  .lg-bsub { display: block; font-size: 16px; margin-top: 16px; max-width: 430px; }
  .lg-pills { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 24px; }
  .lg-form { flex: 1; border-radius: 0; margin-top: 0; align-items: center; justify-content: center; padding: 48px; }
  .lg-card { flex: none; max-width: 400px; }
  .lg-subtitle, .lg-flbl { display: block; }
  .lg-remember { display: flex; }
}
@media (orientation: landscape) and (min-width: 1200px) {
  .lg-brand { width: 620px; padding: 56px 56px 48px; }
  .lg-h1 { font-size: 42px; }
}

/* ---------- transition d'entrée des écrans ---------- */
@keyframes screenIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#view > header.bar, #view > .home-head, #view > main { animation: screenIn 0.22s ease both; }
@media (prefers-reduced-motion: reduce) { #view > * { animation: none !important; } }

/* ---------- menu déroulant (3 points du détail chantier) ---------- */
.menu-backdrop { position: fixed; inset: 0; z-index: 19; }
.menu-pop {
  position: fixed; z-index: 20;
  top: calc(58px + env(safe-area-inset-top, 0px));
  right: max(16px, calc((100vw - var(--maxw)) / 2 + 16px));
  min-width: 222px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: 0 14px 34px rgba(11, 34, 64, 0.18);
  animation: screenIn 0.16s ease both;
}
.menu-pop button {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 12px; border: none; background: transparent; border-radius: 10px;
  font-family: var(--font); font-size: 14.5px; font-weight: 600; color: var(--ink);
  text-align: left; cursor: pointer;
}
.menu-pop button i { font-size: 18px; color: var(--muted); }
.menu-pop button:active { background: var(--track); }
.menu-pop button.danger, .menu-pop button.danger i { color: var(--danger); }

/* ---------- écran : exporter le relevé ---------- */
.doc-preview {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: 0 6px 18px rgba(11, 34, 64, 0.06); margin-top: 4px;
}
.doc-preview .dp-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 11px; border-bottom: 1px solid var(--track); }
.doc-preview .dp-brand { display: flex; align-items: center; gap: 8px; }
.doc-preview .dp-brand svg { width: 16px; height: 16px; flex: 0 0 auto; }
.doc-preview .dp-brand b { font-size: 13px; font-weight: 800; letter-spacing: -0.01em; }
.doc-preview .dp-date { font-size: 10px; font-weight: 600; color: var(--faint); }
.doc-preview .dp-title { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; margin-top: 11px; }
.doc-preview .dp-meta { font-size: 11px; color: var(--muted-2); margin-top: 2px; }
.doc-preview .dp-body { display: flex; gap: 8px; margin-top: 12px; }
.doc-preview .dp-schema { width: 58px; height: 62px; flex: 0 0 auto; border-radius: 8px; background: var(--bg); border: 1px solid var(--track); display: flex; align-items: center; justify-content: center; }
.doc-preview .dp-lines { flex: 1; display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.doc-preview .dp-lines i { display: block; height: 7px; background: var(--track); border-radius: var(--pill); }
.doc-preview .dp-cells { display: flex; gap: 6px; margin-top: 9px; }
.doc-preview .dp-cells i { flex: 1; height: 36px; background: var(--track); border-radius: 7px; }

.opt-list { display: flex; flex-direction: column; gap: 8px; }
.opt-row { display: flex; align-items: center; gap: 11px; padding: 12px 13px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xs); }
.opt-row:active { border-color: var(--accent-soft); }
.opt-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.opt-row .ic { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 9px; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 17px; }
.opt-row.off .ic { background: var(--track); color: var(--muted-2); }
.opt-row .grow { flex: 1; min-width: 0; }
.opt-row h4 { margin: 0; font-size: 13.5px; font-weight: 700; }
.opt-row p { margin: 1px 0 0; font-size: 11px; color: var(--faint); }
.toggle { width: 42px; height: 26px; flex: 0 0 auto; border-radius: var(--pill); background: #D4DBE6; position: relative; transition: background 0.18s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: var(--pill); background: #fff; box-shadow: 0 1px 2px rgba(11, 34, 64, 0.2); transition: left 0.18s; }
.opt-row:not(.off) .toggle { background: var(--accent); }
.opt-row:not(.off) .toggle::after { left: 19px; }

.export-actions { display: flex; gap: 10px; }
.btn.dl56 { width: 56px; height: 56px; flex: 0 0 auto; padding: 0; border-radius: var(--radius-btn); color: var(--accent); border: 1px solid var(--line-2); background: var(--surface); }
.export-actions .btn.primary { flex: 1; width: auto; }

/* ============================================================
   Responsive — tablette & ordinateur (le mobile reste intact).
   Tout est derrière min-width : en dessous de 700px, rien ne change.
   ============================================================ */
@media (min-width: 700px) {
  :root { --maxw: 720px; }
  /* accueil : chantiers en grille */
  .chantier-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
  .chantier-list .card { margin-bottom: 0; }
  /* étage : châssis en tuiles (schéma au centre, repère/cotes dessous, quantité en haut) */
  .chassis-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
  .chassis-list .card { flex-direction: column; align-items: stretch; text-align: center; position: relative; margin-bottom: 0; padding: 16px; gap: 0; }
  .chassis-list .card .pill { order: 0; align-self: flex-end; }
  .chassis-list .card .thumb { order: 1; width: 100%; height: 116px; display: flex; align-items: center; justify-content: center; margin: 8px 0 6px; }
  .chassis-list .card .thumb svg { width: auto; height: 100%; max-width: 100%; }
  .chassis-list .card .grow { order: 2; }
  .chassis-list .card h3 { font-size: 15px; }
  .chassis-list .card p { white-space: normal; }
  .chassis-list .card .chev { display: none; }
}
@media (min-width: 1024px) {
  :root { --maxw: 980px; }
  /* éditeur en deux panneaux : croquis + aperçu | composition (cf. maquette refonte) */
  .editor-grid { display: grid; grid-template-columns: minmax(0, 46%) 1fr; gap: 24px; align-items: start; }
  .ed-left { position: sticky; top: 12px; }
  .chassis-list { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
}

/* ---------- bureau (≥1100px) : barre latérale navy + maître-détail ----------
   Activé par la classe body.has-desknav (posée seulement ≥1100 hors auth). */
#desknav { display: none; }
body.has-desknav #desknav { display: flex; }
body.has-desknav .app { margin: 0 0 0 236px; max-width: none; display: flex; flex-direction: column; min-height: 100vh; }
body.has-desknav .fab { left: 236px; width: calc(100% - 236px); transform: none; }
body.has-desknav .update-bar { left: 236px; width: calc(100% - 236px); transform: none; }
body.has-desknav .menu-pop { right: 24px; top: 64px; }

#desknav {
  position: fixed; left: 0; top: 0; bottom: 0; width: 236px; z-index: 8;
  flex-direction: column; padding: 22px 16px; background: var(--navy); color: #fff;
}
.dn-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 24px; font-size: 21px; font-weight: 800; letter-spacing: -0.03em; color: #EAF3FF; }
.dn-brand svg { width: 26px; height: 26px; flex: 0 0 auto; }
.dn-nav { display: flex; flex-direction: column; gap: 3px; }
.dn-link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: none; border-radius: 11px; background: transparent; color: #8FA6C6; font: 600 14.5px var(--font); cursor: pointer; text-align: left; }
.dn-link i { font-size: 19px; }
.dn-link.on { background: rgba(84, 168, 255, 0.14); color: #EAF3FF; font-weight: 700; }
.dn-foot { margin-top: auto; }
.dn-sync { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: #8FA6C6; padding: 0 6px; }
.dn-sync i { color: var(--highlight); }

.dk-top { flex: none; display: flex; align-items: center; gap: 18px; padding: 16px 26px; border-bottom: 1px solid var(--line); background: var(--surface); }
.dk-top h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.dk-top .dk-newp { width: auto; height: 42px; margin-left: auto; border-radius: 12px; padding: 0 16px; font-size: 14.5px; }
.dk-body { flex: 1; display: flex; min-height: 0; }
.dk-list { width: 340px; flex: none; border-right: 1px solid var(--line); background: var(--surface); padding: 14px 12px; overflow: auto; }
.dk-citem { display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; cursor: pointer; }
.dk-citem.on { background: #F4F8FF; border-color: var(--accent); }
.dk-citem h3 { margin: 0; font-size: 15px; font-weight: 700; }
.dk-citem p { margin: 1px 0 0; font-size: 12px; color: var(--muted-2); }
.dk-detail { flex: 1; min-width: 0; padding: 22px 26px 40px; overflow: auto; }
.dk-dhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.dk-dhead h1 { font-size: 25px; font-weight: 800; letter-spacing: -0.025em; margin: 0; }
.dk-acts { display: flex; gap: 9px; flex: none; }
.dk-acts .btn { width: auto; height: 40px; padding: 0 14px; font-size: 13.5px; border-radius: 11px; }
.dk-acts .iconbtn { width: 40px; height: 40px; }
.dk-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 4px 0 16px; }
.dk-chip { border: none; border-radius: 10px; padding: 8px 14px; font: 600 13px var(--font); background: var(--track); color: #5A678A; cursor: pointer; }
.dk-chip.on { background: var(--navy); color: #fff; font-weight: 700; }
.dk-chip.add { background: var(--surface); border: 1px solid var(--line); color: var(--accent); display: inline-flex; align-items: center; gap: 5px; font-weight: 700; }
.dk-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 50vh; color: var(--muted-2); gap: 10px; }
.dk-empty i { font-size: 40px; opacity: 0.45; }

/* ---------- impression / export PDF (planche technique de marque) ---------- */
#print-root { display: none; }
@page { size: A4; margin: 0; }
@media print {
  body * { visibility: hidden; }
  #print-root, #print-root * { visibility: visible; }
  #print-root { display: block; position: absolute; inset: 0; padding: 0; }
  /* l'app (#view) est retirée du flux : seul #print-root s'imprime (évite des pages blanches) */
  .app, .fab, header.bar, .home-head, .update-bar, .menu-pop, .menu-backdrop, .splash { display: none !important; }
}
.pdf { color: #0B2240; font-family: var(--font); }
/* une planche = une page A4 (en-tête en haut, pied ancré en bas) */
.pdf-sheet { width: 210mm; min-height: 296mm; padding: 15mm 13mm 12mm; box-sizing: border-box; display: flex; flex-direction: column; }
.pdf-sheet + .pdf-sheet { break-before: page; }

/* en-tête */
.pdf-phead { display: flex; align-items: flex-start; justify-content: space-between; gap: 8mm; }
.pdf-phead .ttl { font-size: 21pt; font-weight: 800; letter-spacing: -0.03em; color: #0B2240; line-height: 1.05; }
.pdf-phead .ttl span { color: #9BA4BB; font-weight: 700; }
.pdf-phead .sub { font-size: 10pt; color: #6B7794; margin-top: 2mm; }
.pdf-brandmark { display: flex; align-items: center; gap: 2mm; flex: 0 0 auto; padding-top: 1mm; }
.pdf-brandmark svg { width: 5mm; height: 5mm; }
.pdf-brandmark b { font-size: 11pt; font-weight: 800; letter-spacing: -0.02em; color: #0B2240; }
.pdf-rule { height: 2px; background: #0B2240; margin-top: 4.5mm; }

/* grille 3 colonnes de menuiseries cotées */
.pdf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5mm 6mm; margin-top: 7mm; }
.pdf-cell { display: flex; flex-direction: column; align-items: center; break-inside: avoid; }
.pdf-cell .draw { width: 100%; height: 46mm; display: flex; align-items: flex-end; justify-content: center; }
.pdf-cell .draw svg { max-width: 100%; max-height: 100%; }
.pdf-cell .leg { font-size: 8.5pt; line-height: 1.4; color: #46506B; text-align: center; margin-top: 2.5mm; }
.pdf-cell .leg b { color: #0B2240; font-weight: 800; }
.pdf-cell .leg .q { color: #2563EB; font-weight: 800; }
.pdf-total { margin-top: 8mm; font-size: 11pt; color: #46506B; }
.pdf-total b { color: #0B2240; font-weight: 800; }

/* notes (chantier / étage) sous l'en-tête de planche */
.pdf-notes { margin-top: 4mm; font-size: 8.5pt; line-height: 1.45; color: #46506B; }
.pdf-notes b { color: #0B2240; font-weight: 700; }
/* commentaire d'un châssis dans sa cellule (hauteur bornée pour préserver la pagination) */
.pdf-cell .cnote { margin-top: 1.5mm; font-size: 7.5pt; line-height: 1.3; color: #6B7794; font-style: italic; text-align: center; max-height: 9mm; overflow: hidden; }

/* pied de page ancré en bas */
.pdf-foot { margin-top: auto; padding-top: 4mm; border-top: 1px solid #EDF1F7; display: flex; justify-content: space-between; gap: 6mm; font-size: 7.5pt; color: #9BA4BB; }

/* tableau de métré (page optionnelle) */
.pdf-mtable { width: 100%; border-collapse: collapse; font-size: 9pt; margin-top: 8mm; }
.pdf-mtable th { text-align: left; font-size: 8pt; text-transform: uppercase; letter-spacing: 0.04em; color: #8B95AC; border-bottom: 1.5px solid #0B2240; padding: 2mm 2mm 1.5mm; }
.pdf-mtable td { border-bottom: 1px solid #E9EDF4; padding: 2mm; }
.pdf-mtable th.num, .pdf-mtable td.num { text-align: right; white-space: nowrap; }
.pdf-mtable tfoot td { font-weight: 800; border-bottom: none; border-top: 1.5px solid #0B2240; }

/* ---- export « fiche » : en-tête navy de marque + un bloc par menuiserie ---- */
.pdf, .pdf * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pdf-hero { background: #0B2240; color: #fff; margin: -15mm -13mm 7mm; padding: 13mm 13mm 10mm; }
.pdf-hero-top { display: flex; align-items: center; justify-content: space-between; }
.pdf-hero-brand { display: flex; align-items: center; gap: 2mm; font-size: 13pt; font-weight: 800; letter-spacing: -0.02em; }
.pdf-hero-brand svg { width: 5mm; height: 5mm; }
.pdf-hero-ref { font-size: 8.5pt; color: #8FA6C6; }
.pdf-hero-ttl { font-size: 21pt; font-weight: 800; letter-spacing: -0.03em; margin-top: 6mm; }
.pdf-hero-sub { font-size: 10pt; color: #A9BBD4; margin-top: 1.5mm; }
.pdf-hero-stats { display: flex; gap: 2.5mm; margin-top: 6mm; }
.pdf-hstat { background: rgba(255, 255, 255, 0.08); border-radius: 2.5mm; padding: 2.5mm 4mm; }
.pdf-hstat .n { font-size: 15pt; font-weight: 800; }
.pdf-hstat .n.hl { color: #54A8FF; }
.pdf-hstat .l { font-size: 7.5pt; color: #8FA6C6; margin-top: 0.5mm; }

.pdf-contbar { display: flex; align-items: center; gap: 2mm; font-size: 10pt; font-weight: 800; color: #0B2240; padding-bottom: 3mm; border-bottom: 1px solid #EDF1F7; margin-bottom: 4mm; }
.pdf-contbar svg { width: 4.5mm; height: 4.5mm; }
.pdf-contbar span { font-weight: 600; color: #9BA4BB; }

.pdf-blocks { flex: 1; }
.pdf-elabel { font-size: 8.5pt; font-weight: 700; color: #9BA4BB; text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 3mm; }
.pdf-block { display: flex; gap: 6mm; break-inside: avoid; align-items: flex-start; }
.pdf-bdraw { width: 44mm; flex: none; display: flex; align-items: flex-start; justify-content: center; }
.pdf-bdraw svg { width: 100%; height: auto; max-height: 62mm; }
.pdf-bmain { flex: 1; min-width: 0; }
.pdf-bhead { display: flex; align-items: center; justify-content: space-between; gap: 6mm; }
.pdf-bhead .t { font-size: 14pt; font-weight: 800; color: #0B2240; }
.pdf-bhead .t .sub { font-size: 10pt; color: #8B95AC; font-weight: 600; }
.pdf-bhead .q { font-size: 9pt; font-weight: 800; color: #2563EB; background: #E8EFFC; padding: 1mm 3mm; border-radius: 99px; white-space: nowrap; }
.pdf-spec { width: 100%; border-collapse: collapse; font-size: 9.5pt; margin-top: 3mm; }
.pdf-spec .k { color: #9BA4BB; padding: 1mm 0; width: 26mm; vertical-align: top; }
.pdf-spec .v { color: #0B2240; font-weight: 700; }
.pdf-spec .v .muted { color: #5A678A; font-weight: 600; }
.pdf-bphoto { display: flex; gap: 3mm; align-items: center; margin-top: 3.5mm; }
.pdf-bphoto img { width: 24mm; height: 21mm; object-fit: cover; border-radius: 2mm; border: 1px solid #E9EDF4; flex: none; }
.pdf-bphoto .cap { font-size: 8pt; color: #8B95AC; line-height: 1.4; }
.pdf-sep { height: 1px; background: #EDF1F7; margin: 5mm 0; }
