@import url('/assets/css/fonts.css');

/* ============================================================================
   BySum — feuille de style unique. Aucun build, aucun CDN.
   Thèmes : clair / sombre / auto (suit l'OS).
   - auto   → <html> sans attribut, la media query décide
   - forcé  → <html data-theme="light|dark">, qui gagne sur la media query
   ========================================================================== */

:root {
  /* Palette claire (base) */
  --bg:            #fbfaf7;
  --surface:       #ffffff;
  --surface-2:     #f4f2ed;
  --border:        #e5e2da;
  --border-strong: #cfcabe;
  --text:          #14171c;
  --text-muted:    #5c6470;
  --text-faint:    #8a93a1;

  --accent:      #f5a623;  /* aplats : puces, boutons, points */
  --accent-text: #8f5e08;  /* ambre lisible en texte sur fond clair */
  --accent-ink:  #1a1305;  /* texte posé SUR un aplat ambre */
  --accent-dim:  #fdf1dc;

  --success:     #2e7d52;
  --success-ink: #ffffff;
  --success-dim: #e4f2ea;

  --danger:      #c0392b;
  --danger-dim:  #fceae7;

  --grid-opacity: .34;
  --shadow: 0 1px 2px rgba(20, 23, 28, .04), 0 18px 50px -28px rgba(20, 23, 28, .28);

  --display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --body:    'Inter', ui-sans-serif, -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius:    12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --wrap: 920px;
}

/* Palette sombre — reprise du mockup */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #0d1117;
    --surface:       #151b23;
    --surface-2:     #1c232d;
    --border:        #262e3a;
    --border-strong: #333d4c;
    --text:          #e9edf3;
    --text-muted:    #8891a0;
    --text-faint:    #576073;

    --accent-text: #f5a623;
    --accent-dim:  #4a3a1a;

    --success:     #4caf7d;
    --success-ink: #06150d;
    --success-dim: #1b3327;

    --danger:      #ef6f61;
    --danger-dim:  #3a1e1a;

    --grid-opacity: .15;
    --shadow: 0 20px 60px -20px rgba(0, 0, 0, .6);
  }
}

:root[data-theme="dark"] {
  --bg:            #0d1117;
  --surface:       #151b23;
  --surface-2:     #1c232d;
  --border:        #262e3a;
  --border-strong: #333d4c;
  --text:          #e9edf3;
  --text-muted:    #8891a0;
  --text-faint:    #576073;

  --accent-text: #f5a623;
  --accent-dim:  #4a3a1a;

  --success:     #4caf7d;
  --success-ink: #06150d;
  --success-dim: #1b3327;

  --danger:      #ef6f61;
  --danger-dim:  #3a1e1a;

  --grid-opacity: .15;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, .6);
}

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

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Texture grille discrète, reprise du mockup */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: var(--grid-opacity);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; }

::selection { background: var(--accent); color: var(--accent-ink); }

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

main { flex: 1; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ---------------------------------------------------------------- Typo */

h1 {
  font-family: var(--display);
  font-size: clamp(30px, 6vw, 52px);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.05;
}

h1 .accent { color: var(--accent-text); }

h2 {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.02em;
}

h3 { font-family: var(--display); font-size: 17px; font-weight: 600; letter-spacing: -.01em; }

.eyebrow,
.section-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.eyebrow { color: var(--accent-text); margin-bottom: 20px; }
.section-label { color: var(--text-faint); margin-bottom: 28px; }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 13px; }
.mono  { font-family: var(--mono); }

/* ---------------------------------------------------------------- Nav */

.site-header { border-bottom: 1px solid var(--border); position: relative; z-index: 10; }

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 22px;
  padding-bottom: 22px;
}

.logo {
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -.02em;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  flex: none;
}

.logo .dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  flex: none;
}

.nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav a {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 7px 11px;
  border-radius: var(--radius-xs);
}

.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); }

/* Bouton de thème : soleil / lune / auto */
.theme-toggle {
  font: inherit;
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  cursor: pointer;
  flex: none;
}

.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle svg { width: 16px; height: 16px; display: block; }

/* Une seule icône visible selon le mode courant */
.theme-toggle .i-auto,
.theme-toggle .i-light,
.theme-toggle .i-dark { display: none; }
:root:not([data-theme]) .theme-toggle .i-auto { display: block; }
:root[data-theme="light"] .theme-toggle .i-light { display: block; }
:root[data-theme="dark"]  .theme-toggle .i-dark  { display: block; }

/* ---------------------------------------------------------------- Hero */

.hero { padding: clamp(44px, 9vw, 88px) 0 clamp(36px, 6vw, 60px); text-align: center; }

.hero .sub {
  color: var(--text-muted);
  font-size: 16px;
  max-width: 470px;
  margin: 18px auto 36px;
}

.hero-hint {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 16px;
}

/* ---------------------------------------------------------- Console (input URL) */

.console {
  max-width: 620px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  text-align: left;
  box-shadow: var(--shadow);
}

.console-bar {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.console-bar span {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--text-faint);
  opacity: .5;
}

.console-bar .console-tag {
  width: auto; height: auto;
  border-radius: 0;
  background: none;
  opacity: 1;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}

.console-body {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.prompt-sign { font-family: var(--mono); color: var(--accent-text); font-size: 15px; flex: none; }

.console-input {
  flex: 1 1 220px;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  outline: none;
  padding: 4px 0;
}

.console-input::placeholder { color: var(--text-faint); }

.console-select {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  cursor: pointer;
  flex: none;
}

.console-foot {
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  background: var(--surface-2);
}

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

.btn {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid transparent;
  padding: 10px 16px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
  transition: opacity .12s, transform .06s, border-color .12s, color .12s;
}

.btn:hover { opacity: .88; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); opacity: 1; }

.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { padding: 8px 13px; font-size: 12px; }

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.card > h5,
.card-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  margin-bottom: 14px;
  font-weight: 500;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.stack   { display: grid; gap: 18px; }

/* ---------------------------------------------------------------- Étapes (accueil) */

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.step .num { font-family: var(--mono); color: var(--accent-text); font-size: 13px; margin-bottom: 9px; }
.step h3 { margin-bottom: 6px; }
.step p { color: var(--text-muted); font-size: 14px; }

.pipeline-svg { width: 100%; height: auto; display: block; margin-bottom: 14px; }

/* ---------------------------------------------------------------- Fiche vidéo */

.video-card {
  display: flex;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
}

.video-card .thumb {
  width: 160px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  object-fit: cover;
  background: var(--surface-2);
  display: block;
}

.video-meta { min-width: 0; flex: 1; }
.video-meta h1 { font-size: clamp(19px, 3.4vw, 24px); margin-bottom: 6px; }
.video-meta .chan { color: var(--text-muted); font-size: 13px; margin-bottom: 11px; }

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

.tag-row { display: flex; gap: 7px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Listes de points */

.points { list-style: none; display: flex; flex-direction: column; gap: 11px; }

.points li {
  font-size: 14px;
  color: var(--text-muted);
  padding-left: 16px;
  position: relative;
  line-height: 1.55;
}

.points li::before {
  content: '';
  position: absolute;
  left: 0; top: 8px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.summary-text { font-size: 14.5px; color: var(--text-muted); }

/* ---------------------------------------------------------------- Checklist */

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.progress-count { font-family: var(--mono); font-size: 12px; color: var(--success); white-space: nowrap; }

.progress-bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--success);
  border-radius: 4px;
  transition: width .25s ease;
}

.actions { list-style: none; }

.action-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.action-item:last-child { border-bottom: none; padding-bottom: 0; }
.action-item:first-child { padding-top: 0; }

.action-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--text-faint);
  background: transparent;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .12s, border-color .12s;
}

.action-item input[type="checkbox"]:checked {
  background: var(--success);
  border-color: var(--success);
}

.action-item input[type="checkbox"]:checked::after {
  content: '';
  width: 4px; height: 8px;
  border: solid var(--success-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.action-item .txt { min-width: 0; }

.action-item .txt label {
  font-size: 14px;
  font-weight: 500;
  display: block;
  cursor: pointer;
  margin-bottom: 3px;
}

.action-item .txt p { font-size: 12.5px; color: var(--text-faint); }

.action-item.done .txt label {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--text-faint);
}

.empty-actions {
  font-size: 13.5px;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.export-row { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 18px; }

/* ---------------------------------------------------------------- Notes structurées */

.sections { list-style: none; counter-reset: sec; }

.sections > li {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  counter-increment: sec;
}

.sections > li:first-child { padding-top: 0; }
.sections > li:last-child { border-bottom: 0; padding-bottom: 0; }

.sections h6 {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
  margin-bottom: 9px;
  display: flex;
  gap: 9px;
  align-items: baseline;
}

.sections h6::before {
  content: counter(sec, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--accent-text);
  flex: none;
}

.sections .points { gap: 8px; }
.sections .points li { font-size: 13.5px; }

/* Bascule de format */

.format-reason {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-faint);
  font-style: italic;
}

.format-switch {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
}

.format-chip {
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
}

.format-chip:hover:not([disabled]) { color: var(--text); border-color: var(--border-strong); }

.format-chip.is-on {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-text);
  cursor: default;
}

.format-chip[disabled]:not(.is-on) { opacity: .5; cursor: not-allowed; }

/* Pastille de format dans l'historique */
.hist-format {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-faint);
  white-space: nowrap;
}

.hist-format.plan { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

.transcript-card { margin-top: 18px; }

.transcript-card > summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
}

.transcript-card > summary::-webkit-details-marker { display: none; }
.transcript-card > summary::after { content: ' ▸'; margin-left: auto; }
.transcript-card[open] > summary::after { content: ' ▾'; }
.transcript-card > summary:hover { color: var(--text-muted); }

.transcript-text {
  margin-top: 16px;
  max-height: 420px;
  overflow-y: auto;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-muted);
  white-space: pre-wrap;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ---------------------------------------------------------------- Historique */

.hist-list { list-style: none; }

.hist-row {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}

.hist-row:hover { background: var(--surface); }

.hist-thumb {
  width: 72px;
  aspect-ratio: 16 / 9;
  border-radius: 5px;
  background: var(--surface-2);
  flex-shrink: 0;
  object-fit: cover;
  display: block;
}

.hist-info { flex: 1; min-width: 0; }

.hist-info .title {
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-info .title:hover { color: var(--accent-text); }

.hist-info .sub {
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--mono);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 3px;
}

/* Séparateur entre métadonnées, sinon la ligne se lit comme un seul bloc */
.hist-info .sub > span + span::before,
.hist-info .sub > a + span::before {
  content: '·';
  margin-right: 8px;
  opacity: .55;
}

.hist-url {
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.hist-url:hover { color: var(--accent-text); }

.hist-progress {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
  flex-shrink: 0;
  white-space: nowrap;
}

.hist-progress.done { color: var(--success); border-color: transparent; background: var(--success-dim); }

/* Détail dépliable du traitement */
.usage { margin-top: 8px; }

.usage summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}

.usage summary::-webkit-details-marker { display: none; }
.usage summary:hover { color: var(--text-muted); }

.usage-cost {
  color: var(--accent-text);
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 20px;
  padding: 3px 9px;
  font-variant-numeric: tabular-nums;
}

.usage-ai {
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 9px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-more::after { content: ' ▸'; }
.usage[open] .usage-more::after { content: ' ▾'; }

.usage-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 11.5px;
}

.usage-grid dt { color: var(--text-faint); white-space: nowrap; }
.usage-grid dd { color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- États */

.alert {
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13.5px;
  color: var(--text-muted);
}

.alert-error {
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  background: var(--danger-dim);
  color: var(--danger);
}

.alert-error strong { color: var(--danger); }

.alert + .alert { margin-top: 10px; }

.loading {
  display: none;
  align-items: center;
  gap: 11px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
}

.loading.is-on { display: flex; }

.spinner {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
  flex: none;
}

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

.empty-state {
  text-align: center;
  padding: 56px 22px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
}

.empty-state p { margin-bottom: 14px; }
.empty-state p:last-child { margin-bottom: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 18px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 20px;
  font-family: var(--mono);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 60;
  max-width: calc(100vw - 40px);
}

.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

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

.section { padding: clamp(44px, 7vw, 76px) 0; border-top: 1px solid var(--border); }
.section:first-of-type { border-top: none; }

.page-head { padding: clamp(32px, 5vw, 56px) 0 26px; }
.page-head h1 { font-size: clamp(26px, 5vw, 38px); margin-bottom: 10px; }
.page-head .sub { color: var(--text-muted); font-size: 14px; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
  position: relative;
  z-index: 1;
}

/* ---------------------------------------------------------------- Login */

.login-shell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  position: relative;
  z-index: 1;
}

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

.theme-floating { position: fixed; top: 18px; right: 18px; z-index: 20; }

.login-box .logo { justify-content: center; margin-bottom: 6px; display: flex; font-size: 22px; }

.login-tagline {
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--text-faint);
  margin-bottom: 24px;
}

.login-fields { padding: 22px 20px; display: grid; gap: 14px; }

.field label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  margin-bottom: 7px;
}

.field input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  padding: 11px 13px;
  outline: none;
}

.field input:focus { border-color: var(--accent); }

.field-select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  padding: 11px 13px;
  outline: none;
  cursor: pointer;
}

.field-select:focus { border-color: var(--accent); }
.field input[type="number"] { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------- Réglages */

.provider-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.provider-opt {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  position: relative;
  transition: border-color .12s;
}

.provider-opt:hover { border-color: var(--border-strong); }
.provider-opt.is-on { border-color: var(--accent); background: var(--accent-dim); }

/* Repli CSS si le JS ne tourne pas : :has() suit l'état réel du bouton radio. */
.provider-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-dim); }
.provider-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.provider-opt input { position: absolute; opacity: 0; pointer-events: none; }

.provider-name { font-family: var(--display); font-weight: 600; font-size: 15px; }
.provider-state { font-family: var(--mono); font-size: 11px; }
.provider-state.ok { color: var(--success); }
.provider-state.ko { color: var(--text-faint); }

.key-state {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 11px;
}

.key-state code { color: var(--text-muted); }

.key-clear {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--danger);
  cursor: pointer;
  margin: 0;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
}

.key-clear input { width: 13px; height: 13px; accent-color: var(--danger); }

.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.danger-zone > h5 { color: var(--danger); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .88; }

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

.login-note {
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 18px;
}

/* ---------------------------------------------------------------- Responsive */

@media (max-width: 860px) {
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .steps { grid-template-columns: 1fr; gap: 22px; }
  .pipeline-svg { display: none; }
}

@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  body::before { background-size: 44px 44px; }

  .site-header .wrap { padding-top: 16px; padding-bottom: 16px; gap: 10px; }
  .logo { font-size: 18px; }
  .nav a { padding: 6px 8px; font-size: 13px; }

  .video-card { flex-direction: column; gap: 14px; padding: 15px; }
  .video-card .thumb { width: 100%; }

  .console-body { padding: 15px; gap: 10px; }
  .console-input { flex-basis: 100%; order: 2; }
  .prompt-sign { order: 1; }
  .console-body .btn { order: 4; flex: 1; }
  .console-select { order: 3; flex: 1; }

  .card { padding: 17px; }
  .hist-row { padding: 11px 10px; gap: 11px; align-items: flex-start; }
  .hist-thumb { width: 56px; }
  .hist-progress { align-self: center; }

  .usage-grid { grid-template-columns: 1fr; gap: 2px; }
  .usage-grid dt { margin-top: 7px; }
  .usage-grid dt:first-child { margin-top: 0; }

  .export-row .btn { flex: 1 1 calc(50% - 5px); text-align: center; }
}

@media (max-width: 400px) {
  .hist-row { flex-wrap: wrap; }
  .hist-progress { order: 3; }
  .export-row .btn { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .spinner { animation-duration: 1.4s !important; }
}

/* ---------------------------------------------------------------- Impression */

@media print {
  body::before, .site-header, .site-footer, .export-row, .no-print, .toast { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .card, .video-card { border: 0; padding: 0; margin-bottom: 16px; background: none; }
  .wrap { max-width: none; padding: 0; }
  .two-col { grid-template-columns: 1fr; }
  .action-item { break-inside: avoid; }
}
