:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #1c2330; --muted: #667085; --line: #e3e6ec;
  --off: #eef0f4; --today: #64748b; --accent: #1d4ed8; --warn: #b42318; --ok: #15803d;
  --done: #64748b; --bar-text: #ffffff; --alert-bg: #fff7ed; --head-bg: #fafbfc;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --fs: 14px;
  --label: 230px;
  --hover: color-mix(in srgb, var(--panel) 92%, var(--ink));
  --soft: color-mix(in srgb, var(--accent) 10%, var(--panel));
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: var(--fs)/1.4 var(--font); background: var(--bg); color: var(--ink); }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 7px 12px; }
button:not(.bar):hover { background: var(--hover); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(.92); }
button.primary:disabled { opacity: .5; cursor: not-allowed; }
button.ghost { background: transparent; }
/* Boutons du haut : « Quitter » transparent, d'une autre couleur, pour ne pas surcharger l'écran. */
button.quit { background: transparent; color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
button.quit:hover { background: color-mix(in srgb, var(--warn) 9%, transparent); }
/* « + Équipe ou sous-traitant » : tout près des équipes, juste sous la dernière ligne. */
button.addteam { width: 100%; background: transparent; border-style: dashed; color: var(--muted); font-size: .93em; }
button.addteam:hover { color: var(--accent); border-color: var(--accent); background: var(--soft); }
/* Imprimer : grand bouton en bas à droite. */
.foot .printbig { margin-left: auto; width: 56px; height: 56px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 14px; background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
.foot .printbig:hover { filter: brightness(.92); background: var(--accent); }
button.danger { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--panel)); }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid color-mix(in srgb, var(--line) 70%, var(--muted)); border-radius: 8px; width: 100%; background: var(--panel); color: var(--ink); }
textarea { resize: vertical; }
input[type="color"] { padding: 2px; height: 36px; width: 64px; cursor: pointer; }
input[type="range"] { padding: 0; }
label { display: block; font-size: .93em; color: var(--muted); margin-bottom: 10px; }
label input, label select, label textarea { margin-top: 4px; color: var(--ink); }
label.check { display: flex; gap: 8px; align-items: center; }
label.check input { width: auto; margin: 0; }
.error { color: var(--warn); min-height: 1.2em; margin: 6px 0 0; }
.muted { color: var(--muted); margin: 0 0 10px; }
.hint { color: var(--muted); font-size: .9em; margin: 6px 0; }
.note-view { white-space: pre-wrap; background: var(--bg); border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; }

/* Connexion */
#login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: min(360px, 100%); }
.login-card h1 { margin: 0; font-size: 1.55em; }
.login-card h1 { text-align: center; margin-bottom: 18px; }
.login-card p { margin: 2px 0 18px; color: var(--muted); }
.login-card button { width: 100%; margin-top: 4px; background: var(--accent); color: #fff; border-color: var(--accent); }

/* En-tête et barre d'outils (façon ProGBat) */
.topbar { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.title { display: flex; align-items: center; gap: 14px; }
.title h1 { margin: 0; font-size: 1.3em; }
.sync { font-size: .85em; color: var(--muted); }
.sync.bad { color: var(--warn); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.print-only { display: none; }
.toolbar { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px 20px; align-items: center; padding: 14px 20px 0; }
.tb-left { display: flex; align-items: center; gap: 8px; justify-self: start; }
.tb-left select { width: auto; }
.tb-left #goYear { width: 82px; }
.nav { display: flex; align-items: center; justify-content: center; gap: 10px; }
.nav strong { min-width: 190px; text-align: center; font-size: 1.35em; text-transform: capitalize; }
.viewtools { display: flex; align-items: center; gap: 10px; justify-self: end; }
button.icon { padding: 8px 12px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; font-size: 1.2em; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; padding: 9px 16px; }
.seg button:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.seg button:last-child { border-radius: 0 8px 8px 0; }
.seg button.on { background: var(--accent); color: #fff; border-color: var(--accent); position: relative; z-index: 1; }

/* Recherche (au-dessus des lignes) */
.searchbox { position: relative; width: 100%; }
.searchbox input { width: 100%; margin: 0; }
.searchresults { position: absolute; left: 0; top: calc(100% + 6px); width: min(460px, 86vw); max-height: 340px; overflow: auto; margin: 0; padding: 4px; list-style: none; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(16,24,40,.22); z-index: 30; }
.searchresults li { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.searchresults li:hover, .searchresults li.on { background: var(--soft); }
.searchresults small { display: block; color: var(--muted); }
.searchresults .go { color: var(--accent); font-weight: 600; }
.bar.flash { outline: 3px solid var(--accent); outline-offset: 1px; animation: flash 0.9s ease-in-out 3; }
@keyframes flash { 50% { outline-color: transparent; transform: scale(1.02); } }

/* Alertes */
/* À surveiller : un onglet compact et repliable, pas une bande sur toute la largeur. */
.alerts { margin: 14px 20px 0; width: fit-content; min-width: 280px; max-width: calc(100% - 40px); background: var(--alert-bg); border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--alert-bg)); border-radius: 10px; overflow: hidden; }
button.alerts-toggle { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 14px; border: 0; border-radius: 0; background: transparent; color: var(--warn); font-weight: 600; font-size: .88em; text-transform: uppercase; letter-spacing: .04em; text-align: left; text-decoration: none; }
button.alerts-toggle:hover { background: color-mix(in srgb, var(--warn) 8%, transparent); }
.alerts-toggle .count { background: var(--warn); color: #fff; border-radius: 999px; padding: 0 8px; font-size: .95em; }
.alerts-toggle .chev { margin-left: auto; padding-left: 14px; transition: transform .15s; }
.alerts.open .alerts-toggle .chev { transform: rotate(180deg); }
.alerts ul { margin: 0; padding: 2px 14px 10px; list-style: none; display: grid; gap: 4px; max-height: 190px; overflow: auto; }
.alerts li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.alerts li button { padding: 0; border: 0; background: none; color: var(--accent); text-decoration: underline; text-align: left; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 1em; }
.alerts li button.open { color: var(--muted); font-size: .9em; }
.pill { display: inline-block; font-weight: 700; font-size: .85em; padding: 1px 7px; border-radius: 999px; color: #fff; background: var(--warn); }
.pill.early { background: var(--ok); }
.pill.over { background: color-mix(in srgb, var(--warn) 65%, #000); }

/* Grille */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.workarea { flex: 1 1 auto; min-height: 0; display: flex; gap: 12px; align-items: stretch; margin: 14px 20px 0; }
.grid { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
/* Zone qui défile : les noms d'équipe restent collés à gauche, les dates collées en haut. */
.gscroll { overflow: auto; flex: 1 1 0; min-height: 360px; position: relative; }
.ginner { display: flex; flex-direction: column; min-height: 100%; --total: 1000px; }
.ghead, .row, .gfill { display: grid; grid-template-columns: var(--label) var(--total); }
.ghead { position: sticky; top: 0; z-index: 12; background: var(--head-bg); border-bottom: 1px solid var(--line); }
.headlab { padding: 10px 12px; border-right: 1px solid var(--line); border-left: 5px solid transparent; justify-content: center; z-index: 13 !important; background: var(--head-bg) !important; }
.hline { position: relative; display: flex; font-size: .86em; color: var(--muted); }
.hline.top { height: 1.9em; border-bottom: 1px solid var(--line); }
.hline.days { height: 3.3em; }
.hline > div { flex-shrink: 0; overflow: hidden; white-space: nowrap; padding: 3px 2px; border-left: 1px solid var(--line); text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.hline > div:first-child { border-left: 0; }
.hline.top > div { align-items: flex-start; padding: 5px 6px; font-weight: 600; color: var(--ink); text-transform: capitalize; }
.hline.days .dn { font-size: 1.3em; font-weight: 600; color: var(--ink); line-height: 1.1; }
.hline.days.dense .dn { font-size: 1em; font-weight: 500; }
.hline.days > div.off { background: var(--off); }
.hline.days > div.off .dn { color: color-mix(in srgb, var(--accent) 50%, var(--panel)); font-weight: 500; }
.hline.days .wk { font-size: .78em; color: var(--muted); }
.hline.days > div.mon { border-left: 2px solid color-mix(in srgb, var(--line) 50%, var(--muted)); }
.hline.top > div.wkseg { align-items: center; justify-content: center; padding: 5px 2px; font-size: .8em; letter-spacing: .04em; text-transform: uppercase; color: color-mix(in srgb, var(--accent) 55%, var(--ink)); border-left: 2px solid color-mix(in srgb, var(--line) 50%, var(--muted)); }
.hline.top > div.wkseg:first-child { border-left: 0; }
/* Mois : fond alterné (pair / impair) et trait marqué au 1er, pour voir où un mois commence même en milieu de semaine. */
.hline > div.alt { background: color-mix(in srgb, var(--accent) 6%, var(--head-bg)); }
.hline.days > div.off.alt { background: color-mix(in srgb, var(--accent) 6%, var(--off)); }
.hline > div.m1, .hline.days > div.m1, .hline.top > div.wkseg.m1 { border-left: 2px solid color-mix(in srgb, var(--accent) 60%, var(--line)); }
.weekline.month { border-left: 2px solid color-mix(in srgb, var(--accent) 35%, var(--line)); }
.row { border-bottom: 1px solid var(--line); }
.lab { position: sticky; left: 0; z-index: 8; background: var(--panel); padding: 10px 12px; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; border-left: 5px solid transparent; min-width: 0; }
.row .lab { text-align: left; border-radius: 0; border-top: 0; border-bottom: 0; font: inherit; width: 100%; cursor: pointer; }
.row .lab:hover { background: var(--hover); }
.lab b { font-size: 1.05em; }
.lab small { color: var(--muted); }
.lab .noteflag { color: var(--accent); font-size: .85em; }
/* Les deux boutons d'ajout restent collés en bas de la zone : seules les lignes d'équipes défilent au-dessus. */
.gfill { flex: 1; min-height: 124px; position: sticky; bottom: 0; z-index: 9; background: var(--panel); border-top: 1px solid var(--line); }
.lab.fill { justify-content: flex-end; gap: 10px; padding: 10px; border-left-color: transparent; }
.addwide { width: 100%; background: var(--panel); }
.lane { position: relative; }
.lane.editable { cursor: cell; user-select: none; }
.hoverday { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 9%, transparent); pointer-events: none; z-index: 1; }
.selection { position: absolute; top: 4px; bottom: 4px; background: color-mix(in srgb, var(--accent) 22%, transparent); border: 2px solid var(--accent); border-radius: 6px; pointer-events: none; z-index: 1; }
.weekline { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid color-mix(in srgb, var(--line) 85%, transparent); z-index: 0; pointer-events: none; }
/* Aujourd'hui : colonne grisée et hachurée, placée sous les barres et sans rien cacher. */
.todaycol, .hline > div.today {
  background:
    repeating-linear-gradient(135deg, color-mix(in srgb, var(--today) 50%, transparent) 0 2px, transparent 2px 7px),
    color-mix(in srgb, var(--today) 12%, transparent);
}
.todaycol { position: absolute; top: 0; bottom: 0; z-index: 1; pointer-events: none; box-shadow: inset 1px 0 0 color-mix(in srgb, var(--today) 55%, transparent), inset -1px 0 0 color-mix(in srgb, var(--today) 55%, transparent); }
.hline > div.today .dn { color: var(--ink) !important; font-weight: 800 !important; }

.bar { position: absolute; height: 46px; border-radius: 8px; background-color: color-mix(in srgb, var(--bc, var(--accent)) var(--bar-alpha, 100%), transparent); box-shadow: 0 0 0 1.5px var(--panel); color: var(--bar-text); padding: 4px 8px; overflow: clip; cursor: pointer; z-index: 2; border: 2px solid transparent; font-size: .86em; line-height: 1.25; text-align: left; }
.bar b, .bar span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar:hover { filter: brightness(1.08); }
.bar.unconfirmed { border-style: dashed; border-color: rgba(255,255,255,.9); }
.bar.overrun { --bc: var(--warn) !important; background-image: repeating-linear-gradient(135deg, rgba(0,0,0,.18) 0 8px, transparent 8px 16px); }
.bar.done { opacity: .5; --bc: var(--done) !important; }
/* Barres à fond transparent : seul le fond s'allège ; le contour garde la couleur pleine du chantier, le texte devient sombre. */
.bar.soft { color: var(--ink); border-color: var(--bc); }
.bar.soft.unconfirmed { border-style: dashed; border-color: var(--bc); }
.bar.soft.overrun { background-image: repeating-linear-gradient(135deg, color-mix(in srgb, var(--warn) 28%, transparent) 0 8px, transparent 8px 16px); }
.bar.soft.ghost { background-color: color-mix(in srgb, var(--bc) 30%, var(--panel)); }
.bar.cut-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.bar.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.badges { position: absolute; top: 2px; right: 4px; display: flex; gap: 3px; }
.badges .pill { font-size: .8em; box-shadow: 0 0 0 1px rgba(255,255,255,.7); }
.bar.has-badges .bcontent { max-width: calc(100% - 64px); }

/* Pied de page : bouton « Légende » à gauche (ouvre une carte), grand bouton Imprimer à droite. */
.foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 20px 14px; }
.legendwrap { position: relative; }
button.legendbtn { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 8px 14px; color: var(--muted); background: var(--panel); }
button.legendbtn:hover, button.legendbtn[aria-expanded="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--soft); }
.legendcard { position: absolute; left: 0; bottom: calc(100% + 10px); width: max-content; max-width: min(440px, 86vw); padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 34px rgba(16,24,40,.2); z-index: 40; }
.legendcard[hidden] { display: none; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink); font-size: .9em; }
.chips .sw { margin-right: 0; }
.legendcard .tip { margin: 12px 0 0; color: var(--muted); font-size: .9em; line-height: 1.4; }
.legendcard .tip[hidden] { display: none; }
/* Logo */
.logo { display: block; height: 40px; width: auto; align-self: center; background: #fff; border-radius: 8px; padding: 2px 6px; }
.logo.big { height: 80px; margin: 0 auto 14px; }
.title { align-items: center; }
.sw { display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sw-plan { background: var(--accent); }
.sw-unconfirmed { background: var(--accent); outline: 2px dashed var(--muted); outline-offset: -2px; }
.sw-overrun { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--warn) 60%, #000) 0 4px, var(--warn) 4px 8px); }
.sw-done { background: var(--done); opacity: .6; }
.sw-off { background: color-mix(in srgb, var(--accent) 50%, var(--panel)); height: 6px; vertical-align: 1px; }
.sw-today { width: 14px; background: repeating-linear-gradient(135deg, var(--today) 0 2px, transparent 2px 5px); border: 1px solid var(--today); }

/* Panneau « Chantiers à planifier » */
.todo { width: 330px; flex: none; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.todo[hidden] { display: none; }
.todo-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.todo-head h2 { margin: 0; font-size: 1.05em; }
.todo .count { display: inline-block; background: var(--accent); color: #fff; font-size: .8em; padding: 0 8px; border-radius: 999px; margin-left: 6px; }
.todo .count:empty { display: none; }
.todo .hint { margin: 0; }
.todo-list { list-style: none; margin: 4px 0 0; padding: 0; overflow: auto; display: grid; gap: 8px; align-content: start; flex: 1; }
.todo-card { display: grid; gap: 2px; padding: 9px 11px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; background: var(--panel); cursor: grab; }
.todo-card:hover { background: var(--soft); }
.todo-card:active { cursor: grabbing; }
.todo-card.done { opacity: .65; border-left-color: var(--done); }
.todo-card b { font-size: .98em; }
.todo-card small { color: var(--muted); }
.todo-card .tag { font-size: .8em; color: color-mix(in srgb, var(--accent) 70%, var(--ink)); }
.todo-list .empty { color: var(--muted); padding: 8px 2px; }
.todotab { flex: none; align-self: flex-start; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 74px; padding: 10px 4px; border-radius: 12px; font-size: .8em; color: var(--muted); }
.todotab[hidden] { display: none; }
.todotab.on { background: var(--soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

/* Fenêtres */
dialog { border: 0; border-radius: 14px; padding: 22px; width: min(600px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; box-shadow: 0 20px 60px rgba(16,24,40,.25); background: var(--panel); color: var(--ink); }
dialog::backdrop { background: rgba(16,24,40,.45); }
dialog h2 { margin: 0 0 12px; font-size: 1.3em; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.colorrow { align-items: center; }
.colorrow label { margin: 0; }
.colorrow input[type="color"] { justify-self: end; }
.results { list-style: none; margin: 0 0 10px; padding: 0; max-height: 210px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.results:empty { display: none; }
.results li { padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.results li:last-child { border-bottom: 0; }
.results li:hover { background: var(--soft); }
.results small { display: block; color: var(--muted); }
.chosen { padding: 8px 10px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--panel)); background: var(--soft); border-radius: 8px; margin-bottom: 10px; }
.dialog-actions { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
.spacer { flex: 1; }
.facts { list-style: none; margin: 0 0 14px; padding: 10px 12px; background: var(--bg); border-radius: 8px; display: grid; gap: 3px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.row-actions button { font-size: .93em; }
details.perso { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
details.perso summary { cursor: pointer; color: var(--muted); }
details.perso[open] summary { margin-bottom: 10px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.colors { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
.colors .crow { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink); padding: 3px 0; }
.colors .crow span { font-size: .93em; }

@media (max-width: 720px) {
  :root { --label: 112px; }
  .workarea, .alerts, .foot { margin-left: 8px; margin-right: 8px; }
  .workarea { flex-wrap: wrap; }
  .todo { width: 100%; }
  .topbar { margin: 0; padding: 10px 12px; }
  .toolbar { padding: 10px 12px 0; grid-template-columns: 1fr; justify-items: center; }
  .tb-left, .viewtools { justify-self: center; }
  .nav strong { min-width: 0; font-size: 1.1em; }
  .row2, .colors { grid-template-columns: 1fr; }
}

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  .toolbar, .actions, .sync, #editTip, .printbig, .foot, .legendcard, .alerts, .headlab .searchbox, .gfill .lab button { display: none !important; }
  .print-only { display: block; }
  .topbar { border: 0; padding: 0 0 8px; }
  .grid, .alerts { margin: 8px 0 0; }
  .workarea { margin: 8px 0 0; }
  .todo, .todotab { display: none !important; }
  #app { display: block; min-height: 0; }
  .workarea { display: block; }
  .grid { display: block; }
  .gscroll { height: auto; flex: none; min-height: 0; overflow: visible; }
  .ginner { width: 100% !important; }
  .ghead, .row, .gfill { grid-template-columns: var(--label) 1fr !important; }
  .lab, .ghead, .gfill { position: static; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Déplacer un chantier à la souris */
.lane.editable .bar { cursor: grab; }
.bar.dragging { opacity: .3; }
.bar.ghost { z-index: 60; opacity: .92; pointer-events: none; cursor: grabbing; box-shadow: 0 12px 30px rgba(16,24,40,.35); }
.lane.drop-ok { background: color-mix(in srgb, var(--ok) 10%, transparent); outline: 2px solid color-mix(in srgb, var(--ok) 70%, transparent); outline-offset: -2px; }
.lane.drop-bad { background: color-mix(in srgb, var(--warn) 9%, transparent); outline: 2px solid color-mix(in srgb, var(--warn) 65%, transparent); outline-offset: -2px; }
.dragtip { position: fixed; z-index: 70; max-width: 340px; padding: 8px 12px; border-radius: 10px; font-size: .9em; line-height: 1.35; color: #fff; pointer-events: none; box-shadow: 0 8px 22px rgba(16,24,40,.3); }
.dragtip.ok { background: var(--ok); }
.dragtip.bad { background: var(--warn); }
.dragtip[hidden], .toast[hidden] { display: none; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 80; max-width: min(580px, 92vw); padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--panel); box-shadow: 0 10px 28px rgba(16,24,40,.3); }
.toast.bad { background: var(--warn); color: #fff; }
@media print { .dragtip, .toast { display: none !important; } }

/* Style du fond des chantiers : hachuré et à points (le plein et le transparent passent par la variable --bar-alpha). */
.bar.bs-hatched,
.bar.bs-hatched.soft.overrun {
  background-color: color-mix(in srgb, var(--bc) 8%, transparent);
  background-image: repeating-linear-gradient(135deg, color-mix(in srgb, var(--bc) var(--bar-alpha), transparent) 0 3px, transparent 3px 9px);
}
.bar.bs-dotted,
.bar.bs-dotted.soft.overrun {
  background-color: color-mix(in srgb, var(--bc) 8%, transparent);
  background-image: radial-gradient(color-mix(in srgb, var(--bc) var(--bar-alpha), transparent) 1.7px, transparent 2.1px);
  background-size: 9px 9px;
}
.bar.bs-hatched b, .bar.bs-hatched span,
.bar.bs-dotted b, .bar.bs-dotted span { text-shadow: 0 0 3px var(--panel), 0 0 3px var(--panel); } /* le texte reste lisible sur les motifs */

/* Choix du style dans « Apparence » */
.stylepick { margin: 4px 0 12px; }
.stylepick-title { display: block; font-size: .93em; color: var(--muted); margin-bottom: 6px; }
.stylepick-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stylepick-row button { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px; font-size: .9em; text-align: center; }
.stylepick-row button.on { border-color: var(--accent); background: var(--soft); box-shadow: 0 0 0 1px var(--accent); }
.mini { display: block; height: 26px; border-radius: 6px; border: 2px solid var(--accent); }
.mini.s-solid { background: var(--accent); }
.mini.s-transparent { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.mini.s-hatched { background: color-mix(in srgb, var(--accent) 8%, transparent) repeating-linear-gradient(135deg, var(--accent) 0 3px, transparent 3px 9px); }
.mini.s-dotted { background: color-mix(in srgb, var(--accent) 8%, transparent) radial-gradient(var(--accent) 1.7px, transparent 2.1px) 0 0 / 9px 9px; }
@media (max-width: 720px) { .stylepick-row { grid-template-columns: repeat(2, 1fr); } }

/* Fond propre à un chantier (fiche) */
.stylepick-row.five { grid-template-columns: repeat(5, 1fr); }
.stylepick-row.five button { font-size: .8em; padding: 6px 4px; }
.mini.s-inherit { background: transparent; border-style: dashed; border-color: var(--muted); }
#itOpacityLabel.disabled { opacity: .45; }
.samplewrap { margin: 4px 0 8px; }
.bar.sample { position: relative; width: 100%; cursor: default; pointer-events: none; z-index: 0; }
@media (max-width: 720px) { .stylepick-row.five { grid-template-columns: repeat(3, 1fr); } }

/* Note affichée directement sur la barre (1 ou 2 lignes, le texte complet reste en infobulle). */
.bar .note { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-style: italic; opacity: .96; margin-top: 1px; }

/* Note à droite de la barre : le titre reste à gauche, la note se place à droite sur la même hauteur. */
/* Texte de la barre : un bloc collé à gauche de l'écran (à droite de la colonne des noms) tant qu'une partie de la barre est visible. */
.bcontent { position: sticky; left: calc(var(--label) + 10px); width: fit-content; max-width: 100%; }
/* Note « à droite » : elle suit directement le nom, côte à côte. */
.bcontent.row { display: flex; align-items: center; gap: 14px; height: 100%; }
.bcontent.row .txt { min-width: 0; flex: 0 1 auto; }
.bcontent.row .note { min-width: 0; flex: 0 1 auto; max-width: 52%; margin-top: 0; }

/* Choix de la position de la note dans la fiche */
.stylepick-row.two { grid-template-columns: repeat(2, 1fr); max-width: 320px; }
.minipos { display: block; height: 30px; border-radius: 6px; border: 2px solid var(--accent); background-repeat: no-repeat; }
.minipos.pos-bottom {
  background-image: linear-gradient(var(--ink), var(--ink)), linear-gradient(var(--muted), var(--muted)), linear-gradient(var(--accent), var(--accent));
  background-position: 6px 5px, 6px 12px, 6px 20px;
  background-size: 55% 3px, 35% 3px, 70% 3px;
}
.minipos.pos-right {
  background-image: linear-gradient(var(--ink), var(--ink)), linear-gradient(var(--muted), var(--muted)), linear-gradient(var(--accent), var(--accent));
  background-position: 6px 8px, 6px 15px, right 6px top 11px;
  background-size: 38% 3px, 26% 3px, 34% 3px;
}

/* Avertissement : le serveur qui tourne est plus ancien que la page. */
.stale { background: var(--warn); color: #fff; padding: 10px 20px; text-align: center; line-height: 1.45; }
.stale[hidden] { display: none; }
@media print { .stale { display: none !important; } }
