:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f0f3f9;
  --border: #dde3ec;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --text: #1a2230;
  --text-dim: #6b7688;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

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

/* Layout */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
  box-shadow: var(--shadow);
}
.topbar .brand { font-weight: 800; font-size: 20px; letter-spacing: -0.3px; }
.topbar .brand span { color: var(--primary); }
.nav { display: flex; gap: 6px; align-items: center; }
.nav button { background: transparent; border: none; color: var(--text-dim); font-weight: 600; }
.nav button:hover { background: var(--surface-2); color: var(--text); }
.nav button.active { color: var(--primary); background: #e8effe; }
.topbar a.brand { text-decoration: none; color: var(--text); }

/* Bouton "hamburger" (3 barres) : masqué par défaut, affiché en mobile */
.nav-toggle {
  display: none;
  background: transparent; border: 1px solid var(--border);
  font-size: 20px; line-height: 1; padding: 6px 10px; border-radius: 8px;
}
.nav-toggle:hover { background: var(--surface-2); }

/* Sélecteur de langue (FR | EN) : deux options texte, celle active est mise
   en évidence. Pas d'emoji drapeau : ils ne s'affichent pas sous Windows. */
.lang-switch {
  display: inline-flex; border: 1px solid var(--border); border-radius: 999px;
  overflow: hidden; flex-shrink: 0;
}
.lang-switch button {
  border: none; background: transparent; padding: 6px 11px; font-size: 12px;
  font-weight: 700; cursor: pointer; color: var(--text-dim);
}
.lang-switch button.active { background: var(--primary); color: #fff; }

/* Menu responsive : sous un certain seuil, le menu se replie derrière le
   bouton hamburger et s'affiche en overlay déroulant sur toute la largeur. */
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg); padding: 10px; z-index: 20;
  }
  .nav.open { display: flex; }
  .nav button, .nav .plan-badge { width: 100%; text-align: left; justify-content: flex-start; }
  .nav button { padding: 12px 14px; }
  .topbar { position: relative; }
}


/* Badge de formule dans la barre de navigation */
.plan-badge {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; background: #eef2ff; color: var(--primary);
  border: 1px solid #dbe4ff; white-space: nowrap;
}
.plan-badge.admin { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.plan-badge.free { background: #f3f4f6; color: #6b7280; border-color: #e5e7eb; }

/* Paywall */
.paywall {
  display: flex; gap: 14px; align-items: flex-start; margin-top: 12px;
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  padding: 16px 18px; border-radius: var(--radius);
}
.paywall-ic { font-size: 26px; }

/* Grille des formules (page Abonnement) */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }

.plan-card { position: relative; display: flex; flex-direction: column; }
.plan-card.featured { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.plan-card.current { outline: 2px solid var(--primary); }
.plan-card .ribbon {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
  padding: 4px 12px; border-radius: 999px;
}
.plan-price { margin: 6px 0 12px; }
.plan-price .amt { font-size: 34px; font-weight: 800; }
.plan-price .per { color: var(--text-dim); font-size: 13px; }
.plan-feats { list-style: none; padding: 0; margin: 0 0 16px; flex: 1; }
.plan-feats li { padding: 5px 0; font-size: 13px; border-bottom: 1px dashed var(--border); }
.plan-feats li.no { color: #b0b8c5; }
@media (max-width: 900px) { .plan-grid { grid-template-columns: 1fr; } }

/* Admin */
.admin-stats { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 10px; }
.admin-stats > div { background: var(--surface-2); border-radius: var(--radius); padding: 14px 20px; min-width: 140px; text-align: center; }
.admin-stats strong { display: block; font-size: 24px; color: var(--primary); }
.admin-stats span { font-size: 12px; color: var(--text-dim); }

/* Le tableau utilisateurs peut être plus large que l'écran (beaucoup de
   colonnes) : on l'enveloppe dans un conteneur qui permet un défilement
   horizontal fluide sur mobile/tablette plutôt que de casser la mise en page. */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.admin-table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; white-space: nowrap; }
.admin-table th { color: var(--text-dim); font-weight: 700; text-transform: uppercase; font-size: 11px; }
.admin-table select { padding: 4px 6px; font-size: 12px; }
.admin-actions { white-space: nowrap; }
.admin-actions button { margin-right: 4px; margin-bottom: 4px; }

@media (max-width: 700px) {
  .admin-table { min-width: 600px; font-size: 12px; }
  .admin-table th, .admin-table td { padding: 6px 8px; }
  #admin-search { max-width: 100% !important; width: 100%; }
}




.container { max-width: 1100px; margin: 0 auto; padding: 28px 24px; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card h2 { margin-bottom: 16px; font-size: 18px; font-weight: 700; }
.card h3 { margin: 12px 0 8px; font-size: 15px; color: var(--text-dim); font-weight: 600; }

/* Forms */
label { display: block; font-size: 13px; color: var(--text-dim); margin: 12px 0 5px; font-weight: 600; }
input, textarea, select {
  width: 100%; padding: 10px 13px; background: #fff;
  border: 1px solid var(--border); border-radius: 9px; color: var(--text);
  font-size: 14px; font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
select { cursor: pointer; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-size: 12px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

/* Buttons */
button {
  cursor: pointer; padding: 10px 16px; border-radius: 9px; border: 1px solid var(--border);
  background: #fff; color: var(--text); font-size: 14px; font-weight: 600;
  transition: all .15s;
}
button:hover { background: var(--surface-2); }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-hover); }
button.danger { background: #fff; border-color: var(--danger); color: var(--danger); }
button.danger:hover { background: #fef2f2; }
button.small { padding: 6px 11px; font-size: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; align-items: center; }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  background: #e8effe; border: 1px solid #cfe0fd; border-radius: 999px;
  padding: 4px 10px; font-size: 12px; display: flex; align-items: center; gap: 6px;
  color: var(--primary); font-weight: 600;
}
.tag button { padding: 0; border: none; background: none; color: var(--primary); font-size: 15px; line-height: 1; }
.tag button:hover { background: none; color: var(--danger); }

/* Auth */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(135deg, #eef2fb 0%, #e0e9fd 100%);
}
.auth-card { width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); }
.brand-title { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.auth-wrap { position: relative; flex-direction: column; gap: 14px; }
.back-home {
  align-self: center; font-size: 13px; font-weight: 600; color: var(--text-dim);
  margin-bottom: 4px;
}
.back-home:hover { color: var(--primary); }

/* Modale générique (ex: mot de passe oublié) */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(16, 24, 40, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-box { width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); }


/* Photo de profil */
.photo-row { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.photo-preview {
  width: 120px; height: 120px; border-radius: 14px; object-fit: cover;
  border: 1px solid var(--border); background: var(--surface-2);
}
.photo-preview.photo-empty {
  display: inline-block; position: relative;
}
.photo-preview.photo-empty::after {
  content: "📷"; position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; font-size: 36px; opacity: .4;
}

/* Lists */
.job-list { display: flex; flex-direction: column; gap: 10px; }
.job-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow);
}
.job-item:hover { border-color: var(--primary); }
.job-item.selected { border-color: var(--primary); background: #f5f8ff; box-shadow: 0 0 0 1px var(--primary); }
.job-item .title { font-weight: 700; }
.job-item .meta { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.job-item .excerpt {
  font-size: 12.5px; color: var(--text-dim); margin-top: 6px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.badges { display: flex; gap: 6px; margin-top: 8px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); font-weight: 600; }
.badge.ok { color: var(--success); border-color: #bbf7d0; background: #f0fdf4; }

/* Two-column for jobs view */
.split { display: grid; grid-template-columns: 360px 1fr; gap: 16px; }
@media (max-width: 800px) { .split { grid-template-columns: 1fr; } }

/* Document preview */
.doc-preview {
  background: #fff; color: #111; padding: 28px; border-radius: 8px;
  max-height: 600px; overflow: auto; border: 1px solid var(--border);
}
.doc-preview h1 {
  color: var(--primary); font-size: 26px; margin-bottom: 4px; letter-spacing: -0.3px;
}
.doc-preview h2 {
  color: var(--primary); font-size: 16px; text-transform: uppercase; letter-spacing: 0.5px;
  margin: 20px 0 10px; padding-bottom: 4px; border-bottom: 2px solid var(--primary);
}
.doc-preview h2:first-of-type { margin-top: 8px; }
.doc-preview h3 { color: var(--primary-hover); font-size: 14px; margin: 10px 0 4px; }
.doc-preview strong { color: #111; }
.doc-preview img.cv-photo { width: 100px; height: 100px; object-fit: cover; border-radius: 50%; float: right; margin: 0 0 12px 16px; border: 2px solid var(--primary); }

#gen-lang { width: auto; display: inline-block; padding: 6px 10px; font-size: 13px; }
label[for="gen-lang"] { display: inline; margin: 0; }

.doc-note {
  background: #eef2ff; border: 1px solid var(--primary); color: var(--primary-hover);
  border-radius: var(--radius); padding: 10px 14px; font-size: 13px; margin-bottom: 14px;
}

.doc-preview table { border-collapse: collapse; width: 100%; margin: 12px 0; }
.doc-preview th, .doc-preview td { border: 1px solid #d1d5db; padding: 8px; text-align: left; vertical-align: top; font-size: 13px; }
.doc-preview th { background: #eef2ff; color: var(--primary); }

.doc-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.doc-tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Misc */
.muted { color: var(--text-dim); font-size: 13px; }
.error { color: var(--danger); font-size: 13px; margin-top: 8px; }
.success { color: var(--success); font-size: 13px; margin-top: 8px; }
.spinner {
  display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(37,99,235,.25);
  border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.checkbox-row input { width: auto; }
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.doc-list-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }

/* Recadrage photo (modale) */
.crop-overlay {
  position: fixed; inset: 0; background: rgba(16, 24, 40, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.crop-modal {
  background: var(--surface); border-radius: var(--radius); padding: 22px;
  width: 100%; max-width: 380px; box-shadow: var(--shadow-lg);
}
.crop-stage { display: flex; justify-content: center; margin-bottom: 12px; }
.crop-canvas {
  width: 320px; height: 320px; max-width: 100%; border-radius: 50%;
  border: 2px solid var(--border); background: var(--surface-2);
  cursor: grab; touch-action: none;
}
.crop-canvas:active { cursor: grabbing; }
.crop-zoom { width: 100%; }

/* Section clé API ChatGPT */

.api-key-card { border-color: #cfe0fd; background: linear-gradient(180deg, #f7faff 0%, #ffffff 60%); }
.api-key-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.key-status { font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px; white-space: nowrap; }
.key-status.ok { color: var(--success); background: #f0fdf4; border: 1px solid #bbf7d0; }
.key-status.missing { color: #b45309; background: #fffbeb; border: 1px solid #fde68a; }

