/* ═══════════════════════════════════════════════════════════════
   YOK-KOD — MOTEUR HYBRIDE — DESIGN SYSTEM
   Fichier : yok-kod/assets/css/moteur-hybride.css
   Version : v2.0
   ═══════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────
   1. VARIABLES GLOBALES
   ───────────────────────────────────────────────────────────── */

:root {
  /* Fonds */
  --bg:           #0a0a14;
  --panel:        #14141f;
  --panel-2:      #1c1c2a;
  --panel-3:      #232334;
  --border:       #2a2a3a;
  --border-soft:  #1f1f2d;

  /* Textes */
  --ink:          #ece9e0;
  --ink-dim:      #8a8896;
  --ink-faint:    #4a4858;

  /* Accents */
  --accent:       #7c5cff;
  --accent-2:     #ff7b54;
  --accent-3:     #4ad9b0;
  --accent-4:     #ffd166;

  /* États */
  --success:      #4ad98a;
  --error:        #ff5c5c;
  --warn:         #ffb84a;

  /* Arrondis */
  --radius:       10px;
  --radius-sm:    6px;

  /* Typographies */
  --font-sans:    -apple-system, BlinkMacSystemFont, 'Inter',
                  'Helvetica Neue', Arial, sans-serif;
  --font-mono:    ui-monospace, 'SF Mono', Menlo, monospace;
  --font-serif:   'Playfair Display', Georgia, serif;

  /* Ombres */
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.15);
  --shadow:       0 8px 24px rgba(0,0,0,0.3);
  --shadow-lg:    0 20px 60px rgba(0,0,0,0.5);

  /* Transitions */
  --ease-out:     ease;
  --ease-bounce:  cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

/* ─────────────────────────────────────────────────────────────
   2. RESET / BASE
   ───────────────────────────────────────────────────────────── */

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  padding-top: 64px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.01em;
}

h1 { font-size: 2.4rem; margin-bottom: 0.8rem; }
h2 { font-size: 1.8rem; margin-bottom: 0.6rem; }
h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
h4 { font-size: 1.05rem; margin-bottom: 0.4rem; }

p  { margin-bottom: 0.8rem; color: var(--ink-dim); }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s var(--ease-out);
}

a:hover { color: var(--accent-2); }

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

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

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--panel-3);
  border-radius: 5px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--border); }

/* ─────────────────────────────────────────────────────────────
   3. CONTENEUR
   ───────────────────────────────────────────────────────────── */

.container,
.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-narrow {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ─────────────────────────────────────────────────────────────
   4. HERO / HEADER DE PAGE
   ───────────────────────────────────────────────────────────── */

.page-header {
  padding: 3rem 0 2rem;
  text-align: center;
  position: relative;
}

.page-header h1 {
  background: linear-gradient(135deg,
    var(--accent) 0%,
    var(--accent-2) 50%,
    var(--accent-4) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.page-header .subtitle {
  color: var(--ink-dim);
  font-size: 1.05rem;
  max-width: 640px;
  margin: 0.5rem auto 0;
}

.page-header .tagline {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.35rem 0.9rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.page-header::after {
  content: '';
  display: block;
  width: 80px;
  height: 3px;
  margin: 1.5rem auto 0;
  background: linear-gradient(90deg,
    transparent,
    var(--accent),
    var(--accent-2),
    transparent);
  border-radius: 2px;
}

/* ─────────────────────────────────────────────────────────────
   5. CARTES / SECTIONS
   ───────────────────────────────────────────────────────────── */

.card,
.section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin-bottom: 1rem;
  transition: border-color 0.2s var(--ease-out),
              transform 0.2s var(--ease-out);
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-2 { background: var(--panel-2); }
.card-3 { background: var(--panel-3); }

/* ─────────────────────────────────────────────────────────────
   6. SECTIONS DÉPLIABLES (formulaires)
   ───────────────────────────────────────────────────────────── */

.accordion {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.8rem;
  overflow: hidden;
  transition: border-color 0.2s var(--ease-out);
}

.accordion:hover { border-color: var(--border-soft); }
.accordion.open { border-color: var(--accent); }

.accordion-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 1.2rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s var(--ease-out);
}

.accordion-header:hover { background: var(--panel-2); }

.accordion-header .badge-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
}

.accordion-header .acc-title {
  flex: 1;
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--ink);
}

.accordion-header .chevron {
  color: var(--ink-dim);
  transition: transform 0.3s var(--ease-out);
  font-size: 0.85rem;
}

.accordion.open .chevron { transform: rotate(180deg); }

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s var(--ease-out);
  padding: 0 1.2rem;
}

.accordion.open .accordion-body {
  max-height: 2000px;
  padding: 0 1.2rem 1.2rem;
}

/* ─────────────────────────────────────────────────────────────
   7. FORMULAIRES
   ───────────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-dim);
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}

.form-group .hint {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-faint);
  margin-top: 0.3rem;
  font-family: var(--font-mono);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  transition: border-color 0.15s var(--ease-out),
              box-shadow 0.15s var(--ease-out);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.15);
}

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

textarea {
  resize: vertical;
  min-height: 90px;
  font-family: var(--font-sans);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a8896' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  padding-right: 2rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.checkbox-group,
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.checkbox-item,
.radio-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  transition: all 0.15s var(--ease-out);
}

.checkbox-item:hover,
.radio-item:hover { border-color: var(--accent); }

.checkbox-item input,
.radio-item input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* ─────────────────────────────────────────────────────────────
   8. BOUTONS
   ───────────────────────────────────────────────────────────── */

.mh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.2rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
  white-space: nowrap;
}

.mh-btn:hover {
  background: var(--panel-3);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.mh-btn:active { transform: translateY(0); }

.mh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.mh-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #fff;
  box-shadow: 0 4px 20px rgba(124, 92, 255, 0.3);
}

.mh-btn.primary:hover {
  box-shadow: 0 6px 24px rgba(124, 92, 255, 0.4);
  transform: translateY(-2px);
}

.mh-btn.success {
  background: linear-gradient(135deg, var(--success), var(--accent-3));
  border: none;
  color: #fff;
}

.mh-btn.danger {
  background: transparent;
  border-color: var(--error);
  color: var(--error);
}

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

.mh-btn.pill { border-radius: 999px; }
.mh-btn.small { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.mh-btn.large { padding: 0.9rem 1.8rem; font-size: 1rem; }

.btn-generate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(124, 92, 255, 0.3);
  transition: all 0.2s var(--ease-out);
  margin-top: 1rem;
}

.btn-generate:hover:not(:disabled) {
  box-shadow: 0 6px 28px rgba(124, 92, 255, 0.5);
  transform: translateY(-2px);
}

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ai {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  background: transparent;
  border: 1px solid var(--accent-3);
  border-radius: var(--radius);
  color: var(--accent-3);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
  margin-top: 0.6rem;
}

.btn-ai:hover {
  background: rgba(74, 217, 176, 0.1);
  transform: translateY(-1px);
}

.btn-ai:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─────────────────────────────────────────────────────────────
   9. TOASTS
   ───────────────────────────────────────────────────────────── */

.mh-toast-container {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.mh-toast {
  min-width: 240px;
  max-width: 420px;
  padding: 0.8rem 1.1rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  animation: toast-in 0.35s var(--ease-bounce);
  pointer-events: auto;
}

.mh-toast.success { border-left-color: var(--success); }
.mh-toast.error   { border-left-color: var(--error); }
.mh-toast.warn    { border-left-color: var(--warn); }
.mh-toast.info    { border-left-color: var(--accent); }

.mh-toast.hide {
  animation: toast-out 0.25s var(--ease-out) forwards;
}

@keyframes toast-in {
  from { transform: translateY(-120px); opacity: 0; }
  to   { transform: translateY(0);      opacity: 1; }
}

@keyframes toast-out {
  to { transform: translateY(-120px); opacity: 0; }
}

/* ─────────────────────────────────────────────────────────────
   10. MODALES
   ───────────────────────────────────────────────────────────── */

.mh-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 20, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease-out);
}

.mh-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.mh-modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.25s var(--ease-bounce);
}

.mh-modal-overlay.open .mh-modal { transform: scale(1); }

.mh-modal h3 { margin-bottom: 0.8rem; }

.mh-modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 1.2rem;
}

/* ─────────────────────────────────────────────────────────────
   11. SECTEURS / CARTES SÉLECTIONNABLES
   ───────────────────────────────────────────────────────────── */

.sectors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.7rem;
  margin-top: 0.8rem;
}

.sector-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s var(--ease-out);
}

.sector-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.sector-card.selected {
  border-color: var(--accent);
  background: linear-gradient(135deg,
    rgba(124, 92, 255, 0.15),
    rgba(255, 123, 84, 0.08));
  box-shadow: 0 4px 16px rgba(124, 92, 255, 0.2);
}

.sector-card .icon {
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
  display: block;
}

.sector-card .name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

/* ─────────────────────────────────────────────────────────────
   12. LOADING OVERLAY
   ───────────────────────────────────────────────────────────── */

.mh-loading {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 20, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10500;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: 1.5rem;
}

.mh-loading.open { display: flex; }

.mh-loading .spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-right-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.mh-loading .loading-text {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
}

.mh-loading .loading-sub {
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-align: center;
}

.mh-loading .progress-bar {
  width: 240px;
  height: 4px;
  background: var(--panel-2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.mh-loading .progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  transition: width 0.4s var(--ease-out);
}

/* ─────────────────────────────────────────────────────────────
   13. BADGE MODE (mode-indicator)
   ───────────────────────────────────────────────────────────── */

.mode-indicator {
  position: fixed;
  top: 5rem;
  right: 1.5rem;
  z-index: 9000;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  user-select: none;
}

.mode-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 0 rgba(255, 184, 74, 0.6);
  animation: pulse 2s infinite;
}

.mode-indicator.active .dot {
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(74, 217, 138, 0.6);
}

.mode-indicator.active { color: var(--success); }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(124, 92, 255, 0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(124, 92, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(124, 92, 255, 0); }
}

/* ─────────────────────────────────────────────────────────────
   14. PANNEAU LATÉRAL (settings)
   ───────────────────────────────────────────────────────────── */

.mh-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s var(--ease-out);
  box-shadow: var(--shadow-lg);
}

.mh-panel.open { transform: translateX(0); }

.mh-panel-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.mh-panel-header .logo-mini {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  flex-shrink: 0;
}

.mh-panel-header .panel-titles { flex: 1; }

.mh-panel-header .panel-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--ink);
  font-weight: 700;
}

.mh-panel-header .panel-sub {
  font-size: 0.75rem;
  color: var(--ink-dim);
  font-family: var(--font-mono);
}

.mh-panel-header .close-btn {
  background: transparent;
  border: none;
  color: var(--ink-dim);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s var(--ease-out);
  line-height: 1;
}

.mh-panel-header .close-btn:hover {
  color: var(--ink);
  background: var(--panel-2);
}

.mh-panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}

.mh-panel-tabs .tab {
  flex: 1;
  padding: 0.8rem 0.6rem;
  background: transparent;
  border: none;
  color: var(--ink-dim);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s var(--ease-out);
  font-family: var(--font-sans);
}

.mh-panel-tabs .tab:hover { color: var(--ink); }

.mh-panel-tabs .tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--panel);
}

.mh-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem 1.5rem;
}

.mh-panel-tab-content { display: none; }
.mh-panel-tab-content.active { display: block; }

/* ─────────────────────────────────────────────────────────────
   15. OVERLAY
   ───────────────────────────────────────────────────────────── */

.mh-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 20, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9997;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}

.mh-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ─────────────────────────────────────────────────────────────
   16. FAB (bouton flottant ⚡)
   ───────────────────────────────────────────────────────────── */

.mh-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 9998;
  box-shadow: 0 8px 32px rgba(124, 92, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease-bounce);
}

.mh-fab:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 12px 40px rgba(124, 92, 255, 0.6);
}

.mh-fab::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: fab-pulse 2s infinite;
  pointer-events: none;
}

@keyframes fab-pulse {
  0%   { transform: scale(1);    opacity: 0.7; }
  100% { transform: scale(1.6);  opacity: 0; }
}

/* ─────────────────────────────────────────────────────────────
   17. LISTE DES CLÉS API (multi-clés)
   ───────────────────────────────────────────────────────────── */

.api-key-item {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  transition: all 0.15s var(--ease-out);
}

.api-key-item.paused { border-left-color: var(--warn); }

.api-key-item .key-info { flex: 1; min-width: 0; }

.api-key-item .key-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.15rem;
}

.api-key-item .key-value {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-key-item .key-status {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--success);
  white-space: nowrap;
}

.api-key-item.paused .key-status { color: var(--warn); }

.api-key-item .key-delete {
  background: transparent;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: all 0.15s var(--ease-out);
}

.api-key-item .key-delete:hover {
  color: var(--error);
  background: rgba(255, 92, 92, 0.1);
}

/* ─────────────────────────────────────────────────────────────
   18. JOURNAL / LOGS
   ───────────────────────────────────────────────────────────── */

.log-entry {
  display: flex;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
}

.log-entry:last-child { border-bottom: none; }

.log-entry .log-time {
  color: var(--ink-faint);
  flex-shrink: 0;
}

.log-entry .log-level {
  flex-shrink: 0;
  font-weight: 700;
  text-transform: uppercase;
}

.log-entry.info    .log-level { color: var(--accent); }
.log-entry.success .log-level { color: var(--success); }
.log-entry.warn    .log-level { color: var(--warn); }
.log-entry.error   .log-level { color: var(--error); }

.log-entry .log-msg {
  color: var(--ink-dim);
  flex: 1;
  word-break: break-word;
}

/* ─────────────────────────────────────────────────────────────
   19. HISTORIQUE
   ───────────────────────────────────────────────────────────── */

.history-item {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
}

.history-item:hover {
  border-color: var(--accent);
  transform: translateX(3px);
}

.history-item .h-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.2rem;
}

.history-item .h-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-faint);
  display: flex;
  gap: 0.8rem;
}

.history-item .h-mode {
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  background: var(--panel-3);
}

.history-item .h-mode.local { color: var(--accent-3); }
.history-item .h-mode.ai    { color: var(--accent); }

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--ink-faint);
  font-size: 0.85rem;
}

.empty-state .empty-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

/* ─────────────────────────────────────────────────────────────
   20. RÉSULTAT / DOCUMENT GÉNÉRÉ
   ───────────────────────────────────────────────────────────── */

.result-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1.5rem;
  display: none;
}

.result-panel.open { display: block; }

.result-panel .result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.result-panel .result-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--ink);
  font-weight: 700;
}

.result-panel .result-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.result-content {
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.7;
}

.result-content h2,
.result-content h3 {
  margin-top: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--ink);
}

.result-content h2 { font-size: 1.3rem; }
.result-content h3 { font-size: 1.05rem; }

.result-content p  { color: var(--ink); margin-bottom: 0.7rem; }
.result-content ul,
.result-content ol {
  margin: 0.6rem 0 0.9rem 1.5rem;
  color: var(--ink);
}

.result-content li { margin-bottom: 0.3rem; }

.result-content strong { color: var(--accent-4); }

.result-content code {
  background: var(--panel-2);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--accent-3);
}

.result-content pre {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  overflow-x: auto;
  margin: 0.8rem 0;
}

.result-content pre code {
  background: transparent;
  padding: 0;
  color: var(--ink);
}

.result-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0;
  font-size: 0.88rem;
}

.result-content th,
.result-content td {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  text-align: left;
}

.result-content th {
  background: var(--panel-2);
  color: var(--ink);
  font-weight: 600;
}

/* ─────────────────────────────────────────────────────────────
   21. BADGES / TAGS
   ───────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-dim);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge.free    { color: var(--success);  border-color: var(--success); }
.badge.premium { color: var(--accent-4); border-color: var(--accent-4); }
.badge.locked  { color: var(--ink-faint); }
.badge.new     { color: var(--accent-2); border-color: var(--accent-2); }

/* ─────────────────────────────────────────────────────────────
   22. UTILITAIRES
   ───────────────────────────────────────────────────────────── */

.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

.text-dim    { color: var(--ink-dim); }
.text-faint  { color: var(--ink-faint); }
.text-accent { color: var(--accent); }
.text-success{ color: var(--success); }
.text-error  { color: var(--error); }
.text-warn   { color: var(--warn); }

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

.mt-0  { margin-top: 0; }
.mt-1  { margin-top: 0.5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mb-0  { margin-bottom: 0; }
.mb-1  { margin-bottom: 0.5rem; }
.mb-2  { margin-bottom: 1rem; }
.mb-3  { margin-bottom: 1.5rem; }

.hidden   { display: none !important; }
.visible  { display: block !important; }

.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center  { display: flex; justify-content: center; align-items: center; }
.gap-1        { gap: 0.5rem; }
.gap-2        { gap: 1rem; }

/* ─────────────────────────────────────────────────────────────
   23. RESPONSIVE — Breakpoint 640px
   ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  body {
    padding-top: 56px;
    font-size: 15px;
  }

  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.15rem; }

  .container,
  .wrap,
  .container-narrow {
    padding: 0 1rem;
  }

  .page-header {
    padding: 2rem 0 1.5rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .sectors-grid {
    grid-template-columns: 1fr;
  }

  .mh-panel {
    max-width: 100%;
  }

  .mh-fab {
    width: 48px;
    height: 48px;
    bottom: 1rem;
    right: 1rem;
    font-size: 1.2rem;
  }

  .mode-indicator {
    top: auto;
    bottom: 5rem;
    right: 1rem;
    font-size: 0.65rem;
    padding: 0.3rem 0.6rem;
  }

  .result-panel .result-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .result-panel .result-actions {
    width: 100%;
  }

  .result-panel .result-actions .mh-btn {
    flex: 1;
  }

  .btn-generate {
    font-size: 0.9rem;
    padding: 0.9rem 1rem;
  }

  .mh-modal {
    padding: 1.2rem;
  }

  .mh-loading .progress-bar {
    width: 80%;
  }
}