/* CRM du Club : style de la direction A (clair, sobre, bleu). */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/space-grotesk-latin-wght-normal.woff2') format('woff2');
}

:root {
  --ground: #F5F7F9;
  --surface: #FFFFFF;
  --ink: #16202A;
  --ink-2: #33424F;
  --muted: #5B6875;
  --line: #DDE3E9;
  --line-soft: #EDF0F3;
  --field: #C5CED7;
  --accent: #1F4FD8;
  --accent-soft: #EAF0FD;
  --danger: #B42318;
  --ok: #17663A;
  --display: 'Space Grotesk', Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ground);
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}
a { color: var(--ink); }
a:hover { color: var(--accent); }
h1, h2, h3, p { margin: 0; }
h1 { font-family: var(--display); font-size: 28px; font-weight: 600; line-height: 1.15; }
h2 { font-family: var(--display); font-size: 20px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.soft { color: var(--ink-2); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.strong { font-weight: 600; }
.pad-top { margin-top: 10px; }
.row.tight-row { gap: 6px; }

/* Structure */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.nav {
  flex: 1 1 220px; padding: 24px 16px; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 24px;
}
.brand { padding: 0 12px; font-family: var(--display); font-weight: 600; font-size: 18px; }
.nav-links { display: flex; flex-direction: column; gap: 4px; }
.nav-links a {
  display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none;
}
.nav-links a:hover { background: var(--ground); }
.nav-links a[aria-current='page'] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.nav-links .badge {
  flex: none; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #8A3A0B; color: #FFFFFF;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
}
.plain-list { margin: 0; padding-left: 18px; }
.btn.unread-tab { border-color: #F5C9A6; background: #FFE8D6; color: #8A3A0B; font-weight: 600; }
.btn.unread-tab[aria-pressed='true'] { border-color: #8A3A0B; background: #8A3A0B; color: #FFFFFF; }
dialog .mail-body { max-height: 52vh; }
.mail-body { max-height: 260px; overflow-y: auto; padding: 12px 14px; border-radius: 8px; background: var(--ground); white-space: pre-wrap; overflow-wrap: anywhere; }
.nav-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding: 0 12px; font-size: 13px; }
.nav-foot a, .nav-foot button { min-height: 36px; display: flex; align-items: center; color: var(--muted); }
.linklike { border: 0; padding: 0; background: none; font: inherit; color: var(--ink); text-decoration: underline; cursor: pointer; }
.linklike:hover { color: var(--accent); }
.main { flex: 999 1 560px; min-width: 0; padding: 28px 32px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 720px) {
  .main { padding: 20px 16px; }
  .nav { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* Boutons et champs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 16px;
  border: 1px solid var(--field); border-radius: 8px; background: var(--surface); color: var(--ink);
  font: inherit; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn.strong { font-weight: 600; }
.btn.primary { border-color: var(--accent); background: var(--accent); color: #FFFFFF; font-weight: 600; }
.btn.primary:hover { background: #1A43B8; border-color: #1A43B8; color: #FFFFFF; }
.btn.pressed, .btn[aria-pressed='true'] { border-color: var(--ink); background: var(--ink); color: #FFFFFF; font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn:disabled { opacity: 0.55; cursor: default; }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit;
}
textarea.input { padding: 10px 12px; resize: vertical; line-height: 1.45; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.field .input { font-weight: 400; }
.field .hint { font-weight: 400; font-size: 13px; color: var(--muted); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.inline-field { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.inline-field .input { width: auto; }
.input.narrow { width: 72px; text-align: center; font-weight: 600; }

.card { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.notice { padding: 12px 14px; border-radius: 8px; background: var(--ground); color: var(--ink-2); }
.notice.warn { background: #FFF4EA; border: 1px solid #F5C9A6; color: #6B2D08; }
.notice.good { background: #E8F5EC; border: 1px solid #B7DDC3; color: #124D2C; }
.notice.bad { background: #FDECEA; border: 1px solid #F3B8B1; color: #7A1810; }

/* Pastilles */
.chip {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 13px;
  border: 1px solid #CCD6DF; background: #E6ECF1; color: #33424F; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip.nouveau { background: #FFFFFF; color: #16202A; border-color: #16202A; }
.chip.en_sequence { background: #E6ECF1; color: #33424F; border-color: #CCD6DF; }
.chip.engage { background: #DCE6FB; color: #1B3A8F; border-color: #B9CCF5; }
.chip.chaud { background: #FFE8D6; color: #8A3A0B; border-color: #F5C9A6; }
.chip.sans_reponse { background: #EEF0F2; color: #56626E; border-color: #D5DADF; }
.chip.froid { background: #E3E7EB; color: #4A5561; border-color: #C9D0D7; }
.cls {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px;
  font-size: 12px; font-weight: 600; background: #E6EAEE; color: #4A5561;
}
.cls.A { background: var(--accent); color: #FFFFFF; }
.cls.B { background: #DCE6FB; color: #1B3A8F; }
.cls.big { width: 32px; height: 32px; border-radius: 8px; font-size: 16px; }
.score-num { font-family: var(--display); font-size: 18px; font-weight: 600; min-width: 24px; }
.score-big { font-family: var(--display); font-size: 52px; font-weight: 600; line-height: 1; }

/* Tableaux */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.table { min-width: 940px; }
.tr { display: grid; column-gap: 12px; align-items: center; min-height: 56px; padding: 0 16px; border-bottom: 1px solid var(--line-soft); }
.tr.head { min-height: 40px; border-bottom-color: var(--line); color: var(--muted); font-size: 12px; font-weight: 600; }
.tr:last-child { border-bottom: 0; }
.cols-prospects { grid-template-columns: 64px minmax(170px, 1.3fr) 124px minmax(190px, 1.6fr) 150px minmax(130px, 1fr); }
.cols-import { grid-template-columns: minmax(150px, 1.2fr) minmax(200px, 1.6fr) 80px 150px 150px; }
.cell-name a { font-weight: 600; text-decoration: none; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 40px 24px; text-align: center; color: var(--ink-2); }

/* Fiche */
.columns { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; }
.col-wide { flex: 3 1 480px; min-width: 0; }
.col-side { flex: 2 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.timeline-item { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; }
.timeline-date { padding-top: 12px; color: var(--muted); font-size: 13px; }
.timeline-box { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; }
.timeline-box.email_in { border-color: #F5C9A6; background: #FFF4EA; }
.timeline-box .body { margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline-box .actor { margin-top: 6px; color: var(--muted); font-size: 12px; }
.composer { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 8px; background: var(--ground); }
.detail-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.detail-row .points { flex: none; font-weight: 600; }
.detail-row .points.neg { color: var(--danger); }
.panel { padding: 10px 12px; border-radius: 8px; background: var(--ground); }

/* Barème */
.bareme { columns: 2 420px; column-gap: 24px; }
.b-row {
  break-inside: avoid; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 40px; padding: 4px 12px; border: 1px solid var(--line); border-top-width: 0; background: var(--surface);
}
.b-row.question { margin-top: 16px; border-top-width: 1px; background: #E9EEF3; font-weight: 600; break-after: avoid; }
.b-row.question:first-child { margin-top: 0; }
.b-row label { flex: none; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 400; }
.b-row input {
  width: 56px; height: 32px; border: 1px solid var(--field); border-radius: 6px; background: var(--surface);
  color: var(--ink); font: inherit; font-weight: 600; text-align: center;
}

/* Import */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 20px; text-align: center;
  border: 2px dashed #9FAEBD; border-radius: 10px; background: var(--surface); cursor: pointer;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.figure { padding: 12px 14px; border-radius: 8px; background: var(--ground); }
.figure.main-figure { background: var(--accent-soft); }
.figure b { display: block; font-family: var(--display); font-size: 22px; font-weight: 600; }

/* Listes des réglages */
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.list-row .btn { flex: none; }
.status-row { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 12px; align-items: center; min-height: 52px; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.sep { padding-top: 14px; border-top: 1px solid var(--line-soft); }
.key-box { padding: 12px 14px; border-radius: 8px; background: var(--ink); color: #FFFFFF; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; }

/* Connexion */
.center { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 32px 20px; }
.login { width: 100%; max-width: 420px; }

/* Fenêtre de rédaction et messages */
dialog { width: min(640px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
dialog::backdrop { background: rgba(22, 32, 42, 0.45); }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { padding: 12px 16px; border-radius: 8px; background: var(--ink); color: #FFFFFF; box-shadow: 0 6px 24px rgba(22, 32, 42, 0.25); }
.toast.bad { background: #7A1810; }

/* Documentation */
.doc { max-width: 920px; margin: 0 auto; padding: 32px 20px 64px; display: flex; flex-direction: column; gap: 20px; }
.doc pre { margin: 0; padding: 12px 14px; border-radius: 8px; background: var(--ink); color: #F5F7F9; font-size: 13px; overflow-x: auto; }
.doc code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.doc p code, .doc li code, .doc td code { padding: 1px 5px; border-radius: 4px; background: #E9EEF3; }
.doc .prose { white-space: pre-line; }
.method { display: inline-flex; align-items: center; justify-content: center; min-width: 64px; height: 26px; padding: 0 8px; border-radius: 6px; background: #E6EAEE; color: #33424F; font-size: 12px; font-weight: 600; }
.method.get { background: #DCE6FB; color: #1B3A8F; }
.method.post { background: #E8F5EC; color: #124D2C; }
.method.patch { background: #FFE8D6; color: #8A3A0B; }
.method.delete { background: #FDECEA; color: #7A1810; }
.endpoint-path { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.params { width: 100%; border-collapse: collapse; }
.params td, .params th { padding: 6px 8px 6px 0; border-top: 1px solid var(--line-soft); text-align: left; vertical-align: top; font-size: 13px; }
.params th { color: var(--muted); font-weight: 600; border-top: 0; }
