/* ═══════════════════════════════════════════════ */
/*  COLLAPSIBLE CARDS                              */
/* ═══════════════════════════════════════════════ */
.card-header {
  cursor: pointer;
  user-select: none;
}

.card-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.card-header .card-collapse-chevron {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition);
  margin-right: 6px;
}

.card.collapsed .card-collapse-chevron {
  transform: rotate(-90deg);
}

.card.collapsed .card-body {
  display: none;
}

/* ═══════════════════════════════════════════════ */
/*  DIAGRAM EXPAND BUTTON                          */
/* ═══════════════════════════════════════════════ */
.diagram-expand-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 5px;
  display: flex;
  align-items: center;
  margin-left: 4px;
}
.diagram-expand-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* ═══════════════════════════════════════════════ */
/*  DIAGRAM FULLSCREEN OVERLAY                     */
/* ═══════════════════════════════════════════════ */
.diagram-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.diagram-overlay-content {
  background: var(--bg-surface);
  border-radius: 8px;
  width: 90vw;
  height: 90vh;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.diagram-overlay-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  z-index: 1;
}
.diagram-overlay-close:hover {
  color: var(--text);
}
.diagram-overlay-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.diagram-overlay-controls button {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
}
.diagram-overlay-controls span {
  color: var(--text);
  font-size: 13px;
  min-width: 40px;
  text-align: center;
}
.diagram-overlay-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  flex-direction: column;
  cursor: grab;
}
.diagram-overlay-diagram {
  margin-bottom: 24px;
}
.diagram-overlay-diagram svg {
  overflow: visible;
  max-width: none;
}
.diagram-overlay-body svg {
  max-width: none;
  max-height: none;
}
.diagram-overlay-body svg foreignObject {
  overflow: visible;
}
.diagram-overlay-body svg .node rect,
.diagram-overlay-body svg .node polygon,
.diagram-overlay-body svg .node circle {
  overflow: visible;
}
.diagram-subtitle {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 16px 0 8px 0;
  padding: 0 8px;
}
.diagram-subtitle:first-child {
  margin-top: 8px;
}
.diagram-section {
  margin-bottom: 16px;
  overflow: visible;
}
#systemDiagram svg foreignObject,
#planDiagram svg foreignObject {
  overflow: visible;
}

/* Rules list items */
.rules-item { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 6px; }
.rules-item-header { display: flex; justify-content: space-between; align-items: center; }
.rules-item-name { font-weight: 500; }
.rules-item-source { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: var(--bg-tertiary); color: var(--text-secondary); text-transform: uppercase; }
.rules-item-paths { font-family: monospace; font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
