/* Choix du forfait annuel sur l'écran d'inscription. */
.language-switcher {
  position: fixed;
  z-index: 10000;
  top: max(.75rem, env(safe-area-inset-top));
  right: .75rem;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .45rem;
  border: 1px solid rgba(148, 163, 184, .45);
  border-radius: 6px;
  background: rgba(15, 23, 42, .96);
  color: #f8fafc;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
}

.language-switcher select {
  width: auto;
  min-width: 3.5rem;
  margin: 0;
  padding: .2rem 1.4rem .2rem .3rem;
  border: 0;
  background-color: transparent;
  color: inherit;
  font: inherit;
}

.subscription-plans {
  border: 1px solid #d7dde5;
  margin: 8px 0 4px;
  padding: 12px;
}

.subscription-plan-option {
  align-items: flex-start;
  cursor: pointer;
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 10px 4px;
}

.subscription-plan-option + .subscription-plan-option {
  border-top: 1px solid #e5e7eb;
}

.subscription-plan-option input {
  flex: 0 0 auto;
  margin-top: 4px;
  width: auto;
}

.subscription-plan-option span,
.subscription-plan-option small {
  display: block;
}

.payment-result-screen {
  align-items: center;
  background: #0f172a;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.payment-result-screen[hidden] { display: none; }

.payment-result {
  max-width: 560px;
  text-align: center;
  width: 100%;
}

.payment-result-icon {
  align-items: center;
  border-radius: 50%;
  display: flex;
  height: 72px;
  justify-content: center;
  margin: 0 auto 24px;
  width: 72px;
}

.payment-result-icon.is-pending {
  border: 4px solid #334155;
  border-top-color: #60a5fa;
  animation: payment-spin .9s linear infinite;
}

.payment-result-icon.is-complete {
  animation: none;
  background: #16a34a;
  color: #fff;
  font-size: 40px;
  font-weight: 700;
}

.payment-result-label {
  color: #60a5fa;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.payment-result h1 {
  font-size: 3.5rem;
  letter-spacing: 0;
  margin: 0 0 16px;
}

.payment-result > p:not(.payment-result-label) {
  color: #cbd5e1;
  line-height: 1.6;
  margin-left: auto;
  margin-right: auto;
  max-width: 480px;
}

.payment-admin-link {
  background: #2563eb;
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-size: 1rem;
  font-weight: 700;
  justify-content: center;
  margin: 20px 0 8px;
  padding: 14px 22px;
  text-decoration: none;
}

.payment-admin-link[hidden] { display: none; }
.payment-admin-link:hover { background: #1d4ed8; }

@keyframes payment-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 520px) {
  .payment-result h1 { font-size: 2.25rem; }
  .payment-admin-link { width: 100%; }
}
:root {
  --bg: #0f172a;
  --panel: #111827;
  --accent: #2563eb;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --danger: #ef4444;
  --online: #22c55e;
  --offline: #6b7280;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-width: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.screen { height: 100%; }
.screen[hidden] { display: none; }

/* --- Login --- */
#login-screen, #subscribe-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}
#login-screen[hidden], #subscribe-screen[hidden] { display: none; }
.login-card {
  background: var(--panel);
  padding: 2rem 2.5rem;
  border-radius: 12px;
  width: min(320px, 100%);
  min-width: 0;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.login-card h1 { margin: 0 0 .25rem; font-size: 1.4rem; }
.subtitle { margin: 0 0 1.5rem; color: var(--muted); font-size: .9rem; }
.login-card label {
  display: block;
  margin-bottom: 1rem;
  font-size: .85rem;
  color: var(--muted);
}
.login-card input {
  width: 100%;
  margin-top: .35rem;
  padding: .6rem .7rem;
  border-radius: 8px;
  border: 1px solid #374151;
  background: #1f2937;
  color: var(--text);
  font-size: 1rem;
}
.login-card .professional-confirmation { display: flex; align-items: flex-start; gap: .65rem; line-height: 1.45; }
.login-card .professional-confirmation input { flex: 0 0 auto; width: 1rem; height: 1rem; margin-top: .2rem; padding: 0; }
#subscribe-screen { align-items: flex-start; }
#subscribe-form {
  width: min(860px, 100%);
  min-width: 0;
  margin: auto 0;
}
#subscribe-form h1, #subscribe-form > .subtitle, #subscribe-form > .muted { text-align: center; }
.subscribe-account-fields,
.billing-profile-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1rem;
}
.billing-profile-fields {
  margin: .5rem 0 1rem;
  padding: 1rem 1.25rem .25rem;
  border: 1px solid #374151;
  border-radius: 8px;
}
.billing-profile-fields legend,
.subscription-plans legend {
  padding: 0 .4rem;
  color: var(--text);
  font-weight: 700;
}
.billing-profile-fields p { grid-column: 1 / -1; margin: 0 0 .8rem; line-height: 1.45; }
#subscribe-form .subscription-plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border-color: #374151;
  border-radius: 8px;
}
#subscribe-form .subscription-plan-option {
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: .85rem;
  border: 1px solid #374151;
  border-radius: 8px;
  background: #1f2937;
}
#subscribe-form .subscription-plan-option + .subscription-plan-option { border-top: 1px solid #374151; }
#subscribe-form .professional-confirmation {
  margin: .25rem 0 1rem;
  padding: 1rem;
  border: 1px solid #374151;
  border-radius: 8px;
  background: #0f172a;
  color: var(--text);
}
#subscribe-form .professional-confirmation a { color: #93c5fd; }
.login-card button {
  width: 100%;
  padding: .7rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  cursor: pointer;
}
.login-card button:hover { background: #1d4ed8; }
.login-card .install-app-btn {
  margin-top: .75rem;
  background: transparent;
  border: 1px solid #4b5563;
  color: var(--text);
}
.login-card .install-app-btn:hover { background: #1f2937; }

@media (max-width: 700px) {
  #subscribe-screen { padding: 1rem .75rem; }
  #subscribe-form { padding: 1.25rem; }
  .subscribe-account-fields,
  .billing-profile-fields,
  #subscribe-form .subscription-plans { grid-template-columns: 1fr; }
}

@media (min-width: 701px) and (max-width: 920px) {
  #subscribe-form .subscription-plans { grid-template-columns: 1fr; }
}
.install-app-help { margin: .65rem 0 0; line-height: 1.4; }
.operator-actions + .install-app-help {
  margin: -.25rem 0 .75rem;
  padding: .65rem .75rem;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.4;
}
.pwa-update-banner {
  position: fixed;
  z-index: 3000;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 1rem;
  width: min(460px, calc(100vw - 2rem));
  padding: .9rem 1rem;
  border: 1px solid #475569;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
}
.pwa-update-banner[hidden] { display: none; }
.pwa-update-banner div { display: grid; gap: .2rem; }
.pwa-update-banner span { color: #475569; font-size: .85rem; line-height: 1.35; }
.pwa-update-banner button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 6px;
  padding: .65rem .85rem;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.pwa-update-banner button:disabled { cursor: wait; opacity: .7; }
@media (max-width: 520px) {
  .pwa-update-banner { align-items: stretch; flex-direction: column; gap: .75rem; }
  .pwa-update-banner button { width: 100%; }
}
.pw-wrap { position: relative; display: inline-block; }
.pw-wrap .pw-input { padding-right: 2.2rem; width: 100%; box-sizing: border-box; }
.pw-wrap button.pw-toggle {
  position: absolute;
  right: .4rem;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  height: auto;
  background: none;
  border: none;
  border-radius: 0;
  cursor: pointer;
  font-size: .95rem;
  line-height: 1;
  padding: 0;
  color: var(--muted);
}
.pw-wrap button.pw-toggle:hover { background: none; color: var(--text); }
.error { color: var(--danger); font-size: .85rem; margin-top: .75rem; }
.success { color: var(--online); font-size: .85rem; margin-top: .75rem; }
#sub-paypal-button, #renewal-paypal-button { margin-top: 1rem; }

/* --- Carte --- */
#map-screen {
  display: flex;
  position: relative;
}
#map-screen[hidden] { display: none; }
#map { flex: 1; }

.sidebar-open-btn, .sidebar-backdrop { display: none; }

#sidebar {
  width: 280px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1f2937;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid #1f2937;
}
.sidebar-header h2 { margin: 0; font-size: 1.1rem; }
.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sidebar-header-actions a {
  border: 1px solid #374151;
  color: var(--text);
  border-radius: 6px;
  padding: .3rem .6rem;
  text-decoration: none;
  line-height: 1;
}
#logout-btn {
  background: none;
  border: 1px solid #374151;
  color: var(--text);
  border-radius: 6px;
  padding: .3rem .6rem;
  cursor: pointer;
}
.sidebar-header-actions .header-alert-btn {
  border-color: #b91c1c;
  background: #b91c1c;
  color: white;
  white-space: nowrap;
}
.operator-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: .45rem;
  padding: .65rem 1rem;
  border-bottom: 1px solid #1f2937;
}
.operator-actions a, .operator-actions button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .45rem;
  min-height: 42px;
  padding: .55rem .7rem;
  border: 1px solid #374151;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}
.operator-actions .header-alert-btn { background: #b91c1c; border-color: #b91c1c; }
.danger-alert-panel {
  max-height: 45vh;
  overflow-y: auto;
  padding: .8rem 1rem;
  border-bottom: 1px solid #7f1d1d;
  background: #450a0a;
}
.danger-alert-panel[hidden] { display: none; }
.danger-alert-panel > strong { display: block; margin-bottom: .55rem; color: #fecaca; }
.danger-alert-item {
  padding: .65rem;
  border: 1px solid #dc2626;
  border-radius: 6px;
  background: #7f1d1d;
}
.danger-alert-item + .danger-alert-item { margin-top: .55rem; }
.danger-alert-item > strong, .danger-alert-item > small { display: block; }
.danger-alert-item .danger-client-name {
  padding: .55rem;
  border-radius: 4px;
  background: #dc2626;
  color: #fff;
  font-size: 1.15rem;
  text-align: center;
}
.danger-alert-item > small { margin-top: .2rem; color: #fee2e2; line-height: 1.35; }
.danger-alert-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; margin-top: .55rem; }
.danger-alert-actions a, .danger-alert-actions button {
  min-height: 36px;
  padding: .4rem;
  border: 1px solid #fecaca;
  border-radius: 5px;
  background: #fff;
  color: #7f1d1d;
  font: inherit;
  font-size: .76rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.danger-alert-actions .danger-call { background: #16a34a; border-color: #16a34a; color: white; }
.danger-alert-actions [data-danger-ack] { grid-column: 1 / -1; }
.danger-alert-actions .is-disabled { opacity: .45; pointer-events: none; }
.danger-position-missing { align-self: center; color: #fee2e2; font-size: .72rem; text-align: center; }
.sidebar-close-btn { display: none; }
.client-count {
  padding: .6rem 1rem;
  font-size: .8rem;
  color: var(--muted);
  border-bottom: 1px solid #1f2937;
}
.subscription-info {
  padding: 0 1rem .6rem;
  font-size: .78rem;
  color: var(--online);
  border-bottom: 1px solid #1f2937;
}
.refresh-settings {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  font-size: .78rem;
  color: var(--muted);
  border-bottom: 1px solid #1f2937;
}
.refresh-settings input {
  width: 55px;
  padding: .25rem .4rem;
  border-radius: 6px;
  border: 1px solid #374151;
  background: #1f2937;
  color: var(--text);
}
.emergency-settings input { width: min(12rem, 100%); }
.refresh-settings button {
  padding: .25rem .6rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: .78rem;
}
#client-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}
#client-list li {
  padding: .7rem 1rem;
  border-bottom: 1px solid #1f2937;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .9rem;
}
#client-list li:hover { background: #1f2937; }
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.online { box-shadow: 0 0 0 2px var(--online); }
.dot.offline { opacity: .4; }
.client-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.client-meta small { color: var(--muted); }
.phone-row em { color: var(--muted); font-style: normal; opacity: .7; }
.phone-link {
  text-decoration: none;
  margin-left: .35rem;
  font-size: .85rem;
}
.phone-link:hover { opacity: .7; }
.client-actions {
  display: flex;
  gap: .3rem;
  flex-shrink: 0;
}
.mini-btn {
  background: none;
  border: 1px solid #374151;
  color: var(--text);
  border-radius: 6px;
  padding: .15rem .4rem;
  cursor: pointer;
  font-size: .8rem;
  line-height: 1.4;
}
.mini-btn:hover { background: #1f2937; }

.access-panel {
  border-bottom: 1px solid #1f2937;
  max-height: 36vh;
  overflow-y: auto;
}
.access-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .65rem 1rem;
}
.access-panel-header strong { font-size: .82rem; }
.access-panel-header button {
  border: 1px solid #374151;
  border-radius: 6px;
  background: #1f2937;
  color: var(--text);
  padding: .3rem .5rem;
  cursor: pointer;
  font-size: .76rem;
}
.access-panel-header button.is-placing { border-color: #f59e0b; color: #fbbf24; }
.access-mode-help {
  margin: 0;
  padding: .45rem 1rem;
  color: #fbbf24;
  background: rgba(245, 158, 11, .08);
  font-size: .75rem;
}
#access-list { list-style: none; padding: 0; margin: 0; }
#access-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  border-top: 1px solid #1f2937;
  font-size: .78rem;
}
.access-list-main {
  min-width: 0;
  flex: 1;
  cursor: pointer;
}
.access-list-main span, .access-list-main small { display: block; }
.access-list-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.access-list-main small { color: var(--muted); }
.access-list-actions { display: flex; width: 100%; gap: .35rem; padding-left: 1.85rem; }
.access-list-actions .mini-btn {
  flex: 1;
  min-height: 32px;
  display: grid;
  place-items: center;
  text-align: center;
  text-decoration: none;
}
.access-empty { min-height: 44px; }
.access-kind-symbol { width: 1.35rem; text-align: center; flex-shrink: 0; }
.nearest-access {
  padding: .65rem 1rem;
  border-bottom: 1px solid #1f2937;
  background: rgba(37, 99, 235, .1);
  font-size: .76rem;
}
.nearest-access strong { display: block; margin-bottom: .35rem; }
.nearest-access a { color: #93c5fd; text-decoration: none; }
.nearest-access-row { margin-top: .25rem; }
.access-marker {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 2px solid white;
  border-radius: 50%;
  color: white;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}
.access-marker.vehicle { background: #16a34a; }
.access-marker.four_by_four { background: #d97706; }
.access-marker.launch { background: #0284c7; }
.access-marker.emergency { background: #dc2626; }
.access-marker.barrier { background: #4b5563; }
#map.is-placing { cursor: crosshair; }

.map-dialog {
  position: absolute;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(15, 23, 42, .82);
}
.map-dialog[hidden] { display: none; }
.map-dialog-content {
  width: min(460px, 100%);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 1.25rem;
  border: 1px solid #374151;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 45px rgba(0, 0, 0, .5);
}
.map-dialog-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.map-dialog-header h2 { margin: 0; font-size: 1.05rem; }
.map-dialog-header button { border: 0; background: none; color: var(--text); font-size: 1.5rem; cursor: pointer; }
.map-dialog-content label { display: block; margin-top: .75rem; color: var(--muted); font-size: .8rem; }
.map-dialog-content input, .map-dialog-content select, .map-dialog-content textarea {
  width: 100%;
  margin-top: .3rem;
  padding: .55rem .65rem;
  border: 1px solid #374151;
  border-radius: 6px;
  background: #1f2937;
  color: var(--text);
  font: inherit;
}
.coordinate-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.map-dialog-actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: .5rem; margin-top: 1rem; }
.map-dialog-actions button { border: 0; border-radius: 6px; padding: .55rem .75rem; color: white; background: var(--accent); cursor: pointer; }
.map-dialog-actions .secondary-btn { background: #374151; }
.map-dialog-actions .danger-btn { background: var(--danger); }
.client-details-content { width: min(560px, 100%); }
.client-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
}
.client-details-grid > div {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 0;
  padding: .65rem;
  border: 1px solid #374151;
  border-radius: 6px;
  background: #1f2937;
}
.client-details-grid small { color: var(--muted); }
.client-details-grid strong { overflow-wrap: anywhere; }
.client-details-grid .details-wide { grid-column: 1 / -1; }
.group-size-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: .65rem; margin-top: .65rem; }
.group-size-form select { width: 100%; margin-top: .35rem; }
.group-size-form button, .client-command-bar button, .command-link, .bulk-alert-actions button {
  border: 0;
  border-radius: 6px;
  padding: .6rem .75rem;
  background: var(--accent);
  color: white;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}
.client-command-bar { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: 1rem; }
.client-command-bar .danger-btn { background: var(--danger); }
.client-delete-btn { width: 100%; margin-top: 1rem; }
.command-link.is-disabled { opacity: .45; pointer-events: none; }
.client-nearest-access { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid #374151; }
.client-nearest-access > strong { display: block; margin-bottom: .5rem; }
.client-checklist { margin-top: .8rem; padding: .65rem; border: 1px solid #374151; border-radius: 6px; }
.client-checklist legend { color: var(--muted); font-size: .8rem; }
.client-checklist > div { display: grid; max-height: 190px; overflow-y: auto; }
.client-checklist label {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: .5rem;
  margin: 0;
  padding: .45rem .2rem;
  border-bottom: 1px solid #374151;
  color: var(--text);
}
.client-checklist input { width: auto; margin: 0; grid-row: 1 / 3; }
.client-checklist small { color: var(--muted); }
.bulk-alert-summary { margin-top: .8rem; padding: .7rem; border-left: 3px solid var(--accent); background: #1f2937; font-weight: 700; }
.bulk-alert-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.bulk-alert-actions .secondary-btn { background: #374151; }
.bulk-alert-history { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid #374151; }
.account-content { width: min(560px, 100%); }
.account-section + .account-section { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #374151; }
.account-section h3 { margin: 0 0 .65rem; font-size: .95rem; }
.account-subscription-summary { display: grid; gap: .3rem; padding: .8rem; border: 1px solid #374151; border-radius: 6px; background: #1f2937; }
.account-subscription-summary strong.is-active { color: #4ade80; }
.account-subscription-summary strong.is-inactive { color: #f87171; }
.account-subscription-summary span { color: var(--muted); font-size: .85rem; }
.account-paypal-button { margin-top: .8rem; }
.account-submit-btn {
  width: 100%;
  margin-top: .8rem;
  padding: .65rem .8rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}
.bulk-alert-history > strong { display: block; margin-bottom: .5rem; }
.bulk-alert-history-row { display: flex; flex-direction: column; gap: .25rem; padding: .55rem 0; border-bottom: 1px solid #374151; }
.bulk-alert-history-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-alert-history-row small { color: var(--muted); }
.error.success { color: #86efac; }
.route-editor-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .5rem;
  margin-top: 1rem;
  padding-top: .75rem;
  border-top: 1px solid #374151;
}
.route-editor-actions[hidden] { display: none; }
.route-editor-actions strong, .route-editor-actions span { grid-column: 1 / -1; }
.route-editor-actions button, .map-toolbar button, .navigation-panel button {
  border: 0;
  border-radius: 6px;
  padding: .5rem .65rem;
  color: white;
  background: var(--accent);
  cursor: pointer;
}
.route-editor-actions .danger-btn { background: var(--danger); }
.map-toolbar, .navigation-panel {
  position: absolute;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem;
  border: 1px solid #374151;
  border-radius: 8px;
  background: rgba(17, 24, 39, .96);
  color: var(--text);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
}
.map-toolbar[hidden], .navigation-panel[hidden] { display: none; }
.map-toolbar { top: .75rem; left: calc(280px + .75rem); }
.navigation-panel { right: .75rem; bottom: 1.5rem; flex-direction: column; align-items: stretch; max-width: 280px; }
.route-line { stroke-linecap: round; stroke-linejoin: round; }
.alert-pending { color: #fbbf24; }
.alert-received { color: #93c5fd; }
.alert-acknowledged { color: #86efac; }

.marker-label {
  background: rgba(17,24,39,.9);
  color: #fff;
  min-width: 150px;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: .75rem;
  border: 1px solid rgba(255,255,255,.2);
}
.marker-label::before { border-top-color: rgba(17,24,39,.9); }
.marker-label strong, .marker-label span { display: block; }
.marker-label strong { margin-bottom: 2px; font-size: .82rem; }
.marker-label span { white-space: nowrap; color: #e5e7eb; line-height: 1.35; }

/* --- Overlay abonnement expiré --- */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.overlay[hidden] { display: none; }
.overlay-card {
  background: var(--panel);
  padding: 2rem 2.5rem;
  border-radius: 12px;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.overlay-card h2 { margin-top: 0; }
.muted { color: var(--muted); font-size: .85rem; }

/* --- Panneau super-admin --- */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #1f2937;
}
.panel-header h1 { margin: 0; font-size: 1.2rem; }
.panel-header p { margin: .2rem 0 0; }
.panel-header-actions { display: flex; gap: .5rem; }
.panel-header-actions a, .panel-header-actions button, .secondary-btn {
  padding: .55rem .75rem;
  border: 1px solid #475569;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}
.panel-section {
  padding: 1.5rem;
  width: min(1180px, 100%);
  margin: 0 auto;
}
.panel-section h2 {
  font-size: .85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .75rem;
}
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: .75rem;
}
.inline-form input {
  flex: 1 1 180px;
  padding: .6rem .7rem;
  border-radius: 8px;
  border: 1px solid #374151;
  background: #1f2937;
  color: var(--text);
}
.inline-form .pw-wrap,
.inline-form select,
.inline-form label {
  flex: 1 1 180px;
  min-width: 0;
}
.inline-form label {
  display: grid;
  gap: .35rem;
  color: var(--muted);
  font-size: .8rem;
}
.inline-form select {
  min-height: 42px;
  padding: .6rem .7rem;
  border: 1px solid #374151;
  border-radius: 8px;
  background: #1f2937;
  color: var(--text);
  font: inherit;
}
.inline-form button {
  padding: .6rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
}
.activity-form {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(150px, 1fr);
  gap: 1rem;
  padding: 1rem;
  border: 1px solid #334155;
  border-radius: 8px;
}
.activity-form label { display: grid; gap: .35rem; color: var(--muted); font-size: .85rem; }
.activity-form input {
  min-height: 42px;
  padding: .55rem .65rem;
  border: 1px solid #475569;
  border-radius: 6px;
  background: #1f2937;
  color: var(--text);
}
.activity-form .checkbox-inline { display: flex; }
.activity-form .checkbox-inline input { min-height: auto; }
.activity-time-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.activity-form > button { min-height: 44px; border: 0; border-radius: 6px; background: var(--accent); color: white; cursor: pointer; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .75rem; }
.section-heading h2 { margin: 0; }
.activity-list { display: grid; gap: .8rem; }
.activity-card { padding: 1rem; border: 1px solid #334155; border-radius: 8px; }
.activity-card-main { display: flex; justify-content: space-between; gap: 1rem; }
.activity-card h3 { margin: 0 0 .45rem; }
.activity-card p { margin: .2rem 0; color: var(--muted); }
.activity-card span { display: block; margin-top: .8rem; color: var(--muted); font-size: .75rem; }
.activity-card code { display: inline-block; margin-top: .2rem; padding: .35rem .5rem; background: #1f2937; font-size: 1rem; }
.activity-card-actions { display: flex; gap: .5rem; margin-top: .8rem; }
.activity-card-actions button { min-height: 40px; }
.danger-btn { padding: .55rem .75rem; border: 1px solid #991b1b; border-radius: 6px; background: transparent; color: #fca5a5; cursor: pointer; }
.print-sheet { display: none; }
.checkbox-inline {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  color: var(--text);
}
.qr-box {
  display: inline-block;
  background: #fff;
  padding: 4px;
  border-radius: 6px;
  line-height: 0;
}
.org-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.org-table th, .org-table td {
  text-align: left;
  padding: .6rem .5rem;
  border-bottom: 1px solid #1f2937;
}
.org-table code {
  background: #1f2937;
  padding: .1rem .4rem;
  border-radius: 4px;
}
.org-table button {
  padding: .4rem .7rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: .8rem;
}
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}
.org-actions { display: flex; flex-wrap: wrap; gap: .4rem; min-width: 160px; }
.org-table .support-btn { background: #0f766e; }
.org-table .organization-delete-btn { background: #991b1b; color: #fff; }
.org-table .test-config-btn { background: #b45309; color: #fff; }
.account-type-badge { display: inline-block; margin-top: .3rem; padding: .15rem .4rem; border-radius: 4px; font-size: .68rem; font-weight: 700; letter-spacing: 0; }
.account-type-badge.is-test { background: #78350f; color: #fde68a; }
.account-type-badge.is-paid { background: #064e3b; color: #a7f3d0; }
.status-suspended { color: #fca5a5; font-weight: 700; }
.org-table .reactivate-btn { background: #7c3aed; color: #fff; }
.trial-request-table { min-width: 980px; }
.request-count { display: inline-block; min-width: 1.5rem; padding: .12rem .4rem; border-radius: 999px; background: #b45309; color: #fff; text-align: center; }
.trial-status { display: inline-block; padding: .18rem .45rem; border-radius: 4px; font-size: .72rem; font-weight: 700; }
.trial-status.is-pending { background: #78350f; color: #fde68a; }
.trial-status.is-approved { background: #064e3b; color: #a7f3d0; }
.trial-status.is-rejected { background: #450a0a; color: #fecaca; }
.trial-status.is-unverified { background: #334155; color: #cbd5e1; }
.risk-flags { display: grid; gap: .2rem; color: #fbbf24; font-size: .75rem; }
.risk-clear { color: #86efac; font-size: .75rem; }
.trial-review-summary { padding: .75rem; border: 1px solid #334155; border-radius: 6px; background: #111827; color: var(--muted); overflow-wrap: anywhere; }
.trial-review-summary strong { color: var(--text); }
#trial-review-form textarea { resize: vertical; }
.org-table .trial-approve-btn { background: #047857; }
.org-table .trial-reject-btn { background: #991b1b; }
.support-panel {
  border-top: 1px solid #334155;
  border-bottom: 1px solid #334155;
  max-width: 100%;
  background: #0b1220;
}
.support-panel[hidden] { display: none; }
.support-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.support-heading h2 { margin: 0 0 .3rem; color: #5eead4; }
.support-heading h3 { margin: 0; font-size: 1.25rem; }
.support-notice { padding: .7rem; border-left: 3px solid #14b8a6; background: #112b2b; color: #ccfbf1; font-size: .85rem; }
.support-content > h3 { margin: 1.4rem 0 .65rem; font-size: .95rem; }
.support-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.support-summary > div, .support-activity, .support-alert { padding: .75rem; border: 1px solid #334155; border-radius: 6px; background: var(--panel); }
.support-summary span, .support-summary small, .support-activity span, .support-activity small { color: var(--muted); }
.support-activities { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .6rem; }
.support-activity { display: grid; gap: .25rem; }
.support-client-table { min-width: 780px; }
.support-client-table small { color: var(--muted); }
.support-client-table a { color: #5eead4; }
.status-ok { color: var(--online); }
.support-alerts { display: grid; gap: .5rem; }
.support-alert { display: flex; justify-content: space-between; gap: 1rem; }
.support-alert.is-open { border-color: #dc2626; background: #450a0a; }

@media (max-width: 640px) {
  .panel-header { align-items: flex-start; padding: .85rem; }
  .panel-header-actions { flex-direction: column; align-items: stretch; }
  .panel-header-actions a, .panel-header-actions button { min-height: 42px; }
  .panel-section { padding: 1rem .85rem; }
  .inline-form > input,
  .inline-form > .pw-wrap,
  .inline-form > select,
  .inline-form > label,
  .inline-form > button {
    flex: 1 1 100%;
    width: 100%;
  }
  .activity-form { grid-template-columns: 1fr; }
  .activity-time-fields { grid-template-columns: 1fr 1fr; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .activity-card-main { align-items: flex-start; }
  .activity-card .qr-box img, .activity-card .qr-box canvas { width: 108px !important; height: 108px !important; }
  .activity-card-actions { flex-direction: column; }
  .support-summary { grid-template-columns: 1fr; }
  .support-heading { align-items: stretch; flex-direction: column; }
  .support-alert { flex-direction: column; gap: .25rem; }
  #map-screen { overflow: hidden; }
  #map { width: 100%; min-width: 100%; }
  #sidebar {
    position: fixed;
    z-index: 1200;
    inset: 0 auto 0 0;
    width: min(88vw, 360px);
    min-width: 0;
    box-shadow: 10px 0 28px rgba(0,0,0,.45);
    transform: translateX(0);
    transition: transform .2s ease;
  }
  #map-screen.sidebar-collapsed #sidebar { transform: translateX(-105%); }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    z-index: 1190;
    inset: 0;
    background: rgba(0,0,0,.45);
  }
  .sidebar-backdrop[hidden], #map-screen.sidebar-collapsed .sidebar-backdrop { display: none; }
  .sidebar-open-btn {
    display: block;
    position: fixed;
    z-index: 1180;
    top: max(.65rem, env(safe-area-inset-top));
    left: .65rem;
    min-height: 44px;
    padding: .55rem .8rem;
    border: 1px solid #475569;
    border-radius: 7px;
    background: var(--panel);
    color: var(--text);
    font-weight: 700;
  }
  #map-screen:not(.sidebar-collapsed) .sidebar-open-btn { display: none; }
  #map-screen.sidebar-collapsed .leaflet-top.leaflet-left { top: 58px; }
  .sidebar-close-btn { display: block; }
  .sidebar-header, .access-panel-header { padding-left: .65rem; padding-right: .65rem; }
  .refresh-settings { flex-wrap: wrap; padding-left: .65rem; padding-right: .65rem; }
  .access-panel { max-height: 28vh; }
  #access-list li, .nearest-access { padding-left: .65rem; padding-right: .65rem; }
  #client-list li { flex-wrap: wrap; padding-left: .65rem; padding-right: .65rem; }
  #client-list .client-meta { flex: 1 1 calc(100% - 22px); }
  #client-list .client-actions { width: 100%; justify-content: flex-end; }
  #client-list .client-meta span, #client-list .client-meta small { overflow-wrap: anywhere; }
  .map-dialog { padding: .5rem; }
  .map-dialog-content { max-height: calc(100vh - 1rem); padding: 1rem; overflow-x: hidden; }
  .coordinate-fields { grid-template-columns: 1fr; gap: 0; }
  .map-dialog-actions { grid-template-columns: 1fr 1fr; }
  .map-dialog-actions .danger-btn { grid-column: 1 / -1; }
  .map-toolbar { left: .4rem; right: .4rem; top: .4rem; flex-wrap: wrap; }
  .client-details-grid, .client-command-bar { grid-template-columns: 1fr; }
  .client-details-grid .details-wide { grid-column: auto; }
  .group-size-form { grid-template-columns: 1fr; }
  .navigation-panel { right: .4rem; bottom: .75rem; max-width: calc(100vw - .8rem); }
}

@media print {
  @page { size: A4 portrait; margin: 8mm; }
  html, body { width: 210mm; min-height: 297mm; margin: 0; background: white; color: black; }
  body > *:not(.print-sheet) { display: none !important; }
  .print-sheet { display: block; }
  .print-page {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 132mm);
    gap: 5mm;
    width: 194mm;
    height: 269mm;
    break-after: page;
    page-break-after: always;
  }
  .print-page:last-child { break-after: auto; page-break-after: auto; }
  .print-activity {
    box-sizing: border-box;
    height: 132mm;
    padding: 5mm;
    overflow: hidden;
    border: .4mm solid #111;
    text-align: center;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .print-brand { margin: 0; font-size: 9pt; font-weight: 800; letter-spacing: 2px; }
  .print-activity h2 { min-height: 13mm; margin: 2mm 0 1mm; font-size: 15pt; line-height: 1.15; }
  .print-details { margin: 0 0 2mm; font-size: 9pt; }
  .print-qr { display: flex; justify-content: center; }
  .print-qr img, .print-qr canvas { width: 57mm !important; height: 57mm !important; }
  .print-instruction { margin: 2mm 0 1mm; font-size: 9pt; }
  .print-code { margin: 0; font-size: 10pt; }
}
