/* =============================================================================
   DOKOTERA — Composants d'interface
   ========================================================================== */

/* --- Boutons -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 11px var(--s-5);
  border-radius: var(--r-full);
  font-weight: 700;
  font-size: var(--fs-base);
  line-height: 1.2;
  border: 1.5px solid transparent;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast),
    transform var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
  text-align: center;
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* Action principale : le jaune de la charte sur texte noir. */
.btn--primary {
  background: var(--brand);
  color: var(--ink);
  border-color: var(--brand);
}
.btn--primary:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
  box-shadow: var(--shadow-brand);
}

/* Action forte alternative. */
.btn--dark {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn--dark:hover {
  background: var(--ink-700);
  border-color: var(--ink-700);
}

.btn--outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn--outline:hover {
  border-color: var(--ink);
  background: var(--surface-3);
}

.btn--ghost {
  background: transparent;
  color: var(--ink-600);
}
.btn--ghost:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.btn--danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: transparent;
}
.btn--danger:hover {
  background: var(--danger);
  color: var(--paper);
}

.btn--sm {
  padding: 7px var(--s-4);
  font-size: var(--fs-sm);
}
.btn--lg {
  padding: 15px var(--s-7);
  font-size: var(--fs-md);
}
.btn--block {
  width: 100%;
}

.btn[disabled],
.btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.btn-group {
  display: inline-flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

/* --- Cartes --------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-6);
}

.card--flat {
  border-radius: var(--r-md);
  padding: var(--s-5);
}

.card--hover {
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
}
.card--hover:hover {
  border-color: var(--ink);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
  flex-wrap: wrap;
}

.card__title {
  font-size: var(--fs-lg);
  font-weight: 700;
}

.card__sub {
  color: var(--ink-500);
  font-size: var(--fs-sm);
  margin-top: 2px;
}

/* --- Statistiques --------------------------------------------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--s-4);
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  position: relative;
  overflow: hidden;
}

/* Filet jaune vertical : rappel discret de la couleur d'accent. */
.stat::before {
  content: '';
  position: absolute;
  left: 0;
  top: var(--s-5);
  bottom: var(--s-5);
  width: 3px;
  background: var(--brand);
  border-radius: 0 var(--r-full) var(--r-full) 0;
}

.stat--dark {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.stat--dark .stat__label {
  color: var(--ink-300);
}
.stat--dark .stat__value {
  color: var(--brand);
}

.stat__label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  color: var(--ink-400);
}

.stat__value {
  font-size: var(--fs-2xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-top: var(--s-2);
  line-height: 1.1;
}

.stat__hint {
  font-size: var(--fs-sm);
  color: var(--ink-500);
  margin-top: var(--s-2);
}

/* --- Badges et pastilles --------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--surface-3);
  color: var(--ink-600);
  white-space: nowrap;
}

.badge--brand {
  background: var(--brand-soft);
  color: var(--ink);
}
.badge--dark {
  background: var(--ink);
  color: var(--brand);
}
.badge--success {
  background: var(--success-bg);
  color: var(--success);
}
.badge--danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.badge--warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.badge--info {
  background: var(--info-bg);
  color: var(--info);
}
.badge--outline {
  background: transparent;
  border: 1px solid var(--line-strong);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: currentColor;
  flex-shrink: 0;
}

/* --- Avatars -------------------------------------------------------------- */

.avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--r-full);
  background: var(--brand-soft);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: var(--fs-base);
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--sm {
  width: 34px;
  height: 34px;
  font-size: var(--fs-xs);
}
.avatar--lg {
  width: 68px;
  height: 68px;
  font-size: var(--fs-xl);
}
.avatar--xl {
  width: 104px;
  height: 104px;
  font-size: var(--fs-3xl);
}

/* --- Formulaires ---------------------------------------------------------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s-5);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-width: 0;
}

.field--full {
  grid-column: 1 / -1;
}

.label {
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--ink-700);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.label .req {
  color: var(--danger);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 11px var(--s-4);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-size: var(--fs-base);
  color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--ink-300);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--ink-400);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.input[aria-invalid='true'] {
  border-color: var(--danger);
}

.textarea {
  min-height: 118px;
  resize: vertical;
  line-height: var(--lh-normal);
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%23000' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s-4) center;
  padding-right: var(--s-8);
}

.hint {
  font-size: var(--fs-xs);
  color: var(--ink-400);
}

.field-error {
  font-size: var(--fs-xs);
  color: var(--danger);
  font-weight: 600;
}

/* Champ avec icone en tete de ligne (+ action optionnelle a droite). */
.input-icon {
  position: relative;
  display: block;
}

.input-icon > svg {
  position: absolute;
  left: var(--s-4);
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--ink-400);
  pointer-events: none;
  transition: color var(--t-fast);
}

.input-icon:focus-within > svg {
  color: var(--ink);
}

.input-icon > .input {
  padding-left: 44px;
}

.input-icon > .input[data-has-action] {
  padding-right: 46px;
}

.input-icon__action {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink-400);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
}

.input-icon__action:hover {
  color: var(--ink);
  background: var(--surface-3);
}

.input-icon__action svg {
  width: 18px;
  height: 18px;
}

.input-group {
  display: flex;
  align-items: stretch;
}
.input-group .input {
  border-radius: var(--r-sm) 0 0 var(--r-sm);
}
.input-group .btn {
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

/* Cases a cocher et boutons radio personnalises. */
.check {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  cursor: pointer;
  font-size: var(--fs-base);
  line-height: 1.45;
}

.check input[type='checkbox'],
.check input[type='radio'] {
  width: 19px;
  height: 19px;
  accent-color: var(--ink);
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}

/* Carte selectionnable (operateur Mobile Money, type de compte...). */
.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  cursor: pointer;
  background: var(--surface);
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}

.choice:hover {
  border-color: var(--ink-400);
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice:has(input:checked) {
  border-color: var(--ink);
  background: var(--brand-mist);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.choice__mark {
  width: 20px;
  height: 20px;
  border-radius: var(--r-full);
  border: 2px solid var(--line-strong);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  transition: border-color var(--t-fast);
}

.choice:has(input:checked) .choice__mark {
  border-color: var(--ink);
}
.choice:has(input:checked) .choice__mark::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: var(--r-full);
  background: var(--ink);
}

.choice__body {
  flex: 1;
  min-width: 0;
}
.choice__title {
  font-weight: 700;
}
.choice__desc {
  font-size: var(--fs-sm);
  color: var(--ink-500);
}

/* Interrupteur. */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
}
.switch__track {
  width: 46px;
  height: 26px;
  border-radius: var(--r-full);
  background: var(--surface-4);
  position: relative;
  transition: background var(--t-base);
  flex-shrink: 0;
}
.switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: var(--r-full);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-base);
}
.switch input:checked + .switch__track {
  background: var(--brand);
}
.switch input:checked + .switch__track::after {
  transform: translateX(20px);
}
.switch input:focus-visible + .switch__track {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

/* --- Alertes -------------------------------------------------------------- */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  border-left: 4px solid;
  background: var(--surface-3);
  border-color: var(--ink-400);
}

.alert svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert--success {
  background: var(--success-bg);
  border-color: var(--success);
  color: #0a5230;
}
.alert--error {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: #8c1c1c;
}
.alert--warning {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: #7a4d00;
}
.alert--info {
  background: var(--info-bg);
  border-color: var(--info);
  color: #16457c;
}
.alert--brand {
  background: var(--brand-mist);
  border-color: var(--brand);
  color: var(--ink);
}

.alert__title {
  font-weight: 700;
  margin-bottom: 2px;
}

/* Zone de messages flash, en surimpression. */
.flash-stack {
  position: fixed;
  top: calc(var(--header-h) + var(--s-4));
  right: var(--gutter);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  max-width: min(420px, calc(100vw - 2 * var(--gutter)));
}

.flash-stack .alert {
  box-shadow: var(--shadow-lg);
  background-color: var(--paper);
  animation: flash-in var(--t-slow) ease-out;
}

@keyframes flash-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --- Tableaux ------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-base);
  min-width: 640px;
}

.table thead th {
  text-align: left;
  padding: var(--s-4) var(--s-5);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-400);
  font-weight: 700;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table tbody td {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: background var(--t-fast);
}
.table tbody tr:hover {
  background: var(--surface-2);
}

.table tfoot td {
  padding: var(--s-4) var(--s-5);
  background: var(--surface-2);
  font-weight: 700;
  border-top: 1px solid var(--line-strong);
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* --- Etat vide ------------------------------------------------------------ */

.empty {
  text-align: center;
  padding: var(--s-10) var(--s-6);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.empty__icon {
  width: 60px;
  height: 60px;
  margin: 0 auto var(--s-4);
  border-radius: var(--r-full);
  background: var(--brand-soft);
  display: grid;
  place-items: center;
}
.empty__icon svg {
  width: 28px;
  height: 28px;
}

.empty__title {
  font-size: var(--fs-lg);
  font-weight: 700;
  margin-bottom: var(--s-2);
}

.empty__text {
  color: var(--ink-500);
  max-width: 46ch;
  margin: 0 auto var(--s-5);
}

/* --- Onglets -------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: var(--s-1);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab {
  padding: var(--s-3) var(--s-4);
  font-weight: 600;
  color: var(--ink-500);
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1px;
  transition: color var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-active {
  color: var(--ink);
  border-color: var(--brand);
}

/* --- Pagination ----------------------------------------------------------- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin-top: var(--s-6);
}

.pagination__link {
  min-width: 40px;
  height: 40px;
  padding-inline: var(--s-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: var(--fs-sm);
  transition: all var(--t-fast);
}

.pagination__link:hover {
  border-color: var(--ink);
}

.pagination__link.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--brand);
}

.pagination__link.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* --- Menu deroulant -------------------------------------------------------- */

.dropdown {
  position: relative;
}

.dropdown__panel {
  position: absolute;
  right: 0;
  top: calc(100% + var(--s-2));
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: var(--s-2);
  z-index: var(--z-dropdown);
  display: none;
}

.dropdown__panel.is-open {
  display: block;
  animation: dropdown-in var(--t-fast) ease-out;
}

@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-3);
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: var(--fs-base);
  width: 100%;
  text-align: left;
  transition: background var(--t-fast);
}

.dropdown__item:hover {
  background: var(--surface-3);
}

.dropdown__item svg {
  width: 17px;
  height: 17px;
  color: var(--ink-500);
}

.dropdown__sep {
  height: 1px;
  background: var(--line);
  margin: var(--s-2) 0;
}

/* --- Cloche de notification ------------------------------------------------ */

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--r-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color var(--t-fast), background var(--t-fast);
  position: relative;
}

.icon-btn:hover {
  border-color: var(--ink);
  background: var(--surface-3);
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.icon-btn__count {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 19px;
  height: 19px;
  padding-inline: 5px;
  background: var(--ink);
  color: var(--brand);
  border-radius: var(--r-full);
  font-size: 0.6875rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--paper);
}

/* --- Fil d'Ariane ---------------------------------------------------------- */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-sm);
  color: var(--ink-400);
  flex-wrap: wrap;
}

.breadcrumb a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.breadcrumb__sep {
  opacity: 0.5;
}

/* --- Liste de definitions -------------------------------------------------- */

.data-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.data-list__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 1px dashed var(--line);
}

.data-list__row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.data-list__key {
  color: var(--ink-500);
  font-size: var(--fs-sm);
  flex-shrink: 0;
}

.data-list__val {
  font-weight: 600;
  text-align: right;
  min-width: 0;
  word-break: break-word;
}

/* --- Progression ----------------------------------------------------------- */

.progress {
  height: 8px;
  background: var(--surface-4);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  background: var(--brand);
  border-radius: var(--r-full);
  transition: width var(--t-slow);
}

/* --- Etoiles d'evaluation --------------------------------------------------- */

.rating {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--brand-deep);
}
.rating svg {
  width: 15px;
  height: 15px;
}
.rating__value {
  font-weight: 700;
  color: var(--ink);
  margin-left: var(--s-1);
}

.rating-input {
  display: inline-flex;
  flex-direction: row-reverse;
  gap: var(--s-1);
}
.rating-input input {
  position: absolute;
  opacity: 0;
}
.rating-input label {
  cursor: pointer;
  color: var(--line-strong);
  transition: color var(--t-fast);
}
.rating-input label svg {
  width: 30px;
  height: 30px;
}
.rating-input input:checked ~ label,
.rating-input label:hover,
.rating-input label:hover ~ label {
  color: var(--brand-deep);
}

/* --- Separateur avec titre --------------------------------------------------- */

.divider-label {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  color: var(--ink-400);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.divider-label::before,
.divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* --- Fenetre modale ------------------------------------------------------------ */

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--s-5);
  overflow-y: auto;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 12, 8, 0.55);
  backdrop-filter: blur(3px);
  animation: modal-fade var(--t-base) both;
}

.modal__dialog {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin: auto;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-rise var(--t-slow) both;
}

/* Le formulaire d'inscription a besoin de deux colonnes. */
.modal__dialog--wide {
  max-width: 580px;
}

.modal__close {
  position: absolute;
  top: var(--s-4);
  right: var(--s-4);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--ink-500);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
  transition: background var(--t-fast), color var(--t-fast);
}

.modal__close:hover {
  background: var(--ink);
  color: var(--paper);
}

.modal__close svg {
  width: 17px;
  height: 17px;
}

.modal__head {
  padding: var(--s-8) var(--s-7) var(--s-6);
  text-align: center;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--brand-mist), var(--surface));
}

.modal__mark {
  width: 46px;
  height: 46px;
  border-radius: var(--r-md);
  background: var(--ink);
  display: grid;
  place-items: center;
  margin: 0 auto var(--s-4);
}

.modal__title {
  font-size: var(--fs-xl);
  letter-spacing: -0.03em;
  margin: 0;
}

.modal__lead {
  color: var(--ink-500);
  font-size: var(--fs-sm);
  margin-top: var(--s-2);
}

.modal__body {
  padding: var(--s-7);
  max-height: min(58vh, 560px);
  overflow-y: auto;
}

.modal__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--s-2) var(--s-5);
  padding: var(--s-4) var(--s-6);
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-400);
  font-size: var(--fs-xs);
}

.modal__foot svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.modal__switch {
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--ink-500);
}

/* Selecteur segmente (Se connecter / Creer un compte). */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-top: var(--s-6);
  background: var(--surface-3);
  border-radius: var(--r-full);
}

.segmented__item {
  border: 0;
  background: none;
  border-radius: var(--r-full);
  padding: 9px var(--s-4);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-500);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}

.segmented__item:hover {
  color: var(--ink);
}

.segmented__item.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

/* Bouton qui se comporte visuellement comme un lien. */
.link-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--brand-deep);
}

/* Verrouillage du defilement de la page pendant l'ouverture. */
body.is-modal-open {
  overflow: hidden;
}

@keyframes modal-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modal-rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal__backdrop,
  .modal__dialog {
    animation: none;
  }
}

@media (max-width: 560px) {
  .modal {
    padding: 0;
    place-items: end stretch;
  }
  .modal__dialog {
    max-width: none;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }
  .modal__head {
    padding: var(--s-7) var(--s-5) var(--s-5);
  }
  .modal__body {
    padding: var(--s-6) var(--s-5);
    max-height: 62vh;
  }
}

/* --- Bulle d'aide / d'erreur au survol ----------------------------------------- */

/*
   N'importe quel element porteur de `data-tip` affiche son message au survol
   ET a la prise de focus (clavier), sous l'element. Le message reste dans le
   DOM via `aria-describedby` cote JS pour les lecteurs d'ecran.
*/
[data-tip] {
  position: relative;
  --tip-bg: var(--ink);
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: var(--z-dropdown);
  width: max-content;
  max-width: min(280px, 100%);
  padding: 8px 11px;
  border-radius: var(--r-sm);
  background: var(--tip-bg);
  color: var(--paper);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity var(--t-fast), transform var(--t-fast);
}

/* Petite fleche vers l'element decrit. */
[data-tip]::before {
  content: '';
  position: absolute;
  top: calc(100% + 3px);
  left: 14px;
  z-index: var(--z-dropdown);
  border: 5px solid transparent;
  border-bottom-color: var(--tip-bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-fast);
}

[data-tip]:hover::after,
[data-tip]:focus-within::after,
[data-tip]:hover::before,
[data-tip]:focus-within::before {
  opacity: 1;
  transform: none;
}

/* Variante centree, pour les elements etroits (icones d'aide). */
[data-tip][data-tip-center]::after {
  left: 50%;
  transform: translate(-50%, -4px);
}
[data-tip][data-tip-center]::before {
  left: 50%;
  margin-left: -5px;
}
[data-tip][data-tip-center]:hover::after,
[data-tip][data-tip-center]:focus-within::after {
  transform: translateX(-50%);
}

/* Champ refuse par le serveur : bordure rouge + bulle rouge au survol. */
.field.has-error {
  --tip-bg: var(--danger);
}

.field.has-error .label {
  color: var(--danger);
}

.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.field.has-error .input:focus,
.field.has-error .select:focus,
.field.has-error .textarea:focus {
  box-shadow: 0 0 0 4px rgba(192, 38, 38, 0.14);
}

/* Pastille d'alerte a droite du libelle. */
.field.has-error .label::after {
  content: '!';
  width: 16px;
  height: 16px;
  border-radius: var(--r-full);
  background: var(--danger);
  color: var(--paper);
  font-size: 11px;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
  margin-left: auto;
}

@media (hover: none) {
  /* Sans survol possible, la bulle s'affiche des que le champ est actif. */
  .field.has-error::after,
  .field.has-error::before {
    opacity: 1;
    transform: none;
  }
}

/* Case a cocher refusee (conditions d'utilisation non acceptees). */
.check.has-error {
  --tip-bg: var(--danger);
  color: var(--danger);
}

.check.has-error input[type='checkbox'] {
  accent-color: var(--danger);
  outline: 2px solid var(--danger);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Lien discret aligne a droite d'un libelle de champ (mot de passe oublie). */
.label__link {
  margin-left: auto;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-500);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
}

.label__link:hover {
  color: var(--ink);
  text-decoration-color: var(--brand);
}

/* Ligne de reglage avec interrupteur (preferences de notification). */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  padding: var(--s-4) var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--t-fast);
}

.switch-row:hover {
  border-color: var(--line-strong);
}

.switch-row__label {
  display: block;
  font-weight: 700;
  font-size: var(--fs-base);
}

.switch-row__hint {
  display: block;
  margin-top: 3px;
  font-size: var(--fs-sm);
  color: var(--ink-500);
}

/* --- Panneau « geo » : distance patient <-> cabinet + carte ------------------
   Fenetre de terminal : barre de titre, commande, colonnes alignees en
   monospace. La carte Google s'affiche sous la sortie texte. */

.geo-panel {
  border: 1px solid var(--ink);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}

.geo-panel__bar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 8px var(--s-4);
  background: var(--ink-700);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.geo-panel__dots {
  display: inline-flex;
  gap: 6px;
}
.geo-panel__dots i {
  width: 10px;
  height: 10px;
  border-radius: var(--r-full);
  background: var(--ink-500);
}
.geo-panel__dots i:first-child {
  background: var(--brand);
}
.geo-panel__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-300);
  font-size: var(--fs-xs);
}
.geo-panel__status {
  color: var(--ink-300);
  font-size: var(--fs-xs);
  white-space: pre;
}
.geo-panel__status.is-ok {
  color: var(--monegasy-on-dark);
}
.geo-panel__status.is-fail {
  color: #ff6b6b;
}

.geo-panel__term {
  padding: var(--s-4) var(--s-5);
  line-height: 1.8;
}
.geo-panel__cmd {
  color: var(--paper);
  margin-bottom: var(--s-2);
  overflow-wrap: anywhere;
}
.geo-panel__prompt {
  color: var(--brand);
  margin-right: var(--s-2);
}
.geo-panel__dim {
  color: var(--ink-300);
}
.geo-panel__num {
  color: var(--paper);
  margin-right: var(--s-3);
}

.geo-panel__kv {
  margin: 0;
}
.geo-panel__kv > div,
.geo-panel__kv--inline {
  display: grid;
  grid-template-columns: 10ch minmax(0, 1fr);
  gap: var(--s-3);
  align-items: baseline;
}
.geo-panel__kv dt,
.geo-panel__kv--inline > span:first-child {
  color: var(--brand);
}
.geo-panel__kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.geo-panel__btn {
  margin-left: var(--s-2);
  padding: 1px 10px;
  border: 1px solid var(--brand);
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: var(--fs-xs);
  cursor: pointer;
}
.geo-panel__btn:hover {
  background: var(--brand);
  color: var(--ink);
}
.geo-panel__btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.geo-panel__btn:disabled {
  opacity: 0.5;
  cursor: progress;
}

.geo-panel__warn {
  margin-top: var(--s-2);
  color: #ffb547;
}

.geo-panel__table {
  width: 100%;
  margin-top: var(--s-3);
  border-collapse: collapse;
}
.geo-panel__table th {
  text-align: left;
  font-weight: 400;
  color: var(--brand);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
  padding: 2px var(--s-2) 4px 0;
}
.geo-panel__table td {
  padding: 3px var(--s-2) 3px 0;
  vertical-align: baseline;
}
.geo-panel__table .is-num {
  text-align: right;
  white-space: nowrap;
}
.geo-panel__table a {
  color: var(--paper);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  text-underline-offset: 3px;
}
.geo-panel__table a:hover {
  text-decoration-color: var(--brand);
}

.geo-panel__map {
  display: block;
  width: 100%;
  height: 340px;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--surface-3);
}

.geo-panel__table tr.is-active td {
  background: rgba(8, 166, 160, 0.12);
}
.geo-panel__table tr.is-active td:first-child {
  color: var(--brand);
}

.geo-panel .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.geo-panel__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  color: var(--ink-300);
}
.geo-panel__note {
  flex: 1 1 280px;
}
.geo-panel__link {
  color: var(--brand);
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .geo-panel__term {
    padding: var(--s-3) var(--s-4);
  }
  .geo-panel__map {
    height: 260px;
  }
  .geo-panel__table th:nth-child(3),
  .geo-panel__table td:nth-child(3) {
    display: none;
  }
}

/* Bloc repliable de la carte (page de recherche). */
.geo-toggle__summary {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
  padding: 6px 14px;
  border: 1.5px solid var(--ink);
  border-radius: var(--r-full);
  font-weight: 700;
  font-size: var(--fs-sm);
  cursor: pointer;
  list-style: none;
}
.geo-toggle__summary::-webkit-details-marker {
  display: none;
}
.geo-toggle__summary svg {
  width: 16px;
  height: 16px;
}
.geo-toggle[open] .geo-toggle__summary {
  background: var(--brand);
}
.geo-toggle__hint {
  font-weight: 400;
  color: var(--ink-500);
}
