/* ============================================================ polices (hébergées ici, pas chez Google) */
@font-face { font-family: "Manrope"; font-weight: 200 800; font-display: swap;
  src: url(/static/fonts/manrope-latin-wght-normal.woff2) format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 200 800; font-display: swap;
  src: url(/static/fonts/manrope-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+20C0-24FF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap;
  src: url(/static/fonts/space-grotesk-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap;
  src: url(/static/fonts/space-grotesk-latin-700-normal.woff2) format("woff2"); }

/* ============================================================ couleurs */
:root {
  --ink: #161A33;          /* bleu nuit : menu, textes */
  --ink-2: #4A5072;        /* texte secondaire */
  --ink-3: #868BA6;        /* texte discret */
  --paper: #ECEFF5;        /* fond */
  --surface: #FFFFFF;
  --line: #DCE0EA;
  --call: #0B8A55;         /* vert « décrocher » : actions principales */
  --call-press: #08703F;
  --call-soft: #E1F4EA;
  --hang: #D93F45;         /* rouge « raccrocher » */
  --hang-soft: #FCE8E8;
  --wait: #9A6200;         /* ambre « en attente » */
  --wait-soft: #FFF1D6;
  --rail: #161A33;
  --rail-ink: #B9BED6;
  --display: "Space Grotesk", "Manrope", system-ui, sans-serif;
  --text: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-key: 12px;           /* touches du clavier */
  --r-panel: 18px;         /* grands panneaux */
  --r-ctl: 12px;           /* champs et boutons */
  --tabbar: 68px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 500 16px/1.5 var(--text); color: var(--ink); background: var(--paper);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #6E8BFF; outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(26px, 5vw, 34px); line-height: 1.1; }
h2 { font-size: 20px; line-height: 1.2; }
h3 { font-size: 17px; line-height: 1.25; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }

/* ============================================================ touche de clavier (la signature) */
.key { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-key);
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 2px 0 var(--line);
  font: 700 20px/1 var(--display); color: var(--ink); flex: none; }
.key.done { background: var(--call); border-color: var(--call); box-shadow: 0 2px 0 var(--call-press); color: #fff; }
.key.dark { background: #23284A; border-color: #2E3460; box-shadow: 0 3px 0 #0E1124; color: #fff; }

/* ============================================================ boutons et champs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  padding: 0 20px; border-radius: var(--r-ctl); border: 1px solid transparent; cursor: pointer;
  font-weight: 700; font-size: 16px; text-decoration: none; background: var(--ink); color: #fff;
  transition: transform .08s, background-color .15s; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: translateY(1px); }
.btn.call { background: var(--call); } .btn.call:hover { background: var(--call-press); }
.btn.hang { background: var(--surface); color: var(--hang); border-color: #F2C3C5; }
.btn.hang:hover { background: var(--hang-soft); }
.btn.quiet { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.quiet:hover { background: var(--paper); }
.btn.wide { width: 100%; }
.btn svg.i { width: 20px; height: 20px; }

.field { display: block; margin-top: 16px; }
.field > span { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; min-height: 50px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); font-size: 16px; }
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ink); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.alert { margin-top: 16px; padding: 12px 14px; border-radius: var(--r-ctl); background: var(--hang-soft);
  color: #A3262B; font-weight: 600; font-size: 15px; }

/* ============================================================ pastilles de statut */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700;
  padding: 4px 10px 4px 8px; border-radius: 999px; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.s-pending { background: var(--wait-soft); color: var(--wait); }
.s-active { background: var(--call-soft); color: var(--call); }
.s-suspended { background: var(--hang-soft); color: var(--hang); }

/* ============================================================ pages de connexion */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); }
.auth-side { display: none; }
.auth-main { display: flex; flex-direction: column; padding: 20px 20px 32px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 40px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font: 700 18px var(--display);
  letter-spacing: -0.01em; text-decoration: none; }
.logo .key { width: 34px; height: 34px; font-size: 16px; }
.auth-form { width: 100%; max-width: 420px; margin: 0 auto; flex: 1; }
.auth-form h1 { margin-bottom: 8px; }
.auth-form .btn.wide { margin-top: 24px; }
.auth-alt { margin-top: 20px; text-align: center; color: var(--ink-2); }
.auth-alt a { font-weight: 700; color: var(--call); }
.lang { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.lang a { min-width: 40px; min-height: 34px; display: grid; place-items: center; border-radius: 8px;
  text-decoration: none; font-size: 13px; font-weight: 700; color: var(--ink-3); }
.lang a.on { background: var(--ink); color: #fff; }
.state { text-align: center; padding-top: 24px; }
.state .key { width: 72px; height: 72px; font-size: 32px; margin-bottom: 24px; border-radius: 18px; }
.state p { margin: 12px auto 20px; max-width: 34ch; }

/* version mobile du clavier, sous le formulaire */
.ivr-mobile { margin: 40px auto 0; width: 100%; max-width: 420px; background: var(--rail); color: #fff;
  border-radius: var(--r-panel); padding: 20px; }
.ivr-mobile .ivr h2 { font-size: 20px; margin-bottom: 12px; }
.ivr-mobile .key { width: 40px; height: 40px; font-size: 18px; }
.ivr-mobile .ivr-row span:not(.key) { font-size: 14px; }

@media (min-width: 960px) {
  .ivr-mobile { display: none; }
  .auth { grid-template-columns: minmax(420px, 5fr) 6fr; }
  .auth-side { display: flex; flex-direction: column; justify-content: space-between; padding: 48px;
    background: var(--rail); color: #fff; }
  .auth-side .logo { color: #fff; }
  .auth-side .logo .key { background: var(--call); border-color: var(--call); box-shadow: 0 2px 0 var(--call-press); color: #fff; }
  .auth-main { padding: 32px 48px; }
  .auth-main .auth-top .logo { visibility: hidden; }
  .auth-form { margin: auto; flex: 0; }
}
/* le clavier du panneau de gauche : un vrai parcours d'appel */
.ivr { max-width: 380px; }
.ivr h2 { font-size: clamp(26px, 2.4vw, 34px); line-height: 1.12; margin-bottom: 28px; color: #fff; }
.ivr-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; }
.ivr-row + .ivr-row { border-top: 1px solid #262B4D; }
.ivr-row span { color: var(--rail-ink); font-weight: 600; }
.ivr-row b { margin-left: auto; font-size: 13px; padding: 4px 10px; border-radius: 999px; }
.ivr-row b.lead { background: rgba(18, 183, 106, .16); color: #5BE0A0; }
.ivr-row b.no { background: rgba(229, 72, 77, .16); color: #FF9599; }
.ivr-row b.next { background: #262B4D; color: var(--rail-ink); }
.auth-side .faint { color: #6F7598; }

/* ============================================================ coquille de l'appli (connecté) */
.shell { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: rgba(236, 239, 245, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
.topbar .grow { flex: 1; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: #fff; font: 700 14px var(--display); text-decoration: none; }
.content { max-width: 1040px; margin: 0 auto; padding: 24px 16px 40px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head p { margin-top: 6px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--ink-3); font-size: 12px; font-weight: 700; position: relative; }
.tabbar a.on { color: var(--ink); }
.tabbar a.on::before { content: ""; position: absolute; top: 0; width: 32px; height: 3px; border-radius: 0 0 3px 3px; background: var(--call); }
.tabbar .dot { position: absolute; top: 9px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--wait); color: #fff; font-size: 11px; display: grid; place-items: center; }
.rail { display: none; }

@media (min-width: 960px) {
  .shell { padding: 0 0 0 248px; }
  .tabbar, .topbar .logo { display: none; }
  .rail { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: 248px;
    background: var(--rail); color: var(--rail-ink); padding: 24px 16px; }
  .rail .logo { color: #fff; margin: 0 8px 32px; }
  .rail .logo .key { background: var(--call); border-color: var(--call); box-shadow: 0 2px 0 var(--call-press); color: #fff; }
  .rail nav a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px;
    text-decoration: none; font-weight: 700; margin-bottom: 4px; }
  .rail nav a:hover { background: #1F2445; color: #fff; }
  .rail nav a.on { background: #262B4D; color: #fff; }
  .rail nav .dot { margin-left: auto; background: var(--wait); color: #fff; font-size: 12px; min-width: 22px;
    height: 22px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center; }
  .rail .me { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 12px;
    border-top: 1px solid #262B4D; text-decoration: none; }
  .rail .me .avatar { background: #262B4D; }
  .rail .me b { display: block; color: #fff; font-size: 14px; }
  .rail .me small { font-size: 12px; }
  .topbar { padding: 16px 32px; background: transparent; border: 0; backdrop-filter: none; position: static; }
  .content { padding: 8px 32px 48px; }
}

/* ============================================================ admin : liste des clients */
.filters { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 16px; padding: 2px 16px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters a { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line); text-decoration: none;
  font-weight: 700; font-size: 14px; color: var(--ink-2); }
.filters a.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.filters a small { font-size: 13px; opacity: .7; }
.search { position: relative; margin-bottom: 16px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 20px; height: 20px; }
.search input { width: 100%; min-height: 48px; padding: 0 14px 0 44px; border: 1.5px solid var(--line);
  border-radius: var(--r-ctl); background: var(--surface); font-size: 16px; }
.search input:focus { outline: none; border-color: var(--ink); }

.queue { background: var(--wait-soft); border-radius: var(--r-panel); padding: 16px; margin-bottom: 24px; }
.queue h2 { font-size: 17px; color: var(--wait); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.queue-item { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 14px; padding: 12px; }
.queue-item + .queue-item { margin-top: 8px; }
.queue-item .who { flex: 1; min-width: 0; }
.queue-item .who b, .queue-item .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-item .who span { color: var(--ink-2); font-size: 14px; }

.list { background: var(--surface); border-radius: var(--r-panel); border: 1px solid var(--line); overflow: hidden; }
.client { border-bottom: 1px solid var(--line); }
.client:last-child { border-bottom: 0; }
.client > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  cursor: pointer; min-height: 72px; }
.client > summary::-webkit-details-marker { display: none; }
.client > summary:hover { background: #F7F8FB; }
.client .initials { width: 44px; height: 44px; border-radius: var(--r-key); display: grid; place-items: center;
  background: var(--paper); font: 700 15px var(--display); flex: none; }
.client .who { flex: 1; min-width: 0; }
.client .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client .who span { display: block; color: var(--ink-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client .chev { color: var(--ink-3); transition: transform .2s; }
.client[open] .chev { transform: rotate(90deg); }
.client[open] > summary { background: #F7F8FB; }
.client-body { padding: 4px 16px 20px 72px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 15px; margin-bottom: 16px; }
.facts dt { color: var(--ink-3); } .facts dd { margin: 0; word-break: break-word; }
.facts a { color: var(--call); font-weight: 700; text-decoration: none; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.acts form { margin: 0; }
.empty { padding: 48px 24px; text-align: center; color: var(--ink-2); }
.empty .key { margin-bottom: 12px; }

@media (max-width: 640px) {
  .client-body { padding-left: 16px; }
  .acts form, .acts .btn { flex: 1; }
  .acts .btn { width: 100%; }
  .client .status { display: none; }
  .client .status.always { display: inline-flex; }
}
@media (min-width: 960px) {
  .filters { margin: 0 0 16px; padding: 2px 0; }
  .toolbar { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
  .toolbar .filters, .toolbar .search { margin: 0; }
  .toolbar .search { margin-left: auto; width: 320px; }
}

/* ============================================================ historique */
.timeline { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-panel); overflow: hidden; }
.timeline li { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border: 0; }
.timeline .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.timeline .ico svg { width: 18px; height: 18px; }
.ico.signup { background: var(--paper); color: var(--ink-2); }
.ico.activate, .ico.reactivate { background: var(--call-soft); color: var(--call); }
.ico.suspend { background: var(--hang-soft); color: var(--hang); }
.ico.note { background: var(--wait-soft); color: var(--wait); }
.timeline .txt { flex: 1; min-width: 0; }
.timeline time { color: var(--ink-3); font-size: 13px; white-space: nowrap; }

/* ============================================================ client : mise en route */
.progress { display: flex; align-items: center; gap: 12px; margin: 4px 0 24px; }
.progress .bar { flex: 1; height: 8px; border-radius: 4px; background: #DADFEA; overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--call); border-radius: 4px; }
.progress b { font-family: var(--display); font-size: 15px; }
.steps { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-panel); overflow: hidden; }
.steps li { display: flex; align-items: center; gap: 16px; padding: 16px; border-bottom: 1px solid var(--line); }
.steps li:last-child { border: 0; }
.steps .txt { flex: 1; min-width: 0; }
.steps .txt p { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.steps .later { font-size: 13px; font-weight: 700; color: var(--ink-3); white-space: nowrap; }
.steps li.next { background: #FAFBFD; }
.steps li.next .key { border-color: var(--ink); box-shadow: 0 2px 0 var(--ink); }

/* ============================================================ compte */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 20px; }
.panel + .panel { margin-top: 16px; }
.panel h2 { font-size: 17px; margin-bottom: 4px; }
.me-head { display: flex; align-items: center; gap: 16px; }
.me-head .avatar { width: 56px; height: 56px; font-size: 20px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
