:root {
  --orange: #E97132;
  --orange-light: #f6b998;
  --gray-title: #7F7F7F;
  --border: #cfcfcf;
  --bg: #f7f7f5;
}
* { box-sizing: border-box; }
body {
  font-family: "Aptos", "Calibri", "Segoe UI", sans-serif;
  background: var(--bg);
  color: #222;
  margin: 0;
  padding: 0 0 60px;
}
header.topbar {
  background: var(--gray-title);
  color: #fff;
  padding: 18px 32px;
  font-family: "Aptos Display", "Calibri", sans-serif;
  font-size: 22px;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header.topbar a { color: #fff; font-size: 14px; text-decoration: underline; }
main {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 20px;
}
fieldset {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 20px;
  padding: 0;
  background: #fff;
}
legend {
  font-family: "Aptos Display", sans-serif;
  font-weight: 600;
  background: var(--orange);
  color: #fff;
  padding: 8px 16px;
  width: 100%;
  border-radius: 6px 6px 0 0;
  margin: 0;
}
.fieldset-body { padding: 16px 20px; }
.row { display: flex; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.field { flex: 1; min-width: 200px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field input[type=text], .field input[type=number], .field input[type=date],
.field select, .field textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 4px;
  font-family: inherit; font-size: 14px;
}
.field textarea { min-height: 60px; }
.radio-group, .checkbox-group { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.radio-group label, .checkbox-group label { font-size: 14px; font-weight: 400; display: flex; align-items: center; gap: 6px; }
.parcelle-row { display: flex; gap: 10px; margin-bottom: 8px; align-items: center; }
.parcelle-row input { flex: 1; }
.parcelle-row .rm-btn { background: #d9534f; color: #fff; border: none; border-radius: 4px; padding: 6px 10px; cursor: pointer; }
.btn { background: var(--orange); color: #fff; border: none; border-radius: 4px; padding: 9px 16px; cursor: pointer; font-size: 14px; }
.btn.secondary { background: #888; }
.btn:hover { opacity: 0.9; }
.hint { font-size: 12px; color: #666; margin-top: 4px; }
.submit-bar { text-align: center; margin-top: 24px; }
.submit-bar .btn { font-size: 16px; padding: 12px 28px; }
.kml-status { font-size: 13px; margin-top: 6px; padding: 6px 8px; border-radius: 4px; display: none; }
.kml-status.ok { background: #e6f4ea; color: #1e7e34; display: block; }
.kml-status.err { background: #fdecea; color: #a94442; display: block; }

header.topbar { gap: 12px; }
header.topbar .btn.secondary { background: rgba(255,255,255,0.18); color: #fff; font-size: 13px; padding: 7px 12px; }
header.topbar .btn.secondary:hover { background: rgba(255,255,255,0.3); }

.insee-banner {
  padding: 8px 24px; font-size: 13px; display: flex; align-items: center; justify-content: center;
  gap: 14px; text-align: center;
}
.insee-banner.pending { background: #fff4e0; color: #8a5a00; }
.insee-banner.ok { background: #e6f4ea; color: #1e7e34; }
.insee-banner.err { background: #fdecea; color: #a94442; }
.insee-banner .btn { padding: 5px 12px; font-size: 12px; }
.insee-source { text-align: center; font-size: 12px; color: #666; padding: 4px 24px 0; }
.insee-source a { color: var(--orange); }
#draft-restored-notice {
  background: #fff4e0; color: #8a5a00; border: 1px solid #f0d29a; border-radius: 6px;
  padding: 8px 14px; margin-bottom: 12px; font-size: 13px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
#draft-restored-notice .btn { padding: 5px 12px; font-size: 12px; }

.parcelle-card {
  border: 1px solid #ddd; border-radius: 6px; padding: 14px; margin-bottom: 12px; background: #fafafa;
}
.parcelle-card .field { min-width: 160px; }

/* Télépilotes : grille 2 x 2 (au lieu de 3 + 1 en flex-wrap) */
.pilotes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin-top: 6px; }
@media (max-width: 560px) { .pilotes-grid { grid-template-columns: 1fr; } }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: #fff; border-radius: 8px; width: 90%; max-width: 560px; max-height: 85vh;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.modal-header {
  background: var(--gray-title); color: #fff; padding: 14px 18px; display: flex;
  justify-content: space-between; align-items: center;
}
.modal-header h3 { margin: 0; font-family: "Aptos Display", sans-serif; font-size: 17px; }
.modal-close { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.pilots-table { width: 100%; border-collapse: collapse; }
.pilots-table th { text-align: left; font-size: 12px; padding: 6px; border-bottom: 2px solid #ddd; }
.pilots-table td { padding: 6px; border-bottom: 1px solid #eee; }
.pilots-table input[type=text] { width: 100%; padding: 5px 7px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
.pilots-table input:disabled { background: #f2f2f2; color: #555; border-color: transparent; }
.pilots-table .btn.secondary { padding: 5px 8px; font-size: 12px; }
