/* ==========================================================================
   GestPlan · Composants
   --------------------------------------------------------------------------
   Composants atomiques + layout préfixés .gp-* pour coexister avec les
   classes existantes. Requiert gestplan-tokens.css en amont.

   Contraintes respectées :
   - CSS pur, zéro JS, zéro build.
   - Inputs ≥ 16px (pas d'auto-zoom iOS).
   - Targets tactiles ≥ 44×44 px.
   - Safe-area iPhone sur sticky + sheets.
   - :focus-visible uniquement (pas :focus).
   - Transitions 150–200ms ease-out.
   - Aucun !important.
   - Scopé sous .gp-app, pas de reset agressif.
   ========================================================================== */


/* --------------------------------------------------------------------------
   1 · Base scope
   -------------------------------------------------------------------------- */
.gp-app {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  line-height: 1.5;
}

.gp-app *, .gp-app *::before, .gp-app *::after { box-sizing: border-box; }

/* --------------------------------------------------------------------------
   2 · Buttons
   -------------------------------------------------------------------------- */
.gp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;          /* touch target */
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t), box-shadow var(--t), transform var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.gp-btn:disabled { opacity: .5; cursor: not-allowed; }
.gp-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.gp-btn:active:not(:disabled) { transform: scale(.98); }

.gp-btn--primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.gp-btn--primary:hover:not(:disabled) { background: var(--blue-600); border-color: var(--blue-600); }

.gp-btn--secondary {
  background: var(--surface);
  color: var(--ink-2);
  border-color: var(--line);
  box-shadow: var(--shadow-xs);
}
.gp-btn--secondary:hover:not(:disabled) { border-color: var(--ink-5); background: var(--bg); }

.gp-btn--ghost {
  background: transparent;
  color: var(--ink-2);
}
.gp-btn--ghost:hover:not(:disabled) { background: var(--bg); }

.gp-btn--danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.gp-btn--danger:hover:not(:disabled) { background: #b8251a; border-color: #b8251a; }

.gp-btn--success {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.gp-btn--success:hover:not(:disabled) { background: #0c8449; border-color: #0c8449; }

.gp-btn--accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.gp-btn--accent:hover:not(:disabled) { background: #e8642a; border-color: #e8642a; }

.gp-btn--icon {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: var(--r);
}

.gp-btn--sm { min-height: 36px; padding: 7px 12px; font-size: 13px; border-radius: var(--r-sm); }
.gp-btn--sm.gp-btn--icon { width: 36px; height: 36px; min-height: 36px; padding: 0; }

.gp-btn--lg { min-height: 52px; padding: 14px 22px; font-size: 15px; }

/* --------------------------------------------------------------------------
   3 · Chips / Badges de statut
   -------------------------------------------------------------------------- */
.gp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  height: 22px;
  border-radius: 100px;
  background: var(--bg-2);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.gp-chip::before {                /* point de statut optionnel — ajouter .gp-chip--dot */
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: none;
}
.gp-chip--dot::before { display: block; }

.gp-chip--blue   { background: var(--blue-50);   color: var(--blue-600); }
.gp-chip--green  { background: var(--green-50);  color: var(--green); }
.gp-chip--amber  { background: var(--amber-50);  color: var(--amber); }
.gp-chip--red    { background: var(--red-50);    color: var(--red); }
.gp-chip--purple { background: var(--purple-50); color: var(--purple); }

.gp-chip--solid          { color: #fff; }
.gp-chip--solid.gp-chip--blue   { background: var(--blue-500); }
.gp-chip--solid.gp-chip--green  { background: var(--green); }
.gp-chip--solid.gp-chip--amber  { background: var(--amber); }
.gp-chip--solid.gp-chip--red    { background: var(--red); }
.gp-chip--solid.gp-chip--purple { background: var(--purple); }

/* --------------------------------------------------------------------------
   4 · Cards
   -------------------------------------------------------------------------- */
.gp-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.gp-card--hover {
  cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t-fast);
}
.gp-card--hover:hover { border-color: var(--blue-100); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.gp-card--hover:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.gp-card--elevated { box-shadow: var(--shadow-md); border-color: transparent; }

.gp-card__header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.gp-card__body { padding: var(--sp-4) var(--sp-5); }
.gp-card__footer {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* --------------------------------------------------------------------------
   5 · Inputs & form
   -------------------------------------------------------------------------- */
.gp-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gp-field__help { font-size: 12px; color: var(--ink-3); }
.gp-field__error { font-size: 12px; color: var(--red); }

.gp-input,
.gp-select,
.gp-textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  font-family: inherit;
  font-size: 16px;              /* iOS no-zoom */
  font-weight: 400;
  line-height: 1.4;
  color: var(--ink);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
  -webkit-appearance: none;
  appearance: none;
}
.gp-textarea { min-height: 96px; resize: vertical; line-height: 1.5; }

.gp-input::placeholder,
.gp-textarea::placeholder { color: var(--ink-4); }

.gp-input:hover,
.gp-select:hover,
.gp-textarea:hover { border-color: var(--ink-5); }

.gp-input:focus-visible,
.gp-select:focus-visible,
.gp-textarea:focus-visible {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 4px rgba(26,127,201,.12);
}

.gp-input[disabled],
.gp-select[disabled],
.gp-textarea[disabled] { background: var(--bg); color: var(--ink-4); cursor: not-allowed; }

.gp-input[aria-invalid="true"],
.gp-select[aria-invalid="true"],
.gp-textarea[aria-invalid="true"] { border-color: var(--red); }
.gp-input[aria-invalid="true"]:focus-visible { box-shadow: 0 0 0 4px rgba(217,45,32,.12); }

/* Select : chevron */
.gp-select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* Label générique (utilisable en .gp-label ou <label class="gp-label">) */
/* .gp-label est aussi défini dans tokens.css comme util typographique — même classe */

/* Switch */
.gp-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}
.gp-switch input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0; margin: 0;
  cursor: pointer;
}
.gp-switch__track {
  position: absolute; inset: 0;
  background: var(--ink-5);
  border-radius: 100px;
  transition: background var(--t);
}
.gp-switch__track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 22px; height: 22px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-xs);
  transition: left var(--t);
}
.gp-switch input:checked + .gp-switch__track { background: var(--blue-500); }
.gp-switch input:checked + .gp-switch__track::after { left: 20px; }
.gp-switch input:focus-visible + .gp-switch__track { box-shadow: var(--focus-ring); }

/* --------------------------------------------------------------------------
   6 · Avatar
   -------------------------------------------------------------------------- */
.gp-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r);
  background: var(--blue-50);
  color: var(--blue-600);
  font-weight: 800;
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.gp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.gp-avatar--sm { width: 26px; height: 26px; font-size: 10px; border-radius: var(--r-sm); }
.gp-avatar--lg { width: 48px; height: 48px; font-size: 15px; border-radius: var(--r); }

/* --------------------------------------------------------------------------
   7 · Bottom nav (mobile)
   -------------------------------------------------------------------------- */
.gp-bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-bottomnav);
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -4px 12px -6px rgba(13,24,40,.08);
}
.gp-bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 56px;
  padding: 6px 4px;
  background: transparent;
  border: none;
  color: var(--ink-3);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
  cursor: pointer;
  text-decoration: none;
  transition: color var(--t);
  -webkit-tap-highlight-color: transparent;
}
.gp-bottom-nav__item svg,
.gp-bottom-nav__item .gp-bottom-nav__icon {
  width: 22px; height: 22px;
  transition: transform var(--t-fast);
}
.gp-bottom-nav__item:hover { color: var(--ink-2); }
.gp-bottom-nav__item:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--blue-500); border-radius: var(--r-sm); }
.gp-bottom-nav__item.is-active { color: var(--blue); }
.gp-bottom-nav__item.is-active .gp-bottom-nav__icon { transform: translateY(-1px); }

/* --------------------------------------------------------------------------
   8 · Sidebar nav (desktop)
   -------------------------------------------------------------------------- */
.gp-sidebar {
  width: 72px;
  background: var(--ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 10px 14px;
}
.gp-sidebar__item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin: 0 auto;
  border-radius: var(--r);
  color: rgba(255,255,255,.55);
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  transition: background var(--t-fast), color var(--t-fast);
}
.gp-sidebar__item svg { width: 20px; height: 20px; }
.gp-sidebar__item:hover { color: #fff; background: rgba(255,255,255,.06); }
.gp-sidebar__item:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--blue-500); }
.gp-sidebar__item.is-active {
  background: linear-gradient(140deg, var(--blue-500), var(--blue));
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(26,127,201,.7);
}
.gp-sidebar__item.is-active::before {
  content: '';
  position: absolute;
  left: -10px; top: 14px; bottom: 14px;
  width: 3px;
  background: var(--accent);
  border-radius: 100px;
}

/* --------------------------------------------------------------------------
   9 · Topbar
   -------------------------------------------------------------------------- */
.gp-topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: calc(56px + var(--safe-top));
  padding: var(--safe-top) var(--sp-4) 0 var(--sp-4);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.gp-topbar__title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gp-topbar__back {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: none; background: transparent;
  color: var(--ink-2);
  border-radius: var(--r);
  cursor: pointer;
  flex-shrink: 0;
}
.gp-topbar__back:hover { background: var(--bg); }
.gp-topbar__back:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* --------------------------------------------------------------------------
   10 · Sheet / bottom-sheet
   -------------------------------------------------------------------------- */
.gp-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-overlay);
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: 0 -20px 40px -10px rgba(13,24,40,.25);
  padding: var(--sp-2) var(--sp-5) calc(var(--sp-5) + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform 220ms ease-out;
  max-height: 92vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.gp-sheet--open { transform: translateY(0); }

.gp-sheet__handle {
  width: 40px;
  height: 4px;
  background: var(--ink-5);
  border-radius: 100px;
  margin: 8px auto 16px;
}
.gp-sheet__title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-3);
}

.gp-sheet__backdrop {
  position: fixed; inset: 0;
  z-index: calc(var(--z-overlay) - 1);
  background: rgba(11,18,32,.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease-out;
}
.gp-sheet__backdrop.is-open { opacity: 1; pointer-events: auto; }

/* --------------------------------------------------------------------------
   11 · Event block (planning desktop)
   -------------------------------------------------------------------------- */
.gp-evt {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 9px;
  border-left: 3px solid var(--blue-500);
  border-radius: var(--r-sm);
  background: var(--blue-50);
  color: var(--blue-600);
  font-size: 12px;
  line-height: 1.3;
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
  overflow: hidden;
}
.gp-evt__time {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
  opacity: .8;
}
.gp-evt__title {
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gp-evt__meta {
  font-size: 11px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gp-evt:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.gp-evt:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.gp-evt--blue  { background: var(--blue-50);  border-left-color: var(--blue-500);  color: var(--blue-600); }
.gp-evt--green { background: var(--green-50); border-left-color: var(--green);     color: var(--green); }
.gp-evt--amber { background: var(--amber-50); border-left-color: var(--amber);     color: var(--amber); }
.gp-evt--red   { background: var(--red-50);   border-left-color: var(--red);       color: var(--red); }
.gp-evt--purple{ background: var(--purple-50);border-left-color: var(--purple);    color: var(--purple); }

/* --------------------------------------------------------------------------
   12 · Intervention card (mobile list)
   -------------------------------------------------------------------------- */
.gp-inter-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t), box-shadow var(--t);
  -webkit-tap-highlight-color: transparent;
}
.gp-inter-card:hover { border-color: var(--blue-100); box-shadow: var(--shadow-sm); }
.gp-inter-card:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.gp-inter-card__time {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  text-align: right;
  min-width: 52px;
  line-height: 1.3;
}
.gp-inter-card__time b { color: var(--ink); font-weight: 700; display: block; font-size: 13px; }

.gp-inter-card__body { min-width: 0; }
.gp-inter-card__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}
.gp-inter-card__meta {
  font-size: 12px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  gap: 6px;
  align-items: center;
}

.gp-inter-card__action {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  color: var(--ink-4);
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   13 · Check-list
   -------------------------------------------------------------------------- */
.gp-checklist {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 4px;
}
.gp-checklist__item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 52px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.4;
  transition: background var(--t-fast);
}
.gp-checklist__item + .gp-checklist__item { border-top: 1px solid var(--line-2); }
.gp-checklist__item.is-done { color: var(--ink); }
.gp-checklist__item.is-done .gp-checklist__label { text-decoration: line-through; text-decoration-color: var(--ink-4); text-decoration-thickness: 1.5px; }
.gp-checklist__label { flex: 1; min-width: 0; }

.gp-checkbox {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 24px; height: 24px;
  flex-shrink: 0;
  border: 2px solid var(--ink-5);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.gp-checkbox input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0; cursor: pointer; margin: 0;
}
.gp-checkbox__mark {
  width: 12px; height: 12px;
  color: #fff;
  opacity: 0;
  transform: scale(.6);
  transition: opacity var(--t-fast), transform var(--t-fast);
}
.gp-checkbox input:checked ~ .gp-checkbox__mark { opacity: 1; transform: scale(1); }
.gp-checkbox:has(input:checked) { background: var(--green); border-color: var(--green); }
.gp-checkbox input:focus-visible ~ .gp-checkbox__mark,
.gp-checkbox:has(input:focus-visible) { box-shadow: var(--focus-ring); }

/* --------------------------------------------------------------------------
   14 · Photo slot (avant / après)
   -------------------------------------------------------------------------- */
.gp-photo-slot {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-2);
}
.gp-photo-slot--empty {
  border: 1.5px dashed var(--ink-5);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--ink-4);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  min-height: 88px;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
}
.gp-photo-slot--empty:hover { border-color: var(--blue-500); color: var(--blue-600); background: var(--blue-50); }
.gp-photo-slot--empty:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.gp-photo-slot--filled { border: 1.5px solid var(--line); }
.gp-photo-slot__img { width: 100%; height: 100%; object-fit: cover; display: block; }

.gp-photo-slot__tag {
  position: absolute;
  top: 6px; left: 6px;
  padding: 3px 7px;
  border-radius: var(--r-sm);
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.gp-photo-slot__actions {
  position: absolute;
  bottom: 6px; right: 6px;
  display: flex;
  gap: 4px;
}
.gp-photo-slot__actions button {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: rgba(0,0,0,.55);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* --------------------------------------------------------------------------
   15 · KPI card (dashboard)
   -------------------------------------------------------------------------- */
.gp-kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.gp-kpi__icon {
  position: absolute;
  top: 14px; right: 14px;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--r);
  background: var(--blue-50);
  color: var(--blue-600);
}
.gp-kpi__icon svg { width: 16px; height: 16px; }
.gp-kpi__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.gp-kpi__value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.1;
  margin-top: 4px;
}
.gp-kpi__delta {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.gp-kpi__delta--up   { color: var(--green); }
.gp-kpi__delta--down { color: var(--red); }

/* --------------------------------------------------------------------------
   16 · Segmented control
   -------------------------------------------------------------------------- */
.gp-seg {
  display: inline-flex;
  padding: 3px;
  background: var(--bg-2);
  border-radius: var(--r);
  gap: 2px;
}
.gp-seg__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 14px;
  border: none;
  background: transparent;
  color: var(--ink-3);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: calc(var(--r) - 3px);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.gp-seg__item:hover { color: var(--ink); }
.gp-seg__item:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.gp-seg__item.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

/* --------------------------------------------------------------------------
   17 · Map controls
   -------------------------------------------------------------------------- */
.gp-map-tools {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  z-index: var(--z-sticky);     /* au-dessus des tuiles Leaflet, sous overlays */
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 4px;
  box-shadow: var(--shadow-sm);
}
.gp-map-tools button {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: transparent;
  border: none;
  color: var(--ink-2);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.gp-map-tools button:hover { background: var(--bg); }
.gp-map-tools button:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.gp-map-badge {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: var(--z-sticky);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
}
.gp-map-badge::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
}

/* --------------------------------------------------------------------------
   18 · Progress bar
   -------------------------------------------------------------------------- */
.gp-progress {
  position: relative;
  width: 100%;
  height: 6px;
  background: var(--line);
  border-radius: 100px;
  overflow: hidden;
}
.gp-progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-500), var(--blue));
  border-radius: 100px;
  transition: width var(--t);
}
.gp-progress--sm { height: 4px; }
.gp-progress--lg { height: 10px; }

.gp-progress--green .gp-progress__bar { background: var(--green); }
.gp-progress--amber .gp-progress__bar { background: var(--amber); }
.gp-progress--red   .gp-progress__bar { background: var(--red); }

/* --------------------------------------------------------------------------
   19 · Empty state
   -------------------------------------------------------------------------- */
.gp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-10) var(--sp-5);
  text-align: center;
  color: var(--ink-3);
}
.gp-empty__icon {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  background: var(--bg);
  border-radius: var(--r-lg);
  color: var(--ink-4);
}
.gp-empty__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.gp-empty__desc {
  font-size: 13px;
  line-height: 1.5;
  max-width: 280px;
}

/* --------------------------------------------------------------------------
   20 · Divider
   -------------------------------------------------------------------------- */
.gp-divider {
  height: 1px;
  background: var(--line);
  border: none;
  margin: var(--sp-4) 0;
}

/* --------------------------------------------------------------------------
   20a · Topbar branded (variant mobile bleu)
   -------------------------------------------------------------------------- */
.gp-topbar--brand {
  background: var(--blue);
  border-bottom-color: transparent;
  color: #fff;
  box-shadow: 0 2px 16px rgba(0,30,80,.2);
}
.gp-topbar--brand .gp-topbar__title { color: #fff; }
.gp-topbar--brand .gp-topbar__action {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 44px; height: 44px;
  border-radius: var(--r);
  display: grid; place-items: center;
  font-size: 18px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.gp-topbar--brand .gp-topbar__action:hover { background: rgba(255,255,255,.22); }
.gp-topbar--brand .gp-topbar__action:focus-visible { outline: 2px solid rgba(255,255,255,.55); outline-offset: 2px; }
.gp-topbar__badge {
  position: absolute;
  top: -3px; right: -3px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 700;
  border: 2px solid var(--blue);
  padding: 0 3px;
}

/* --------------------------------------------------------------------------
   20b · Sheet fullscreen variant (modales plein écran : détail, form, caméra)
   -------------------------------------------------------------------------- */
.gp-sheet--fullscreen {
  position: fixed;
  inset: 0;
  bottom: 0;
  top: 0;
  left: 0;
  right: 0;
  border-radius: 0;
  max-height: 100dvh;
  padding: 0;
  transform: translateY(100%);
  display: none;
  flex-direction: column;
}
.gp-sheet--fullscreen.gp-sheet--open { display: flex; transform: translateY(0); }
.gp-sheet--fullscreen > .gp-sheet__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4);
  overscroll-behavior: contain;
}

/* --------------------------------------------------------------------------
   20c · Toast transient
   -------------------------------------------------------------------------- */
.gp-toast {
  position: fixed;
  top: calc(var(--safe-top) + 70px);
  left: var(--sp-4); right: var(--sp-4);
  z-index: var(--z-modal);
  background: var(--ink);
  color: #fff;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transform: translateY(-20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}
.gp-toast.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.gp-toast--success { background: var(--green); }
.gp-toast--danger  { background: var(--red); }
.gp-toast--amber   { background: var(--amber); }

/* --------------------------------------------------------------------------
   20d · FAB (Floating Action Button)
   -------------------------------------------------------------------------- */
.gp-fab {
  position: fixed;
  right: var(--sp-4);
  bottom: calc(86px + var(--safe-bottom));
  z-index: var(--z-fab);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--blue-500);
  color: #fff;
  border: none;
  font-size: 26px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px -4px rgba(13,77,141,.5), 0 2px 6px rgba(13,24,40,.15);
  display: grid; place-items: center;
  transition: transform 160ms ease-out, box-shadow 160ms ease-out;
}
.gp-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -6px rgba(13,77,141,.55), 0 2px 6px rgba(13,24,40,.15); }
.gp-fab:active { transform: scale(.95); }
.gp-fab:focus-visible { outline: none; box-shadow: var(--focus-ring), 0 8px 20px -4px rgba(13,77,141,.5); }
.gp-fab--accent  { background: var(--accent); box-shadow: 0 8px 20px -4px rgba(255,122,61,.45); }
.gp-fab--success { background: var(--green);  box-shadow: 0 8px 20px -4px rgba(15,157,88,.45); }

/* --------------------------------------------------------------------------
   20e · List (groupe carte : settings, menus)
   -------------------------------------------------------------------------- */
.gp-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.gp-list__title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 var(--sp-2) var(--sp-2);
  margin-top: var(--sp-4);
}
.gp-list__item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line-2);
  color: var(--ink);
  text-decoration: none;
  min-height: 56px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.gp-list__item:last-child { border-bottom: none; }
.gp-list__item:hover { background: var(--bg); }
.gp-list__item:focus-visible { outline: none; background: var(--bg); box-shadow: inset 2px 0 0 var(--blue-500); }
.gp-list__icon {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  background: var(--blue-50);
  color: var(--blue-600);
  display: grid; place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.gp-list__body { flex: 1; min-width: 0; }
.gp-list__title-line {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.gp-list__sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
}
.gp-list__trailing {
  flex-shrink: 0;
  color: var(--ink-4);
  font-size: 14px;
}
.gp-list__item--danger .gp-list__icon { background: var(--red-50); color: var(--red); }
.gp-list__item--danger .gp-list__title-line { color: var(--red); }

/* --------------------------------------------------------------------------
   20f · Search input (input + bouton clear)
   -------------------------------------------------------------------------- */
.gp-search {
  position: relative;
  margin-bottom: var(--sp-3);
}
.gp-search__input {
  width: 100%;
  padding: var(--sp-3) 42px var(--sp-3) var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-family: inherit;
  font-size: 16px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border var(--t);
}
.gp-search__input:focus-visible { border-color: var(--blue-500); box-shadow: 0 0 0 4px rgba(26,127,201,.12); }
.gp-search__input::placeholder { color: var(--ink-4); }
.gp-search__clear {
  position: absolute;
  right: var(--sp-2);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg);
  border: none;
  color: var(--ink-3);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 14px;
}
.gp-search__clear:hover { background: var(--bg-2); color: var(--ink); }

/* --------------------------------------------------------------------------
   21 · Responsive tweaks
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .gp-card__header,
  .gp-card__body { padding: var(--sp-3) var(--sp-4); }

  .gp-kpi { padding: var(--sp-3); }
  .gp-kpi__value { font-size: 26px; }

  .gp-topbar { padding-left: var(--sp-3); padding-right: var(--sp-3); }
}

/* --------------------------------------------------------------------------
   22 · Préférences utilisateur
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .gp-app *,
  .gp-app *::before,
  .gp-app *::after {
    transition-duration: 0.01ms;
    animation-duration: 0.01ms;
  }
}
