:root {
  --bg: #f5f4f0;
  --panel: #ffffff;
  --ink: #1d2422;
  --muted: #69716d;
  --line: #e8e6e0;
  --line-strong: #d5d2ca;
  --accent: #1f5f56;
  --accent-hover: #184c45;
  --accent-soft: #e6f0ed;
  --warn: #9a5b0b;
  --warn-soft: #fbf1df;
  --danger: #b42318;
  --ok: #2f7d4f;
  --off-day: #f4f3ef;
  --row-h: 36px;
  --label-w: 300px;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(29,36,34,.05), 0 2px 8px rgba(29,36,34,.04);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- En-tête ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 24px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
body.editing .top { box-shadow: inset 0 -3px 0 var(--accent); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--accent); color: #fff; flex: none; }
.logo .ic { width: 28px; height: 28px; stroke-width: 2.6; }
.brand h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand > div { min-width: 0; }
@media (max-width: 1280px) { .brand .upd { display: none; } }
.tabs { display: flex; gap: 4px; margin: 0 auto; padding: 4px; background: var(--off-day); border-radius: 12px; }
.tabs button {
  display: flex; align-items: center; gap: 8px;
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 550; font-size: 14.5px; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); background: rgba(255,255,255,.7); }
.tabs button.active { color: var(--accent); background: #fff; box-shadow: 0 1px 3px rgba(29,36,34,.12); }
.badge {
  display: inline-block; min-width: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--warn-soft); color: var(--warn);
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}
.badge:empty { display: none; }
.actions { display: flex; align-items: center; gap: 12px; flex: none; }
.save-status { font-size: 13px; color: var(--ok); }
.save-status.err { color: var(--danger); }
.top .btn.ghost { border-color: var(--line-strong); color: var(--ink); }
.top .btn.ghost.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Boutons & formulaires ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 7px 14px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink);
  font-size: 14.5px; font-weight: 550; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn .ic { width: 18px; height: 18px; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 5px 11px; font-size: 13.5px; }
.btn.icon { padding: 5px 10px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--off-day); border: 1px solid var(--line); border-radius: 10px; }
.seg button { border: 0; background: transparent; padding: 6px 13px; border-radius: 7px; cursor: pointer; font-size: 13.5px; font-weight: 550; color: var(--muted); }
.seg button:hover { color: var(--ink); }
.seg button.active { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(29,36,34,.12); }

label.field { display: block; margin-bottom: 14px; font-size: 13.5px; color: var(--muted); }
label.field > span { display: block; margin-bottom: 5px; font-weight: 600; color: var(--ink); }
.field input[type=text], .field input[type=date], .field input[type=number], .field input[type=tel],
.field input[type=email], .field input[type=password], .field select, .field textarea, .dep-row select, .dep-row input {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 9px;
  background: #fff; color: var(--ink); font-size: 15px;
}
.field input:focus, .field select:focus, .field textarea:focus, .dep-row select:focus, .dep-row input:focus,
.c-row input:focus, .a-note:focus, .a-name:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.field textarea { min-height: 80px; resize: vertical; }
.field .hint { font-size: 12.5px; margin-top: 5px; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- Barre d'outils ---------- */
main { max-width: 1500px; margin: 0 auto; padding: 22px 24px 48px; }
.view-intro { margin: 0 0 16px; color: var(--muted); font-size: 15px; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); align-items: center; }
.legend i { display: inline-block; vertical-align: middle; margin-right: 5px; }
.legend .lg-bar { width: 22px; height: 10px; border-radius: 3px; background: #868e96; }
.legend .lg-tbc { width: 22px; height: 10px; border-radius: 3px; border: 1.5px dashed #868e96;
  background: repeating-linear-gradient(45deg, #dee2e6 0 4px, transparent 4px 8px); }
.legend .lg-ms { width: 10px; height: 10px; background: #868e96; transform: rotate(45deg); }
.legend .lg-today { width: 2px; height: 14px; background: var(--danger); }

/* ---------- Gantt ---------- */
.gantt {
  position: relative; overflow: auto;
  max-height: calc(100vh - 150px);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.g-inner { position: relative; }
.g-head { position: sticky; top: 0; z-index: 6; display: flex; background: var(--panel); border-bottom: 1px solid var(--line-strong); }
.g-corner {
  position: sticky; left: 0; z-index: 7; flex: none; width: var(--label-w);
  display: flex; align-items: flex-end; padding: 6px 12px;
  background: var(--panel); border-right: 1px solid var(--line-strong);
  font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
.g-tl { position: relative; flex: none; }
.g-tl > div { position: relative; }
.g-months { height: 24px; }
.g-weeks { height: 22px; border-top: 1px solid var(--line); }
.g-days { height: 30px; border-top: 1px solid var(--line); }
.g-tl .m, .g-tl .w, .g-tl .d {
  position: absolute; top: 0; bottom: 0; overflow: hidden; white-space: nowrap;
  border-left: 1px solid var(--line); font-size: 12px;
}
.g-tl .m { padding: 4px 8px; font-weight: 650; text-transform: capitalize; color: var(--ink); }
.g-tl .w { padding: 3px 5px; color: var(--muted); font-size: 11px; }
.g-tl .d { text-align: center; font-size: 10px; line-height: 13px; padding-top: 2px; color: var(--muted); }
.g-tl .d.off { background: var(--off-day); }
.g-tl .d.today { background: var(--danger); color: #fff; font-weight: 700; }

.g-body { position: relative; }
.g-bg, .g-links { position: absolute; top: 0; pointer-events: none; }
.g-bg .off { position: absolute; top: 0; bottom: 0; background: var(--off-day); }
.g-bg .mline { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line-strong); }
.g-bg .today { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--danger); z-index: 1; }
.g-links { z-index: 2; overflow: visible; }
.g-links path { fill: none; stroke: #868e96; stroke-width: 1.4; }

.g-row { position: relative; display: flex; height: var(--row-h); border-bottom: 1px solid var(--line); }
.g-row.lot { background: #fbfaf8; }
.g-label {
  position: sticky; left: 0; z-index: 4; flex: none; width: var(--label-w);
  display: flex; align-items: center; gap: 6px; padding: 0 10px 0 12px;
  background: var(--panel); border-right: 1px solid var(--line-strong);
  font-size: 13.5px; overflow: hidden; cursor: pointer;
}
.g-row.lot .g-label { font-weight: 650; background: #fbfaf8; cursor: default; }
.g-row.task .g-label { padding-left: 28px; }
.g-row.task .g-label:hover .name { text-decoration: underline; }
.g-label .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-label .co { margin-left: auto; font-size: 11px; font-weight: 400; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.tag { flex: none; font-size: 11px; font-weight: 650; padding: 1px 7px; border-radius: 20px; }
.tag.tbc { background: var(--warn-soft); color: var(--warn); }
.tag.todo { background: var(--off-day); color: var(--muted); }
.tag.late { background: #ffe3e3; color: var(--danger); }

.g-track { position: relative; flex: none; }
.bar {
  position: absolute; top: 7px; height: calc(var(--row-h) - 14px); z-index: 3;
  border-radius: 6px; background: var(--c); color: #fff; cursor: pointer;
  display: flex; align-items: center; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.bar:hover { filter: brightness(1.08); box-shadow: 0 0 0 2px rgba(0,0,0,.15); }
.bar span { position: relative; padding: 0 8px; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar.tbc {
  background: repeating-linear-gradient(45deg, var(--c) 0 6px, color-mix(in srgb, var(--c) 70%, #fff) 6px 12px);
  outline: 1.5px dashed color-mix(in srgb, var(--c) 70%, #000); outline-offset: -1.5px;
}
.out-label {
  position: absolute; top: 0; height: var(--row-h); z-index: 3; display: flex; align-items: center;
  font-size: 12px; color: var(--ink); white-space: nowrap; pointer-events: none;
}
.ms {
  position: absolute; top: calc(var(--row-h) / 2 - 8px); width: 16px; height: 16px; z-index: 3;
  background: var(--c); transform: rotate(45deg); border-radius: 2px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.ms.tbc { outline: 1.5px dashed #000; outline-offset: 1px; }
.period {
  position: absolute; top: 9px; height: calc(var(--row-h) - 18px); z-index: 3;
  border-radius: 4px; cursor: pointer;
  background: color-mix(in srgb, var(--c) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  display: flex; align-items: center;
}
.period span { position: sticky; left: calc(var(--label-w) + 6px); padding: 0 6px; font-size: 11px; font-weight: 600; color: color-mix(in srgb, var(--c) 80%, #000); white-space: nowrap; }
.lot-span { position: absolute; top: calc(var(--row-h) / 2 - 3px); height: 6px; border-radius: 3px; background: var(--c); opacity: .35; }

/* ---------- Vue semaine ---------- */
.week-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.week-nav h2 { margin: 0 8px; font-size: 20px; letter-spacing: -.01em; }
.week-nav h2 small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
.banner { padding: 11px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 14.5px; background: var(--accent-soft); color: var(--accent); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.week-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.week-table th, .week-table td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; font-size: 14.5px; }
.week-table tbody tr:last-child td { border-bottom: 0; }
.week-table th.day, .week-table td.day { width: 11%; text-align: center; border-left: 1px solid var(--line); padding: 6px 4px; }
.week-table th { background: #fbfaf8; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.week-table th.day.off { background: var(--off-day); }
.week-table th.day.today { color: var(--danger); }
.week-table tr.group td { background: #fbfaf8; font-weight: 650; }
.week-table tr.group .contact { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 8px; }
.week-table tr.task td:first-child { padding-left: 28px; cursor: pointer; }
.week-table tr.task td:first-child:hover { text-decoration: underline; }
.cell { height: 20px; border-radius: 6px; background: var(--c); }
.cell.tbc { background: repeating-linear-gradient(45deg, var(--c) 0 5px, color-mix(in srgb, var(--c) 65%, #fff) 5px 10px); }
.cell.off { background: var(--off-day); }
.cell-ms { display: inline-block; width: 12px; height: 12px; background: var(--c); transform: rotate(45deg); }
.upcoming { margin-top: 28px; }
.upcoming h3, .section h3 { font-size: 16px; margin: 0 0 8px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14.5px; cursor: pointer; }
.list li:last-child { border-bottom: 0; }
.list li:hover { background: #fbfaf8; }
.list li .meta { margin-left: auto; color: var(--muted); font-size: 13px; text-align: right; }

/* ---------- Entreprises ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.lot-card { position: relative; padding: 18px 20px 16px 24px; overflow: hidden; }
.lot-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.lot-card h3 { margin: 2px 0 2px; font-size: 16px; }
.lot-card .code { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .05em; }
.lot-card .company { margin: 10px 0 4px; font-weight: 600; font-size: 16px; }
.lot-card .company.missing { color: var(--warn); font-weight: 500; font-style: italic; }
.lot-card .line { font-size: 14px; color: var(--muted); margin: 4px 0; }
.lot-card .line a { text-decoration: none; }
.lot-card .notes { font-size: 13px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--muted); }
.lot-card .card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sec-title { font-size: 17px; margin: 8px 0 12px; letter-spacing: -.01em; }
.grid + .sec-head { margin-top: 30px; }
.group-card { --c: var(--accent); }
.lot-card .move { display: flex; gap: 4px; margin-left: auto; }
.lot-card .move .btn { min-width: 34px; padding: 4px 0; }
a.btn { text-decoration: none; color: inherit; }
.project-card { padding: 14px 18px; margin-bottom: 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- Saisie artisan ---------- */
.tabs button.tab-artisan:not(.active) { color: var(--accent); }
.tabs .short { display: none; }
.artisan { max-width: 820px; margin: 0 auto; padding-bottom: 70px; }
.artisan .intro { position: relative; padding: 20px 22px 8px 26px; overflow: hidden; }
.artisan .intro::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--c); }
.artisan .intro .code { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .05em; }
.artisan .intro h2 { margin: 2px 0 10px; font-size: 22px; letter-spacing: -.01em; }
.artisan .intro p { font-size: 15px; line-height: 1.55; margin: 0 0 12px; }
.a-title { font-size: 17px; margin: 28px 0 10px; }
.a-contact { padding: 20px 22px 12px; margin-top: 14px; }
.a-after { margin-top: 3px; font-size: 12px; opacity: .85; }
.a-unsure { margin: 4px 0 8px; color: var(--muted); }
.a-unsure input { width: 18px; height: 18px; accent-color: var(--warn); }
.a-task.unsure .a-unsure { color: var(--warn); font-weight: 600; }
.a-unsure-hint { font-size: 12px; color: var(--warn); margin: -4px 0 10px 26px; }
.a-task.unsure .a-when {
  background: repeating-linear-gradient(45deg, var(--warn-soft) 0 8px, #fff 8px 16px);
  color: var(--warn); outline: 1px dashed var(--warn); outline-offset: -1px;
}
.a-modes { display: grid; gap: 6px; margin-bottom: 12px; }
.a-mode {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 10px; font-size: 15px;
  transition: border-color .15s, background .15s;
}
.a-mode:hover { border-color: var(--accent); }
.a-mode input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.a-mode.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.a-grid .a-dep { grid-column: 1 / -1; }
.a-grid select { font-size: 16px; padding: 9px 10px; min-height: 44px; }
.a-note { width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 9px; font-size: 14.5px; resize: vertical; margin-bottom: 4px; }
.a-del { border: 0; background: none; padding: 6px 0; font-size: 13px; color: var(--muted); text-decoration: underline; cursor: pointer; }
.a-del:hover { color: var(--danger); }
.a-task { position: relative; padding: 18px 20px 14px 26px; margin-bottom: 14px; overflow: hidden; }
.a-task::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.a-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.a-head h3 { margin: 0; font-size: 17px; }
.a-name { flex: 1; font-size: 17px; font-weight: 600; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 9px; }
.a-when { font-size: 14.5px; padding: 10px 13px; border-radius: 9px; margin-bottom: 12px; background: var(--accent-soft); color: var(--accent); }
.a-when.none { background: var(--off-day); color: var(--muted); }
.a-when.warn { background: var(--warn-soft); color: var(--warn); }
.a-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 480px; }
.a-grid input { font-size: 16px; padding: 9px 10px; min-height: 44px; }
.a-task textarea { min-height: 54px; }
.a-agenda { display: flex; align-items: center; gap: 16px; margin-top: 24px; padding: 16px 20px; }
.a-agenda p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.a-agenda .btn { flex: none; min-height: 44px; }
@media (max-width: 720px) {
  .a-agenda { flex-direction: column; align-items: stretch; }
}
.agenda-choices { display: grid; gap: 8px; margin-bottom: 16px; }
.agenda-choice {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line-strong);
  border-radius: 10px; color: inherit; text-decoration: none; background: var(--panel);
}
.agenda-choice:hover { border-color: var(--accent); background: var(--accent-soft); }
.agenda-choice strong { font-size: 15px; }
.agenda-choice span { font-size: 13px; color: var(--muted); }
.a-landmarks { margin-top: 24px; }
.a-landmarks summary { cursor: pointer; font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.a-savebar .btn { min-height: 46px; padding: 10px 22px; font-size: 16px; }
.a-savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  display: flex; justify-content: flex-end; align-items: center; gap: 14px;
  padding: 12px 24px; background: rgba(255,255,255,.95); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(29,36,34,.06);
}
#aState { font-size: 14px; color: var(--warn); }
#aState.saved { color: var(--ok); }

/* ---------- Contacts ---------- */
.c-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 6px; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); align-items: center; }
.c-row [data-c=phone] { grid-column: 1; }
.c-row [data-c=email] { grid-column: 2 / 4; }
.c-row .x { grid-column: 4; grid-row: 1 / span 2; }
.c-row input { width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; font-size: 14px; }
/* Fenêtre étroite : prénom + nom, rôle + téléphone, e-mail */
.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; min-width: 0; }
.modal .c-row { grid-template-columns: 1fr 1fr auto; }
.modal .c-row [data-c=role] { grid-column: 1; }
.modal .c-row [data-c=phone] { grid-column: 2; }
.modal .c-row [data-c=email] { grid-column: 1 / 3; }
.modal .c-row .x { grid-column: 3; grid-row: 1 / span 3; }
.contact-block + .contact-block { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.role { display: inline-block; white-space: nowrap; font-size: 11.5px; padding: 1px 8px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); color: var(--muted); }

/* ---------- Plans ---------- */
.plans-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-bottom: 26px; }
.plan-card { overflow: hidden; display: flex; flex-direction: column; }
.plan-thumb { display: flex; align-items: center; justify-content: center; height: 150px; padding: 10px; overflow: hidden; background: var(--off-day); border-bottom: 1px solid var(--line); color: var(--accent); text-decoration: none; }
.plan-thumb img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; box-shadow: 0 1px 3px rgba(29,36,34,.15); }
.plan-ext { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 650; font-size: 13px; letter-spacing: .04em; }
.plan-ext .ic { width: 44px; height: 44px; stroke-width: 1.4; }
.plan-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.plan-body h3 { margin: 0; font-size: 15.5px; }
.plan-body .line { font-size: 13px; color: var(--muted); }
.plan-actions, .plan-admin { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.plan-actions .btn { flex: 1; }
.plan-admin { padding-top: 10px; border-top: 1px solid var(--line); }

/* ---------- Points à confirmer ---------- */
.section { margin-bottom: 26px; }
.section .card { overflow: hidden; }
.section .why { font-size: 14px; color: var(--muted); margin: -4px 0 8px; }
.empty { color: var(--muted); font-style: italic; padding: 12px; }

/* ---------- Tiroir & modale ---------- */
.backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(29,36,34,.3); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 31;
  width: min(460px, 100vw); overflow-y: auto;
  background: var(--panel); box-shadow: -8px 0 32px rgba(29,36,34,.18);
  padding: 22px 24px 32px;
}
.drawer header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.drawer header h2 { margin: 0; font-size: 20px; flex: 1; letter-spacing: -.01em; }
.drawer .lot-line { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.drawer dl { display: grid; grid-template-columns: 130px 1fr; gap: 10px 12px; margin: 0 0 18px; font-size: 15px; }
.drawer dt { color: var(--muted); }
.drawer dd { margin: 0; }
.drawer .notes { white-space: pre-wrap; background: #fbfaf8; border: 1px solid var(--line); border-radius: 9px; padding: 10px; font-size: 14px; }
.drawer .computed { background: var(--accent-soft); color: var(--accent); border-radius: 9px; padding: 10px 13px; font-size: 14px; margin-bottom: 14px; }
.drawer .computed.warn { background: var(--warn-soft); color: var(--warn); }
.drawer footer { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.drawer footer .spacer { flex: 1; }
.deps { margin-bottom: 12px; }
.deps > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.dep-row { display: grid; grid-template-columns: 1.1fr 1.6fr 64px auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.x { border: 0; background: transparent; cursor: pointer; font-size: 20px; color: var(--muted); line-height: 1; padding: 6px 8px; border-radius: 8px; }
.x:hover { background: var(--off-day); }
.x:hover { color: var(--danger); }

.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(29,36,34,.4); padding: 16px; }
.modal .box { width: min(520px, 100%); max-height: 90vh; overflow-y: auto; background: var(--panel); border-radius: 16px; padding: 24px; box-shadow: 0 24px 60px rgba(29,36,34,.28); }
.modal h2 { margin: 0 0 18px; font-size: 20px; letter-spacing: -.01em; }
.modal .err { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.modal footer .spacer { flex: 1; }
.modal.dialog { z-index: 50; }
.modal.dialog .box { width: min(400px, 100%); }
.dlg-msg { margin: 0 0 18px; font-size: 16px; line-height: 1.5; }
.btn.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---------- Tablette : en-tête resserré ---------- */
@media (max-width: 1100px) {
  .top { gap: 12px; padding-left: 16px; padding-right: 16px; }
  .tabs button { padding: 8px 10px; gap: 6px; }
  .top .btn.ghost span, .save-status { display: none; }
}

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  :root { --label-w: 150px; }
  /* Pas de flou ici : il empêcherait la barre d'onglets de se fixer en bas de l'écran */
  .top { padding: 10px 16px; gap: 10px; justify-content: space-between; background: #fff; backdrop-filter: none; }
  .logo { width: 36px; height: 36px; border-radius: 10px; }
  .logo .ic { width: 25px; height: 25px; }
  .brand .upd { display: none; }
  .brand h1 { font-size: 15.5px; }
  .brand .sub { font-size: 11.5px; }
  .top .btn.ghost { min-height: 36px; padding: 5px 10px; font-size: 13.5px; }
  .top .btn.ghost .ic + span { display: none; }
  .top .btn.ghost.on .ic + span { display: inline; }
  .save-status { display: none; }
  /* Onglets en bas de l'écran, comme une appli de téléphone */
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; margin: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-radius: 0; gap: 2px;
    background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  }
  .tabs button { position: relative; flex: 1; flex-direction: column; gap: 3px; padding: 6px 2px; font-size: 11.5px; border-radius: 10px; min-width: 0; }
  .tabs button span:not(.badge) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tabs button .ic { width: 22px; height: 22px; }
  .tabs button.active { background: var(--accent-soft); box-shadow: none; }
  .tabs .badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; line-height: 18px; font-size: 11px; padding: 0 5px; }
  .tabs.many .long { display: none; }
  .tabs.many .short { display: inline; }
  .tabs.many { gap: 0; padding-left: 2px; padding-right: 2px; }
  .tabs.many button { font-size: 10.5px; padding-left: 1px; padding-right: 1px; }
  main { padding: 16px 16px calc(90px + env(safe-area-inset-bottom)); }
  .view-intro { font-size: 14px; margin-bottom: 12px; }
  .artisan { padding-bottom: 80px; }
  .a-savebar { bottom: calc(64px + env(safe-area-inset-bottom)); padding: 10px 16px; }
  .a-savebar .btn { flex: 1; }
  .gantt { max-height: calc(100vh - 230px); }
  .week-nav h2 { order: -1; width: 100%; margin: 0 0 4px; }
  .g-label .co, .g-label .tag.tbc { display: none; }
  .g-row.task .g-label { padding-left: 16px; }
  .week-table th, .week-table td { padding: 6px; font-size: 13px; }
  .week-table tr.task td:first-child { padding-left: 12px; }
  .row2 { grid-template-columns: 1fr; }
  .dep-row { grid-template-columns: 1fr 1fr; }
  .c-row { grid-template-columns: 1fr 1fr auto; }
  .c-row [data-c=role] { grid-column: 1; }
  .c-row [data-c=phone] { grid-column: 2; }
  .c-row [data-c=email] { grid-column: 1 / 3; }
  .c-row .x { grid-column: 3; grid-row: 1 / span 3; }
}

/* ---------- Impression ---------- */
@media print {
  @page { size: A3 landscape; margin: 10mm; }
  body { background: #fff; }
  .top { position: static; background: #fff; color: #000; border-bottom: 2px solid #000; }
  .tabs, .actions, .toolbar .no-print, .btn { display: none !important; }
  main { padding: 8px 0; }
  .gantt { max-height: none; overflow: visible; border: 0; }
  .g-head, .g-corner, .g-label { position: static; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
