/* myCV — feuille de style de l'IHM.
   Les couleurs sont celles du site MyAlfred.ai : le PDF exporté et l'écran qui
   le prépare doivent parler la même langue. */

:root {
  --violet: #7C4FD0;
  --violet-2: #9968FF;
  --violet-3: #BD99FF;
  --violet-tint: #E5D6FF;
  --rose: #FF6CB2;
  --orange: #FFB367;
  --text: #2C2C2C;
  --grey: #565656;
  --grey-light: #8A8A8A;
  --line: #E4E4E8;
  --bg: #FFFFFF;
  --bg-soft: #F7F5FB;
  --ok: #1E9E5A;
  --warn: #B36A00;
  --bad: #C4362F;
  --radius: 12px;
  --radius-sm: 8px;
}

@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/lexend/Lexend-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/lexend/Lexend-Medium.ttf') format('truetype');
}
@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/lexend/Lexend-SemiBold.ttf') format('truetype');
}
@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/lexend/Lexend-Bold.ttf') format('truetype');
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 300;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--violet); }
h1, h2, h3 { font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.15rem; }

/* --- Barre supérieure --- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 300;
  color: var(--violet);
  text-decoration: none;
}
.brand strong { font-weight: 700; }
.brand-logo { height: 26px; width: auto; }
.topnav { display: flex; gap: 18px; }
.topnav a { color: var(--grey); text-decoration: none; }
.topnav a:hover { color: var(--violet); }
.whoami { margin-left: auto; font-size: .85rem; color: var(--grey-light); }

/* --- Structure --- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-actions { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.search { display: flex; gap: 6px; }

/* --- Contrôles --- */
input[type="text"], input[type="search"], input[type="email"], input[type="url"],
input[type="tel"], select, textarea {
  font: inherit;
  color: inherit;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--violet-3);
  outline-offset: 1px;
  border-color: var(--violet-3);
}
textarea { resize: vertical; min-height: 80px; width: 100%; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--violet);
  border-radius: 999px;
  background: var(--violet);
  color: #fff;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: #6A3FBE; border-color: #6A3FBE; }
.btn-ghost { background: transparent; color: var(--violet); }
.btn-ghost:hover { background: var(--violet-tint); }
.btn-danger { background: var(--bad); border-color: var(--bad); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
}

/* --- Messages --- */
.flash {
  max-width: 1100px;
  margin: 16px auto 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--ok);
  background: var(--bg-soft);
}
.flash.bad { border-left-color: var(--bad); }
.flash.warn { border-left-color: var(--warn); }
.empty { color: var(--grey); }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .75rem;
  background: var(--violet-tint);
  color: var(--violet);
}
.badge-mute { background: #EFEFF2; color: var(--grey-light); }

/* --- Cartes consultants --- */
.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card:hover { border-color: var(--violet-3); }
.card-link {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}
.card-photo {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  flex: none;
}
.card-photo-empty {
  display: grid;
  place-items: center;
  background: var(--violet-tint);
  color: var(--violet);
  font-weight: 600;
}
.card-body { display: flex; flex-direction: column; min-width: 0; }
.card-name { font-weight: 600; }
.card-headline {
  font-size: .85rem;
  color: var(--grey);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card .badge { position: absolute; top: 10px; right: 10px; }

/* --- Page de connexion --- */
.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: linear-gradient(140deg, #F7F5FB 0%, #EFE7FF 100%);
}
.login-card {
  width: min(400px, calc(100vw - 32px));
  padding: 36px 32px 28px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
}
.login-logo { height: 46px; width: auto; }
.login-card h1 { margin: 14px 0 2px; font-weight: 300; color: var(--violet); }
.login-card h1 strong { font-weight: 700; }
.login-sub { margin: 0 0 22px; color: var(--grey); font-size: .9rem; }
.login-note { margin: 14px 0 0; font-size: .8rem; color: var(--grey-light); }
.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}
.google-btn:hover { border-color: var(--violet-3); background: var(--bg-soft); }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .whoami { margin-left: 0; width: 100%; }
  .page-actions { margin-left: 0; width: 100%; }
}

/* --- Mise en page à deux colonnes, panneaux, formulaires empilés --- */
.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.panel h2 { margin: 0 0 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--grey); }
.stack input, .stack select, .stack textarea { width: 100%; }
.hint { font-size: .85rem; color: var(--grey-light); margin: 4px 0 10px; }
.muted { color: var(--grey-light); font-size: .85rem; }
.btn-sm { padding: 5px 12px; font-size: .85rem; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.version-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.version-row:first-of-type { border-top: 0; }
details.sub { margin-top: 12px; }
details.sub summary { cursor: pointer; color: var(--violet); font-weight: 500; }
details.sub form { margin-top: 12px; }
.card-meta { font-size: .75rem; color: var(--grey-light); }

/* --- Hub consultant --- */
.hub-head { display: flex; align-items: center; gap: 20px; margin-bottom: 28px; }
.hub-photo { width: 84px; height: 84px; border-radius: 14px; object-fit: cover; font-size: 1.6rem; flex: none; }
.hub-identity { flex: 1; }
.hub-headline { margin: 2px 0; color: var(--grey); }
.hub-photo-form { display: flex; gap: 8px; }

/* --- Éditeur --- */
[x-cloak] { display: none !important; }
.editor-main { max-width: none; padding: 0; }
.editor { display: flex; flex-direction: column; height: calc(100vh - 53px); }
.editor-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.editor-bar .back { color: var(--grey); text-decoration: none; }
.editor-title { font-weight: 600; display: inline-flex; gap: 8px; align-items: center; }
.save-status { font-size: .8rem; color: var(--grey-light); min-width: 120px; }
.save-status.saving, .save-status.dirty { color: var(--warn); }
.save-status.saved { color: var(--ok); }
.save-status.conflict, .save-status.error { color: var(--bad); font-weight: 500; }
.page-badge.warn { background: #FDE7E5; color: var(--bad); }
.format-select { display: flex; gap: 6px; margin-left: auto; }
.format-select select { padding: 5px 8px; font-size: .85rem; }
.conflict { display: flex; align-items: center; gap: 10px; margin: 10px 20px 0; }
.editor-panes { display: grid; grid-template-columns: minmax(420px, 46%) 1fr; flex: 1; min-height: 0; }
.editor-form { overflow-y: auto; padding: 16px 20px 60px; border-right: 1px solid var(--line); }
.editor-form[inert] { opacity: .7; }
.editor-preview { overflow-y: auto; background: #ECEAF1; padding: 24px; position: relative; }
.preview-page {
  display: block;
  width: 100%;
  max-width: 820px;
  margin: 0 auto 18px;
  box-shadow: 0 2px 12px rgba(44, 44, 44, .18);
  background: #fff;
}
.preview-overlay {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: center;
  padding: 6px;
  font-size: .8rem;
  color: var(--violet);
  background: rgba(236, 234, 241, .9);
}

.ed-section { border-bottom: 1px solid var(--line); padding: 6px 0 12px; }
.ed-section h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 1rem;
  cursor: pointer;
  user-select: none;
}
.ed-section h2::before, details.ed-exp > summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--violet-3);
  border-bottom: 2px solid var(--violet-3);
  transform: rotate(45deg);
  margin: 0 6px 3px 2px;
  flex: none;
}
.ed-section h2.collapsed::before, details.ed-exp:not([open]) > summary::before {
  transform: rotate(-45deg);
  margin-bottom: 0;
}
.ed-section h2 small { font-weight: 400; color: var(--grey-light); font-size: .8rem; }
.ed-body { display: flex; flex-direction: column; gap: 10px; }
.ed-body label { display: flex; flex-direction: column; gap: 3px; font-size: .82rem; color: var(--grey); }
.ed-body input, .ed-body select, .ed-body textarea { width: 100%; font-size: .9rem; }
.ed-body input.short { max-width: 150px; }
.ed-body input.muted { font-size: .82rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.grid-2 .span-2 { grid-column: span 2; }
.ed-item { display: flex; gap: 8px; align-items: flex-start; }
.ed-item-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.ed-item-fields.grid-2 { display: grid; }
.ed-item-tools { display: inline-flex; gap: 2px; flex: none; }
.ed-item-tools button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--grey);
  border-radius: 6px;
  width: 26px;
  height: 26px;
  font-size: .7rem;
  cursor: pointer;
  line-height: 1;
}
.ed-item-tools button:hover { border-color: var(--violet-3); color: var(--violet); }
.ed-actions { display: flex; gap: 8px; }
.ai-actions { display: flex; gap: 6px; }
details.ed-exp { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; }
details.ed-exp > summary { display: flex; gap: 10px; align-items: center; cursor: pointer; font-weight: 500; list-style: none; }
details.ed-exp > summary .ed-item-tools { margin-left: auto; }
details.ed-exp > .grid-2 { margin-top: 10px; }
details.ed-exp h3 { font-size: .9rem; margin: 14px 0 6px; display: flex; gap: 6px; align-items: center; }
details.ed-exp h3 small { font-weight: 400; color: var(--grey-light); }
details.ed-mission { border-left: 2px solid var(--violet-tint); padding: 6px 10px; margin: 6px 0; }
details.ed-mission > summary { display: flex; gap: 10px; align-items: center; cursor: pointer; font-size: .9rem; list-style: none; }
details.ed-mission > summary .ed-item-tools { margin-left: auto; }
details.ed-mission > .grid-2 { margin-top: 8px; }
.options fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; }
.options legend { font-size: .82rem; color: var(--grey); padding: 0 4px; }
label.check { flex-direction: row; align-items: center; gap: 8px; }
label.check input { width: auto; }

/* --- Modale --- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(44, 44, 44, .45);
  display: grid;
  place-items: center;
  z-index: 10;
}
.modal-card {
  width: min(640px, calc(100vw - 32px));
  background: #fff;
  border-radius: 16px;
  padding: 22px 24px;
}
.modal-card h2 { margin: 0 0 12px; }
.modal-card textarea { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

@media (max-width: 900px) {
  .two-cols { grid-template-columns: 1fr; }
  .editor { height: auto; }
  .editor-panes { grid-template-columns: 1fr; }
  .editor-form { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* --- Catalogue d'outils --- */
.tool-list { list-style: none; margin: 0; padding: 0; }
.tool-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.tool-row strong { flex: 1; }
.tool-logo { width: 44px; height: 44px; display: grid; place-items: center; }
.tool-logo img { max-width: 44px; max-height: 36px; }
.tool-logo .card-photo-empty { width: 36px; height: 36px; border-radius: 50%; font-size: .9rem; }

/* --- Tableaux --- */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 500; color: var(--grey); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table .current-row { background: var(--bg-soft); }
.back { color: var(--grey); text-decoration: none; font-size: .9rem; }

/* --- Tâches --- */
.job { max-width: 720px; }
.job-status { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--violet); font-weight: 500; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid var(--violet-tint); border-top-color: var(--violet);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.warnings { margin: 6px 0 14px; padding-left: 20px; color: var(--warn); font-size: .9rem; }

/* --- Propositions IA --- */
.props { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.prop { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.prop-head { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.prop-head input { width: 18px; height: 18px; accent-color: var(--violet); }
.prop-title { font-weight: 600; flex: 1; }
.prop-body { margin: 8px 0 0 28px; font-size: .92rem; }
.prop-reason { color: var(--grey); margin: 6px 0 0; }
.prop-source { margin: 6px 0 0; padding-left: 10px; border-left: 3px solid var(--violet-tint); color: var(--grey-light); font-size: .85rem; font-style: italic; }
.conf-high { background: #E1F5EA; color: var(--ok); }
.conf-medium { background: #FFF1DD; color: var(--warn); }
.conf-low { background: #FDE7E5; color: var(--bad); }
ul.plain { margin: 4px 0; padding-left: 18px; }

/* --- Synchronisation --- */
.sync-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.sync-row:first-of-type { border-top: 0; }
.sync-preview { font-size: .85rem; color: var(--grey); margin-top: 4px; }
.sync-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.panel + .panel { margin-top: 20px; }
