:root {
  --black: #070808;
  --panel: #0a0b0b;
  --panel-soft: #0d0e0e;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.13);
  --text: #f2f2f2;
  --muted: #777b80;
  --muted-2: #45494e;
  --green: #20d66b;
  --yellow: #f5cf00;
  --orange: #ff8a1f;
  --red: #ff3848;
  --body: "Inter", Arial, sans-serif;
  --heading: "Oswald", "Arial Narrow", Arial, sans-serif;
}

body[data-auth-shell] { visibility: hidden; }

* {
  box-sizing: border-box;
}

/* Un `display` explicite l’emporterait sur l’attribut hidden : les panneaux
   masqués resteraient visibles. */
[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--black);
  color: var(--text);
  font-family: var(--body);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.035), transparent 24rem),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02), transparent 18rem),
    var(--black);
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.system-shell {
  /* Pleine largeur : le rail se cale au bord de la fenêtre, comme sur le suivi
     commercial. Le plafond de lecture s'applique au contenu, pas à la coquille,
     sinon la navigation flotte au milieu de bandes vides. */
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  transition: grid-template-columns 180ms ease;
}

.system-shell.nav-expanded {
  grid-template-columns: 270px minmax(0, 1fr);
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  padding: 34px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  overflow: hidden;
}

.rail-logo {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 18px;
}

.rail-logo img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.rail-logo span {
  display: none;
  min-width: 0;
  color: var(--text);
  font-family: var(--heading);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.rail-toggle {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.015);
  color: var(--muted);
  cursor: pointer;
}

.rail-toggle:hover {
  color: var(--green);
  border-color: rgba(32, 214, 107, 0.3);
}

.rail-toggle svg,
.rail-link svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail-link svg rect {
  fill: none;
}

.rail-nav {
  display: grid;
  width: 100%;
  flex: 1;
  min-height: 0;
  align-content: start;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  gap: 10px;
  padding: 24px 0 0;
}

.rail-nav::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.rail-account {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
}

.rail-account span {
  display: none;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-account button {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: #686d69;
  cursor: pointer;
}

.rail-account button:hover { color: var(--green); border-color: rgba(32, 214, 107, 0.35); }
.rail-account button:disabled { opacity: 0.5; cursor: wait; }
.rail-account svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.rail-link {
  width: 36px;
  min-height: 36px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #575b60;
  border-radius: 8px;
  padding: 0 9px;
  transition: width 180ms ease, color 160ms ease, background 160ms ease;
}

.rail-link span {
  display: none;
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-family: var(--heading);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.rail-link:hover,
.rail-link.active {
  color: var(--green);
  background: rgba(32, 214, 107, 0.07);
}

.nav-expanded .rail {
  align-items: stretch;
}

.nav-expanded .rail-logo {
  justify-content: flex-start;
}

.nav-expanded .rail-logo span,
.nav-expanded .rail-link span {
  display: block;
}

.nav-expanded .rail-toggle {
  margin-left: 18px;
}

.nav-expanded .rail-link {
  width: calc(100% - 28px);
  justify-content: flex-start;
  margin: 0 14px;
}

.nav-expanded .rail-account { justify-content: space-between; }
.nav-expanded .rail-account span { display: block; }

.console {
  min-width: 0;
  padding: 34px 52px 32px;
}

.console > * {
  width: min(1240px, 100%);
  margin-inline: auto;
}

.console-head {
  min-height: 124px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 28px;
}

.overline,
.panel-kicker {
  margin: 0 0 14px;
  color: var(--muted);
  font-family: var(--heading);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.overline::after,
.panel-kicker::after {
  content: "";
  display: block;
  width: 54px;
  height: 1px;
  margin-top: 12px;
  background: var(--green);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--heading);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
}

h2 {
  font-size: 16px;
  line-height: 1.2;
}

h3 {
  margin-top: 26px;
  font-size: 13px;
}

.view-subtitle {
  max-width: 560px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.head-actions,
.filters-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.search-field,
.filters-row label {
  border-bottom: 1px solid var(--line-strong);
  display: grid;
  gap: 7px;
  padding-bottom: 8px;
}

.search-field {
  width: 250px;
}

.search-shell {
  position: relative;
  width: 250px;
}

.search-shell .search-field {
  width: 100%;
}

.global-search-results {
  position: absolute;
  z-index: 95;
  top: calc(100% + 10px);
  right: 0;
  width: min(430px, calc(100vw - 32px));
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #090a0a;
  box-shadow: 0 22px 48px rgba(0, 0, 0, .58);
  overflow: hidden;
}

.global-search-count,
.global-search-empty {
  margin: 0;
  padding: 13px 15px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  text-transform: uppercase;
}

.global-search-count {
  border-bottom: 1px solid var(--line);
  font-family: var(--heading);
  letter-spacing: .12em;
}

.global-search-list {
  display: grid;
  max-height: min(430px, 60vh);
  overflow-y: auto;
}

.global-search-list button {
  min-width: 0;
  min-height: 66px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 12px 15px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.global-search-list button:last-child {
  border-bottom: 0;
}

.global-search-list button:hover,
.global-search-list button:focus-visible {
  background: rgba(32, 214, 107, .07);
  outline: 0;
}

.global-search-list button > span {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.global-search-list button > span:last-child {
  justify-items: end;
}

.global-search-list strong,
.global-search-list small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-search-list strong {
  font-size: 12px;
}

.global-search-list small,
.global-search-list i {
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
}

.global-search-list i {
  font-family: var(--heading);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.global-search-list b {
  font-size: 11px;
}

.search-field span,
.filters-row span {
  color: var(--muted);
  font-family: var(--heading);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: 0;
  background: #080909;
  color: var(--text);
}

textarea {
  min-height: 120px;
  resize: vertical;
  padding: 12px;
  font-size: 13px;
  line-height: 1.6;
}

select {
  height: 38px;
  padding: 0 34px 0 11px;
}

.filters-row {
  justify-content: start;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 34px;
}

.dashboard-context[hidden] {
  display: none;
}

.filters-row label {
  width: 138px;
}

.action-main,
.action-ghost {
  height: 34px;
  border-radius: 7px;
  padding: 0 16px;
  cursor: pointer;
  font-family: var(--heading);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.action-main {
  border: 0;
  background: var(--green);
  color: #031107;
}

.action-ghost {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
}

.sync-state {
  margin-left: auto;
  display: grid;
  grid-template-columns: 8px auto;
  align-items: center;
  gap: 6px 10px;
}

.sync-state small {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
}

.status-dot.live {
  background: var(--green);
}

.warning-list {
  margin: -10px 0 28px;
  border: 1px solid rgba(245, 207, 0, 0.18);
  background: rgba(245, 207, 0, 0.045);
  color: #e9d876;
  padding: 14px 18px;
  display: grid;
  gap: 6px;
  font-size: 12px;
  line-height: 1.55;
}

.warning-list[hidden] {
  display: none;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 48px;
}

.kpi-card {
  min-height: 122px;
  border-bottom: 1px solid var(--line);
  display: grid;
  align-content: start;
  gap: 12px;
}

.kpi-card span,
.micro-stats span,
th {
  color: var(--muted);
  font-family: var(--heading);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.kpi-card strong {
  color: var(--text);
  font-family: var(--heading);
  font-size: 32px;
  line-height: 0.95;
  letter-spacing: 0.02em;
}

.kpi-card small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
  text-transform: uppercase;
}

.accent-green strong {
  color: var(--green);
}

.accent-yellow strong {
  color: var(--yellow);
}

.accent-orange strong {
  color: var(--orange);
}

.objective-overview {
  margin-bottom: 48px;
  padding: 24px 0 28px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.objective-edit {
  background: transparent;
  cursor: pointer;
}

.objective-edit:hover {
  color: var(--green);
  border-color: rgba(32, 214, 107, .35);
}

.objective-main {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(240px, 1.2fr) 64px;
  gap: 22px;
  align-items: center;
}

.objective-main-copy {
  display: grid;
  gap: 7px;
}

.objective-main-copy span,
.objective-support-item span,
.activity-performance-head span {
  color: var(--muted);
  font-size: 11px;
}

.objective-main-copy strong {
  font-family: var(--heading);
  font-size: 25px;
}

.objective-main-copy small {
  color: var(--muted);
  font-family: var(--body);
  font-size: 11px;
  font-weight: 400;
}

.objective-main > b {
  color: var(--green);
  font-family: var(--heading);
  font-size: 20px;
  text-align: right;
}

.objective-progress,
.objective-mini-progress {
  height: 5px;
  background: var(--line);
  overflow: hidden;
}

.objective-progress i,
.objective-mini-progress i {
  display: block;
  width: var(--progress);
  height: 100%;
  background: var(--activity-color, var(--green));
}

.objective-supporting {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 28px;
  border-top: 1px solid var(--line);
}

.objective-support-item {
  min-width: 0;
  padding: 18px 20px 0;
  border-left: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 12px;
}

.objective-support-item:first-child {
  padding-left: 0;
  border-left: 0;
}

.objective-support-item strong {
  grid-row: 2;
  font-family: var(--heading);
  font-size: 22px;
}

.objective-support-item small {
  grid-row: 2;
  align-self: end;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.objective-mini-progress {
  grid-column: 1 / -1;
  margin-top: 4px;
  height: 3px;
}

.matrix {
  display: grid;
  gap: 24px;
  margin-bottom: 58px;
}

.two-col {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.9fr);
}

.quote-layout {
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.8fr);
}

/* ---------- Devis et factures ---------- */

.document-workspace {
  min-width: 0;
  margin-bottom: 58px;
}

.document-toolbar {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) 180px auto;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.document-tabs {
  display: flex;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  overflow: hidden;
}

.document-tabs button {
  min-width: 116px;
  border: 0;
  border-right: 1px solid var(--line-strong);
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--heading);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.document-tabs button:last-child {
  border-right: 0;
}

.document-tabs button:hover,
.document-tabs button.active {
  background: rgba(32, 214, 107, .08);
  color: var(--green);
}

.document-tabs button span {
  margin-left: 6px;
  color: var(--text);
}

.document-search {
  height: 40px;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

.document-search svg,
.document-sync svg,
.document-row-followup svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.document-search svg {
  width: 17px;
  color: var(--muted);
}

.document-search input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 0;
  padding: 0;
  background: transparent;
}

.document-search input:focus {
  outline: 0;
}

.document-filter select {
  width: 100%;
  height: 40px;
}

.document-sync {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.document-sync svg {
  width: 16px;
}

.document-sync:disabled {
  cursor: wait;
  opacity: .55;
}

.document-notice {
  margin: 18px 0 0;
  border-left: 2px solid var(--red);
  padding: 10px 14px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
}

.document-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 28px 0 26px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.document-stat {
  min-width: 0;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
  display: grid;
  gap: 8px;
}

.document-stat:first-child {
  padding-left: 0;
}

.document-stat:last-child {
  border-right: 0;
}

.document-stat span {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
  text-transform: uppercase;
}

.document-stat strong {
  overflow-wrap: anywhere;
  font-family: var(--heading);
  font-size: 23px;
  line-height: 1.1;
}

.document-list {
  min-width: 0;
}

.document-list-head,
.document-row {
  display: grid;
  grid-template-columns: minmax(230px, 1.5fr) minmax(160px, 1fr) 90px 120px 120px minmax(155px, .9fr);
  align-items: center;
  gap: 18px;
}

.document-list-head {
  padding: 0 16px 12px;
  color: var(--muted);
  font-family: var(--heading);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.document-row {
  width: 100%;
  min-height: 84px;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 14px 16px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.document-row:last-child {
  border-bottom: 1px solid var(--line);
}

.document-row:hover,
.document-row:focus-visible {
  background: rgba(255, 255, 255, .025);
  outline: 0;
}

.document-row:focus-visible {
  box-shadow: inset 3px 0 var(--green);
}

.document-row > span,
.document-row > strong {
  min-width: 0;
  font-size: 12px;
}

.document-row-main {
  display: grid;
  gap: 5px;
}

.document-row-main strong,
.document-row-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-row-main strong {
  font-size: 13px;
}

.document-row-main small,
.document-row-followup {
  color: var(--muted);
  font-size: 10px;
}

.document-status {
  display: inline-block;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 5px 7px;
  font-family: var(--heading);
  font-size: 9px;
  font-style: normal;
  letter-spacing: .09em;
  text-transform: uppercase;
  white-space: nowrap;
}

.document-status.ok {
  border-color: rgba(32, 214, 107, .35);
  color: var(--green);
}

.document-status.wait {
  border-color: rgba(245, 207, 0, .3);
  color: var(--yellow);
}

.document-status.bad {
  border-color: rgba(255, 56, 72, .35);
  color: var(--red);
}

.document-row-followup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.document-row-followup svg {
  width: 17px;
  flex: 0 0 auto;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent), var(--panel);
  padding: 24px;
}

.panel-head,
.section-tools {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.chip,
.chips span {
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 6px 10px;
  color: var(--muted);
  font-family: var(--heading);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  white-space: nowrap;
}

.link-chip,
.open-link {
  color: var(--green);
}

.bars {
  display: grid;
  gap: 18px;
}

.activity-performance {
  display: grid;
  gap: 10px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.activity-performance:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.activity-performance-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.activity-performance-head span {
  display: flex;
  align-items: center;
  gap: 9px;
}

.activity-performance-head i {
  width: 7px;
  height: 7px;
  background: var(--activity-color);
}

.activity-performance-head strong {
  font-size: 11px;
}

.activity-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.activity-facts span {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
  text-transform: uppercase;
}

.activity-facts b {
  display: block;
  color: var(--text);
  font-size: 11px;
  text-transform: none;
}

.objectives-drawer,
.pipeline-drawer,
.document-drawer {
  position: fixed;
  z-index: 80;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(560px, calc(100vw - 32px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: -24px 0 56px rgba(0, 0, 0, .55);
  overflow: hidden;
}

.objectives-drawer-head,
.pipeline-drawer-head,
.document-drawer-head {
  min-height: 68px;
  padding: 0 16px 0 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.objectives-drawer-head > div,
.pipeline-drawer-head > div,
.document-drawer-head > div {
  display: grid;
  gap: 4px;
}

.objectives-drawer-head span,
.pipeline-drawer-head span,
.document-drawer-head span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.objectives-drawer-head strong,
.pipeline-drawer-head strong,
.document-drawer-head strong {
  font-family: var(--heading);
  font-size: 16px;
  text-transform: uppercase;
}

.objectives-drawer-head .icon-action,
.pipeline-drawer-head .icon-action,
.document-drawer-head .icon-action {
  font-size: 24px;
  font-weight: 300;
}

.objectives-form {
  padding: 24px;
  display: grid;
  align-content: start;
  gap: 30px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.objectives-form section {
  display: grid;
  gap: 18px;
}

.objectives-form h2 {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.objective-form-grid,
.activity-objective-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 14px;
}

.objectives-form label {
  min-width: 0;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-family: var(--heading);
  font-size: 10px;
  text-transform: uppercase;
}

.objectives-form label small {
  min-height: 28px;
  color: var(--muted-2);
  font-family: var(--body);
  font-size: 9px;
  line-height: 1.5;
  text-transform: none;
}

.objectives-form input {
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #080909;
}

.activity-objective-inputs label {
  grid-template-columns: 8px minmax(0, 1fr);
  align-items: center;
}

.activity-objective-inputs input {
  grid-column: 1 / -1;
}

.activity-swatch {
  width: 7px;
  height: 7px;
}

.activity-swatch.photovoltaic { background: var(--green); }
.activity-swatch.building { background: var(--yellow); }
.activity-swatch.underwater { background: var(--orange); }
.objectives-message { min-height: 18px; color: var(--orange); font-size: 11px; }
.objectives-submit { width: 100%; min-height: 42px; }

.bar-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 90px;
  gap: 16px;
  align-items: center;
}

.bar-row span,
.bar-row strong {
  font-size: 12px;
}

.bar-row span {
  color: var(--muted);
  text-transform: uppercase;
}

.bar-row strong {
  text-align: right;
}

.bar-track {
  height: 3px;
  background: var(--line);
}

.bar-fill {
  width: var(--width);
  height: 100%;
  background: var(--bar-color);
}

.quality-grid,
.micro-stats,
.source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.quality-item,
.micro-stats div,
.source-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.quality-item span,
.source-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 10px;
}

.quality-item strong,
.micro-stats strong,
.source-card strong {
  color: var(--text);
  font-family: var(--heading);
  font-size: 28px;
  line-height: 1;
}

.quality-item.ok strong {
  color: var(--green);
}

.quality-item.warn strong {
  color: var(--yellow);
}

.note,
.empty-copy,
.empty-state p,
.timeline-row p,
.pipe-card p,
td small,
.source-card small,
.gap-list span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.timeline,
.gap-list,
.score-lines,
.profile-meta {
  display: grid;
  gap: 12px;
}

.timeline-row,
.gap-list div,
.score-lines div,
.profile-meta div {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

td strong,
.timeline-row strong,
.pipe-card strong,
.gap-list strong,
.score-lines strong,
.profile-meta strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.score-lines span,
.profile-meta span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table-wrap.flush {
  margin: 0 -24px -24px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 17px 0;
  text-align: left;
}

td {
  color: var(--text);
  font-size: 13px;
}

.status,
.score-pill {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 8px;
  font-family: var(--heading);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status.ok {
  color: var(--green);
  border-color: rgba(32, 214, 107, 0.35);
}

.status.wait {
  color: var(--yellow);
  border-color: rgba(245, 207, 0, 0.3);
}

.status.bad {
  color: var(--red);
  border-color: rgba(255, 56, 72, 0.3);
}

.profile-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 28px;
}

.score-panel strong {
  display: block;
  font-family: var(--heading);
  font-size: 72px;
  line-height: 0.95;
}

.score-panel > span {
  display: block;
  color: var(--green);
  margin: 12px 0 28px;
  font-family: var(--heading);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.timeline-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.timeline-row > span {
  width: 6px;
  height: 6px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--green);
}

.timeline-row time {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 22px;
  overflow-x: auto;
}

.pipeline-notice {
  margin: 0 0 18px;
  padding: 10px 12px;
  border-left: 2px solid var(--red);
  color: var(--text);
  background: rgba(255, 56, 72, .06);
  font-size: 10px;
}

.pipe-column {
  min-height: 420px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
  transition: border-color 160ms ease, background 160ms ease;
}

.pipe-column.is-drop-target {
  border-top-color: var(--green);
  background: rgba(32, 214, 107, .025);
}

.pipe-column-list {
  min-height: 340px;
  position: relative;
}

.pipe-column-list.drop-at-end::after,
.pipe-card.drop-before::before,
.pipe-card.drop-after::after {
  content: "";
  position: absolute;
  z-index: 3;
  left: 4px;
  right: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--green);
  box-shadow: 0 0 0 1px rgba(32, 214, 107, .16), 0 0 12px rgba(32, 214, 107, .4);
  pointer-events: none;
}

.pipe-card.drop-before::before {
  top: -8px;
}

.pipe-card.drop-after::after {
  bottom: -8px;
}

.pipe-column-list.drop-at-end::after {
  top: 8px;
}

.pipe-column header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}

.pipe-column header span {
  font-family: var(--heading);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.pipe-card {
  width: 100%;
  color: inherit;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--panel-soft);
  position: relative;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.pipe-card[draggable="true"] {
  cursor: grab;
}

.pipe-card:hover,
.pipe-card:focus-visible {
  border-color: rgba(32, 214, 107, .55);
  background: #101212;
  outline: none;
}

.pipe-card:active {
  cursor: grabbing;
}

.pipe-card.is-dragging {
  opacity: .45;
  transform: scale(.985);
}

.pipe-card-grip {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 14px;
  height: 20px;
  display: grid;
  grid-template-columns: repeat(2, 3px);
  grid-auto-rows: 3px;
  gap: 3px;
  align-content: center;
  justify-content: center;
}

.pipe-card-grip i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted);
}

.pipe-card > strong,
.pipe-card > p {
  padding-right: 26px;
}

.pipe-manual-chip {
  display: inline-flex;
  margin-top: 10px;
  padding: 4px 6px;
  border: 1px solid rgba(32, 214, 107, .28);
  border-radius: 4px;
  color: var(--green);
  font-size: 8px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.pipe-card footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.pipe-card em {
  color: var(--muted);
  font-style: normal;
  text-transform: uppercase;
}

.pipeline-drawer-body {
  min-height: 0;
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.document-drawer-body {
  min-height: 0;
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.document-drawer-summary {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.document-drawer-summary > span {
  color: var(--green);
  font-family: var(--heading);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.document-drawer-summary h2 {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
  font-size: 22px;
  line-height: 1.35;
}

.document-drawer-summary p {
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.document-drawer-summary .document-status {
  margin-top: 18px;
}

.document-detail-list {
  margin: 0;
}

.document-detail-list > div {
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(130px, .8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 18px;
}

.document-detail-list dt,
.document-detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.45;
}

.document-detail-list dt {
  color: var(--muted);
}

.document-detail-list dd {
  color: var(--text);
  font-weight: 600;
  text-align: right;
}

.pipeline-drawer-summary {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.pipeline-drawer-summary p,
.pipeline-drawer-summary h2 {
  margin: 0;
}

.pipeline-drawer-summary p {
  color: var(--green);
  font-family: var(--heading);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.pipeline-drawer-summary h2 {
  margin-top: 8px;
  font-size: 19px;
  line-height: 1.35;
}

.pipeline-drawer-summary > strong {
  display: block;
  margin-top: 18px;
  font-family: var(--heading);
  font-size: 38px;
  line-height: 1;
}

.pipeline-stage-section {
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.pipeline-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.pipeline-section-title span {
  font-family: var(--heading);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.pipeline-section-title em {
  color: var(--green);
  font-size: 9px;
  font-style: normal;
}

.pipeline-stage-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  overflow: hidden;
}

.pipeline-stage-control button {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--line-strong);
  color: var(--muted);
  background: #080909;
  cursor: pointer;
  font-size: 10px;
  text-transform: uppercase;
}

.pipeline-stage-control button:last-child {
  border-right: 0;
}

.pipeline-stage-control button.active {
  color: var(--black);
  background: var(--green);
  font-weight: 700;
}

.pipeline-stage-control button:disabled {
  cursor: default;
  opacity: .55;
}

.pipeline-stage-section > small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

.pipeline-order-control {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.pipeline-order-control > div:first-child {
  display: grid;
  gap: 4px;
}

.pipeline-order-control span {
  color: var(--text);
  font-family: var(--heading);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.pipeline-order-control small {
  color: var(--muted);
  font-size: 9px;
}

.pipeline-order-control > div:last-child {
  display: flex;
  gap: 8px;
}

.pipeline-order-control .icon-action {
  font-size: 17px;
  line-height: 1;
}

.pipeline-order-control .icon-action:disabled {
  cursor: default;
  opacity: .28;
}

.pipeline-detail-list {
  margin: 0;
}

.pipeline-detail-list > div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.pipeline-detail-list dt,
.pipeline-detail-list dd {
  font-size: 11px;
  line-height: 1.5;
}

.pipeline-detail-list dd {
  color: var(--text);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.pipeline-save-message {
  min-height: 18px;
  margin: 16px 0 0;
  color: var(--green);
  font-size: 10px;
}

.detail-card dl {
  margin: 30px 0 0;
  display: grid;
  gap: 18px;
}

.detail-card div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
}

.empty-state {
  max-width: 620px;
  border-left: 1px solid var(--line);
  padding: 40px 0 40px 34px;
}

.empty-state h2 {
  font-size: 28px;
  margin-bottom: 20px;
}

.agent-admin-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.2fr) minmax(280px, .65fr);
  gap: 28px;
  align-items: start;
}

.agent-preview-panel {
  padding-bottom: 18px;
}

.agent-preview {
  display: block;
  width: 100%;
  height: 690px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #070908;
}

.agent-capabilities {
  display: grid;
  border-top: 1px solid var(--line);
}

.agent-capabilities > div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 7px 12px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.agent-capabilities span {
  grid-row: 1 / 3;
  color: var(--green);
  font-family: var(--heading);
  font-size: 12px;
}

.agent-capabilities strong {
  font-family: var(--heading);
  font-size: 16px;
  text-transform: uppercase;
}

.agent-capabilities p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.knowledge-library-head p {
  max-width: 520px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.knowledge-form label,
.knowledge-library-head label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-family: var(--heading);
  font-size: 10px;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.knowledge-form input {
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #080909;
  padding: 0 11px;
}

.knowledge-form-message {
  min-height: 18px;
  margin: 0;
  color: var(--orange);
  font-size: 11px;
}

.knowledge-toolbar,
.knowledge-library-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.knowledge-stats {
  display: flex;
  align-items: center;
  gap: 18px;
}

.knowledge-stats span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.knowledge-stats strong {
  color: var(--text);
  font-family: var(--heading);
  font-size: 18px;
}

.icon-action {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-action:hover {
  color: var(--green);
  border-color: rgba(32, 214, 107, .32);
}

.icon-action svg,
.knowledge-drop svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.knowledge-layout {
  display: grid;
  grid-template-columns: minmax(320px, .7fr) minmax(0, 1.3fr);
  gap: 30px;
  align-items: start;
}

.knowledge-editor,
.knowledge-library {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.knowledge-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 4px;
}

.knowledge-mode-tabs button {
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.knowledge-mode-tabs button.active {
  background: rgba(32, 214, 107, .1);
  color: var(--green);
}

.knowledge-form {
  display: grid;
  gap: 15px;
}

.knowledge-form h3,
.knowledge-library h3 {
  margin: 0 0 6px;
  letter-spacing: .12em;
}

.knowledge-form .action-main {
  justify-self: start;
}

.knowledge-drop {
  min-height: 160px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 22px;
  text-align: center;
  cursor: pointer;
}

.knowledge-drop:hover {
  color: var(--green);
  border-color: rgba(32, 214, 107, .35);
  background: rgba(32, 214, 107, .025);
}

.knowledge-drop svg {
  width: 25px;
  height: 25px;
}

.knowledge-drop strong {
  color: var(--text);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}

.knowledge-drop span {
  max-width: 290px;
  color: var(--muted);
  font-family: var(--body);
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 0;
  text-transform: none;
  overflow-wrap: anywhere;
}

.knowledge-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.knowledge-library-head label {
  width: 190px;
  flex: 0 0 auto;
}

.knowledge-library-head p {
  margin-bottom: 0;
}

.knowledge-document-list {
  display: grid;
}

.knowledge-document {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 74px;
  border-bottom: 1px solid var(--line);
}

.knowledge-document-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--green);
  font-family: var(--heading);
  font-size: 10px;
  text-transform: uppercase;
}

.knowledge-document strong,
.knowledge-document span {
  display: block;
  overflow-wrap: anywhere;
}

.knowledge-document strong {
  font-size: 12px;
}

.knowledge-document span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.knowledge-document-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.knowledge-status {
  color: var(--green);
  font-family: var(--heading);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.knowledge-status.pending,
.knowledge-status.in_progress {
  color: var(--yellow);
}

.knowledge-status.failed {
  color: var(--red);
}

.knowledge-empty {
  border-bottom: 1px solid var(--line);
  padding: 46px 0;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.json-box {
  min-height: 260px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050505;
  color: var(--muted);
  padding: 16px;
  font-size: 11px;
  line-height: 1.6;
}

.endpoint-list {
  display: grid;
  gap: 12px;
}

.endpoint-list a,
.endpoint-list span {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  color: var(--green);
  font-size: 12px;
  line-height: 1.6;
}

.console-foot {
  border-top: 1px solid var(--line);
  margin-top: 64px;
  padding-top: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.console-foot img {
  width: 24px;
  height: 24px;
  vertical-align: middle;
  margin-right: 14px;
}

@media (max-width: 1120px) {
  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .system-shell {
    grid-template-columns: 1fr;
  }

  .system-shell.nav-expanded {
    grid-template-columns: 1fr;
  }

  .rail {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    padding: 14px 16px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: var(--black);
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
  }

  .rail-logo {
    order: 1;
    width: auto;
    padding: 0;
    justify-content: flex-start;
  }

  /* De la place pour le nom : la marque disparaissait au profit d'un pictogramme. */
  .rail-logo span {
    display: block;
    font-size: 13px;
    letter-spacing: 0.14em;
  }

  .rail-toggle {
    order: 2;
    width: 40px;
    height: 40px;
    margin: 0;
  }

  /*
   * Les dix destinations passaient dans un défileur horizontal : une barre de
   * défilement native apparaissait sous les icônes, et les dernières entrées
   * n'étaient atteignables qu'en faisant glisser le bandeau. Elles passent
   * maintenant à la ligne, toutes visibles d'un coup.
   */
  /*
   * Replié, le menu disparaît et laisse une barre compacte : c'est le
   * comportement du suivi commercial. Les dix destinations tenaient auparavant
   * dans un défileur horizontal, avec sa barre grise et ses entrées hors champ.
   */
  .rail-nav {
    display: none;
  }

  .nav-expanded .rail-nav {
    order: 3;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: none;
    overflow: visible;
    padding-top: 4px;
    gap: 6px;
  }

  .rail-account { display: none; }
  .nav-expanded .rail-account {
    order: 4;
    display: flex;
    width: 100%;
    padding: 4px 0 0;
  }

  /* 44 px : cible tactile minimale confortable. */
  .rail-link {
    width: 44px;
    height: 44px;
    margin: 0;
    justify-content: center;
  }

  .nav-expanded .rail-link {
    width: 100%;
    height: auto;
    min-height: 44px;
    margin: 0;
    justify-content: flex-start;
  }

  .nav-expanded .rail-link span {
    display: block;
  }

  .nav-expanded .rail-toggle {
    margin-left: 0;
  }

  .console {
    padding: 28px 24px;
  }

  .console-head,
  .panel-head,
  .section-tools,
  .console-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .head-actions,
  .filters-row {
    justify-content: start;
  }

  .sync-state {
    margin-left: 0;
  }

  .two-col,
  .quote-layout,
  .profile-grid,
  .agent-admin-layout,
  .knowledge-layout {
    grid-template-columns: 1fr;
  }

  .knowledge-toolbar,
  .knowledge-library-head {
    flex-direction: column;
    align-items: stretch;
  }

  .knowledge-library-head label {
    width: 100%;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin-bottom: 42px;
  }

  .objective-main {
    grid-template-columns: minmax(0, 1fr) 54px;
  }

  .objective-main-copy {
    grid-column: 1 / -1;
  }

  .objective-supporting {
    grid-template-columns: 1fr;
  }

  .objective-support-item,
  .objective-support-item:first-child {
    padding: 16px 0;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 560px) {
  .console {
    padding: 24px 18px;
  }

  .search-shell,
  .search-field,
  .filters-row label,
  .action-main,
  .action-ghost {
    width: 100%;
  }

  .global-search-results {
    right: auto;
    left: 0;
    width: 100%;
  }

  .quality-grid,
  .micro-stats,
  .source-grid {
    grid-template-columns: 1fr;
  }

  .kpi-grid,
  .objective-form-grid,
  .activity-objective-inputs,
  .activity-facts {
    grid-template-columns: 1fr;
  }

  .activity-performance-head {
    display: grid;
  }

  .objectives-drawer,
  .pipeline-drawer,
  .document-drawer {
    top: 8px;
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
  }

  .objectives-form {
    padding: 20px 16px;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .bar-row strong {
    text-align: left;
  }

  .pipeline-board {
    grid-template-columns: 1fr;
  }

  .pipeline-drawer-body,
  .document-drawer-body {
    padding: 20px 16px;
  }

  .pipeline-detail-list > div {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .knowledge-stats {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-wrap: wrap;
  }

  .knowledge-document {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 12px 0;
  }

  .knowledge-document-actions {
    grid-column: 2;
    justify-content: space-between;
  }
}

@media (max-width: 1100px) {
  .document-toolbar {
    grid-template-columns: auto minmax(220px, 1fr) 170px;
  }

  .document-sync {
    grid-column: 3;
  }

  .document-list-head,
  .document-row {
    grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 1fr) 90px 110px 110px;
  }

  .document-list-head > :last-child,
  .document-row > :last-child {
    display: none;
  }
}

@media (max-width: 760px) {
  .document-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .document-tabs {
    grid-column: 1 / -1;
  }

  .document-tabs button {
    flex: 1;
    min-width: 0;
  }

  .document-search {
    grid-column: 1 / -1;
  }

  .document-filter {
    min-width: 0;
  }

  .document-sync {
    grid-column: auto;
  }

  .document-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .document-stat,
  .document-stat:first-child {
    padding: 15px 12px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .document-stat:nth-child(2n) {
    border-right: 0;
  }

  .document-list-head {
    display: none;
  }

  .document-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 14px;
    padding: 16px 4px;
  }

  .document-row > :nth-child(2),
  .document-row > :nth-child(3),
  .document-row > :last-child {
    display: none;
  }

  .document-row > :nth-child(4) {
    grid-column: 1;
    grid-row: 2;
  }

  .document-row > :nth-child(5) {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .document-detail-list > div {
    grid-template-columns: minmax(105px, .8fr) minmax(0, 1.2fr);
    gap: 12px;
  }
}

/* ---------- Suivi des conversations ---------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.conv-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.conv-search {
  position: relative;
  flex: 1 1 260px;
  display: flex;
  align-items: center;
}

.conv-search svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

.conv-search input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
}

.conv-periods {
  display: flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.conv-periods button {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.conv-periods button:hover {
  color: var(--text);
}

.conv-periods button.active {
  background: var(--panel-soft);
  color: var(--green);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.conv-notice {
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--red);
  border-radius: 8px;
  background: var(--panel);
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.conv-notice strong {
  color: var(--text);
}

.conv-layout {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.conv-count {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.conv-list {
  display: grid;
  list-style: none;
  margin: 0;
  padding-left: 0;
  /* Colonne explicitement bornée : sans cela, une piste auto se dimensionne
     sur le contenu le plus large et pousse la liste hors de son cadre. */
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  max-height: min(640px, calc(100vh - 20rem));
  overflow-y: auto;
  /* Aucune barre horizontale : tout ce qui dépasse doit être tronqué, pas
     poussé hors du cadre. */
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

/* En grille, un enfant vaut par défaut min-content : un long libellé
   élargirait la colonne au lieu d'être tronqué. */
.conv-list > li {
  min-width: 0;
}

.conv-item {
  width: 100%;
  min-width: 0;
  color: var(--text);
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  text-align: left;
  cursor: pointer;
}

.conv-item:hover {
  border-color: var(--line-strong);
}

.conv-item[aria-pressed="true"] {
  border-color: var(--green);
  background: var(--panel-soft);
}

.conv-avatar {
  display: grid;
  place-content: center;
  height: 38px;
  border-radius: 8px;
  background: rgba(32, 214, 107, 0.1);
  border: 1px solid rgba(32, 214, 107, 0.28);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.conv-item-body {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

/* Un enfant de grille vaut min-content par défaut : un nom long refuserait
   de se laisser tronquer. */
.conv-item-body > * {
  min-width: 0;
}

.conv-item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.conv-item-head strong {
  font-size: 14px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-item-head time {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted-2);
  white-space: nowrap;
}

.conv-item-preview {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  min-width: 0;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.conv-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.conv-item-tags em {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}

.conv-thread {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  min-height: 420px;
  display: flex;
  flex-direction: column;
}

.conv-thread-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.conv-thread-head h2 {
  font-size: 20px;
  margin: 6px 0 0;
}

.conv-thread-contact {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.conv-thread-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.chip-green {
  color: var(--green);
  border-color: rgba(32, 214, 107, 0.4);
}

.chip-red {
  color: var(--red);
  border-color: rgba(255, 56, 72, 0.35);
}

.conv-stream {
  display: grid;
  gap: 14px;
  padding: 20px;
  max-height: min(620px, calc(100vh - 22rem));
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.conv-stream > * {
  min-width: 0;
}

.conv-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.conv-separator::before,
.conv-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.conv-message {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.conv-message.from-prospect {
  flex-direction: row-reverse;
}

.conv-message-avatar {
  display: grid;
  place-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid var(--line-strong);
  color: var(--muted);
}

.conv-message.from-assistant .conv-message-avatar {
  background: rgba(32, 214, 107, 0.12);
  border-color: rgba(32, 214, 107, 0.3);
  color: var(--green);
}

.conv-message > div {
  max-width: 78%;
}

.conv-message.from-prospect > div {
  margin-left: auto;
  text-align: right;
}

.conv-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: left;
}

.conv-message.from-assistant .conv-bubble {
  border-top-left-radius: 4px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  color: var(--text);
}

.conv-message.from-prospect .conv-bubble {
  border-top-right-radius: 4px;
  background: rgba(32, 214, 107, 0.12);
  border: 1px solid rgba(32, 214, 107, 0.28);
  color: var(--text);
}

.conv-message-time {
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted-2);
}

.conv-milestone {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  font-size: 12px;
  color: var(--muted);
}

.conv-milestone-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--yellow);
  flex-shrink: 0;
}

.conv-milestone time {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted-2);
  white-space: nowrap;
}

.conv-note {
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted-2);
  border-radius: 7px;
  background: var(--panel-soft);
  padding: 12px 14px;
}

.conv-note header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 6px;
}

.conv-note header strong {
  font-size: 13px;
}

.conv-note header time {
  font-size: 11px;
  color: var(--muted-2);
  white-space: nowrap;
}

.conv-note p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.conv-note footer {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted-2);
  font-style: italic;
}

.conv-placeholder {
  margin: auto;
  padding: 56px 24px;
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
  max-width: 44ch;
}

.conv-placeholder svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: var(--muted-2);
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.conv-placeholder strong {
  font-family: var(--heading);
  font-size: 17px;
}

.conv-placeholder p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}

.conv-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .conv-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .conv-list {
    max-height: 320px;
  }

  .conv-message > div {
    max-width: 88%;
  }
}

.conv-list::-webkit-scrollbar,
.conv-stream::-webkit-scrollbar {
  width: 6px;
  height: 0;
}

.conv-list::-webkit-scrollbar-track,
.conv-stream::-webkit-scrollbar-track {
  background: transparent;
}

.conv-list::-webkit-scrollbar-thumb,
.conv-stream::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 3px;
}

.conv-list::-webkit-scrollbar-thumb:hover,
.conv-stream::-webkit-scrollbar-thumb:hover {
  background: var(--muted-2);
}

.conv-milestone > span:not(.conv-milestone-dot) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-empty small {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted-2);
}

/* ---------- Analytics ---------- */

/*
 * Jetons de visualisation, distincts des couleurs de l'interface.
 *
 * Les teintes de marque (--green, --yellow, --orange) échouent comme palette
 * catégorielle sur fond sombre : vert et jaune ne sont séparables qu'à
 * ΔE 6 en protanopie. Les trois teintes ci-dessous sont validées pour ce
 * fond, y compris sur toutes les paires. Les couleurs de statut sont
 * réservées et toujours accompagnées de leur libellé.
 */
:root {
  --viz-serie-1: #3987e5;
  --viz-serie-2: #d95926;
  --viz-serie-3: #199e70;
  --viz-inconnu: #5b6067;
  --viz-good: #0ca30c;
  --viz-warning: #fab219;
  --viz-critical: #d03b3b;
}

.ana-notice {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--orange);
  border-radius: 8px;
  background: var(--panel);
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}

.ana-notice strong {
  color: var(--text);
}

.ana-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.ana-tile {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}

.ana-tile span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.ana-tile strong {
  display: block;
  font-family: var(--heading);
  font-size: 26px;
  line-height: 1.1;
}

.ana-tile small {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted-2);
}

/* Un indicateur non calculable ne se déguise pas en zéro. */
.ana-tile.absent strong {
  font-size: 17px;
  color: var(--muted);
}

.ana-chart {
  padding-top: 4px;
}

.ana-bars {
  display: grid;
  gap: 12px;
}

.ana-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  font-size: 12px;
}

.ana-bar-label {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ana-bar-track {
  height: 10px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.ana-bar-track i {
  display: block;
  height: 100%;
  border-radius: 5px;
  min-width: 4px;
}

.ana-bar-value {
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ana-trend {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 190px;
  padding-top: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.ana-trend-col {
  flex: 1 1 0;
  min-width: 54px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  height: 180px;
}

.ana-trend-value {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.ana-trend-bar {
  display: block;
  /* Plafonnée : avec deux ou trois périodes, une barre pleine largeur devient
     un pavé qui pèse plus lourd que la donnée qu'elle porte. */
  width: min(100%, 56px);
  margin: 0 auto;
  border-radius: 4px 4px 0 0;
  background: var(--viz-serie-1);
  align-self: end;
}

.ana-trend-label {
  font-size: 11px;
  color: var(--muted-2);
  text-align: center;
  white-space: nowrap;
}

.ana-hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted-2);
  font-style: italic;
}

@media (max-width: 720px) {
  .ana-bar-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .ana-bar-value {
    justify-self: start;
  }
}

/* ---------- Planning des interventions ---------- */

.plan-notice {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--orange);
  border-radius: 8px;
  background: var(--panel);
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}

.plan-notice strong { color: var(--text); }
.plan-notice.succes { border-left-color: var(--green); }

.plan-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.plan-tile {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}

.plan-tile span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.plan-tile strong { display: block; font-family: var(--heading); font-size: 26px; line-height: 1.1; }
.plan-tile small { display: block; margin-top: 6px; font-size: 11px; color: var(--muted-2); }
.plan-tile.alerte strong { color: var(--orange); }

.plan-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.plan-month {
  display: flex;
  align-items: center;
  gap: 10px;
}

.plan-month strong {
  min-width: 148px;
  font-family: var(--heading);
  font-size: 16px;
  text-transform: capitalize;
}

.plan-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 320px);
  gap: 16px;
  align-items: start;
}

.plan-grid-head {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.plan-grid-head span {
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.plan-cell {
  min-height: 92px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.plan-cell:hover { border-color: var(--line-strong); }
.plan-cell.hors-mois { opacity: 0.4; }
.plan-cell.aujourdhui { border-color: rgba(32, 214, 107, 0.45); }
.plan-cell.selection { border-color: var(--green); background: var(--panel-soft); }

.plan-cell-num {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.plan-cell.aujourdhui .plan-cell-num { color: var(--green); font-weight: 700; }

/* La pastille porte l'heure et le nom : la couleur du statut ne dit jamais
   seule de quoi il s'agit. */
.plan-pastille {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 5px;
  border-radius: 4px;
  border-left: 2px solid var(--muted-2);
  background: rgba(255, 255, 255, 0.04);
  font-size: 10px;
  color: var(--muted);
}

.plan-pastille.statut-planifiee { border-left-color: var(--viz-serie-1); }
.plan-pastille.statut-confirmee { border-left-color: var(--viz-good); }
.plan-pastille.statut-realisee { border-left-color: var(--muted-2); }
.plan-pastille.statut-annulee { border-left-color: var(--viz-critical); }

.plan-cell-plus { font-size: 10px; color: var(--muted-2); }

.plan-day {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 16px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.plan-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.plan-day-head h3 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: capitalize;
}

.plan-empty {
  font-size: 13px;
  color: var(--muted);
  padding: 16px 0;
}

.plan-item {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.plan-item:hover { border-color: var(--line-strong); }
.plan-item.statut-planifiee { border-left-color: var(--viz-serie-1); }
.plan-item.statut-confirmee { border-left-color: var(--viz-good); }
.plan-item.statut-realisee { border-left-color: var(--muted-2); }
.plan-item.statut-annulee { border-left-color: var(--viz-critical); }

.plan-item-heure { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.plan-item strong { font-size: 14px; overflow-wrap: anywhere; }
.plan-item-meta { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.plan-item-desc { font-size: 11px; color: var(--muted-2); line-height: 1.5; overflow-wrap: anywhere; }
.plan-item-statut {
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.plan-form {
  margin-top: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  padding: 20px;
  display: grid;
  gap: 16px;
}

.plan-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.plan-form-head h2 { font-size: 16px; }

.plan-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.plan-form .field { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }

.plan-form .field input,
.plan-form .field select {
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #080909;
  color: var(--text);
}

.plan-form .field textarea { min-height: 92px; }

.plan-notification {
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.plan-notification-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.plan-notification-choice input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--green);
}

.plan-notification-choice strong {
  display: block;
  font-size: 13px;
  color: var(--text);
}

.plan-notification-choice small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.plan-notification-choice:has(input:disabled) { cursor: default; opacity: 0.58; }

.plan-form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.plan-form-actions small { color: var(--muted); font-size: 12px; }
.action-ghost.danger { border-color: rgba(255, 56, 72, 0.35); color: var(--red); }

@media (max-width: 1020px) {
  .plan-layout { grid-template-columns: minmax(0, 1fr); }
  .plan-cell { min-height: 74px; }
}

@media (max-width: 720px) {
  .plan-toolbar { flex-direction: column; align-items: stretch; }
  .plan-month { justify-content: space-between; }
  .plan-month strong { min-width: 0; flex: 1; text-align: center; }
  .plan-create, .plan-toolbar .action-main { width: 100%; }
  .plan-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-cell { min-height: 58px; padding: 4px; }
  /* Sous cette largeur, une pastille lisible ne tient pas dans une case :
     le compte suffit, le détail se lit dans le panneau du jour. */
  .plan-pastille { font-size: 0; padding: 0; height: 4px; border-left: 0; border-radius: 2px; background: var(--viz-serie-1); }
  .plan-pastille.statut-confirmee { background: var(--viz-good); }
  .plan-pastille.statut-realisee { background: var(--muted-2); }
  .plan-pastille.statut-annulee { background: var(--viz-critical); }
}

/* ---------- Éditeur d'apparence de l'assistant ---------- */

.agent-config {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 20px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.agent-config-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.agent-config-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.agent-config-tabs button {
  flex: 1;
  min-width: 0;
  height: 32px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.agent-config-tabs button:hover { color: var(--text); }

.agent-config-tabs button.active {
  background: var(--panel);
  color: var(--green);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.agent-config-panel { display: none; }
.agent-config-panel.active { display: grid; gap: 12px; }

.agent-config .field { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }

.agent-config .field input[type="text"],
.agent-config .field input[type="url"],
.agent-config .field input[type="email"],
.agent-config .field textarea,
.agent-config .field select {
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #080909;
  color: var(--text);
}

.agent-config .field textarea {
  height: auto;
  min-height: 62px;
  padding: 9px 11px;
  line-height: 1.5;
  resize: vertical;
  font: inherit;
}
.agent-config .field b { color: var(--text); font-variant-numeric: tabular-nums; }

.look-color {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.look-color input[type="color"] {
  width: 46px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #080909;
  cursor: pointer;
}

.agent-config input[type="range"] {
  /* Le navigateur pose 2px de marge de chaque côté : avec width:100% cela
     déborde du panneau sur mobile. */
  width: 100%;
  margin: 0;
  accent-color: var(--green);
}

.look-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  cursor: pointer;
}

.look-toggle input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--green); }
.look-toggle strong { display: block; font-size: 13px; }
.look-toggle small { display: block; margin-top: 3px; font-size: 11px; line-height: 1.5; color: var(--muted); }

.agent-config-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.agent-config-actions small { color: var(--muted); font-size: 12px; }

.look-contrast {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.look-contrast.warn { color: var(--red); }

.agent-config-note {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted-2);
}

@media (max-width: 1020px) {
  .agent-admin-layout { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Actes commerciaux : devis et envoi ---------- */

.acte-form {
  display: grid;
  gap: 14px;
  margin: 16px 0 4px;
  padding: 19px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
}

.acte-intro { margin: 0; max-width: 72ch; font-size: 12.5px; line-height: 1.6; color: var(--muted); }

.acte-grille {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
}

.acte-form .field { display: grid; gap: 6px; font-size: 12px; color: var(--muted); min-width: 0; }

.acte-form input,
.acte-form select,
.acte-form textarea {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #080909;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.acte-form textarea { height: auto; padding: 9px 11px; line-height: 1.5; resize: vertical; }

.acte-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.acte-avert { font-size: 11.5px; line-height: 1.5; color: var(--muted); }

.acte-apercu {
  padding: 14px 16px;
  border: 1px solid rgba(32, 214, 107, 0.3);
  border-radius: 8px;
  background: rgba(32, 214, 107, 0.05);
}

.acte-lignes { display: grid; gap: 8px; margin: 0 0 10px; }
.acte-lignes > div { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; }
.acte-lignes dt { color: var(--muted); }
.acte-lignes dd { margin: 0; color: var(--text); font-variant-numeric: tabular-nums; }
.acte-montant { color: var(--green); font-weight: 600; font-size: 15px; }

.acte-impossible { margin: 0; font-size: 13px; line-height: 1.6; color: var(--yellow); }
.acte-retour { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
