/* PM180 — styles communs de l'espace candidat */
:root {
  --bg: #F6F5F1; --ink: #16142E; --purple: #2E1A6B; --purple-2: #452A8F; --purple-3: #4F2D93;
  --orange: #F0501E; --orange-dark: #C93C10; --muted: #4F566B; --muted-2: #7A8095;
  --border: #E4E2DC; --border-2: #D5D3CC; --line: #EDEBE5; --paper: #FBFAF7;
  --green: #2E8A60; --green-dark: #1E6B49; --green-bg: #EEF7F2;
  --red: #B5432F; --red-dark: #8A3524; --red-bg: #FBEDE9;
  --amber: #8A4A0F; --amber-bg: #FDF3E7; --amber-border: #F1D4B0;
  --lav: #ECE9F8; --lav-text: #D3D0EA; --lav-2: #A39FCB; --lav-border: #4A3888;
  --serif: 'Source Serif 4', Georgia, serif; --sans: 'Source Sans 3', system-ui, sans-serif; --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; font-size: 16px; }
a { color: var(--purple-3); text-decoration: none; }
a:hover { color: var(--orange-dark); }
button { font-family: var(--sans); }
input, select, textarea { font-family: var(--sans); font-size: 16px; color: var(--ink); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; }
.mono { font-family: var(--mono); }
.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.hidden { display: none !important; }
.logo { font-family: var(--serif); font-weight: 700; font-size: 22px; color: #fff; letter-spacing: -0.01em; }
.logo span { color: var(--orange); }
.logo:hover { color: #fff; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 6px; padding: 12px 20px; font: 700 16px var(--sans); cursor: pointer; text-align: center; line-height: 1.2; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--purple); color: #fff; }
.btn-primary:hover { background: var(--purple-2); color: #fff; }
.btn-orange { background: var(--orange); color: var(--purple); }
.btn-orange:hover { background: #F57A52; color: var(--purple); }
.btn-ghost { background: #fff; border: 1px solid var(--border-2); color: var(--ink); font-weight: 600; }
.btn-ghost:hover { border-color: var(--purple); color: var(--ink); }
.btn-green { background: var(--green); color: #fff; }
.btn-danger { background: #fff; border: 1px solid var(--red); color: var(--red); font-weight: 600; }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-block { width: 100%; }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.input, .field input, .field select, .field textarea { border: 1px solid var(--border-2); border-radius: 6px; padding: 12px 14px; font-weight: 400; background: #fff; width: 100%; }
.field textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--purple-3); outline-offset: -1px; }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.check { display: flex; gap: 10px; font-size: 14px; color: var(--muted); line-height: 1.45; font-weight: 400; align-items: flex-start; }
.check input { margin-top: 3px; accent-color: var(--purple); }
.alert { border-radius: 8px; padding: 12px 16px; font-size: 15px; line-height: 1.5; }
.alert-error { background: var(--red-bg); color: var(--red-dark); }
.alert-ok { background: var(--green-bg); color: var(--green-dark); }
.alert-info { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }

/* ---------- Mise en page avec barre latérale ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex-shrink: 0; background: var(--purple); color: var(--lav-text); padding: 28px 16px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .logo { padding: 0 12px 28px; }
.nav-link { padding: 10px 12px; border-radius: 6px; color: var(--lav-text); display: flex; align-items: center; gap: 8px; }
.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-link.active { background: var(--purple-2); color: #fff; font-weight: 600; }
.nav-link .lock { margin-left: auto; font-size: 12px; opacity: .7; }
.sidebar .spacer { flex: 1; }
.access-box { padding: 12px; border: 1px solid var(--lav-border); border-radius: 8px; font-size: 13px; color: var(--lav-text); line-height: 1.4; margin-top: 12px; display: block; }
.access-box strong { color: #fff; }
.user-box { display: flex; align-items: center; gap: 10px; padding: 16px 12px 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--orange); color: var(--purple); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.user-box .name { color: #fff; font-weight: 600; font-size: 14px; }
.user-box button { background: none; border: 0; color: var(--lav-2); font-size: 12px; padding: 0; cursor: pointer; }
.user-box button:hover { color: #fff; }
.main { flex: 1; min-width: 0; padding: 40px 48px 64px; max-width: 1240px; }
.page-title { font-size: 36px; margin: 0 0 8px; }
.page-sub { color: var(--muted); font-size: 17px; margin: 0 0 32px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 32px; flex-wrap: wrap; }

/* ---------- Cartes ---------- */
.card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 28px; }
.card-dark { background: var(--purple); color: #fff; border-radius: 12px; padding: 28px; }
.card-title { font-weight: 700; font-size: 18px; margin-bottom: 16px; }
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2); }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar > div { height: 100%; background: var(--purple); border-radius: 4px; }
.pill { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 13px; font-weight: 600; }
.pill-target { background: var(--lav); color: var(--purple-3); }
.pill-below { background: var(--red-bg); color: var(--red-dark); }
.pill-above { background: var(--green-bg); color: var(--green-dark); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-grey { background: var(--line); color: var(--muted); }
.chip { border: 1px solid var(--border-2); background: #fff; color: var(--ink); border-radius: 20px; padding: 8px 16px; font: 600 15px var(--sans); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.chip .n { font-family: var(--mono); font-size: 12px; opacity: .7; }
.chip.on { background: var(--purple); border-color: var(--purple); color: #fff; }
.chip-sm { padding: 6px 12px; font-size: 14px; }
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--border-2); margin-bottom: 32px; flex-wrap: wrap; }
.tab { background: none; border: 0; padding: 12px 0; font: 600 16px var(--sans); cursor: pointer; color: var(--muted-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--ink); border-bottom-color: var(--orange); }
.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; padding: 9px 16px; font: 600 14px var(--sans); cursor: pointer; background: #fff; color: var(--ink); }
.seg button.on { background: var(--purple); color: #fff; }
.table-row { display: grid; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: center; font-size: 15px; }
.table-head { font-size: 13px; color: var(--muted-2); padding: 8px 0; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.loader { display: flex; align-items: center; justify-content: center; min-height: 50vh; color: var(--muted-2); font-family: var(--mono); font-size: 14px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 15px; z-index: 1000; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: calc(100% - 32px); }
.toast.error { background: var(--red); }
.upsell { background: var(--amber-bg); border: 1px solid var(--amber-border); border-radius: 12px; padding: 24px 28px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.upsell .txt { flex: 1; min-width: 240px; }
.upsell .t { font-weight: 700; font-size: 18px; }
.upsell .d { color: var(--muted); font-size: 15px; margin-top: 4px; line-height: 1.5; }

/* ---------- Contenu riche (modules) ---------- */
.prose { font-size: 18px; line-height: 1.75; max-width: 720px; }
.prose p { margin: 0 0 18px; }
.prose h3 { font-size: 22px; margin: 28px 0 10px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 20px; }
.prose li { margin-bottom: 6px; }
.prose .callout { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 24px 28px; margin: 24px 0; font-size: 16px; line-height: 1.65; }
.prose .callout-k { font-family: var(--mono); font-size: 12px; color: var(--muted-2); text-transform: uppercase; margin-bottom: 10px; }
.prose .callout p:last-child { margin-bottom: 0; }
.prose .takeaway { background: var(--purple); color: #fff; border-radius: 12px; padding: 24px 28px; margin: 28px 0; font-family: var(--serif); font-size: 21px; line-height: 1.45; }
.prose .takeaway::before { content: 'À retenir'; display: block; font-family: var(--mono); font-size: 12px; color: var(--orange); text-transform: uppercase; margin-bottom: 8px; letter-spacing: .06em; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 12px 16px; gap: 4px; overflow-x: auto; }
  .sidebar .logo { padding: 0 12px 0 0; }
  .sidebar .spacer, .sidebar .access-box { display: none; }
  .nav-link { white-space: nowrap; padding: 8px 10px; font-size: 14px; }
  .user-box { padding: 0 0 0 8px; }
  .user-box .meta .city { display: none; }
  .main { padding: 24px 16px 48px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .page-title { font-size: 28px; }
}
