@import "./styles/index.css";

:root {
  color-scheme: dark;
  font-family:
    Inter, Pretendard, "Noto Sans KR", ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #0b0e14;
  --chrome: #11151d;
  --panel: #151a23;
  --panel-raised: #1a202b;
  --panel-border: #28303d;
  --panel-border-strong: #343e4e;
  --text: #eef2f7;
  --text-subtle: #9aa6b6;
  --text-muted: #6e7a8c;
  --accent: #7c8cff;
  --accent-strong: #8f9cff;
  --accent-soft: rgba(124, 140, 255, 0.14);
  --success: #3dd6a3;
  --danger: #ff7182;
  --canvas: #f8fafc;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  --radius: 10px;
  --topbar-height: 56px;
  --statusbar-height: 28px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.svg-viewport:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: var(--topbar-height) minmax(0, 1fr) var(--statusbar-height);
  background: var(--bg);
}

.topbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid var(--panel-border);
  background: #0f131a;
}

.brand,
.brand-copy,
.toolbar,
.preview-tools,
.field-row,
.group-heading,
.statusbar-right {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  min-width: auto;
  flex-shrink: 0;
}

.brand-mark {
  position: relative;
  width: 28px;
  height: 28px;
}

.brand-mark span {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--accent-strong);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.brand-mark span:nth-child(1) {
  left: 1px;
  top: 10px;
}

.brand-mark span:nth-child(2) {
  right: 1px;
  top: 2px;
}

.brand-mark span:nth-child(3) {
  right: 1px;
  bottom: 2px;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  height: 1px;
  width: 15px;
  left: 7px;
  background: #606fc7;
  transform-origin: left center;
}

.brand-mark::before {
  top: 13px;
  transform: rotate(-28deg);
}

.brand-mark::after {
  top: 14px;
  transform: rotate(28deg);
}

.brand-copy {
  align-items: flex-start;
  flex-direction: column;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 13px;
  letter-spacing: 0.01em;
}

.brand-copy small {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.toolbar {
  flex: 1 1 0%;
  min-width: 0;
  margin-inline-start: auto;
  justify-content: safe flex-end;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 5px;
}

.toolbar::-webkit-scrollbar {
  display: none;
}

.primary-nav,
.mode-switcher-group {
  flex-shrink: 0;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: var(--panel-border);
}

.button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    transform 120ms ease;
}

.button:active,
.icon-button:active {
  transform: translateY(1px);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 11px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  box-sizing: border-box;
  line-height: 1.2;
  text-decoration: none;
}

.button.compact {
  min-height: 28px;
  padding-inline: 9px;
}

.button-quiet {
  background: transparent;
  border-color: var(--panel-border);
  color: #cbd3df;
}

.button-quiet:hover {
  background: var(--panel-raised);
  border-color: var(--panel-border-strong);
}

.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d1120;
}

.button-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.icon-button {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-color: var(--panel-border);
  color: #cbd3df;
  font-size: 17px;
  line-height: 1;
  box-sizing: border-box;
  flex-shrink: 0;
}

.icon-button.compact {
  width: 24px;
  height: 24px;
  font-size: 13px;
}

.icon-button:hover {
  background: var(--panel-raised);
}

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 33%) minmax(420px, 1fr) 292px;
  gap: 1px;
  background: var(--panel-border);
}

.panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr) 30px;
  background: var(--panel);
  overflow: hidden;
}

.inspector-panel {
  grid-template-rows: 52px minmax(0, 1fr) auto;
}

.panel-header {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border-bottom: 1px solid var(--panel-border);
  background: var(--chrome);
}

.panel-header h1,
.panel-header p,
.selection-summary h2,
.empty-inspector h2,
.property-group h3 {
  margin: 0;
}

.panel-header h1 {
  color: #dce3ed;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.panel-header p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 9px;
}

.status-chip,
.scope-badge,
.object-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  white-space: nowrap;
  box-sizing: border-box;
  line-height: 1.2;
}

.status-chip {
  padding: 4px 7px;
  background: var(--accent-soft);
  color: #aeb8ff;
}

.editor-wrap {
  min-height: 0;
  position: relative;
  background: #10141b;
}

#dot-editor {
  width: 100%;
  height: 100%;
  display: block;
  resize: none;
  border: 0;
  padding: 14px 15px 80px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px) 0 0 / 48px 100%,
    #10141b;
  color: #cfd7e4;
  caret-color: #aeb8ff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 1.58;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

#dot-editor::selection {
  background: rgba(124, 140, 255, 0.31);
}

.panel-footer {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
  border-top: 1px solid var(--panel-border);
  background: var(--chrome);
  color: var(--text-muted);
  font-size: 9px;
  white-space: nowrap;
}

.preview-tools {
  gap: 5px;
}

.zoom-status {
  min-width: 44px;
  text-align: center;
  color: var(--text-subtle);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.canvas-shell {
  min-height: 0;
  position: relative;
  overflow: hidden;
  background-color: var(--canvas);
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
  background-size: 20px 20px;
}

.svg-viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
  touch-action: none;
  user-select: none;
}

.svg-viewport.is-space-panning {
  cursor: grab !important;
}

.svg-viewport.is-dragging-canvas {
  cursor: grabbing !important;
}

.svg-stage {
  min-width: 100%;
  min-height: 100%;
  display: grid;
  place-items: center;
  transform-origin: center center;
  transition: none;
  will-change: transform;
}

.svg-stage > svg {
  display: block;
  width: min(100%, 1080px);
  height: auto;
  min-width: 560px;
  overflow: visible;
  filter: drop-shadow(0 10px 24px rgba(15, 23, 42, 0.08));
}

.render-state {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(100, 116, 139, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  color: #475569;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  font-size: 10px;
  backdrop-filter: blur(8px);
}

.render-state[hidden] {
  display: none;
}

.render-state.error {
  color: #9f1239;
  border-color: rgba(225, 29, 72, 0.22);
  background: rgba(255, 241, 242, 0.96);
}

.spinner {
  width: 11px;
  height: 11px;
  border: 2px solid #cbd5e1;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Graphviz interaction layer. It changes temporary SVG state only. */
.svg-stage g.node,
.svg-stage g.edge,
.svg-stage g.cluster {
  transition:
    opacity 130ms ease,
    filter 130ms ease;
}

.svg-stage g.node,
.svg-stage g.edge {
  cursor: pointer;
}

.svg-stage.has-focus g.node,
.svg-stage.has-focus g.edge,
.svg-stage.has-focus g.cluster {
  opacity: 0.12;
}

.svg-stage.has-focus g.is-active {
  opacity: 1;
}

.svg-stage g.is-selected {
  opacity: 1 !important;
  filter: drop-shadow(0 0 4px rgba(99, 102, 241, 0.42));
}

.svg-stage g.node.is-selected polygon,
.svg-stage g.node.is-selected path,
.svg-stage g.node.is-selected ellipse {
  stroke: #4f46e5 !important;
  stroke-width: 2.4px !important;
}

.svg-stage g.edge.is-selected path {
  stroke: #4f46e5 !important;
  stroke-width: 2.7px !important;
}

.svg-stage g.edge.is-selected polygon {
  fill: #4f46e5 !important;
  stroke: #4f46e5 !important;
}

.svg-stage .edge-hit-area {
  fill: none !important;
  stroke: rgba(0, 0, 0, 0.001) !important;
  stroke-width: 14px !important;
  pointer-events: stroke;
}

.svg-stage g.edge text,
.svg-stage g.cluster text {
  paint-order: stroke fill;
  stroke: #f8fafc;
  stroke-width: 5px;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.svg-stage:is(.has-focus, .has-search, .has-layer-highlight, .has-timeline-playback) g[data-part="label-foreground-layer"] {
  display: none;
}

.inspector-content {
  min-height: 0;
  overflow: auto;
  background: var(--panel);
}

.empty-inspector {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.empty-illustration {
  position: relative;
  width: 90px;
  height: 58px;
  margin-bottom: 18px;
}

.empty-node {
  position: absolute;
  top: 12px;
  left: 5px;
  width: 34px;
  height: 34px;
  border: 1px solid #3d4757;
  border-radius: 7px;
  background: #1b222e;
}

.empty-node.small {
  right: 5px;
  left: auto;
  top: 19px;
  width: 28px;
  height: 28px;
}

.empty-edge {
  position: absolute;
  top: 29px;
  left: 38px;
  width: 24px;
  height: 1px;
  background: #505b6e;
}

.empty-edge::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -3px;
  border-left: 5px solid #505b6e;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
}

.empty-inspector h2 {
  font-size: 13px;
}

.empty-inspector p {
  max-width: 220px;
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.6;
}

.selection-summary {
  padding: 17px 14px 14px;
  border-bottom: 1px solid var(--panel-border);
  background: #131821;
}

.object-kind {
  display: inline-block;
  padding: 3px 6px;
  margin-bottom: 8px;
  background: var(--accent-soft);
  color: #aeb8ff;
}

.selection-summary h2 {
  font-size: 14px;
  font-weight: 720;
  overflow-wrap: anywhere;
}

.selection-summary code {
  display: block;
  margin-top: 7px;
  color: var(--text-muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  overflow-wrap: anywhere;
}

.property-group {
  padding: 15px 14px;
  border-bottom: 1px solid var(--panel-border);
}

.property-group h3 {
  color: #cdd5e1;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.group-heading {
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 13px;
}

.scope-badge {
  padding: 3px 6px;
  background: rgba(61, 214, 163, 0.1);
  color: #78e6c0;
}

.definition-list {
  display: grid;
  gap: 9px;
  margin: 13px 0 0;
}

.definition-list div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.definition-list dt {
  color: var(--text-muted);
  font-size: 9px;
}

.definition-list dd {
  min-width: 0;
  margin: 0;
  color: #cbd3df;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--text-subtle);
  font-size: 9px;
  font-weight: 650;
}

.field-row {
  align-items: stretch;
  gap: 7px;
}

.number-input {
  min-width: 0;
  width: 92px;
  height: 34px;
  border: 1px solid var(--panel-border-strong);
  border-radius: 7px;
  padding: 0 9px;
  background: #0f131a;
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.field-help {
  margin: 9px 0 0;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.55;
}

.field-help.error {
  color: var(--danger);
}

.inspector-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--panel-border);
  background: var(--chrome);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-subtle);
  font-size: 9px;
  cursor: pointer;
}

.toggle-row input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 11px;
  border-top: 1px solid #202733;
  background: #0c1016;
  color: var(--text-muted);
  font-size: 9px;
}

.statusbar-right {
  gap: 6px;
}

.dot-separator {
  color: #394252;
}

body[data-render-state="error"] #app-message {
  color: var(--danger);
}

body[data-render-state="ready"] #app-message {
  color: var(--success);
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: minmax(280px, 36%) minmax(400px, 1fr);
  }

  .inspector-panel {
    position: absolute;
    z-index: 5;
    right: 10px;
    top: calc(var(--topbar-height) + 10px);
    bottom: calc(var(--statusbar-height) + 10px);
    width: 292px;
    border: 1px solid var(--panel-border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
}

@media (max-width: 760px) {
  .topbar {
    gap: 8px;
  }

  .brand-copy small,
  .toolbar .button-quiet,
  .toolbar-divider {
    display: none;
  }

  .workspace {
    grid-template-columns: minmax(250px, 44%) minmax(360px, 1fr);
  }
}

/* v0.3 — managed ERD editing surfaces */
.workspace {
  grid-template-columns: minmax(320px, 31%) minmax(500px, 1fr) 340px;
}

button:disabled,
.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.button-danger {
  border-color: rgba(255, 113, 130, 0.28);
  background: rgba(255, 113, 130, 0.08);
  color: #ff9daa;
}

.button-danger:hover {
  border-color: rgba(255, 113, 130, 0.55);
  background: rgba(255, 113, 130, 0.14);
}

.button.full,
.full {
  width: 100%;
}

.button-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.button-row.two > *,
.button-row.three > * {
  flex: 1;
  min-width: 0;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: min(230px, 28vw);
}

.search-box::before {
  content: none;
}

.search-box > span {
  position: absolute;
  left: 8px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
  z-index: 1;
}

.search-box input,
.dialog input,
.dialog select,
.inspector-content input,
.inspector-content select,
.inspector-content textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--panel-border-strong);
  border-radius: 7px;
  background: #0f131a;
  color: var(--text);
  transition: border-color 120ms ease, background 120ms ease;
}

.search-box input {
  height: 28px;
  padding: 0 9px 0 27px;
  font-size: 10px;
}

.search-box input::placeholder,
.dialog input::placeholder,
.inspector-content input::placeholder {
  color: #5e6979;
}

.search-box input:focus,
.dialog input:focus,
.dialog select:focus,
.inspector-content input:focus,
.inspector-content select:focus,
.inspector-content textarea:focus {
  border-color: var(--accent);
  outline: 0;
}

.focus-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.focus-controls label,
.toggle-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-subtle);
  font-size: 9px;
}

.focus-controls select {
  height: 28px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  padding: 0 24px 0 8px;
  background: #11161f;
  color: #cbd3df;
  font-size: 9px;
}

.toggle-inline input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--accent);
}

.inspector-content {
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #3a4556 transparent;
}

.property-group {
  padding: 14px 13px;
  border-bottom: 1px solid var(--panel-border);
}

.property-group:last-child {
  border-bottom: 0;
}

.property-group h3 {
  color: #dce3ed;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.group-heading {
  min-width: 0;
  justify-content: space-between;
  gap: 9px;
  margin-bottom: 11px;
}

.scope-badge {
  max-width: 170px;
  padding: 4px 7px;
  overflow: hidden;
  background: rgba(124, 140, 255, 0.1);
  color: #9faaff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-grid {
  display: grid;
  gap: 9px;
}

.form-grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-subtle);
  font-size: 9px;
  font-weight: 670;
  letter-spacing: 0.012em;
}

.dialog input,
.dialog select,
.inspector-content input,
.inspector-content select,
.inspector-content textarea {
  min-height: 34px;
  padding: 7px 9px;
  font-family: inherit;
  font-size: 10px;
}

.inspector-content input[type="color"] {
  min-height: 34px;
  padding: 4px;
}

.inspector-content input[type="checkbox"],
.dialog input[type="checkbox"] {
  width: 14px;
  min-height: 14px;
  height: 14px;
  padding: 0;
  accent-color: var(--accent);
}

.field-note,
.property-note,
.empty-copy {
  margin: 0;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.55;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.overview-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.018);
}

.overview-card strong {
  display: block;
  color: #edf2f8;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.overview-card span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.object-list,
.column-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.object-row,
.column-item {
  width: 100%;
  display: grid;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  text-align: left;
}

.object-row {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 8px 9px;
}

.object-row:hover,
.column-item:hover {
  border-color: var(--panel-border);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
}

.object-row.selected,
.column-item.selected {
  border-color: rgba(124, 140, 255, 0.42);
  background: var(--accent-soft);
  color: #e7eaff;
}

.object-row strong,
.object-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.object-row strong {
  font-size: 10px;
}

.object-row span {
  color: var(--text-muted);
  font-size: 8px;
}

.column-list {
  max-height: 226px;
  overflow: auto;
  padding-right: 2px;
}

.column-item {
  grid-template-columns: 38px minmax(0, 1fr) minmax(68px, auto);
  padding: 7px 8px;
  font-size: 9px;
}

.column-key {
  color: #a9b4c3;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
}

.column-name {
  overflow: hidden;
  color: inherit;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-type {
  overflow: hidden;
  color: var(--text-muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-editor {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-border);
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.check-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  color: var(--text-subtle);
  font-size: 9px;
}

.endpoint-box,
.relation-endpoint {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.018);
}

.endpoint-box strong,
.relation-endpoint strong {
  display: block;
  overflow: hidden;
  color: #e6ebf2;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.endpoint-box span,
.relation-endpoint span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--text-muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relation-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
}

.relation-arrow {
  color: var(--text-muted);
  text-align: center;
}

.empty-inspector {
  padding: 22px 15px;
}

.empty-inspector h2 {
  margin-bottom: 8px;
  color: #e1e7ef;
  font-size: 12px;
}

.selection-summary {
  min-width: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(124, 140, 255, 0.045);
}

.selection-summary h2 {
  margin-top: 5px;
  overflow: hidden;
  color: #edf1f6;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.object-kind {
  display: inline-block;
  color: #9ea9ba;
}

.dialog {
  width: min(430px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--panel-border-strong);
  border-radius: 12px;
  background: #151a23;
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.dialog.dialog-wide {
  width: min(690px, calc(100vw - 32px));
}

.dialog::backdrop {
  background: rgba(4, 7, 11, 0.72);
  backdrop-filter: blur(3px);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--panel-border);
  background: #11151d;
}

.dialog-header h2 {
  margin: 0;
  font-size: 12px;
}

.dialog-close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 142px);
  padding: 15px;
  overflow: auto;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  padding-top: 3px;
}

.svg-stage g.node,
.svg-stage g.edge,
.svg-stage g.cluster {
  transition: opacity 120ms ease, filter 120ms ease;
}

.svg-stage.has-focus g.node:not(.is-active),
.svg-stage.has-focus g.edge:not(.is-active),
.svg-stage.has-focus g.cluster:not(.is-active),
.svg-stage.has-search g.node:not(.is-search-match),
.svg-stage.has-search g.edge:not(.is-search-match),
.svg-stage.has-search g.cluster:not(.is-search-match) {
  opacity: 0.12;
}

.svg-stage g.node.is-selected polygon,
.svg-stage g.node.is-selected path,
.svg-stage g.node.is-selected ellipse,
.svg-stage g.cluster.is-selected polygon,
.svg-stage g.cluster.is-selected path {
  filter: drop-shadow(0 0 3px rgba(37, 99, 235, 0.45));
  stroke-width: 2.2px !important;
}

.svg-stage g.edge.is-selected path {
  filter: drop-shadow(0 0 2px rgba(37, 99, 235, 0.42));
  stroke-width: 2.6px !important;
}

.svg-stage g.is-search-match {
  opacity: 1;
  filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.5));
}

.edge-hit-area {
  fill: none;
  stroke: transparent;
  stroke-width: 15px;
  pointer-events: stroke;
  cursor: pointer;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(300px, 34%) minmax(450px, 1fr);
  }

  .inspector-panel {
    position: absolute;
    z-index: 7;
    right: 10px;
    top: calc(var(--topbar-height) + 10px);
    bottom: calc(var(--statusbar-height) + 10px);
    width: 340px;
    border: 1px solid var(--panel-border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
}

@media (max-width: 820px) {
  .search-box,
  .focus-controls {
    display: none;
  }

  .workspace {
    grid-template-columns: minmax(260px, 43%) minmax(420px, 1fr);
  }
}

.dialog-body.relation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 11px;
}

.dialog-body.relation-grid .field-label:nth-last-child(1) {
  grid-column: 1 / -1;
}

.overview-grid {
  padding: 13px;
  border-bottom: 1px solid var(--panel-border);
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.color-grid input[type="color"] {
  cursor: pointer;
}

.endpoint-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.endpoint-box code {
  min-width: 0;
  overflow: hidden;
  color: #e6ebf2;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.endpoint-box code:last-child {
  text-align: right;
}

.endpoint-box > span {
  margin: 0;
  color: var(--accent-strong);
  font-family: inherit;
  font-size: 11px;
}

.field-origin {
  margin-left: 4px;
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 500;
}

/* v0.4 contextual live source editor */
.source-header {
  padding-right: 9px;
}

.source-header-actions,
.segmented-control,
.context-summary,
.context-card-header,
.context-card-actions,
.context-card-meta,
.context-legend {
  display: flex;
  align-items: center;
}

.source-header-actions {
  min-width: 0;
  gap: 7px;
}

.segmented-control {
  padding: 2px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  background: #0d1118;
}

.segment-button {
  min-width: 48px;
  height: 22px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 9px;
  font-weight: 720;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-sizing: border-box;
  line-height: 1;
}

.segment-button:hover {
  color: var(--text-subtle);
}

.segment-button.is-active {
  background: var(--panel-raised);
  color: #dce3ed;
  box-shadow: 0 0 0 1px var(--panel-border-strong);
}

.editor-wrap {
  overflow: hidden;
}

.context-editor,
.full-source-editor {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.full-source-editor {
  position: relative;
}

.context-editor {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  background: #10141b;
}

.context-summary {
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px 9px;
  border-bottom: 1px solid rgba(40, 48, 61, 0.68);
  background: #111720;
}

.context-summary h2,
.context-summary p {
  margin: 0;
}

.context-summary h2 {
  color: #e4e9f1;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.25;
}

.context-summary p {
  max-width: 330px;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.45;
}

.context-count {
  flex: 0 0 auto;
  padding: 3px 6px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.context-legend {
  gap: 12px;
  padding: 7px 14px;
  border-bottom: 1px solid rgba(40, 48, 61, 0.68);
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.025em;
}

.context-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6b7280;
}

.legend-dot.direct {
  background: #8f9cff;
}

.legend-dot.related {
  background: #3dd6a3;
}

.legend-dot.inherited {
  background: #7c8798;
}

.context-blocks {
  min-height: 0;
  overflow: auto;
  padding: 10px 10px 72px;
  scrollbar-gutter: stable;
}

.context-empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.6;
}

.context-card {
  position: relative;
  margin-bottom: 9px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-left-width: 3px;
  border-radius: 8px;
  background: #121821;
}

.context-card[data-role="direct"] {
  border-left-color: #8f9cff;
}

.context-card[data-role="related"] {
  border-left-color: #3dd6a3;
}

.context-card[data-role="inherited"] {
  border-left-color: #667085;
  background: #11161e;
}

.context-card.is-editing {
  border-color: #6674d7;
  border-left-color: #aeb8ff;
  box-shadow: 0 0 0 1px rgba(124, 140, 255, 0.18);
}

.context-card-header {
  justify-content: space-between;
  gap: 8px;
  min-height: 43px;
  padding: 7px 8px 7px 10px;
  border-bottom: 1px solid rgba(40, 48, 61, 0.72);
}

.context-card-title {
  min-width: 0;
}

.context-card-title strong,
.context-card-title small {
  display: block;
}

.context-card-title strong {
  overflow: hidden;
  color: #dce3ed;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-card-title small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-card-actions {
  flex: 0 0 auto;
  gap: 4px;
}

.context-action {
  height: 23px;
  padding: 0 6px;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 8px;
  font-weight: 650;
}

.context-action:hover {
  border-color: var(--panel-border-strong);
  background: var(--panel-raised);
  color: var(--text-subtle);
}

.context-role {
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(124, 140, 255, 0.11);
  color: #aeb8ff;
  font-size: 7px;
  font-weight: 760;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.context-card[data-role="related"] .context-role {
  background: rgba(61, 214, 163, 0.1);
  color: #74e4bf;
}

.context-card[data-role="inherited"] .context-role {
  background: rgba(110, 122, 140, 0.12);
  color: #97a3b4;
}

.context-code {
  width: 100%;
  min-height: 76px;
  max-height: 320px;
  display: block;
  resize: vertical;
  border: 0;
  padding: 10px 11px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px) 0 0 / 44px 100%,
    #0e131a;
  color: #d2dae6;
  caret-color: #aeb8ff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 10px;
  line-height: 1.55;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

.context-code[readonly] {
  color: #8894a5;
  background: #10151c;
  cursor: default;
}

.context-code::selection {
  background: rgba(124, 140, 255, 0.31);
}

.context-card-meta {
  justify-content: space-between;
  gap: 8px;
  min-height: 25px;
  padding: 0 9px;
  border-top: 1px solid rgba(40, 48, 61, 0.58);
  color: var(--text-muted);
  font-size: 7.5px;
  font-variant-numeric: tabular-nums;
}

.context-live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.context-live-indicator::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(61, 214, 163, 0.08);
}

.context-card.has-error .context-live-indicator::before {
  background: var(--danger);
}

.source-panel[data-source-validity="invalid"] .status-chip {
  background: rgba(255, 113, 130, 0.12);
  color: #ff9baa;
}

.source-panel[data-source-validity="pending"] .status-chip {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}

@media (max-width: 1180px) {
  .source-header-actions .status-chip {
    display: none;
  }

  .segment-button {
    min-width: 43px;
    padding-inline: 6px;
  }
}

.context-card.is-targeted {
  border-color: #7c8cff;
  box-shadow: 0 0 0 2px rgba(124, 140, 255, 0.14);
}

/* v0.5 — profile switch and nested architecture */
.profile-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 7px 0 9px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-select select {
  height: 26px;
  border: 0;
  background: transparent;
  color: #dce3ed;
  font-size: 10px;
  font-weight: 700;
  outline: 0;
}

.profile-select option {
  background: #11151d;
  color: #eef2f7;
}

.selection-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  color: #93a0b2;
  font-size: 9px;
  line-height: 1.45;
}

.selection-breadcrumb span {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-breadcrumb i {
  color: #4a5567;
  font-style: normal;
}

.architecture-tree {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.architecture-tree::-webkit-scrollbar {
  height: 4px;
}

.architecture-tree::-webkit-scrollbar-track {
  background: transparent;
}

.architecture-tree::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.architecture-tree .tree-branch,
.architecture-tree .tree-row-shell,
.architecture-tree .tree-children {
  min-width: max-content;
}

.tree-branch {
  display: grid;
  gap: 3px;
  min-width: max-content;
}

.tree-row {
  margin-left: calc(var(--tree-depth, 0) * 13px);
}

.tree-row::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border: 1px solid #667085;
  border-radius: 2px;
}

body[data-profile="architecture"] .brand-mark span {
  border-radius: 1px;
}

body[data-profile="architecture"] .canvas-shell {
  background-size: 24px 24px;
}

@media (max-width: 1220px) {
  .profile-select span {
    display: none;
  }

  .profile-select {
    padding-inline: 4px;
  }
}

/* v0.6 — render-only container collapse and architecture layer filters */
.view-control-button.has-view-state {
  border-color: rgba(124, 140, 255, 0.72);
  background: rgba(124, 140, 255, 0.16);
  color: #c9cfff;
}

.architecture-view-panel {
  position: absolute;
  z-index: 20;
  top: 14px;
  right: 14px;
  width: min(340px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.94);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  animation: viewPanelFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes viewPanelFadeIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.view-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.view-panel-header strong {
  display: block;
  color: #f1f5f9;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.view-panel-header small {
  display: block;
  margin-top: 2px;
  color: #94a3b8;
  font-size: 11px;
}

.view-panel-section {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.view-panel-section h3 {
  margin: 0;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.view-panel-footer {
  padding: 12px 16px;
  background: rgba(10, 14, 23, 0.6);
}

.layer-presets-bar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.35);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.preset-chip-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-chip:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(30, 41, 59, 0.7);
  color: #ffffff;
}

.preset-chip.is-active {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.22);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

.preset-chip-icon {
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
}

.filter-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 8px;
}

.filter-mode-label {
  font-size: 10.5px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.filter-mode-tabs {
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.filter-mode-btn {
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-sizing: border-box;
  line-height: 1.2;
}

.filter-mode-btn:hover {
  color: #f1f5f9;
}

.filter-mode-btn.is-active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.layer-metric-bar {
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: 3px 0 2px;
}

.layer-metric-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.layer-filter-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  margin-bottom: 8px;
}

.layer-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 3.5px solid var(--layer-color, #6366f1);
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.45);
  transition: all 0.15s ease;
}

.layer-item-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(30, 41, 59, 0.85);
  transform: translateX(2px);
}

.layer-item-card.is-disabled {
  opacity: 0.45;
  filter: grayscale(0.6);
}

.layer-toggle-hitbox {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  user-select: none;
}

.layer-checkbox-native {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.layer-visibility-icon {
  font-size: 14px;
  line-height: 1;
  opacity: 0.85;
  transition: transform 0.15s ease;
}

.layer-toggle-hitbox:hover .layer-visibility-icon {
  transform: scale(1.18);
  opacity: 1;
}

.layer-color-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  box-shadow: 0 0 8px var(--layer-color, #6366f1);
}

.layer-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.layer-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.layer-icon {
  font-size: 12px;
  line-height: 1;
}

.layer-name {
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--layer-color, #6366f1) 22%, transparent);
  color: var(--layer-color, #818cf8);
}

.layer-counts {
  color: #94a3b8;
  font-size: 9.5px;
}

.layer-solo-button {
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.layer-solo-button:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 25%, transparent);
  color: #ffffff;
}

/* Cluster & Container Visual Enhancements on Canvas */
.svg-stage g.cluster {
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.svg-stage g.cluster:hover > polygon,
.svg-stage g.cluster:hover > path {
  filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.4));
  stroke-width: 1.6px !important;
}

.svg-stage g.cluster.is-selected > polygon,
.svg-stage g.cluster.is-selected > path {
  filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.5));
  stroke: #38bdf8 !important;
  stroke-width: 2px !important;
}

.svg-stage g.is-layer-hidden {
  display: none !important;
}

.svg-stage g.is-layer-ghosted {
  opacity: 0.12 !important;
  filter: grayscale(0.92) !important;
  pointer-events: none;
  transition: opacity 0.22s ease, filter 0.22s ease;
}

.svg-stage g.is-layer-glow {
  filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.8)) !important;
}

.svg-stage.has-layer-highlight g.node:not(.is-layer-hovered) {
  opacity: 0.28;
  filter: grayscale(0.7);
  transition: all 0.18s ease;
}

.svg-stage.has-layer-highlight g.node.is-layer-hovered {
  filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.9)) !important;
  transition: all 0.18s ease;
}

.svg-stage g.cluster.is-layer-empty {
  opacity: 0.2;
  filter: grayscale(0.85);
}

.svg-stage g.node.arch-container-summary polygon,
.svg-stage g.node.arch-container-summary path {
  stroke-dasharray: 6 4;
}

.tree-row-shell {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 25px;
  gap: 4px;
  align-items: stretch;
  margin-left: calc(var(--tree-depth, 0) * 13px);
}

.tree-row-shell .tree-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-left: 0;
  padding: 6px 10px;
  border-radius: 7px;
  transition: all 0.15s ease;
}

.tree-row-main {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.tree-kind-icon {
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
}

.tree-label {
  color: #f1f5f9;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-row-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.tree-kind-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  color: #94a3b8;
  text-transform: uppercase;
}

.tree-count-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
}

.tree-collapse-button {
  width: 25px;
  min-height: 30px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: all 0.15s ease;
}

.tree-collapse-button:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #c9cfff;
}

.tree-collapse-button:disabled {
  opacity: 0.25;
  cursor: default;
}

.tree-children {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  margin-left: 12px;
  padding-left: 8px;
  border-left: 1.5px solid rgba(255, 255, 255, 0.08);
}

.tree-branch.is-collapsed > .tree-children {
  display: none;
}

.tree-branch.is-collapsed > .tree-row-shell .tree-row {
  border-color: rgba(124, 140, 255, 0.42);
  background: rgba(124, 140, 255, 0.08);
}

.view-state-property {
  background: rgba(124, 140, 255, 0.045);
}

@media (max-width: 980px) {
  .architecture-view-panel {
    width: min(290px, calc(100% - 18px));
    top: 9px;
    right: 9px;
  }
}

/* v0.24 — Excalidraw coordinate composition and drawing-reference browser gates */
.app-content {
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.app-page {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.editor-workspace {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--layers-panel-width, 290px) 4px minmax(360px, 1fr) 4px var(--inspector-panel-width, 350px);
  gap: 0;
  background: var(--panel-border);
  position: relative;
}

.editor-workspace.is-layers-collapsed {
  grid-template-columns: minmax(360px, 1fr) 4px var(--inspector-panel-width, 350px);
}

.editor-workspace.is-inspector-collapsed {
  grid-template-columns: var(--layers-panel-width, 290px) 4px minmax(360px, 1fr);
}

.editor-workspace.is-layers-collapsed.is-inspector-collapsed {
  grid-template-columns: minmax(360px, 1fr);
}

.editor-workspace.is-inspector-collapsed #right-resizer,
.editor-workspace.is-inspector-collapsed .inspector-panel {
  display: none !important;
}

.editor-workspace.is-layers-collapsed #left-resizer,
.editor-workspace.is-layers-collapsed .layers-panel {
  display: none !important;
}

/* Viewer Mode UI Separation */
.app-shell.is-viewer-mode .editor-workspace {
  grid-template-columns: minmax(360px, 1fr) !important;
}

.app-shell.is-viewer-mode #left-resizer,
.app-shell.is-viewer-mode #right-resizer,
.app-shell.is-viewer-mode .layers-panel,
.app-shell.is-viewer-mode .inspector-panel,
.app-shell.is-viewer-mode .inspector-open-button,
.app-shell.is-viewer-mode .sidebar-open-button,
.app-shell.is-viewer-mode .editor-only-action {
  display: none !important;
}

.app-shell.is-viewer-mode .viewer-only-action {
  display: inline-flex !important;
}

.viewer-only-action {
  display: none !important;
}

.mode-switcher-group {
  display: inline-flex;
  align-items: center;
  background: var(--panel-raised, #f1f5f9);
  border: 1px solid var(--panel-border, #cbd5e1);
  border-radius: var(--radius-sm, 6px);
  padding: 2px;
  gap: 2px;
}

.mode-switcher-btn {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-subtle, #64748b);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mode-switcher-btn:hover {
  color: var(--text, #0f172a);
}

.mode-switcher-btn.is-active {
  background: var(--panel, #ffffff);
  color: var(--accent, #0284c7);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.panel-resizer {
  width: 4px;
  height: 100%;
  background: var(--panel-border);
  cursor: col-resize;
  position: relative;
  z-index: 15;
  user-select: none;
  transition: background 0.15s ease;
}

.panel-resizer:hover,
.panel-resizer.is-dragging {
  background: var(--accent, #6366f1);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
}

.panel-resizer::after {
  content: "";
  position: absolute;
  inset: 0 -4px;
}

.layers-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  background: var(--panel);
  overflow: hidden;
  border-right: 1px solid var(--panel-border);
}

.layers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--panel-border);
}

.layers-header h1 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.01em;
}

.layers-header p {
  margin: 2px 0 0;
  font-size: 10.5px;
  color: var(--text-muted);
}

.layers-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.layers-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.layers-section .group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}

.layers-section .group-heading h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #cbd5e1;
  text-transform: uppercase;
}

.layer-heading-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 3px;
}

.button.micro {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  font-size: 9.5px;
  min-height: 20px;
  border-radius: 4px;
  white-space: nowrap;
  box-sizing: border-box;
  line-height: 1.2;
}

.compact-row {
  margin-bottom: 8px;
}

.layers-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--panel-border);
  background: var(--panel-raised);
}

.preview-header-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-open-button,
.inspector-open-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.12);
  padding: 3px 8px;
  white-space: nowrap;
  box-sizing: border-box;
}

.sidebar-open-button:hover,
.inspector-open-button:hover {
  background: rgba(99, 102, 241, 0.24);
  color: #ffffff;
}

.source-page {
  background: var(--panel-border);
}

.source-page .source-panel {
  width: 100%;
  height: 100%;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.018);
}

.primary-nav-button {
  min-width: 68px;
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.015em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
  box-sizing: border-box;
}

.primary-nav-button:hover {
  color: var(--text);
  background: var(--panel-raised);
}

.primary-nav-button.is-active {
  color: #eef1ff;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(124, 140, 255, 0.32);
}

.inspector-header {
  gap: 8px;
}

.inspector-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inspector-aspect-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  background: #0e1219;
}

.inspector-aspect-button {
  min-height: 25px;
  border: 0;
  border-radius: 5px;
  padding: 0 9px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 9px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-sizing: border-box;
  line-height: 1.2;
}

.inspector-aspect-button.is-active {
  background: var(--accent-soft);
  color: #b6bfff;
}

.is-aspect-hidden,
.is-aspect-empty {
  display: none !important;
}

.inspector-footer {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.inspector-footer-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.settings-page {
  overflow: auto;
  padding: 36px clamp(24px, 5vw, 72px) 64px;
  background:
    radial-gradient(circle at 15% 0%, rgba(124, 140, 255, 0.08), transparent 28%),
    var(--bg);
}

.settings-page-header {
  width: min(1120px, 100%);
  margin: 0 auto 24px;
}

.settings-page-header h1 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.settings-page-header p {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.6;
}

.settings-grid {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.012));
  box-shadow: 0 12px 34px rgba(0,0,0,0.12);
}

.settings-card header h2 {
  margin: 0;
  color: #e6ebf3;
  font-size: 13px;
  font-weight: 750;
}

.settings-card header p {
  margin: 6px 0 18px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.55;
}

.settings-field {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  color: var(--text-subtle);
  font-size: 10px;
}

.settings-field select,
.settings-field input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--panel-border-strong);
  border-radius: 7px;
  padding: 0 10px;
  background: #0f131a;
  color: var(--text);
  font-size: 10px;
}

.settings-toggle {
  min-height: 36px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.settings-note {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.6;
}

.settings-definition-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.settings-definition-list div {
  display: grid;
  grid-template-columns: 115px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.045);
}

.settings-definition-list dt {
  color: var(--text-muted);
  font-size: 9px;
}

.settings-definition-list dd {
  margin: 0;
  color: #cbd3df;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.settings-action-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

body[data-page="source"] .toolbar #add-schema-button,
body[data-page="source"] .toolbar #add-table-button,
body[data-page="source"] .toolbar #add-relation-button,
body[data-page="settings"] .toolbar #add-schema-button,
body[data-page="settings"] .toolbar #add-table-button,
body[data-page="settings"] .toolbar #add-relation-button {
  opacity: 0.5;
}

@media (max-width: 1180px) {
  .brand-copy small {
    display: none;
  }
  .editor-workspace {
    grid-template-columns: minmax(480px, 1fr) 330px;
  }
  .toolbar .button-quiet:nth-of-type(-n+2) {
    display: none;
  }
}

@media (max-width: 880px) {
  .topbar {
    gap: 8px;
  }
  .brand-copy {
    display: none;
  }
  .primary-nav-button {
    min-width: 56px;
    padding-inline: 8px;
  }
  .editor-workspace {
    grid-template-columns: minmax(420px, 1fr);
  }
  .inspector-panel {
    position: absolute;
    z-index: 8;
    right: 10px;
    top: 10px;
    bottom: 10px;
    width: min(360px, calc(100vw - 20px));
    border: 1px solid var(--panel-border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

/* Page-scoped toolbar actions */
body:not([data-page="editor"]) .editor-only-action {
  display: none !important;
}

/* ==========================================================================
   Visual Shape Picker Component
   ========================================================================== */

.shape-visual-picker-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-block: 6px 12px;
  grid-column: 1 / -1;
}

.shape-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--panel-raised);
  border: 1px solid var(--panel-border-strong);
  border-radius: 8px;
}

.shape-preview-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shape-preview-glyph {
  width: 36px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.shape-preview-glyph .shape-svg {
  width: 100%;
  height: 100%;
}

.shape-preview-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shape-preview-text strong {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}

.shape-preview-text small {
  font-size: 11px;
  color: var(--text-subtle);
}

.shape-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding: 4px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
}

.shape-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--text-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
}

.shape-card:hover {
  background: var(--panel-raised);
  border-color: var(--panel-border-strong);
  color: var(--text);
  transform: translateY(-1px);
}

.shape-card.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 8px rgba(124, 140, 255, 0.3);
}

.shape-card-icon {
  width: 32px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shape-card-icon .shape-svg {
  width: 100%;
  height: 100%;
}

.shape-card-name {
  font-size: 10px;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ==========================================================================
   Color Swatch Picker & Custom Palette Controls
   ========================================================================== */
.color-swatch-picker-container {
  width: 100%;
  margin-top: 4px;
}

.color-swatch-palette {
  background: var(--panel, #1e293b);
  border: 1px solid var(--panel-border, #334155);
  border-radius: 8px;
  padding: 8px;
}

.color-swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(22px, 1fr));
  gap: 6px;
  align-items: center;
}

.color-swatch-btn {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  position: relative;
  outline: none;
}

.color-swatch-btn:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

.color-swatch-btn.is-active {
  box-shadow: 0 0 0 2px var(--bg-surface, #0f172a), 0 0 0 4px var(--accent, #6366f1);
  z-index: 3;
}

.color-swatch-btn.has-border {
  border: 1px solid #94a3b8;
}

.color-swatch-check {
  font-size: 10px;
  font-weight: bold;
  color: #ffffff;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.85);
  display: none;
  line-height: 1;
}

.color-swatch-btn.is-active .color-swatch-check {
  display: block;
}

/* Custom native color picker swatch */
.color-swatch-custom-wrapper {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1px dashed #64748b;
  display: grid;
  place-items: center;
  position: relative;
  cursor: pointer;
  background: var(--panel-raised, #334155);
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.color-swatch-custom-wrapper:hover {
  transform: scale(1.2);
  border-color: var(--accent, #6366f1);
  z-index: 2;
}

.color-swatch-custom-wrapper.is-active {
  border-color: var(--accent, #6366f1);
  box-shadow: 0 0 0 2px var(--bg-surface, #0f172a), 0 0 0 4px var(--accent, #6366f1);
  z-index: 3;
}

.color-swatch-custom-label {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  cursor: pointer;
  margin: 0;
}

.color-swatch-custom-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.color-swatch-custom-icon {
  font-size: 11px;
  line-height: 1;
  user-select: none;
}

/* ==========================================================================
   HTML Overlay Layer, Drag Handles & Guidelines
   ========================================================================== */
.canvas-overlay-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  overflow: visible;
}

.canvas-guidelines-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9;
  overflow: visible;
}

.node-overlay-box {
  position: absolute;
  pointer-events: auto;
  border: 1.5px dashed #3b82f6;
  border-radius: 6px;
  box-sizing: border-box;
  background: rgba(59, 130, 246, 0.05);
  transition: border-color 0.12s ease;
}

.node-overlay-box.is-dragging {
  border-color: #6366f1;
  border-style: solid;
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.35);
}

.overlay-drag-handle {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #6366f1;
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: grab;
  font-size: 13px;
  font-weight: bold;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  user-select: none;
  z-index: 12;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.overlay-drag-handle:hover {
  background: #4f46e5;
  transform: scale(1.18);
}

.overlay-drag-handle:active,
.node-overlay-box.is-dragging .overlay-drag-handle {
  cursor: grabbing;
  background: #4338ca;
  transform: scale(1.25);
}

.guideline-line {
  stroke: #6366f1;
  stroke-width: 1.5px;
  stroke-dasharray: 4, 3;
}

.guideline-line.center {
  stroke: #3b82f6;
  stroke-width: 1.5px;
}

.guideline-line.leading,
.guideline-line.trailing {
  stroke: #10b981;
  stroke-width: 1.5px;
}

.guideline-line.grid {
  stroke: #94a3b8;
  stroke-width: 1px;
  stroke-dasharray: 2, 2;
}

.node-inline-editor {
  position: absolute;
  z-index: 25;
  border: 2px solid #6366f1;
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  outline: none;
  box-sizing: border-box;
  resize: none;
}

/* ==========================================================================
   Settings Page: Kind Registry Manager
   ========================================================================== */
.settings-card-wide {
  grid-column: 1 / -1;
}

.settings-card-header-with-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.settings-card-header-with-actions h2 {
  margin: 0;
  font-size: 13px;
  color: #edf2f8;
}

.settings-card-header-with-actions p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 10px;
}

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

.kind-registry-table-container {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #0f141c;
}

.kind-registry-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  text-align: left;
}

.kind-registry-table th {
  background: #151b26;
  color: var(--text-subtle);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.03em;
  padding: 9px 12px;
  border-bottom: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
}

.kind-registry-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.kind-registry-table tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

.kind-registry-table code {
  color: #e2e8f0;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10.5px;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 5px;
  border-radius: 4px;
}

.kind-style-preview {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-subtle);
}

.kind-swatch-box {
  display: inline-block;
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1.5px solid #94a3b8;
  flex-shrink: 0;
  vertical-align: middle;
}

.kind-target-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
}

.kind-target-badge.target-resource {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.kind-target-badge.target-container {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.kind-target-badge.target-connection {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.badge-builtin {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
}

.badge-custom {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.kind-actions-cell {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Layer Config Dialog */
.layer-config-dialog {
  max-width: 820px;
  width: 95vw;
}

.layer-config-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 65vh;
  overflow-y: auto;
}

.layer-config-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--panel-border);
}

.layer-config-table-container {
  overflow-x: auto;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.layer-edit-label,
.layer-edit-kinds {
  width: 100%;
  padding: 4px 8px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  color: var(--text);
}

.layer-edit-label:focus,
.layer-edit-kinds:focus,
.layer-edit-icon:focus,
.layer-edit-badge:focus {
  border-color: var(--accent);
  outline: none;
}

.layer-edit-icon,
.layer-edit-badge {
  padding: 4px 6px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  color: var(--text);
}

/* ==========================================================================
   Milestone 2: Resource Lifecycle Status Badge & Glow Styles
   ========================================================================== */

@keyframes statusPulse {
  0%, 100% {
    opacity: 1;
    filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.4));
  }
  50% {
    opacity: 0.65;
    filter: drop-shadow(0 0 12px rgba(59, 130, 246, 0.7));
  }
}

@keyframes alertGlowPulse {
  0%, 100% {
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.6)) drop-shadow(0 0 16px rgba(239, 68, 68, 0.3));
  }
  50% {
    filter: drop-shadow(0 0 14px rgba(239, 68, 68, 0.85)) drop-shadow(0 0 24px rgba(239, 68, 68, 0.5));
  }
}

@keyframes pulseFailedAlert {
  0%, 100% {
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.6));
  }
  50% {
    filter: drop-shadow(0 0 16px rgba(239, 68, 68, 0.9));
  }
}

@keyframes pulseProvisioning {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.65;
  }
}

@keyframes statePulseAlert {
  0% {
    filter: drop-shadow(0 0 3px rgba(239, 68, 68, 0.45));
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.95)) drop-shadow(0 0 24px rgba(239, 68, 68, 0.55));
  }
  100% {
    filter: drop-shadow(0 0 3px rgba(239, 68, 68, 0.45));
  }
}

@keyframes statePulseProvisioning {
  0% {
    filter: drop-shadow(0 0 2px rgba(59, 130, 246, 0.35));
  }
  50% {
    filter: drop-shadow(0 0 9px rgba(59, 130, 246, 0.85));
  }
  100% {
    filter: drop-shadow(0 0 2px rgba(59, 130, 246, 0.35));
  }
}

@keyframes stateDashMarch {
  to {
    stroke-dashoffset: -16;
  }
}

/* --- Healthy State --- */
.state-healthy,
g.node.state-healthy,
g.cluster.state-healthy {
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.45));
  transition: stroke 200ms ease, filter 200ms ease;
}
.state-healthy > polygon,
.state-healthy > path,
.state-healthy > rect,
.state-healthy > ellipse,
g.node.state-healthy polygon,
g.node.state-healthy path,
g.node.state-healthy rect,
g.node.state-healthy ellipse,
g.cluster.state-healthy polygon,
g.cluster.state-healthy path,
g.cluster.state-healthy rect {
  stroke: #10b981 !important;
  stroke-dasharray: none !important;
}

/* --- Degraded State --- */
.state-degraded,
g.node.state-degraded,
g.cluster.state-degraded {
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.5));
  transition: stroke 200ms ease, filter 200ms ease;
}
.state-degraded > polygon,
.state-degraded > path,
.state-degraded > rect,
.state-degraded > ellipse,
g.node.state-degraded polygon,
g.node.state-degraded path,
g.node.state-degraded rect,
g.node.state-degraded ellipse,
g.cluster.state-degraded polygon,
g.cluster.state-degraded path,
g.cluster.state-degraded rect {
  stroke: #f59e0b !important;
  stroke-dasharray: 6 3 !important;
}

/* --- Provisioning State --- */
.state-provisioning,
g.node.state-provisioning,
g.cluster.state-provisioning {
  animation: statePulseProvisioning 2.2s ease-in-out infinite;
}
.state-provisioning > polygon,
.state-provisioning > path,
.state-provisioning > rect,
.state-provisioning > ellipse,
g.node.state-provisioning polygon,
g.node.state-provisioning path,
g.node.state-provisioning rect,
g.node.state-provisioning ellipse,
g.cluster.state-provisioning polygon,
g.cluster.state-provisioning path,
g.cluster.state-provisioning rect {
  stroke: #0ea5e9 !important;
  stroke-dasharray: 5 3 !important;
  animation: stateDashMarch 1.6s linear infinite;
}

/* --- Failed State --- */
.state-failed,
g.node.state-failed,
g.cluster.state-failed {
  animation: statePulseAlert 1.2s ease-in-out infinite;
}
.state-failed > polygon,
.state-failed > path,
.state-failed > rect,
.state-failed > ellipse,
g.node.state-failed polygon,
g.node.state-failed path,
g.node.state-failed rect,
g.node.state-failed ellipse,
g.cluster.state-failed polygon,
g.cluster.state-failed path,
g.cluster.state-failed rect {
  stroke: #ef4444 !important;
  stroke-width: 2px !important;
}

/* --- Terminating State --- */
.state-terminating,
g.node.state-terminating,
g.cluster.state-terminating {
  opacity: 0.72 !important;
  filter: grayscale(0.45) drop-shadow(0 0 4px rgba(100, 116, 139, 0.3));
  transition: opacity 200ms ease;
}
.state-terminating > polygon,
.state-terminating > path,
.state-terminating > rect,
.state-terminating > ellipse,
g.node.state-terminating polygon,
g.node.state-terminating path,
g.node.state-terminating rect,
g.node.state-terminating ellipse,
g.cluster.state-terminating polygon,
g.cluster.state-terminating path,
g.cluster.state-terminating rect {
  stroke: #64748b !important;
  stroke-dasharray: 2 3 !important;
}

/* --- Property Inspector Status Chip & Picker --- */
.status-visual-picker-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.status-preview-header {
  width: 100%;
}

.status-preview-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--panel-raised);
  border: 1px solid var(--panel-border);
  transition: all 0.18s ease-in-out;
}

.status-preview-icon {
  font-size: 16px;
  line-height: 1;
}

.status-preview-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.status-preview-text strong {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.status-preview-text small {
  font-size: 11px;
  color: var(--text-subtle);
}

.status-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 6px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  color: var(--text-subtle);
  font-size: 10.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  min-width: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  box-sizing: border-box;
}

.status-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--panel-border-strong);
  color: var(--text);
}

.status-chip.is-active {
  background: rgba(124, 140, 255, 0.16);
  border-color: var(--accent);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--accent);
}

.status-chip[data-status-value="healthy"].is-active {
  background: rgba(16, 185, 129, 0.18);
  border-color: #10b981;
  color: #a7f3d0;
  box-shadow: 0 0 0 1px #10b981;
}

.status-chip[data-status-value="degraded"].is-active {
  background: rgba(245, 158, 11, 0.18);
  border-color: #f59e0b;
  color: #fde68a;
  box-shadow: 0 0 0 1px #f59e0b;
}

.status-chip[data-status-value="provisioning"].is-active {
  background: rgba(59, 130, 246, 0.18);
  border-color: #3b82f6;
  color: #bfdbfe;
  box-shadow: 0 0 0 1px #3b82f6;
}

.status-chip[data-status-value="failed"].is-active {
  background: rgba(239, 68, 68, 0.22);
  border-color: #ef4444;
  color: #fecaca;
  box-shadow: 0 0 0 1px #ef4444;
}

.status-chip[data-status-value="terminating"].is-active {
  background: rgba(100, 116, 139, 0.2);
  border-color: #64748b;
  color: #cbd5e1;
  box-shadow: 0 0 0 1px #64748b;
}

.status-chip-icon {
  font-size: 11px;
}

.status-dropdown-wrapper {
  margin-top: 4px;
}

.field-label-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field-label-caption {
  font-size: 11px;
  color: var(--text-muted);
}

.status-select {
  flex: 1;
  padding: 4px 8px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  color: var(--text);
}

.status-select:focus {
  border-color: var(--accent);
  outline: none;
}

.property-status-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.property-status-select {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--text);
}

.property-status-select:focus {
  border-color: var(--accent);
  outline: none;
}

/* ==========================================================================
   Step-by-Step Timeline Player & Glassmorphic Dock
   ========================================================================== */

/* --- Floating Glassmorphic Dock Container --- */
.timeline-player-dock {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: min(880px, calc(100% - 40px));
  max-width: 880px;
  z-index: 45;
  background: rgba(17, 21, 29, 0.78);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.52),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  padding: 10px 14px;
  color: var(--text);
  user-select: none;
  animation: timelineDockSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes timelineDockSlideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 14px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.timeline-dock-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --- Dock Header --- */
.timeline-dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.timeline-meta-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.timeline-badge {
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(124, 140, 255, 0.2);
  border: 1px solid rgba(124, 140, 255, 0.4);
  color: var(--accent-strong);
  text-transform: uppercase;
}

.timeline-title {
  font-size: 12px;
  font-weight: 650;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-step-counter {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timeline-dock-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-preset-select {
  padding: 3px 8px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  color: var(--text);
}

/* --- Annotation Callout Card --- */
.timeline-annotation-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: var(--text);
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-annotation-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}

.timeline-annotation-badge.info {
  background: rgba(59, 130, 246, 0.22);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.timeline-annotation-badge.callout {
  background: rgba(139, 92, 246, 0.22);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.35);
}

.timeline-annotation-badge.warning {
  background: rgba(245, 158, 11, 0.22);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.timeline-annotation-badge.error {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

/* --- Step Chips Strip --- */
.timeline-step-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 4px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.timeline-step-chip {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.timeline-step-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.timeline-step-chip.is-active {
  background: rgba(124, 140, 255, 0.22);
  border-color: #7c8cff;
  color: #ffffff;
  font-weight: 650;
  box-shadow: 0 0 10px rgba(124, 140, 255, 0.4);
}

/* --- Transport Controls & Scrubber --- */
.timeline-transport-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.timeline-transport-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.timeline-btn-play.is-playing {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #0f172a;
}

.timeline-scrubber-wrapper {
  display: flex;
  align-items: center;
  width: 100%;
}

.timeline-scrubber {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.timeline-scrubber:hover {
  background: rgba(255, 255, 255, 0.2);
}

.timeline-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #7c8cff;
  border: 2px solid #ffffff;
  box-shadow: 0 0 8px rgba(124, 140, 255, 0.7);
  cursor: grab;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.timeline-scrubber::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(124, 140, 255, 0.95);
}

.timeline-scrubber::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #7c8cff;
  border: 2px solid #ffffff;
  box-shadow: 0 0 8px rgba(124, 140, 255, 0.7);
  cursor: grab;
}

.timeline-transport-options {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timeline-rate-select {
  padding: 3px 6px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  color: var(--text);
}

.timeline-loop-label {
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
}

/* --- SVG Stage Highlighting Classes --- */
.timeline-player-dock[data-theme="white-red"],
[data-theme="white-red"] .timeline-player-dock,
.theme-white-red .timeline-player-dock {
  background: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(15, 23, 42, 0.03) inset;
  color: #0F172A;
}

[data-theme="white-red"] .timeline-title,
.theme-white-red .timeline-title { color: #0F172A; }
[data-theme="white-red"] .timeline-step-counter,
.theme-white-red .timeline-step-counter,
[data-theme="white-red"] .timeline-loop-label,
.theme-white-red .timeline-loop-label { color: #64748B; }
[data-theme="white-red"] .timeline-badge,
.theme-white-red .timeline-badge { background: #FEF2F2; border-color: #EF4444; color: #991B1B; }
[data-theme="white-red"] .timeline-step-chip,
.theme-white-red .timeline-step-chip { background: #F1F5F9; border-color: #CBD5E1; color: #475569; }
[data-theme="white-red"] .timeline-step-chip:hover,
.theme-white-red .timeline-step-chip:hover { background: #F8FAFC; border-color: #EF4444; color: #991B1B; }
[data-theme="white-red"] .timeline-step-chip.is-active,
.theme-white-red .timeline-step-chip.is-active { background: #FEF2F2; border-color: #EF4444; color: #991B1B; box-shadow: 0 0 10px rgba(239, 68, 68, 0.18); }
[data-theme="white-red"] .timeline-preset-select,
.theme-white-red .timeline-preset-select,
[data-theme="white-red"] .timeline-rate-select,
.theme-white-red .timeline-rate-select { background: #FFFFFF; border-color: #CBD5E1; color: #1E293B; }
[data-theme="white-red"] .timeline-annotation-card,
.theme-white-red .timeline-annotation-card { background: #F8FAFC; border-color: #E2E8F0; color: #0F172A; }
[data-theme="white-red"] .timeline-scrubber,
.theme-white-red .timeline-scrubber { background: #E2E8F0; accent-color: #EF4444; }
[data-theme="white-red"] .timeline-scrubber::-webkit-slider-thumb,
.theme-white-red .timeline-scrubber::-webkit-slider-thumb,
[data-theme="white-red"] .timeline-scrubber::-moz-range-thumb,
.theme-white-red .timeline-scrubber::-moz-range-thumb { background: #EF4444; border-color: #FFFFFF; box-shadow: 0 0 8px rgba(239, 68, 68, 0.55); }
[data-theme="white-red"] .timeline-btn-play.is-playing,
.theme-white-red .timeline-btn-play.is-playing { background: #DC2626; border-color: #B91C1C; color: #FFFFFF; }

.svg-stage.has-timeline-playback [data-kind="node"],
.svg-stage.has-timeline-playback [data-kind="edge"],
.svg-stage.has-timeline-playback [data-kind="cluster"],
.svg-stage.has-timeline-playback g.node,
.svg-stage.has-timeline-playback g.edge,
.svg-stage.has-timeline-playback g.cluster {
  transition: opacity 0.22s ease-in-out, filter 0.22s ease-in-out;
}

.is-timeline-dimmed {
  opacity: 0.22 !important;
}

.is-timeline-active {
  opacity: 1 !important;
}

.svg-stage.has-timeline-playback g.node.is-timeline-active > path,
.svg-stage.has-timeline-playback g.node.is-timeline-active > polygon,
.svg-stage.has-timeline-playback g.node.is-timeline-active > ellipse {
  stroke: #ef4444 !important;
  stroke-width: 2.5px !important;
  filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.85)) !important;
}

.svg-stage.has-timeline-playback g.edge.flow-active {
  filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.9)) !important;
}

.svg-stage.has-timeline-playback g.edge.flow-active path {
  stroke: #ef4444 !important;
  fill: none !important;
  stroke-width: 2.5px !important;
}

.svg-stage.has-timeline-playback g.edge.flow-active polygon {
  stroke: #ef4444 !important;
  fill: #ef4444 !important;
}

/* Flow Dash Keyframe Animation */
@keyframes edgeFlowDash {
  from {
    stroke-dashoffset: 24;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes edgeFlowDashReverse {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: 24;
  }
}

.flow-active,
path.flow-active,
g.edge.flow-active path {
  fill: none !important;
  stroke-dasharray: 6 3 !important;
  animation: edgeFlowDash 1s linear infinite !important;
  will-change: stroke-dashoffset;
}

g.edge.flow-active polygon {
  stroke-dasharray: none !important;
  transition: stroke 200ms ease, fill 200ms ease;
}

.flow-active.flow-fast,
g.edge.flow-active.flow-fast path {
  animation-duration: 0.5s !important;
}

.flow-active.flow-slow,
g.edge.flow-active.flow-slow path {
  animation-duration: 2s !important;
}

.flow-active.flow-reverse,
g.edge.flow-active.flow-reverse path {
  animation-name: edgeFlowDashReverse !important;
}

/* --- Flow State Trajectories --- */
/* Default Flow (Blue) */
g.edge.flow-active,
g.edge.flow-active.flow-default,
g.edge.flow-active.flow-blue {
  filter: drop-shadow(0 0 5px rgba(59, 130, 246, 0.65));
}
g.edge.flow-active path,
g.edge.flow-active.flow-default path,
g.edge.flow-active.flow-blue path {
  stroke: #3b82f6 !important;
  fill: none !important;
}
g.edge.flow-active polygon,
g.edge.flow-active.flow-default polygon,
g.edge.flow-active.flow-blue polygon {
  stroke: #3b82f6 !important;
  fill: #3b82f6 !important;
}

/* Success Flow (Green) */
g.edge.flow-active.flow-success,
g.edge.flow-active.flow-healthy,
g.edge.flow-active.flow-green {
  filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.65));
}
g.edge.flow-active.flow-success path,
g.edge.flow-active.flow-healthy path,
g.edge.flow-active.flow-green path {
  stroke: #10b981 !important;
  fill: none !important;
}
g.edge.flow-active.flow-success polygon,
g.edge.flow-active.flow-healthy polygon,
g.edge.flow-active.flow-green polygon {
  stroke: #10b981 !important;
  fill: #10b981 !important;
}

/* Error / Alert Flow (Red) */
g.edge.flow-active.flow-error,
g.edge.flow-active.flow-failed,
g.edge.flow-active.flow-alert,
g.edge.flow-active.flow-red {
  filter: drop-shadow(0 0 7px rgba(239, 68, 68, 0.85));
}
g.edge.flow-active.flow-error path,
g.edge.flow-active.flow-failed path,
g.edge.flow-active.flow-alert path,
g.edge.flow-active.flow-red path {
  stroke: #ef4444 !important;
  fill: none !important;
}
g.edge.flow-active.flow-error polygon,
g.edge.flow-active.flow-failed polygon,
g.edge.flow-active.flow-alert polygon,
g.edge.flow-active.flow-red polygon {
  stroke: #ef4444 !important;
  fill: #ef4444 !important;
}

/* Warning / Degraded Flow (Amber) */
g.edge.flow-active.flow-warning,
g.edge.flow-active.flow-degraded,
g.edge.flow-active.flow-amber {
  filter: drop-shadow(0 0 5px rgba(245, 158, 11, 0.65));
}
g.edge.flow-active.flow-warning path,
g.edge.flow-active.flow-degraded path,
g.edge.flow-active.flow-amber path {
  stroke: #f59e0b !important;
  fill: none !important;
}
g.edge.flow-active.flow-warning polygon,
g.edge.flow-active.flow-degraded polygon,
g.edge.flow-active.flow-amber polygon {
  stroke: #f59e0b !important;
  fill: #f59e0b !important;
}

/* Terminating / Draining Flow (Slate) */
g.edge.flow-active.flow-terminating,
g.edge.flow-active.flow-slate {
  filter: drop-shadow(0 0 4px rgba(100, 116, 139, 0.4));
  opacity: 0.75;
}
g.edge.flow-active.flow-terminating path,
g.edge.flow-active.flow-slate path {
  stroke: #64748b !important;
  fill: none !important;
}
g.edge.flow-active.flow-terminating polygon,
g.edge.flow-active.flow-slate polygon {
  stroke: #64748b !important;
  fill: #64748b !important;
}

@media (prefers-reduced-motion: reduce) {
  .flow-active,
  path.flow-active,
  g.edge.flow-active path {
    animation: none !important;
    stroke-dasharray: 6 3 !important;
  }
}

/* Diagnostic & Linter Dialog */
.diagnostic-dialog {
  max-width: 820px;
  width: 90vw;
}

.diagnostic-dialog-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.diagnostic-dialog-summary-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.diagnostic-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

.diagnostic-badge.error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.diagnostic-badge.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.diagnostic-badge.info {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.diagnostic-table-container {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
}

#diagnostic-summary {
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

#diagnostic-summary:hover {
  background: rgba(255, 255, 255, 0.08);
  text-decoration: underline;
}

/* ==========================================================================
   ERD Style Design Gallery Modal & Card System
   ========================================================================== */

.erd-gallery-dialog {
  max-width: 960px;
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
}

.erd-gallery-body {
  padding: 16px 20px 24px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

.erd-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.erd-gallery-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--panel-raised, #1a202b);
  border: 1px solid var(--panel-border, #28303d);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.18s ease,
              box-shadow 0.18s ease;
  position: relative;
  user-select: none;
}

.erd-gallery-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent, #7c8cff);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
}

.erd-gallery-card.is-active {
  border-color: var(--accent, #7c8cff);
  box-shadow: 0 0 0 1px var(--accent, #7c8cff), 0 8px 24px rgba(124, 140, 255, 0.18);
  background: linear-gradient(180deg, rgba(124, 140, 255, 0.06) 0%, rgba(26, 32, 43, 1) 100%);
}

.erd-card-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.erd-card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.erd-card-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #eef2f7);
  letter-spacing: -0.01em;
}

.erd-card-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-subtle, #9aa6b6);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.erd-card-active-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent, #7c8cff);
  color: #0b0e14;
  margin-left: auto;
}

.erd-card-description {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-subtle, #9aa6b6);
}

.erd-card-preview-area {
  border-radius: 6px;
  padding: 12px;
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.erd-mini-table {
  width: 100%;
  max-width: 200px;
  border-style: solid;
  border-width: 1px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 10px;
  font-family: inherit;
}

.erd-mini-table-header {
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  border-bottom-style: solid;
  border-bottom-width: 1px;
  text-align: left;
}

.erd-mini-table-body {
  display: flex;
  flex-direction: column;
}

.erd-mini-table-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 4px;
  padding: 2.5px 8px;
  align-items: center;
  font-size: 9.5px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.erd-mini-table-row:last-child {
  border-bottom: none;
}

.erd-mini-col-pk,
.erd-mini-col-fk {
  font-weight: 700;
  font-size: 8.5px;
}

.erd-mini-col-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.erd-mini-col-type {
  opacity: 0.7;
  font-size: 8.5px;
  font-family: monospace;
}

.erd-palette-swatches {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}

.erd-swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  display: inline-block;
  flex-shrink: 0;
}

.erd-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
}

.erd-card-actions .erd-apply-button {
  width: 100%;
}



