/* Kotyz Prospection — interface pensée pour le téléphone, lisible aussi sur ordinateur. */
:root {
  --ink: #17171c; --muted: #5d5d68; --line: #e6e6ec; --bg: #f6f6f8; --card: #fff;
  --brand: #2f5bea; --brand-soft: #eef2fe; --brand-mid: #b9c7f7;
  --ok: #17653b; --ok-soft: #e6f5ec; --warn: #9a4a07; --warn-soft: #fff4e6; --danger: #a4262c; --danger-soft: #fbe9ea;
  --radius: 14px;
}
* { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg); padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
a { color: var(--brand); }
h1 { font-size: 22px; line-height: 1.2; margin: 0; }
h2 { font-size: 16px; margin: 0; }
p { margin: 0; }

/* En-tête */
.top { background: var(--card); padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.top .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.brand { font-weight: 700; font-size: 17px; text-decoration: none; color: var(--ink); }
.brand span { color: var(--muted); font-weight: 500; }
.back { font-size: 14px; text-decoration: none; display: inline-block; margin-bottom: 6px; }
.sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.pill { font: inherit; font-size: 13px; font-weight: 600; border: 0; border-radius: 999px; padding: 8px 12px;
  min-height: 36px; cursor: pointer; white-space: nowrap; }
.pill.on { background: var(--ok-soft); color: var(--ok); }
.pill.off { background: var(--danger-soft); color: var(--danger); }

main { max-width: 760px; margin: 0 auto; padding: 14px 14px 24px; display: flex; flex-direction: column; gap: 12px; }

/* Cartes et listes */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; }
.card.focus { border: 2px solid var(--brand); }
.card.dashed { border: 1px dashed var(--brand-mid); }
.card h2 + .sub { margin-top: 2px; }
.row-link { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: var(--radius);
  padding: 14px; text-decoration: none; color: inherit; }
.row-link .grow { flex: 1; min-width: 0; }
.chev { color: var(--muted); flex: none; }
.avatar { width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.avatar.round { border-radius: 50%; }
.avatar.big { width: 52px; height: 52px; font-size: 18px; }
.avatar.solid { background: var(--brand); color: #fff; }
.title { font-weight: 600; font-size: 15px; }
.line2 { font-size: 14px; color: #3c3c45; margin-top: 2px; overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); display: inline-block; flex: none; }

.banner { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--brand); color: #fff; text-decoration: none; }
.banner .n { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.18); display: flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: 18px; flex: none; }
.banner.calm { background: var(--card); color: var(--ink); }
.banner.calm .n { background: var(--ok-soft); color: var(--ok); }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--card); border-radius: var(--radius); padding: 14px; }
.kpi .lab { font-size: 13px; color: var(--muted); }
.kpi .val { font-size: 26px; font-weight: 700; margin-top: 2px; line-height: 1.2; }
.kpi .val small { font-size: 15px; color: var(--muted); font-weight: 500; }
.kpi .note { font-size: 13px; color: var(--muted); margin-top: 4px; }

.meter { height: 8px; border-radius: 4px; background: #ececf1; margin-top: 8px; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 4px; background: var(--brand); }
.meter.soft > i { background: #9db1f5; }
.bars { display: flex; align-items: flex-end; gap: 5px; height: 110px; margin-top: 14px; border-bottom: 1px solid var(--line); }
.bars i { flex: 1; background: #b9c7f7; border-radius: 4px 4px 0 0; position: relative; }
.bars i.today { background: var(--brand); }
.bars i b { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 11px; font-style: normal;
  color: var(--muted); font-weight: 600; }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.rank { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.rank .head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }

.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: #f0f0f3; color: #3c3c45; white-space: nowrap; }
.tag.ok, .s-positive, .s-client { background: var(--ok-soft); color: var(--ok); }
.s-demo, .tag.brand { background: var(--brand); color: #fff; }
.tag.warn, .s-replied { background: var(--warn-soft); color: var(--warn); }
.tag.danger, .s-stop, .s-bounced { background: var(--danger-soft); color: var(--danger); }
.s-in_sequence, .s-queued { background: var(--brand-soft); color: #1f44c4; }

.note-box { font-size: 13px; line-height: 1.4; border-radius: 10px; padding: 10px 12px; }
.note-box.warn { background: var(--warn-soft); color: var(--warn); }
.note-box.info { background: var(--brand-soft); color: #1f44c4; }
.note-box.bad { background: var(--danger-soft); color: var(--danger); }

/* Formulaires */
label { display: block; font-size: 13px; font-weight: 600; margin-top: 12px; }
label.inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; margin-top: 8px; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; font-weight: 400; padding: 10px 12px;
  border: 1px solid #dcdce4; border-radius: 10px; background: #fff; color: var(--ink); margin-top: 6px; }
label.inline input, .chips input { width: auto; margin: 0; accent-color: var(--brand); }
textarea { line-height: 1.45; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #c9d4fa; outline-offset: 1px; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 15px;
  font-weight: 600; border: 0; border-radius: 12px; padding: 12px 14px; min-height: 46px; cursor: pointer;
  background: var(--brand); color: #fff; text-decoration: none; }
.btn.light, button.light { background: #fff; color: var(--ink); border: 1px solid #dcdce4; }
button.green { background: var(--ok-soft); color: var(--ok); }
button.dark { background: var(--ink); color: #fff; }
button.ghost { background: none; color: var(--muted); padding: 8px 0; min-height: 44px; }
button.red-ghost { background: none; color: var(--danger); padding: 8px 0; min-height: 44px; }
button.red-line { background: #fff; color: var(--danger); border: 1px solid #ecc6c8; }
.wide { width: 100%; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btnrow > * { flex: 1 1 140px; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
form.inline { display: inline; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chips::-webkit-scrollbar { display: none; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 500;
  border: 1px solid #dcdce4; border-radius: 999px; padding: 7px 12px; min-height: 36px; background: #fff; color: var(--ink);
  text-decoration: none; cursor: pointer; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.chip.sel { background: var(--brand-soft); border-color: var(--brand-mid); color: #1f44c4; }
.chip.tool { background: var(--brand-soft); border: 0; color: var(--brand); font-weight: 600; font-size: 12px; min-height: 32px; padding: 6px 10px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; border-radius: 12px;
  background: #f0f0f3; margin-top: 12px; }
.seg button, .seg a { background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; min-height: 40px;
  padding: 8px 4px; border-radius: 9px; text-align: center; text-decoration: none; display: flex; align-items: center; justify-content: center; }
.seg .on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

/* Frise (vague, historique) */
.steps { display: flex; flex-direction: column; margin-top: 14px; }
.step { display: flex; gap: 12px; }
.step .rail { display: flex; flex-direction: column; align-items: center; width: 44px; flex: none; }
.step .badge { width: 44px; height: 44px; border-radius: 12px; background: var(--brand); color: #fff; display: flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.step .badge.later { background: var(--brand-soft); color: var(--brand); }
.step .bar { width: 2px; flex: 1; min-height: 16px; background: var(--brand-mid); }
.step .body { flex: 1; padding-bottom: 16px; }
.nums { display: flex; gap: 14px; margin-top: 6px; font-size: 14px; }
.tl { display: flex; gap: 12px; }
.tl .rail { display: flex; flex-direction: column; align-items: center; width: 12px; flex: none; }
.tl .pt { width: 12px; height: 12px; border-radius: 50%; background: #c9c9d3; margin-top: 4px; }
.tl .pt.out { background: #9db1f5; } .tl .pt.in { background: var(--ok); } .tl .pt.bad { background: var(--danger); }
.tl .bar { width: 2px; flex: 1; background: var(--line); }
.tl .body { flex: 1; padding-bottom: 14px; }
.tl details summary { font-size: 13px; color: var(--brand); cursor: pointer; margin-top: 4px; }

/* Conversation */
.bubble { border-radius: 14px; padding: 12px; font-size: 14px; line-height: 1.5; max-width: 92%; }
.bubble .txt { white-space: pre-wrap; margin-top: 4px; }
.bubble.in { background: var(--card); align-self: flex-start; border: 1px solid var(--line); }
.bubble.out { background: var(--brand-soft); align-self: flex-end; }
.bubble small { display: block; color: var(--muted); font-size: 12px; }
.convo { display: flex; flex-direction: column; gap: 8px; }
pre { white-space: pre-wrap; font: inherit; margin: 6px 0 0; }

.preview { margin-top: 8px; padding: 12px; border-radius: 12px; background: var(--bg); font-size: 14px; }
.preview .subj { font-weight: 600; }
mark { background: var(--brand-soft); color: inherit; border-radius: 4px; padding: 0 2px; }

.toggle { width: 44px; height: 26px; border-radius: 13px; background: #c9c9d3; position: relative; display: inline-block; border: 0;
  padding: 0; min-height: 0; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
.toggle.on { background: var(--brand); }
.toggle.on::after { left: 21px; }
.words { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.words div { padding: 8px 10px; border-radius: 10px; background: var(--bg); }
.words small { display: block; font-size: 11px; color: var(--muted); }
.words b { font-size: 13px; }

.check { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid #efeff3; }
.check:last-child { border-bottom: 0; }
.check .ico { width: 22px; height: 22px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; margin-top: 1px; }
.ico.ok { background: var(--ok-soft); color: var(--ok); } .ico.warn, .ico.unknown { background: var(--warn-soft); color: var(--warn); }
.ico.bad { background: var(--danger-soft); color: var(--danger); }
.check .detail { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.check .fix { font-size: 13px; color: var(--ink); margin-top: 2px; }

.flash { background: #fff; border-left: 4px solid var(--brand); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.flash.warn { border-left-color: var(--warn); }
.events { list-style: none; margin: 0; padding: 0; }
.events li { padding: 8px 0; border-bottom: 1px solid #efeff3; font-size: 13px; white-space: pre-line; }
.events li:last-child { border-bottom: 0; }
.events li.error { color: var(--danger); } .events li.warning { color: var(--warn); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-size: 14px; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #efeff3; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.num { text-align: right; white-space: nowrap; }

/* Onglets du bas */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: space-around;
  background: rgba(255,255,255,.97); border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 60px; min-height: 48px;
  justify-content: center; text-decoration: none; color: var(--muted); font-size: 11px; position: relative; }
.tabs a.on { color: var(--brand); font-weight: 600; }
.tabs .count { position: absolute; top: 0; right: 8px; background: #d9363e; color: #fff; border-radius: 999px; font-size: 10px;
  font-weight: 700; padding: 1px 5px; }
@media (min-width: 900px) {
  .tabs { left: 50%; transform: translateX(-50%); max-width: 760px; border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; }
}
@media (prefers-reduced-motion: reduce) { .toggle::after { transition: none; } }
