/* terrain.css — outil terrain du chauffeur (gros boutons, utilisables avec des gants) + stock et seuils. */

.tr-btn { min-height: 52px; padding: 10px 18px; font-size: 16px; font-weight: 600; justify-content: center; border-radius: 12px; }
.tr-btn.on { border-color: var(--red); background: var(--red-bg); color: #fff; }
.tr-jours { display: flex; gap: 6px; }
.tr-jours .tr-btn { min-width: 52px; }
.tr-filtres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

.tr-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.tr-arret { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--green); border-radius: 14px; padding: 16px; }
.tr-arret.ramassage { border-left-color: var(--blue); }
.tr-arret.retard { border-color: rgba(208, 32, 42, .55); border-left-color: var(--red); }
.tr-arret.solo { margin-bottom: 6px; }
.tr-a-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.tr-type { font-weight: 800; text-transform: uppercase; letter-spacing: .05em; font-size: 13px; color: var(--green); }
.tr-arret.ramassage .tr-type { color: #7aa7ff; }
.tr-heure { margin-left: auto; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tr-client { font-size: 20px; font-weight: 700; line-height: 1.25; }
.tr-adr { margin-top: 8px; font-size: 16px; }
.tr-acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 14px; }
.tr-acts .primary { grid-column: 1 / -1; min-height: 60px; font-size: 18px; }
.tr-chauf {display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.tr-chauf select { min-height: 44px; }

.tr-machines { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.tr-machine { flex-direction: column; align-items: flex-start; white-space: normal; text-align: left; }
.tr-machine small { color: var(--faint); font-weight: 500; }
.tr-machine.fait { border-color: rgba(34, 197, 94, .5); color: var(--green); }

.tr-form { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-top: 14px; scroll-margin-top: 70px; }
.tr-form h2 { font-size: 18px; }
.tr-champ { display: block; margin-bottom: 18px; }
.tr-champ > span { display: block; font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.tr-champ em { font-style: normal; font-weight: 400; color: var(--faint); }
input.in.tr-gros { font-size: 22px; padding: 12px 14px; min-height: 56px; }
.tr-form textarea.in { font-size: 16px; }
.tr-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.tr-seg + .tr-seg { margin-top: 8px; }
.tr-seg button { min-height: 56px; border: 2px solid var(--line-2); background: var(--panel-2); border-radius: 12px; font-size: 17px; font-weight: 700; cursor: pointer; color: var(--muted); }
.tr-seg button.on { border-color: var(--green); color: #fff; background: var(--green-bg); }
.tr-seg button.mal.on { border-color: var(--red); background: var(--red-bg); }
.tr-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 8px; }
.tr-ph { position: relative; }
.tr-ph img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.tr-ph button { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .75); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; }
.tr-photo-btn { width: 100%; cursor: pointer; }
.tr-sign { position: relative; background: #fff; border-radius: 12px; border: 2px dashed var(--line-2); overflow: hidden; }
.tr-sign canvas { display: block; width: 100%; height: 220px; touch-action: none; cursor: crosshair; }
.tr-sign-l { position: absolute; left: 14px; bottom: 10px; color: #999; font-size: 14px; pointer-events: none; }
.tr-sign.signe .tr-sign-l { display: none; }
.tr-gps { color: var(--muted); margin-bottom: 14px; font-size: 14px; }
.tr-coche { display: flex; align-items: center; gap: 12px; font-size: 15px; margin-bottom: 16px; }
.tr-coche input { width: 28px; height: 28px; accent-color: var(--red); flex: none; }
.tr-go { width: 100%; min-height: 64px; font-size: 19px; }

.tr-file { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--amber-bg); border: 1px solid rgba(245, 158, 11, .45); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.tr-file > div { flex: 1; min-width: 200px; }
.tr-file small { display: block; color: var(--muted); }
.tr-file.err { background: var(--red-bg); border-color: rgba(208, 32, 42, .5); }

/* Preuve imprimable */
.tr-doc .t td:first-child { width: 170px; }
.tr-doc-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tr-doc-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; border: 1px solid #ddd; }
.tr-doc-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: end; margin-top: 22px; padding-top: 14px; border-top: 1px solid #ddd; }
.tr-doc-sign img { max-width: 320px; max-height: 140px; border-bottom: 1px solid #111; margin-bottom: 6px; }

/* Stock */
.stk-seuil { width: 84px !important; text-align: right; display: inline-block; }
.print-only { display: none; }
@media print {
  .tr-doc-photos { grid-template-columns: repeat(3, 1fr); }
  .tr-doc-photos a, .tr-doc-sign { break-inside: avoid; }
  .print-only { display: block; }
  body.print-achats .main > .head, body.print-achats .stk-sec:not(.achats) { display: none !important; }
  body.print-achats .card { background: #fff; color: #111; border: 0; }
  body.print-achats .t th, body.print-achats .t td { color: #111; }
}

@media (max-width: 760px) {
  .tr-liste { grid-template-columns: 1fr; }
  .tr-jours { width: 100%; }
  .tr-jours .tr-btn:nth-child(2) { flex: 1; }
  .tr-filtres .tr-btn { flex: 1; }
  .tr-niv button { font-size: 16px; }
  .tr-doc-photos { grid-template-columns: repeat(2, 1fr); }
  .tr-doc-sign { grid-template-columns: 1fr; }
}

/* App terrain (/terrain) : cadre téléphone et écrans dans terrain-app.css (public/terrain-app.js). */
