/* =====================================================================
   Entre Rhône & Alpilles — Espace apporteur
   Design corporate : pierre, charbon, bronze. Typographie Jost (sans-serif).
   ===================================================================== */

:root {
  --bg: #f1efe9;
  --card: #ffffff;
  --ink: #20201d;
  --ink-soft: #6f6a5f;
  --line: #ddd7c9;
  --deep: #1d1c19;
  --accent: #8c6a3f;
  --accent-dark: #6c5030;
  --olive: #5f684a;
  --olive-dark: #4c543a;
  --ok: #5a7350;
  --ok-bg: #edf0e4;
  --warn: #a87c2a;
  --warn-bg: #f7eed6;
  --danger: #a23d33;
  --danger-bg: #f6e4e1;
  --sans: "Jost", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(20, 18, 14, .04), 0 4px 12px rgba(20, 18, 14, .04);
  --tabbar-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-weight: 400;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 15px;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}

/* ---- Barre supérieure ---- */
.topbar {
  background: var(--deep);
  color: #f1ece0;
  position: sticky; top: 0; z-index: 50;
  border-bottom: 2px solid var(--accent);
}
.topbar-inner {
  max-width: 880px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
}
.brand-name {
  font-family: var(--sans);
  font-size: 16px; font-weight: 600; line-height: 1.1;
  letter-spacing: .06em; text-transform: uppercase;
}
.brand-name em { color: var(--accent); font-style: normal; }
.brand-name small {
  display: block;
  font-family: var(--sans);
  font-weight: 400; font-size: 9px;
  letter-spacing: .24em; text-transform: uppercase;
  color: #a89e8b; margin-top: 3px;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.offline-badge {
  font-size: 9.5px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--deep); background: #e8c987;
  padding: 4px 10px; border-radius: 2px;
}
.icon-btn {
  background: none;
  border: 1px solid rgba(241, 236, 224, .25);
  color: #f1ece0;
  cursor: pointer; padding: 7px; border-radius: 3px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---- Mise en page ---- */
.view { max-width: 880px; margin: 0 auto; padding: 22px 16px 16px; }
h2.section-title {
  font-family: var(--sans);
  font-size: 22px; font-weight: 600;
  margin: 4px 0 2px; letter-spacing: .01em;
}
.section-sub { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 16px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; margin-bottom: 12px;
}
.card h3 {
  font-family: var(--sans);
  margin: 0 0 8px; font-size: 16px; font-weight: 600;
}
.muted { color: var(--ink-soft); font-size: 13px; }

/* ---- Boutons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 3px; cursor: pointer;
  font-family: var(--sans); font-size: 11.5px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 11px 18px; min-height: 44px; box-sizing: border-box;
  background: var(--ink); color: #f5f1e8;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary {
  background: transparent; color: var(--ink); border-color: #c9c0ab;
}
.btn.secondary:hover { border-color: var(--accent); color: var(--accent-dark); background: transparent; }
.btn.olive { background: var(--olive); }
.btn.olive:hover { background: var(--olive-dark); }
.btn.danger { background: transparent; color: var(--danger); border-color: #d8aaa4; }
.btn.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.small { font-size: 10.5px; padding: 8px 12px; min-height: 38px; }
.btn.block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
a.btn { text-decoration: none; }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--ink); color: #f5f1e8; border: none;
  font-size: 26px; font-weight: 300; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 18px rgba(35, 33, 28, .35);
  z-index: 40;
}
.fab:hover { background: var(--accent-dark); }

/* ---- Barre d'onglets ---- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-family: var(--sans); font-size: 9px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-soft);
  border-top: 2px solid transparent; margin-top: -1px;
}
.tab svg { width: 20px; height: 20px; }
.tab.active { color: var(--accent-dark); border-top-color: var(--accent); }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  font-size: 9.5px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  border-radius: 2px; padding: 4px 8px; white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: #82601f; }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.neutral { background: #eee8da; color: var(--ink-soft); }
.badge.olive { background: #e9ecdd; color: var(--olive-dark); }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }

/* ---- Parcours d'accueil ---- */
.onb-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; }
.onb-dot {
  width: 8px; height: 8px; border-radius: 50%; border: none; padding: 0;
  background: var(--line); cursor: pointer;
}
.onb-dot.active { background: var(--accent); }
.onb-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.onb-tab {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--sans); font-size: 11px; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  border-radius: 999px; padding: 7px 13px; cursor: pointer;
}
.onb-tab svg { width: 15px; height: 15px; }
.onb-tab.active { background: var(--ink); color: #f5f1e8; border-color: var(--ink); }

/* ---- Indicateurs ---- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.kpi .kpi-num {
  font-family: var(--sans);
  font-size: 30px; font-weight: 600; line-height: 1;
}
.kpi .kpi-num small { font-size: 16px; font-weight: 500; color: var(--ink-soft); }
.kpi .kpi-label {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-soft); margin-top: 6px;
}
.kpi.ok { border-bottom: 2px solid var(--ok); }
.kpi.warn { border-bottom: 2px solid var(--warn); }
.kpi.danger { border-bottom: 2px solid var(--danger); }
.kpi.olive { border-bottom: 2px solid var(--olive); }

.today-card .task { border-bottom: none; padding-bottom: 6px; }
.kpi-bar { height: 3px; border-radius: 2px; background: #eae3d2; margin-top: 10px; overflow: hidden; }
.kpi-bar > span { display: block; height: 100%; background: var(--accent); }

/* ---- Listes de tâches ---- */
.task {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.task:last-child { border-bottom: none; }
.task-dot {
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 6px; flex-shrink: 0; background: var(--ink-soft);
}
.task-dot.danger { background: var(--danger); }
.task-dot.warn { background: var(--warn); }
.task-dot.neutral { background: var(--accent); }
.task-main { flex: 1; }
.task-title { font-weight: 500; font-size: 14.5px; }
.task-sub { font-size: 12.5px; color: var(--ink-soft); }
.task .btn { flex-shrink: 0; }

/* ---- Cartes prospect ---- */
.prospect-card { cursor: pointer; transition: border-color .15s; }
.prospect-card:hover { border-color: var(--accent); }
.prospect-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.prospect-name { font-family: var(--sans); font-weight: 600; font-size: 16px; line-height: 1.2; }
.prospect-meta { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

.steps-track { display: flex; gap: 4px; margin-top: 12px; }
.steps-track i {
  flex: 1; height: 3px; background: #e8e1d0; font-style: normal;
}
.steps-track i.done { background: var(--olive); }
.steps-track i.current { background: var(--accent); }

.filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-row .chip {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 2px; padding: 7px 13px; min-height: 36px; box-sizing: border-box;
  font-family: var(--sans); font-size: 10px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-soft); cursor: pointer;
}
.filter-row .chip.active { background: var(--ink); color: #f5f1e8; border-color: var(--ink); }

/* ---- Formulaires ---- */
.field { margin-bottom: 13px; }
.field label {
  display: block; font-size: 10.5px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  margin-bottom: 5px; color: var(--ink);
}
.field .hint { font-size: 10.5px; color: var(--ink-soft); font-weight: 400; text-transform: none; letter-spacing: 0; }
.field input[type=text], .field input[type=tel], .field input[type=email],
.field input[type=password], .field input[type=date], .field input[type=number],
.field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 3px;
  font-family: var(--sans); font-size: 16px; background: #fffefb; color: var(--ink);
  min-height: 44px; box-sizing: border-box;
}
.field textarea { min-height: 70px; resize: vertical; }
.field label { cursor: pointer; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(156, 122, 77, .18);
}
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 480px) { .field-grid { grid-template-columns: 1fr; } }

.check {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 3px; margin-bottom: 8px;
  cursor: pointer; background: #fffefb;
}
.check input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--olive); flex-shrink: 0; }
.check b { font-size: 14px; font-weight: 600; }
.check .muted { display: block; }
.check.checked { border-color: var(--olive); background: var(--ok-bg); }

.qual-verdict {
  text-align: center; padding: 11px; border-radius: 3px;
  font-size: 13px; font-weight: 500; letter-spacing: .04em; margin: 12px 0;
}
.qual-verdict.go { background: var(--ok-bg); color: var(--ok); }
.qual-verdict.nogo { background: var(--danger-bg); color: var(--danger); }

/* ---- Modale ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(35, 33, 28, .6); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--bg); width: 100%; max-width: 640px;
  max-height: 92vh; overflow-y: auto;
  border-radius: var(--radius) var(--radius) 0 0;
  border-top: 2px solid var(--accent);
  padding: 18px 18px 32px;
  animation: slideUp .22s ease;
}
@media (min-width: 700px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: var(--radius); max-height: 86vh; }
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.modal-head h3 { margin: 0; font-family: var(--sans); font-size: 18px; font-weight: 600; }
.modal-close {
  background: none; border: 1px solid #c9c0ab; border-radius: 2px;
  width: 40px; height: 40px; font-size: 15px; cursor: pointer;
  color: var(--ink); flex-shrink: 0;
}
.modal-close:hover { border-color: var(--accent); color: var(--accent-dark); }

/* ---- Trames ---- */
.script-card .script-text {
  background: #fffefb; border: 1px solid var(--line); border-left: 2px solid var(--accent);
  padding: 13px 14px; font-size: 14px; white-space: pre-wrap; margin: 10px 0;
}
.script-text mark { background: #f0e4ce; color: var(--accent-dark); font-weight: 500; padding: 0 2px; }
.placeholder-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.placeholder-bar input {
  flex: 1; min-width: 110px; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 3px; font-family: var(--sans); font-size: 16px; background: #fffefb;
  min-height: 40px; box-sizing: border-box;
}
.placeholder-bar input:focus { outline: none; border-color: var(--accent); }

/* ---- Accordéons ---- */
details.acc {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 8px; box-shadow: var(--shadow); overflow: hidden;
}
details.acc summary {
  cursor: pointer; padding: 14px 16px;
  font-family: var(--sans); font-weight: 600; font-size: 15px;
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::after {
  content: "+"; color: var(--accent); font-size: 18px; font-weight: 300;
  transition: transform .15s;
}
details.acc[open] summary::after { transform: rotate(45deg); }
details.acc .acc-body { padding: 0 16px 14px; font-size: 14px; }

/* ---- Tableaux ---- */
.mini-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mini-table th, .mini-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.mini-table th {
  font-size: 10px; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .12em; font-weight: 500;
}

/* ---- Étapes (méthode & process) ---- */
.step-item { display: flex; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.step-item:last-child { border-bottom: none; }
.step-num {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 4px;
  border: 1px solid var(--accent); color: var(--accent-dark); background: transparent;
  font-family: var(--sans); font-weight: 600; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.step-num.done { background: var(--olive); border-color: var(--olive); color: #f5f1e8; }
.step-num.off { border-color: #cfc6b1; color: #b3a98f; }
.step-body b { font-size: 14.5px; font-weight: 600; }
.step-body p { margin: 2px 0 0; font-size: 13px; color: var(--ink-soft); }
.deadline-tag {
  color: var(--accent-dark); font-weight: 500; font-size: 10.5px;
  letter-spacing: .08em; text-transform: uppercase;
}

.redline { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.redline:last-child { border-bottom: none; }
.redline::before { content: "—"; color: var(--danger); font-weight: 600; flex-shrink: 0; }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom));
  background: var(--deep); color: #f1ece0;
  border-left: 2px solid var(--accent);
  padding: 11px 20px; border-radius: 3px;
  font-size: 12px; font-weight: 500; letter-spacing: .06em;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200;
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Divers ---- */
.empty {
  text-align: center; color: var(--ink-soft); padding: 34px 16px;
  font-family: var(--sans); font-style: normal; font-size: 15px;
}
.divider { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.notice {
  background: var(--warn-bg); border: 1px solid #e8d6ae; border-radius: 3px;
  padding: 11px 13px; font-size: 13px; margin-bottom: 12px;
}
.notice.red { background: var(--danger-bg); border-color: #e3bcb6; }
.fiche-preview {
  background: #fffefb; border: 1px solid var(--line); border-radius: 3px;
  padding: 4px 13px; max-height: 360px; overflow-y: auto;
}
.fiche-row {
  display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.fiche-row:last-child { border-bottom: none; }
.fiche-row .fiche-label {
  flex: 0 0 180px; font-family: var(--sans); font-size: 10.5px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft);
}
.fiche-row .fiche-val { flex: 1 1 160px; font-size: 13.5px; }
.fiche-row .fiche-val.empty { color: var(--ink-soft); }
.auth-wrap { max-width: 440px; margin: 5vh auto 0; }
