/* AAC Chantier : vert forÃªt, vert pÃ¢le, un accent orange ; titres Ã  empattements ; cartes arrondies Ã  ombre douce.
   Contraste Ã©levÃ© (lisible dehors), cibles tactiles de 48 px, espacements en multiples de 4 px. */
:root {
  --bg: #f4f6f3; --card: #fff; --ink: #14241d; --muted: #5c6b64; --line: #dde5df;
  --brand: #235b49; --deep: #193f34; --brand-ink: #fff; --sage: #e7f0e9; --accent: #c38439;
  --ok: #1d6b45; --ok-bg: #e0f1e6; --warn: #7a4b00; --warn-bg: #fff0d6; --err: #a12626; --err-bg: #fbe4e1; --info-bg: #e7f0e9;
  --radius: 14px; --radius-s: 10px; --tap: 48px; --shadow: 0 10px 30px rgba(31,65,51,.07);
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 17px/1.5 var(--sans); color: var(--ink); background: var(--bg); overflow-x: hidden; }
a { color: var(--brand); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; color: var(--deep); text-wrap: balance; }
h1 { font-size: 1.9rem; line-height: 1.15; margin: .25rem 0 1rem; }
h2 { font-size: 1.3rem; line-height: 1.2; margin: 0 0 .75rem; }
h3 { font-size: 1.1rem; margin: 1rem 0 .5rem; }
p { margin: 0 0 .75rem; }

/* ---- Bandeaux, en-tÃªte, navigation ---- */
#mode-banner { background: #fff3df; color: var(--warn); font-weight: 700; font-size: .9rem; text-align: center; padding: 8px 16px; position: sticky; top: 0; z-index: 30; border-bottom: 1px solid #f1d9ae; }
#top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; background: var(--deep); color: var(--brand-ink); padding: 12px 20px; }
#top a { color: var(--brand-ink); }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; line-height: 1.1; }
.brand .logo { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28); font: 700 1.2rem var(--serif); }
.brand small { display: block; font: 600 .68rem var(--sans); letter-spacing: .14em; text-transform: uppercase; opacity: .75; margin-top: 3px; }
.brand b { font: 700 1.05rem var(--serif); }
#nav { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
#nav a { text-decoration: none; padding: 8px 14px; border-radius: 999px; min-height: 40px; display: inline-flex; align-items: center; font-weight: 600; }
#nav a.active, #nav a:hover { background: rgba(255,255,255,.16); }
#who { font-size: .9rem; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#who button { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.55); box-shadow: none; }
main { max-width: 1200px; margin: 0 auto; padding: 24px 20px; outline: none; }
#foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 16px 16px 32px; }
#pending { background: var(--warn-bg); color: var(--warn); border-bottom: 2px solid var(--warn); padding: 12px 20px; }
.pending-row { margin-top: 8px; }
#toasts { position: fixed; bottom: 16px; left: 12px; right: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; max-width: 640px; margin: 0 auto; }
.toast { pointer-events: auto; padding: 14px 44px 14px 16px; border-radius: var(--radius); font-weight: 600; position: relative; box-shadow: 0 14px 40px rgba(0,0,0,.2); border: 1px solid; }
.toast.ok { background: var(--ok-bg); color: var(--ok); border-color: #b7dcc3; }
.toast.warn { background: var(--warn-bg); color: var(--warn); border-color: #f1d9ae; }
.toast.err { background: var(--err-bg); color: var(--err); border-color: #efbdb7; }
.toast-x { position: absolute; right: 8px; top: 8px; background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: inherit; }

/* Bureau sur grand Ã©cran : navigation Ã  gauche (le rÃ´le choisit la classe, la largeur choisit la disposition). */
@media (min-width: 960px) {
  body.office { display: grid; grid-template-columns: 248px minmax(0, 1fr); grid-template-areas: "banner banner" "top pending" "top main" "top foot"; align-items: start; }
  body.office > #mode-banner { grid-area: banner; }
  body.office > #top { grid-area: top; position: sticky; top: 0; height: 100vh; flex-direction: column; align-items: stretch; flex-wrap: nowrap; padding: 24px 16px; gap: 24px; }
  body.office > #pending { grid-area: pending; }
  body.office > main { grid-area: main; width: 100%; }
  body.office > #foot { grid-area: foot; }
  body.office #nav { flex: 0 0 auto; flex-direction: column; flex-wrap: nowrap; }
  body.office #nav a { border-radius: 12px; padding: 10px 14px; }
  body.office #who { margin-top: auto; flex-direction: column; align-items: stretch; }
  body.office #who a { opacity: .8; }
}

/* ---- Cartes, grilles ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.error { border-color: var(--err); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.spread { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.empty { border: 1.5px dashed #b9c8bf; background: transparent; border-radius: var(--radius); padding: 28px 20px; text-align: center; color: var(--muted); margin-bottom: 16px; }
.empty strong { display: block; color: var(--deep); font: 700 1.1rem var(--serif); margin-bottom: 4px; }

/* ---- Boutons ---- */
.btn { min-height: var(--tap); padding: 10px 18px; border-radius: 12px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font: 700 1rem var(--sans); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 1px 2px rgba(25,63,52,.3); }
.btn:hover { background: var(--deep); border-color: var(--deep); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn.ghost { background: var(--sage); color: var(--deep); border-color: #c5d6ca; box-shadow: none; }
.btn.ghost:hover { background: #d9e8dd; }
.btn.big { min-height: 64px; font-size: 1.1rem; width: 100%; }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: .92rem; border-radius: 10px; }
.btn.danger { background: var(--err); border-color: var(--err); }
.btn.success { background: var(--ok); border-color: var(--ok); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
a.card:active, .btn:active { filter: brightness(.9); transform: translateY(1px); }
label.btn { font-weight: 700; }

/* ---- Formulaires ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-weight: 600; }
.field small { font-weight: 400; color: var(--muted); }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid #c3d0c8; border-radius: 12px; background: #fff; color: var(--ink); min-height: var(--tap); width: 100%; max-width: 100%; }
textarea { min-height: 96px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 24px; height: 24px; min-height: 24px; accent-color: var(--brand); }
.check { display: flex; align-items: center; gap: 12px; min-height: var(--tap); font-weight: 600; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 14px 12px; margin: 0 0 12px; }
legend { font-weight: 700; padding: 0 6px; color: var(--deep); }

/* ---- Pastilles, alertes ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--sage); color: var(--deep); border: 1px solid #c5d6ca; white-space: nowrap; }
.b-publiee, .b-presente { background: var(--info-bg); }
.b-en_cours, .b-sur_place, .b-a_verifier { background: var(--warn-bg); color: var(--warn); border-color: #f1d9ae; }
.b-terminee, .b-signe, .b-valide, .b-charge { background: var(--ok-bg); color: var(--ok); border-color: #b7dcc3; }
.b-annulee, .b-non_realisee, .b-manquant, .b-absence_motif, .b-a_preparer { background: var(--err-bg); color: var(--err); border-color: #efbdb7; }
.alert { padding: 12px 14px; border-radius: var(--radius-s); border-left: 5px solid; margin: 10px 0; }
.alert.err { background: var(--err-bg); border-color: var(--err); color: var(--err); }
.alert.warn { background: var(--warn-bg); border-color: var(--accent); color: var(--warn); }
.alert.ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.alert.info { background: var(--info-bg); border-color: var(--brand); color: var(--deep); }

/* ---- Tableaux, planning, listes ---- */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
a.tile { display: block; text-decoration: none; color: inherit; }
.tile strong { display: block; font-size: 1.9rem; line-height: 1.2; color: var(--deep); }
.retour { gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.week .col { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 140px; }
.week .col.today { border: 2px solid var(--brand); box-shadow: var(--shadow); }
.week .col h3 { margin: 0 0 8px; font-size: .95rem; text-transform: capitalize; }
.daychip { display: block; text-decoration: none; color: var(--ink); background: var(--info-bg); border-radius: var(--radius-s); padding: 8px 10px; margin-bottom: 8px; font-size: .88rem; border-left: 5px solid var(--brand); }
.daychip.s-brouillon { background: #eef1ee; border-left-color: #8b9a92; }
.daychip.s-en_cours { background: var(--warn-bg); border-left-color: var(--accent); }
.daychip.s-terminee { background: var(--ok-bg); border-left-color: var(--ok); }
.daychip.s-annulee { text-decoration: line-through; opacity: .6; }
.daychip.conflict { outline: 3px solid var(--err); }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps .dot { flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--sage); color: var(--deep); }
.steps .done .dot { background: var(--ok); color: #fff; }
.steps .current .dot { background: var(--accent); color: #fff; }
.crc-item { border-bottom: 1px solid var(--line); padding: 12px 0; }
.crc-item.missing { background: var(--err-bg); }
.crc-item textarea { min-height: var(--tap); margin-top: 6px; field-sizing: content; } /* grandit avec le texte (sinon s'agrandit au doigt) */
.crc-item .row.spread .btn { flex: none; white-space: nowrap; }
.crc-item .opts { display: flex; gap: 6px; margin: 8px 0; } /* les 3 choix sur une ligne */
.crc-item .opts label { flex: 1 1 auto; position: relative; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; border: 1px solid #c3d0c8; border-radius: 12px; padding: 4px 10px; font-weight: 600; min-height: 44px; background: #fff; cursor: pointer; }
/* Choix segmentÃ©s : le bouton radio reste (clavier, lecteur d'Ã©cran) mais invisible ; le choix cochÃ© est colorÃ©. */
.crc-item .opts input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.crc-item .opts label:has(input:checked) { background: var(--brand); border-color: var(--brand); color: #fff; }
.crc-item .opts label:has(input:focus-visible) { outline: 3px solid var(--brand); outline-offset: 2px; }
.crc-item .opts label:has(input:disabled) { opacity: .6; cursor: default; }
.chat { background: var(--sage); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px; max-height: 340px; overflow-y: auto; }
.chat .q { font-weight: 700; margin: 8px 0; }
.chat .a { margin: 4px 0 4px 16px; color: var(--muted); }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb-pending { width: 96px; height: 96px; display: grid; place-items: center; text-align: center; font-size: .75rem; background: var(--warn-bg); border: 1px dashed var(--warn); border-radius: var(--radius-s); }
.thumbs img { width: 96px; height: 96px; object-fit: cover; border-radius: var(--radius-s); border: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: minmax(110px, 35%) 1fr; gap: 6px 12px; }
.kv dt { font-weight: 700; color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv.compact { grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0 0 16px; padding: 12px 18px; }
.kv.compact dt { margin: 0; font-size: .88rem; } .kv.compact dd { margin: 0; }
.login { max-width: 420px; margin: 40px auto; }
.order-list li { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.diff pre { white-space: pre-wrap; background: var(--sage); padding: 10px; border-radius: var(--radius-s); margin: 0; }

/* ---- Terrain : prochaine action Ã  portÃ©e de pouce, ce qui se touche se voit ---- */
.nextbar { position: sticky; bottom: 0; z-index: 20; background: var(--bg); padding: 10px 0; margin: 8px 0 12px; }
.client-card { display: block; text-decoration: none; color: inherit; border-left: 6px solid var(--line); }
.client-card.current { border-left-color: var(--accent); }
a.card { position: relative; padding-right: 44px; cursor: pointer; text-decoration: none; color: inherit; }
a.card::after { content: 'â€º'; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 1.8rem; color: var(--brand); }
.back { margin-bottom: 12px; }
/* Type de chantier : une pastille sombre, toujours visible sur la carte du client. */
.badge.type { background: var(--deep); color: #fff; border-color: var(--deep); }
.badge.veh { color: #fff; border-color: transparent; }
/* Ã‰tapes de la journÃ©e : oÃ¹ j'en suis, et ce que je peux revoir d'un toucher. */
.stepbar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 4px 0 18px; }
.stepbar a, .stepbar button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; min-height: 60px; border-radius: 12px; text-decoration: none; color: var(--muted); font-size: .82rem; font-weight: 700; background: var(--card); border: 1px solid var(--line); }
.stepbar .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--sage); color: var(--deep); }
.stepbar a.done .n { background: var(--ok); color: #fff; }
.stepbar a.current .n { background: var(--accent); color: #fff; }
.stepbar a.shown, .stepbar button.shown { border-color: var(--brand); color: var(--deep); box-shadow: inset 0 -3px 0 var(--brand); }
.stepbar.tabs a, .stepbar.tabs button { min-height: 48px; justify-content: center; text-align: center; font-family: inherit; cursor: pointer; }
.stepbar.t3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stepbar.t2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Conduite : nom, compteur d'heures, retirer. */
.drives li { align-items: center; gap: 8px; }
.drives .hours { min-width: 52px; text-align: center; font: 700 1.2rem var(--serif); font-variant-numeric: tabular-nums; }
/* Checklist : une ligne par article, deux boutons carrÃ©s âœ“ / âœ•. */
.checklist li { align-items: center; padding: 8px 0; }
.checklist .row { flex-wrap: nowrap; gap: 8px; }
.btn.icon { width: 48px; min-width: 48px; padding: 0; font-size: 1.25rem; border-radius: 12px; }
/* Cartes client glissables (mode Â« Modifier l'ordre Â»). */
.client-card.movable { display: flex; align-items: center; gap: 12px; padding-right: 20px; border-left-color: var(--accent); }
.client-card:not(.movable):not(a) { opacity: .75; }
.client-card.dragging { box-shadow: 0 18px 40px rgba(31,65,51,.25); background: var(--sage); }
.grip { touch-action: none; cursor: grab; border: 0; background: var(--sage); color: var(--deep); border-radius: 10px; width: 44px; min-height: 56px; font-size: 1.5rem; flex: none; }
a.tel { font-weight: 700; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#foot .row { gap: 10px; flex-wrap: nowrap; justify-content: center; } #foot .btn.small { padding: 8px 12px; }
dialog.ask { width: min(520px, calc(100vw - 24px)); border: 0; border-radius: 18px; padding: 22px; box-shadow: 0 20px 90px rgba(7,24,15,.3); }
dialog.ask::backdrop { background: rgba(7,24,15,.5); }
dialog.ask .row > button { flex: 1 1 140px; }
details.card > summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; gap: 8px; }

@media (max-width: 760px) {
  body { font-size: 17px; }
  main { padding: 16px; }
  .week { grid-template-columns: 1fr; }
  /* Tuiles : une seule ligne de 4 chiffres, sans la mention Â« cette semaine Â». */
  .tiles { gap: 6px; }
  .tile { padding: 8px; } .tile strong { font-size: 1.4rem; } .tile .sub { display: none; }
  .week .col { min-height: 0; }
  /* Jour sans journÃ©e : une seule ligne (date + Â« + journÃ©e Â»). */
  .week .col.free { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; }
  .week .col.free h3 { margin: 0; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 8px; }
  .kv.compact { grid-template-columns: auto 1fr; } .kv.compact dt { margin-top: 0; }
  .diff { grid-template-columns: 1fr; }
  #mode-banner { position: static; font-size: .85rem; padding: 6px 12px; }
  #top { padding: 10px 14px; gap: 6px 10px; flex-wrap: nowrap; }
  .brand { gap: 10px; } .brand .logo { width: 38px; height: 38px; } .brand b, .brand small { display: none; }
  #nav { flex-wrap: nowrap; justify-content: flex-end; }
  #nav a { padding: 6px 14px; white-space: nowrap; }
  #who { display: none; } /* compte et dÃ©connexion : pied de page */
  h1 { font-size: 1.55rem; }
  .card { padding: 14px; }
  /* Doigts, gants : boutons secondaires Ã  la hauteur d'une cible tactile, sÃ©parÃ©s de leur voisin. */
  .btn.small { min-height: var(--tap); padding: 8px 14px; }
  .crc-item .opts label { min-height: var(--tap); }
  .steps li a { display: inline-flex; align-items: center; min-height: var(--tap); }
  details.card > summary { min-height: var(--tap); }
  /* Menu du bureau : une seule ligne qui dÃ©file au doigt au lieu de trois lignes de boutons. */
  .subnav { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .subnav a { flex: none; white-space: nowrap; }
}
@media print {
  #top, #nav, #toasts, #pending, .no-print { display: none !important; }
  body { background: #fff; display: block; }
}
