/* Spec04 — Artefacts. Consultation mobile-first + écrans viewer/admin. */

.art-file-download {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 100%;
  min-height: 300px;
  color: var(--fg-muted);
}
.art-file-download svg { opacity: .4; }
.art-file-name { font-size: 15px; font-weight: 600; color: var(--fg); }
.art-no-download { font-size: 13px; color: var(--fg-muted); opacity: .6; font-style: italic; }

.btn-gold {
  background: #BB984D;
  color: #FAF7F0;
  border: none;
}
.btn-gold:hover:not(:disabled) { background: #a8863d; }
.btn-gold:disabled { opacity: .6; cursor: default; }

/* ----------------------------------------------------- Viewer landing */
.viewer-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-page);
  z-index: 40; /* sous les overlays dashboards (50) / artefacts (60) */
  display: flex;
  flex-direction: column;
}
.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  background: var(--header-bg);
  color: var(--header-fg);
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 2px 8px rgba(60, 40, 10, 0.10);
}
.viewer-header .brand {
  color: var(--header-fg);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
}
.viewer-header .user-box { color: var(--fg-muted); }
.viewer-header .btn-ghost { color: rgba(255,255,255,0.88); }
.viewer-header .btn-ghost:hover:not(:disabled) {
  background: rgba(255,255,255,0.15);
  color: #ffffff;
}
.viewer-menu {
  flex: 1;
  padding: 24px 16px;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}
.viewer-greeting {
  color: var(--fg);
  margin-bottom: 28px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.viewer-greeting strong { color: var(--gold); }
.viewer-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.viewer-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg-alt);
  cursor: pointer;
  font: inherit;
  color: var(--fg);
  transition: border-color .15s, transform .05s;
}
.viewer-tile:hover { border-color: var(--accent); }
.viewer-tile:active { transform: scale(.99); }
.vt-icon { font-size: 38px; }
.vt-label { font-size: 16px; font-weight: 600; color: var(--accent); }
.viewer-tile { border-color: var(--border); }
.viewer-tile:hover { border-color: var(--gold); }

/* ----------------------------------------------------- Consultation */
.artifacts-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-page);
  z-index: 45; /* base "page d'accueil" : Dashboards (50) / modales s'ouvrent par-dessus */
  display: flex;
  flex-direction: column;
}
.artifacts-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  color: var(--header-fg);
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 2px 8px rgba(60, 40, 10, 0.10);
}
.artifacts-header h1 {
  font-size: 18px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--header-fg);
}
.artifacts-header .btn-ghost { color: rgba(255,255,255,0.88); }
.artifacts-header .btn-ghost:hover:not(:disabled) {
  background: rgba(255,255,255,0.15);
  color: #ffffff;
}
.artifacts-content { flex: 1; overflow: auto; width: 100%; min-width: 0; }

/* Contenu pleine largeur */
.cockpit-wrap {
  padding: 24px 32px 48px;
  width: 100%;
  box-sizing: border-box;
}
.art-group { margin-bottom: 32px; width: 100%; }

.art-empty { padding: 32px 16px; color: var(--fg-muted); text-align: center; }
.art-empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--fg-muted);
}
.art-empty-icon { font-size: 44px; opacity: .5; margin-bottom: 12px; }
.art-empty-state h2 { font-size: 18px; color: var(--fg); margin: 0 0 6px; font-weight: 600; }
.art-empty-state p { margin: 0; font-size: 14px; }

/* .art-group défini plus haut avec width: 100% */
.art-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 2px 14px;
}
.art-group-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  color: var(--fg-muted);
  margin: 0;
}
.art-group-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  line-height: 1.6;
}

.art-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 1100px) { .art-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .art-grid { grid-template-columns: 1fr; } }

/* Carte — layout horizontal, plus grande, avec shimmer */
.art-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 18px;
  padding: 24px 22px;
  min-height: 110px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
  box-shadow: var(--shadow);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
  outline: none;
}

/* Shimmer au survol */
.art-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 20%, rgba(187, 152, 77, 0.07) 50%, transparent 80%);
  transform: translateX(-100%);
  transition: transform 0.55s ease;
  pointer-events: none;
}
.art-card:hover::before { transform: translateX(100%); }

.art-card:hover,
.art-card:focus-visible {
  border-color: var(--gold);
  box-shadow: 0 8px 32px rgba(187, 152, 77, 0.18);
  transform: translateY(-4px);
}
.art-card:active { transform: translateY(-1px); transition-duration: 0.08s; }
.art-card.is-empty { cursor: default; opacity: .5; box-shadow: none; }
.art-card.is-empty:hover { border-color: var(--border); box-shadow: none; transform: none; }
.art-card.is-empty::before { display: none; }

.art-card-icon {
  flex: none;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  transition: transform 0.25s ease, background 0.25s ease;
}
.art-card:hover .art-card-icon {
  transform: scale(1.1);
}

.art-card-body {
  flex: 1;
  min-width: 0;
}

.art-card-dept {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  opacity: 0.8;
  margin-bottom: 4px;
}
.art-card-name {
  font-family: var(--font-brand);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}
.art-card-desc {
  font-size: 12.5px;
  color: var(--fg-muted);
  margin-top: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}
.art-card-meta {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 8px;
  opacity: .75;
  letter-spacing: 0.02em;
}
.art-card-arrow {
  flex: none;
  align-self: center;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  transition: transform 0.2s ease, color 0.2s ease, opacity 0.2s ease;
  opacity: 0.4;
}
.art-card:hover .art-card-arrow,
.art-card:focus-visible .art-card-arrow {
  transform: translateX(5px);
  color: var(--gold);
  opacity: 1;
}

/* Viewer (iframe) */
.art-viewer { display: flex; flex-direction: column; height: 100%; }
.art-viewer-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}
.art-version-pick { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-muted); }
.art-version-pick .input { width: auto; min-width: 200px; }
.art-version-meta { font-size: 12px; color: var(--fg-muted); }
.art-frame-wrap { position: relative; flex: 1; min-height: 0; background: var(--bg-alt); }
.art-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #fff;
}
.art-frame-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  background: var(--bg);
}

/* ----------------------------------------------------- Admin */
.dept-transversal-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  white-space: nowrap;
}
.art-admin-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.art-admin-toolbar label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.art-admin-list { display: flex; flex-direction: column; gap: 14px; }
.art-admin-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px;
  background: var(--bg-alt);
}
.art-admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.art-admin-name { font-weight: 600; }
.art-admin-desc { font-size: 13px; color: var(--fg-muted); margin-top: 2px; }
.art-admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.art-upload-label { cursor: pointer; }
.art-admin-noversion { margin-top: 10px; color: var(--fg-muted); font-size: 13px; }
.art-version-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
.art-version-table th, .art-version-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.art-version-table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.art-badge-current {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--success);
  color: #fff;
  margin-left: 4px;
}

/* Badge "Accès total" pour les admins (caps non applicables) */
.cap-badge-all {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  white-space: nowrap;
}
.cap-badge-editor {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(80, 140, 100, 0.15);
  color: #4d9b65;
  border: 1px solid rgba(80, 140, 100, 0.35);
  white-space: nowrap;
}
.caps-cell label { display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; font-size: 13px; cursor: pointer; }

/* Sélecteur multi (cases à cocher + filtre) */
.picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1100; /* modale de 1er plan : au-dessus du Report Builder (1000) et de tout overlay */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.picker-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  width: min(480px, 100%);
  max-height: min(70vh, 600px);
  display: flex;
  flex-direction: column;
}
.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.picker-head h3 { margin: 0; font-size: 16px; }
.picker-sub { padding: 10px 16px 0; margin: 0; color: var(--fg-muted); font-size: 13px; }
.picker-filter { margin: 12px 16px; width: calc(100% - 32px); }
.picker-list { flex: 1; overflow: auto; padding: 0 8px; }
.picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-radius: var(--radius-input);
  cursor: pointer;
}
.picker-item:hover { background: var(--bg-alt); }
.picker-item-sub { color: var(--fg-muted); font-style: normal; font-size: 12px; }
.picker-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.picker-count { color: var(--fg-muted); font-size: 12px; }

/* Menu Cockpit (hamburger + dropdown) */
.cockpit-nav { position: relative; flex: none; }
.cockpit-menu-btn { font-size: 18px; line-height: 1; }
.cockpit-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 210px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  z-index: 70;
}
.cockpit-menu-item {
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  color: var(--fg);
  padding: 10px 12px;
  border-radius: 8px;
}
.cockpit-menu-item:hover { background: var(--bg-alt); }
.cockpit-menu-item.is-danger { color: var(--danger); }

/* Header admin (#app) : éviter le débordement sur petit écran */
@media (max-width: 760px) {
  .header { flex-wrap: wrap; height: auto; row-gap: 6px; padding-top: 8px; padding-bottom: 8px; }
  .header .user-box { flex-wrap: wrap; gap: 6px; }
}

/* Header actions (viewer) + responsable */
.artifacts-actions { margin-left: auto; }
.art-owner { font-size: 12px; color: var(--fg-muted); margin-left: auto; }
.art-admin-owner { font-size: 12px; color: var(--fg-muted); margin-top: 4px; }

/* Panneau de commentaires */
.comments-card { width: min(520px, 100%); max-height: min(80vh, 680px); }
.comments-list { flex: 1; overflow: auto; padding: 8px 16px; display: flex; flex-direction: column; gap: 12px; }
.cm-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 10px 12px;
  background: var(--bg-alt);
}
.cm-meta { font-size: 12px; color: var(--fg-muted); margin-bottom: 4px; }
.cm-meta em { font-style: italic; }
.cm-ver {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 6px;
  margin-left: 2px;
}
.cm-body { font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.cm-tomb { color: var(--fg-muted); font-style: italic; }
.cm-deleted { opacity: .7; }
.cm-actions { display: flex; gap: 6px; margin-top: 8px; }
.cm-actions .btn { font-size: 12px; padding: 2px 8px; }
.cm-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.cm-form textarea { flex: 1; resize: vertical; }

/* Modale de formulaire */
.fm-form { padding: 14px 16px 0; display: flex; flex-direction: column; gap: 14px; }
.fm-field { display: flex; flex-direction: column; gap: 6px; }
.fm-label { font-size: 13px; font-weight: 600; color: var(--fg-muted); }
.fm-req { color: var(--danger); font-style: normal; }
.fm-error { margin: 0; }
.fm-form .picker-foot { margin: 4px -16px 0; }

/* Browser SharePoint */
.sp-browser { width: min(680px, 100%) !important; max-height: min(82vh, 740px) !important; }
.sp-breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 8px 16px; background: var(--bg-alt); border-bottom: 1px solid var(--border); font-size: 13px; min-height: 38px; }
.sp-crumb { background: none; border: none; padding: 2px 6px; border-radius: 4px; cursor: pointer; color: var(--accent, #BB984D); font-size: 13px; font-family: inherit; }
.sp-crumb:hover { background: var(--bg); }
.sp-crumb-active { color: var(--fg); font-weight: 600; cursor: default; padding: 2px 6px; }
.sp-crumb-sep { color: var(--fg-muted); padding: 0 2px; }
.sp-file-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
.sp-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-input, 6px); }
.sp-item-folder { cursor: pointer; }
.sp-item-folder:hover { background: var(--bg-alt); }
.sp-item-file { cursor: pointer; }
.sp-item-file:hover { background: var(--bg-alt); }
.sp-item-other { opacity: 0.38; }
.sp-item-icon { font-size: 16px; flex-shrink: 0; }
.sp-item-name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-item-arrow { color: var(--fg-muted); font-size: 18px; font-weight: 300; }
.sp-item-meta { font-size: 11px; color: var(--fg-muted); white-space: nowrap; flex-shrink: 0; }
.sp-sel-bar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--border); background: var(--bg-alt); font-size: 13px; flex-shrink: 0; }
.sp-sel-count { flex: 1; font-weight: 600; }
.sp-note-row { padding: 10px 16px 0; flex-shrink: 0; }
.sp-select-all-row { padding: 6px 10px 6px; font-size: 13px; border-bottom: 1px solid var(--border); margin-bottom: 2px; }
.sp-select-all-row label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.sp-empty, .sp-spinner { padding: 28px; text-align: center; color: var(--fg-muted); font-size: 13px; }

/* Mobile : tables admin scrollables */
@media (max-width: 640px) {
  .art-version-table { display: block; overflow-x: auto; }
  .art-viewer-bar { gap: 8px; }
}

/* Badge "Publiée" pour la version courante */
.art-badge-published {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #2d7a4f;
  color: #fff;
  margin-left: 5px;
  font-weight: 500;
}

/* === Modal "Transformer avec Claude" — chat-like === */
.tr-modal {
  width: min(560px, 95vw) !important;
  max-height: min(82vh, 680px) !important;
  display: flex;
  flex-direction: column;
}
.tr-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.tr-art-info {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tr-art-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.tr-art-desc {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.5;
}
.tr-input-wrap {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.tr-textarea {
  flex: 1;
  min-height: 90px;
  resize: none;
  font-size: 13px;
}
.tr-send-btn { align-self: flex-end; }
.tr-progress-bar {
  height: 3px;
  background: var(--border);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.tr-progress-fill {
  height: 100%;
  background: var(--gold, #BB984D);
  width: 0;
  transition: width 0.4s ease;
}
.tr-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 12px;
  color: var(--fg-muted);
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
@keyframes tr-spin { to { transform: rotate(360deg); } }
.tr-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--gold, #BB984D);
  border-radius: 50%;
  animation: tr-spin 0.8s linear infinite;
  flex-shrink: 0;
}
.tr-stream-pre {
  flex: 1;
  overflow: auto;
  margin: 0;
  padding: 12px 16px;
  font-size: 10.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--fg-muted);
  background: var(--bg-alt);
  font-family: 'Courier New', Courier, monospace;
}
.tr-center {
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 24px;
  text-align: center;
}
.tr-done-icon { font-size: 42px; line-height: 1; }
.tr-done-title { font-size: 16px; font-weight: 700; }
.tr-done-sub { font-size: 13px; color: var(--fg-muted); }
.tr-errmsg { font-size: 13px; color: #c0392b; max-width: 380px; line-height: 1.5; }

/* ================================================================
   COCKPIT — DESIGN PREMIUM
   ================================================================ */

/* Header Cockpit — logo Pairi Daiza (mode compact : viewer) */
.artifacts-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.artifacts-brand .brand-logo {
  height: 28px;
  width: 28px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.85;
  flex-shrink: 0;
}

/* Header mode accueil — greeting intégré, plus haut */
.artifacts-header.is-home {
  height: auto;
  padding: 18px 28px 16px;
  gap: 16px;
  flex-wrap: nowrap;
  align-items: center;
}
.artifacts-header.is-home .artifacts-brand {
  flex: none;
}
.artifacts-header.is-home .artifacts-brand h1 {
  display: none;
}

/* Zone greeting dans le header */
.artifacts-greeting {
  flex: 1;
  min-width: 0;
  animation: fadeIn 0.35s ease;
}
.cockpit-eyebrow {
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.38em;
  color: rgba(187, 152, 77, 0.75);
  margin: 0 0 4px;
  text-transform: uppercase;
}
.cockpit-greeting {
  font-family: var(--font-brand);
  font-size: clamp(22px, 3.5vw, 34px);
  font-weight: 600;
  color: var(--header-fg);
  margin: 0 0 3px;
  line-height: 1.1;
}
.cockpit-greeting span {
  color: var(--gold);
  font-style: italic;
}
.cockpit-date {
  font-family: var(--font-body);
  font-size: 11px;
  color: rgba(250, 247, 240, 0.42);
  letter-spacing: 0.07em;
  margin: 0;
}

/* === Onglets de navigation par département === */
.dept-tabs {
  display: flex;
  gap: 0;
  padding: 0 40px;
  border-bottom: 2px solid var(--border);
  background: var(--bg);
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}
.dept-tabs::-webkit-scrollbar { display: none; }

.dept-tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 14px 18px;
  font: inherit;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: color 0.15s, border-color 0.15s;
}
.dept-tab:hover { color: var(--fg); }
.dept-tab.is-active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  font-weight: 600;
}
.dept-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-alt);
  color: var(--fg-muted);
  transition: background 0.15s, color 0.15s;
}
.dept-tab.is-active .dept-tab-count {
  background: rgba(187, 152, 77, 0.15);
  color: var(--gold);
}

@media (max-width: 600px) {
  .dept-tabs { padding: 0 12px; }
  .dept-tab  { padding: 12px 12px; font-size: 13px; }
}

/* === Animation d'entrée décalée === */
.art-card { animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
.art-grid .art-card:nth-child(1)  { animation-delay: 0.00s; }
.art-grid .art-card:nth-child(2)  { animation-delay: 0.07s; }
.art-grid .art-card:nth-child(3)  { animation-delay: 0.14s; }
.art-grid .art-card:nth-child(4)  { animation-delay: 0.21s; }
.art-grid .art-card:nth-child(5)  { animation-delay: 0.28s; }
.art-grid .art-card:nth-child(6)  { animation-delay: 0.35s; }
.art-grid .art-card:nth-child(7)  { animation-delay: 0.42s; }
.art-grid .art-card:nth-child(8)  { animation-delay: 0.49s; }
.art-grid .art-card:nth-child(9)  { animation-delay: 0.56s; }
.art-grid .art-card:nth-child(10) { animation-delay: 0.63s; }
.art-grid .art-card:nth-child(11) { animation-delay: 0.70s; }
.art-grid .art-card:nth-child(12) { animation-delay: 0.77s; }

/* Icône — couleurs or */
.art-card-icon {
  background: rgba(187, 152, 77, 0.08);
  border-color: rgba(187, 152, 77, 0.20);
  color: var(--gold);
}
.art-card:hover .art-card-icon {
  background: rgba(187, 152, 77, 0.16);
  border-color: rgba(187, 152, 77, 0.45);
}
.art-card.is-empty .art-card-icon {
  background: transparent;
  border-color: var(--border);
  color: var(--fg-muted);
  opacity: 0.45;
}

/* === En-têtes de département premium === */
.art-group-head {
  border-left: 2px solid var(--gold);
  padding-left: 12px;
}
.art-group-title {
  font-family: var(--font-brand);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--fg);
}
.art-group-count {
  background: rgba(187, 152, 77, 0.10);
  border-color: rgba(187, 152, 77, 0.28);
  color: var(--gold);
  font-weight: 600;
}

/* === Menu burger amélioré === */
.cockpit-menu-btn {
  font-size: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.cockpit-menu-btn::before {
  content: '';
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor, 0 -5px 0 currentColor;
}
.cockpit-menu {
  min-width: 220px;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}
.cockpit-menu-item {
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 14px;
}
.cockpit-menu-item:hover {
  background: var(--bg-alt);
  color: var(--gold);
}

/* === Viewer bar premium === */
.art-viewer-bar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.art-version-pick .input {
  border-radius: 8px;
}

/* === Mobile === */
@media (max-width: 600px) {
  .cockpit-wrap { padding: 16px 12px 32px; }
  .art-card { animation-delay: 0s !important; }
}

/* ===================================================== Template cockpit */
.tpl-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0;
}

.tpl-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.tpl-status-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  color: var(--text-muted, #6b7280);
}

.tpl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tpl-dot--none   { background: #d1d5db; }
.tpl-dot--active { background: #22c55e; }

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

.tpl-upload-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.tpl-upload-progress {
  font-size: .85rem;
  color: var(--text-muted, #6b7280);
  padding: 6px 0;
}

.tpl-preview-label {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted, #6b7280);
  margin-bottom: 8px;
}

.tpl-preview-frame {
  width: 100%;
  height: 420px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: #fff;
}

.tpl-empty {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted, #6b7280);
}
.tpl-empty p { margin-bottom: 8px; }
.tpl-empty-hint {
  font-size: .83rem;
  line-height: 1.5;
}
.tpl-empty-hint code {
  background: var(--bg-surface, #f3f4f6);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: .8rem;
}

/* ================================================================
   ADMIN SCREEN — Plein écran avec sidebar
   ================================================================ */

.admin-screen {
  position: fixed;
  inset: 0;
  display: flex;
  z-index: 80;
  background: var(--bg-page);
  overflow: hidden;
}

/* ----- Sidebar ----- */
.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--header-bg);
  color: var(--header-fg);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.admin-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.admin-sidebar-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.75;
  flex-shrink: 0;
}
.admin-sidebar-title {
  font-family: var(--font-brand);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--header-fg);
  line-height: 1.2;
}
.admin-sidebar-sub {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.85;
  margin-top: 2px;
}

.admin-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(250, 247, 240, 0.62);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.admin-nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--header-fg);
}
.admin-nav-item.is-active {
  background: rgba(187, 152, 77, 0.18);
  color: var(--gold);
}
.admin-nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.85;
}

.admin-sidebar-footer {
  padding: 14px 10px 18px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.admin-back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(250, 247, 240, 0.5);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.admin-back-btn:hover {
  color: var(--header-fg);
  background: rgba(255,255,255,0.07);
}

/* ----- Main area ----- */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--bg-page);
}

.admin-main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  gap: 16px;
}
.admin-main-header h1 {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--fg);
}
.admin-section-actions {
  display: flex;
  gap: 8px;
}

.admin-panel {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ----- Cards ----- */
.admin-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
}
.admin-card-title {
  margin: 0 0 6px;
  font-family: var(--font-brand);
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
}
.admin-card-desc {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.5;
}

/* ----- Forms ----- */
.admin-add-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-add-form input.input,
.admin-add-form select.input {
  flex: 1;
  min-width: 160px;
}
.admin-add-card { background: var(--bg); }
.admin-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.admin-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.admin-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.admin-settings-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--fg-muted);
}
.admin-settings-grid label strong { color: var(--fg); }
.admin-form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.admin-status-msg { font-size: 13px; color: var(--fg-muted); }
.admin-status-msg.is-error { color: var(--danger); }

/* ----- User table ----- */
.admin-search-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.admin-search-bar .input { max-width: 320px; }
.admin-user-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}
.stat-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 11.5px;
}
.stat-pill.stat-admin { background: rgba(34,31,23,0.08); color: var(--accent); border-color: rgba(34,31,23,0.2); }
.stat-pill.stat-editor { background: rgba(80,140,100,0.08); color: #4d9b65; border-color: rgba(80,140,100,0.25); }
.stat-pill.stat-filter { background: rgba(187,152,77,0.1); color: var(--gold); border-color: rgba(187,152,77,0.3); }
@media (prefers-color-scheme: dark) {
  .stat-pill.stat-admin { background: rgba(187,152,77,0.1); color: var(--gold); border-color: rgba(187,152,77,0.25); }
}
.admin-table-wrap {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th {
  position: sticky;
  top: 0;
  background: var(--bg-alt);
  border-bottom: 2px solid var(--border);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-muted);
  white-space: nowrap;
  z-index: 1;
}
.admin-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tr:hover td { background: rgba(187,152,77,0.04); }
.admin-table .actions { text-align: right; white-space: nowrap; }
.admin-table th:last-child,
.admin-table td:last-child { width: 52px; min-width: 52px; }
.upn-cell {
  cursor: pointer;
  font-family: monospace;
  font-size: 12px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upn-cell.is-copied { color: var(--gold); }
.caps-cell { vertical-align: middle; min-width: 140px; }
.dept-chip {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(187,152,77,0.1);
  border: 1px solid rgba(187,152,77,0.3);
  color: var(--gold);
  margin: 1px 2px;
}
.role-select {
  font-size: 12px;
  padding: 3px 6px;
  border-radius: 5px;
  width: auto;
  min-width: 80px;
}
.cap-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  cursor: pointer;
  margin-right: 6px;
}
.dept-edit-btn { font-size: 12px; padding: 2px 8px; }
.self-tag { font-size: 11px; color: var(--fg-muted); font-style: italic; }

/* ----- Dept cards ----- */
.dept-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.dept-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  transition: border-color 0.2s;
}
.dept-card:hover { border-color: var(--gold); }
.dept-card.is-transversal { border-color: rgba(187,152,77,0.4); }
.dept-card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.dept-card-name { font-size: 15px; font-weight: 600; color: var(--fg); margin: 0; }
.dept-badge-transversal {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; padding: 3px 8px; border-radius: 999px;
  background: rgba(187,152,77,0.15); color: var(--gold); border: 1px solid rgba(187,152,77,0.35);
}
.dept-card-stats { display: flex; gap: 16px; margin-bottom: 14px; }
.dept-stat { font-size: 12px; color: var(--fg-muted); display: flex; align-items: center; gap: 5px; }
.dept-card-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.dept-toggle-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer; color: var(--fg-muted); }
.dept-card-actions { display: flex; gap: 6px; }
.dept-empty { text-align: center; padding: 48px 24px; color: var(--fg-muted); }
.dept-empty p { margin: 8px 0 0; font-size: 13px; }

/* Config cockpit par département — section dépliable dans les cartes */
.dept-cockpit-details {
  border-top: 1px solid var(--border);
  margin: 12px -1px 0;
  padding: 0 1px;
}
.dept-cockpit-summary {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--fg-muted);
  padding: 8px 0; cursor: pointer; list-style: none; user-select: none;
}
.dept-cockpit-summary::-webkit-details-marker { display: none; }
.dept-cockpit-summary:hover { color: var(--fg); }
.dept-cockpit-badge {
  font-size: 11px; font-weight: 700; padding: 1px 6px;
  border-radius: 999px; margin-left: 2px;
}
.dept-ck-ok      { background: rgba(40,160,80,.12); color: #1a9450; }
.dept-ck-partial { background: rgba(200,160,40,.12); color: #a07010; }
.dept-ck-warn    { background: rgba(200,80,40,.12); color: #c25020; }

/* Liste multi-templates */
.tpl-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.tpl-toolbar .admin-card-desc { flex: 1; min-width: 200px; }
.tpl-list { display: flex; flex-direction: column; gap: 10px; }
.tpl-item { display: flex; align-items: center; gap: 16px; padding: 14px 18px; }
.tpl-item-info { flex: 1; min-width: 0; }
.tpl-item-name { font-size: 14px; font-weight: 600; color: var(--fg); display: block; }
.tpl-item-meta { font-size: 12px; color: var(--fg-muted); }
.tpl-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.dept-cockpit-body { padding: 10px 0 14px; display: flex; flex-direction: column; gap: 14px; }
.dept-ck-row { display: flex; flex-direction: column; gap: 6px; }
.dept-ck-label { font-size: 11.5px; font-weight: 600; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .03em; }
.dept-ck-actions { display: flex; gap: 6px; }
.dept-ck-sp-row { display: flex; gap: 6px; }
.dept-ck-sp-input { flex: 1; font-size: 12px; }
.dept-ck-info { font-size: 11.5px; color: var(--fg-muted); font-style: italic; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.dept-create-wrap { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }

/* ----------------------------------------------------- Config cockpit par artefact */
.art-ck-config { border-top: 1px solid var(--border); margin-top: 12px; }
.art-ck-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 8px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-muted);
  list-style: none;
  user-select: none;
}
.art-ck-summary::-webkit-details-marker { display: none; }
.art-ck-summary:hover { color: var(--fg); }
.art-ck-body { padding: 12px 0 4px; display: flex; flex-direction: column; gap: 12px; }
.art-ck-row { display: flex; flex-direction: column; gap: 4px; }
.art-ck-label { font-size: 11.5px; font-weight: 600; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .04em; }
.art-ck-field-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.art-ck-field-row .input { flex: 1; min-width: 180px; font-size: 13px; }
.art-ck-sp-display { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.art-ck-sp-path { font-family: monospace; font-size: 11px; background: var(--surface-raised, #f0ebe0); padding: 2px 7px; border-radius: 4px; white-space: nowrap; }
.art-ck-sp-count { font-size: 11px; color: #8a8270; margin-right: 4px; white-space: nowrap; }
.art-ck-sp-none { font-size: 12px; opacity: .5; }
.art-ck-badge { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.art-ck-badge-ok      { background: rgba(40,160,80,.12); color: #1a9450; }
.art-ck-badge-partial { background: rgba(200,160,40,.12); color: #a07010; }
.art-ck-badge-warn    { background: rgba(200,80,40,.12); color: #c25020; }

/* ----------------------------------------------------- Paramètres */
.settings-card { margin-bottom: 20px; }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-of-type { border-bottom: none; }
.settings-row-label { display: flex; flex-direction: column; gap: 2px; }
.settings-label { font-size: 13.5px; font-weight: 600; color: var(--fg); }
.settings-hint { font-size: 12px; color: var(--fg-muted); }
.settings-theme-btns { display: flex; gap: 8px; }
.settings-theme-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--fg-muted);
  border-radius: 8px;
  transition: border-color .15s, color .15s;
}
.settings-theme-btn.is-active {
  border-color: var(--gold);
  color: var(--fg);
  background: var(--bg-alt);
}
.settings-lang-select { width: auto; min-width: 140px; font-size: 13px; }

/* ----------------------------------------------------- Cockpit admin panel sections */
.ck-admin-section { margin-bottom: 36px; }
.ck-admin-section-title { font-size: 15px; font-weight: 700; color: var(--fg); margin: 0 0 4px; }

.ck-dept-config-list { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.ck-dept-row { padding: 18px 20px; }
.ck-dept-row-name { font-size: 14px; font-weight: 600; color: var(--fg); margin-bottom: 14px; }
.ck-dept-row-fields { display: flex; flex-direction: column; gap: 12px; }
.ck-dept-field { display: flex; flex-direction: column; gap: 4px; }
.ck-dept-field-label { font-size: 11.5px; font-weight: 600; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .04em; }
.ck-dept-field-row { display: flex; gap: 8px; align-items: center; }
.ck-dept-field-row .input { flex: 1; font-size: 13px; }
.ck-dept-field-hint { font-size: 11.5px; color: var(--fg-muted); font-style: italic; }

/* ----------------------------------------------------- Cockpit config overlay */
.ck-config-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ck-config-panel {
  background: var(--bg, #FAF7F0);
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ck-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border, #e8e0d0);
}
.ck-config-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--fg, #221F17); }
.ck-config-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--fg-muted, #888);
  padding: 0 4px;
}
.ck-config-close:hover { color: var(--fg, #221F17); }
.ck-config-body { padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.ck-cfg-label { font-size: 12px; font-weight: 600; color: var(--fg-muted, #666); text-transform: uppercase; letter-spacing: .04em; }
.ck-cfg-select,
.ck-cfg-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border, #e8e0d0);
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg-page, #fff);
  color: var(--fg, #221F17);
  box-sizing: border-box;
}
.ck-cfg-select:focus,
.ck-cfg-input:focus { outline: 2px solid #BB984D; outline-offset: 1px; }
.ck-cfg-hint { font-size: 11.5px; color: var(--fg-muted, #888); margin: 2px 0 0; font-style: italic; }
.ck-config-footer {
  padding: 14px 20px 18px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid var(--border, #e8e0d0);
}

/* ----------------------------------------------------- Toast notification */
.ck-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #221F17;
  color: #FAF7F0;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  z-index: 300;
}
.ck-toast--show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ----- Art admin ----- */
.art-admin-top {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.art-admin-dept-label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--fg-muted); }
.art-admin-list { display: flex; flex-direction: column; gap: 14px; }
.art-admin-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.art-admin-card:hover { border-color: rgba(187,152,77,0.4); }
.art-admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}
.art-admin-name { font-size: 15px; font-weight: 600; color: var(--fg); }
.art-admin-desc { font-size: 13px; color: var(--fg-muted); margin-top: 3px; }
.art-admin-owner { font-size: 12px; color: var(--fg-muted); margin-top: 4px; }
.art-admin-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.art-version-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.art-version-table th, .art-version-table td {
  text-align: left; padding: 8px 18px; border-bottom: 1px solid var(--border);
}
.art-version-table th { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--fg-muted); background: transparent; }
.art-version-table tr:last-child td { border-bottom: 0; }
.art-version-table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.art-admin-noversion { padding: 16px 18px; color: var(--fg-muted); font-size: 13px; font-style: italic; }
.art-badge-published {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; padding: 2px 8px; border-radius: 999px;
  background: #2d7a4f; color: #fff; font-weight: 500;
}

/* ----- Template panel ----- */
.tpl-status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.tpl-status-left { display: flex; align-items: center; gap: 14px; }
.tpl-status-label { font-size: 14px; font-weight: 600; color: var(--fg); }
.tpl-status-detail { font-size: 12.5px; color: var(--fg-muted); margin-top: 2px; }
.tpl-preview-header {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--fg-muted); margin-bottom: 10px;
}
.tpl-preview-frame {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; min-height: 500px;
}
.tpl-empty-state {
  text-align: center; padding: 64px 24px; color: var(--fg-muted);
  background: var(--bg); border: 1px dashed var(--border); border-radius: 12px;
}
.tpl-empty-state h3 { font-size: 17px; color: var(--fg); margin: 16px 0 8px; }
.tpl-empty-state p { font-size: 13px; line-height: 1.6; max-width: 440px; margin: 0 auto; }
.tpl-empty-state code {
  background: var(--bg-alt); padding: 2px 6px; border-radius: 4px; font-size: 12px;
}
.tpl-upload-progress {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 10px; background: var(--bg-alt);
  font-size: 13px; color: var(--fg-muted);
}
@keyframes admin-spin { to { transform: rotate(360deg); } }
.tpl-upload-spinner {
  width: 16px; height: 16px; flex-shrink: 0;
  border: 2px solid var(--border); border-top-color: var(--gold);
  border-radius: 50%; animation: admin-spin 0.8s linear infinite;
}
.btn-ghost-danger {
  background: transparent; border: 1px solid rgba(164, 80, 60, 0.4);
  color: var(--danger); border-radius: var(--radius-input);
}
.btn-ghost-danger:hover { background: rgba(164, 80, 60, 0.08); }

/* ----- Viewer actions bar ----- */
.viewer-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 7px 14px;
}


/* ----- SharePoint footer with two buttons ----- */
.sp-footer { gap: 8px; }

/* ================================================= Générateur de cockpit */
.gen-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.gen-step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.gen-step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.gen-step-body { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.gen-label { font-size: 13px; font-weight: 600; color: var(--fg); }
.gen-hint  { font-size: 11px; color: var(--fg-muted); font-family: monospace; }
.gen-excel-label {
  display: inline-flex; align-items: center; gap: 7px;
  cursor: pointer; max-width: 360px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.gen-excel-label.has-file { border-color: var(--gold); color: var(--gold); }

/* ----- Responsive admin ----- */
@media (max-width: 760px) {
  .admin-sidebar { width: 200px; }
  .admin-panel { padding: 20px 16px 40px; }
  .admin-main-header { padding: 16px 16px 14px; }
  .admin-settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .admin-screen { flex-direction: column; }
  .admin-sidebar { width: 100%; flex-direction: row; align-items: center; padding: 10px; }
  .admin-nav { flex-direction: row; overflow-x: auto; padding: 0; flex: 1; }
  .admin-nav-item { padding: 8px 12px; font-size: 12px; white-space: nowrap; }
  .admin-nav-icon { display: none; }
  .admin-sidebar-brand, .admin-sidebar-footer { display: none; }
}

/* ── Éditeur cockpit Claude ──────────────────────────────────────────── */
.ck-edit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ck-edit-dialog {
  background: var(--bg, #fff);
  border-radius: 10px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35);
  width: min(1400px, 97vw);
  height: min(96vh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ck-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border, #e0d9cc);
  flex-shrink: 0;
  gap: 12px;
}
.ck-edit-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--fg, #1a1a1a);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ck-edit-header-actions { display: flex; gap: 8px; flex-shrink: 0; }
.ck-edit-body {
  display: flex;
  flex: 1;
  min-height: 0;
}
.ck-edit-preview {
  flex: 1;
  min-width: 0;
  border-right: 1px solid var(--border, #e0d9cc);
  background: var(--bg-alt, #f5f3ee);
}
.ck-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.ck-edit-panel {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg, #fff);
}
.ck-chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ck-chat-hint {
  font-size: 12px;
  color: var(--fg-muted, #888);
  background: var(--bg-alt, #f5f3ee);
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.5;
}
.ck-bubble {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 100%;
  word-break: break-word;
}
.ck-bubble-user {
  background: #1a1a1a;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 3px;
}
.ck-bubble-claude {
  background: var(--bg-alt, #f5f3ee);
  color: var(--fg, #1a1a1a);
  border: 1px solid var(--border, #e0d9cc);
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}
.ck-chat-input-row {
  padding: 12px 16px;
  border-top: 1px solid var(--border, #e0d9cc);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.ck-chat-textarea {
  width: 100%;
  resize: none;
  height: 90px;
  font-size: 13px;
  border: 1px solid var(--border, #e0d9cc);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--bg-input, #fff);
  color: var(--fg, #1a1a1a);
  font-family: inherit;
  line-height: 1.5;
}
.ck-chat-textarea:focus { outline: none; border-color: var(--primary, #BB984D); }
.ck-chat-actions { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.ck-file-label { cursor: pointer; font-size: 12px; }
.ck-file-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; min-height: 0; }
.ck-file-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--bg-alt, #f5f3ee); border: 1px solid var(--border, #e0d9cc); border-radius: 4px; padding: 2px 6px; font-size: 11px; color: var(--fg, #1a1a1a); }
.ck-file-chip button { background: none; border: 0; cursor: pointer; color: var(--fg-muted, #888); padding: 0; font-size: 13px; line-height: 1; }
.ck-chat-send { flex-shrink: 0; }
/* onglets */
.ck-tabs {
  display: flex;
  border-bottom: 1px solid var(--border, #e0d9cc);
  flex-shrink: 0;
}
.ck-tab {
  flex: 1;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--fg-muted, #888);
  transition: color .15s, border-color .15s;
}
.ck-tab:hover { color: var(--fg, #1a1a1a); }
.ck-tab.ck-tab-active { color: var(--primary, #BB984D); border-bottom-color: var(--primary, #BB984D); }

/* panneaux onglets */
.ck-tab-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ck-tab-pane-hidden { display: none !important; }

/* éditeur code */
.ck-code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, #e0d9cc);
  flex-shrink: 0;
  gap: 8px;
}
.ck-code-hint { font-size: 12px; color: var(--fg-muted, #888); }
.ck-code-editor {
  flex: 1;
  width: 100%;
  resize: none;
  border: 0;
  border-radius: 0;
  padding: 14px 16px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
  background: #1a1a1a;
  color: #e8e6df;
  outline: none;
  tab-size: 2;
}

.ck-chat-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 10px;
  font-size: 12px;
  color: var(--fg-muted, #888);
  flex-shrink: 0;
}
.ck-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border, #e0d9cc);
  border-top-color: var(--primary, #BB984D);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 768px) {
  .ck-edit-body { flex-direction: column; }
  .ck-edit-preview { flex: none; height: 45vh; border-right: 0; border-bottom: 1px solid var(--border, #e0d9cc); }
  .ck-edit-panel { width: 100%; }
}

/* Artefact de type iframe (page externe embarquée) */
.art-kind-badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 600; vertical-align: middle; background: var(--bg-alt); color: var(--fg-muted); }
.art-admin-embed { margin-top: 4px; font-size: 12px; color: var(--fg-muted); word-break: break-all; }
.art-admin-embed a { color: inherit; text-decoration: underline; }
