/* =========================================================================
   Kelmiora SMS — feuille de style unique
   Palette clinique : blanc dominant, sarcelle pour l'action, gris-bleu froid.
   Aucune ressource externe (police, CDN) : rien ne sort du VPS.
   ========================================================================= */

:root {
  --c-bg: #f2f6f7;
  --c-surface: #ffffff;
  --c-surface-2: #f7fafb;
  --c-surface-3: #eef4f5;
  --c-border: #dde7ea;
  --c-border-strong: #c2d4d9;

  --c-text: #0f262e;
  --c-muted: #5b7581;
  --c-faint: #89a2ac;

  --c-primary: #0d7d8c;
  --c-primary-hover: #0a6674;
  --c-primary-soft: #e3f1f3;
  --c-primary-text: #0a5f6b;
  --c-ring: rgba(13, 125, 140, 0.3);

  --c-success: #0d7350;
  --c-success-soft: #e1f3ea;
  --c-danger: #ad2439;
  --c-danger-soft: #fbe9ec;
  --c-warn: #8f5a00;
  --c-warn-soft: #fcf1de;

  --radius-sm: 7px;
  --radius: 11px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(15, 38, 46, 0.05);
  --shadow: 0 2px 4px rgba(15, 38, 46, 0.05), 0 8px 20px -12px rgba(15, 38, 46, 0.18);
  --shadow-lg: 0 4px 12px rgba(15, 38, 46, 0.07), 0 24px 48px -24px rgba(15, 38, 46, 0.3);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --header-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: #0a1519;
    --c-surface: #0f2027;
    --c-surface-2: #132830;
    --c-surface-3: #17303a;
    --c-border: #1f3b45;
    --c-border-strong: #2c525f;

    --c-text: #e6f0f2;
    --c-muted: #9bb4bd;
    --c-faint: #718e99;

    --c-primary: #2ba3b3;
    --c-primary-hover: #3fb8c8;
    --c-primary-soft: #11333a;
    --c-primary-text: #7fd4e0;
    --c-ring: rgba(43, 163, 179, 0.4);

    --c-success: #3cb98a;
    --c-success-soft: #0e2f26;
    --c-danger: #f1798c;
    --c-danger-soft: #331119;
    --c-warn: #d99a3a;
    --c-warn-soft: #2e2413;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 8px 20px -12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.4), 0 24px 48px -24px rgba(0, 0, 0, 0.8);
  }
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 650;
}

h1 {
  font-size: 1.5rem;
}
h2 {
  font-size: 1.0625rem;
}
h3 {
  font-size: 0.9375rem;
}

p {
  margin: 0 0 0.75rem;
}
p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--c-primary-text);
  text-decoration-color: color-mix(in srgb, var(--c-primary) 35%, transparent);
  text-underline-offset: 2px;
}
a:hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
  border-radius: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--c-surface);
  color: var(--c-text);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* ---------- En-tete ---------- */

.header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: color-mix(in srgb, var(--c-surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--c-border);
}

.header__inner {
  max-width: 1180px;
  height: 100%;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--c-text);
  text-decoration: none;
  flex-shrink: 0;
}

.brand__mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--c-primary), color-mix(in srgb, var(--c-primary) 65%, #0a4f5c));
  display: grid;
  place-items: center;
  box-shadow: 0 1px 2px rgba(10, 79, 92, 0.3);
}
.brand__mark svg {
  width: 19px;
  height: 19px;
  display: block;
}

.brand__name {
  font-weight: 680;
  font-size: 0.9875rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.brand__org {
  display: block;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--c-faint);
  letter-spacing: 0.01em;
}

.nav {
  display: flex;
  gap: 0.125rem;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar {
  display: none;
}

.nav a {
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  color: var(--c-muted);
  font-size: 0.875rem;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.12s, color 0.12s;
}
.nav a:hover {
  background: var(--c-surface-3);
  color: var(--c-text);
}
.nav a[aria-current="page"] {
  background: var(--c-primary-soft);
  color: var(--c-primary-text);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-left: 1rem;
  border-left: 1px solid var(--c-border);
  flex-shrink: 0;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--c-primary-soft);
  color: var(--c-primary-text);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.user-menu__name {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu__role {
  display: block;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--c-faint);
}

/* ---------- Structure de page ---------- */

.main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 4rem;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.page-head__sub {
  margin: 0.25rem 0 0;
  color: var(--c-muted);
  font-size: 0.875rem;
}

.grid-send {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 900px) {
  .grid-send {
    grid-template-columns: 1fr;
  }
}

/* ---------- Cartes ---------- */

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card__head {
  padding: 1.125rem 1.375rem;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card__body {
  padding: 1.375rem;
}

.card__body--tight {
  padding: 1rem 1.375rem;
}

.card__foot {
  padding: 1rem 1.375rem;
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.card__hint {
  font-size: 0.8125rem;
  color: var(--c-muted);
}

/* ---------- Formulaires ---------- */

.field {
  margin-bottom: 1.125rem;
}
.field:last-child {
  margin-bottom: 0;
}

.field__label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 620;
  margin-bottom: 0.375rem;
  letter-spacing: 0.005em;
}

.field__help {
  font-size: 0.8125rem;
  color: var(--c-muted);
  margin: 0.375rem 0 0;
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.12s, box-shadow 0.12s;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--c-faint);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-ring);
}

.input:disabled,
.textarea:disabled {
  background: var(--c-surface-3);
  color: var(--c-muted);
  cursor: not-allowed;
}

.textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.55;
}

.select {
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%235b7581' d='M6 8 0 1.4 1.4 0 6 4.6 10.6 0 12 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 10px;
}

.input--mono {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  letter-spacing: 0.01em;
}

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.575rem 1.05rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s, opacity 0.12s;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--c-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover:not(:disabled) {
  background: var(--c-primary-hover);
}

.btn--ghost {
  background: var(--c-surface);
  border-color: var(--c-border-strong);
  color: var(--c-text);
}
.btn--ghost:hover:not(:disabled) {
  background: var(--c-surface-2);
  border-color: var(--c-faint);
}

.btn--quiet {
  background: transparent;
  color: var(--c-muted);
  padding: 0.35rem 0.55rem;
}
.btn--quiet:hover:not(:disabled) {
  background: var(--c-surface-3);
  color: var(--c-text);
}

.btn--danger {
  background: transparent;
  border-color: color-mix(in srgb, var(--c-danger) 35%, transparent);
  color: var(--c-danger);
}
.btn--danger:hover:not(:disabled) {
  background: var(--c-danger-soft);
}

.btn--sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
}

.btn--block {
  width: 100%;
}

.btn__spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Alertes ---------- */

.alert {
  display: flex;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: 0.875rem;
  margin-bottom: 1.125rem;
}

.alert__icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.alert__title {
  font-weight: 650;
  margin: 0 0 0.15rem;
}

.alert--error {
  background: var(--c-danger-soft);
  border-color: color-mix(in srgb, var(--c-danger) 25%, transparent);
  color: var(--c-danger);
}
.alert--success {
  background: var(--c-success-soft);
  border-color: color-mix(in srgb, var(--c-success) 25%, transparent);
  color: var(--c-success);
}
.alert--warn {
  background: var(--c-warn-soft);
  border-color: color-mix(in srgb, var(--c-warn) 28%, transparent);
  color: var(--c-warn);
}
.alert--info {
  background: var(--c-primary-soft);
  border-color: color-mix(in srgb, var(--c-primary) 25%, transparent);
  color: var(--c-primary-text);
}

.alert p {
  color: inherit;
}

/* ---------- Pastilles / etiquettes ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 620;
  line-height: 1.5;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.pill--sent {
  background: var(--c-success-soft);
  color: var(--c-success);
}
.pill--failed {
  background: var(--c-danger-soft);
  color: var(--c-danger);
}
.pill--simulated {
  background: var(--c-warn-soft);
  color: var(--c-warn);
}
.pill--neutral {
  background: var(--c-surface-3);
  color: var(--c-muted);
}
.pill--admin {
  background: var(--c-primary-soft);
  color: var(--c-primary-text);
}

.pill--plain::before {
  display: none;
}

/* ---------- Pastilles destinataires ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.625rem;
  min-height: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  font-weight: 500;
  border: 1px solid;
}

.chip--ok {
  background: var(--c-primary-soft);
  border-color: color-mix(in srgb, var(--c-primary) 22%, transparent);
  color: var(--c-primary-text);
}
.chip--ko {
  background: var(--c-danger-soft);
  border-color: color-mix(in srgb, var(--c-danger) 25%, transparent);
  color: var(--c-danger);
}
.chip--dup {
  background: var(--c-surface-3);
  border-color: var(--c-border-strong);
  color: var(--c-muted);
  text-decoration: line-through;
}

.chip__note {
  font-family: var(--font);
  font-size: 0.75rem;
  opacity: 0.85;
}

/* ---------- Compteur SMS ---------- */

.counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: var(--c-muted);
  flex-wrap: wrap;
}

.counter__count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--c-text);
}

.counter--warn .counter__count {
  color: var(--c-warn);
}
.counter--over .counter__count {
  color: var(--c-danger);
}

.meter {
  flex: 1 1 120px;
  height: 4px;
  min-width: 80px;
  border-radius: 999px;
  background: var(--c-surface-3);
  overflow: hidden;
}

.meter__fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--c-primary);
  transition: width 0.15s ease-out, background-color 0.15s;
}

.counter--warn .meter__fill {
  background: var(--c-warn);
}
.counter--over .meter__fill {
  background: var(--c-danger);
}

/* ---------- Encadres lateraux ---------- */

.aside-card + .aside-card {
  margin-top: 1rem;
}

.info-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--c-border);
  font-size: 0.8125rem;
}
.info-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.info-row:first-child {
  padding-top: 0;
}

.info-row__label {
  color: var(--c-muted);
}
.info-row__value {
  font-weight: 620;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sender-badge {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.7rem 0.8rem;
  background: var(--c-primary-soft);
  border: 1px solid color-mix(in srgb, var(--c-primary) 18%, transparent);
  border-radius: var(--radius);
}

.sender-badge__icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--c-primary);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.sender-badge__icon svg {
  width: 16px;
  height: 16px;
}

.sender-badge__label {
  font-size: 0.6875rem;
  color: var(--c-primary-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 650;
  line-height: 1.3;
}
.sender-badge__value {
  font-weight: 680;
  font-size: 0.9375rem;
  color: var(--c-primary-text);
  line-height: 1.25;
  word-break: break-word;
}

/* ---------- Apercu telephone ---------- */

.preview {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 0.9rem;
}

.preview__from {
  font-size: 0.6875rem;
  font-weight: 650;
  color: var(--c-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.preview__bubble {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 14px 14px 14px 4px;
  padding: 0.7rem 0.85rem;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-sm);
  min-height: 2.5rem;
}

.preview__bubble:empty::before {
  content: "Votre message apparaitra ici.";
  color: var(--c-faint);
  font-style: italic;
}

/* ---------- Statistiques ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}

.stat__label {
  font-size: 0.75rem;
  color: var(--c-muted);
  font-weight: 550;
  margin-bottom: 0.15rem;
}

.stat__value {
  font-size: 1.375rem;
  font-weight: 680;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat__value--danger {
  color: var(--c-danger);
}

/* ---------- Tableaux ---------- */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.7rem 1rem;
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}

.table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: var(--c-surface-2);
}

.table__nowrap {
  white-space: nowrap;
}

.table__mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.table__excerpt {
  max-width: 34ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-muted);
}

.table__actions {
  display: flex;
  gap: 0.3rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.table td.right,
.table th.right {
  text-align: right;
}

.empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--c-muted);
}

.empty__icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 0.75rem;
  color: var(--c-faint);
  opacity: 0.6;
}

.empty__title {
  font-weight: 620;
  color: var(--c-text);
  margin-bottom: 0.2rem;
}

/* ---------- Filtres ---------- */

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.filters__actions {
  display: flex;
  gap: 0.5rem;
  align-items: end;
}

/* ---------- Pagination ---------- */

.pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: space-between;
  flex-wrap: wrap;
}

.pagination__info {
  font-size: 0.8125rem;
  color: var(--c-muted);
  font-variant-numeric: tabular-nums;
}

.pagination__links {
  display: flex;
  gap: 0.375rem;
}

/* ---------- Page de connexion ---------- */

.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(900px 500px at 50% -10%, var(--c-primary-soft), transparent 70%),
    var(--c-bg);
}

.auth__box {
  width: 100%;
  max-width: 400px;
}

.auth__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth__brand .brand__mark {
  width: 46px;
  height: 46px;
  border-radius: 13px;
}
.auth__brand .brand__mark svg {
  width: 26px;
  height: 26px;
}

.auth__title {
  font-size: 1.25rem;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.auth__org {
  font-size: 0.875rem;
  color: var(--c-muted);
  margin-top: 0.1rem;
}

.auth__foot {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--c-faint);
  line-height: 1.6;
}

/* ---------- Divers ---------- */

.credentials {
  margin-top: 0.75rem;
  background: var(--c-surface);
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--radius);
  padding: 0.75rem 0.875rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--c-text);
  display: grid;
  gap: 0.3rem;
}

.credentials__row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.credentials__key {
  color: var(--c-muted);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
}

.message-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.definition {
  display: grid;
  grid-template-columns: minmax(130px, auto) 1fr;
  gap: 0.5rem 1.25rem;
  font-size: 0.875rem;
}

.definition dt {
  color: var(--c-muted);
  font-weight: 550;
}

.definition dd {
  margin: 0;
  font-weight: 550;
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .definition {
    grid-template-columns: 1fr;
    gap: 0.1rem 0;
  }
  .definition dd {
    margin-bottom: 0.625rem;
  }
}

.divider {
  height: 1px;
  background: var(--c-border);
  border: 0;
  margin: 1.25rem 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.row {
  display: flex;
  gap: 0.625rem;
  align-items: center;
  flex-wrap: wrap;
}

.row--end {
  justify-content: flex-end;
}

.muted {
  color: var(--c-muted);
}

.small {
  font-size: 0.8125rem;
}

.mono {
  font-family: var(--font-mono);
}

.text-danger {
  color: var(--c-danger);
}

.inline-form {
  display: inline;
}

@media (max-width: 720px) {
  /* Sur telephone, la navigation passe sous la marque : comprimee sur une seule
     ligne, elle devenait illisible et hors d'atteinte. */
  .header {
    height: auto;
  }
  .header__inner {
    height: auto;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    padding: 0.5rem 0.875rem;
  }
  .nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    padding-top: 0.45rem;
    border-top: 1px solid var(--c-border);
  }
  .user-menu {
    margin-left: auto;
    padding-left: 0.625rem;
  }
  .user-menu__name,
  .brand__org {
    display: none;
  }
  .main {
    padding: 1.25rem 0.875rem 3rem;
  }
  .brand__name {
    font-size: 0.9375rem;
  }
}

/* ---------- Sections repliables ---------- */

.disclosure__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.125rem 1.375rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.disclosure__summary::-webkit-details-marker {
  display: none;
}

.disclosure__summary:hover {
  background: var(--c-surface-2);
}

.disclosure[open] > .disclosure__summary {
  border-bottom: 1px solid var(--c-border);
}

.disclosure__chevron {
  width: 11px;
  height: 8px;
  flex-shrink: 0;
  color: var(--c-faint);
  transition: transform 0.15s;
}

.disclosure[open] > .disclosure__summary .disclosure__chevron {
  transform: rotate(180deg);
}

.disclosure__summary--sub {
  padding: 0.6rem 1.375rem;
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.disclosure[open] > .disclosure__summary--sub {
  border-radius: 0;
}

/* ---------- Liste des utilisateurs ---------- */

.user-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.user-item--off {
  opacity: 0.72;
}

.user-item__head {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem 1.375rem;
}

.user-item__ident {
  min-width: 0;
  flex: 1;
}

.user-item__name {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-weight: 640;
  font-size: 0.9375rem;
  line-height: 1.35;
}

.user-item__meta {
  font-size: 0.8125rem;
  color: var(--c-muted);
  margin-top: 0.1rem;
  overflow-wrap: anywhere;
}

.user-item__actions {
  display: flex;
  gap: 0.375rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-item__edit {
  padding: 1.125rem 1.375rem;
}

.user-item__edit-form {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
}

@media (max-width: 720px) {
  .user-item__head {
    flex-wrap: wrap;
  }
  .user-item__actions {
    width: 100%;
    justify-content: flex-start;
  }
  .user-item__edit-form {
    grid-template-columns: 1fr;
  }
}

/* ---------- Journal d'audit ---------- */

.audit-action {
  font-weight: 600;
}

.audit-details {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--c-muted);
  max-width: 46ch;
  overflow-wrap: anywhere;
}

/* ---------- Page configuration ---------- */

.config-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(0, 1.4fr);
  gap: 0.5rem 1.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--c-border);
  align-items: baseline;
}

.config-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.config-row__label {
  font-weight: 600;
  font-size: 0.875rem;
}

.config-row__hint {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--c-faint);
  font-weight: 400;
  margin-top: 0.1rem;
}

.config-row__value {
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .config-row {
    grid-template-columns: 1fr;
  }
}

/* ---------- Bandeau copie ---------- */

.copied {
  color: var(--c-success);
  font-size: 0.75rem;
  font-weight: 620;
  margin-left: 0.35rem;
}

/* ---------- Utilitaires ---------- */
/* La politique CSP interdit l'attribut style="" : tout ajustement passe par une classe. */

.main--narrow {
  max-width: 540px;
}
.main--medium {
  max-width: 820px;
}
.main--wide {
  max-width: 960px;
}

.mt-1 {
  margin-top: 0.4rem;
}
.mt-2 {
  margin-top: 0.5rem;
}
.mt-3 {
  margin-top: 0.75rem;
}
.mt-4 {
  margin-top: 1.25rem;
}
.mt-6 {
  margin-top: 2rem;
}
.mb-4 {
  margin-bottom: 1.25rem;
}
.ml-2 {
  margin-left: 0.4rem;
}

.grow {
  flex: 1;
  min-width: 0;
}

.row--between {
  justify-content: space-between;
}

.list-compact {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
}

.textarea--compact {
  min-height: 64px;
}

.link-plain {
  display: block;
  color: inherit;
  text-decoration: none;
}

.state-panel {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.state-panel__icon {
  color: var(--c-faint);
  margin-bottom: 0.75rem;
}

.state-panel__title {
  margin-bottom: 0.4rem;
}

/* ---------- Message impose par la configuration ---------- */

.locked-message {
  display: flex;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-primary);
  border-radius: var(--radius);
}

.locked-message__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--c-primary);
}

.locked-message__text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.locked-message__note {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--c-muted);
}

/* ---------- Compteur affiche sur l'etiquette du champ ---------- */

.field__count {
  float: right;
  font-weight: 550;
  font-size: 0.75rem;
  color: var(--c-muted);
  font-variant-numeric: tabular-nums;
}

.field__count--warn {
  color: var(--c-warn);
}

.counter--static {
  margin-top: 0.625rem;
}

/* ---------- Indicateurs : nuances de statut ---------- */

.stat__value--ok {
  color: var(--c-success);
}

.stat__note {
  font-size: 0.6875rem;
  color: var(--c-faint);
  margin-top: 0.15rem;
  line-height: 1.35;
}

/* ---------- Mode operatoire ---------- */

.guide {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.guide__step {
  display: flex;
  gap: 1.125rem;
  align-items: flex-start;
}

.guide__num {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.guide__num--plain {
  background: var(--c-primary-soft);
  color: var(--c-primary-text);
}
.guide__num svg {
  width: 18px;
  height: 18px;
}

.guide__body {
  min-width: 0;
  flex: 1;
}

.guide__body h2 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.guide__body p {
  font-size: 0.9375rem;
  line-height: 1.65;
}

.guide__shot {
  margin: 1rem 0;
}

.guide__shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--c-surface);
}

.guide__shot figcaption {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: var(--c-muted);
  line-height: 1.6;
}

.guide__shot--inline {
  margin: 0.75rem 0;
}

.guide__tip {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  background: var(--c-primary-soft);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--c-primary-text);
}

.guide__warn {
  display: flex;
  gap: 0.7rem;
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  background: var(--c-warn-soft);
  border: 1px solid color-mix(in srgb, var(--c-warn) 28%, transparent);
  border-radius: var(--radius);
  color: var(--c-warn);
}

.guide__warn svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  margin-top: 2px;
}

.guide__warn p {
  color: inherit;
  font-size: 0.875rem;
}

.guide__legend {
  display: grid;
  grid-template-columns: minmax(150px, auto) 1fr;
  gap: 0.5rem 1.25rem;
  margin: 0.75rem 0 0;
  font-size: 0.9375rem;
}

.guide__legend dt {
  font-weight: 640;
}

.guide__legend dd {
  margin: 0;
  color: var(--c-muted);
  line-height: 1.6;
}

.guide__list {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.9375rem;
  line-height: 1.7;
}

.guide__list li {
  margin-bottom: 0.5rem;
}

@media (max-width: 620px) {
  .guide__legend {
    grid-template-columns: 1fr;
    gap: 0.1rem 0;
  }
  .guide__legend dd {
    margin-bottom: 0.625rem;
  }
  .guide__step {
    gap: 0.75rem;
  }
}

/* ---------- Impression du mode operatoire ---------- */

@media print {
  .header,
  .page-head .btn,
  .skip-link {
    display: none !important;
  }
  body {
    background: #fff;
  }
  .main {
    padding: 0;
    max-width: none;
  }
  .guide__step {
    break-inside: avoid;
  }
  .guide__shot img {
    box-shadow: none;
  }
  a[href]::after {
    content: '';
  }
}

/* Les captures d'un formulaire etroit n'ont pas a occuper toute la largeur. */
.guide__shot--etroit img {
  max-width: 420px;
}

/* ---------- En-tete du mode operatoire imprime ---------- */

.print-entete {
  display: none;
}

@media print {
  .print-entete {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding-bottom: 0.9rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--c-primary);
  }

  .print-entete__marque {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 8px;
    background: #0d7d8c;
    display: grid;
    place-items: center;
  }
  .print-entete__marque svg {
    width: 18px;
    height: 18px;
    display: block;
  }

  .print-entete__nom {
    font-weight: 700;
    font-size: 0.9375rem;
    line-height: 1.2;
  }
  .print-entete__sous {
    font-size: 0.75rem;
    color: #5b7581;
  }

  /* Le titre d'ecran ferait doublon avec l'en-tete du document. */
  .page-head {
    display: none;
  }

  /* Une etape ne doit pas etre coupee entre deux pages, ni son titre isole. */
  .guide {
    gap: 1.5rem;
  }
  .guide__step {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .guide__body h2 {
    break-after: avoid;
  }
  .guide__shot {
    break-inside: avoid;
  }
  .guide__shot img {
    border-color: #c2d4d9;
  }

  /* Les fonds teintes doivent rester lisibles une fois imprimes. */
  .guide__tip,
  .guide__warn,
  .guide__num {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
