/*
 * Régis — design system (v1)
 * Source : maquette Claude Design « Régis — interface d'administration » (tokens.json + regis.css).
 * Servi sur https://heyregis.ai/design/regis.css pour les éditeurs des services (Trailer, Painter…).
 * Tous les noms sont préfixés `r-` / `--r-` pour cohabiter avec n'importe quel framework.
 *
 * Thème : clair par défaut, sombre avec `data-theme="dark"` sur <html> (ou préférence système
 * quand aucun thème n'est forcé).
 */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=Instrument+Serif:ital@0;1&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* Surfaces */
  --r-page: #f4f3ef;
  --r-card: #ffffff;
  --r-sunken: #ecebe6;
  --r-hover: #e7e5df;
  --r-platform: #101014;
  --r-platform-2: #24242b;
  --r-on-platform: #ffffff;
  --r-accent-on-dark: #9483ee;
  /* Lignes */
  --r-line: #dedcd4;
  --r-line-strong: #c9c6bc;
  /* Encre */
  --r-ink: #16161b;
  --r-ink-2: #45454d;
  --r-ink-3: #62616a;
  /* Accent « régie » */
  --r-accent: #4a33b5;
  --r-accent-ink: #35238a;
  --r-accent-soft: #ebe7f9;
  --r-on-accent: #ffffff;
  /* Statuts */
  --r-ok: #1c6e46;
  --r-ok-soft: #e1f1e8;
  --r-ok-dot: #2e9a63;
  --r-warn: #8a5200;
  --r-warn-soft: #fbeed5;
  --r-warn-dot: #d08a16;
  --r-err: #b0261b;
  --r-err-soft: #fbe6e3;
  --r-info: #1d5a9e;
  --r-info-soft: #e3edf8;
  --r-focus: var(--r-accent);
  /* Typo */
  --r-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
  --r-serif: 'Instrument Serif', Georgia, serif;
  --r-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  /* Espacements */
  --r-space-1: 4px;
  --r-space-2: 8px;
  --r-space-3: 12px;
  --r-space-4: 16px;
  --r-space-5: 20px;
  --r-space-6: 24px;
  --r-space-8: 32px;
  --r-space-10: 40px;
  --r-space-14: 56px;
  /* Rayons */
  --r-radius-xs: 5px;
  --r-radius-sm: 8px;
  --r-radius-md: 10px;
  --r-radius-lg: 12px;
  --r-radius-xl: 16px;
  --r-radius-pill: 999px;
  /* Dimensions */
  --r-target: 44px;
  --r-topbar-h: 56px;
  --r-rail-w: 72px;
  --r-subnav-w: 220px;
  --r-row-h: 60px;
  /* Ombres */
  --r-shadow-menu: 0 18px 48px rgba(0, 0, 0, 0.18);
  --r-shadow-dialog: 0 24px 64px rgba(0, 0, 0, 0.28);
}

:root[data-theme='dark'] {
  --r-page: #141417;
  --r-card: #1c1c21;
  --r-sunken: #232329;
  --r-hover: #2a2a31;
  --r-platform: #0a0a0c;
  --r-platform-2: #1d1d23;
  --r-line: #2e2e36;
  --r-line-strong: #45454f;
  --r-ink: #f1f0ec;
  --r-ink-2: #c4c3cb;
  --r-ink-3: #9c9ba5;
  --r-accent: #9483ee;
  --r-accent-ink: #b7aaf5;
  --r-accent-soft: #2a2345;
  --r-on-accent: #141417;
  --r-ok: #5cc98f;
  --r-ok-soft: #15301f;
  --r-ok-dot: #5cc98f;
  --r-warn: #e7a945;
  --r-warn-soft: #33260f;
  --r-warn-dot: #e7a945;
  --r-err: #f07a6e;
  --r-err-soft: #3a1916;
  --r-info: #7db2ee;
  --r-info-soft: #14263a;
  --r-shadow-menu: 0 18px 48px rgba(0, 0, 0, 0.55);
  --r-shadow-dialog: 0 24px 64px rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --r-page: #141417;
    --r-card: #1c1c21;
    --r-sunken: #232329;
    --r-hover: #2a2a31;
    --r-platform: #0a0a0c;
    --r-platform-2: #1d1d23;
    --r-line: #2e2e36;
    --r-line-strong: #45454f;
    --r-ink: #f1f0ec;
    --r-ink-2: #c4c3cb;
    --r-ink-3: #9c9ba5;
    --r-accent: #9483ee;
    --r-accent-ink: #b7aaf5;
    --r-accent-soft: #2a2345;
    --r-on-accent: #141417;
    --r-ok: #5cc98f;
    --r-ok-soft: #15301f;
    --r-ok-dot: #5cc98f;
    --r-warn: #e7a945;
    --r-warn-soft: #33260f;
    --r-warn-dot: #e7a945;
    --r-err: #f07a6e;
    --r-err-soft: #3a1916;
    --r-info: #7db2ee;
    --r-info-soft: #14263a;
  }
}

/* ---------- Base (à appliquer sur le conteneur d'un éditeur embarqué) ---------- */
.r-root {
  font-family: var(--r-sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--r-ink);
  background: var(--r-page);
  -webkit-font-smoothing: antialiased;
}
.r-root *,
.r-root *::before,
.r-root *::after {
  box-sizing: border-box;
}
.r-mono {
  font-family: var(--r-mono);
}
.r-serif {
  font-family: var(--r-serif);
  font-weight: 400;
}
.r-num {
  font-variant-numeric: tabular-nums;
}

/* ---------- Typo ---------- */
.r-display {
  margin: 0;
  font-family: var(--r-serif);
  font-weight: 400;
  font-size: 56px;
  line-height: 1;
  letter-spacing: -0.01em;
}
.r-h1 {
  margin: 0;
  font-size: 24px;
  line-height: 29px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.r-h2 {
  margin: 0;
  font-size: 16px;
  line-height: 21px;
  font-weight: 600;
}
.r-h3 {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}
.r-small {
  font-size: 12px;
  line-height: 17px;
}
.r-eyebrow {
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--r-ink-3);
}
.r-muted {
  color: var(--r-ink-3);
}
.r-soft {
  color: var(--r-ink-2);
}

/* ---------- Mise en page ---------- */
.r-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.r-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.r-grow {
  flex: 1;
  min-width: 0;
}
.r-page-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.r-page-head > .r-grow {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---------- Cartes ---------- */
.r-card {
  background: var(--r-card);
  border: 1px solid var(--r-line);
  border-radius: var(--r-radius-lg);
}
.r-card-pad {
  padding: 18px 20px;
}
.r-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--r-line);
}
.r-list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--r-line);
  color: inherit;
  text-decoration: none;
}
.r-list-row:last-child {
  border-bottom: 0;
}
a.r-list-row:hover {
  background: var(--r-hover);
}
.r-divider {
  height: 1px;
  background: var(--r-line);
}

/* ---------- Boutons ---------- */
.r-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--r-target);
  padding: 0 16px;
  border-radius: var(--r-radius-md);
  border: 1px solid var(--r-line-strong);
  background: var(--r-card);
  color: var(--r-ink);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.r-btn:hover {
  background: var(--r-sunken);
  color: var(--r-ink);
}
.r-btn--primary {
  background: var(--r-accent);
  border-color: var(--r-accent);
  color: var(--r-on-accent);
}
.r-btn--primary:hover {
  background: var(--r-accent-ink);
  border-color: var(--r-accent-ink);
  color: var(--r-on-accent);
}
.r-btn--ghost {
  border-color: transparent;
  background: transparent;
}
.r-btn--ghost:hover {
  background: var(--r-hover);
}
.r-btn--danger {
  color: var(--r-err);
}
.r-btn--block {
  width: 100%;
}
.r-btn:focus-visible,
.r-chip:focus-visible,
.r-focusable:focus-visible {
  outline: 2px solid var(--r-focus);
  outline-offset: 2px;
}
.r-btn[disabled],
.r-btn[aria-disabled='true'] {
  opacity: 0.5;
  pointer-events: none;
}

/* ---------- Puces, statuts, étiquettes ---------- */
.r-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--r-target);
  padding: 0 14px;
  /* même arrondi sobre que les boutons (charte UX, règle 11) : une puce cliquable n'est jamais une pilule */
  border-radius: var(--r-radius-md);
  border: 1px solid var(--r-line-strong);
  background: var(--r-card);
  font-size: 13px;
  font-weight: 500;
  color: var(--r-ink-2);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.r-chip--on {
  background: var(--r-ink);
  border-color: var(--r-ink);
  color: var(--r-page);
}
.r-st {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px 0 7px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.r-st svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.r-st--ok {
  background: var(--r-ok-soft);
  color: var(--r-ok);
}
.r-st--warn {
  background: var(--r-warn-soft);
  color: var(--r-warn);
}
.r-st--err {
  background: var(--r-err-soft);
  color: var(--r-err);
}
.r-st--run {
  background: var(--r-accent-soft);
  color: var(--r-accent-ink);
}
.r-st--info {
  background: var(--r-info-soft);
  color: var(--r-info);
}
.r-st--idle {
  background: var(--r-sunken);
  color: var(--r-ink-2);
}
.r-st--wait {
  background: var(--r-card);
  color: var(--r-accent-ink);
  box-shadow: inset 0 0 0 1.5px var(--r-accent);
}
.r-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  display: inline-block;
  background: var(--r-line-strong);
}
.r-dot--ok {
  background: var(--r-ok-dot);
}
.r-dot--warn {
  background: var(--r-warn-dot);
}
.r-dot--err {
  background: var(--r-err);
}
.r-dot--run {
  background: var(--r-accent);
}
.r-ver {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--r-radius-xs);
  font-family: var(--r-mono);
  font-size: 12px;
  font-weight: 500;
  background: var(--r-sunken);
  color: var(--r-ink-2);
  border: 1px solid var(--r-line);
}
.r-tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-radius-xs);
  font-size: 12px;
  background: var(--r-sunken);
  color: var(--r-ink-2);
}
.r-kbd {
  font-family: var(--r-mono);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: var(--r-radius-xs);
  background: var(--r-card);
  border: 1px solid var(--r-line);
  color: var(--r-ink-2);
}
.r-wf {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--r-ink-2);
  background: var(--r-card);
  border: 1px dashed var(--r-line-strong);
  text-decoration: none;
}

/* ---------- Barres de progression ---------- */
.r-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--r-sunken);
  overflow: hidden;
}
.r-bar > span {
  display: block;
  height: 100%;
  background: var(--r-accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.r-bar--lg {
  height: 10px;
  border-radius: 5px;
}
.r-bar--ok > span {
  background: var(--r-ok-dot);
}
.r-bar--warn > span {
  background: var(--r-warn-dot);
}
.r-bar--err > span {
  background: var(--r-err);
}

/* ---------- Tableaux ---------- */
.r-tbl {
  width: 100%;
  border-collapse: collapse;
}
.r-tbl th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--r-ink-3);
  padding: 0 12px;
  height: 40px;
  border-bottom: 1px solid var(--r-line);
  white-space: nowrap;
}
.r-tbl td {
  padding: 0 12px;
  height: var(--r-row-h);
  border-bottom: 1px solid var(--r-line);
  vertical-align: middle;
}
.r-tbl tr:last-child td {
  border-bottom: 0;
}
.r-tbl th:first-child,
.r-tbl td:first-child {
  padding-left: 20px;
}
.r-tbl th:last-child,
.r-tbl td:last-child {
  padding-right: 20px;
}

/* ---------- Champs ---------- */
.r-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.r-field label {
  font-size: 13px;
  font-weight: 500;
}
.r-input {
  height: var(--r-target);
  border-radius: var(--r-radius-md);
  border: 1px solid var(--r-line-strong);
  background: var(--r-card);
  color: var(--r-ink);
  padding: 0 12px;
  width: 100%;
  font: inherit;
}
.r-input:focus {
  outline: 2px solid var(--r-focus);
  outline-offset: 1px;
}

/* ---------- Onglets ---------- */
.r-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--r-line);
}
.r-tabs a {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: var(--r-target);
  padding: 0 14px;
  text-decoration: none;
  color: var(--r-ink-2);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.r-tabs a[aria-current='page'] {
  color: var(--r-ink);
  border-bottom-color: var(--r-ink);
}

/* ---------- Encadrés, états ---------- */
.r-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--r-radius-sm);
  font-size: 13px;
}
.r-note--warn {
  background: var(--r-warn-soft);
  color: var(--r-warn);
}
.r-note--err {
  background: var(--r-err-soft);
  color: var(--r-err);
}
.r-note--info {
  background: var(--r-info-soft);
  color: var(--r-info);
}
.r-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 24px;
  text-align: center;
  color: var(--r-ink-2);
}
.r-empty .r-h2 {
  color: var(--r-ink);
}
.r-empty p {
  margin: 0;
  max-width: 440px;
}
.r-skel {
  background: var(--r-sunken);
  border-radius: 6px;
  animation: r-pulse 1.4s ease-in-out infinite;
}
@keyframes r-pulse {
  50% {
    opacity: 0.55;
  }
}
.r-cover {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-family: var(--r-mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--r-sunken);
  color: var(--r-ink-2);
}
.r-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.r-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--r-accent-soft);
  color: var(--r-accent-ink);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
  flex: none;
}

/* ---------- Icônes (trait 1,75) ---------- */
.r-ic {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.r-ic--sm {
  width: 16px;
  height: 16px;
}
.r-ic--lg {
  width: 24px;
  height: 24px;
}

/* ---------- Le fader (logo) : curseur animé ---------- */
.r-fader-knob--anim {
  animation: r-fader 2.8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes r-fader {
  0%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-19px);
  }
  62% {
    transform: translateY(15px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .r-fader-knob--anim,
  .r-skel {
    animation: none;
  }
}
