
  :root {
    --blue: #0ea5e9; --blue-dark: #0369a1; --green: #22c55e;
    --orange: #f97316; --red: #ef4444; --yellow: #eab308;
    --gray-50: #f8fafc; --gray-100: #f1f5f9; --gray-200: #e2e8f0;
    --gray-400: #94a3b8; --gray-600: #475569; --gray-700: #334155; --gray-800: #1e293b;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: 'Nunito', sans-serif; background: #f0f6ff; color: var(--gray-800); min-height: 100vh; }

  /* HEADER */
  .header {
    background: linear-gradient(135deg, #0369a1 0%, #0ea5e9 60%, #38bdf8 100%);
    padding: 20px 28px;
    box-shadow: 0 2px 20px rgba(3,105,161,0.3);
  }
  .header-inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }
  .header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
  }
  .header-center {
    flex: 1;
    text-align: center;
  }
  .header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
  }
  .header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
  }
  .header-user {
    font-size: 11px;
    color: rgba(255,255,255,0.72);
    text-align: right;
  }
  .header-badge {
    display: inline-block;
    background: #f97316;
    color: white;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 4px;
  }
  .header h1 { color: white; font-size: 18px; font-weight: 800; }
  .header p  { color: rgba(255,255,255,0.7); font-size: 11px; margin-top: 2px; }
  .badge-new { background: rgba(255,255,255,0.2); color: white; font-size: 10px; font-weight: 700;
    padding: 3px 10px; border-radius: 99px; border: 1px solid rgba(255,255,255,0.35); }
  .header-btn {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .header-btn:hover {
    background: rgba(255,255,255,0.22);
  }

  /* LAYOUT */
  .container { max-width: 980px; margin: 0 auto; padding: 32px 20px; display: flex; flex-direction: column; gap: 24px; }

  /* CARDS */
  .card { background: white; border-radius: 16px; padding: 24px; box-shadow: 0 2px 16px rgba(0,0,0,0.06); }
  .card-title { font-size: 15px; font-weight: 800; color: var(--gray-800); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
  .card-sub   { font-size: 12px; color: var(--gray-400); margin-bottom: 18px; }

  /* STEPS */
  .steps { display: flex; gap: 0; margin-bottom: 28px; }
  .step { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; }
  .step:not(:last-child)::after {
    content: ''; position: absolute; top: 16px; left: 50%; width: 100%; height: 2px;
    background: var(--gray-200); z-index: 0;
  }
  .step.active:not(:last-child)::after { background: var(--blue); }
  .step-circle {
    width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--gray-200);
    background: white; display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800; color: var(--gray-400); z-index: 1; position: relative;
    transition: all 0.3s;
  }
  .step.active .step-circle { border-color: var(--blue); background: var(--blue); color: white; }
  .step.done .step-circle   { border-color: var(--green); background: var(--green); color: white; }
  .step-label { font-size: 10px; font-weight: 600; color: var(--gray-400); margin-top: 6px; text-align: center; }
  .step.active .step-label, .step.done .step-label { color: var(--gray-700); }

  /* TEXTAREA */
  .transcript-area {
    width: 100%; min-height: 200px; padding: 14px; border: 1.5px solid var(--gray-200);
    border-radius: 10px; font-family: 'Nunito', sans-serif; font-size: 13px; line-height: 1.6;
    color: var(--gray-700); resize: vertical; outline: none; transition: border-color 0.2s;
    background: var(--gray-50);
  }
  .transcript-area:focus { border-color: var(--blue); background: white; }

  /* BUTTONS */
  .btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: 10px; font-family: 'Nunito', sans-serif;
    font-size: 13px; font-weight: 700; cursor: pointer; border: none; transition: all 0.2s;
  }
  .btn-primary { background: var(--blue); color: white; }
  .btn-primary:hover { background: var(--blue-dark); }
  .btn-primary:disabled { background: var(--gray-200); color: var(--gray-400); cursor: not-allowed; }
  .btn-success { background: #dcfce7; color: #15803d; border: 1.5px solid #86efac; }
  .btn-success:hover { background: #bbf7d0; }
  .btn-ghost { background: var(--gray-100); color: var(--gray-600); }
  .btn-ghost:hover { background: var(--gray-200); }
  .btn-sm { padding: 5px 12px; font-size: 11px; }

  /* ANALYSE RESULT */
  .result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
  @media (max-width: 640px) { .result-grid { grid-template-columns: 1fr; } }

  .result-module {
    border: 1.5px solid var(--gray-200); border-radius: 12px; padding: 14px;
    display: flex; flex-direction: column; gap: 8px; transition: border-color 0.2s;
    position: relative;
  }
  .result-module.detected   { border-color: #86efac; background: #f0fdf4; }
  .result-module.partial    { border-color: #fde047; background: #fefce8; }
  .result-module.undetected { border-color: var(--gray-200); background: var(--gray-50); opacity: 0.5; }

  .mod-header { display: flex; align-items: center; gap: 8px; }
  .mod-icon { font-size: 18px; }
  .mod-name { font-size: 13px; font-weight: 800; flex: 1; }
  .mod-status {
    font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px;
  }
  .status-detected   { background: #dcfce7; color: #15803d; }
  .status-partial    { background: #fef9c3; color: #a16207; }
  .status-undetected { background: var(--gray-100); color: var(--gray-400); }

  .mod-evidence {
    font-size: 11px; color: var(--gray-600); line-height: 1.5;
    border-left: 2px solid #86efac; padding-left: 8px; font-style: italic;
  }
  .mod-evidence.partial-ev { border-left-color: #fde047; }

  .mod-fields { display: flex; flex-direction: column; gap: 4px; }
  .mod-field  { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--gray-700); }
  .field-key  { font-weight: 600; color: var(--gray-500); min-width: 80px; }
  .field-val  { background: white; border: 1px solid var(--gray-200); border-radius: 6px;
    padding: 2px 8px; flex: 1; }
  .confidence {
    display: flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 600;
  }
  .conf-bar { flex: 1; height: 4px; background: var(--gray-200); border-radius: 2px; overflow: hidden; }
  .conf-fill { height: 100%; border-radius: 2px; transition: width 0.5s; }
  .conf-high   .conf-fill { background: var(--green); }
  .conf-medium .conf-fill { background: var(--yellow); }
  .conf-low    .conf-fill { background: var(--orange); }

  /* CONTACT DETECTED */
  .contact-card {
    background: #eff6ff; border: 1.5px solid #bfdbfe; border-radius: 12px; padding: 14px;
    display: flex; gap: 16px; flex-wrap: wrap;
  }
  .contact-field { display: flex; flex-direction: column; gap: 2px; }
  .contact-label { font-size: 10px; font-weight: 700; color: #3b82f6; text-transform: uppercase; letter-spacing: 0.5px; }
  .contact-value { font-size: 13px; font-weight: 700; color: var(--gray-800); }

  /* SUMMARY BAR */
  .summary-bar {
    display: flex; align-items: center; gap: 16px; padding: 14px 18px;
    background: var(--gray-50); border-radius: 10px; border: 1.5px solid var(--gray-200);
    flex-wrap: wrap;
  }
  .sum-item { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
  .sum-dot  { width: 10px; height: 10px; border-radius: 50%; }

  /* APPLY PANEL */
  .apply-panel {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1.5px solid #86efac; border-radius: 14px; padding: 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    flex-wrap: wrap;
  }
  .apply-text h3 { font-size: 15px; font-weight: 800; color: #15803d; }
  .apply-text p  { font-size: 12px; color: #166534; margin-top: 3px; }

  /* LOADING */
  .loading-overlay {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.4);
    backdrop-filter: blur(4px); z-index: 999; align-items: center; justify-content: center;
  }
  .loading-overlay.show { display: flex; }
  .loading-box {
    background: white; border-radius: 20px; padding: 32px 40px; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2); display: flex; flex-direction: column;
    align-items: center; gap: 16px; max-width: 320px;
  }
  .spinner {
    width: 44px; height: 44px; border: 4px solid var(--gray-200);
    border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .loading-steps { display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left; }
  .loading-step  { font-size: 12px; color: var(--gray-400); display: flex; align-items: center; gap: 8px; }
  .loading-step.active { color: var(--blue); font-weight: 700; }
  .loading-step.done   { color: var(--green); font-weight: 600; }

  /* PROMPT PREVIEW */
  .prompt-preview {
    background: #0f172a; border-radius: 10px; padding: 14px; font-family: monospace;
    font-size: 11px; color: #94a3b8; line-height: 1.6; max-height: 200px;
    overflow-y: auto; white-space: pre-wrap;
  }
  .prompt-preview .kw { color: #38bdf8; }
  .prompt-preview .val { color: #4ade80; }
  .prompt-preview .comment { color: #64748b; }

  /* CHAMPS CLIENT */
  .client-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
  @media (max-width: 600px) { .client-fields { grid-template-columns: 1fr; } }
  .client-field label { display: block; font-size: 11px; font-weight: 700; color: var(--gray-600); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px; }
  .client-field input {
    width: 100%; padding: 10px 14px; border: 1.5px solid var(--gray-200);
    border-radius: 10px; font-family: 'Nunito', sans-serif; font-size: 13px;
    font-weight: 600; color: var(--gray-800); outline: none; transition: border-color 0.2s;
    background: var(--gray-50);
  }
  .client-field input:focus { border-color: var(--blue); background: white; }
  .client-field input.filled { border-color: #86efac; background: #f0fdf4; }

  /* UPLOAD ZONE */
  .upload-zone {
    border: 2px dashed var(--gray-200); border-radius: 12px; padding: 28px;
    text-align: center; cursor: pointer; transition: all 0.2s; background: var(--gray-50);
  }
  .upload-zone:hover, .upload-zone.drag-over { border-color: var(--blue); background: #e0f2fe; }
  .upload-zone.has-file { border-color: #86efac; background: #f0fdf4; border-style: solid; }
  .upload-icon { font-size: 28px; margin-bottom: 8px; }
  .upload-label { font-size: 13px; font-weight: 700; color: var(--gray-600); }
  .upload-sub   { font-size: 11px; color: var(--gray-400); margin-top: 4px; }
  .upload-file-name { font-size: 12px; font-weight: 700; color: #15803d; margin-top: 6px; }

  /* TABS */
  .tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--gray-200); margin-bottom: 20px; }
  .tab  { padding: 8px 16px; font-size: 12px; font-weight: 700; color: var(--gray-400);
    cursor: pointer; border-radius: 8px 8px 0 0; border: none; background: none; font-family: 'Nunito', sans-serif; }
  .tab.active { color: var(--blue); background: #e0f2fe; border-bottom: 2px solid var(--blue); }

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

  #panel1, #panel2, #panel3 {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }

  .info-box {
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px;
    padding: 12px 16px; font-size: 12px; color: #1d4ed8; line-height: 1.6;
  }
  .info-box strong { font-weight: 800; }

  /* MODE SWITCHER (nouveau / existant) */
  .mode-switcher {
    display: flex; gap: 6px; margin-bottom: 12px;
  }
  .mode-btn {
    padding: 8px 18px; border-radius: 8px; font-family: 'Nunito', sans-serif;
    font-size: 12px; font-weight: 700; cursor: pointer; border: 1.5px solid var(--gray-200);
    background: var(--gray-50); color: var(--gray-600); transition: all 0.18s;
  }
  .mode-btn.active {
    background: var(--blue); color: white; border-color: var(--blue);
  }
  .mode-btn:hover:not(.active) { background: var(--gray-100); }

  .mode-hint {
    font-size: 12px; color: var(--gray-400); padding: 6px 0;
  }

  /* PROJECT SELECT */
  .project-select {
    padding: 9px 12px; border: 1.5px solid var(--gray-200); border-radius: 10px;
    font-family: 'Nunito', sans-serif; font-size: 13px; font-weight: 600;
    color: var(--gray-700); background: var(--gray-50); outline: none;
    transition: border-color 0.2s; cursor: pointer;
  }
  .project-select:focus { border-color: var(--blue); background: white; }
