/* Prospector événementiel : une seule interface, bureau (≥ 900 px : menu à gauche) et téléphone
   (menu en bas). Palette des maquettes validées : gris-bleu, accent doré, accent bleu. */
@font-face { font-family: Unbounded; font-weight: 500; font-display: swap; src: url(/fonts/unbounded-500.woff2) format('woff2'); }
@font-face { font-family: Unbounded; font-weight: 600; font-display: swap; src: url(/fonts/unbounded-600.woff2) format('woff2'); }
@font-face { font-family: Figtree; font-weight: 400; font-display: swap; src: url(/fonts/figtree-400.woff2) format('woff2'); }
@font-face { font-family: Figtree; font-weight: 500; font-display: swap; src: url(/fonts/figtree-500.woff2) format('woff2'); }
@font-face { font-family: Figtree; font-weight: 600; font-display: swap; src: url(/fonts/figtree-600.woff2) format('woff2'); }

:root {
  --bg: #1E2532;
  --card: #283247;
  --line: #3A465F;
  --text: #EDF0F6;
  --muted: #B4BDCE;
  --nav: #C9D0DD;
  --gold: #E8C77A;
  --blue: #8FB0F2;
  --green-bg: #2B3D33; --green: #A8D8B9;
  --blue-bg: #24304A;
  --gold-bg: #3A3424;
  --red-bg: #3D2B2B; --red: #E8A8A8;
  --tour-bg: #2E2A22; --tour-line: #5C4E2E; --tour-text: #EDE3CC;
  --title: Unbounded, system-ui, sans-serif;
  --body: Figtree, system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--body); }
a { color: var(--blue); }
a:hover { color: #B9CEF7; }
h1 { margin: 4px 0 0; font: 600 26px/1.2 var(--title); }
h2 { margin: 0; font-size: 17px; font-weight: 600; }
h3 { margin: 0; font-size: 15px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* --- Mise en page ---------------------------------------------------------------------- */
.shell { min-height: 100vh; display: flex; }
.nav { flex: 0 0 232px; padding: 28px 16px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; font: 600 16px var(--title); }
.brand svg { flex: none; }
.nav a { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 10px; color: var(--nav); text-decoration: none; font-size: 15px; }
.nav a:hover { background: #242D3F; color: var(--text); }
.nav a.on { background: var(--card); color: var(--text); font-weight: 600; }
.nav .badge { margin-left: auto; }
.nav .spacer { flex: 1; }
main { flex: 1 1 560px; min-width: 0; padding: 32px 32px 48px; display: flex; flex-direction: column; gap: 22px; max-width: 1180px; }
.lone { max-width: 560px; margin: 12vh auto; padding: 0 16px; display: flex; flex-direction: column; gap: 16px; }

.head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.head .tools { display: flex; gap: 10px; flex-wrap: wrap; }
.crumb { font-size: 14px; color: var(--muted); }
.crumb a { color: var(--muted); }

/* --- Éléments -------------------------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card.hl { border: 2px solid var(--gold); }
.row { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.row > * { flex: 1 1 320px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi .label { font-size: 14px; color: var(--muted); }
.kpi .value { font: 600 26px var(--title); margin-top: 2px; }
.kpi .value small { font: 400 15px var(--body); color: var(--muted); }
.item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.item .main { flex: 1 1 200px; min-width: 0; }
.item .name { font-weight: 600; overflow-wrap: anywhere; }
.item .detail { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.item.click { cursor: pointer; }
.item.click:hover .name { color: var(--gold); }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }

.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 16px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--text); font: 500 15px var(--body); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--bg); font-weight: 600; }
.btn.primary:hover { background: #F0D592; }
.btn.blue { background: var(--blue); border-color: var(--blue); color: var(--bg); font-weight: 600; }
.btn.danger { color: var(--red); border-color: #6B4040; }
.btn.small { min-height: 44px; padding: 0 12px; font-size: 14px; }
.btn.round { width: 44px; padding: 0; border: 2px solid var(--gold); border-radius: 50%; color: var(--gold); font-weight: 600; font-size: 18px; }
.btn:disabled { opacity: .5; cursor: default; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.tag { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.blue { background: var(--blue-bg); color: var(--blue); }
.tag.gold { background: var(--gold-bg); color: var(--gold); }
.tag.red { background: var(--red-bg); color: var(--red); }
.badge { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--gold); color: var(--bg); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: 500 14px var(--body); cursor: pointer; }
.chip.on { border-color: var(--gold); background: var(--card); color: var(--text); }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: 400 15px var(--body);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
textarea.tall { min-height: 260px; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: none; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--gold); }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }

.note { background: var(--tour-bg); border: 1px solid var(--tour-line); border-radius: 14px; padding: 16px 18px; color: var(--tour-text); }
.note > * + * { margin-top: 8px; }
.note p { margin: 0; }
.note strong { color: var(--gold); }
.info { border-left: 3px solid var(--blue); padding: 4px 0 4px 12px; color: var(--muted); font-size: 14px; }
.warn { border-left: 3px solid var(--gold); padding: 4px 0 4px 12px; color: var(--tour-text); font-size: 14px; }
.error { border-left: 3px solid var(--red); padding: 4px 0 4px 12px; color: var(--red); font-size: 14px; }
.mail { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 14px; overflow-wrap: anywhere; }
.var { background: var(--gold-bg); color: var(--gold); border-radius: 4px; padding: 0 3px; }

/* Étapes du démarrage */
.steps { display: flex; gap: 8px; flex-wrap: wrap; }
.step { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px 0 6px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 14px; background: transparent; cursor: pointer; text-decoration: none; }
.step .n { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.step.done { color: var(--text); }
.step.done .n { background: var(--green-bg); color: var(--green); border-color: var(--green-bg); }
.step.now { border-color: var(--gold); background: var(--card); color: var(--text); }
.step.now .n { border-color: var(--gold); color: var(--gold); }
.bullets { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.howto { display: flex; flex-direction: column; gap: 10px; }
.howto div { display: flex; gap: 10px; }
.howto b { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: var(--bg); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 28px 18px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.drop.over { border-color: var(--gold); background: #242D3F; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; }
.scroll { overflow-x: auto; }

/* Historique d'un contact */
.timeline { display: flex; flex-direction: column; }
.timeline .ev { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.timeline .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); margin-top: 7px; }

/* Agenda */
.week { display: flex; flex-direction: column; gap: 8px; }
.day { display: flex; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.day .d { flex: 0 0 120px; font-weight: 600; }
.day .evs { flex: 1 1 240px; display: flex; flex-direction: column; gap: 6px; }
.event { padding: 6px 10px; border-radius: 8px; background: var(--bg); font-size: 14px; }
.event.ours { background: var(--gold-bg); color: var(--gold); }

/* Assistant */
.chat { display: flex; flex-direction: column; gap: 12px; min-height: 300px; }
.msg { max-width: 82%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--blue-bg); }
.msg.bot { align-self: flex-start; background: var(--bg); }
.msg .meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.composer { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { min-height: 52px; height: 52px; }

/* Fenêtre et messages flottants */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--card); border: 1px solid var(--gold); color: var(--text); border-radius: 12px; padding: 12px 18px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: 0 8px 30px rgba(0, 0, 0, .35); }
.toast.bad { border-color: var(--red); }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
dialog { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 20px; max-width: min(640px, calc(100vw - 32px)); width: 100%; }
dialog::backdrop { background: rgba(10, 14, 22, .6); }
dialog form { display: flex; flex-direction: column; gap: 12px; }

/* --- Téléphone : menu en bas, défilant ------------------------------------------------- */
@media (max-width: 899px) {
  .shell { flex-direction: column; }
  .nav { position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); background: var(--bg); overflow-x: auto; overflow-y: hidden; z-index: 20; gap: 4px; }
  .nav .brand, .nav .spacer { display: none; }
  .nav a { flex: none; padding: 0 12px; font-size: 14px; white-space: nowrap; }
  main { padding: 20px 16px 96px; gap: 18px; }
  h1 { font-size: 22px; }
  .day .d { flex-basis: 100%; }
  .msg { max-width: 92%; }
  .toast { bottom: 84px; }
}
