/* Open Space Composer. Uses the tokens and fonts of site.css. */

:root {
  --cmp-palette-w: 272px;
  --cmp-inspector-w: 340px;
  --cmp-canvas-bg: #F7F9FB;
  --cmp-grid-dot: #CDD5DF;
  --cmp-danger: #B42318;
  --cmp-danger-bg: #FEF3F2;
  --cmp-focus: var(--orange);
  --cmp-label: #2B3646;
}

/* Page frame of the app layout: the editor fills the window below a compact site header */
.app-body {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.site-header-compact .header-bar-wide {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 32px;
  padding: 10px 20px;
}
.site-header-compact .brand img { height: 26px; }
.site-header-compact .site-nav a { padding: 4px 0; }
.app-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.cmp {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  background: var(--light);
  font-size: 0.92rem;
}
.cmp-message {
  margin: auto;
  padding: 48px 24px;
  color: var(--text-muted);
}
.cmp-error { color: var(--cmp-danger); }
.cmp-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.cmp-mono { font-family: var(--font-mono); }
.cmp [hidden],
.cmp-ghost[hidden] { display: none !important; }

.cmp :focus-visible {
  outline: 3px solid var(--cmp-focus);
  outline-offset: 2px;
}

/* Toolbar --------------------------------------------------------------------------------------------------------- */
.cmp-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding: 8px 16px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
}
.cmp-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 8px;
}
.cmp-title {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.cmp-beta {
  color: var(--orange-text);
  border-color: var(--orange-text);
}
.cmp-toolgroup {
  display: flex;
  gap: 6px;
}
.cmp-toolgroup-end { margin-left: auto; }
.cmp-tool[aria-pressed="true"] {
  color: #FFFFFF;
  background: var(--navy);
  border-color: var(--navy);
}
.cmp-tool,
.cmp-btn {
  font: inherit;
  font-size: 0.86rem;
  line-height: 1.2;
  padding: 7px 12px;
  color: var(--navy);
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
a.cmp-tool {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.cmp-tool:hover:not(:disabled),
.cmp-btn:hover:not(:disabled) { border-color: var(--navy); }
.cmp-tool:disabled,
.cmp-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
/* focusable, and says why it does nothing (title) */
.cmp-tool[aria-disabled="true"] { opacity: 0.55; }
.cmp-btn-primary {
  color: #FFFFFF;
  background: var(--navy);
  border-color: var(--navy);
}
.cmp-btn-primary:hover:not(:disabled) { background: #1C2D45; }
.cmp-btn-danger { color: var(--cmp-danger); }
.cmp-btn-danger:hover:not(:disabled) {
  border-color: var(--cmp-danger);
  background: var(--cmp-danger-bg);
}

.cmp-menu-wrap { position: relative; }
.cmp-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  min-width: 300px;
  padding: 6px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lift);
}
.cmp-menu-item {
  display: block;
  width: 100%;
  padding: 9px 10px;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.cmp-menu-item:hover,
.cmp-menu-item:focus-visible { background: var(--surface); }
.cmp-menu-title { display: block; font-weight: 600; }
.cmp-menu-desc { display: block; font-size: 0.8rem; color: var(--text-muted); }

/* Tabs ------------------------------------------------------------------------------------------------------------ */
.cmp-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 6px 12px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.cmp-tablist {
  display: flex;
  gap: 4px;
}
.cmp-tab {
  display: flex;
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}
.cmp-tab.is-active {
  background: #FFFFFF;
  border-color: var(--border);
  margin-bottom: -1px;
}
.cmp-tab-btn,
.cmp-tab-close,
.cmp-tab-add {
  font: inherit;
  color: var(--text-muted);
  background: none;
  border: 0;
  cursor: pointer;
}
.cmp-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 4px 8px 14px;
  font-size: 0.84rem;
}
.cmp-tab.is-active .cmp-tab-btn { color: var(--navy); font-weight: 600; }
.cmp-tab-dirty {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
}
.cmp-tab-close {
  padding: 4px 10px 4px 6px;
  font-size: 1.05rem;
  line-height: 1;
}
.cmp-tab-close:hover,
.cmp-tab-btn:hover { color: var(--navy); }
.cmp-tab-add {
  margin: 0 0 4px 4px;
  padding: 2px 10px;
  font-size: 1.15rem;
  border-radius: 8px;
}
.cmp-tab-add:hover { background: #FFFFFF; color: var(--navy); }

/* Work area ------------------------------------------------------------------------------------------------------- */
.cmp-work {
  display: grid;
  grid-template-columns: var(--cmp-palette-w) minmax(0, 1fr) var(--cmp-inspector-w);
  min-height: 0;
}

/* Palette */
.cmp-palette {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #FFFFFF;
  border-right: 1px solid var(--border);
  /* the canvas beside it moves while panning: without containment WebKit paints the panels again on every frame */
  contain: paint;
}
.cmp-palette-head { padding: 12px 12px 8px; }
.cmp-search {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.88rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--light);
}
.cmp-palette-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 12px 12px;
}
.cmp-palette-help {
  margin: 0;
  padding: 10px 14px;
  font-size: 0.76rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.cmp-pal-cat + .cmp-pal-cat { margin-top: 18px; }
.cmp-pal-cat-title {
  margin: 10px 0 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange-text);
}
.cmp-pal-olo .cmp-pal-cat-title,
.cmp-pal-subsystem .cmp-pal-cat-title { color: var(--navy); }
.cmp-pal-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.cmp-pal-items {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cmp-pal-item {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 8px 10px 8px 12px;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: var(--light);
  border: 1px solid var(--border);
  border-left: 4px solid var(--orange);
  border-radius: 10px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.cmp-pal-olo .cmp-pal-item { border-left-color: var(--navy); }
.cmp-pal-subsystem .cmp-pal-item { border-left-color: var(--navy); border-left-style: double; }
.cmp-pal-item:hover {
  background: #FFFFFF;
  border-color: var(--orange);
  transform: translateX(2px);
}
.cmp-pal-olo .cmp-pal-item:hover,
.cmp-pal-subsystem .cmp-pal-item:hover { border-color: var(--navy); }
.cmp-pal-name { font-size: 0.86rem; font-weight: 600; }
.cmp-pal-entity {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}
.cmp-pal-vendor,
.cmp-vendor {
  align-self: flex-start;
  margin-top: 4px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--navy);
  background: var(--surface);
}
.cmp-vendor { margin-top: 0; }
.cmp-pal-none { color: var(--text-muted); font-size: 0.85rem; }

.cmp-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  background: #FFFFFF;
  border: 1px solid var(--orange);
  border-left-width: 4px;
  border-radius: 10px;
  box-shadow: 0 14px 28px rgba(14, 26, 43, 0.22), 0 3px 8px rgba(14, 26, 43, 0.12);
  pointer-events: none;
  opacity: 0.94;
  transform-origin: 30% 0;
  will-change: transform;
}
.cmp-ghost-olo { border-color: var(--navy); }
.cmp-ghost-subsystem { border-color: var(--navy); border-left-style: double; }
.cmp-ghost.is-over-canvas { opacity: 1; }
body.cmp-dragging,
body.cmp-dragging * { cursor: grabbing !important; user-select: none; }

/* Canvas */
.cmp-canvas-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  /* never scrolled, not even by focus: the SVG reaches beyond the visible area */
  overflow: clip;
  background: var(--cmp-canvas-bg);
}
.cmp-canvas {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  font-family: var(--font-sans);
  /* labels without kerning and ligatures: WebKit draws the many short labels three times faster while panning */
  text-rendering: optimizeSpeed;
}
.cmp-canvas.is-panning { cursor: grabbing; }
/* dot grid below the SVG, moved by a transform (see CanvasView.applyGrid) */
.cmp-grid {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  will-change: transform;
}
/* while panning: twice the visible area, centred on it, moved as a whole (see CanvasView.panFrame) */
.cmp-canvas-wrap.is-pan-big .cmp-canvas {
  left: -50%;
  top: -50%;
  width: 200%;
  height: 200%;
}

.cmp-block { cursor: move; }
.cmp-block-shadow {
  fill: rgba(14, 26, 43, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.cmp-block.is-lifted .cmp-block-shadow { opacity: 1; }
.cmp-block.is-lifted .cmp-block-body { stroke: var(--orange); }
.cmp-block.is-leaving,
.cmp-auto.is-leaving { pointer-events: none; }
.cmp-canvas.is-moving { cursor: grabbing; }
.cmp-block:focus { outline: none; }
.cmp-block-body {
  fill: #FFFFFF;
  stroke: var(--border);
  stroke-width: 1.5;
  transition: stroke 0.15s ease;
}
.cmp-block-head { fill: #FFF6F0; }
.cmp-block-stripe { fill: var(--orange); }
.cmp-block-olo .cmp-block-head { fill: #F1F4F8; }
.cmp-block-olo .cmp-block-stripe { fill: var(--navy); }
/* a subsystem: a system inside, drawn with a double outline */
.cmp-block-subsystem .cmp-block-head { fill: #EEF1F6; }
.cmp-block-subsystem .cmp-block-stripe { fill: var(--navy); }
.cmp-block-subsystem .cmp-block-body { stroke: var(--navy); stroke-width: 1.5; stroke-dasharray: 7 3; }
.cmp-block-changed text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  fill: var(--orange-text);
}
.cmp-block-bottleneck text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  fill: var(--orange-text);
}
.cmp-block.is-bottleneck .cmp-block-body { stroke: var(--orange); stroke-width: 2; }
.cmp-traffic-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  align-items: center;
  margin-top: 4px;
}
.cmp-traffic-row label { font-size: 0.8rem; color: var(--text-muted); }
.cmp-traffic-paths { margin-top: 6px; }
.cmp-subsystem-changed {
  margin: 8px 0;
  padding: 8px 10px;
  border: 1px solid var(--orange);
  border-radius: 8px;
  background: #FFF6F0;
}
.cmp-block-id {
  font-size: 15px;
  font-weight: 650;
  fill: var(--navy);
}
.cmp-block-name {
  font-size: 11.5px;
  fill: var(--text-muted);
}
.cmp-block:hover .cmp-block-body { stroke: #B8C2CE; }
.cmp-block.is-selected .cmp-block-body {
  stroke: var(--orange);
  stroke-width: 2.5;
}
.cmp-block-focus {
  fill: none;
  stroke: none;
  pointer-events: none;
}
.cmp-block:focus-visible .cmp-block-focus {
  stroke: var(--orange);
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

.cmp-port { cursor: crosshair; }
.cmp-port-hit { fill: transparent; }
.cmp-port-glyph {
  fill: #FFFFFF;
  stroke: var(--c);
  stroke-width: 2.4;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.12s ease, fill 0.12s ease;
}
.cmp-port.is-connected .cmp-port-glyph { fill: var(--c); }
.cmp-port:hover .cmp-port-glyph { transform: scale(1.3); }
.cmp-port-label {
  font-family: var(--font-mono);
  font-size: 11px;
  fill: var(--cmp-label);
  pointer-events: none;
}
.cmp-canvas.is-zoomed-out .cmp-port-label { display: none; }

.cmp-port-ring {
  fill: none;
  stroke: var(--c);
  stroke-width: 2;
  opacity: 0;
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
}
.cmp-canvas.is-connecting .cmp-port.is-target .cmp-port-ring { animation: cmp-ring 1.25s ease-out infinite; }
.cmp-canvas.is-connecting .cmp-port.is-snap .cmp-port-ring { animation: none; opacity: 0.9; transform: scale(1.5); }
.cmp-canvas.is-connecting .cmp-port.is-snap .cmp-port-glyph { fill: var(--c); transform: scale(1.7); animation: none; }
@keyframes cmp-ring {
  from { opacity: 0.75; transform: scale(0.8); }
  to { opacity: 0; transform: scale(2.1); }
}
.cmp-canvas.is-connecting .cmp-port { transition: opacity 0.18s ease; }
.cmp-canvas.is-connecting .cmp-port.is-dimmed { opacity: 0.22; }
.cmp-canvas.is-connecting .cmp-port.is-origin .cmp-port-glyph { fill: var(--c); transform: scale(1.3); }
.cmp-canvas.is-connecting .cmp-port.is-target .cmp-port-glyph {
  fill: var(--c);
  animation: cmp-pulse 0.9s ease-in-out infinite alternate;
}
@keyframes cmp-pulse {
  from { transform: scale(1.05); }
  to { transform: scale(1.55); }
}

.cmp-edge { cursor: pointer; }
.cmp-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
}
.cmp-edge-line {
  fill: none;
  stroke: var(--c);
  stroke-width: 2.6;
  stroke-linecap: round;
  transition: stroke-width 0.12s ease;
}
.cmp-edge:hover .cmp-edge-line { stroke-width: 3.6; }
.cmp-edge.is-selected .cmp-edge-line { stroke-width: 4.5; }
/* a halo without SVG filters (filters are expensive to draw) */
.cmp-edge.is-selected .cmp-edge-hit { stroke: rgba(238, 90, 18, 0.2); }
.cmp-band {
  fill: none;
  stroke: var(--c);
  stroke-width: 2.6;
  stroke-dasharray: 7 5;
  stroke-linecap: round;
  pointer-events: none;
}
.cmp-band.is-invalid { stroke: var(--cmp-danger); }
.cmp-band.is-snapped { stroke-dasharray: none; stroke-width: 3; }
.cmp-flash {
  fill: none;
  stroke: var(--c);
  stroke-width: 2.5;
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
}
.cmp-edge-flow {
  fill: none;
  stroke: #FFFFFF;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 0 18;
  opacity: 0;
  pointer-events: none;
}
.cmp-edge.is-flowing .cmp-edge-flow {
  opacity: 0.95;
  animation: cmp-flow 0.7s linear infinite;
}
@keyframes cmp-flow {
  to { stroke-dashoffset: -36; }
}

.cmp-tip {
  position: absolute;
  z-index: 10;
  max-width: 320px;
  padding: 8px 11px;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--light);
  background: var(--navy);
  border-radius: 8px;
  box-shadow: var(--shadow-lift);
  pointer-events: none;
}

.cmp-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
}
.cmp-empty[hidden] { display: none; }
.cmp-empty-card {
  max-width: 440px;
  padding: 26px 28px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(14, 26, 43, 0.06);
  pointer-events: auto;
}
.cmp-empty-card h2 { margin: 0 0 8px; font-size: 1.2rem; }
.cmp-empty-card p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.cmp-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

/* Right column: inspector, separator, checks; each part scrolls on its own */
.cmp-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #FFFFFF;
  border-left: 1px solid var(--border);
  contain: paint;
}
.cmp-split {
  position: relative;
  flex: 0 0 10px;
  margin: -5px 0;
  z-index: 4;
  cursor: row-resize;
  touch-action: none;
}
.cmp-split::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 3px;
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transform: translateX(-50%);
  transition: background-color 0.15s ease;
}
.cmp-split:hover::after,
.cmp-split:focus-visible::after,
.cmp-side.is-resizing .cmp-split::after { background: var(--navy); }
.cmp-split:focus-visible { outline-offset: -2px; }
.cmp-side.is-checks-closed .cmp-split { display: none; }
.cmp-side.is-resizing { user-select: none; }

/* Inspector */
.cmp-inspector {
  flex: 1 1 auto;
  min-height: 120px;
  overflow-y: auto;
  padding: 0 18px 28px;
  background: #FFFFFF;
}
.cmp-insp-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 0 -18px 12px;
  padding: 14px 18px 10px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
}
.cmp-insp-bar .cmp-insp-meta { margin-top: 6px; }
h2.cmp-insp-bar { margin: 0 -18px 14px; }
.cmp-inspector:focus { outline: none; }
.cmp-insp-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
}
.cmp-insp-sub {
  margin: 22px 0 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.cmp-insp-head { margin-bottom: 4px; }
.cmp-insp-head > .cmp-insp-summary:first-child { margin-top: 0; }
.cmp-input-title {
  font-size: 1.05rem !important;
  font-weight: 650;
}
.cmp-insp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.cmp-insp-summary { margin: 8px 0 0; font-size: 0.84rem; line-height: 1.5; }
.cmp-doc-link { display: inline-block; margin-top: 6px; font-size: 0.82rem; font-weight: 600; }

.cmp-field { margin: 0 0 14px; }
.cmp-field > label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin-bottom: 4px;
  font-size: 0.82rem;
  font-weight: 600;
}
.cmp-g-name {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
}
.cmp-input {
  width: 100%;
  padding: 7px 9px;
  font: inherit;
  font-size: 0.86rem;
  color: var(--text);
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.cmp-input.cmp-mono { font-family: var(--font-mono); font-size: 0.8rem; }
textarea.cmp-input { resize: vertical; }
.cmp-input[readonly] { color: var(--text-muted); background: var(--light); }
.cmp-input:disabled,
.cmp-check input:disabled { cursor: not-allowed; opacity: 0.55; }
.cmp-input:disabled { background: var(--light); }
.cmp-field.is-disabled > label,
.cmp-field.is-disabled .cmp-g-label { color: var(--text-muted); }
.cmp-dep-note { color: var(--text-muted); }
.cmp-input[aria-invalid="true"] { border-color: var(--cmp-danger); background: var(--cmp-danger-bg); }
.cmp-check {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 8px;
}
.cmp-check > label { margin: 0; }
.cmp-check > .cmp-help,
.cmp-check > .cmp-field-error,
.cmp-check > .cmp-reset { grid-column: 2; }
.cmp-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--navy); }
.cmp-help {
  margin: 4px 0 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--text-muted);
}
.cmp-facts { font-family: var(--font-mono); font-size: 0.7rem; }
.cmp-field-error {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--cmp-danger);
}
.cmp-field.is-changed {
  padding-left: 9px;
  border-left: 3px solid var(--orange);
}
.cmp-warn { color: var(--cmp-danger); }
.cmp-link-btn {
  padding: 0;
  font: inherit;
  font-size: 0.8rem;
  color: var(--orange-text);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.cmp-link-btn:hover { color: var(--navy); }
.cmp-reset { margin-top: 4px; }
.cmp-adv summary {
  margin: 4px 0 12px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.cmp-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 0.86rem; }
.cmp-autosave-note { margin-top: 22px; }

.cmp-itf-list { margin: 0; padding: 0; list-style: none; }
.cmp-itf {
  padding: 9px 8px;
  border-top: 1px solid var(--border);
  border-radius: 6px;
}
.cmp-itf.is-highlighted { background: #FFF6F0; }
.cmp-itf-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.cmp-chip-glyph path { fill: var(--c); }
.cmp-itf-name { font-size: 0.8rem; font-weight: 600; }
.cmp-itf-dir {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  color: var(--text-muted);
}
.cmp-itf-type { width: 100%; font-size: 0.76rem; color: var(--text-muted); }
.cmp-itf-label { margin: 2px 0 6px; font-size: 0.8rem; }
.cmp-itf-conn { margin: 0 0 4px; font-size: 0.8rem; }
.cmp-itf-addr { margin: 0 0 4px; font-size: 0.8rem; color: var(--text-muted); overflow-wrap: anywhere; }
.cmp-itf select { margin-top: 2px; }
.cmp-amap { margin: 0 0 10px; }
.cmp-amap-space { margin: 0 0 4px; font-size: 0.8rem; overflow-wrap: anywhere; }
.cmp-view-sub { margin-top: 10px; }
.cmp-facts-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0 0 10px;
  font-size: 0.86rem;
}
.cmp-facts-list dt { color: var(--text-muted); }
.cmp-facts-list dd { margin: 0; }
.cmp-notes { margin: 12px 0; padding-left: 18px; font-size: 0.82rem; }
.cmp-inspector > .cmp-btn-danger,
.cmp-inspector > .cmp-btn { margin-top: 18px; }

/* Messages and dialogs */
.cmp-toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 30;
  max-width: min(560px, calc(100% - 32px));
  padding: 10px 14px;
  font-size: 0.86rem;
  color: var(--cmp-danger);
  background: var(--cmp-danger-bg);
  border: 1px solid #F4C7C3;
  border-radius: 10px;
  box-shadow: var(--shadow-lift);
  transform: translateX(-50%);
}
.cmp-dialog {
  max-width: min(560px, calc(100vw - 32px));
  padding: 22px 24px;
  color: var(--text);
  border: 0;
  border-radius: 16px;
  box-shadow: var(--shadow-lift);
}
.cmp-dialog::backdrop { background: rgba(14, 26, 43, 0.45); }
.cmp-dialog-title { margin: 0 0 10px; font-size: 1.1rem; }
.cmp-dialog p,
.cmp-dialog-list { font-size: 0.88rem; }
.cmp-dialog-list { max-height: 50vh; overflow-y: auto; padding-left: 18px; }
.cmp-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* Narrow screens: a notice first, then a stacked layout */
.cmp-narrow { display: none; }
@media (max-width: 899px) {
  .cmp-narrow {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 14px;
    padding: 24px;
    background: rgba(244, 246, 248, 0.97);
  }
  .cmp-narrow p { max-width: 42ch; margin: 0; }
  body.cmp-narrow-ok .cmp-narrow { display: none; }
  .cmp-work {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 28%) minmax(0, 1fr) minmax(0, 32%);
  }
  .cmp-palette { border-right: 0; border-bottom: 1px solid var(--border); }
  .cmp-side { border-left: 0; border-top: 1px solid var(--border); }
  .site-header-compact .site-nav { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cmp *,
  .cmp-ghost {
    transition: none !important;
    animation: none !important;
  }
  .cmp-ghost { rotate: 0deg; }
}

/* The canvas takes focus on a click; with the keyboard its frame shows the focus */
.cmp-canvas:focus { outline: none; }
.cmp-canvas-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.cmp-canvas-wrap:has(.cmp-canvas:focus-visible)::after { box-shadow: inset 0 0 0 3px var(--cmp-focus); }
.cmp-block-id,
.cmp-block-name { pointer-events: none; }

/* Checks panel ----------------------------------------------------------------------------------------------------- */
.cmp-checks {
  display: flex;
  flex: 0 0 var(--cmp-checks-h, 220px);
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid var(--border);
}
.cmp-side.is-checks-closed .cmp-checks { flex-basis: auto; }
.cmp-checks-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 18px;
  font: inherit;
  color: var(--text);
  text-align: left;
  background: var(--light);
  border: 0;
  cursor: pointer;
}
.cmp-checks-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.cmp-checks-counts {
  display: flex;
  gap: 12px;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}
.cmp-checks-chevron { font-size: 1rem; color: var(--text-muted); }
.cmp-sev-error { color: var(--cmp-danger); }
.cmp-sev-warning { color: #9A5B00; }
.cmp-sev-info { color: #1864AB; }
.cmp-checks-list {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 6px 10px 10px;
  overflow-y: auto;
  list-style: none;
}
.cmp-check-item {
  display: flex;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.4;
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.cmp-check-item:hover:not(:disabled) { background: var(--light); }
.cmp-check-item:disabled { cursor: default; }
.cmp-check-sym { flex: 0 0 14px; font-weight: 700; }
.cmp-sym {
  display: inline-block;
  vertical-align: -1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cmp-sym-warning { fill: currentColor; stroke-width: 1.2; }
.cmp-check-item .cmp-sym { margin-top: 2px; }
.cmp-check-item.cmp-sev-error .cmp-check-sym { color: var(--cmp-danger); }
.cmp-check-item.cmp-sev-warning .cmp-check-sym { color: #9A5B00; }
.cmp-check-item.cmp-sev-info .cmp-check-sym { color: #1864AB; font-style: italic; font-family: var(--font-mono); }
.cmp-check-msg { color: var(--text); }
.cmp-check-none { padding: 8px; font-size: 0.8rem; color: var(--text-muted); }

/* Clock domains ---------------------------------------------------------------------------------------------------- */
.cmp-domain-box {
  fill: var(--d-fill);
  stroke: var(--d-stroke);
  stroke-width: 1.5;
  stroke-dasharray: 7 5;
  transition: stroke-width 0.15s ease;
}
.cmp-domain.is-selected .cmp-domain-box { stroke-width: 2.6; stroke-dasharray: none; }
.cmp-domain.is-drop-target .cmp-domain-box {
  stroke-width: 3;
  stroke-dasharray: none;
  fill: var(--d-stroke);
  fill-opacity: 0.12;
}
.cmp-domain-head { cursor: move; }
.cmp-domain-head.is-selected .cmp-domain-tab { stroke-width: 2.4; }
.cmp-domain-tab {
  fill: #FFFFFF;
  stroke: var(--d-stroke);
  stroke-width: 1.3;
}
.cmp-domain-label {
  font-size: 12px;
  font-weight: 600;
  fill: var(--navy);
}
.cmp-domain-reset {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-muted);
}
.cmp-domain-hint { font-size: 13px; fill: var(--text-muted); pointer-events: none; }

/* Inserted adapters, clock chips, external interfaces -------------------------------------------------------------- */
.cmp-auto { cursor: pointer; }
.cmp-auto:focus { outline: none; }
.cmp-auto-base { fill: #FFFFFF; }
.cmp-auto-half { fill: var(--t); fill-opacity: 0.14; }
.cmp-auto-border { stroke: #6C757D; stroke-width: 1.5; }
.cmp-auto-body {
  fill: none;
  stroke: #6C757D;
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}
.cmp-auto.is-selected .cmp-auto-body,
.cmp-auto:focus-visible .cmp-auto-body { stroke: var(--orange); stroke-width: 2.5; }
.cmp-auto-name { font-size: 12px; font-weight: 600; fill: var(--navy); pointer-events: none; }
.cmp-auto-detail { font-family: var(--font-mono); font-size: 10.5px; fill: var(--text-muted); pointer-events: none; }
.cmp-auto-badge rect { fill: var(--navy); }
.cmp-auto-badge text {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  fill: #FFFFFF;
}
.cmp-auto-port { fill: #FFFFFF; stroke: #6C757D; stroke-width: 1.5; }
.cmp-chip-box { fill: var(--d-fill); stroke: var(--d-stroke); stroke-width: 1; }
.cmp-chip-text { font-family: var(--font-mono); font-size: 10.5px; fill: var(--cmp-label); pointer-events: none; }
.cmp-port.is-external .cmp-port-glyph { fill: var(--c); }
.cmp-external-line { stroke: var(--navy); stroke-width: 1.5; stroke-dasharray: 3 3; }
.cmp-external-tag { fill: #FFFFFF; stroke: var(--navy); stroke-width: 1; }
.cmp-external-label { font-family: var(--font-mono); font-size: 10.5px; fill: var(--navy); pointer-events: none; }
.cmp-canvas.is-connecting .cmp-port.is-bridge .cmp-port-glyph {
  fill: #FFFFFF;
  stroke-dasharray: 2 2;
  transform: scale(1.35);
}
.cmp-band.is-bridge { stroke-dasharray: 2 5; }

.cmp-popover {
  position: absolute;
  z-index: 25;
  max-width: 340px;
  padding: 14px 16px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lift);
}
.cmp-popover-text { margin: 0 0 12px; font-size: 0.86rem; line-height: 1.45; }
.cmp-popover-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

/* Inspector additions */
.cmp-btn-small { padding: 5px 10px; font-size: 0.8rem; }
.cmp-field.is-auto .cmp-input { color: #174C82; background: #F1F6FB; }
.cmp-auto-note { margin: 4px 0 0; font-size: 0.76rem; color: #1864AB; }
.cmp-auto-tag {
  padding: 1px 7px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: #FFFFFF;
  background: var(--navy);
  border-radius: 999px;
}
.cmp-pack { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.cmp-pack th,
.cmp-pack td { padding: 3px 6px; text-align: left; border-bottom: 1px solid var(--border); }
.cmp-pack th { font-weight: 600; color: var(--text-muted); }
.cmp-btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.cmp-ext { margin-top: 6px; }
.cmp-ext-actions { display: flex; gap: 14px; margin-top: 4px; }
.cmp-notes li.cmp-sev-error { color: var(--cmp-danger); }
.cmp-notes li.cmp-sev-warning { color: #9A5B00; }

/* Legend ----------------------------------------------------------------------------------------------------------- */
.cmp-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  width: min(300px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lift);
}
.cmp-legend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 0 14px;
}
.cmp-legend-title { margin: 0; font-size: 0.95rem; }
.cmp-legend-close {
  padding: 2px 9px;
  font: inherit;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--text-muted);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.cmp-legend-close:hover { color: var(--navy); background: var(--light); }
.cmp-legend-note { margin: 4px 14px 8px; font-size: 0.74rem; line-height: 1.4; color: var(--text-muted); }
.cmp-legend-symbols {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 0 14px 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.cmp-legend-symbol { display: inline-flex; align-items: center; gap: 4px; }
.cmp-legend-body { min-height: 0; overflow-y: auto; padding: 0 14px 12px; }
.cmp-legend-family h3 {
  margin: 10px 0 4px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.cmp-legend-family ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.cmp-legend-family li {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 2px 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-radius: 6px;
}
.cmp-legend-family li.is-used { color: var(--text); font-weight: 600; background: var(--light); }
.cmp-legend-glyph path { fill: #FFFFFF; stroke: var(--c); stroke-width: 2.2; }
.cmp-legend-family li.is-used .cmp-legend-glyph path { fill: var(--c); }
.cmp-legend-id { font-family: var(--font-mono); font-size: 0.66rem; font-weight: 400; color: var(--text-muted); }
