/* Charte INNOV DRONE : noir et rouge, avec du vert « agri » pour les cultures, le NDVI et les validations */
:root {
  --red: #E5170D;
  --red-d: #B8100A;
  --red-brand: #FD1C11;
  --red-l: #fdecea;
  --green: #2f7d3a;
  --green-d: #1f5a28;
  --green-l: #e8f3e4;
  --leaf: #7fcf6b;
  --ochre: #c58b2a;
  --cream: #f6f5f2;
  --ink: #141414;
  --muted: #666b66;
  --line: #deddd8;
  --tint: #f1efea;
  --danger: #b3261e;
  --radius: 10px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--cream); line-height: 1.5; }
h1, h2, h3 { color: var(--ink); line-height: 1.2; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.45rem; }
a { color: var(--red-d); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

header.top { background: #111; color: #fff; border-bottom: 3px solid var(--red-brand); }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
header.top .brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 800; letter-spacing: .01em; color: #fff; text-decoration: none; }
header.top .brand img { height: 38px; width: auto; }
header.top .brand i { font-style: normal; color: var(--red-brand); }
header.top .brand b { color: var(--leaf); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; align-self: flex-end; margin-bottom: 4px; }
header.top nav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
header.top nav a, header.top nav button { color: #fff; text-decoration: none; font-size: .95rem; }

.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--red); color: #fff; border: 0; padding: 9px 16px; border-radius: 8px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--red-d); }
.btn.alt { background: #fff; color: var(--ink); border: 1px solid #c9c8c2; }
.btn.alt:hover { background: var(--tint); }
.btn.ghost { background: transparent; border: 1px solid rgba(255,255,255,.55); color: #fff; }
.btn.ghost:hover { background: rgba(255,255,255,.12); }
.btn.danger { background: #8f1d16; }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Bandeau d'accueil : fond noir, ondes radar rouges, sillons de culture verts */
.hero { position: relative; overflow: hidden; background: #111; color: #fff; padding: 44px 0 40px; }
.hero::before { content: ""; position: absolute; right: -90px; top: -130px; width: 520px; height: 520px; border-radius: 50%;
  background: repeating-radial-gradient(circle at center, transparent 0 34px, rgba(253,28,17,.55) 34px 37px); opacity: .55; }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 12px;
  background: repeating-linear-gradient(90deg, var(--green) 0 26px, #1d4e26 26px 34px); }
.hero .wrap { position: relative; z-index: 1; }
.hero h1 { color: #fff; font-size: clamp(1.8rem, 4.2vw, 2.7rem); max-width: 17em; }
.hero h1 em { font-style: normal; color: var(--red-brand); }
.hero p { max-width: 42em; opacity: .9; font-size: 1.05rem; }
.services { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-top: 22px; }
.services div { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.16); border-top: 3px solid var(--leaf); border-radius: var(--radius); padding: 12px 14px; font-size: .95rem; }
.services strong { display: block; color: #fff; }

.steps { display: flex; gap: 22px; flex-wrap: wrap; margin: 26px 0 8px; counter-reset: s; padding: 0; }
.steps li { list-style: none; counter-increment: s; display: flex; gap: 8px; align-items: baseline; color: var(--muted); }
.steps li::before { content: counter(s); background: var(--red); color: #fff; font-weight: 700; width: 24px; height: 24px; display: inline-grid; place-items: center; border-radius: 50%; font-size: .85rem; flex: none; }

.layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 20px; margin: 24px 0 40px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 16px; }

#map, #map-farm { height: 520px; border-radius: var(--radius); border: 1px solid var(--line); z-index: 0; }
#map-farm { height: 420px; }
.mapbar { display: flex; gap: 8px; margin-bottom: 10px; position: relative; }
.mapbar input { flex: 1; }
.suggest { position: absolute; top: 100%; left: 0; right: 90px; background: #fff; border: 1px solid var(--line); border-radius: 8px; z-index: 1000; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.suggest button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; font: inherit; cursor: pointer; }
.suggest button:hover { background: var(--tint); }
.hint { color: var(--muted); font-size: .9rem; margin: 8px 0 0; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; border-left: 4px solid var(--leaf); z-index: 3000; max-width: 90vw; }
.toast.err { background: var(--danger); }

label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 4px; }
input, select, textarea { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--red-brand); outline-offset: 1px; }
textarea { min-height: 80px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 560px) { .row2, .row3 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { width: auto; margin-top: 4px; }
.hp { position: absolute; left: -9999px; }

.sel-list { list-style: none; margin: 10px 0; padding: 0; }
.sel-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: var(--green-l); }
.sel-list small { color: var(--muted); display: block; }
.total { font-weight: 700; color: var(--ink); }
.empty { color: var(--muted); font-style: italic; }

/* Espace client */
.app { display: grid; grid-template-columns: 220px 1fr; gap: 22px; margin: 22px 0 40px; align-items: start; }
@media (max-width: 800px) { .app { grid-template-columns: 1fr; } }
.side { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; position: sticky; top: 12px; }
.side button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 8px; font: inherit; cursor: pointer; color: var(--ink); }
.side button:hover { background: var(--tint); }
.side button.on { background: #111; color: #fff; font-weight: 700; box-shadow: inset 4px 0 0 var(--red-brand); }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
@media (max-width: 800px) { .side { display: flex; flex-wrap: wrap; position: static; } .side button { width: auto; } .side hr { display: none; } }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.kpi { border-top: 3px solid var(--leaf); }
.kpi b { display: block; font-size: 1.9rem; font-weight: 800; color: var(--ink); }
.kpi span { color: var(--muted); font-size: .9rem; }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; background: #fff; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--tint); color: var(--ink); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
td.num { text-align: right; white-space: nowrap; }
.actions { white-space: nowrap; }
.actions .btn { margin-right: 4px; }
.app > section { min-width: 0; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .8rem; font-weight: 600; background: #eee; color: #444; white-space: nowrap; }
.badge.nouvelle { background: #fde9c4; color: #7a4d00; }
.badge.en_etude, .badge.devis_envoye { background: #dbe8f7; color: #1f4a7a; }
.badge.accepte, .badge.planifiee { background: #d6ecd2; color: #1f5a1b; }
.badge.realisee { background: #c4e2c9; color: #14501f; }
.badge.annulee { background: #f1d4d0; color: #8a2a20; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar select { width: auto; }
.toolbar .grow { flex: 1; }

dialog { border: 0; border-radius: 12px; padding: 0; width: min(640px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(10,10,10,.6); }
dialog form { padding: 20px; max-height: 88vh; overflow: auto; }
dialog .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.login { max-width: 420px; margin: 50px auto; }
.warn { background: #fff4d6; border: 1px solid #e8cf86; border-radius: 8px; padding: 10px 12px; font-size: .9rem; }
footer { color: var(--muted); font-size: .85rem; text-align: center; padding: 24px 0 40px; }
.legend span { display: inline-block; margin-right: 12px; font-size: .85rem; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* Rappels */
.reminders { list-style: none; margin: 0; padding: 0; }
.reminders li { padding: 7px 10px; border-left: 4px solid var(--line); background: #fff; margin-bottom: 6px; border-radius: 0 8px 8px 0; }
.reminders li.danger { border-color: var(--danger); background: #fbecea; }
.reminders li.warn { border-color: var(--ochre); background: #fff6e3; }
.reminders li.info { border-color: #6a8fb5; background: #f1f6fb; }

/* Calendrier */
.cal { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.cal-head, .cal-body { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { background: #111; color: #fff; font-weight: 600; font-size: .8rem; text-align: center; padding: 6px 0; }
.cal-day { min-height: 92px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); padding: 3px; cursor: default; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.out { background: #f6f6f1; color: #aab0a6; }
.cal-day.today { background: #fff8e6; }
.cal-day .n { font-size: .78rem; font-weight: 600; display: block; margin-bottom: 2px; }
.cal-day small { color: var(--muted); font-size: .7rem; }
.ev { display: block; width: 100%; text-align: left; border: 0; border-radius: 4px; padding: 1px 5px; margin-bottom: 2px; font: inherit; font-size: .72rem; color: #fff; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.ev.s-annule { opacity: .45; text-decoration: line-through; }
.ev.s-fait { opacity: .7; }
.k-mission { background: #E5170D; } .k-semis { background: #a77a1f; } .k-pulverisation { background: #3d6ea3; }
.k-trichogrammes { background: #2c8a80; } .k-cartographie { background: #7a5aa6; } .k-autre { background: #777; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
@media (max-width: 700px) { .cal-day { min-height: 64px; } .ev { font-size: .62rem; } }

/* NDVI */
.ndvi-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .ndvi-layout { grid-template-columns: 1fr; } }
.ndvi-px { image-rendering: pixelated; }
.ndvi-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 8px; }
.ndvi-grad { height: 12px; width: 220px; border-radius: 6px; background: linear-gradient(90deg, rgb(122,82,48), rgb(201,164,106) 20%, rgb(239,224,138) 35%, rgb(183,217,108) 50%, rgb(108,191,90) 65%, rgb(47,158,68) 80%, rgb(11,107,51)); }
.ndvi-scale { display: flex; justify-content: space-between; width: 220px; font-size: .72rem; color: var(--muted); margin-top: -4px; }
.ndvi-bar { position: relative; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; }
.ndvi-read { margin-top: 8px; min-height: 2.2em; padding: 8px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; font-size: .95rem; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; border: 1px solid rgba(0,0,0,.2); }
.sw.big { width: 38px; height: 38px; border-radius: 8px; flex: none; }
.ndvi-mean { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.ndvi-mean b { font-size: 1.9rem; font-weight: 800; color: var(--ink); line-height: 1; }
table.mini { font-size: .88rem; } table.mini th { background: none; text-transform: none; font-weight: 500; color: var(--muted); padding: 4px 6px 4px 0; letter-spacing: 0; white-space: normal; } table.mini td { padding: 4px 0; text-align: right; }
.stack { display: flex; height: 16px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); margin-top: 6px; }
.classes { list-style: none; margin: 8px 0 0; padding: 0; font-size: .88rem; } .classes li { display: flex; align-items: center; gap: 6px; padding: 1px 0; } .classes strong { margin-left: auto; }
details > summary { cursor: pointer; }

/* Pied de page, bandeaux et nouveaux écrans */
footer { border-top: 1px solid var(--line); margin-top: 20px; }
footer a { color: var(--muted); margin: 0 6px; }
#netbar { position: sticky; top: 0; z-index: 2500; background: #111; color: #fff; text-align: center; padding: 7px 12px; font-size: .9rem; border-bottom: 3px solid var(--red-brand); }
#netbar[hidden] { display: none; }
.reminders li.info { border-color: var(--leaf); background: var(--green-l); }
.reminders li.warn { border-color: var(--ochre); background: #fff6e3; }
.bsv-item { border-left: 4px solid var(--leaf); padding: 6px 10px; margin-bottom: 8px; background: var(--green-l); border-radius: 0 8px 8px 0; }
.bsv-item small { color: var(--muted); }
.legal { max-width: 800px; margin: 28px auto 40px; }
.legal h1 { font-size: 1.9rem; }
.legal h2 { margin-top: 1.6em; font-size: 1.2rem; border-left: 4px solid var(--red-brand); padding-left: 10px; }
.legal table { margin: 10px 0; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 16px; }
.badge.ok { background: var(--green-l); color: var(--green-d); }
.badge.ko { background: var(--red-l); color: var(--red-d); }
