/* Allovia — console. Bleu encre et papier froid ; le bloc-message rose est le seul accent. */
:root {
    --ink: #14213d;
    --ink-2: #33415f;
    --muted: #66718a;
    --line: #dde2ea;
    --canvas: #f3f5f8;
    --surface: #ffffff;
    --primary: #1d3faf;
    --primary-ink: #ffffff;
    --signal: #1f7a5a;
    --slip: #fbe7ea;
    --slip-line: #efc3cb;
    --slip-ink: #8f2741;
    --urgent: #c42b3a;
    --radius-s: 6px;
    --radius-m: 10px;
    --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --step--1: 0.8125rem;
    --step-0: 0.9375rem;
    --step-1: 1.125rem;
    --step-2: 1.5rem;
    --step-3: 2.25rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 var(--step-0)/1.5 var(--font); color: var(--ink); background: var(--canvas); }
a { color: var(--primary); text-underline-offset: 2px; }
h1, h2 { margin: 0; line-height: 1.2; }
h1 { font-size: var(--step-2); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: var(--step-1); font-weight: 600; }
:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; border-radius: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---------- structure ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #dfe5f1; display: flex; flex-direction: column; padding: 22px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: #ffffff; text-decoration: none; font-weight: 700; font-size: var(--step-1); padding: 0 10px 22px; }
.brand__mark { width: 26px; height: 26px; color: var(--slip); flex: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__link { display: flex; align-items: center; justify-content: space-between; color: #c9d2e4; text-decoration: none; padding: 9px 10px; border-radius: var(--radius-s); font-weight: 500; }
.nav__link:hover { background: rgba(255, 255, 255, .06); color: #ffffff; }
.nav__link[aria-current="page"] { background: rgba(255, 255, 255, .1); color: #ffffff; }
.nav__badge { background: var(--slip); color: var(--slip-ink); font-size: var(--step--1); font-weight: 700; min-width: 22px; text-align: center; padding: 1px 7px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.side__foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid rgba(255, 255, 255, .12); }
.side__user { font-weight: 600; color: #ffffff; margin-bottom: 4px; }
.side__logout { background: none; border: 0; padding: 0; color: #aab6cd; font: inherit; font-size: var(--step--1); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.side__logout:hover { color: #ffffff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 32px; background: var(--surface); border-bottom: 1px solid var(--line); }
.top__month { color: var(--muted); font-size: var(--step--1); }
.switch select { font: inherit; font-weight: 600; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 6px 30px 6px 10px; background: var(--surface); }
.content { padding: 28px 32px 56px; max-width: 1240px; width: 100%; }
.flash { margin: 16px 32px 0; padding: 10px 14px; background: #e7f3ee; color: #13573f; border-radius: var(--radius-s); font-weight: 500; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head__sub { margin: 6px 0 0; color: var(--muted); }
.page-head__side { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.back { margin: 0 0 10px; font-size: var(--step--1); }

.block { margin-bottom: 28px; }
.block > h2, .block__head { margin-bottom: 12px; }
.block__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.block__head a { font-size: var(--step--1); }
.split { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 28px; align-items: start; }
.split--detail { grid-template-columns: 1fr minmax(280px, 360px); }
.empty { color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-m); padding: 18px; margin: 0; }
.count { color: var(--muted); font-size: var(--step--1); margin: 0 0 8px; }
.prose { margin: 0; max-width: 72ch; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px 18px; }

/* ---------- chiffres du mois ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; margin-bottom: 30px; }
.stat { background: var(--surface); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; }
.stat__value { font-size: var(--step-3); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat__value small { font-size: var(--step-0); font-weight: 500; color: var(--muted); letter-spacing: 0; }
.stat__label { color: var(--muted); font-size: var(--step--1); }
.stat--slip { background: var(--slip); }
.stat--slip .stat__value, .stat--slip .stat__label { color: var(--slip-ink); }
.stat--slip:hover { background: #f8dde2; }
.meter { display: block; height: 6px; background: #e8ecf2; border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--signal); border-radius: inherit; }
.meter--warn > span { background: #c98a00; }
.meter--over > span { background: var(--urgent); }

/* ---------- tableaux ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.table th { text-align: left; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid #edf0f4; vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { position: relative; }
.table tbody tr:hover { background: #f8f9fb; }
.row-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.row-link::after { content: ""; position: absolute; inset: 0; }
.row-link:focus-visible::after { outline: 3px solid #f2b705; outline-offset: -3px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.caller { display: block; font-weight: 600; font-size: var(--step-0); }
.caller__sub { display: block; color: var(--muted); }
.col-summary { min-width: 260px; color: var(--ink-2); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; margin-right: 4px; white-space: nowrap; }
.badge--message { background: #e3eeff; color: #1946a8; }
.badge--transfert { background: #e2f2ea; color: #17614a; }
.badge--information { background: #f0e9fb; color: #5f3a9e; }
.badge--autre { background: #eef0f3; color: #4d5870; }
.badge--urgent { background: var(--urgent); color: #ffffff; }

/* ---------- bloc-message « pendant votre absence » ---------- */
.slips { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; align-items: start; }
.slip { position: relative; background: var(--slip); color: #3d1420; border-radius: 3px 3px var(--radius-s) var(--radius-s); padding: 16px 18px 14px; margin-bottom: 16px; box-shadow: 0 1px 0 var(--slip-line), 0 8px 18px -14px rgba(143, 39, 65, .55); }
.slips .slip { margin-bottom: 0; }
.slip::before { content: ""; position: absolute; left: 0; right: 0; top: -6px; height: 6px; background: radial-gradient(circle at 5px 6px, transparent 3px, var(--slip) 3.5px) 0 0 / 10px 6px repeat-x; }
.slip--urgent { box-shadow: inset 4px 0 0 var(--urgent), 0 1px 0 var(--slip-line), 0 8px 18px -14px rgba(143, 39, 65, .55); }
.slip--done { background: #f4f1f2; color: #4a4146; }
.slip--done::before { background: radial-gradient(circle at 5px 6px, transparent 3px, #f4f1f2 3.5px) 0 0 / 10px 6px repeat-x; }
.slip__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; border-bottom: 2px solid var(--slip-ink); padding-bottom: 6px; margin-bottom: 10px; }
.slip--done .slip__head { border-color: #b9aeb3; }
.slip__title { font-weight: 700; color: var(--slip-ink); font-size: var(--step-0); }
.slip--urgent .slip__title { color: var(--urgent); }
.slip--done .slip__title { color: #7a6d73; }
.slip__head time { font-size: var(--step--1); color: #7c4555; white-space: nowrap; }
.slip__lines { margin: 0; }
.slip__lines > div { display: grid; grid-template-columns: 70px 1fr; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--slip-line); }
.slip--done .slip__lines > div { border-color: #e2dadd; }
.slip__lines dt { color: #8a5363; font-size: var(--step--1); padding-top: 1px; }
.slip__lines dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.slip__lines a { color: inherit; }
.slip__reason { margin: 12px 0 0; line-height: 1.55; }
.slip__todo { margin: 10px 0 0; padding-left: 0; list-style: none; }
.slip__todo li { position: relative; padding-left: 22px; margin-top: 4px; }
.slip__todo li::before { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border: 1.5px solid var(--slip-ink); border-radius: 2px; }
.slip__foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.slip__foot form { margin: 0; }
.slip__done { font-size: var(--step--1); color: #6b5f65; }
.slip__link { margin-left: auto; font-size: var(--step--1); color: var(--slip-ink); }

/* ---------- conversation ---------- */
.transcript { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.turn { display: grid; grid-template-columns: 120px 1fr; column-gap: 14px; padding: 12px 18px; border-bottom: 1px solid #edf0f4; }
.turn:last-child { border-bottom: 0; }
.turn__who { font-weight: 600; font-size: var(--step--1); }
.turn--agent .turn__who { color: var(--primary); }
.turn__time { grid-column: 1; grid-row: 2; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.turn__text { grid-column: 2; grid-row: 1 / span 2; margin: 0; max-width: 70ch; }
.turn--agent { background: #fafbfd; }

.facts { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 4px 16px; }
.facts > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #edf0f4; }
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); font-size: var(--step--1); }
.facts dd { margin: 0; font-weight: 500; text-align: right; }
.facts .ref { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- formulaires et boutons ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.field--inline { margin-bottom: 0; }
.field--grow { flex: 1 1 260px; }
.field label { font-weight: 600; font-size: var(--step--1); }
.field input, .field select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid #c9d0db; border-radius: var(--radius-s); padding: 9px 11px; width: 100%; }
.field input[aria-invalid="true"] { border-color: var(--urgent); }
.field__error { margin: 0; color: var(--urgent); font-size: var(--step--1); font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--step--1); padding: 9px 0; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 var(--step--1)/1 var(--font); padding: 10px 16px; border-radius: var(--radius-s); border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn--primary { background: var(--primary); color: var(--primary-ink); }
.btn--primary:hover { background: #17338f; }
.btn--ghost { background: transparent; color: var(--ink); border-color: #c9d0db; }
.btn--ghost:hover { background: rgba(20, 33, 61, .05); }
.slip .btn--ghost { border-color: var(--slip-line); color: #5e1a2c; }
.slip .btn--ghost:hover { background: rgba(143, 39, 65, .07); }
.btn--slip { background: var(--slip-ink); color: #ffffff; }
.btn--slip:hover { background: #761f35; }
.btn--sm { padding: 7px 12px; }
.btn--block { width: 100%; padding: 12px 16px; font-size: var(--step-0); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.tabs__tab { padding: 9px 14px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs__tab span { font-variant-numeric: tabular-nums; margin-left: 4px; color: inherit; opacity: .8; }
.tabs__tab[aria-current="page"] { color: var(--ink); border-color: var(--ink); }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.pager__btn { padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); text-decoration: none; color: var(--ink); font-size: var(--step--1); font-weight: 600; }
.pager__btn[aria-disabled="true"] { color: #a5adbd; }
.pager__info { color: var(--muted); font-size: var(--step--1); }

/* ---------- connexion ---------- */
.guest { min-height: 100vh; background: var(--ink); display: grid; place-items: center; padding: 24px 16px; }
.guest__wrap { width: 100%; max-width: 420px; }
.login { background: var(--surface); border-radius: var(--radius-m); padding: 32px 30px 28px; box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .6); }
.login__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: var(--step-1); color: var(--ink); margin-bottom: 26px; }
.login__brand .brand__mark { color: var(--slip-ink); }
.login__title { font-size: var(--step-2); margin-bottom: 8px; }
.login__lead { color: var(--muted); margin: 0 0 24px; }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; gap: 6px 12px; }
    .brand { padding: 0 8px 0 0; }
    .nav { flex-direction: row; flex-wrap: wrap; gap: 2px; }
    .nav__link { padding: 7px 9px; gap: 6px; }
    .side__foot { margin: 0 0 0 auto; padding: 0; border: 0; display: flex; align-items: center; gap: 10px; }
    .side__user { display: none; }
    .top { padding: 10px 16px; }
    .content { padding: 20px 16px 40px; }
    .flash { margin: 12px 16px 0; }
    .split, .split--detail { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; align-items: flex-start; }
    .turn { grid-template-columns: 1fr; }
    .turn__time { grid-row: auto; }
    .turn__text { grid-column: 1; grid-row: auto; margin-top: 4px; }
}

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

/* ---------- administration des clients (lot 7) ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 18px; margin-bottom: 14px; }
.panel__title { margin: 0 0 12px; font-size: var(--step-0); font-weight: 600; }
.panel__actions { display: flex; gap: 10px; margin-top: 6px; }
.inline-panel { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; }
.field--wide { grid-column: 1 / -1; }
.field textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid #c9d0db; border-radius: var(--radius-s); padding: 9px 11px; width: 100%; resize: vertical; }
.field__help { margin: 0 0 10px; color: var(--muted); font-size: var(--step--1); max-width: 72ch; }
.alert { background: #fdecee; color: #8e1f2b; border-radius: var(--radius-s); padding: 10px 14px; margin-bottom: 12px; font-weight: 500; }
.tag { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: #eef0f3; color: #4d5870; white-space: nowrap; }
.tag--on { background: #e2f2ea; color: #17614a; }
.number__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.number__e164 { font-size: var(--step-1); font-variant-numeric: tabular-nums; }
.number__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.number__actions form { margin: 0; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form select { font: inherit; border: 1px solid #c9d0db; border-radius: var(--radius-s); padding: 6px 10px; background: var(--surface); }
.instructions { margin-top: 12px; }
.instructions summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.instructions pre { margin: 10px 0 0; padding: 12px 14px; background: #f6f8fb; border: 1px solid var(--line); border-radius: var(--radius-s); white-space: pre-wrap; font: 400 var(--step--1)/1.6 var(--font); }
.list { list-style: none; margin: 0 0 14px; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; padding: 12px 16px; border-bottom: 1px solid #edf0f4; }
.list li:last-child { border-bottom: 0; }
.list a { margin-left: auto; font-size: var(--step--1); }
