/* ===== Reset & Variables ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --accent: #f59e0b;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-secondary: #64748b;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  --transition: .2s ease;
}

html { font-size: 15px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Sidebar ===== */
.sidebar {
  width: 260px;
  background: var(--text);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sidebar-header p {
  font-size: .75rem;
  color: rgba(255,255,255,.5);
  margin-top: .25rem;
}
.sidebar nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.25rem;
  color: rgba(255,255,255,.7);
  font-size: .9rem;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active {
  background: rgba(37,99,235,.25);
  color: #fff;
  border-left-color: var(--primary);
}
.nav-item .icon { font-size: 1.15rem; width: 1.5rem; text-align: center; }
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .75rem;
  color: rgba(255,255,255,.4);
}

/* ===== Main ===== */
.main {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar h2 { font-size: 1.15rem; font-weight: 600; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
  padding: .25rem .75rem;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
}
.status-badge .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

.content { padding: 2rem; flex: 1; }

/* ===== Pages ===== */
.page { display: none; }
.page.active { display: block; }

/* ===== Dashboard ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.stat-card .label {
  font-size: .8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.stat-card .value {
  font-size: 2rem;
  font-weight: 700;
  margin: .25rem 0;
}
.stat-card .sub {
  font-size: .8rem;
  color: var(--text-secondary);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.action-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.action-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.action-card .action-icon {
  font-size: 2rem;
  flex-shrink: 0;
}
.action-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: .25rem; }
.action-card p { font-size: .85rem; color: var(--text-secondary); }

/* ===== Chat ===== */
.chat-container {
  display: flex;
  height: calc(100vh - 130px);
  gap: 0;
}
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.message {
  max-width: 80%;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  font-size: .9rem;
  line-height: 1.7;
  white-space: pre-wrap;
}
.message.user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.message.assistant {
  align-self: flex-start;
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.message.assistant h3,
.message.assistant h4 { margin: .75rem 0 .25rem; font-size: .95rem; }
.message.assistant ul, .message.assistant ol { padding-left: 1.25rem; margin: .5rem 0; }
.message .typing-indicator span {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: typing .8s infinite;
  margin-right: 4px;
}
.message .typing-indicator span:nth-child(2) { animation-delay: .15s; }
.message .typing-indicator span:nth-child(3) { animation-delay: .3s; }
@keyframes typing {
  0%, 100% { opacity: .3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

.chat-input-area {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: .75rem;
  align-items: flex-end;
}
.chat-input-area textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .75rem 1rem;
  font-size: .9rem;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  outline: none;
  transition: border-color var(--transition);
}
.chat-input-area textarea:focus { border-color: var(--primary); }

.chat-sidebar {
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-left: 1rem;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.chat-sidebar h3 {
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: .25rem;
}
.suggestion-chip {
  display: block;
  width: 100%;
  text-align: left;
  padding: .6rem .75rem;
  font-size: .8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}
.suggestion-chip:hover { border-color: var(--primary); background: var(--primary-light); }

/* ===== Analyse DCE ===== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 1.5rem;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-zone .icon { font-size: 3rem; margin-bottom: .75rem; }
.upload-zone p { color: var(--text-secondary); font-size: .9rem; }

.analysis-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.analysis-section {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.analysis-section:last-child { border-bottom: none; }
.analysis-section h3 {
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.analysis-section table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.analysis-section th, .analysis-section td {
  text-align: left;
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
}
.analysis-section th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ===== Checklist ===== */
.checklist-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.checklist-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.checklist-header h3 { font-size: 1rem; font-weight: 600; }
.progress-bar {
  width: 120px;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: var(--success);
  border-radius: 999px;
  transition: width var(--transition);
}
.checklist-items { padding: .5rem 0; }
.checklist-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1.25rem;
  cursor: pointer;
  transition: background var(--transition);
}
.checklist-item:hover { background: var(--bg); }
.checklist-item input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}
.checklist-item .label { flex: 1; font-size: .9rem; }
.checklist-item .status-tag {
  font-size: .7rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-weight: 500;
}
.status-tag.required { background: #fef2f2; color: #b91c1c; }
.status-tag.optional { background: #fffbeb; color: #92400e; }
.status-tag.done { background: #f0fdf4; color: #166534; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: .4rem .75rem; font-size: .8rem; }

/* ===== RC Extraction Cards ===== */
.rc-alerts-container { margin-bottom: 1rem; display:flex; flex-direction:column; gap:.5rem; }
.rc-alert {
  padding: .75rem 1rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.rc-alert-danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.rc-alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.rc-alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.rc-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.rc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.rc-card-full { grid-column: 1 / -1; }
.rc-card-header {
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.rc-card-header h3 { font-size: .95rem; font-weight: 600; display:flex; align-items:center; gap:.5rem; }
.rc-card-body { padding: 1.25rem; }

/* Info grid (label/value pairs) */
.rc-info-grid { display: flex; flex-direction: column; gap: .5rem; }
.rc-info-row {
  display: flex;
  gap: 1rem;
  padding: .35rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: .88rem;
}
.rc-info-row:last-child { border-bottom: none; }
.rc-info-label {
  min-width: 160px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.rc-info-value { flex: 1; }
.rc-value-danger { color: var(--danger); font-weight: 600; }

/* Table */
.rc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.rc-table th, .rc-table td {
  text-align: left;
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
}
.rc-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.rc-lot-num {
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  width: 50px;
}

/* Critères bars */
.rc-criteres-lot { margin-bottom: 1.25rem; }
.rc-criteres-lot:last-child { margin-bottom: 0; }
.rc-criteres-lot h4 { font-size: .9rem; font-weight: 600; margin-bottom: .75rem; color: var(--primary); }
.rc-criteres-bars { display: flex; flex-direction: column; gap: .5rem; }
.rc-critere-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .88rem;
}
.rc-critere-name { min-width: 150px; font-weight: 500; flex-shrink:0; }
.rc-critere-bar-container {
  flex: 1;
  height: 22px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.rc-critere-bar {
  height: 100%;
  border-radius: 999px;
  transition: width .6s ease;
  min-width: 2px;
}
.rc-critere-pct { font-weight: 700; min-width: 40px; text-align: right; color: var(--text-secondary); }

/* Sous-critères */
.rc-sous-criteres {
  margin: .25rem 0 .5rem 1rem;
  padding-left: 1rem;
  border-left: 3px solid var(--border);
}
.rc-sous-critere {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .3rem 0;
  font-size: .82rem;
  color: var(--text-secondary);
}
.rc-sc-name { flex: 1; }
.rc-sc-points {
  font-weight: 600;
  color: var(--text);
  background: var(--primary-light);
  padding: .1rem .5rem;
  border-radius: 4px;
  font-size: .78rem;
  white-space: nowrap;
}
.rc-sc-elim {
  font-weight: 500;
  color: var(--danger);
  font-size: .78rem;
  white-space: nowrap;
}

/* Pièces demandées */
.rc-pieces-list { display: flex; flex-direction: column; gap: .35rem; }
.rc-piece-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .4rem .5rem;
  border-radius: 6px;
  font-size: .88rem;
}
.rc-piece-item:hover { background: var(--bg); }
.rc-piece-icon { font-size: .7rem; flex-shrink: 0; }
.rc-piece-name { flex: 1; }

/* Capacités minimales */
.rc-capacites-list { display: flex; flex-direction: column; gap: .4rem; }
.rc-capacite-item {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  padding: .35rem .25rem;
  font-size: .88rem;
}
.rc-cap-icon { flex-shrink: 0; margin-top: .1rem; }

@media (max-width: 768px) {
  .rc-cards-grid { grid-template-columns: 1fr; }
  .rc-info-row { flex-direction: column; gap: .15rem; }
  .rc-info-label { min-width: unset; }
  .rc-critere-row { flex-wrap: wrap; }
  .rc-critere-name { min-width: unset; width: 100%; }
}

/* ===== Mémoire technique (Gap 2) ===== */

/* Zone de sélection */
.memoir-select-zone {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
}
.memoir-select-zone .icon { font-size: 3rem; margin-bottom: .75rem; }
.memoir-select-zone h3 { font-size: 1.15rem; margin-bottom: .5rem; }
.memoir-select-zone p { color: var(--text-secondary); font-size: .9rem; margin-bottom: 1.5rem; }

.memoir-form {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
.memoir-form-row {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  text-align: left;
}
.memoir-form-row label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.memoir-form-row select,
.memoir-form-row input {
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: .9rem;
  outline: none;
  min-width: 200px;
}
.memoir-form-row select { min-width: 380px; }
.memoir-form-row input { width: 80px; min-width: 80px; }

/* Plan header */
.memoir-plan-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .5rem;
  margin-bottom: 1rem;
}
.memoir-plan-header h3 { font-size: 1.1rem; }

/* Bouton export Word */
.btn-export {
  white-space: nowrap;
}
.btn-export:disabled {
  opacity: .6;
  cursor: wait;
}

/* Barre de progression globale */
.memoir-progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: .35rem;
}
.memoir-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 999px;
  transition: width .4s ease;
}
.memoir-progress-text {
  font-size: .8rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

/* Liste des sections */
.memoir-sections-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.memoir-section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.memoir-section-card:hover { box-shadow: var(--shadow-lg); }

.memoir-section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
}
.memoir-section-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
}
.memoir-section-info { flex: 1; }
.memoir-section-info h4 { font-size: .95rem; margin-bottom: .3rem; }

.memoir-section-critere {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.memoir-critere-badge {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: .15rem .6rem;
  border-radius: 4px;
  font-size: .78rem;
  font-weight: 600;
}
.memoir-points-badge {
  background: #fef3c7;
  color: #92400e;
  padding: .15rem .5rem;
  border-radius: 4px;
  font-size: .78rem;
  font-weight: 600;
}
.memoir-pond-badge {
  background: #dcfce7;
  color: #166534;
  padding: .15rem .5rem;
  border-radius: 4px;
  font-size: .78rem;
  font-weight: 600;
}
.memoir-elim-badge {
  background: #fef2f2;
  color: var(--danger);
  padding: .15rem .5rem;
  border-radius: 4px;
  font-size: .78rem;
  font-weight: 600;
}

.memoir-section-status {
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
  padding: .25rem .75rem;
  border-radius: 6px;
  flex-shrink: 0;
}
.memoir-status-a_faire { background: #f1f5f9; color: var(--text-secondary); }
.memoir-status-genere { background: #dbeafe; color: var(--primary); }
.memoir-status-valide { background: #dcfce7; color: #166534; }

/* Barre pondération visuelle */
.memoir-pond-bar-container {
  height: 4px;
  background: #e2e8f0;
  overflow: hidden;
}
.memoir-pond-bar {
  height: 100%;
  background: var(--primary);
  transition: width .6s ease;
}

/* Détails de section */
.memoir-section-details {
  padding: .5rem 1.25rem .75rem;
  border-top: 1px solid #f1f5f9;
}
.memoir-detail-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: .5rem 0 .2rem;
}
.memoir-detail-text {
  font-size: .85rem;
  color: var(--text);
  line-height: 1.5;
}
.memoir-refs-list {
  font-size: .83rem;
  color: var(--text-secondary);
  padding-left: 1.25rem;
  margin: .25rem 0 0;
}
.memoir-refs-list li { margin-bottom: .15rem; }

/* Actions de section */
.memoir-section-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.25rem;
  border-top: 1px solid #f1f5f9;
  background: #fafbfc;
}
.memoir-length-hint {
  font-size: .78rem;
  color: var(--text-secondary);
}

/* Modal brouillon */
.memoir-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.memoir-modal-content {
  background: var(--surface);
  border-radius: var(--radius);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.memoir-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.memoir-modal-header h3 { font-size: 1rem; }
.memoir-modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: .25rem;
}
.memoir-draft-meta {
  display: flex;
  gap: .5rem;
  padding: .75rem 1.25rem;
  flex-wrap: wrap;
}
.memoir-draft-editor {
  margin: 0 1.25rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: .88rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  flex: 1;
  min-height: 300px;
  overflow-y: auto;
}
.memoir-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* ===== Auth Overlay ===== */
.auth-overlay {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  align-items: center;
  justify-content: center;
}
.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}
.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-header h1 { font-size: 1.5rem; }
.auth-header p { color: var(--text-secondary); font-size: .85rem; margin-top: .25rem; }
.auth-form h2 { font-size: 1.1rem; margin-bottom: 1.25rem; }
.auth-field { margin-bottom: 1rem; }
.auth-field label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .35rem; }
.auth-field input {
  width: 100%;
  padding: .65rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  font-family: inherit;
  outline: none;
  transition: border var(--transition);
}
.auth-field input:focus { border-color: var(--primary); }
.auth-error { color: var(--danger); font-size: .85rem; margin-bottom: .75rem; }
.btn-block { width: 100%; }
.auth-switch { text-align: center; font-size: .85rem; color: var(--text-secondary); margin-top: 1rem; }

/* ===== Sidebar Usage ===== */
.sidebar-usage {
  padding: .75rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .8rem;
}
.usage-title { color: rgba(255,255,255,.6); font-weight: 600; margin-bottom: .5rem; font-size: .75rem; }
.usage-row { display: flex; justify-content: space-between; color: rgba(255,255,255,.7); margin-bottom: .25rem; }

/* ===== Scoring ===== */
.scoring-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.scoring-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.scoring-field label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .35rem; }
.scoring-field select, .scoring-field input[type="range"] {
  width: 100%;
  padding: .5rem .6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: .9rem;
}
.scoring-analyses-list { display: flex; flex-direction: column; gap: .5rem; }
.scoring-analysis-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: .75rem 1rem; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; transition: all var(--transition);
}
.scoring-analysis-item:hover { border-color: var(--primary); background: var(--primary-light); }
.scoring-analysis-item.selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 2px var(--primary); }
.scoring-analysis-info { display: flex; flex-direction: column; gap: .15rem; }
.scoring-analysis-badges { display: flex; align-items: center; gap: .5rem; }
.score-badge {
  padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
}
.score-go { background: #dcfce7; color: #166534; }
.score-nogo { background: #fecaca; color: #991b1b; }
.score-maybe { background: #fef3c7; color: #92400e; }
.score-pending { background: #f3f4f6; color: #6b7280; border: 1px dashed #d1d5db; }
.score-value { font-size: .85rem; font-weight: 700; color: var(--text); }
.score-value.score-obj { color: #9ca3af; font-weight: 400; font-size: .75rem; font-style: italic; }

/* Type AO badges */
.ao-type-badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  font-size: .7rem; font-weight: 600; white-space: nowrap;
}
.ao-type-forfait { background: #ede9fe; color: #5b21b6; }
.ao-type-regie { background: #dbeafe; color: #1e40af; }

/* Meta tags for forfait/régie specifics */
.meta-tag {
  display: inline-block; padding: .1rem .4rem; border-radius: 4px;
  font-size: .65rem; font-weight: 500;
}
.meta-forfait { background: #f3e8ff; color: #7c3aed; }
.meta-regie { background: #e0f2fe; color: #0369a1; }
.meta-critere { background: #fef3c7; color: #92400e; }

.scoring-result-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.scoring-result-header {
  padding: 2rem; text-align: center;
}
.scoring-result-go { background: linear-gradient(135deg, #dcfce7, #bbf7d0); }
.scoring-result-nogo { background: linear-gradient(135deg, #fecaca, #fca5a5); }
.scoring-result-maybe { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.scoring-big-score { font-size: 3rem; font-weight: 800; }
.scoring-big-score span { font-size: 1.2rem; font-weight: 400; color: var(--text-secondary); }
.scoring-rec { font-size: 1.5rem; font-weight: 700; margin-top: .5rem; }
.scoring-details { padding: 1rem 1.5rem; }
.scoring-detail-row { display: flex; justify-content: space-between; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.scoring-detail-row:last-child { border-bottom: none; }

/* ===== CVs ===== */
.cvs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.cv-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: box-shadow var(--transition);
}
.cv-card:hover { box-shadow: var(--shadow-lg); }
.cv-card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.cv-card-body { padding: 1rem 1.25rem; }
.cv-exp { font-size: .85rem; color: var(--text-secondary); margin-bottom: .5rem; }
.cv-skills { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }
.cv-skill-tag {
  padding: .15rem .5rem; border-radius: 999px; font-size: .75rem;
  background: var(--primary-light); color: var(--primary-dark);
}
.cv-specs { display: flex; flex-wrap: wrap; gap: .35rem; }
.cv-spec-tag {
  padding: .15rem .5rem; border-radius: 999px; font-size: .75rem;
  background: #fef3c7; color: #92400e;
}
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ===== Delete analysis button ===== */
.btn-delete-analysis {
  background: none; border: none; cursor: pointer; font-size: 1rem;
  opacity: .4; transition: opacity .15s; padding: .25rem; margin-left: .5rem;
}
.btn-delete-analysis:hover { opacity: 1; }

/* ===== Hamburger menu toggle ===== */
.menu-toggle {
  display: none;
  position: fixed; top: .75rem; left: .75rem; z-index: 1100;
  background: var(--primary); color: #fff; border: none; border-radius: .5rem;
  width: 2.5rem; height: 2.5rem; font-size: 1.4rem; cursor: pointer;
  align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

/* ===== Loading spinner ===== */
.loading { position: relative; pointer-events: none; opacity: .6; }
.loading::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 1.5rem; height: 1.5rem; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Sidebar backdrop (mobile) ===== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 99;
  cursor: pointer;
}
.sidebar-backdrop.active { display: block; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding-top: 3.5rem; }
  .chat-sidebar { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
  .scoring-fields { grid-template-columns: 1fr; }
  .cvs-grid { grid-template-columns: 1fr; }
  .analysis-cards { grid-template-columns: 1fr; }
  .memoir-cards { grid-template-columns: 1fr; }
  table { font-size: .8rem; }
  .criteria-table td, .criteria-table th { padding: 4px 6px; }
}
