/* Natz Leads — styles. Pensé pour le téléphone, utilisable sur ordinateur. */
:root {
  --brand: #4b3aa0;
  --brand-dark: #3a2c82;
  --brand-soft: #ece9f8;
  --brand-softer: #f6f4fd;
  --ink: #1d1b2e;
  --muted: #6b6880;
  --line: #e4e1ef;
  --bg: #f4f3f9;
  --card: #ffffff;
  --hot: #d92d20;
  --warm: #f79009;
  --cold: #2e90fa;
  --ok: #12a150;
  --warn-bg: #fff6e5;
  --warn-ink: #8a4b00;
  --err-bg: #fdecea;
  --err-ink: #b42318;
  --radius: 14px;
  --tap: 48px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.4; color: var(--ink); background: var(--bg);
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

.app { min-height: 100%; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; background: var(--bg); }

/* Barre du haut */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: calc(10px + var(--safe-top)) 14px 10px; background: var(--brand); color: #fff; min-height: 56px;
}
.topbar-title { flex: 1; min-width: 0; text-align: center; }
.topbar-title span { display: block; font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title small { display: block; font-size: 12px; opacity: .8; }
.topbar-back, .topbar-avatar, .topbar-pending {
  border: 0; background: rgba(255,255,255,.14); color: #fff; height: 38px; min-width: 38px; border-radius: 19px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; font-weight: 600; font-size: 14px;
}
.topbar-avatar { padding: 0; width: 38px; overflow: hidden; }
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.topbar-pending { background: #ffb020; color: #3d2600; gap: 4px; }
.topbar-pending svg { width: 16px; height: 16px; }

.banner { padding: 10px 16px; font-size: 14px; background: var(--warn-bg); color: var(--warn-ink); border-bottom: 1px solid #f5dfb5; }
.banner.err { background: var(--err-bg); color: var(--err-ink); border-color: #f6c7c1; }
.banner.ok { background: #e7f6ec; color: #0b6b35; border-color: #bfe6cc; }

.view { flex: 1; padding: 14px 14px calc(96px + var(--safe-bottom)); outline: none; }

/* Barre d'onglets du bas */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: center;
  background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom);
}
.tabbar-inner { display: flex; width: 100%; max-width: 720px; }
.tab {
  flex: 1; border: 0; background: none; padding: 8px 2px 7px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 11px; text-decoration: none; min-height: 58px;
}
.tab.active { color: var(--brand); font-weight: 600; }
.tab svg { width: 24px; height: 24px; }

/* Cartes et sections */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(29,27,46,.06); }
.card h2, .section-title { font-size: 17px; margin: 0 0 10px; }
.section-title { margin: 18px 4px 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }

/* Champs */
.field { margin-bottom: 16px; }
.field > label, .field > .label { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.req { font-weight: 400; font-size: 11px; color: var(--muted); }
.req.on { color: var(--brand); }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.input, select.input, textarea.input {
  width: 100%; min-height: var(--tap); border: 1.5px solid var(--line); background: #fff; border-radius: 12px;
  padding: 11px 13px; font-size: 16px; outline: none; transition: border-color .15s;
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field.invalid .input, .field.invalid .chips, .field.invalid .people { border-color: var(--err-ink); box-shadow: 0 0 0 3px var(--err-bg); border-radius: 12px; }
.field .error { display: none; color: var(--err-ink); font-size: 13px; margin-top: 5px; }
.field.invalid .error { display: block; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two .field { margin-bottom: 0; }
.input-wrap { position: relative; }
.input-wrap .suffix { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-wrap .input { padding-right: 40px; }
.icon-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: var(--brand-soft); color: var(--brand); width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn.rec { background: var(--hot); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }

/* Boutons « puces » (choix en un tap) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 14px; min-height: var(--tap);
  font-weight: 600; font-size: 15px; display: inline-flex; flex-direction: column; align-items: flex-start; justify-content: center; text-align: left;
}
.chip small { font-weight: 400; font-size: 11px; color: var(--muted); margin-top: 1px; }
.chip.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.chips.grow .chip { flex: 1 1 0; align-items: center; text-align: center; }
.chip.hot.on { border-color: var(--hot); background: #fdecea; color: #912018; }
.chip.warm.on { border-color: var(--warm); background: #fff4e5; color: #8a4b00; }
.chip.cold.on { border-color: var(--cold); background: #e8f2ff; color: #144f9b; }

/* Boutons */
.btn {
  border: 0; border-radius: 12px; min-height: var(--tap); padding: 12px 18px; font-weight: 700; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; background: var(--brand-soft); color: var(--brand-dark);
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:active { background: var(--brand-dark); }
.btn.danger { background: var(--err-bg); color: var(--err-ink); }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.block { width: 100%; }
.btn.small { min-height: 38px; padding: 8px 12px; font-size: 14px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn svg { width: 20px; height: 20px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 auto; }

.submit-bar { position: sticky; bottom: calc(66px + var(--safe-bottom)); z-index: 5; padding: 10px 0 4px; background: linear-gradient(transparent, var(--bg) 30%); }

/* Congrès sélectionné */
.congress-pick { display: flex; align-items: center; gap: 12px; width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 8px 12px; min-height: 60px; text-align: left; }
.congress-pick .grow { flex: 1; min-width: 0; }
.congress-pick b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 44px; height: 44px; border-radius: 10px; object-fit: contain; background: var(--brand-softer); flex: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: var(--brand); font-size: 14px; overflow: hidden; }
.logo img { width: 100%; height: 100%; object-fit: contain; }

/* Suggestions de villes */
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 15; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(29,27,46,.14); overflow: hidden; }
.suggest button { display: block; width: 100%; text-align: left; border: 0; background: #fff; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.suggest button:last-child { border-bottom: 0; }
.suggest button:active, .suggest button.hl { background: var(--brand-softer); }
.suggest small { color: var(--muted); }
.place { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--brand-softer); border: 1.5px solid var(--brand-soft); }
.place .grow { flex: 1; }
.place small { display: block; color: var(--muted); }
.link-btn { border: 0; background: none; color: var(--brand); padding: 6px 0; font-size: 14px; text-decoration: underline; }

/* Personnes (Assigné à, équipe) */
.people { display: flex; flex-direction: column; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.person { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; min-height: 54px; width: 100%; }
.person:last-child { border-bottom: 0; }
.person .grow { flex: 1; min-width: 0; }
.person small { display: block; color: var(--muted); font-size: 12px; }
.person.on { background: var(--brand-soft); }
.person .radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.person.on .radio { border-color: var(--brand); box-shadow: inset 0 0 0 5px var(--brand); }
.people .divider { padding: 7px 12px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--brand-softer); text-transform: uppercase; letter-spacing: .03em; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-dark); vertical-align: middle; }
.tag.hot { background: #fdecea; color: #912018; } .tag.warm { background: #fff4e5; color: #8a4b00; } .tag.cold { background: #e8f2ff; color: #144f9b; }
.tag.grey { background: #eeedf3; color: var(--muted); } .tag.ok { background: #e7f6ec; color: #0b6b35; } .tag.err { background: var(--err-bg); color: var(--err-ink); }

.note { padding: 10px 12px; border-radius: 10px; font-size: 14px; background: var(--brand-softer); color: var(--brand-dark); }
.note.warn { background: var(--warn-bg); color: var(--warn-ink); }
.note.err { background: var(--err-bg); color: var(--err-ink); }

.check { display: flex; gap: 12px; align-items: flex-start; padding: 4px 0; }
.check input { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--brand); }
.consent-text { font-size: 13px; color: #45425a; }
.legal { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* Listes */
.list { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 2px rgba(29,27,46,.06); }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); width: 100%; border-left: 0; border-right: 0; border-top: 0; background: #fff; text-align: left; }
.item:last-child { border-bottom: 0; }
.item .grow { flex: 1; min-width: 0; }
.item b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .chev { color: #b8b5c8; }
.empty { text-align: center; color: var(--muted); padding: 30px 16px; }

.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .input { flex: 1 1 160px; min-height: 44px; }
.seg { display: flex; background: #e9e7f2; border-radius: 12px; padding: 3px; gap: 3px; overflow-x: auto; margin-bottom: 12px; }
.seg button { flex: 1 0 auto; border: 0; background: none; border-radius: 9px; padding: 9px 12px; font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; }
.seg button.on { background: #fff; color: var(--brand-dark); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* Statistiques / ROI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-bottom: 12px; }
.kpi { background: #fff; border-radius: 12px; padding: 12px; box-shadow: 0 1px 2px rgba(29,27,46,.06); }
.kpi b { display: block; font-size: 22px; }
.kpi span { font-size: 12px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: 13px; margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr 34px; gap: 8px; align-items: center; font-size: 13px; }
.bar-row .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 12px; border-radius: 6px; background: var(--brand-softer); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.bar-row .n { text-align: right; font-weight: 600; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }
.dot.green { background: #3cc47c; box-shadow: 0 0 0 3px #d9f4e4; } .dot.red { background: #f04438; box-shadow: 0 0 0 3px #fde3e1; }
.progress { height: 10px; border-radius: 6px; background: var(--brand-soft); overflow: hidden; margin: 8px 0 14px; }
.progress > i { display: block; height: 100%; background: var(--brand); }
.kv { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { text-align: right; font-weight: 600; word-break: break-word; }

/* Équipe */
.team { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tcard { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 2px rgba(29,27,46,.06); display: flex; flex-direction: column; }
.tcard .ph { aspect-ratio: 4/3; background: var(--brand-softer); display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 800; color: var(--brand); }
.tcard .ph img { width: 100%; height: 100%; object-fit: cover; }
.tcard .bd { padding: 10px 12px 12px; }
.tcard b { display: block; font-size: 14px; }
.tcard small { display: block; color: var(--muted); font-size: 12px; }
.tcard .acts { display: flex; gap: 6px; margin-top: 8px; }
.tcard .acts a { flex: 1; display: inline-flex; justify-content: center; padding: 7px 0; border-radius: 9px; background: var(--brand-soft); color: var(--brand); }
.tcard .acts svg { width: 18px; height: 18px; }

/* Agenda */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-head h2 { flex: 1; margin: 0; font-size: 18px; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 2px rgba(29,27,46,.06); }
.cal .dow { font-size: 11px; color: var(--muted); text-align: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.cal .day { min-height: 64px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 3px; font-size: 12px; overflow: hidden; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.out { color: #c3c0d2; background: #fbfbfd; }
.cal .day.today .num { background: var(--brand); color: #fff; border-radius: 10px; padding: 0 6px; }
.cal .num { display: inline-block; text-align: right; font-weight: 600; }
.cal .ev { display: block; margin-top: 2px; background: var(--brand); color: #fff; border-radius: 4px; padding: 1px 3px; font-size: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Feuille (fenêtre du bas) */
.sheet-back { position: fixed; inset: 0; background: rgba(20,18,35,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--bg); width: 100%; max-width: 720px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 8px 14px calc(18px + var(--safe-bottom)); animation: up .18s ease-out; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: #cfcbe0; margin: 4px auto 10px; }
.sheet h2 { font-size: 18px; margin: 4px 0 12px; }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
@keyframes fade { from { opacity: 0; } }

.toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-bottom)); transform: translateX(-50%) translateY(20px); background: #1d1b2e; color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; max-width: 92vw; z-index: 60; opacity: 0; pointer-events: none; transition: all .2s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.success { text-align: center; padding: 26px 10px 10px; }
.success .big { width: 76px; height: 76px; border-radius: 50%; background: #e7f6ec; color: var(--ok); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.success .big.wait { background: var(--warn-bg); color: #b26b00; }
.success .big svg { width: 40px; height: 40px; stroke-width: 2.5; }

.login { max-width: 420px; margin: 6vh auto 0; }
.login .brand { text-align: center; margin-bottom: 18px; }
.login .brand img { width: 84px; height: 84px; border-radius: 20px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
table.grid th, table.grid td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.grid th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
table.grid select { min-height: 38px; padding: 6px 8px; font-size: 14px; }
.scroll-x { overflow-x: auto; border-radius: var(--radius); }

.spinner { width: 22px; height: 22px; border: 3px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 720px) {
  .view { padding: 20px 20px 110px; }
  .tabbar { border-top: 1px solid var(--line); }
}
