@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #f8f6fa;
  --surface: #ffffff;
  --surface-2: #f2edf7;
  --border: #e7e1ec;
  --text: #1f1b24;
  --muted: #6b6473;
  --muted-2: #9a92a3;
  --accent: #5b3a7e;
  --accent-soft: #f0e8f7;
  --sidebar: #241432;
  --sidebar-2: #332044;
  --sidebar-text: #d6cbdf;
  --green: #059669;
  --amber: #d97706;
  --red: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 27, 36, .05), 0 8px 24px rgba(31, 27, 36, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
h1, h2, .brand-name, .kpi .value, .page-head h1, .dossier-head h1 {
  font-family: "Manrope", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 248px; flex: 0 0 248px; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #38bdf8, #2563eb);
  display: grid; place-items: center; color: white; font-weight: 800; font-size: 15px;
}
.brand-name { color: white; font-weight: 700; font-size: 14px; line-height: 1.2; }
.brand-sub { color: var(--muted-2); font-size: 11px; }
.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  color: var(--sidebar-text); font-weight: 500; font-size: 13px;
}
.nav a:hover { background: var(--sidebar-2); text-decoration: none; color: white; }
.nav a.active { background: #6d4692; color: white; }
.install-btn { display: flex; align-items: center; gap: 9px; width: calc(100% - 16px); margin: 10px 8px 4px; padding: 9px 11px; border: 1px solid rgba(255,255,255,.14); border-radius: 9px; background: rgba(255,255,255,.06); color: var(--sidebar-text); font: inherit; font-size: 12px; cursor: pointer; text-align: left; }
.install-btn:hover { background: rgba(255,255,255,.10); color: #fff; }
.nav .ico { width: 18px; text-align: center; opacity: .9; }
.sidebar-foot { margin-top: auto; padding: 12px 8px 4px; border-top: 1px solid #1e293b; font-size: 11px; color: var(--muted-2); }

/* Main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; background: rgba(255,255,255,.9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px;
  padding: 0 26px; position: sticky; top: 0; z-index: 20;
}
.search { flex: 1; max-width: 560px; display: flex; }
.search input {
  width: 100%; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px;
  padding: 9px 12px; font-size: 13px; outline: none;
}
.search input:focus { border-color: #d8c7e8; background: white; box-shadow: 0 0 0 3px rgba(91,58,126,.10); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.userchip { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: #6d4692;
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.userchip .name { font-weight: 600; font-size: 12.5px; }
.userchip .role { color: var(--muted); font-size: 11px; }

.content { padding: 26px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.02em; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.head-actions { display: flex; gap: 8px; align-items: center; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px;
}
.kpi .label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.kpi .value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin-top: 4px; }
.kpi .hint { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.grid-2-50 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; }
.section-title h2 { font-size: 14px; margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.strong { font-weight: 650; }

/* Status chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--border);
  background: var(--surface); border-radius: 999px; font-size: 12px; color: var(--text);
}
.chip .count { font-weight: 800; }
.chip:hover { text-decoration: none; border-color: #cbd5e1; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; min-width: 900px; }
.table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: 11px 14px; background: #f8fafc; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fbfdff; }
.table .muted { white-space: nowrap; }

/* Badges */
.badge {
  display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  border: 1px solid transparent; white-space: nowrap;
}
.status-prepare { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.status-valide { background: #ede3f6; color: #6d4692; border-color: #d8c7e8; }
.status-importe { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
.status-envoye { background: #e0e7ff; color: #4338ca; border-color: #c7d2fe; }
.status-reponse { background: #ccfbf1; color: #0f766e; border-color: #99f6e4; }
.status-cv_demande { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.status-rdv { background: #d1fae5; color: #047857; border-color: #a7f3d0; }
.status-refuse { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.status-sans_reponse { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
.status-reserve { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }

.score { font-weight: 800; font-size: 12px; padding: 3px 8px; border-radius: 8px; }
.score-good { background: #d1fae5; color: #047857; }
.score-mid { background: #fef3c7; color: #b45309; }
.score-low { background: #fee2e2; color: #b91c1c; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 12px; border-radius: 9px; border: 1px solid var(--border); background: white;
  color: var(--text); font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: #4a2c68; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-sm { padding: 5px 9px; font-size: 11.5px; }

/* Forms */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.field input, .field select, .field textarea {
  border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; font-size: 12.5px; background: white;
  font-family: inherit; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: #d8c7e8; box-shadow: 0 0 0 3px rgba(91,58,126,.10); }
.field textarea { min-height: 74px; resize: vertical; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; }

/* Dossier detail */
.breadcrumb { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.breadcrumb a { color: var(--muted); }
.dossier-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.dossier-head h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.02em; }
.dossier-head .sub { color: var(--muted); font-size: 13px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px; background: var(--surface-2); color: #475569; font-size: 11.5px; }
.card + .card { margin-top: 14px; }
.card h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: -.01em; }
.prose { color: #334155; font-size: 13px; }
.prose p { margin: 0 0 8px; }
.prose ul { margin: 6px 0 0; padding-left: 18px; }
.prose li { margin-bottom: 4px; }
.message {
  white-space: pre-wrap; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; font-size: 12.5px; color: #1e293b; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.55; overflow-x: auto;
}
.message-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 18px; border-left: 2px solid #e2e8f0; margin-left: 5px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline .dot { position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: #93c5fd; border: 2px solid white; }
.timeline .when { color: var(--muted); font-size: 11px; }
.timeline .what { font-size: 12.5px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h3 { margin: 0 0 6px; color: var(--text); }
.notice { padding: 11px 13px; border-radius: 10px; font-size: 12.5px; margin-bottom: 14px; }
.notice-ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.notice-warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.notice-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.pill.ok { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.pill.warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.pill.risk { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.matrix td.num, .matrix th.num { text-align: right; font-variant-numeric: tabular-nums; }
.matrix .total-row td { border-top: 2px solid var(--border); background: #faf7fd; }
.exp-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.exp-item:last-child { border-bottom: 0; }

/* Matching */
.match-card .section-title { align-items: flex-start; }
.match-score { text-align: right; line-height: 1.1; }
.match-score .big { font-size: 24px; font-weight: 800; color: var(--accent); letter-spacing: -.03em; }
.match-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 4px 0 12px; color: var(--muted); font-size: 11.5px; }
.match-legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.match-legend .dot.covered { background: #059669; }
.match-legend .dot.partial { background: #d97706; }
.match-legend .dot.gap { background: #dc2626; }
.match-head, .match-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr) 96px; gap: 16px; }
.match-head {
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  font-weight: 800; padding: 8px 0; border-bottom: 1px solid var(--border);
}
.match-row { padding: 13px 0; border-bottom: 1px solid #f1f5f9; align-items: start; }
.match-row:last-child { border-bottom: none; }
.match-req strong { display: block; font-size: 12.5px; margin-bottom: 3px; }
.match-ev { font-size: 12.5px; color: #334155; }
.match-note { margin-top: 5px; font-size: 11.5px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 7px; padding: 6px 8px; }
.match-verdict { text-align: left; }
.match-mini { display: flex; align-items: center; gap: 7px; margin-top: 6px; }
.match-mini .mini-bar { width: 64px; height: 6px; border-radius: 999px; background: #e2e8f0; overflow: hidden; display: inline-block; }
.match-mini .mini-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #059669, #34d399); }

/* Comparaison annonce / CV */
.compare-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.compare-pane { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.compare-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); background: #faf8fc; }
.compare-scroll { max-height: 480px; overflow: auto; padding: 14px; white-space: pre-line; font-size: 12px; line-height: 1.55; color: #334155; }
.cv-frame { width: 100%; height: 480px; border: 0; display: block; background: #f8f6fa; }
.compare-foot { padding: 8px 12px; border-top: 1px solid var(--border); }
.compare-empty { padding: 40px 16px; text-align: center; color: var(--muted); font-size: 12px; }
.match-cat { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 8px; }
.match-cat-head { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 0 2px; }
.match-cat-head h3 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); margin: 0; }
@media (max-width: 900px) { .compare-grid { grid-template-columns: 1fr; } .cv-frame { height: 420px; } }

/* Vivier */
.status-select { padding: 5px 7px; font-size: 11px; border: 1px solid var(--border); border-radius: 7px; background: #fff; }

/* Activité */
.activity-card .section-title { margin-bottom: 6px; }
.activity-day { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); font-weight: 800; margin: 12px 0 2px; }
.activity-day:first-of-type { margin-top: 2px; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 6px; border-bottom: 1px solid #f1edf5; border-radius: 8px; }
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: #faf8fc; }
.activity-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 14px; flex: none; }
.activity-icon.status { background: #ecfdf5; color: #059669; }
.activity-icon.cv { background: #eff6ff; color: #2563eb; }
.activity-icon.email { background: #fff7ed; color: #c2410c; }
.activity-icon.note { background: #fefce8; color: #a16207; }
.activity-icon.import { background: #f5f3ff; color: #6d28d9; }
.activity-icon.matching { background: #f0fdfa; color: #0f766e; }
.activity-body { flex: 1; min-width: 0; }
.activity-line { font-size: 12.5px; color: #334155; }
.activity-line strong { color: var(--text); }
.activity-target { font-size: 12.5px; margin-top: 1px; }
.activity-detail { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.activity-time { font-size: 10.5px; color: var(--muted-2); white-space: nowrap; padding-top: 2px; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (max-width: 700px) { .activity-time { display: none; } }

/* Audit */
.audit-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.audit-kpis .kpi .value { font-size: 25px; }
.priority-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.priority-col { background: #faf8fc; border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.priority-col.p1 { border-top: 3px solid #059669; }
.priority-col.p2 { border-top: 3px solid #d97706; }
.priority-col.p3 { border-top: 3px solid #94a3b8; }
.priority-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.priority-tag { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 11px; flex: none; }
.cluster-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.cluster-card.ghost { border-style: dashed; background: transparent; }
.cluster-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.cluster-stats { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11.5px; color: var(--muted); margin: 6px 0; }
.cluster-stats b { color: var(--text); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.warn-list, .plan-list { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.6; color: #334155; }
.warn-list li, .plan-list li { margin-bottom: 7px; }
@media (max-width: 1100px) { .audit-kpis { grid-template-columns: repeat(2, 1fr); } .priority-board { grid-template-columns: 1fr; } .two-col { grid-template-columns: 1fr; } }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 10% 0%, #ede3f6 0%, transparent 55%), var(--bg); }
.login-card { width: 100%; max-width: 410px; background: white; border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 20px 60px rgba(15,23,42,.12); padding: 30px; }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 20px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.02em; }
.login-card p.sub { color: var(--muted); font-size: 12.5px; margin: 0 0 18px; }
.login-card .field { margin-bottom: 12px; }
.login-card .btn { width: 100%; margin-top: 6px; }
.login-foot { margin-top: 16px; color: var(--muted); font-size: 11px; text-align: center; }

@media (max-width: 1050px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-2-50 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { display: none; }
  .content { padding: 18px; }
  .topbar { padding: 0 16px; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
