/* Duva — feuille de composants.
   Se charge après tokens.css, qui définit toutes les variables --*.
   Aucune valeur en dur : tout passe par un token. */

/* ---------------------------------------------------------------- base --- */

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

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

body {
  margin: 0;
  background: var(--surface-page);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

code, kbd, samp, pre { font-family: var(--font-mono); font-size: 13px; }

table { border-collapse: collapse; border-spacing: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

svg { flex: none; }

hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-6) 0; }

/* Focus : un seul anneau, partout, jamais masqué par une barre collante. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: var(--focus-w) solid var(--accent);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-xs);
  scroll-margin-block: calc(var(--header-h) + var(--space-4));
}
:focus:not(:focus-visible) { outline: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ------------------------------------------------------------ utilitaires - */

.u-visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.u-skip-link {
  position: absolute; left: var(--space-2); top: calc(var(--space-2) * -10);
  z-index: var(--z-toast);
  background: var(--surface-raised); color: var(--ink);
  border: 1px solid var(--border-control); border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3); text-decoration: none;
}
.u-skip-link:focus { top: var(--space-2); }

.u-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.u-num  { font-variant-numeric: tabular-nums; }
.u-muted { color: var(--ink-muted); }
.u-nowrap { white-space: nowrap; }
.u-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-right { text-align: right; }
.u-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.u-row { display: flex; align-items: center; gap: var(--space-2); }
.u-row--wrap { flex-wrap: wrap; }  /* à la ligne quand la place manque, plutôt que d'élargir le conteneur */
.u-row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.u-spacer { flex: 1 1 auto; }

.t-display { font-size: 34px; line-height: 40px; font-weight: 600; letter-spacing: -0.02em; }
.t-h1 { font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -0.01em; }
.t-h2 { font-size: 18px; line-height: 24px; font-weight: 600; letter-spacing: -0.005em; }
.t-h3 { font-size: 15px; line-height: 20px; font-weight: 600; }
.t-body { font-size: 14px; line-height: 20px; }
.t-body-strong { font-size: 14px; line-height: 20px; font-weight: 600; }
.t-body-sm { font-size: 13px; line-height: 18px; }
.t-caption { font-size: 12px; line-height: 16px; }
.t-label { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em; }
.t-overline { font-size: 11px; line-height: 14px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.t-metric { font-family: var(--font-mono); font-size: 28px; line-height: 32px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.t-metric-sm { font-family: var(--font-mono); font-size: 18px; line-height: 24px; font-weight: 500; font-variant-numeric: tabular-nums; }
.t-mono { font-family: var(--font-mono); font-size: 13px; line-height: 20px; font-variant-numeric: tabular-nums; }
.t-mono-sm { font-family: var(--font-mono); font-size: 12px; line-height: 18px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- icônes ---- */

.icon { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; }
.icon--sm { width: 14px; height: 14px; vertical-align: -2px; }
.icon--lg { width: 20px; height: 20px; vertical-align: -4px; }

/* ----------------------------------------------------- gabarit d'app ----- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "sidebar header" "sidebar main";
  min-height: 100vh;
}

.app-sidebar {
  grid-area: sidebar;
  background: var(--surface-sunken);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  z-index: var(--z-header);
}
.app-sidebar__brand {
  display: flex; align-items: center; gap: var(--space-2);
  height: var(--header-h); padding: 0 var(--space-4);
  border-bottom: 1px solid var(--border);
}
.app-sidebar__brand img { height: 22px; width: auto; }
.app-sidebar__nav { padding: var(--space-3) var(--space-2); display: flex; flex-direction: column; gap: var(--space-1); }
.app-sidebar__group { padding: var(--space-4) var(--space-3) var(--space-1); color: var(--ink-muted); }
.app-sidebar__foot { margin-top: auto; padding: var(--space-3); border-top: 1px solid var(--border); }

.nav-item {
  display: flex; align-items: center; gap: var(--space-2);
  min-height: 32px; padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none;
  border-left: 2px solid transparent;
}
.nav-item:hover { background: var(--surface-hover); color: var(--ink); }
.nav-item .icon { color: var(--ink-muted); }
.nav-item[aria-current="page"] {
  background: var(--accent-surface);
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.nav-item[aria-current="page"] .icon { color: var(--accent); }
.nav-item__count {
  margin-left: auto; font-family: var(--font-mono); font-size: 12px;
  color: var(--ink-muted); font-variant-numeric: tabular-nums;
}

.app-header {
  grid-area: header;
  display: flex; align-items: center; gap: var(--space-3);
  height: var(--header-h); padding: 0 var(--space-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: var(--z-header);
}

.app-main { grid-area: main; min-width: 0; }
.app-main__inner { max-width: var(--content-max); padding: var(--space-6); }

.page-head { display: flex; align-items: flex-start; gap: var(--space-4); margin-bottom: var(--space-5); }
.page-head__text { min-width: 0; }
.page-head__sub { color: var(--ink-muted); margin-top: var(--space-1); }
.page-head__actions { margin-left: auto; display: flex; gap: var(--space-2); align-items: center; }

@media (max-width: 1080px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "header" "main"; }
  .app-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform 0.15s ease; box-shadow: var(--shadow-lg); }
  .app-sidebar[data-open="true"] { transform: none; }
  .app-main__inner { padding: var(--space-4); }
}
@media (min-width: 1081px) { .app-header__menu { display: none; } }

/* L'en-tête et le bandeau d'état se compriment plutôt que de pousser la page. */
@media (max-width: 720px) {
  .app-header { padding: 0 var(--space-4); gap: var(--space-2); }
  .app-header__doc { display: none; }
  .app-header .domain-picker__name { max-width: 118px; overflow: hidden; text-overflow: ellipsis; }
  .app-header__account { max-width: 148px; min-width: 0; }
  .app-header__account .u-truncate { max-width: 96px; }
  .statusbar { padding: var(--space-2) var(--space-4); flex-wrap: wrap; }
  .statusbar__actions { margin-left: 0; width: 100%; }
  .page-head { flex-wrap: wrap; }
  .page-head__actions { margin-left: 0; }
}
.app-header__account { overflow: hidden; }
.app-header .menu, .app-header .domain-picker { min-width: 0; }
.app-header .menu { display: flex; }
.statusbar { flex-wrap: wrap; }

/* ------------------------------------------------------------- boutons --- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--control-md); padding: 0 var(--space-4);
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; line-height: 20px;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  background: var(--surface); color: var(--ink);
  border-color: var(--border-control);
}
.btn:hover { background: var(--surface-hover); color: var(--ink); }
.btn:active { background: var(--surface-sunken); }
.btn[disabled], .btn[aria-disabled="true"] {
  background: var(--surface-disabled); color: var(--ink-subtle);
  border-color: var(--border); cursor: not-allowed;
}

.btn--primary { background: var(--accent); color: var(--on-accent); border-color: transparent; box-shadow: var(--shadow-xs); }
.btn--primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn--primary:active { background: var(--accent-active); }

.btn--danger { background: var(--danger-solid); color: var(--ink-inverse); border-color: transparent; }
.btn--danger:hover { background: var(--danger); color: var(--ink-inverse); }

.btn--ghost { background: transparent; border-color: transparent; color: var(--ink); font-weight: 400; }
.btn--ghost:hover { background: var(--surface-hover); }

.btn--sm { min-height: var(--control-sm); padding: 0 var(--space-3); font-size: 13px; }
.btn--lg { min-height: var(--control-lg); padding: 0 var(--space-5); font-size: 15px; }
.btn--icon { padding: 0; width: var(--control-md); }
.btn--icon.btn--sm { width: var(--control-sm); }
.btn--block { width: 100%; }

.btn[aria-busy="true"] { position: relative; color: transparent; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 14px; height: 14px;
  border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
  color: var(--on-accent); animation: duva-spin 0.7s linear infinite;
}
.btn:not(.btn--primary):not(.btn--danger)[aria-busy="true"]::after { color: var(--ink); }
@keyframes duva-spin { to { transform: rotate(360deg); } }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn[aria-pressed="true"] { background: var(--accent-surface); color: var(--accent); border-color: var(--accent-border); z-index: 1; }

/* -------------------------------------------------------------- badges --- */

.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  min-height: 20px; padding: 0 var(--space-2) 0 var(--space-1);
  border-radius: var(--radius-xs); border: 1px solid;
  font-size: 12px; line-height: 16px; font-weight: 600; white-space: nowrap;
}
.badge .icon { width: 12px; height: 12px; vertical-align: 0; }
.badge--plain { padding: 0 var(--space-2); }

.badge--neutral { color: var(--neutral); background: var(--neutral-surface); border-color: var(--neutral-border); }
.badge--info    { color: var(--info);    background: var(--info-surface);    border-color: var(--info-border); }
.badge--success { color: var(--success); background: var(--success-surface); border-color: var(--success-border); }
.badge--warning { color: var(--warning); background: var(--warning-surface); border-color: var(--warning-border); }
.badge--danger  { color: var(--danger);  background: var(--danger-surface);  border-color: var(--danger-border); }
.badge--sandbox { color: var(--sandbox); background: var(--sandbox-surface); border-color: var(--sandbox-border); }

.dot { width: 8px; height: 8px; border-radius: var(--radius-full); display: inline-block; flex: none; }
.dot--success { background: var(--success-solid); }
.dot--warning { background: var(--warning-solid); }
.dot--danger  { background: var(--danger-solid); }
.dot--info    { background: var(--accent); }
.dot--neutral { background: var(--neutral); }

/* -------------------------------------------------------------- cartes --- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.card__head {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.card__title { font-size: 15px; font-weight: 600; }
.card__actions { margin-left: auto; display: flex; gap: var(--space-2); align-items: center; }
.card__body { padding: var(--space-4); }
.card__body--flush { padding: 0; }
.card__foot { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); background: var(--surface-sunken); border-radius: 0 0 var(--radius-md) var(--radius-md); }

.grid { display: grid; gap: var(--space-4); }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
/* Deux colonnes asymétriques au-dessus de 1080 px, une seule en dessous. */
.grid--principal-aside, .grid--detail { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1081px) {
  .grid--principal-aside { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
  .grid--detail { grid-template-columns: minmax(320px, 1fr) minmax(0, 1.4fr); }
}

/* ------------------------------------------------------- indicateurs ----- */

.stat { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); }
.stat__label { color: var(--ink-muted); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em; display: flex; align-items: center; gap: var(--space-1); }
.stat__value { font-family: var(--font-mono); font-size: 28px; line-height: 32px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat__meta { display: flex; align-items: baseline; gap: var(--space-2); color: var(--ink-muted); font-size: 12px; line-height: 16px; }
.stat__rate { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 500; }
.stat__delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; }
.stat__delta--up { color: var(--success); }
.stat__delta--down { color: var(--danger); }
.stat__delta--flat { color: var(--ink-muted); }
.stat__spark { margin-top: var(--space-2); }

/* ------------------------------------------------------------ tableaux --- */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table { width: 100%; min-width: 720px; font-size: 14px; }
.table--wide { min-width: 960px; }
.table thead th {
  position: sticky; top: 0; z-index: var(--z-sticky);
  background: var(--surface-sunken);
  color: var(--ink-muted);
  font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em;
  text-align: left; white-space: nowrap;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-strong);
}
.table thead th[aria-sort] { cursor: pointer; }
.table thead th[aria-sort="ascending"], .table thead th[aria-sort="descending"] { color: var(--ink); }
.table tbody td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  height: var(--row-dense);
}
.table tbody tr:hover td { background: var(--surface-hover); }
.table tbody tr[aria-selected="true"] td { background: var(--surface-selected); }
.table tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.table td.is-num, .table th.is-num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.table td.is-mono { font-family: var(--font-mono); font-size: 13px; }
.table td.is-tight { width: 1%; white-space: nowrap; }
/* Cellule de texte libre (une adresse) : la seule à se replier quand le tableau est trop large, au lieu
   de l'élargir. Les autres colonnes gardent leur largeur : ni rôle ni bouton coupé. */
.table td.is-breakable { overflow-wrap: anywhere; }
/* Liste déroulante compacte dans une cellule : assez large pour lire « Administrateur ». Sans largeur
   minimale, un tableau trop large l'écrase jusqu'à sa flèche et le choix actuel devient illisible. */
.table td .select--sm { min-width: 8.5rem; }
.table__sub { display: block; color: var(--ink-muted); font-size: 12px; line-height: 16px; }
.table a { color: var(--ink); text-decoration: none; font-weight: 600; }
.table a:hover { color: var(--accent); text-decoration: underline; }

.table-scroll-hint {
  display: none; color: var(--ink-muted); font-size: 12px; padding: var(--space-2) var(--space-3);
}
@media (max-width: 720px) { .table-scroll-hint { display: block; } }

/* --------------------------------------------------------- barre filtre -- */

.filterbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.filterbar__search { flex: 1 1 220px; min-width: 180px; }
.chip {
  display: inline-flex; align-items: center; gap: var(--space-1);
  min-height: 26px; padding: 0 var(--space-1) 0 var(--space-2);
  border: 1px solid var(--border-control); border-radius: var(--radius-full);
  background: var(--surface); font-size: 13px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent-surface); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip__x { display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center; border-radius: var(--radius-full); border: 0; background: transparent; cursor: pointer; color: inherit; }
.chip__x:hover { background: var(--surface-hover); }

/* ---------------------------------------------------------- formulaires -- */

.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field__label { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em; }
.field__hint { color: var(--ink-muted); font-size: 13px; line-height: 18px; }
.field__error { color: var(--danger); font-size: 13px; line-height: 18px; display: flex; align-items: center; gap: var(--space-1); }
.field__req { color: var(--danger); }

.input, .select, .textarea {
  width: 100%; min-height: var(--control-md);
  padding: var(--space-2) var(--space-3);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border-control); border-radius: var(--radius-sm);
}
.textarea { min-height: 88px; resize: vertical; font-family: var(--font-mono); font-size: 13px; }
.input::placeholder, .textarea::placeholder { color: var(--ink-subtle); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-muted); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger-solid); border-width: 2px; }
.input[disabled], .select[disabled], .textarea[disabled] { background: var(--surface-disabled); color: var(--ink-subtle); cursor: not-allowed; }
.input--sm, .select--sm { min-height: var(--control-sm); padding: var(--space-1) var(--space-2); font-size: 13px; }
.input--mono { font-family: var(--font-mono); font-size: 13px; }

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) calc(50% + 1px), calc(100% - 10px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: var(--space-8);
}

.checkbox { display: inline-flex; align-items: flex-start; gap: var(--space-2); cursor: pointer; min-height: 24px; }
.checkbox input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }

.switch { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.switch__track {
  width: 34px; height: 20px; border-radius: var(--radius-full);
  background: var(--surface-disabled); border: 1px solid var(--border-control);
  position: relative; transition: background 0.12s ease;
}
.switch__track::after {
  content: ""; position: absolute; inset: 2px auto 2px 2px; width: 14px;
  border-radius: var(--radius-full); background: var(--ink-muted); transition: transform 0.12s ease, background 0.12s ease;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch input:checked + .switch__track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(14px); background: var(--on-accent); }
.switch input:focus-visible + .switch__track { outline: var(--focus-w) solid var(--accent); outline-offset: var(--focus-offset); }

.form-row { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ------------------------------------------------------------ bandeaux --- */

.banner {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid; border-radius: var(--radius-md);
}
.banner__icon { flex: none; margin-top: 1px; }
.banner__body { min-width: 0; flex: 1 1 auto; }
.banner__title { font-weight: 600; }
.banner__text { margin-top: 2px; font-size: 13px; line-height: 18px; }
.banner__actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; margin-top: var(--space-2); }
.banner--info    { color: var(--info);    background: var(--info-surface);    border-color: var(--info-border); }
.banner--success { color: var(--success); background: var(--success-surface); border-color: var(--success-border); }
.banner--warning { color: var(--warning); background: var(--warning-surface); border-color: var(--warning-border); }
.banner--danger  { color: var(--danger);  background: var(--danger-surface);  border-color: var(--danger-border); }
.banner--sandbox { color: var(--sandbox); background: var(--sandbox-surface); border-color: var(--sandbox-border); }
.banner .btn { color: var(--ink); }

/* Bandeau pleine largeur sous l'en-tête. */
.statusbar {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-6);
  border-bottom: 1px solid;
  font-size: 13px; line-height: 18px;
}
.statusbar--sandbox { color: var(--sandbox); background: var(--sandbox-surface); border-color: var(--sandbox-border); }
.statusbar--warning { color: var(--warning); background: var(--warning-surface); border-color: var(--warning-border); }
.statusbar--danger  { color: var(--danger);  background: var(--danger-surface);  border-color: var(--danger-border); }
.statusbar__actions { margin-left: auto; display: flex; gap: var(--space-2); align-items: center; }

/* ------------------------------------------------------- bloc de code ---- */

.code {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-sunken); overflow: hidden;
}
.code__tabs { display: flex; align-items: center; gap: var(--space-1); padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--border); }
.code__tab {
  background: transparent; border: 0; border-radius: var(--radius-xs);
  padding: var(--space-1) var(--space-2); min-height: 26px;
  font-size: 13px; color: var(--ink-muted); cursor: pointer;
}
.code__tab:hover { background: var(--surface-hover); color: var(--ink); }
.code__tab[aria-selected="true"] { background: var(--accent-surface); color: var(--accent); font-weight: 600; }
.code__copy { margin-left: auto; }
.code__body { margin: 0; padding: var(--space-3) var(--space-4); overflow-x: auto; }
.code__body code { font-size: 13px; line-height: 20px; white-space: pre; color: var(--ink); }
.code .tok-str { color: var(--chart-2); }
.code .tok-key { color: var(--accent); }
.code .tok-com { color: var(--ink-muted); font-style: italic; }
.code .tok-num { color: var(--chart-3); }

.copy-field {
  display: flex; align-items: stretch; gap: 0;
  border: 1px solid var(--border-control); border-radius: var(--radius-sm);
  background: var(--surface); overflow: hidden;
}
.copy-field code { flex: 1 1 auto; padding: var(--space-2) var(--space-3); overflow-x: auto; white-space: nowrap; font-size: 13px; }
.copy-field .btn { border-radius: 0; border: 0; border-left: 1px solid var(--border); }

/* ------------------------------------------------------- chronologie ----- */

.timeline { display: flex; flex-direction: column; }
.timeline__item { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: var(--space-3); position: relative; padding-bottom: var(--space-4); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__rail { display: flex; flex-direction: column; align-items: center; }
.timeline__marker {
  width: 20px; height: 20px; border-radius: var(--radius-full);
  display: grid; place-items: center; flex: none;
  border: 1px solid var(--border-control); background: var(--surface); color: var(--ink-muted);
}
.timeline__line { flex: 1 1 auto; width: 2px; background: var(--border); margin-top: var(--space-1); }
.timeline__item:last-child .timeline__line { display: none; }
.timeline__body { padding-top: 1px; }
.timeline__title { font-weight: 600; display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.timeline__time { color: var(--ink-muted); font-family: var(--font-mono); font-size: 12px; }
.timeline__detail { color: var(--ink-muted); font-size: 13px; line-height: 18px; margin-top: 2px; }
.timeline__item--success .timeline__marker { border-color: var(--success-solid); color: var(--success); background: var(--success-surface); }
.timeline__item--danger .timeline__marker  { border-color: var(--danger-solid); color: var(--danger); background: var(--danger-surface); }
.timeline__item--warning .timeline__marker { border-color: var(--warning-solid); color: var(--warning); background: var(--warning-surface); }
.timeline__item--info .timeline__marker    { border-color: var(--accent); color: var(--accent); background: var(--accent-surface); }
.timeline__item--pending .timeline__marker { border-style: dashed; }

/* ------------------------------------------------------------- étapes ---- */

.stepper { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.stepper__step { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); min-width: 0; }
.stepper__num {
  width: 22px; height: 22px; border-radius: var(--radius-full); flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--border-control); color: var(--ink-muted);
  font-size: 12px; font-weight: 600; font-family: var(--font-mono);
}
.stepper__label { font-size: 13px; color: var(--ink-muted); }
.stepper__sep { align-self: center; color: var(--border-strong); }
.stepper__step--done .stepper__num { background: var(--success-surface); border-color: var(--success-solid); color: var(--success); }
.stepper__step--done .stepper__label { color: var(--ink); }
.stepper__step--current { background: var(--accent-surface); }
.stepper__step--current .stepper__num { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.stepper__step--current .stepper__label { color: var(--accent); font-weight: 600; }

/* -------------------------------------------------------------- jauge ---- */

.gauge__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-2); }
.gauge__value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.gauge__track { height: 8px; border-radius: var(--radius-full); background: var(--chart-track); overflow: hidden; }
.gauge__fill { height: 100%; border-radius: var(--radius-full); background: var(--accent); }
.gauge--warning .gauge__fill { background: var(--warning-solid); }
.gauge--danger .gauge__fill { background: var(--danger-solid); }
.gauge__foot { display: flex; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-1); color: var(--ink-muted); font-size: 12px; }

/* --------------------------------------------------------- graphiques ---- */

.chart { display: block; width: 100%; height: auto; }
.chart__grid line { stroke: var(--chart-grid); stroke-width: 1; }
.chart__axis line, .chart__axis path { stroke: var(--chart-axis); stroke-width: 1; }
.chart__label { fill: var(--ink-muted); font-size: 11px; font-family: var(--font-sans); }
.chart__value { fill: var(--ink); font-size: 11px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.chart__series-1 { fill: var(--chart-1); stroke: var(--chart-1); }
.chart__series-2 { fill: var(--chart-2); stroke: var(--chart-2); }
.chart__series-3 { fill: var(--chart-3); stroke: var(--chart-3); }
.chart__series-4 { fill: var(--chart-4); stroke: var(--chart-4); }
.chart__series-5 { fill: var(--chart-5); stroke: var(--chart-5); }
.chart__line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-3); }
.chart-legend__item { display: inline-flex; align-items: center; gap: var(--space-1); font-size: 12px; color: var(--ink-muted); }
.chart-legend__swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.sparkline { display: block; width: 100%; height: 28px; }

/* ----------------------------------------------------- menu déroulant ---- */

.menu { position: relative; display: inline-block; }
.menu__panel {
  position: absolute; top: calc(100% + var(--space-1)); left: 0; min-width: 240px;
  background: var(--surface-raised); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  padding: var(--space-1); z-index: var(--z-dropdown);
}
.menu__panel--right { left: auto; right: 0; }
.menu__item {
  display: flex; align-items: center; gap: var(--space-2); width: 100%;
  min-height: 32px; padding: var(--space-1) var(--space-2);
  background: transparent; border: 0; border-radius: var(--radius-sm);
  text-align: left; cursor: pointer; color: var(--ink); text-decoration: none;
}
.menu__item:hover { background: var(--surface-hover); }
.menu__item[aria-checked="true"] { background: var(--accent-surface); color: var(--accent); font-weight: 600; }
.menu__sep { height: 1px; background: var(--border); margin: var(--space-1) 0; }
.menu__head { padding: var(--space-2); color: var(--ink-muted); }

.domain-picker { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--control-sm); padding: 0 var(--space-2); border: 1px solid var(--border-control); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-size: 13px; }
.domain-picker__name { font-family: var(--font-mono); font-weight: 500; }

/* -------------------------------------------------------- pagination ----- */

.pager { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); }
.pager__info { color: var(--ink-muted); font-size: 13px; }
.pager__actions { margin-left: auto; display: flex; gap: var(--space-2); }

/* ------------------------------------------------------------- onglets --- */

.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); }
.tab {
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  padding: var(--space-2) var(--space-3); min-height: 36px;
  color: var(--ink-muted); cursor: pointer; font-size: 14px;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* --------------------------------------------------------------- états --- */

.empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); padding: var(--space-12) var(--space-6); text-align: center; }
.empty__icon { color: var(--ink-subtle); }
.empty__title { font-size: 15px; font-weight: 600; }
.empty__text { color: var(--ink-muted); max-width: 46ch; font-size: 13px; line-height: 18px; }

.skeleton {
  background: var(--chart-track); border-radius: var(--radius-xs);
  position: relative; overflow: hidden;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--surface-hover), transparent);
  animation: duva-shimmer 1.3s infinite;
}
@keyframes duva-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.skeleton--text { height: 12px; }
.skeleton--line { height: 12px; width: 100%; }
.skeleton--pill { height: 20px; width: 72px; border-radius: var(--radius-xs); }
.skeleton--metric { height: 28px; width: 96px; }

.is-loading { cursor: progress; }

/* ------------------------------------------------------------ modales ---- */

.modal-overlay { position: fixed; inset: 0; background: var(--overlay); z-index: var(--z-overlay); display: grid; place-items: center; padding: var(--space-4); }
.modal {
  background: var(--surface-raised); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: min(560px, 100%); max-height: calc(100vh - var(--space-8)); overflow: auto;
  z-index: var(--z-modal);
}
.modal__head { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); }
.modal__title { font-size: 16px; font-weight: 600; }
.modal__body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.modal__foot { display: flex; gap: var(--space-2); justify-content: flex-end; padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border); background: var(--surface-sunken); }
.modal--wide { width: min(760px, 100%); }

/* --------------------------------------------------- notifications ------- */

.toasts { position: fixed; right: var(--space-4); bottom: var(--space-4); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--space-2); width: min(380px, calc(100vw - var(--space-8))); }
.toast {
  display: flex; align-items: flex-start; gap: var(--space-3);
  background: var(--surface-raised); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  padding: var(--space-3) var(--space-4);
}
.toast__icon { flex: none; margin-top: 1px; }
.toast--success .toast__icon { color: var(--success); }
.toast--danger .toast__icon { color: var(--danger); }
.toast--info .toast__icon { color: var(--accent); }
.toast__body { flex: 1 1 auto; min-width: 0; }
.toast__title { font-weight: 600; }
.toast__text { color: var(--ink-muted); font-size: 13px; line-height: 18px; }

/* ------------------------------------------------------ tableau DNS ------ */

.dns td { vertical-align: top; }
.dns .dns__value { font-family: var(--font-mono); font-size: 12px; line-height: 18px; word-break: break-all; max-width: 420px; }
.dns__row--ok td { background: var(--success-surface); }
.dns__row--pending td { background: var(--warning-surface); }

/* --------------------------------------------------- aperçu du message --- */

.preview-frame { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; }
.preview-frame__bar { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); background: var(--surface-sunken); font-size: 12px; color: var(--ink-muted); }
.preview-frame__body { padding: var(--space-4); max-height: 420px; overflow: auto; }

.kv { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: var(--space-1) var(--space-4); }
.kv dt { color: var(--ink-muted); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; padding-top: 2px; }
.kv dd { font-family: var(--font-mono); font-size: 13px; word-break: break-word; }

/* ----------------------------------------------------- flux temps réel --- */

.live { display: flex; align-items: center; gap: var(--space-2); font-size: 12px; color: var(--ink-muted); }
.live__pulse { width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--success-solid); animation: duva-pulse 2s ease-in-out infinite; }
@keyframes duva-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.feed { font-family: var(--font-mono); font-size: 12px; line-height: 20px; }
.feed__row { display: grid; grid-template-columns: 74px 92px minmax(0, 1fr); gap: var(--space-3); padding: var(--space-1) var(--space-4); border-bottom: 1px solid var(--border); }
.feed__row:hover { background: var(--surface-hover); }
.feed__time { color: var(--ink-muted); }
.feed__row--new { animation: duva-flash 1.2s ease-out; }
@keyframes duva-flash { from { background: var(--accent-surface); } to { background: transparent; } }

/* ------------------------------------------------------------- marque ---- */

img.brand-dark { display: none; }
[data-theme="dark"] img.brand-light { display: none; }
[data-theme="dark"] img.brand-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) img.brand-light { display: none; }
  :root:not([data-theme="light"]) img.brand-dark { display: block; }
}
