:root {
  --author-bg: var(--bg);
  --author-paper: var(--panel);
  --author-ink: var(--text);
  --author-muted: var(--muted);
  --author-line: var(--border);
  --author-line-strong: var(--border-soft);
  --author-green: var(--good);
  --author-green-dark: var(--text-strong);
  --author-green-soft: rgba(123, 213, 140, 0.14);
  --author-lime: var(--warn);
  --author-amber: var(--warn);
  --author-amber-soft: rgba(246, 211, 107, 0.14);
  --author-red: var(--bad);
  --author-red-soft: rgba(229, 127, 127, 0.14);
  --author-blue: var(--accent-cool);
  --author-code: var(--font-mono);
  --author-shadow: var(--shadow);
}

:root[data-theme="light"] {
  --author-green-soft: #e3f1eb;
  --author-amber-soft: #fff2d5;
  --author-red-soft: #fde8e5;
}

.authoring-body {
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  background:
    radial-gradient(circle at 85% -10%, rgba(120, 198, 255, 0.15), transparent 31rem),
    var(--author-bg);
  color: var(--author-ink);
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

button,
select,
textarea,
input {
  font: inherit;
}

button,
select,
.file-button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(36, 90, 145, 0.32);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.app-header {
  min-height: 4.25rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: minmax(15rem, 1fr) auto minmax(15rem, 1fr);
  align-items: center;
  gap: 1.5rem;
  border-bottom: 1px solid var(--author-line);
  background: var(--panel-glass-strong);
  backdrop-filter: blur(16px);
  z-index: 5;
}

.product-mark {
  color: var(--author-ink);
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  width: fit-content;
}

.product-mark:hover {
  color: var(--author-ink);
}

.product-mark strong,
.product-mark small {
  display: block;
}

.product-mark strong {
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.product-mark small {
  color: var(--author-muted);
  font-size: 0.72rem;
  margin-top: 0.1rem;
}

.product-glyph {
  width: 2.3rem;
  height: 2.3rem;
  display: grid;
  place-items: center;
  border-radius: 0.72rem;
  color: var(--accent-cool-ink);
  background: linear-gradient(135deg, var(--accent-cool), var(--accent-cool-strong));
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: inset 0 -4px 9px rgba(0, 0, 0, 0.13);
}

.account-area {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.mode-badge,
.validation-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.85rem;
  padding: 0.25rem 0.65rem;
  border: 1px solid #b7d5c8;
  border-radius: 999px;
  color: var(--author-green-dark);
  background: var(--author-green-soft);
  font-size: 0.74rem;
  font-weight: 750;
}

.quiet-button,
.tool-button,
.primary-button,
.secondary-button {
  border-radius: 0.62rem;
  cursor: pointer;
  font-weight: 700;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.quiet-button:hover,
.tool-button:hover,
.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.quiet-button {
  border: 1px solid var(--author-line-strong);
  background: var(--author-paper);
  color: var(--author-ink);
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
}

.workspace-intro {
  padding: 1.15rem 1.5rem 1rem;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  border-bottom: 1px solid var(--author-line);
}

.workspace-intro h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2.4vw, 2.25rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.workspace-intro p:not(.eyebrow) {
  max-width: 54rem;
  margin: 0.45rem 0 0;
  color: var(--author-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.eyebrow,
.pane-kicker {
  margin: 0 0 0.3rem;
  color: var(--author-green);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.intro-state {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--author-line);
  border-radius: 0.8rem;
  background: var(--panel-glass);
}

.intro-state strong,
.intro-state small {
  display: block;
}

.intro-state strong {
  font-size: 0.8rem;
}

.intro-state small {
  color: var(--author-muted);
  font-size: 0.7rem;
  margin-top: 0.1rem;
}

.state-dot {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  background: var(--author-green);
  box-shadow: 0 0 0 5px var(--author-green-soft);
}

.project-bar {
  min-height: 3.65rem;
  padding: 0.55rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--author-line);
  background: var(--panel-glass);
}

.compact-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-left: 0.65rem;
  border: 1px solid var(--author-line-strong);
  border-radius: 0.62rem;
  background: var(--author-paper);
  overflow: hidden;
}

.compact-field > span {
  color: var(--author-muted);
  font-size: 0.69rem;
  font-weight: 700;
  white-space: nowrap;
}

.compact-field select {
  min-height: 2.3rem;
  border: 0;
  padding: 0 1.8rem 0 0.35rem;
  color: var(--author-ink);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 700;
}

.server-field {
  margin-left: auto;
}

.server-field select {
  width: min(18rem, 22vw);
}

.tool-button,
.file-button {
  min-height: 2.3rem;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--author-line-strong);
  background: var(--author-paper);
  color: var(--author-ink);
  padding: 0 0.72rem;
  font-size: 0.75rem;
  white-space: nowrap;
}

.tool-button.needs-action {
  border-color: #7c990d;
  color: #263500;
  background: var(--author-lime);
  box-shadow: 0 0 0 3px rgba(217, 242, 123, 0.22);
}

.tool-button.needs-action:hover {
  border-color: #627b00;
  background: #e4fb8e;
}

.tool-button.ids-current,
.tool-button.ids-current:disabled {
  border-color: #b7d5c8;
  color: var(--author-green-dark);
  background: var(--author-green-soft);
  opacity: 1;
}

.edit-mode-button {
  border-color: rgba(120, 198, 255, 0.55);
  color: var(--accent-cool);
  background: rgba(120, 198, 255, 0.1);
  box-shadow: 0 0 0 2px rgba(120, 198, 255, 0.08);
}

.edit-mode-button[aria-pressed="true"] {
  border-color: var(--accent-cool);
  color: var(--bg-deep);
  background: var(--accent-cool);
  box-shadow: 0 0 0 3px rgba(120, 198, 255, 0.18);
}

.tool-button:disabled,
.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.bar-divider {
  width: 1px;
  height: 1.8rem;
  margin: 0 0.15rem;
  background: var(--author-line-strong);
}

.workspace-shell {
  min-height: 0;
  padding: 0.85rem 1.5rem 1rem;
  display: grid;
  grid-template-columns: minmax(24rem, 1fr) minmax(24rem, 1fr);
  gap: 0.85rem;
}

.workspace-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--author-line);
  border-radius: 0.95rem;
  background: var(--author-paper);
  box-shadow: var(--author-shadow);
  overflow: hidden;
}

.pane-header {
  min-height: 4.2rem;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--author-line);
}

.pane-header h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.015em;
}

.editor-metrics {
  color: var(--author-muted);
  font-family: var(--author-code);
  font-size: 0.68rem;
}

.editor-wrap {
  position: relative;
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr);
  background: var(--code-bg);
}

.line-numbers {
  margin: 0;
  padding: 1rem 0.75rem 5rem 0;
  overflow: hidden;
  border-right: 1px solid var(--code-border);
  color: var(--muted);
  background: var(--bg-deep);
  font: 0.8rem/1.65 var(--author-code);
  text-align: right;
  user-select: none;
}

.editor-surface {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--code-bg);
}

.markdown-highlight,
#markdownEditor {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 20rem;
  resize: none;
  border: 0;
  outline: 0;
  padding: 1rem 1.15rem 5rem;
  font: 0.8rem/1.65 var(--author-code);
  tab-size: 2;
  white-space: pre;
}

.markdown-highlight {
  z-index: 1;
  margin: 0;
  color: var(--muted-strong);
  background: var(--code-bg);
  pointer-events: none;
  overflow: auto;
  scrollbar-width: none;
}

.markdown-highlight::-webkit-scrollbar {
  display: none;
}

#markdownEditor {
  z-index: 2;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: var(--author-lime);
  background: transparent;
  overflow: auto;
  scrollbar-gutter: stable;
}

.syntax-heading { color: var(--accent-cool); font-weight: 700; }
.syntax-heading-value { color: var(--text-strong); font-weight: 600; }
.syntax-front-key { color: var(--warn); }
.syntax-field { color: var(--good); font-weight: 650; }
.syntax-value { color: var(--text); }
.syntax-predicate { color: var(--accent-strong); }
.syntax-id { color: var(--info); }
.syntax-punctuation,
.syntax-separator { color: var(--muted); }
.syntax-sentinel { display: inline-block; width: 0; }

#markdownEditor::selection {
  color: #fff;
  background: rgba(114, 166, 142, 0.45);
}

.editor-wrap.dragging {
  box-shadow: inset 0 0 0 3px var(--author-lime);
}

.editor-wrap.dragging .drop-message {
  display: grid;
}

.drop-message {
  position: absolute;
  inset: 1rem;
  display: none;
  place-items: center;
  border: 2px dashed var(--author-lime);
  border-radius: 0.8rem;
  color: #efffc3;
  background: rgba(18, 51, 41, 0.94);
  font-weight: 800;
  pointer-events: none;
}

.editor-footer {
  min-height: 2rem;
  padding: 0 0.8rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  color: var(--muted);
  background: var(--bg-deep);
  font: 0.66rem var(--author-code);
}

.preview-header {
  border-bottom: 0;
}

.validation-badge.valid {
  border-color: #b7d5c8;
  color: var(--author-green-dark);
  background: var(--author-green-soft);
}

.validation-badge.warning {
  border-color: var(--warn);
  color: #ffe69a;
  background: #29261f;
}

:root[data-theme="light"] .validation-badge.warning {
  color: #5a3700;
  background: #fff2d5;
}

.validation-badge.error {
  border-color: #e4b0aa;
  color: var(--author-red);
  background: var(--author-red-soft);
}

.preview-tabs {
  padding: 0 1rem;
  display: flex;
  gap: 0.2rem;
  border-bottom: 1px solid var(--author-line);
}

.preview-tab {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--author-muted);
  padding: 0.72rem 0.7rem 0.68rem;
  font-size: 0.74rem;
  font-weight: 750;
  cursor: pointer;
}

.preview-tab::after {
  content: "";
  position: absolute;
  right: 0.65rem;
  bottom: -1px;
  left: 0.65rem;
  height: 2px;
  background: transparent;
}

.preview-tab.active {
  color: var(--author-green-dark);
}

.preview-tab.active::after {
  background: var(--author-green);
}

.preview-tab span {
  min-width: 1.25rem;
  display: inline-grid;
  place-items: center;
  margin-left: 0.2rem;
  padding: 0.08rem 0.3rem;
  border-radius: 999px;
  color: var(--author-muted);
  background: var(--bg-soft);
  font-size: 0.62rem;
}

.preview-content {
  min-height: 0;
  flex: 1 1 auto;
  position: relative;
}

.preview-panel {
  position: absolute;
  inset: 0;
  display: none;
  overflow: auto;
  scrollbar-gutter: stable;
  padding: 1rem;
}

.preview-panel.active {
  display: block;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  margin-bottom: 0.8rem;
}

.summary-item {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--author-line);
  border-radius: 0.72rem;
  background: var(--bg-soft);
}

.summary-item strong,
.summary-item span {
  display: block;
}

.summary-item strong {
  font-size: 1.15rem;
}

.summary-item span {
  margin-top: 0.12rem;
  color: var(--author-muted);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.empty-preview {
  min-height: 16rem;
  display: grid;
  place-items: center;
  padding: 2rem;
  border: 1px dashed var(--author-line-strong);
  border-radius: 0.8rem;
  color: var(--author-muted);
  text-align: center;
}

.checklist-heading {
  margin: 0 0 0.8rem;
  padding: 0.85rem 0.9rem;
  border-radius: 0.8rem;
  color: var(--accent-cool-ink);
  background: var(--accent-cool);
}

.checklist-heading span,
.checklist-heading strong {
  display: block;
}

.checklist-heading span {
  color: var(--accent-cool-ink);
  opacity: 0.72;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.checklist-heading strong {
  margin-top: 0.2rem;
  font-size: 1rem;
}

.section-block {
  margin-bottom: 0.75rem;
  border: 1px solid var(--author-line);
  border-radius: 0.8rem;
  overflow: hidden;
}

.section-heading {
  padding: 0.62rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-soft);
}

.section-heading strong {
  font-size: 0.78rem;
}

.section-heading span {
  color: var(--author-muted);
  font-size: 0.64rem;
}

.procedure-card {
  padding: 0.75rem;
  border-top: 1px solid var(--author-line);
}

.procedure-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.procedure-title button {
  border: 0;
  background: transparent;
  color: var(--author-ink);
  padding: 0;
  font-size: 0.78rem;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.procedure-title span {
  flex: 0 0 auto;
  color: var(--author-muted);
  font-family: var(--author-code);
  font-size: 0.6rem;
}

.field-grid {
  margin-top: 0.55rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.field-chip {
  min-width: 0;
  padding: 0.48rem 0.55rem;
  border-radius: 0.55rem;
  background: var(--bg-soft);
}

.field-chip.wide {
  grid-column: 1 / -1;
}

.field-chip b,
.field-chip span {
  display: block;
}

.field-chip b {
  color: var(--author-green);
  font-size: 0.58rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.field-chip span {
  margin-top: 0.18rem;
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 0.7rem;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.field-chip.missing span {
  color: var(--author-red);
  font-style: italic;
}

.panel-lead {
  max-width: 44rem;
  margin-bottom: 1rem;
}

.panel-lead h3 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
}

.panel-lead p:not(.eyebrow) {
  margin: 0.35rem 0 0;
  color: var(--author-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.problem-list {
  display: grid;
  gap: 0.45rem;
}

.problem-item {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.65rem;
  border: 1px solid var(--author-line);
  border-radius: 0.7rem;
  background: var(--bg-soft);
  padding: 0.65rem;
  color: var(--author-ink);
  text-align: left;
  cursor: pointer;
}

.problem-item:hover {
  border-color: var(--author-line-strong);
  background: var(--panel-strong);
}

.problem-icon {
  width: 1.45rem;
  height: 1.45rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
}

.problem-item.error .problem-icon {
  background: var(--author-red);
}

.problem-item.warning .problem-icon {
  background: var(--author-amber);
}

.problem-item strong,
.problem-item small {
  display: block;
}

.problem-item strong {
  font-size: 0.72rem;
  line-height: 1.4;
}

.problem-item small {
  margin-top: 0.14rem;
  color: var(--author-muted);
  font: 0.6rem var(--author-code);
}

.problem-line {
  color: var(--author-blue);
  font: 0.62rem var(--author-code);
}

.problem-empty {
  padding: 1rem;
  border: 1px solid #b7d5c8;
  border-radius: 0.75rem;
  color: var(--author-green-dark);
  background: var(--author-green-soft);
  font-size: 0.78rem;
}

.predicate-panel {
  padding: 0;
}

.predicate-panel-header {
  padding: 1rem 1rem 0.75rem;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--author-line);
  background: var(--bg-soft);
}

.predicate-panel-header .panel-lead {
  margin-bottom: 0;
}

.predicate-legend {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
  color: var(--author-muted);
  font-size: 0.62rem;
}

.predicate-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.legend-line {
  width: 1.4rem;
  height: 0;
  display: inline-block;
  border-top: 2px solid var(--author-green);
}

.legend-line.draft {
  border-color: var(--author-blue);
  border-top-style: dashed;
}

.legend-line.lineage {
  border-color: var(--muted);
  border-top-style: dotted;
}

.predicate-notice {
  margin: 0.75rem 1rem 0;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--warn);
  border-radius: 0.65rem;
  color: #ffe69a;
  background: #29261f;
  font-size: 0.68rem;
  line-height: 1.45;
}

:root[data-theme="light"] .predicate-notice {
  color: #5a3700;
  background: #fff2d5;
}

:root[data-theme="high-contrast"] .predicate-notice,
:root[data-theme="high-contrast"] .predicate-notice.ready {
  border-width: 2px;
  color: #ffffff;
  background: #000000;
}

.predicate-notice.ready {
  border-color: #b7d5c8;
  color: var(--author-green-dark);
  background: var(--author-green-soft);
}

.predicate-workspace {
  min-width: 43rem;
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.predicate-canvas {
  position: relative;
  min-height: 28rem;
  overflow: hidden;
  border: 1px solid var(--author-line);
  border-radius: 0.8rem;
  background:
    linear-gradient(rgba(120, 198, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 198, 255, 0.045) 1px, transparent 1px),
    var(--bg-soft);
  background-size: 24px 24px;
}

.predicate-svg {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.predicate-svg.selection-active {
  z-index: 5;
}

.predicate-edge {
  fill: none;
  stroke: var(--author-green);
  stroke-width: 1.8;
  stroke-opacity: 0.32;
  marker-end: url(#predicateArrow);
  transition: stroke 120ms ease, stroke-opacity 120ms ease, stroke-width 120ms ease;
}

.predicate-edge.selected {
  stroke: var(--accent-cool);
  stroke-width: 3.6;
  stroke-opacity: 1;
  marker-end: url(#predicateSelectedArrow);
  filter: drop-shadow(0 0 4px rgba(120, 198, 255, 0.62));
}

.predicate-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
  pointer-events: stroke;
  cursor: pointer;
}

.predicate-edge.draft {
  stroke: var(--author-blue);
  stroke-dasharray: 7 5;
  marker-end: url(#predicateDraftArrow);
}

.predicate-edge-label {
  fill: var(--author-green-dark);
  stroke: var(--bg-soft);
  stroke-width: 4px;
  opacity: 0.5;
  paint-order: stroke;
  font: 650 10px var(--author-code);
  text-anchor: middle;
}

.predicate-edge-label.draft {
  fill: var(--author-blue);
  opacity: 1;
}

.predicate-edge-label.selected {
  fill: var(--accent-cool);
  opacity: 1;
}

.predicate-nodes {
  position: relative;
  z-index: auto;
  padding: 0.8rem;
  display: grid;
  gap: 0.8rem;
  pointer-events: none;
}

.predicate-lane {
  padding: 0.65rem;
  border: 1px solid var(--author-line);
  border-radius: 0.72rem;
  background: var(--panel-glass-strong);
}

.predicate-lane-header {
  position: relative;
  z-index: 4;
  margin-bottom: 0.55rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--author-green-dark);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.predicate-lane-header span {
  color: var(--author-muted);
  font-size: 0.58rem;
  letter-spacing: 0;
}

.predicate-lane-nodes {
  display: grid;
  grid-template-columns: repeat(2, minmax(10.5rem, 1fr));
  gap: 0.55rem 1.7rem;
}

.predicate-node {
  position: relative;
  z-index: 4;
  min-width: 0;
  padding: 0.7rem 1.8rem 0.68rem 0.72rem;
  border: 1px solid var(--author-line-strong);
  border-radius: 0.65rem;
  background: var(--author-paper);
  box-shadow: 0 5px 14px rgba(28, 41, 35, 0.07);
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
  pointer-events: auto;
}

.predicate-node:hover,
.predicate-node.connection-target {
  border-color: var(--author-green);
  box-shadow: 0 6px 18px rgba(21, 95, 75, 0.15);
}

.predicate-node.connection-target {
  transform: translateY(-1px);
}

.predicate-node.relationship-selected-source,
.predicate-node.relationship-selected-target {
  border-color: var(--accent-cool);
  box-shadow: 0 0 0 2px rgba(120, 198, 255, 0.18), 0 8px 22px rgba(0, 0, 0, 0.24);
}

.predicate-node.relationship-selected-source::before,
.predicate-node.relationship-selected-target::before {
  position: absolute;
  top: 0.28rem;
  left: 0.38rem;
  color: var(--accent-cool);
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.predicate-node.relationship-selected-source::before {
  content: "source";
}

.predicate-node.relationship-selected-target::before {
  content: "target";
}

.predicate-node.relationship-selected-source > strong,
.predicate-node.relationship-selected-target > strong {
  margin-top: 0.35rem;
}

.predicate-node strong,
.predicate-node small,
.predicate-node code {
  display: block;
}

.predicate-node strong {
  overflow: hidden;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.predicate-node small {
  margin-top: 0.22rem;
  overflow: hidden;
  color: var(--author-muted);
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.predicate-node code {
  margin-top: 0.42rem;
  color: var(--author-green-dark);
  font: 0.57rem var(--author-code);
}

.predicate-connector {
  position: absolute;
  top: 50%;
  right: -0.72rem;
  width: 1.45rem;
  height: 1.45rem;
  display: grid;
  place-items: center;
  border: 2px solid var(--author-paper);
  border-radius: 50%;
  color: #fff;
  background: var(--author-green);
  box-shadow: 0 2px 8px rgba(21, 95, 75, 0.3);
  cursor: crosshair;
  font-size: 0.68rem;
  transform: translateY(-50%);
  touch-action: none;
  z-index: 5;
}

.predicate-connector:disabled {
  cursor: not-allowed;
  background: #aeb7b2;
  box-shadow: none;
}

.predicate-inspector {
  min-height: 0;
  border: 1px solid var(--author-line);
  border-radius: 0.8rem;
  background: var(--author-paper);
  overflow: hidden;
}

.predicate-inspector > summary {
  min-height: 2.65rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.8rem;
  color: var(--author-ink);
  background: var(--panel-strong);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 750;
}

.predicate-inspector > summary::before {
  content: "";
  width: 0;
  height: 0;
  flex: 0 0 auto;
  border-top: 0.34rem solid transparent;
  border-bottom: 0.34rem solid transparent;
  border-left: 0.48rem solid var(--accent-cool);
  filter: drop-shadow(0 0 4px rgba(120, 198, 255, 0.5));
  transition: transform 140ms ease;
}

.predicate-inspector[open] > summary::before {
  transform: rotate(90deg);
}

.predicate-inspector > summary::after {
  content: "Expand";
  margin-left: auto;
  padding: 0.2rem 0.42rem;
  border: 1px solid rgba(120, 198, 255, 0.42);
  border-radius: 999px;
  color: var(--accent-cool);
  background: rgba(120, 198, 255, 0.08);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.predicate-inspector[open] > summary::after {
  content: "Collapse";
}

.predicate-inspector > summary small {
  color: var(--author-muted);
  font-size: 0.62rem;
  font-weight: 500;
}

.predicate-inspector-body {
  padding: 0.75rem 0.8rem 0.85rem;
}

.predicate-inspector h3,
.predicate-inspector h4 {
  margin: 0;
}

.predicate-inspector h3 {
  font-size: 0.86rem;
}

.predicate-inspector h4 {
  margin-top: 0.9rem;
  color: var(--author-muted);
  font-size: 0.64rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.predicate-inspector .note {
  margin: 0.38rem 0 0;
  color: var(--author-muted);
  font-size: 0.65rem;
  line-height: 1.45;
}

.predicate-route {
  margin-top: 0.65rem;
  padding: 0.6rem;
  border-radius: 0.6rem;
  color: var(--author-green-dark);
  background: var(--author-green-soft);
  font-size: 0.65rem;
  line-height: 1.5;
}

.predicate-form {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.45rem;
}

.predicate-builder-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(7rem, 1fr));
  gap: 0.45rem;
}

.predicate-slot span,
.predicate-token-field span {
  display: block;
}

.predicate-slot select {
  width: 100%;
  min-height: 2.15rem;
  margin-top: 0.25rem;
  border: 1px solid var(--author-line-strong);
  border-radius: 0.55rem;
  padding: 0 1.7rem 0 0.5rem;
  color: var(--author-ink);
  background: var(--field-bg);
  font-size: 0.66rem;
}

.predicate-builder-note {
  margin: 0;
  color: var(--author-muted);
  font-size: 0.6rem;
  line-height: 1.4;
}

.predicate-form label {
  color: var(--author-muted);
  font-size: 0.62rem;
  font-weight: 750;
}

.predicate-form input {
  width: 100%;
  min-height: 2.15rem;
  margin-top: 0.25rem;
  border: 1px solid var(--author-line-strong);
  border-radius: 0.55rem;
  padding: 0 0.55rem;
  color: var(--author-ink);
  background: var(--field-bg);
  font: 0.66rem var(--author-code);
}

.predicate-form-actions {
  display: flex;
  gap: 0.4rem;
}

.predicate-form-actions button {
  flex: 1;
}

.predicate-edge-list {
  margin-top: 0.45rem;
  display: grid;
  gap: 0.35rem;
}

.predicate-edge-item {
  padding: 0.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem;
  border: 1px solid var(--author-line);
  border-radius: 0.55rem;
  background: var(--bg-soft);
  cursor: pointer;
}

.predicate-edge-item.selected {
  border-color: var(--accent-cool);
  box-shadow: 0 0 0 2px rgba(120, 198, 255, 0.16);
}

.predicate-edge-item strong,
.predicate-edge-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.predicate-edge-item strong {
  font: 0.6rem var(--author-code);
}

.predicate-edge-item small {
  margin-top: 0.15rem;
  color: var(--author-muted);
  font-size: 0.58rem;
}

.predicate-edge-item button {
  align-self: center;
  border: 0;
  color: var(--author-red);
  background: transparent;
  cursor: pointer;
  font-size: 0.62rem;
  font-weight: 750;
}

.predicate-lineage-summary {
  margin-top: 0.6rem;
  color: var(--author-muted);
  font-size: 0.6rem;
  line-height: 1.4;
}

.predicate-selected-token {
  display: block;
  margin-top: 0.55rem;
  color: var(--accent-cool);
  font: 0.66rem var(--author-code);
}

.syntax-example {
  margin: 0;
  padding: 0.9rem 1rem;
  overflow: auto;
  border-radius: 0.75rem;
  color: var(--text);
  background: var(--code-bg);
  font: 0.72rem/1.6 var(--author-code);
}

.syntax-grid {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.syntax-grid article {
  padding: 0.7rem;
  border: 1px solid var(--author-line);
  border-radius: 0.7rem;
  background: var(--bg-soft);
}

.syntax-grid strong,
.syntax-grid span {
  display: block;
}

.syntax-grid strong {
  color: var(--author-green-dark);
  font-size: 0.72rem;
}

.syntax-grid span {
  margin-top: 0.22rem;
  color: var(--author-muted);
  font-size: 0.68rem;
  line-height: 1.45;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.7rem;
}

.plan-card {
  position: relative;
  padding: 1rem;
  border: 1px solid var(--author-line);
  border-radius: 0.85rem;
  background: var(--bg-soft);
}

.plan-card.current {
  border-color: var(--author-green);
  background: linear-gradient(180deg, var(--author-green-soft), var(--bg-soft));
}

.plan-card.available {
  border-color: var(--accent-cool);
  background: linear-gradient(180deg, rgba(120, 198, 255, 0.11), var(--bg-soft));
}

.plan-card.available .plan-label {
  color: var(--accent-cool);
  background: rgba(120, 198, 255, 0.1);
}

.plan-label {
  display: inline-block;
  padding: 0.22rem 0.42rem;
  border-radius: 999px;
  color: var(--author-green-dark);
  background: var(--author-green-soft);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.plan-card h4 {
  margin: 0.7rem 0 0.1rem;
  font-size: 1.05rem;
}

.plan-card > strong {
  color: var(--author-green-dark);
  font-size: 1.35rem;
}

.plan-card ul {
  min-height: 7.7rem;
  margin: 0.8rem 0 1rem;
  padding-left: 1.1rem;
  color: var(--muted-strong);
  font-size: 0.7rem;
  line-height: 1.7;
}

.primary-button,
.secondary-button {
  min-height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--author-green);
  padding: 0 0.8rem;
  font-size: 0.72rem;
  text-decoration: none;
}

.primary-button {
  color: #fff;
  background: var(--author-green);
}

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

.secondary-button {
  color: var(--author-green-dark);
  background: var(--author-paper);
}

.prototype-note {
  margin: 0.8rem 0 0;
  padding: 0.65rem 0.75rem;
  border-radius: 0.65rem;
  color: #765318;
  background: var(--author-amber-soft);
  font-size: 0.68rem;
  line-height: 1.45;
}

.action-footer {
  min-height: 3.9rem;
  padding: 0.65rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid var(--author-line);
  background: var(--panel-glass-strong);
  backdrop-filter: blur(14px);
  z-index: 5;
}

.authoring-body.edit-mode {
  grid-template-rows: auto minmax(0, 1fr);
}

.authoring-body.edit-mode > [data-chax-shell],
.authoring-body.edit-mode > .workspace-intro,
.authoring-body.edit-mode > .action-footer {
  display: none;
}

.authoring-body.edit-mode .project-bar {
  min-height: 3.05rem;
  padding: 0.35rem 0.75rem;
}

.authoring-body.edit-mode .workspace-shell {
  padding: 0.45rem;
  gap: 0.45rem;
}

.authoring-body.edit-mode .workspace-pane {
  border-radius: 0.62rem;
}

.authoring-body.edit-mode .pane-header {
  min-height: 3.1rem;
  padding: 0.45rem 0.75rem;
}

.authoring-body.edit-mode .pane-kicker {
  display: none;
}

.authoring-body.edit-mode .editor-footer {
  min-height: 1.8rem;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.authoring-body.edit-mode .preview-panel {
  padding: 0.65rem;
}

.authoring-body.edit-mode .predicate-panel {
  padding: 0;
}

.authoring-body.edit-mode .predicate-panel-header {
  padding: 0.65rem 0.75rem 0;
}

.authoring-body.edit-mode .predicate-panel-header .panel-lead p:not(.eyebrow),
.authoring-body.edit-mode .predicate-legend {
  display: none;
}

.authoring-body.edit-mode .predicate-notice {
  margin: 0.55rem 0.75rem 0;
}

.authoring-body.edit-mode .predicate-workspace {
  padding: 0.55rem 0.75rem 0.75rem;
}

.authoring-body.edit-mode .predicate-inspector {
  position: sticky;
  top: 0;
  z-index: 8;
  box-shadow: 0 7px 22px rgba(0, 0, 0, 0.24);
}

.authoring-body.edit-mode .toast {
  bottom: 1rem;
}

.save-state,
.footer-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.save-state {
  color: var(--author-muted);
  font-size: 0.72rem;
}

.save-indicator {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--author-green);
}

.save-indicator.saving {
  background: var(--author-amber);
}

.footer-summary {
  color: var(--author-muted);
  font: 0.68rem var(--author-code);
  text-align: center;
}

.footer-actions {
  justify-self: end;
}

.toast {
  position: fixed;
  right: 1.25rem;
  bottom: 4.75rem;
  z-index: 20;
  max-width: 24rem;
  padding: 0.75rem 0.9rem;
  border-radius: 0.7rem;
  color: #fff;
  background: #17221f;
  box-shadow: 0 12px 30px rgba(23, 34, 31, 0.25);
  font-size: 0.74rem;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(0.5rem);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: #7e2929;
}

@media (max-width: 1040px) {
  .authoring-body {
    overflow: auto;
    display: block;
  }

  .app-header {
    grid-template-columns: 1fr auto;
  }

  .chax-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: center;
    margin-bottom: 0.65rem;
  }

  .workspace-shell {
    grid-template-columns: 1fr;
  }

  .workspace-pane {
    min-height: 42rem;
  }

  .project-bar {
    flex-wrap: wrap;
  }

  .server-field {
    margin-left: 0;
  }

  .server-field select {
    width: 16rem;
  }

  .action-footer {
    position: sticky;
    bottom: 0;
  }

  .authoring-body.edit-mode {
    height: 100vh;
    height: 100dvh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }

  .authoring-body.edit-mode .workspace-shell {
    min-width: 48rem;
    grid-template-columns: repeat(2, minmax(23rem, 1fr));
    overflow-x: auto;
  }

  .authoring-body.edit-mode .workspace-pane {
    min-height: 0;
  }
}

@media (max-width: 680px) {
  .app-header,
  .workspace-intro,
  .project-bar,
  .workspace-shell,
  .action-footer {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
  }

  .app-header {
    gap: 0.75rem;
  }

  .chax-nav {
    overflow-x: auto;
    justify-content: start;
  }

  .mode-badge {
    display: none;
  }

  .workspace-intro {
    align-items: start;
    flex-direction: column;
  }

  .intro-state {
    width: 100%;
  }

  .workspace-shell {
    padding-top: 0.75rem;
  }

  .workspace-pane {
    min-height: 38rem;
  }

  .summary-strip,
  .plan-grid,
  .syntax-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .field-chip.wide {
    grid-column: auto;
  }

  .preview-tabs {
    overflow-x: auto;
  }

  .preview-tab {
    white-space: nowrap;
  }

  .predicate-panel-header {
    align-items: start;
    flex-direction: column;
  }

  .predicate-legend {
    justify-content: start;
  }

  .predicate-workspace {
    min-width: 33rem;
  }

  .predicate-builder-grid {
    grid-template-columns: repeat(2, minmax(7rem, 1fr));
  }

  .predicate-lane-nodes {
    grid-template-columns: 1fr;
  }

  .action-footer {
    grid-template-columns: 1fr;
  }

  .footer-summary {
    display: none;
  }

  .footer-actions {
    justify-self: stretch;
  }

  .footer-actions > * {
    flex: 1;
  }

  .authoring-body.edit-mode {
    height: auto;
    display: block;
    overflow: auto;
  }

  .authoring-body.edit-mode .project-bar {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .authoring-body.edit-mode .workspace-shell {
    min-width: 0;
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .authoring-body.edit-mode .workspace-pane {
    min-height: 38rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
