/* Permissions Map — PERMISSIONS-MAP-V1 */

/* ── Page layout ─────────────────────────────────────────────────────────── */

.pm-page {
  padding: 0 0 40px 0;
}

.pm-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.pm-subtitle {
  color: #9D8BB8;
  font-size: 12px;
  margin: 2px 0 16px 0;
}

/* ── Tab 1 — Doctrine ─────────────────────────────────────────────────────── */

.pm-doctrine-wrap {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.pm-doctrine-svg-zone {
  flex: 1;
  min-width: 0;
  background: rgba(10, 10, 20, 0.6);
  border: 1px solid rgba(129, 140, 248, 0.15);
  border-radius: 12px;
  padding: 16px;
  overflow: hidden;
}

.pm-doctrine-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* SVG node hover */
.pm-node rect { transition: fill 0.15s, stroke 0.15s; }
.pm-node:hover rect { filter: brightness(1.25); }

/* ── Legend ──────────────────────────────────────────────────────────────── */

.pm-doctrine-legend {
  width: 220px;
  flex-shrink: 0;
  background: rgba(30, 20, 50, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 16px;
  font-size: 12px;
}

.pm-legend-title {
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.pm-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #9D8BB8;
  margin-bottom: 8px;
  font-size: 11px;
  line-height: 1.4;
}

.pm-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pm-legend-sep {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  margin: 12px 0;
}

.pm-legend-note {
  color: #5A3B7A;
  font-size: 10px;
  font-style: italic;
  line-height: 1.5;
}

/* ── Drawer ──────────────────────────────────────────────────────────────── */

.pm-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
}

.pm-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100vh;
  background: #13101f;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 201;
  overflow-y: auto;
  padding: 0;
}

.pm-drawer-header {
  padding: 20px 20px 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pm-drawer-title {
  font-size: 15px;
  font-weight: 700;
}

.pm-drawer-close {
  background: none;
  border: none;
  color: #9D8BB8;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.pm-drawer-close:hover { color: #ffffff; }

.pm-drawer-body {
  padding: 20px;
  font-size: 13px;
  color: #9D8BB8;
  line-height: 1.6;
}

.pm-drawer-body p {
  margin-bottom: 14px;
}

.pm-drawer-chain {
  font-family: monospace;
  font-size: 11px;
  color: #818cf8;
  background: rgba(129, 140, 248, 0.06);
  border: 1px solid rgba(129, 140, 248, 0.2);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
  word-break: break-all;
}

.pm-drawer-kv {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.5;
}

.pm-drawer-key {
  color: #ffffff;
  font-weight: 600;
  min-width: 110px;
  flex-shrink: 0;
}

.pm-drawer-ref {
  margin-top: 16px;
  padding: 10px 12px;
  background: rgba(245, 158, 11, 0.06);
  border-left: 2px solid #f59e0b;
  border-radius: 0 6px 6px 0;
  font-size: 11px;
  color: #9D8BB8;
  line-height: 1.5;
}

/* ── Tab 2 — Live traversée ──────────────────────────────────────────────── */

.pm-live-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pm-live-modes {
  display: flex;
  gap: 8px;
}

.pm-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #9D8BB8;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.pm-mode-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.pm-mode-btn.active {
  background: rgba(129, 140, 248, 0.12);
  border-color: #818cf8;
  color: #ffffff;
}

.pm-live-search-zone {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pm-live-input {
  flex: 1;
}

.pm-live-go {
  flex-shrink: 0;
}

.pm-live-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pm-live-example-pill {
  background: rgba(129, 140, 248, 0.08);
  border: 1px solid rgba(129, 140, 248, 0.2);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 10px;
  color: #9D8BB8;
  cursor: pointer;
  font-family: monospace;
  transition: background 0.15s, color 0.15s;
}
.pm-live-example-pill:hover {
  background: rgba(129, 140, 248, 0.18);
  color: #e0d4f5;
}

.pm-live-results {
  min-height: 120px;
}

.pm-live-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 20px;
  color: #5A3B7A;
  font-size: 13px;
  text-align: center;
}

.pm-live-result-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pm-perm-code {
  font-family: monospace;
  font-size: 13px;
  color: #D8A3FF;
  background: rgba(216, 163, 255, 0.08);
  padding: 3px 8px;
  border-radius: 4px;
}

.pm-result-count {
  color: #9D8BB8;
  font-size: 12px;
}

.pm-live-section {
  margin-bottom: 16px;
}

.pm-live-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pm-live-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.02);
}

.pm-live-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.pm-live-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.pm-live-badge--user {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22c55e;
}

.pm-live-badge--workload {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #6366f1;
}

.pm-live-badge--agent {
  background: rgba(216, 163, 255, 0.12);
  border: 1px solid rgba(216, 163, 255, 0.3);
  color: #D8A3FF;
}

.pm-live-path {
  font-size: 11px;
  color: #6b7280;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-live-code {
  font-family: monospace;
  font-size: 11px;
  color: #9D8BB8;
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ── Tab 3 — Audit 5-sources ─────────────────────────────────────────────── */

.pm-audit-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pm-audit-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pm-audit-desc {
  color: #9D8BB8;
  font-size: 12px;
}

.pm-audit-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border-left: 3px solid #22c55e;
}

.pm-source-doctrine {
  background: rgba(30, 20, 50, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 16px;
}

.pm-sources-title {
  color: #9D8BB8;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.pm-sources-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pm-source-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  transition: background 0.15s;
}

.pm-source-card:hover {
  background: rgba(255, 255, 255, 0.04);
}

.pm-source-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(129, 140, 248, 0.08);
  border-radius: 8px;
  flex-shrink: 0;
}

.pm-source-info {
  flex: 1;
  min-width: 0;
}

.pm-source-name {
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.pm-source-desc {
  color: #9D8BB8;
  font-size: 11px;
}

.pm-source-status {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pm-no-gaps {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: rgba(34, 197, 94, 0.05);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 8px;
  color: #22c55e;
  font-size: 13px;
  font-weight: 500;
}

.pm-gaps-section {
  background: rgba(245, 158, 11, 0.04);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: 10px;
  padding: 16px;
}

.pm-gaps-title {
  color: #f59e0b;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.pm-gaps-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pm-gap-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.pm-gap-type {
  color: #f59e0b;
  font-size: 10px;
  font-weight: 600;
  min-width: 180px;
  flex-shrink: 0;
}

.pm-gap-code {
  font-family: monospace;
  font-size: 11px;
  color: #9D8BB8;
}

.pm-audit-actions {
  display: flex;
  gap: 8px;
  padding-top: 8px;
}
