[hidden] { display: none !important; }
:root {
  /* Charte J.Rod SA (kit visuel v1.0, palette-jrod.css) */
  --brand: #1BAEE4;            /* Bleu J.Rod : aplats, barres, graphiques — jamais pour du texte sur blanc */
  --brand-deep: #1391C2;       /* survols */
  --brand-tint: #E9F7FD;       /* fonds légers, encadrés */
  --bg: #F5F5F7; --panel: #FFFFFF; --text: #1D1D1F; --text-soft: #424245; --muted: #6E6E73; --line: #D2D2D7;
  --accent: #0B6F99; --accent-text: #FFFFFF;   /* Bleu texte : seul bleu lisible en petit corps (5,1:1) */
  --ok: #2e7d4f; --warn: #b7791f; --crit: #b83232; --info: #0B6F99;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0E12; --panel: #141A20; --text: #F5F5F7; --text-soft: #D2D2D7; --muted: #A1A1A6; --line: #2A3138;
    --brand-tint: #10303E; --accent: #1BAEE4; --accent-text: #0A0E12;   /* #1BAEE4 sur Nuit : 8,4:1 */
    --ok: #5cbf86; --warn: #e0a84a; --crit: #e46a6a; --info: #1BAEE4;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", Arial, sans-serif; }
/* Titres : Arial Black, casse normale, interlignage serré (charte §4). */
h1, h2, h3 { font-family: "Arial Black", "Arial Bold", Arial, sans-serif; font-weight: 900; letter-spacing: -0.01em; line-height: 1.15; }
h3 { font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a { color: var(--accent); }
header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); border-top: 4px solid var(--brand); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; font-size: 16px; }
.logo { color: var(--accent); }
nav { display: flex; flex-wrap: wrap; gap: 4px; }
nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; }
nav a.active, nav a:hover { background: var(--brand-tint); color: var(--accent); }
nav .badge { background: var(--crit); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
main { padding: 16px; max-width: 1400px; margin: 0 auto; }
h2 { margin: 4px 0 12px; font-size: 18px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar input[type=search] { flex: 1; min-width: 160px; }
button, .btn { background: var(--accent); color: var(--accent-text); border: 0; border-radius: 6px; padding: 7px 12px; cursor: pointer; font: inherit; }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.danger { background: var(--crit); color: #fff; }
button.ok { background: var(--ok); color: #fff; }
input, select, textarea { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: inherit; width: 100%; }
textarea { min-height: 120px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.kpi .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12px; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
tr.clickable:hover { background: var(--bg); cursor: pointer; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; border: 1px solid var(--line); }
.prop { border-left: 4px solid var(--info); margin-bottom: 10px; }
.prop.attention { border-left-color: var(--warn); }
.prop.critique { border-left-color: var(--crit); }
.prop .meta { color: var(--muted); font-size: 12px; }
.prop pre { white-space: pre-wrap; font: inherit; margin: 8px 0; }
.prop .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot.on { background: var(--ok); } .dot.off { background: var(--crit); }
.plan td, .plan th { text-align: center; min-width: 110px; }
.plan td:first-child, .plan th:first-child { text-align: left; }
.plan td.cell { cursor: pointer; }
.plan td.cell:hover { background: var(--bg); }
.plan .abs { color: var(--warn); font-size: 12px; }
.plan .ch { display: block; background: var(--bg); border-radius: 4px; margin: 2px 0; padding: 2px 4px; font-size: 12px; }
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); width: min(640px, calc(100vw - 32px)); padding: 16px; }
dialog::backdrop { background: rgba(0,0,0,.4); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.form-grid label.wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; max-width: calc(100vw - 32px); }
.muted { color: var(--muted); }
@media (max-width: 600px) { main { padding: 12px 16px; } }
h2 button { font-size: 14px; font-weight: 400; margin-left: 8px; vertical-align: middle; }
#user { margin-left: auto; display: flex; gap: 8px; align-items: center; }
body.auth nav, body.auth #user { display: none; }
.auth-box { max-width: 440px; margin: 40px auto; }
.auth-box ol { padding-left: 20px; }
.err { color: var(--crit); min-height: 1em; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; }
#brand-logo { height: 30px; width: auto; max-width: 140px; object-fit: contain; display: block; }
.brand { display: flex; align-items: center; gap: 4px; }
.auth-logo { text-align: center; margin: 4px 0 14px; font-size: 22px; }
.auth-logo img { max-height: 90px; max-width: 100%; object-fit: contain; }
.logo-preview { border: 1px dashed var(--line); border-radius: 8px; padding: 12px; min-height: 70px; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.logo-preview img { max-height: 90px; max-width: 100%; object-fit: contain; }
input[type=color] { height: 38px; padding: 3px; cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 4px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card h3 { margin: 0 0 10px; font-size: 15px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.kv b.neg { color: var(--crit); }
.ok-text { color: var(--ok); font-weight: 600; }
.week { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 8px; overflow-x: auto; }
.day { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-height: 120px; }
.day.today { border-color: var(--accent); }
.day-h { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.day-h span { font-weight: 700; color: var(--text); }
.entry { border-left: 3px solid var(--warn); background: var(--bg); border-radius: 6px; padding: 5px 7px; margin-bottom: 6px; font-size: 12px; }
.entry.approuve { border-left-color: var(--ok); }
.entry.soumis { border-left-color: var(--info); }
.day .abs { font-size: 12px; color: var(--warn); margin-bottom: 4px; }
@media (max-width: 700px) { .week { grid-template-columns: 1fr; } .day { min-height: 0; } }
button:disabled { opacity: .45; cursor: not-allowed; }
/* ---- Interface dynamique ---- */
.page-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.page-h h2 { margin: 0; }
.back { display: inline-block; margin-bottom: 6px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--accent); }
.grid.tiles { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
a.card { color: inherit; text-decoration: none; transition: transform .12s ease, box-shadow .12s ease, border-color .12s; }
a.card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.07); border-color: var(--accent); }
.kpi.hl { border-left: 4px solid var(--brand); background: var(--brand-tint); }
.kpi.bad { border-left: 4px solid var(--crit); }
.sp { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.small { font-size: 12px; }
.neg, .bad-t { color: var(--crit); }
.row-link { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; border-radius: 6px; }
.row-link.col { flex-direction: column; align-items: stretch; gap: 4px; }
.row-link:hover { background: var(--bg); }
.bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 4px; transition: width .4s ease; }
.bar.warn span { background: var(--warn); }
.bar.crit span { background: var(--crit); }
.bar.done span { background: var(--ok, #2e7d4f); }
.etat { font-size: 13px; white-space: nowrap; }
.etat b { font-weight: 400; }
.etat.present b { color: var(--ok); } .etat.planifie b { color: var(--info); } .etat.absent b { color: var(--warn); } .etat.libre b { color: var(--muted); }
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .fill { fill: var(--brand); }
.chart .mark.hover .fill { fill: var(--brand-deep); }
.chart .mark.hover .fill { opacity: 1; }
.chart .axis { font-size: 11px; fill: var(--muted); }
.chart .base { stroke: var(--line); }
.chart .ref { stroke: var(--muted); stroke-dasharray: 4 4; }
.chart .tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); padding: 4px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap; z-index: 2; }
.data-table summary { font-size: 12px; color: var(--muted); cursor: pointer; margin-top: 4px; }
.data-table table { font-size: 12px; }
details > summary { cursor: pointer; }
.board { display: grid; grid-template-columns: repeat(6, minmax(220px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.col-b { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-height: 120px; }
.col-h { font-weight: 600; font-size: 13px; margin: 2px 4px 8px; display: flex; justify-content: space-between; }
.count { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0 7px; font-size: 12px; }
.ch-card { display: flex; flex-direction: column; gap: 5px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; color: inherit; text-decoration: none; transition: box-shadow .12s, border-color .12s; }
.ch-card:hover { border-color: var(--accent); box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.ch-card.late { border-left: 4px solid var(--crit); }
.empty { text-align: center; padding: 10px; }
.kv.col { flex-direction: column; align-items: stretch; gap: 6px; }
select.inline { width: auto; padding: 3px 6px; }
input[type=range] { padding: 0; accent-color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 2px 9px; font-size: 12px; }
.task { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-bottom: 1px dashed var(--line); cursor: pointer; font-size: 14px; color: var(--text); }
.task input { width: auto; margin-top: 3px; }
.task.done span { text-decoration: line-through; color: var(--muted); }
.inline-form { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.inline-form input[name=titre] { flex: 1 1 200px; }
.inline-form input[type=date] { width: auto; }
.journal-form { display: grid; gap: 6px; margin-bottom: 12px; }
.journal-form textarea { min-height: 70px; }
.journal-form button { justify-self: end; }
.timeline { max-height: 420px; overflow-y: auto; }
.tl { border-left: 3px solid var(--line); padding: 4px 0 10px 10px; margin-left: 4px; }
.tl.probleme { border-left-color: var(--crit); } .tl.reception { border-left-color: var(--ok); } .tl.livraison { border-left-color: var(--info); } .tl.client { border-left-color: var(--warn); }
.tl-h { font-size: 12px; margin-bottom: 2px; }
.attention-card { border-left: 4px solid var(--warn); }
.val-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.val-row .actions { display: flex; gap: 6px; }
.grid.people { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.person { display: flex; flex-direction: column; gap: 7px; }
@media (max-width: 700px) { .board { grid-template-columns: repeat(6, 82vw); } }

/* ---- Documents ---- */
.doc { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.doc-b { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.doc-b a b { overflow-wrap: anywhere; }
.doc-ic { flex: 0 0 44px; height: 44px; border-radius: 8px; background: var(--brand-tint); color: var(--accent); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; display: block; border: 1px solid var(--line); }
.icon-btn { padding: 4px 9px; }
.doc-group { margin-top: 12px; }
.doc-grid .doc { border-bottom: 1px solid var(--line); }
.drop { border: 2px dashed var(--line); border-radius: 10px; padding: 16px; text-align: center; cursor: pointer; background: var(--bg); }
.drop.over { border-color: var(--brand); background: var(--brand-tint); }
.drop input { margin-top: 8px; }

/* Parcours d'un chantier : origine → chantier → suite */
.flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 10px; align-items: start; }
.flow-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.flow-step { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
a.flow-step:hover { border-color: var(--accent); }
.flow-step.cur { background: var(--brand-tint); border-color: var(--accent); }
.flow-t { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.flow-arrow { align-self: center; color: var(--muted); font-size: 20px; }
@media (max-width: 760px) { .flow { grid-template-columns: 1fr; } .flow-arrow { transform: rotate(90deg); justify-self: center; } }
button.chip { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
button.chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* Marges : barres horizontales et total */
.bar-h { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar-h i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.kv.total { border-top: 2px solid var(--text); margin-top: 6px; padding-top: 8px; font-size: 1.05em; }

/* Rapport : histogramme mensuel N / N-1 */
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; height: 140px; margin: 6px 0 12px; }
.mcol { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.mbars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.mbars i { display: block; width: 40%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 1px; }
.mbars i.prev { background: var(--line); }
.mcol span { font-size: 11px; color: var(--muted); }
tr.total td { border-top: 2px solid var(--text); }
@media print { header, nav, .toolbar, button { display: none !important; } .card { break-inside: avoid; } }

/* Prix : courbes achat / vente */
svg.chart { width: 100%; height: auto; }
svg.chart .axis { stroke: var(--line); }
svg.chart text { fill: var(--muted); font-size: 11px; }
.l-achat { stroke: var(--accent); fill: var(--accent); stroke-width: 2; }
.l-vente { stroke: #8a5a00; fill: #8a5a00; stroke-width: 2; }
polyline.l-achat, polyline.l-vente { fill: none; }
.legend .sw { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin: 0 4px 0 10px; }
.legend .sw.l-achat { background: var(--accent); } .legend .sw.l-vente { background: #8a5a00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .l-vente { stroke: #e0a63a; fill: #e0a63a; } :root:not([data-theme="light"]) .legend .sw.l-vente { background: #e0a63a; } }

/* Info-bulle globale */
#gtip { position: fixed; z-index: 50; max-width: min(360px, calc(100vw - 16px)); padding: 8px 10px; border-radius: 8px; background: var(--text); color: var(--bg);
  font-size: 12.5px; line-height: 1.45; pointer-events: none; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
#gtip b { color: inherit; }
[data-tip] { cursor: help; }
a[data-tip], tr[data-tip].clickable, [data-tip].clickable { cursor: pointer; }
/* Coûts consommés / avancement */
.dual { position: relative; height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; margin-top: 4px; }
.dual i { position: absolute; left: 0; height: 50%; border-radius: 3px; }
.dual i.c { top: 0; background: var(--accent); } .dual i.c.crit { background: var(--crit); }
.dual i.a { bottom: 0; background: var(--muted); }

/* ---------- Menu par rubriques + onglets de rubrique ---------- */
nav#nav a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
nav#nav .ic { font-size: 16px; line-height: 1; }
#subnav { display: flex; flex-wrap: nowrap; gap: 4px; padding: 6px 16px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; position: sticky; top: var(--header-h, 58px); z-index: 4; }
#subnav:empty { display: none; }
#subnav a { padding: 6px 12px; border-radius: 16px; color: var(--muted); text-decoration: none; white-space: nowrap; font-size: 14px; }
#subnav a.active { background: var(--accent); color: var(--accent-text); }
#subnav .badge { background: var(--crit); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
body.auth #subnav { display: none; }

/* Grandes actions tactiles (stock). */
.actions-big { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.big-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; font-size: 24px; text-align: left; }
.big-btn b { font-size: 14px; } .big-btn span { font-size: 12px; color: var(--muted); }
.big-btn:hover { border-color: var(--accent); }
table.saisie td { padding: 4px; } table.saisie input { min-width: 0; }

/* ---------- Tablette ---------- */
@media (max-width: 1100px) {
  nav#nav a { padding: 6px 8px; }
  #user .nom { display: none; }
}

/* ---------- Téléphone ---------- */
@media (max-width: 700px) {
  header { padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); gap: 8px; }
  #brand-logo { height: 26px; }
  #user button { padding: 6px 10px; font-size: 13px; }
  nav#nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(var(--n, 6), 1fr); gap: 0;
    background: var(--panel); border-top: 1px solid var(--line); padding: 4px 2px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 10px rgba(0,0,0,.06); }
  nav#nav a { flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 11px; font-weight: 600; border-radius: 8px; position: relative; justify-content: center; }
  nav#nav .ic { font-size: 22px; }
  nav#nav .badge { position: absolute; top: 2px; right: 18%; margin: 0; }
  #subnav { top: var(--header-h, 50px); padding: 6px 12px; }
  main { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
  /* 16 px minimum : Safari ne zoome plus à chaque champ touché. */
  input, select, textarea, button { font-size: 16px; }
  button, .btn { min-height: 40px; }
  .kpi .v { font-size: 19px; }
  .grid.tiles { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .page-h { flex-direction: column; align-items: stretch; }
  .page-h .toolbar { justify-content: flex-start; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid label.wide { grid-column: 1 / -1; }
  dialog { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 16px 16px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  #gtip { max-width: calc(100vw - 24px); }
  /* Tableaux → fiches empilées (sauf planning et tableaux de saisie, qui défilent). */
  .table-wrap table:not(.plan):not(.saisie) thead { display: none; }
  .table-wrap table:not(.plan):not(.saisie) tr { display: block; padding: 8px 4px; border-bottom: 1px solid var(--line); }
  .table-wrap table:not(.plan):not(.saisie) td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 3px 8px; white-space: normal; text-align: right; }
  .table-wrap table:not(.plan):not(.saisie) td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex-shrink: 0; }
  .table-wrap table:not(.plan):not(.saisie) td[data-label=""]::before { content: none; }
  .table-wrap table:not(.plan):not(.saisie) td:first-child { font-weight: 600; text-align: left; }
  .table-wrap table:not(.plan):not(.saisie) td .bar-h { width: 40%; }
  .table-wrap table:not(.plan):not(.saisie) tr.total { background: var(--bg); }
  table.saisie input { font-size: 16px; }
}
@media print { #subnav { display: none !important; } }
/* Graphique automatique au-dessus des tableaux. */
.auto-chart { margin: 10px 0; }
.auto-chart summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.auto-chart[open] summary { margin-bottom: 8px; }
.auto-chart .kv.col { border-bottom: 0; padding: 3px 0; }
tfoot.auto tr.total td { background: var(--bg); border-top: 2px solid var(--text); }
@media (max-width: 700px) { .table-wrap table:not(.plan):not(.saisie) tfoot tr { display: block; } }

/* ---------- Icônes J.Rod (tracé anguleux, couleur du texte) ---------- */
.ico { width: 1.1em; height: 1.1em; vertical-align: -0.18em; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: square; stroke-linejoin: miter; flex-shrink: 0; }
.ico.ok-t { color: var(--ok); } .ico.bad-t { color: var(--crit); }
/* Carreau bleu J.Rod, icône blanche : menu et grandes actions. */
.ico.tuile { width: 26px; height: 26px; padding: 4px; background: var(--brand); color: #fff; border-radius: 3px; stroke-width: 2.4; vertical-align: middle; }
nav#nav .ic { display: inline-flex; }
nav#nav .ico.tuile { width: 22px; height: 22px; padding: 3px; }
nav#nav a:not(.active) .ico.tuile { background: var(--brand-tint); color: var(--accent); }
.big-btn .ico.tuile { width: 34px; height: 34px; padding: 6px; margin-bottom: 6px; }
.auto-chart summary .ico { color: var(--accent); }
button .ico { vertical-align: -0.2em; }
@media (max-width: 700px) { nav#nav .ico.tuile { width: 28px; height: 28px; padding: 5px; } }

/* ---------- Ma journée : lisible d'un coup d'œil, gros boutons ---------- */
.mj { max-width: 720px; margin: 0 auto; }
.mj-bonjour { font-size: 26px; margin-bottom: 2px; }
.mj-date { font-size: 17px; color: var(--muted); margin: 0 0 14px; text-transform: none; }
.mj-chantier, .mj-vehicule, .mj-absence, .mj-vide { margin-bottom: 12px; padding: 16px; }
.mj-chantier { border-left: 6px solid var(--brand); }
.mj-ou { display: flex; gap: 12px; align-items: flex-start; }
.mj-adr { font-size: 22px; font-weight: 800; line-height: 1.2; }
.mj-t { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.mj-v { font-size: 17px; }
.mj-ligne { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.mj-ligne .ico.tuile, .mj-ou .ico.tuile { width: 34px; height: 34px; padding: 6px; flex-shrink: 0; }
.btn { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.mj-go { width: 100%; justify-content: center; font-size: 19px; font-weight: 700; padding: 14px; margin: 12px 0 4px; border-radius: 10px; }
.mj-call { margin-top: 6px; font-size: 16px; padding: 10px 14px; border-radius: 10px; background: var(--ok); }
.mj-code { font-size: 26px; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.mj-km summary { list-style: none; display: inline-flex; margin-top: 8px; } .mj-km summary::-webkit-details-marker { display: none; }
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
.mj-raccourcis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 16px; }
a.big-btn { text-decoration: none; }
.mj-h { margin: 8px 0; }
.mj-jour summary { display: flex; flex-direction: column; gap: 2px; cursor: pointer; font-size: 16px; }
.mj-jour summary span { color: var(--muted); font-size: 14px; }
.mj-jour { margin-bottom: 8px; } .mj-jour .mj-chantier { margin-top: 10px; box-shadow: none; }

/* ---------- Parc automobile ---------- */
.veh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
a.card.veh { color: inherit; text-decoration: none; display: flex; flex-direction: column; gap: 4px; }
a.card.veh:hover { border-color: var(--accent); }
.plaque { font-size: 17px; letter-spacing: .04em; }
.warn-t { color: var(--warn); }
.mj-vehicule .mj-ligne:first-child { border-top: 0; padding-top: 0; }

/* ---------- Planification ---------- */
.chart .fill-est { fill: var(--brand); opacity: .35; }
.chart .cap { stroke: var(--text); stroke-width: 2.5; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; color: var(--muted); }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -2px; margin-right: 4px; }
.legend .sw.fill { background: var(--brand); } .legend .sw.fill-est { background: var(--brand); opacity: .35; } .legend .sw.cap { height: 3px; background: var(--text); vertical-align: 3px; }
.conseil { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.conseil.critique > .ico { color: var(--crit); } .conseil.attention > .ico { color: var(--warn); } .conseil.info > .ico { color: var(--accent); }
.ia-box { background: var(--brand-tint); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
table.gantt td, table.gantt th { min-width: 46px; padding: 4px 6px; font-size: 12px; text-align: center; }
table.gantt td.g-nom { text-align: left; min-width: 220px; white-space: normal; }
table.gantt .g-cell.on { background: color-mix(in srgb, var(--brand) calc(25% + var(--a) * 60%), transparent); color: #fff; font-weight: 700; }
table.gantt .g-cell.tard { outline: 2px solid var(--crit); outline-offset: -2px; }
table.gantt .g-cell .ico { width: .9em; height: .9em; }
.pill.p1 { border-color: var(--crit); color: var(--crit); } .pill.p3 { color: var(--muted); }
button.small { padding: 3px 8px; font-size: 12px; min-height: 0; }
.sg-sem { border-top: 1px solid var(--line); padding: 8px 0; } .sg-sem summary { cursor: pointer; }

/* ---------- Fil d'Ariane, bouton Retour, vue large ---------- */
#fil { display: flex; align-items: center; gap: 10px; max-width: 1400px; margin: 0 auto; padding: 10px 16px 0; }
#fil:empty, body.auth #fil { display: none; }
#fil .retour { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
#fil .ariane { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; min-width: 0; flex: 1; }
#fil .ariane a { color: var(--muted); } #fil .ariane b { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }
#fil .sep { color: var(--line); }
#fil .vue { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
main .back { display: none; } /* remplacé par le bouton Retour du fil d'Ariane */
body.large main, body.large #fil { max-width: none; }
body.large main { padding: 10px 18px; }
body.large th, body.large td { padding: 4px 8px; font-size: 13px; }
body.large .card { padding: 10px 12px; }
body.large .grid { gap: 8px; }
body.large .kpi .v { font-size: 19px; }
/* Formulaires : boutons Annuler / Enregistrer toujours visibles en bas de la fiche. */
dialog { max-height: 90vh; overflow: auto; }
dialog .form-actions { position: sticky; bottom: -16px; background: var(--panel); padding: 10px 0 12px; margin-bottom: -12px; border-top: 1px solid var(--line); z-index: 2; }
@media (max-width: 700px) {
  #fil { padding: 8px 12px 0; }
  #fil .vue span { display: none; }
  #fil .vue { display: none; } /* sur téléphone l'écran est déjà utilisé en entier */
  #fil .ariane { font-size: 13px; }
  #fil .ariane > span:first-child, #fil .ariane > .sep:nth-child(2) { display: none; }
}
@media print { #fil { display: none !important; } }
.form-grid .form-section { grid-column: 1 / -1; margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--accent); text-transform: uppercase; letter-spacing: .03em; }
.form-grid .form-section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
dialog .fermer { padding: 4px 8px; min-height: 0; }
@media (max-width: 700px) { #fil .ariane { flex-wrap: nowrap; overflow: hidden; } #fil .ariane b { max-width: 55vw; } }
.doublons-bandeau { margin-bottom: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.doublons-bandeau .ico { color: var(--warn); }
.dbl { margin: 10px 0; } .dbl-l { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-top: 1px dashed var(--line); cursor: pointer; }
.dbl-autre { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; color: var(--muted); }
/* Tri des colonnes */
th.triable { cursor: pointer; user-select: none; white-space: nowrap; }
th.triable:hover { color: var(--accent); }
th.triable::after { content: ' ↕'; opacity: .3; font-size: 11px; }
th.tri-asc::after { content: ' ▲'; opacity: 1; color: var(--accent); }
th.tri-desc::after { content: ' ▼'; opacity: 1; color: var(--accent); }
.tri-mobile { display: none; }
@media (max-width: 700px) { .tri-mobile { display: block; width: auto; margin: 8px 0 4px; } }
/* Filtres automatiques au-dessus des tableaux */
.filtres-auto { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.filtres-auto input[type=search] { flex: 1; min-width: 180px; }
.filtres-auto select, .filtres-auto input[type=date] { width: auto; }
.filtres-auto label { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.filtres-auto.actif { background: var(--brand-tint); border-radius: 8px; padding: 6px; }
@media (max-width: 700px) { .filtres-auto select, .filtres-auto label { flex: 1 1 45%; } .filtres-auto label input { flex: 1; } }
@media (max-width: 700px) { .table-wrap table:not(.plan):not(.saisie) td:empty { display: none; } }

/* Débiteurs : tuiles cliquables (filtre) et bouton d'import de fichier */
button.card.kpi { text-align: left; color: var(--text); background: var(--panel); border: 1px solid var(--line); font: inherit; cursor: pointer; }
button.card.kpi.on { outline: 2px solid var(--accent); outline-offset: -2px; }
label.button { display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; padding: 7px 12px; cursor: pointer; }
label.button.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
.pill.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); }
.pill.warn { background: color-mix(in srgb, var(--warn, #b45309) 15%, transparent); }
.pill.bad { background: color-mix(in srgb, var(--crit) 15%, transparent); }

/* Indicateur « en direct » (temps réel) */
.live { font-size: 11px; color: var(--ok); margin-right: 8px; display: inline-flex; align-items: center; gap: 4px; }
.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.live.pulse::before { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 30%, transparent); }
@media (max-width: 700px) { .live { font-size: 0; } }

/* App collaborateurs : suivi de chantier, langues */
.mj-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.mj-boutons { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 12px 0; }
button.big-btn { font: inherit; text-align: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.big-btn.danger-btn { border-color: var(--crit); }
.big-btn.danger-btn b { color: var(--crit); }
.big-btn.ok-btn { border-color: var(--ok); }
.big-btn.ok-btn b { color: var(--ok); }
.big-file { display: flex; align-items: center; gap: 8px; padding: 14px; border: 2px dashed var(--line); border-radius: 10px; cursor: pointer; font-weight: 600; }
.big-file input { display: none; }
.j-apercu, .j-photos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.j-apercu img, .j-photos img { width: 92px; height: 92px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.tl.fin { border-left-color: var(--ok); }
.tl.probleme { border-left-color: var(--crit); }
.mj-alerte { display: flex; align-items: center; gap: 8px; border-left: 4px solid var(--warn); text-decoration: none; color: var(--text); flex-wrap: wrap; }
.mj-estim .kv b.neg { color: var(--crit); }
.langues { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 8px; }
.langues .chip { min-height: 36px; }
#j-grav label.chip { display: inline-flex; align-items: center; gap: 4px; }
#j-grav input { width: auto; }
/* Dari : écriture de droite à gauche */
[dir="rtl"] .mj, [dir="rtl"] #view { text-align: right; }
[dir="rtl"] .kv { flex-direction: row-reverse; }
[dir="rtl"] .langues { justify-content: flex-start; }

/* Mon contrat : rubriques de documents */
.dossier-rub { margin-top: 10px; }
.dossier-rub summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.dossier-rub summary .pill { margin-left: auto; }
.mj-alerte-bord { border-left: 4px solid var(--warn); }

/* Planning de l'équipe (collaborateurs) et heures réalisées (direction) */
.pe-jour { margin-top: 10px; }
.pe-jour h3 { text-transform: capitalize; }
.pe-auj { border-left: 4px solid var(--accent); }
.pe-lieu { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.pe-lieu:last-of-type { border-bottom: 0; }
.pe-moi b { color: var(--accent); }
td.cell .realise { font-size: 11px; color: var(--ok); font-weight: 600; }
.cert-apercu { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; max-height: 260px; overflow: auto; font-size: 13px; }
.cert-apercu p { margin: 6px 0; }

/* Clients et offres : simple et lisible */
button.gros, .btn.gros { font-size: 1.05rem; padding: 12px 20px; }
.recherche-grande { width: 100%; font-size: 1.1rem; padding: 14px 16px; margin: 4px 0 12px; }
.cl-liste { display: grid; gap: 8px; }
.cl-carte { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.cl-nom { display: flex; flex-direction: column; text-decoration: none; color: inherit; min-width: 0; }
.cl-nom b { font-size: 1.05rem; }
.cl-actions { display: flex; gap: 6px; flex-shrink: 0; }
.options-piece { margin-top: 10px; }
.options-piece summary { cursor: pointer; padding: 6px 0; }
.etapes-piece { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 12px; flex-wrap: wrap; }
.etapes-piece li { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: .95rem; }
.etapes-piece li span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); color: #fff; font-size: .8rem; font-weight: 700; }
.etapes-piece li.fait span { background: var(--ok); }
.etapes-piece li.encours { border-color: var(--accent); color: var(--text); font-weight: 600; }
.etapes-piece li.encours span { background: var(--accent); }
@media (max-width: 600px) { .etapes-piece li { font-size: .85rem; padding: 6px 10px; } }
