/* Back office Kollekt — CSS maison sobre, sans framework ni build Node.
   Accent #696cff (couleur de kollekt-ui). */

:root {
  --bo-accent: #696cff;
  --bo-accent-dark: #5a5de0;
  --bo-accent-soft: #ececff;
  --bo-text: #2f3349;
  --bo-muted: #6d7086;
  --bo-border: #e4e5ec;
  --bo-bg: #f5f5f9;
  --bo-surface: #ffffff;
  --bo-danger: #d63c3c;
  --bo-danger-soft: #fdecec;
  --bo-success: #2e9e5b;
  --bo-success-soft: #e8f6ee;
  --bo-radius: 8px;
  --bo-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--bo-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--bo-text);
  background: var(--bo-bg);
}

a { color: var(--bo-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* --- En-tête et navigation --------------------------------------------- */

.bo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--bo-surface);
  border-bottom: 1px solid var(--bo-border);
}

.bo-brand {
  font-weight: 700;
  color: var(--bo-accent);
  margin: 0;
}

.bo-staff { display: flex; align-items: center; gap: 12px; }
.bo-staff-name { font-weight: 600; }

.bo-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bo-accent-soft);
  color: var(--bo-accent-dark);
}
.bo-badge-support { background: #eef0f4; color: var(--bo-muted); }

.bo-shell { display: flex; min-height: calc(100vh - 57px); }

.bo-nav {
  width: 230px;
  flex-shrink: 0;
  padding: 16px 12px;
  background: var(--bo-surface);
  border-right: 1px solid var(--bo-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bo-nav-section {
  margin: 16px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--bo-muted);
}

.bo-nav-link {
  display: block;
  padding: 8px 12px;
  border-radius: var(--bo-radius);
  color: var(--bo-text);
}
.bo-nav-link:hover { background: var(--bo-bg); text-decoration: none; }
.bo-nav-link.is-active { background: var(--bo-accent-soft); color: var(--bo-accent-dark); font-weight: 600; }
.bo-nav-link.is-disabled { color: #a9abbc; cursor: default; }
.bo-nav-link.is-disabled:hover { background: none; }

.bo-main { flex: 1; padding: 24px 32px; max-width: 1200px; }

/* --- Contenus ------------------------------------------------------------ */

.bo-title { font-size: 22px; margin: 0 0 16px; }
.bo-muted { color: var(--bo-muted); }
.bo-small { font-size: 13px; }

.bo-card {
  background: var(--bo-surface);
  border: 1px solid var(--bo-border);
  border-radius: var(--bo-radius);
  padding: 20px 24px;
}
.bo-empty { text-align: center; padding: 48px 24px; }

/* --- Formulaires et boutons ---------------------------------------------- */

.bo-form { display: flex; flex-direction: column; gap: 16px; margin: 16px 0; }
.bo-field { display: flex; flex-direction: column; gap: 6px; }
.bo-field label { font-weight: 600; font-size: 14px; }
.bo-field input,
.bo-field textarea {
  font: inherit;
  padding: 9px 12px;
  border: 1px solid var(--bo-border);
  border-radius: var(--bo-radius);
  background: var(--bo-surface);
}
.bo-field input:focus,
.bo-field textarea:focus { outline: 2px solid var(--bo-accent-soft); border-color: var(--bo-accent); }

.bo-button {
  font: inherit;
  font-weight: 600;
  padding: 9px 16px;
  border: 1px solid var(--bo-accent);
  border-radius: var(--bo-radius);
  background: var(--bo-accent);
  color: #fff;
  cursor: pointer;
}
.bo-button:hover { background: var(--bo-accent-dark); }
.bo-button-ghost { background: transparent; color: var(--bo-accent); padding: 6px 12px; }
.bo-button-ghost:hover { background: var(--bo-accent-soft); }
.bo-inline-form { display: inline; margin: 0; }

/* --- Messages flash ------------------------------------------------------ */

.bo-flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: var(--bo-radius);
  font-size: 14px;
}
.bo-flash-notice { background: var(--bo-success-soft); color: var(--bo-success); }
.bo-flash-alert { background: var(--bo-danger-soft); color: var(--bo-danger); }
.bo-flash-close {
  border: 0;
  background: none;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

/* --- Écrans de connexion ------------------------------------------------- */

.bo-auth-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.bo-auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bo-surface);
  border: 1px solid var(--bo-border);
  border-radius: var(--bo-radius);
  padding: 32px;
}
.bo-auth-card .bo-brand { margin-bottom: 20px; }
.bo-qrcode { display: flex; justify-content: center; margin: 16px 0; }
.bo-secret { word-break: break-all; }

/* --- Administration : listes, fiches, journal (E1-S2) -------------------- */

.bo-page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.bo-page-header .bo-title { margin: 0; }
.bo-subtitle { font-size: 17px; margin: 28px 0 12px; }
.bo-card-flush { padding: 0; overflow-x: auto; }
.bo-card-narrow { max-width: 560px; }
.bo-card-footer { margin: 0; padding: 12px 16px; border-top: 1px solid var(--bo-border); font-size: 14px; }

.bo-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.bo-table th, .bo-table td { padding: 10px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--bo-border); }
.bo-table th { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--bo-muted); background: #fafafc; }
.bo-table tbody tr:last-child td { border-bottom: 0; }
.bo-nowrap { white-space: nowrap; }
.bo-changes { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-word; }

.bo-status { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.bo-status-success { background: var(--bo-success-soft); color: var(--bo-success); }
.bo-status-danger { background: var(--bo-danger-soft); color: var(--bo-danger); }
.bo-status-warning { background: #fff4e0; color: #a5650a; }

.bo-details { display: grid; grid-template-columns: 220px 1fr; gap: 10px 16px; margin: 0; }
.bo-details dt { font-weight: 600; color: var(--bo-muted); }
.bo-details dd { margin: 0; }

.bo-action-list { padding: 0; }
.bo-action { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--bo-border); }
.bo-action:last-child { border-bottom: 0; }
.bo-action p { margin: 4px 0 0; }
.bo-action form { margin: 0; flex-shrink: 0; }
.bo-actions { display: flex; align-items: center; gap: 16px; }

.bo-button-danger { background: var(--bo-danger); border-color: var(--bo-danger); padding: 6px 12px; }
.bo-button-danger:hover { background: #b83232; }

/* Rattachements (fiche utilisateur) : colonne d'action et formulaire sous le tableau. */
.bo-table .bo-cell-action { width: 1%; white-space: nowrap; text-align: right; vertical-align: middle; }
.bo-card-flush > .bo-table + .bo-action,
.bo-card-flush > .bo-empty + .bo-action { border-top: 1px solid var(--bo-border); }
.bo-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; }

.bo-field select {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--bo-border);
  border-radius: var(--bo-radius);
  background: var(--bo-surface);
}
.bo-error-list { margin: 0; padding-left: 18px; }

.bo-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 16px; }
.bo-filters .bo-field { min-width: 160px; }
.bo-filters-actions { display: flex; align-items: center; gap: 12px; }
.bo-field-checks { flex-direction: row; align-items: center; gap: 16px; min-height: 38px; }
.bo-field-checks label { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.bo-field-checks input { padding: 0; }
.bo-field textarea { min-width: 280px; resize: vertical; }

/* --- Sociétés (E3-S1) ------------------------------------------------------ */

.bo-table .bo-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bo-status-info { background: var(--bo-accent-soft); color: var(--bo-accent-dark); }
.bo-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px 20px; margin: 0; }
.bo-form-grid .bo-field-wide { grid-column: 1 / -1; }
.bo-form-grid > p { margin: 0; }
.bo-field-checks-column { flex-direction: column; align-items: flex-start; gap: 8px; }

.bo-pagination { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 16px 0; font-size: 14px; }

@media (max-width: 720px) {
  .bo-shell { flex-direction: column; }
  .bo-nav { width: auto; border-right: 0; border-bottom: 1px solid var(--bo-border); }
  .bo-main { padding: 16px; }
  .bo-details { grid-template-columns: 1fr; }
  .bo-action { flex-direction: column; align-items: flex-start; }
}

/* --- Connecteurs (E3-S2) --------------------------------------------------- */

.bo-log-details + .bo-log-details { margin-top: 8px; }
.bo-log-details summary { cursor: pointer; font-weight: 600; }
.bo-log-details .bo-table { margin-top: 8px; }
.bo-table-compact th, .bo-table-compact td { padding: 6px 8px; }
.bo-pre { white-space: pre-wrap; word-break: break-word; }

/* --- Filiales Endrix (E3-S3) ----------------------------------------------- */

.bo-tabs { display: flex; gap: 4px; margin: -4px 0 16px; border-bottom: 1px solid var(--bo-border); }
.bo-tab { padding: 8px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--bo-muted); font-weight: 600; }
.bo-tab:hover { color: var(--bo-text); text-decoration: none; }
.bo-tab.is-active { color: var(--bo-accent-dark); border-bottom-color: var(--bo-accent); }

/* --- Onboarding Endrix (E4-S1) --------------------------------------------- */

.bo-notice { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--bo-radius); font-size: 14px; }
.bo-notice-warning { background: #fff4e0; color: #8a5300; }
.bo-funnel-totals { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 0 0 16px; }
.bo-funnel-totals > div { padding: 12px 16px; background: var(--bo-surface); border: 1px solid var(--bo-border); border-radius: var(--bo-radius); }
.bo-funnel-totals dt { font-size: 13px; color: var(--bo-muted); }
.bo-funnel-totals dd { margin: 4px 0 0; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
