/* ============================================================
   specifique1 — onglet « Flotte » (Vue d'ensemble du chef de cabinet)
   Volet de navigation gauche = standard répliqué de l'onglet Accès.
   ============================================================ */
.sp1-tab { padding: 0; height: 100%; display: flex; flex-direction: column; }

/* ----- Toolbar ----- */
.sp1-toolbar {
  display: flex; gap: .7rem; align-items: center;
  padding: .55rem .9rem;
  min-height: 3.15rem;
  background: rgba(24, 24, 27, .22);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  flex-wrap: wrap;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}
.sp1-toolbar .sp1-title {
  font-family: 'Menlo','Consolas',monospace;
  font-size: .9rem; font-weight: 700; color: var(--p-soft);
  letter-spacing: .04em; display: inline-flex; align-items: center; gap: .45rem;
}
.sp1-toolbar .sp1-title .sp1-ic { color: var(--p-base); display: inline-flex; }
.sp1-toolbar .sp1-stats {
  font-family: 'Menlo','Consolas',monospace; font-size: .78rem; color: #94a3b8;
}
.sp1-toolbar #sp1-refresh { margin-left: auto; }

/* ----- Layout 2 colonnes (volet gauche standard) ----- */
.sp1-layout { display: grid; grid-template-columns: 230px 1fr; flex: 1; min-height: 0; transition: grid-template-columns .2s; }
.sp1-layout.sidebar-hidden { grid-template-columns: 0 1fr; }
.sp1-layout.sidebar-hidden .sp1-sidebar { visibility: hidden; border-right: none; }

.sp1-sidebar {
  background: rgba(20, 20, 23, .25);
  border-right: 1px solid rgba(255, 255, 255, .1);
  overflow-y: auto;
  backdrop-filter: blur(24px) saturate(180%);
}
.sp1-nav { list-style: none; margin: 0; padding: .35rem 0; }
.sp1-section { margin-bottom: .3rem; }
.sp1-section-h {
  display: flex; align-items: center; gap: .4rem;
  padding: .55rem .85rem .35rem;
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--p-light); font-weight: 600; user-select: none;
}
.sp1-section-h .sp1-chev { display: inline-flex; opacity: .6; }
.sp1-sub { list-style: none; margin: 0; padding: 0; }
.sp1-sub li {
  display: flex; align-items: center; gap: .45rem;
  padding: .4rem .85rem .4rem 1.4rem;
  cursor: pointer; font-size: .82rem; color: #d4d4d8;
  border-bottom: 1px solid rgba(255, 255, 255, .03);
  transition: background .12s;
}
.sp1-sub li:hover { background: rgba(var(--p-base-rgb), .07); }
.sp1-sub li.active {
  background: rgba(var(--p-glow-rgb), .12);
  box-shadow: inset 2px 0 0 var(--p-base);
  color: var(--p-base);
}
.sp1-sub .sp1-li-ic { color: var(--p-light); flex-shrink: 0; display: inline-flex; }
.sp1-sub li.active .sp1-li-ic { color: var(--p-base); }
.sp1-sub .sp1-li-lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ----- Main + handle ----- */
.sp1-main { display: flex; flex-direction: column; background: transparent; position: relative; overflow: hidden; min-height: 0; }
.sp1-main .sidebar-handle {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 12px; height: 64px;
  background: rgba(39, 39, 42, .55);
  border: 1px solid rgba(255, 255, 255, .08); border-left: none;
  border-radius: 0 6px 6px 0; color: var(--p-light);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: .9rem; line-height: 1; padding: 0; z-index: 10;
  backdrop-filter: blur(15px);
}
.sp1-main .sidebar-handle:hover { background: rgba(var(--p-base-rgb), .18); color: var(--p-base); }
.sp1-content { flex: 1; overflow-y: auto; padding: 1.2rem 1.1rem 2rem; }
.sp1-empty { color: #64748b; font-style: italic; padding: 1rem; text-align: center; }

/* ============================================================
   Organigramme : orchestrateur en haut, 11 agents dessous
   ============================================================ */
.sp1-org { display: flex; flex-direction: column; align-items: center; }

/* --- Orchestrateur (racine) --- */
.org-top { display: flex; justify-content: center; }
.org-root {
  position: relative;
  min-width: 260px; max-width: 360px;
  padding: .9rem 1.2rem;
  border-radius: 12px;
  border: 1px solid rgba(var(--p-base-rgb), .55);
  background: linear-gradient(180deg, rgba(var(--p-base-rgb), .22), rgba(var(--p-deep-rgb), .35));
  box-shadow: 0 0 24px rgba(var(--p-glow-rgb), .35), inset 0 0 0 1px rgba(var(--p-soft-rgb), .12);
  text-align: center;
}
.org-root .org-root-h {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  color: var(--p-pale); font-weight: 700; font-size: 1rem;
  font-family: 'Menlo','Consolas',monospace; letter-spacing: .03em;
}
.org-root .org-root-h .org-root-ic { color: var(--p-soft); display: inline-flex; }
.org-root .org-root-desc { color: var(--p-soft); font-size: .76rem; margin-top: .25rem; opacity: .85; }
.org-root .org-root-meta {
  margin-top: .5rem; display: flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: 'Menlo','Consolas',monospace; font-size: .72rem; color: #94a3b8;
}

/* --- connecteur vertical (tronc) --- */
.org-trunk { width: 2px; height: 26px; background: linear-gradient(180deg, rgba(var(--p-base-rgb), .7), rgba(var(--p-base-rgb), .2)); }

/* --- grille des agents --- */
.org-grid {
  display: grid; gap: .7rem; width: 100%;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.org-node {
  position: relative;
  padding: .7rem .8rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(24, 24, 27, .4);
  backdrop-filter: blur(12px);
  transition: border-color .15s, transform .12s;
}
.org-node::before { /* petit stub de connexion vers le haut */
  content: ''; position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  width: 2px; height: 14px; background: rgba(var(--p-base-rgb), .3);
}
.org-node:hover { border-color: rgba(var(--p-base-rgb), .45); transform: translateY(-1px); }
.org-node-h { display: flex; align-items: center; gap: .45rem; margin-bottom: .25rem; }
.org-node-h .org-node-ic { color: var(--p-light); flex-shrink: 0; display: inline-flex; }
.org-node-h .org-node-name { font-weight: 700; font-size: .9rem; color: #e4e4e7; flex: 1; }
.org-node-desc { font-size: .73rem; color: #94a3b8; line-height: 1.35; min-height: 2em; }
.org-node-foot {
  display: flex; align-items: center; gap: .4rem; margin-top: .5rem;
  font-family: 'Menlo','Consolas',monospace; font-size: .68rem; color: #71717a;
}
.org-node-ip { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.org-ping-btn {
  background: transparent; border: 1px solid rgba(255, 255, 255, .12);
  color: var(--p-light); border-radius: 4px; padding: .15rem .4rem;
  cursor: pointer; font-size: .66rem; display: inline-flex; align-items: center; gap: .2rem;
  font-family: 'Menlo','Consolas',monospace;
}
.org-ping-btn:hover:not(:disabled) { background: rgba(var(--p-base-rgb), .14); border-color: rgba(var(--p-base-rgb), .4); color: var(--p-base); }
.org-ping-btn:disabled { opacity: .35; cursor: not-allowed; }

/* --- pastille de statut --- */
.org-st {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .62rem; font-weight: 700; letter-spacing: .03em;
  font-family: 'Menlo','Consolas',monospace; text-transform: uppercase;
  padding: .12rem .4rem; border-radius: 4px; border: 1px solid; white-space: nowrap;
}
.org-st .org-st-ic { display: inline-flex; }
.org-st.checking { color: #94a3b8; border-color: rgba(148,163,184,.4); background: rgba(148,163,184,.08); }
.org-st.checking .org-st-ic { animation: sp1-spin 1s linear infinite; }
.org-st.up   { color: #4ade80; border-color: rgba(74,222,128,.5);  background: rgba(74,222,128,.1); }
.org-st.down { color: #ef4444; border-color: rgba(239,68,68,.5);   background: rgba(239,68,68,.1); }
.org-st.warn { color: #fbbf24; border-color: rgba(251,191,36,.5);  background: rgba(251,191,36,.1); }
.org-st.pong { color: #22d3ee; border-color: rgba(34,211,238,.5);  background: rgba(34,211,238,.12); }
.org-st.fail { color: #ef4444; border-color: rgba(239,68,68,.5);   background: rgba(239,68,68,.1); }
@keyframes sp1-spin { to { transform: rotate(360deg); } }

.org-legend {
  margin: 1.4rem auto 0; display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center;
  font-size: .68rem; color: #71717a; font-family: 'Menlo','Consolas',monospace;
}
.org-legend .ll { display: inline-flex; align-items: center; gap: .3rem; }
.org-legend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.org-legend .dot.up { background: #4ade80; } .org-legend .dot.down { background: #ef4444; }
.org-legend .dot.warn { background: #fbbf24; } .org-legend .dot.pong { background: #22d3ee; }

/* ============================================================
   Page Délégations — journal (logs/delegate.jsonl)
   ============================================================ */
.dlg-wrap { width: 100%; margin: 0; }
.dlg-head {
  display: flex; align-items: center; gap: .45rem;
  font-family: 'Menlo','Consolas',monospace; font-weight: 700; font-size: .9rem;
  color: var(--p-soft); margin-bottom: .8rem;
}
.dlg-head span[data-icon] { color: var(--p-base); display: inline-flex; }
.dlg-head .dlg-count { margin-left: auto; font-size: .72rem; font-weight: 500; color: #71717a; }
.dlg-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.dlg-table th {
  text-align: left; padding: .4rem .55rem;
  font-size: .66rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--p-light); font-family: 'Menlo','Consolas',monospace;
  border-bottom: 1px solid rgba(var(--p-base-rgb), .25);
}
.dlg-table td { padding: .4rem .55rem; border-bottom: 1px solid rgba(255,255,255,.05); color: #d4d4d8; vertical-align: top; }
.dlg-row:hover td { background: rgba(var(--p-base-rgb), .05); }
.dlg-ts  { font-family: 'Menlo','Consolas',monospace; color: #94a3b8; white-space: nowrap; }
.dlg-ms  { font-family: 'Menlo','Consolas',monospace; color: #94a3b8; white-space: nowrap; text-align: right; }
.dlg-agent {
  font-weight: 700; color: var(--p-soft);
  font-family: 'Menlo','Consolas',monospace; font-size: .76rem;
}
.dlg-src {
  font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  font-family: 'Menlo','Consolas',monospace;
  padding: .08rem .35rem; border-radius: 3px;
  border: 1px solid rgba(var(--p-light-rgb), .4); color: var(--p-light);
  background: rgba(var(--p-light-rgb), .1); white-space: nowrap;
}
/* Familles de source (page Delegations) : Telegram / Email / Interne */
.dlg-src-tg   { border-color: rgba(56,189,248,.5);          color: #38bdf8;        background: rgba(56,189,248,.12); }
.dlg-src-mail { border-color: rgba(var(--p-light-rgb), .45); color: var(--p-light); background: rgba(var(--p-light-rgb), .12); }
.dlg-src-int  { border-color: rgba(148,163,184,.4);         color: #94a3b8;        background: rgba(148,163,184,.1); }
.dlg-ok { text-align: center; font-weight: 700; }
.dlg-ok.ok   { color: #4ade80; }
.dlg-ok.fail { color: #ef4444; }
.dlg-row.fail td { background: rgba(239,68,68,.05); }
.dlg-table { table-layout: fixed; }
.dlg-table th:nth-child(1), .dlg-table td:nth-child(1) { width: 4.5rem; }   /* Quand */
.dlg-table th:nth-child(2), .dlg-table td:nth-child(2) { width: 7.5rem; }  /* Agent */
.dlg-table th:nth-child(3), .dlg-table td:nth-child(3) { width: 5rem; }    /* Source */
.dlg-table th:nth-child(4), .dlg-table td:nth-child(4) { width: 4rem; }    /* Durée */
.dlg-table th:nth-child(5), .dlg-table td:nth-child(5) { width: 2.5rem; }  /* OK */
.dlg-table th:nth-child(6), .dlg-table td:nth-child(6) { width: auto; }    /* Demande — prend tout le reste */
.dlg-demande { min-width: 0; }
.dlg-prompt {
  color: #e4e4e7; line-height: 1.45;
  white-space: normal; overflow-wrap: anywhere; word-break: break-word;
}
.dlg-resp {
  margin-top: .3rem; padding-left: .65rem;
  border-left: 2px solid rgba(var(--p-base-rgb), .35);
  color: #8b8b94; font-size: .74rem; line-height: 1.4;
  white-space: normal; overflow-wrap: anywhere;
}
.dlg-resp::before { content: '↳ '; color: var(--p-light); }

/* ============================================================
   Page Dossiers (mémoire de continuité)
   ============================================================ */
.dos-table .dos-row { cursor: pointer; }
.dos-table th:nth-child(3), .dos-table td:nth-child(3) { text-align: right; width: 4rem; }
.dos-title { color: #e4e4e7; font-weight: 600; }
.dos-implicit-tag, .dos-num { font-family: 'Menlo','Consolas',monospace; }
.dos-implicit-tag { font-size: .6rem; color: #71717a; border: 1px dashed rgba(255,255,255,.18); padding: .02rem .3rem; border-radius: 3px; }
.dos-num { color: #94a3b8; }
.dos-agents { display: flex; flex-wrap: wrap; gap: .25rem; }
.dos-ag {
  font-size: .62rem; font-family: 'Menlo','Consolas',monospace;
  color: var(--p-light); background: rgba(var(--p-light-rgb), .1);
  border: 1px solid rgba(var(--p-light-rgb), .3); border-radius: 3px; padding: .02rem .3rem;
}
.dos-badge {
  font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  font-family: 'Menlo','Consolas',monospace; padding: .08rem .4rem; border-radius: 4px; border: 1px solid; white-space: nowrap;
}
.dos-badge.open     { color: #4ade80; border-color: rgba(74,222,128,.5);  background: rgba(74,222,128,.1); }
.dos-badge.closed   { color: #94a3b8; border-color: rgba(148,163,184,.4); background: rgba(148,163,184,.08); }
.dos-badge.implicit { color: #fbbf24; border-color: rgba(251,191,36,.5);  background: rgba(251,191,36,.1); }

/* détail */
.dos-detail-head { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.dos-detail-title { font-size: 1.05rem; font-weight: 700; color: var(--p-pale); font-family: 'Menlo','Consolas',monospace; }
.dos-slug { font-family: 'Menlo','Consolas',monospace; font-size: .7rem; color: #71717a; }
.dos-back { font-family: 'Menlo','Consolas',monospace; }
.dos-summary-block {
  background: rgba(24,24,27,.4); border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px; padding: .8rem .9rem;
}
.dos-summary-lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--p-light); font-weight: 600; margin-bottom: .5rem; }
.dos-hint { text-transform: none; letter-spacing: 0; color: #71717a; font-weight: 400; }
.dos-summary-ro { color: #d4d4d8; font-size: .85rem; line-height: 1.5; white-space: pre-wrap; }
.dos-summary-edit {
  width: 100%; box-sizing: border-box; resize: vertical;
  background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.12); border-radius: 6px;
  color: #e4e4e7; font-size: .85rem; line-height: 1.5; padding: .55rem .6rem; margin-bottom: .5rem;
  font-family: inherit;
}
.dos-summary-edit:focus { outline: none; border-color: rgba(var(--p-base-rgb), .55); }
.dos-summary-btns { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
#dos-summary-ai { color: var(--p-soft); border-color: rgba(var(--p-soft-rgb), .4); }
#dos-summary-ai:hover:not(:disabled) { background: rgba(var(--p-base-rgb), .14); border-color: rgba(var(--p-base-rgb), .5); color: var(--p-base); }

/* ===== Page Catalogue (capacités & données) ===== */
.cat-wrap { padding: .4rem .2rem; }
.cat-head { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--p-light); margin-bottom: .8rem; }
.cat-head .cat-count { margin-left: auto; font-size: .72rem; color: #94a3b8; font-weight: 500; }
.cat-vm { margin-bottom: 1.1rem; }
.cat-vm h3 { font-size: .92rem; margin: .2rem 0 .5rem; color: #d4d4d8; text-transform: capitalize; }
.cat-vm h3 .cat-ip { font-size: .68rem; color: #64748b; font-weight: 400; font-family: 'Menlo','Consolas',monospace; }
.cat-fn { border: 1px solid rgba(255,255,255,.08); border-left: 2px solid rgba(var(--p-base-rgb), .5); border-radius: 6px; padding: .45rem .6rem; margin-bottom: .4rem; background: rgba(24,24,27,.25); }
.cat-fn-proposed { border-left-color: #fb923c; }
.cat-fn-top { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.cat-slug { font-family: 'Menlo','Consolas',monospace; font-size: .76rem; color: var(--p-light); }
.cat-ret { font-size: .64rem; color: #94a3b8; }
.cat-label { color: #d4d4d8; font-size: .8rem; }
.cat-badge { font-size: .6rem; font-weight: 700; text-transform: uppercase; padding: .06rem .35rem; border-radius: 3px; }
.cat-validated { background: rgba(74,222,128,.14); color: #4ade80; border: 1px solid rgba(74,222,128,.4); }
.cat-proposed { background: rgba(251,146,60,.14); color: #fb923c; border: 1px solid rgba(251,146,60,.4); }
.cat-validate { margin-left: auto; font-size: .66rem; padding: .12rem .5rem; border-radius: 4px; border: 1px solid rgba(74,222,128,.5); background: rgba(74,222,128,.12); color: #4ade80; cursor: pointer; }
.cat-validate:hover:not(:disabled) { background: rgba(74,222,128,.25); }
.cat-fn-meta { font-size: .68rem; color: #94a3b8; margin-top: .2rem; }
.cat-sql { font-size: .66rem; color: #a1a1aa; background: rgba(0,0,0,.25); border-radius: 4px; padding: .3rem .45rem; margin: .35rem 0 0; overflow-x: auto; white-space: pre-wrap; }

/* actions catalogue */
.cat-actions { margin-left: auto; display: inline-flex; gap: .3rem; }
.cat-act { font-size: .64rem; padding: .1rem .45rem; border-radius: 4px; cursor: pointer; border: 1px solid; background: transparent; }
.cat-validate { color: #4ade80; border-color: rgba(74,222,128,.5); background: rgba(74,222,128,.1); }
.cat-validate:hover:not(:disabled) { background: rgba(74,222,128,.22); }
.cat-disable { color: #fbbf24; border-color: rgba(251,191,36,.5); background: rgba(251,191,36,.08); }
.cat-disable:hover:not(:disabled) { background: rgba(251,191,36,.2); }
.cat-delete { color: #f87171; border-color: rgba(248,113,113,.45); background: rgba(248,113,113,.08); }
.cat-delete:hover:not(:disabled) { background: rgba(248,113,113,.2); }
.cat-enrich { margin-left: .5rem; font-size: .66rem; padding: .12rem .55rem; border-radius: 5px; cursor: pointer; color: var(--p-light); border: 1px solid rgba(var(--p-base-rgb),.5); background: rgba(var(--p-base-rgb),.12); }
.cat-enrich:hover:not(:disabled) { background: rgba(var(--p-base-rgb),.25); }
.cat-fn-disabled { opacity: .55; border-left-color: #64748b !important; }
.cat-disabled { background: rgba(100,116,139,.15); color: #94a3b8; border: 1px solid rgba(100,116,139,.4); }

/* Statut : position unique (haut-droite) dans TOUTES les cartes (agents + orchestrateur) ;
   le check « up » perd son cadre (juste l icone verte). Les etats d anomalie gardent le leur. */
.org-root { position: relative; }
.org-node .org-st-slot, .org-root .org-st-slot { position: absolute; top: .55rem; right: .6rem; }
.org-node-h { padding-right: 1.2rem; }
.org-st.up { border: none; background: transparent; padding: 0; }
