:root {
  font-family: "DM Sans", "Segoe UI", sans-serif;
  color: #20283a;
  background: #f5f7fb;
  --muted: #8b93a5;
  --line: #e7eaf1;
  --purple: #6654e8;
  --purple-dark: #4d3bd0;
  --red: #c34b4b;
  --green: #279a6c;
  --orange: #c88732;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--purple-dark); }
h1 { font: 800 26px Manrope, "Segoe UI", sans-serif; letter-spacing: -.5px; margin: 4px 0 6px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.inline { display: inline; }
.late { color: var(--red); font-weight: 700; }
.on-time { color: var(--green); font-weight: 700; }
/* Texte écrit par le client (réclamation), dans l'espace équipe */
.client-text { color: var(--red); }
.badge.level-2 { background: #f1ebff; color: var(--purple-dark); }
.level-2-text { color: var(--purple-dark); font-weight: 600; }
.level-2-banner { background: #f1ebff; color: #3b2c99; border: 1px solid #d9ccff; }
.support-phones { margin: 0; padding: 10px 14px; border-radius: 10px; background: #f4f1ff; color: #3b3f52; font-weight: 600; }
.support-phones a { color: var(--purple-dark); text-decoration: none; white-space: nowrap; }
th.num, td.num { text-align: right; white-space: nowrap; }
.period { align-items: flex-end; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 32px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #20283a; text-decoration: none; font: 800 18px Manrope, sans-serif; }
.brand small { display: block; color: #9da4b2; font: 700 8px "DM Sans", sans-serif; letter-spacing: 1.3px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: linear-gradient(140deg, #7a68fa, #5645dc); }
.menu { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 13px; font-weight: 600; }
.menu a { color: #59627a; text-decoration: none; }
.menu a:hover { color: var(--purple-dark); }
.spaces a[aria-current] { color: var(--purple-dark); text-decoration: underline; text-underline-offset: 4px; }
.menu .who { color: var(--muted); font-weight: 500; }
.page { max-width: 1240px; margin: 0 auto; padding: 28px 32px 60px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.eyebrow { margin: 0; font-size: 10px; font-weight: 800; letter-spacing: 1.3px; color: var(--muted); }

.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; margin-bottom: 18px; }
.narrow { max-width: 460px; margin: 0 auto; }
.login-card { max-width: 420px; margin: 8vh auto 0; }
.two-columns { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: grid; gap: 14px; }
.stack > .card { margin-bottom: 0; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; align-items: end; }
.row-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 12px; }
.row-form .grow { flex: 1 1 240px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; }

.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: #4a5365; }
input, select, textarea { font: inherit; font-weight: 400; color: #20283a; border: 1px solid #d9dde7; border-radius: 9px; padding: 9px 11px; background: #fff; width: 100%; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c8c0fb; border-color: var(--purple); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check input { width: auto; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 9px; padding: 9px 16px; font: 700 13px inherit; font-family: inherit; cursor: pointer; text-decoration: none; }
.button-primary { background: var(--purple); color: #fff; }
.button-primary:hover { background: var(--purple-dark); }
.button-light { background: #fff; border-color: #d9dde7; color: #3b4458; }
.button-light:hover { background: #f4f3ff; }
.button-small { padding: 6px 11px; font-size: 12px; }
.link-button { background: none; border: 0; padding: 0; color: var(--purple-dark); font: inherit; cursor: pointer; text-decoration: underline; }
.link-button.danger, .danger { color: var(--red); }

.flash { padding: 11px 15px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.flash-success { background: #e8f7f0; color: #1d6e4d; }
.flash-error { background: #fff0f0; color: #a33d3d; }
.flash-info, .notice { background: #f0efff; color: #4d3bd0; padding: 10px 14px; border-radius: 10px; }
.credentials code { font-size: 16px; background: #fff; padding: 2px 8px; border-radius: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 10px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid #f0f2f6; vertical-align: top; }
.table-wrap { overflow-x: auto; }
.truncate { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }
tr.inactive td { color: var(--muted); }
.row-actions { white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 24px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 11px; font-weight: 700; vertical-align: middle; }
.badge.normal { background: #edf3ff; color: #4f72bb; }
.badge.urgent { background: #fff0f0; color: var(--red); }
.status-nouvelle { background: #fff5e9; color: var(--orange); }
.status-prise_en_charge { background: #edf3ff; color: #4f72bb; }
.status-cloturee { background: #f2f3f6; color: #6b7386; }
.result-aboutie { background: #e8f7f0; color: var(--green); }
.result-interrompue { background: #fff5e9; color: var(--orange); }
.result-non_faite { background: #fff0f0; color: var(--red); }

/* Avancement d'une réclamation (espace client) : déposée → prise en charge → clôturée */
.progress { display: flex; list-style: none; margin: 4px 0 0; padding: 0; }
.progress li { flex: 1; position: relative; padding-top: 26px; text-align: center; font-size: 13px; color: var(--muted); }
.progress li::before { content: ""; position: absolute; top: 4px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: #dfe3ea; z-index: 1; }
.progress li::after { content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 3px; background: #dfe3ea; }
.progress li:first-child::after { display: none; }
.progress li strong { display: block; color: #8a93a6; }
.progress li small { display: block; margin-top: 2px; }
.progress li.done::before, .progress li.done::after, .progress li.current::after { background: var(--green); }
.progress li.done strong { color: #20283a; }
.progress li.current::before { background: #fff; border: 3px solid var(--orange); width: 12px; height: 12px; box-shadow: 0 0 0 4px #fff5e9; }
.progress li.current strong { color: var(--orange); }
.progress li.warn::before { background: var(--orange); }
.progress li.fail::before { background: var(--red); }
.progress li.warn strong { color: var(--orange); }
.progress li.fail strong { color: var(--red); }
.progress.compact { min-width: 230px; }
.progress.compact li { padding-top: 18px; font-size: 10px; }
.progress.compact li::before { top: 2px; width: 12px; height: 12px; margin-left: -6px; }
.progress.compact li::after { top: 7px; height: 2px; }
.progress.compact li.current::before { width: 8px; height: 8px; border-width: 2px; }
.progress-text { display: block; margin-top: 6px; text-align: center; font-weight: 700; }
.progress-text.is-waiting { color: var(--orange); }
.progress-text.is-taken { color: #4f72bb; }
.progress-text.result-text-aboutie { color: var(--green); }
.progress-text.result-text-interrompue { color: var(--orange); }
.progress-text.result-text-non_faite { color: var(--red); }
.progress-card { margin-bottom: 18px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { padding: 7px 13px; border-radius: 16px; border: 1px solid #e3e6ee; background: #fff; color: #59627a; text-decoration: none; font-size: 12px; font-weight: 700; }
.tab span { color: #9aa2b1; margin-left: 4px; }
.tab.active { border-color: #a69bee; background: #f0efff; color: var(--purple-dark); }
.search input { min-width: 280px; }

.facts { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; margin: 0 0 18px; font-size: 14px; }
.facts dt { color: var(--muted); font-size: 12px; font-weight: 700; padding-top: 2px; }
.facts dd { margin: 0; }
.timeline { list-style: none; margin: 0 0 14px; padding: 0 0 0 14px; border-left: 2px solid var(--line); font-size: 13px; }
.timeline li { margin: 0 0 12px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: #c8c0fb; }
.timeline li.event-closed::before { background: var(--green); }
.timeline li.internal::before { background: #d9dde7; }
.timeline p { margin: 3px 0 0; }
.plain { list-style: none; padding: 0; margin: 0; font-size: 13px; display: grid; gap: 8px; }

fieldset { border: 0; padding: 0; margin: 0; display: flex; gap: 10px; flex-wrap: wrap; }
legend { font-size: 13px; font-weight: 600; color: #4a5365; margin-bottom: 6px; padding: 0; }
.choice { flex: 1 1 180px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid #d9dde7; border-radius: 11px; padding: 11px 13px; cursor: pointer; }
.choice input { width: auto; margin-top: 3px; }
.choice small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.choice:has(input:checked) { border-color: var(--purple); background: #f6f5ff; }
.choice.urgent:has(input:checked) { border-color: var(--red); background: #fff6f6; }

.dictation-bar { display: flex; align-items: center; gap: 10px; }
.mic-button.recording { background: #fff0f0; border-color: var(--red); color: var(--red); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(195, 75, 75, .15); } }

.assistant { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; }
.assistant-head { display: flex; gap: 10px; align-items: center; }
.assistant-head small { display: block; }
.bot-avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #f0efff; font-size: 20px; }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 380px; min-height: 180px; overflow-y: auto; padding: 4px 2px; }
.bubble { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.4; white-space: pre-wrap; }
.bubble.bot { background: #f0efff; color: #2e2670; border-bottom-left-radius: 4px; align-self: flex-start; }
.bubble.user { background: var(--purple); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.bubble.user.muted { background: #eef0f5; color: var(--muted); }
.chat-input { display: flex; gap: 8px; }
.chat-tools { font-size: 12px; color: var(--muted); }

@media (max-width: 860px) {
  .two-columns { grid-template-columns: 1fr; }
  .assistant { position: static; order: -1; }
  .page { padding: 18px 14px 40px; }
  .topbar { padding: 10px 14px; }
  .facts { grid-template-columns: 1fr; }
  .search input { min-width: 0; }
}
