:root {
  --bg: #f4f6f9; --card: #fff; --ink: #0f172a; --muted: #64748b; --line: #e2e8f0; --soft: #f1f5f9;
  --brand: #ea580c; --brand-ink: #fff; --brand-soft: #fff1e7; --nav: #0f172a; --nav-ink: #cbd5e1;
  --ok: #15803d; --ok-soft: #e8f6ec; --warn: #b45309; --warn-soft: #fef5e4; --bad: #b91c1c; --bad-soft: #fdecec; --info: #1d4ed8; --info-soft: #e8efff;
  --r: 12px; --shadow: 0 1px 2px rgb(15 23 42 / .06), 0 4px 16px rgb(15 23 42 / .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120; --card: #131c2e; --ink: #e5e9f0; --muted: #94a3b8; --line: #23304a; --soft: #1a2438;
    --brand: #f97316; --brand-soft: #2c1a0e; --nav: #070b16; --nav-ink: #94a3b8;
    --ok: #4ade80; --ok-soft: #10261a; --warn: #fbbf24; --warn-soft: #2a2010; --bad: #f87171; --bad-soft: #2c1414; --info: #93b4ff; --info-soft: #152140;
    --shadow: 0 1px 2px rgb(0 0 0 / .3); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--info); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ---------- mise en page ---------- */
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--nav); color: var(--nav-ink); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; padding: 4px 10px 18px; font-size: 16px; }
.logo img { width: 30px; height: 30px; }
.logo small { display: block; font-weight: 500; color: var(--nav-ink); font-size: 12px; }
.side a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--nav-ink); text-decoration: none; font-weight: 500; }
.side a:hover { background: rgb(255 255 255 / .06); color: #fff; }
.side a.on { background: rgb(249 115 22 / .16); color: #fff; }
.side a svg { width: 19px; height: 19px; flex: none; }
.side .grow { flex: 1; }
.side .who { font-size: 13px; padding: 8px 12px; border-top: 1px solid rgb(255 255 255 / .08); }
.side .who button { background: none; border: 0; color: var(--nav-ink); padding: 0; cursor: pointer; text-decoration: underline; font-size: 13px; }
main { padding: 24px clamp(16px, 3vw, 36px) 90px; min-width: 0; max-width: 1280px; }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.tabbar { display: none; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side { display: none; }
  main { padding: 16px 16px 96px; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--nav); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--nav-ink); text-decoration: none; font-size: 11px; padding: 4px 6px; flex: 1; border-radius: 8px; }
  .tabbar a.on { color: #fff; background: rgb(249 115 22 / .18); }
  .tabbar svg { width: 21px; height: 21px; }
}

/* ---------- éléments ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 18px; }
.kpi .v { font-size: 28px; font-weight: 750; letter-spacing: -.02em; }
.kpi .l { color: var(--muted); font-size: 13px; }
.two { grid-template-columns: 1.3fr 1fr; align-items: start; }
@media (max-width: 1000px) { .two { grid-template-columns: 1fr; } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--card); padding: 9px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.big { padding: 14px 20px; font-size: 16px; border-radius: 12px; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgb(234 88 12 / .15); }
label.f { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.f > input, label.f > select, label.f > textarea { margin-top: 5px; color: var(--ink); font-weight: 400; font-size: 15px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; cursor: pointer; user-select: none; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.check input { accent-color: var(--brand); width: 16px; height: 16px; margin: 0; }
.err { color: var(--bad); font-size: 14px; min-height: 20px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* ---------- connexion / invitation ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 0%, rgb(234 88 12 / .18), transparent 50%), var(--bg); }
.auth .card { width: min(420px, 100%); padding: 28px; }
.auth .logo { color: var(--ink); padding: 0 0 18px; }
.auth .logo small { color: var(--muted); }
.auth h1 { font-size: 21px; margin-bottom: 6px; }

/* ---------- filtres et liste ---------- */
.filters { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
@media (max-width: 1100px) { .filters { grid-template-columns: 1fr 1fr; } .filters .q { grid-column: 1 / -1; } }
.toggles { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.count { color: var(--muted); font-size: 14px; }
.fbox > summary { display: none; }
@media (max-width: 860px) {
  .fbox { margin-bottom: 12px; }
  .fbox > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 650; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; list-style: none; }
  .fbox > summary::-webkit-details-marker { display: none; }
  .fbox > summary::after { content: '▾'; margin-left: auto; color: var(--muted); }
  .fbox[open] > summary { margin-bottom: 10px; }
  .toggles .check { font-size: 13px; padding: 6px 9px; }
}
.list { display: grid; gap: 10px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; padding: 14px 16px; cursor: pointer; transition: border-color .12s; }
.item:hover { border-color: var(--brand); }
.item .t { font-weight: 700; font-size: 15.5px; overflow-wrap: anywhere; }
.item .meta { color: var(--muted); font-size: 13px; display: flex; gap: 6px 12px; flex-wrap: wrap; }
.item .person { font-size: 14px; }
.item .person b { font-weight: 650; }
.item .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.item .tel { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 600px) { .item { grid-template-columns: 1fr; } .item .right { flex-direction: row; justify-content: space-between; align-items: center; text-align: left; } }
.more { display: flex; justify-content: center; margin-top: 16px; }

/* ---------- fiche ---------- */
.drawer-bg { position: fixed; inset: 0; background: rgb(2 6 23 / .45); z-index: 30; animation: fade .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); background: var(--bg); z-index: 31; overflow-y: auto; animation: slide .18s ease-out; box-shadow: -10px 0 30px rgb(0 0 0 / .15); }
@keyframes fade { from { opacity: 0; } } @keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer header { position: sticky; top: 0; background: var(--bg); padding: 14px 18px 10px; display: flex; gap: 10px; align-items: flex-start; z-index: 2; border-bottom: 1px solid var(--line); }
.drawer header h2 { margin: 0; font-size: 19px; overflow-wrap: anywhere; }
.drawer .body { padding: 16px 18px 40px; display: grid; gap: 14px; }
.fiche-title { flex: 1; min-width: 0; }
.callbox { display: grid; gap: 10px; }
.callnum { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.callnum .num { font-size: 26px; font-weight: 800; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.src { font-size: 13px; color: var(--muted); }
.people { display: grid; gap: 8px; }
.person-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--soft); border-radius: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 750; flex: none; font-size: 14px; }
.person-row .n { font-weight: 700; }
.person-row .r { font-size: 13px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.outcomes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.outcomes .btn { justify-content: flex-start; }
.outcomes .btn.sel { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.hist { display: grid; gap: 8px; font-size: 13.5px; }
.hist div { border-left: 3px solid var(--line); padding-left: 10px; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- session d'appels ---------- */
.session-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.callcard { max-width: 760px; }

/* ---------- équipe ---------- */
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tablewrap { overflow-x: auto; }
.linkbox { display: flex; gap: 8px; align-items: center; background: var(--soft); border-radius: 10px; padding: 8px 10px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; }
.linkbox span { flex: 1; min-width: 0; }
.bar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.divrow { display: grid; grid-template-columns: 1fr 70px; gap: 4px 10px; align-items: center; font-size: 13.5px; margin-bottom: 8px; }
.divrow .bar { grid-column: 1 / -1; }

#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; font-weight: 600; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%); }
