:root {
  --bg: #f4f5f7; --card: #fff; --ink: #1f2937; --muted: #6b7280; --line: #e5e7eb;
  --accent: #4f46e5; --accent-ink: #fff; --danger: #b91c1c; --ok: #15803d;
  --s-a-appeler: #e0e7ff; --s-appele: #dcfce7; --s-a-relancer: #fef3c7; --s-sans-suite: #f3f4f6;
  --s-promise: #e0e7ff; --s-faite: #dbeafe; --s-rdv-pris: #dcfce7; --s-mission: #bbf7d0; --s-abandonnee: #f3f4f6;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
h1 { font-size: 20px; margin: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
code { background: var(--line); padding: 1px 5px; border-radius: 4px; }

/* en-tête */
.top { background: var(--card); border-bottom: 1px solid var(--line); padding: 12px 16px 0; position: sticky; top: 0; z-index: 5; }
.brand { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.stat { background: var(--bg); border-radius: var(--radius); padding: 8px 6px; text-align: center; }
.stat b { display: block; font-size: 22px; line-height: 1.1; }
.stat span { font-size: 11px; color: var(--muted); }
.tabs { display: flex; gap: 4px; }
.tab { flex: 1; background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 6px; font: inherit;
  font-weight: 600; color: var(--muted); cursor: pointer; min-height: 44px; }
.tab[aria-selected="true"] { color: var(--accent); border-color: var(--accent); }
.tab small { font-weight: 400; color: var(--muted); }

/* barre d'outils */
main { padding: 12px 16px 80px; max-width: 1400px; margin: 0 auto; }
.toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.toolbar #search { grid-column: 1 / -1; }
.toolbar input, .toolbar select { min-height: 44px; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px;
  background: var(--card); min-height: 40px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; min-height: 40px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 14px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn.danger { color: var(--danger); }
.btn.icon { padding: 8px; min-width: 44px; }

/* lignes : cartes sur téléphone */
.list { display: flex; flex-direction: column; gap: 10px; }
.head { display: none; }
.row { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); padding: 12px; display: grid;
  grid-template-columns: 1fr 1fr; gap: 8px 10px; border-left-width: 5px; }
.row[data-statut="à appeler"], .row[data-statut="promise"] { border-left-color: #6366f1; }
.row[data-statut="appelé"], .row[data-statut="faite"] { border-left-color: #3b82f6; }
.row[data-statut="à relancer"] { border-left-color: #f59e0b; }
.row[data-statut="RDV pris"] { border-left-color: #22c55e; }
.row[data-statut="mission"] { border-left-color: #15803d; }
.row[data-statut="sans suite"], .row[data-statut="abandonnée"] { border-left-color: #9ca3af; opacity: .8; }
.f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.f > span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.f.wide { grid-column: 1 / -1; }
.f.check { flex-direction: row; align-items: center; gap: 8px; }
.f.check input { width: 22px; height: 22px; min-height: 0; margin: 0; }
.f.check > span { text-transform: none; font-size: 14px; color: var(--ink); }
.tel { display: flex; gap: 6px; }
.tel a { flex: 0 0 44px; }
.actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
select.statut { font-weight: 600; }
select.statut[data-v="à appeler"], select.statut[data-v="promise"] { background: var(--s-a-appeler); }
select.statut[data-v="appelé"], select.statut[data-v="faite"] { background: var(--s-faite); }
select.statut[data-v="à relancer"] { background: var(--s-a-relancer); }
select.statut[data-v="RDV pris"] { background: var(--s-rdv-pris); }
select.statut[data-v="mission"] { background: var(--s-mission); }
select.statut[data-v="sans suite"], select.statut[data-v="abandonnée"] { background: var(--s-sans-suite); }
.late { color: var(--danger); font-weight: 600; }

/* enregistrements d'appels (Onoff) */
.recs { grid-column: 1 / -1; border-top: 1px dashed var(--line); padding-top: 8px; font-size: 14px; }
.recs-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.rec { margin-top: 6px; }
.rec > summary { cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 36px; }
.rec > summary .btn { margin-left: auto; min-height: 28px; }
.rec-resume { white-space: normal; padding: 6px 0 6px 12px; border-left: 3px solid var(--accent); margin: 6px 0; }
.rec-verbatim > summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.rec-verbatim pre { white-space: pre-wrap; font-family: inherit; font-size: 13px; line-height: 1.45; background: var(--bg); padding: 10px; border-radius: 8px; max-height: 320px; overflow: auto; }

/* grille sur grand écran */
@media (min-width: 1100px) {
  .top { padding: 12px 24px 0; }
  .brand h1 { font-size: 22px; }
  .stats { grid-template-columns: repeat(4, 160px); }
  .tabs { max-width: 400px; }
  .tab { flex: 0 0 auto; padding: 10px 18px; }
  main { padding: 16px 24px 60px; }
  .toolbar { grid-template-columns: 2fr 1fr 1fr auto auto; }
  .toolbar #search { grid-column: auto; }
  .list { gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
  .head, .row { display: grid; align-items: start; gap: 6px; padding: 8px 10px; border-radius: 0; border: 0;
    border-bottom: 1px solid var(--line); border-left: 5px solid transparent; min-width: 1200px; }
  .head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; position: sticky; top: 0;
    background: var(--bg); z-index: 1; padding-top: 10px; padding-bottom: 10px; }
  .row:last-child { border-bottom: 0; }
  .f > span { display: none; }
  .f.wide { grid-column: auto; }
  .f.check { justify-content: center; }
  .f.check > span { display: none; }
  .actions { grid-column: auto; justify-content: flex-end; }
  .recs { grid-column: 1 / -1; }
  .list[data-table="appels"] .head, .list[data-table="appels"] .row {
    grid-template-columns: 1.3fr 1fr 1.1fr 1fr minmax(140px, .9fr) 2.2fr .6fr minmax(140px, .9fr) .5fr 90px; }
  .list[data-table="introductions"] .head, .list[data-table="introductions"] .row {
    grid-template-columns: 1.2fr 1.1fr .9fr 1.1fr 1fr 1.4fr minmax(140px, .9fr) 1.6fr 48px; }
  input, select, textarea { padding: 6px 8px; min-height: 36px; }
  .btn.icon { min-width: 36px; min-height: 36px; padding: 4px; }
}

/* divers */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 10; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.toast.err { background: var(--danger); }
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { background: var(--card); border-radius: 14px; padding: 28px 24px; width: 100%; max-width: 380px;
  box-shadow: 0 10px 30px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 12px; }
.login-card label { font-size: 13px; color: var(--muted); }
.login-card form { display: flex; flex-direction: column; gap: 10px; }
.error { color: var(--danger); margin: 0; }
