:root {
  --ink: #1a1d20;
  --ink-2: #1e3486;
  --ink-3: #6c757d;
  --ink-4: #adb5bd;
  --white: #ffffff;
  --surface-left: #fbd9be;
  --surface-right: #f4f5f7;
  --surface-card: rgba(255, 255, 255, 0.92);
  --accent: #21af8e;
  --accent-dark: #1e3486;
  --accent-dark-2: #21af8e;
  --accent-light: rgba(33, 175, 142, 0.16);
  --accent-subtle: rgba(30, 52, 134, 0.08);
  --border: rgba(30, 52, 134, 0.12);
  --muted: #6c757d;
  --good: #64a319;
  --warn: #e58303;
  --bad: #dc3545;
  --shadow: 0 18px 38px rgba(30, 52, 134, 0.08);
  --radius: 10px;
  --radius-sm: 6px;
  --topbar-h: 76px;
  --left-w: 196px;
  --content-pad: 24px;
  --input-font-family: "DM Sans", sans-serif;
  --input-font-size: 12px;
  --input-font-weight: 500;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "DM Sans", sans-serif;
  background: var(--surface-right);
  color: var(--ink);
}

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

.hidden {
  display: none !important;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--accent-dark);
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 20px 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar-left,
.topbar-center,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-center {
  justify-content: center;
  justify-self: center;
}

.topbar-right {
  margin-left: 0;
  justify-content: flex-end;
}

.app-title-block {
  display: grid;
  gap: 2px;
  color: #fff;
}

.app-title-kicker {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  opacity: 0.72;
}

.app-title-text {
  font-family: "DM Serif Display", serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
}

.menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent-dark-2);
  color: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.menu-toggle:hover {
  background: rgba(33, 175, 142, 0.82);
}

.menu-toggle span {
  font-size: 18px;
  line-height: 1;
}

.brand {
  font-family: "DM Serif Display", serif;
  color: #fff;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 9px;
  line-height: 1;
}

.brand-button {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.brand-box {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 14px;
  padding: 10px 18px;
  box-shadow: 0 14px 30px rgba(13, 26, 73, 0.16);
}

.brand-logo {
  display: block;
  height: 26px;
  width: auto;
}

.brand-badge {
  background: var(--accent-dark-2);
  color: #fff;
  font-family: "DM Sans", sans-serif;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.4px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.save-btn {
  appearance: none;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.save-btn:active {
  transform: scale(0.98);
}

.topbar .save-btn {
  background: var(--accent-dark-2);
  color: #fff;
  padding: 7px 18px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.topbar .save-btn:hover {
  background: rgba(33, 175, 142, 0.82);
}

.accent-btn {
  background: var(--accent-dark);
  color: #fff;
  padding: 10px 16px;
  box-shadow: 0 8px 22px rgba(30, 52, 134, 0.18);
}

.accent-btn:hover {
  background: #273f99;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.82);
  color: var(--accent-dark);
  border: 1px solid rgba(30, 52, 134, 0.12);
  padding: 10px 16px;
  box-shadow: 0 6px 14px rgba(30, 52, 134, 0.08);
}

.secondary-btn:hover {
  background: #fff;
}

.topbar-account-button {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: var(--accent-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(30, 52, 134, 0.08);
}

.topbar-account-button:hover {
  background: #f7f7f7;
}

.topbar-account-button.is-guest {
  background: rgba(30, 52, 134, 0.08);
  color: var(--accent-dark);
}

.topbar-account-button.is-authenticated {
  background: var(--accent-dark);
  color: #fff;
  box-shadow: 0 10px 22px rgba(30, 52, 134, 0.22);
}

.topbar-account-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.app {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: var(--left-w) 1fr;
}

.left {
  background: var(--surface-left);
  border-right: 1px solid var(--border);
  overflow: auto;
}

.right {
  background: var(--surface-right);
  overflow: auto;
  padding: 22px var(--content-pad) 60px var(--content-pad);
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  background: rgba(26, 29, 32, 0.3);
  z-index: 89;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.menu-list {
  padding: 4px 4px 6px;
}

.l1-card {
  position: relative;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  margin-bottom: 4px;
  border: 1px solid transparent;
  background: transparent;
}

.l1-card:hover {
  background: rgba(30, 52, 134, 0.04);
}

.l1-card.active {
  background: rgba(30, 52, 134, 0.08);
  border-color: rgba(30, 52, 134, 0.1);
}

.l1-card.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  background: var(--accent-dark-2);
  border-radius: 0 3px 3px 0;
}

.l1-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.chev {
  width: 12px;
  flex-shrink: 0;
  color: var(--ink-4);
  font-size: 11px;
  transition: transform 0.18s ease, color 0.15s ease;
  transform-origin: center;
  text-align: center;
  user-select: none;
}

.l1-card.active > .l1-row1 .chev {
  color: var(--accent-dark-2);
}

.l1-card.has-children.open > .l1-row1 .chev {
  transform: rotate(90deg);
}

.l1-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.35;
  flex: 1;
}

.l1-children {
  margin-top: 7px;
  margin-left: 16px;
  padding-left: 10px;
  position: relative;
}

.l1-children::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 1px;
  background: rgba(30, 52, 134, 0.08);
}

.l2-block {
  margin-bottom: 2px;
}

.l2-row,
.l3-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  min-height: 24px;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  border-radius: 5px;
}

.l2-row {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-2);
  padding: 4px 0 4px 10px;
  cursor: pointer;
}

.l3-row {
  font-size: 10px;
  font-weight: 400;
  color: var(--ink-3);
  padding: 4px 0 4px 20px;
  margin-top: 1px;
  cursor: pointer;
}

.l2-row::before,
.l3-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 8px;
  height: 1px;
  background: rgba(30, 52, 134, 0.08);
  transform: translateY(-50%);
}

.l3-row::before {
  width: 12px;
}

.l2-row:hover,
.l3-row:hover {
  background: rgba(255, 255, 255, 0.72);
}

.l2-row.active {
  color: var(--ink);
}

.l2-row.has-children .l2-label {
  padding-right: 16px;
}

.l2-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  text-align: center;
  font-size: 10px;
  color: var(--ink-4);
  transition: transform 0.18s ease, color 0.15s ease;
}

.l2-block.open .l2-toggle {
  transform: translateY(-50%) rotate(90deg);
  color: var(--accent-dark-2);
}

.l2-label,
.l3-label {
  display: block;
  min-width: 0;
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  line-height: 1.35;
}

.l3-row.active {
  color: var(--ink);
  font-weight: 600;
}

.preview {
  width: 100%;
  max-width: none;
  min-width: 760px;
}

.preview-title {
  font-family: "DM Serif Display", serif;
  font-size: 21px;
  font-weight: 400;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  margin: 0 0 6px 0;
}

.preview-subtitle {
  margin: 0 0 18px 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-3);
}

.preview-page {
  display: none;
}

.preview-page.is-active {
  display: block;
}

.intake-shell {
  margin: 0;
}

.page-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.intro-grid,
.admin-grid,
.summary-grid,
.result-split {
  display: grid;
  gap: 14px;
}

.intro-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
}

.admin-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

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

.summary-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.result-split {
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head.compact {
  margin-bottom: 12px;
}

.card-kicker {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.45px;
  margin-bottom: 4px;
}

.card-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.card-copy {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-3);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.inline-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(33, 175, 142, 0.12);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 600;
}

.metric-list {
  display: grid;
  gap: 10px;
}

.metric-row {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(30, 52, 134, 0.05);
  border: 1px solid rgba(30, 52, 134, 0.08);
}

.metric-row span {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.metric-row strong {
  font-size: 13px;
  color: var(--ink);
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.scenario-grid-spacer {
  visibility: hidden;
  pointer-events: none;
}

.scenario-btn {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.scenario-btn:hover {
  border-color: rgba(33, 175, 142, 0.32);
  box-shadow: 0 10px 20px rgba(30, 52, 134, 0.08);
}

.scenario-btn.is-active {
  border-color: rgba(33, 175, 142, 0.42);
  box-shadow: inset 0 0 0 1px rgba(33, 175, 142, 0.32);
  background: rgba(255, 255, 255, 0.9);
}

.scenario-btn-empty {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.86);
}

.scenario-btn strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}

.scenario-btn span {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
}

.guide-card {
  background:
    radial-gradient(circle at top right, rgba(33, 175, 142, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 249, 252, 0.92));
}

.guide-intro {
  max-width: 860px;
  margin-bottom: 18px;
}

.guide-flow-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.guide-flow-step {
  position: relative;
  display: grid;
  gap: 7px;
  padding: 16px 14px 14px;
  border-radius: 14px;
  border: 1px solid rgba(30, 52, 134, 0.1);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 24px rgba(30, 52, 134, 0.06);
}

.guide-flow-step::after {
  content: "→";
  position: absolute;
  right: -11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: rgba(30, 52, 134, 0.28);
}

.guide-flow-step:last-child::after {
  display: none;
}

.guide-flow-step.user {
  border-color: rgba(30, 52, 134, 0.18);
}

.guide-flow-step.engine {
  border-color: rgba(33, 175, 142, 0.28);
}

.guide-flow-step.ai {
  border-color: rgba(229, 131, 3, 0.24);
}

.guide-flow-step.control {
  border-color: rgba(220, 53, 69, 0.16);
}

.guide-flow-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(30, 52, 134, 0.1);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.guide-flow-step strong {
  font-size: 15px;
  color: var(--ink);
}

.guide-flow-step p {
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink-3);
}

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

.guide-detail-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(30, 52, 134, 0.08);
  background: rgba(255, 255, 255, 0.88);
}

.guide-detail-title {
  margin: 0;
  font-size: 16px;
  color: var(--ink);
}

.guide-bullets {
  margin: 0;
}

.guide-footer-note {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(30, 52, 134, 0.06);
  border: 1px solid rgba(30, 52, 134, 0.08);
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-2);
}

.guide-footer-note strong {
  display: inline-block;
  margin-right: 8px;
  color: var(--accent-dark);
}

.bullet-list {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-3);
  line-height: 1.7;
}

.bullet-list li + li {
  margin-top: 8px;
}

.form-row-top,
.form-row-bottom,
.form-row-narrow {
  display: grid;
  gap: 10px;
  width: 100%;
  margin-top: 10px;
}

.form-row-top {
  grid-template-columns: minmax(220px, 3fr) minmax(220px, 3fr);
}

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

.form-row-narrow {
  grid-template-columns: minmax(220px, 3fr) minmax(120px, 1fr);
}

.field.span-2 {
  grid-column: span 2;
}

.field.span-3 {
  grid-column: 1 / -1;
}

.spacer {
  min-height: 1px;
}

.field {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  min-width: 0;
}

.field.has-error {
  border-color: rgba(220, 53, 69, 0.34);
  box-shadow: inset 0 0 0 1px rgba(220, 53, 69, 0.08);
}

.field.has-warning {
  border-color: rgba(229, 131, 3, 0.32);
  box-shadow: inset 0 0 0 1px rgba(229, 131, 3, 0.08);
}

.field label:not(.checkbox-control) {
  display: block;
  font-size: 8px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

.field small {
  display: block;
  margin-top: 8px;
  color: var(--ink-3);
  font-size: 11px;
}

.field-issue-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.field-issue {
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.45;
}

.field-issue strong {
  font-size: 11px;
}

.field-issue span {
  color: inherit;
}

.field-issue-error {
  background: rgba(220, 53, 69, 0.08);
  color: #8b1f2d;
}

.field-issue-warning {
  background: rgba(229, 131, 3, 0.09);
  color: #925113;
}

.input-wrap {
  position: relative;
}

.field input:not([type="checkbox"]),
.field textarea,
.field select {
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 2px 20px 2px 0;
  font-family: var(--input-font-family);
  font-size: var(--input-font-size);
  font-weight: var(--input-font-weight);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease;
  border-radius: 0;
  box-shadow: none;
}

.field textarea {
  resize: vertical;
  min-height: 88px;
}

.readonly-field {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(241, 245, 253, 0.9);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 600;
}

.prompt-editor {
  min-height: 220px;
  font-size: 12px;
  line-height: 1.65;
}

.admin-help-card {
  margin-top: 16px;
  padding: 15px 16px;
  border-radius: 12px;
  border: 1px solid rgba(30, 52, 134, 0.1);
  background: rgba(255, 255, 255, 0.82);
}

.admin-help-title {
  margin: 4px 0 8px;
  font-size: 15px;
  color: var(--ink);
}

.admin-help-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.admin-help-links a {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(30, 52, 134, 0.1);
  background: rgba(30, 52, 134, 0.04);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}

.admin-help-links a:hover {
  border-color: rgba(33, 175, 142, 0.28);
  background: rgba(33, 175, 142, 0.08);
}

.admin-credit-note {
  margin: 12px 0 0;
  font-size: 11px;
  line-height: 1.55;
  color: var(--ink-3);
}

.admin-credit-note code {
  font-size: 10px;
}

.admin-session-card {
  margin-top: 14px;
}

.prompt-management-panel {
  margin: 16px 0 18px;
}

.prompt-management-shell {
  border: 1px solid rgba(30, 52, 134, 0.1);
  border-radius: 14px;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(250, 250, 252, 0.94) 100%);
  box-shadow: 0 10px 24px rgba(30, 52, 134, 0.06);
}

.prompt-management-copy {
  margin-bottom: 12px;
}

.prompt-management-title {
  margin: 4px 0 6px;
  font-size: 16px;
  color: var(--ink);
}

.prompt-management-copy .card-copy {
  margin-bottom: 0;
}

.prompt-management-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.prompt-management-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.prompt-management-summary {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(30, 52, 134, 0.08);
}

.prompt-management-summary strong {
  font-size: 13px;
  color: var(--ink);
}

.prompt-management-summary span {
  font-size: 11px;
  color: var(--ink-3);
}

.prompt-editor-head {
  margin-top: 4px;
}

.prompt-editor-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.prompt-payload-shell {
  margin: 14px 0 18px;
  border: 1px solid rgba(30, 52, 134, 0.1);
  border-radius: 14px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(248, 250, 255, 0.96) 0%, rgba(241, 245, 253, 0.94) 100%);
}

.prompt-output-guide {
  margin: 14px 0 18px;
  border: 1px solid rgba(30, 52, 134, 0.1);
  border-radius: 14px;
  padding: 16px 18px;
  background:
    radial-gradient(circle at top right, rgba(33, 175, 142, 0.1), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 249, 255, 0.96) 100%);
  box-shadow: 0 12px 28px rgba(30, 52, 134, 0.07);
}

.prompt-output-guide .card-copy {
  margin-bottom: 14px;
}

.prompt-output-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.prompt-output-card {
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid rgba(30, 52, 134, 0.08);
  background: rgba(255, 255, 255, 0.82);
}

.prompt-output-card strong {
  font-size: 13px;
  color: var(--accent-dark);
}

.prompt-output-card span {
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-2);
}

.prompt-output-schema {
  margin: 0;
  padding: 14px 15px;
  border-radius: 12px;
  background: #10213c;
  color: #dbe7ff;
  font-size: 11px;
  line-height: 1.65;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.prompt-payload-meta {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-2);
}

.prompt-payload-meta code {
  font-size: 11px;
}

.prompt-payload-viewer {
  margin: 0;
  padding: 14px 15px;
  border-radius: 12px;
  background: #0f172a;
  color: #dbe7ff;
  font-size: 11px;
  line-height: 1.65;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.prompt-save-dialog {
  border: none;
  padding: 0;
  background: transparent;
}

.prompt-save-dialog::backdrop {
  background: rgba(26, 29, 32, 0.34);
  backdrop-filter: blur(2px);
}

.prompt-save-dialog-card {
  width: min(520px, calc(100vw - 32px));
  margin: 0;
  padding: 20px;
  border: 1px solid rgba(30, 52, 134, 0.12);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 22px 48px rgba(30, 52, 134, 0.18);
}

.prompt-save-dialog-head {
  margin-bottom: 6px;
}

.prompt-save-dialog .card-copy {
  margin-bottom: 14px;
}

.prompt-save-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.save-btn.tertiary-btn {
  background: rgba(220, 53, 69, 0.1);
  color: var(--bad);
  border-color: rgba(220, 53, 69, 0.16);
}

.save-btn.tertiary-btn:hover {
  background: rgba(220, 53, 69, 0.14);
}

.field input:not([type="checkbox"]):focus,
.field textarea:focus,
.field select:focus {
  border-bottom-color: var(--accent-dark-2);
}

.native-select-hidden {
  display: none;
}

.field-dropdown {
  position: relative;
}

.field-autocomplete {
  position: relative;
}

.field-autocomplete::after {
  content: "▾";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  color: var(--ink-4);
  line-height: 1;
  pointer-events: none;
  transition: transform 0.18s ease, color 0.15s ease;
}

.field-autocomplete.open::after,
.field-autocomplete:focus-within::after {
  color: var(--accent-dark-2);
}

.field-autocomplete.open::after {
  transform: translateY(-50%) rotate(180deg);
}

.field-autocomplete-input {
  padding-right: 18px;
}

.field-autocomplete-input[disabled] {
  color: var(--ink-4);
  cursor: not-allowed;
}

.field-dropdown-trigger {
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 2px 20px 2px 0;
  font-family: var(--input-font-family);
  font-size: var(--input-font-size);
  font-weight: var(--input-font-weight);
  color: var(--ink);
  outline: none;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  transition: border-color 0.15s ease;
}

.field-dropdown-trigger:hover,
.field-dropdown.open .field-dropdown-trigger,
.field-dropdown-trigger:focus-visible {
  border-bottom-color: var(--accent-dark-2);
}

.field-dropdown-label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field-dropdown-caret {
  flex-shrink: 0;
  font-size: 9px;
  color: var(--ink-4);
  line-height: 1;
  transition: transform 0.18s ease, color 0.15s ease;
}

.field-dropdown.open .field-dropdown-caret {
  transform: rotate(180deg);
  color: var(--accent-dark-2);
}

.field-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 100%;
  background: #fff;
  border: 1px solid rgba(30, 52, 134, 0.12);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(30, 52, 134, 0.14), 0 2px 8px rgba(30, 52, 134, 0.08);
  padding: 6px;
  display: none;
  z-index: 40;
}

.field-dropdown.open .field-dropdown-menu {
  display: block;
}

.field-autocomplete.open .field-autocomplete-menu {
  display: block;
}

.field-dropdown-option {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--input-font-family);
  font-size: var(--input-font-size);
  font-weight: var(--input-font-weight);
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.field-dropdown-option:hover,
.field-dropdown-option:focus-visible {
  background: rgba(30, 52, 134, 0.08);
  color: var(--accent-dark);
  outline: none;
}

.field-dropdown-option.active {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.field-autocomplete-empty {
  padding: 10px 12px;
  font-size: 11px;
  color: var(--ink-3);
}

.field-help {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid rgba(30, 52, 134, 0.18);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink-3);
  font-family: "DM Sans", sans-serif;
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  transition: all 0.15s ease;
  z-index: 3;
  user-select: none;
}

.field-help:hover,
.field-help:focus-visible {
  background: var(--accent-dark-2);
  border-color: var(--accent-dark-2);
  color: #fff;
  outline: none;
}

.field-tooltip {
  position: absolute;
  top: 28px;
  right: 8px;
  width: 220px;
  max-width: calc(100vw - 32px);
  background: var(--accent-dark);
  color: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.5;
  box-shadow: 0 10px 24px rgba(30, 52, 134, 0.2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 6;
  pointer-events: none;
  text-transform: none;
  letter-spacing: normal;
}

.field-tooltip::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 14px;
  width: 10px;
  height: 10px;
  background: var(--accent-dark);
  transform: rotate(45deg);
}

.field-help:hover + .field-tooltip,
.field-help:focus-visible + .field-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.toggle-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
  gap: 10px;
  margin-top: 14px;
  justify-content: start;
}

.toggle-field {
  width: min(100%, 260px);
  padding-bottom: 12px;
  justify-self: start;
}

.toggle-switch-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 20px;
  width: fit-content;
  font-family: var(--input-font-family);
}

.toggle-switch {
  position: relative;
  width: 38px;
  height: 20px;
  background: rgba(15, 17, 23, 0.12);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
  padding: 0;
  font-family: var(--input-font-family);
}

.toggle-switch.active {
  background: var(--accent-dark-2);
  border-color: var(--accent-dark-2);
}

.toggle-switch.unselected {
  background: transparent;
  border: 1px dashed var(--border);
}

.toggle-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 6px;
  transition: left 0.2s ease;
  box-shadow: 0 2px 4px rgba(15, 17, 23, 0.12);
  pointer-events: none;
}

.toggle-switch.active .toggle-switch-thumb {
  left: 20px;
}

.toggle-switch.unselected .toggle-switch-thumb {
  left: 12px;
  opacity: 0.4;
}

.toggle-label {
  font-family: var(--input-font-family);
  font-size: var(--input-font-size);
  font-weight: var(--input-font-weight);
  color: var(--ink);
  user-select: none;
}

.toggle-label.unselected {
  color: var(--muted);
}

.form-footer-note {
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-3);
}

.analysis-hero-card {
  background: rgba(30, 52, 134, 0.95);
  color: #fff;
}

.analysis-hero-card .card-kicker,
.analysis-hero-card .card-title,
.analysis-hero-card .card-copy,
.analysis-hero-card .call-meta {
  color: #fff;
}

.analysis-hero-copy {
  max-width: 720px;
  opacity: 0.88;
}

.analysis-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
  gap: 12px;
  margin-bottom: 12px;
}

.analysis-overview-card {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(30, 52, 134, 0.1);
}

.analysis-overview-copy {
  max-width: 680px;
  margin-top: 8px;
}

.analysis-overview-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.overview-stat {
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid rgba(30, 52, 134, 0.08);
  background: rgba(255, 255, 255, 0.92);
}

.overview-stat span {
  display: block;
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.overview-stat strong {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}

.overview-stat-link-row {
  margin-top: 8px;
}

.analysis-action-card {
  display: grid;
  gap: 12px;
  align-content: start;
  background: rgba(251, 217, 190, 0.42);
  border: 1px solid rgba(30, 52, 134, 0.1);
}

.analysis-primary-action {
  width: 100%;
  min-height: 46px;
}

.analysis-action-note {
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-3);
}

.call-meta {
  font-size: 12px;
  color: var(--ink-3);
}

.status-box {
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 14px;
  border: 1px solid transparent;
}

.status-box.muted {
  background: rgba(255, 255, 255, 0.74);
  border-color: rgba(30, 52, 134, 0.08);
  color: var(--ink-3);
}

.status-box.success {
  background: rgba(100, 163, 25, 0.12);
  border-color: rgba(100, 163, 25, 0.18);
  color: #4f7e14;
}

.status-box.error {
  background: rgba(220, 53, 69, 0.12);
  border-color: rgba(220, 53, 69, 0.16);
  color: var(--bad);
}

.status-box.warning {
  background: rgba(229, 131, 3, 0.12);
  border-color: rgba(229, 131, 3, 0.18);
  color: var(--warn);
}

.status-box strong {
  display: block;
  margin-bottom: 4px;
}

.status-box span {
  display: block;
  margin-bottom: 6px;
}

.gate-action-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.gate-action-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(19, 32, 51, 0.08);
}

.gate-action-item strong {
  margin-bottom: 6px;
}

.gate-action-item p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: inherit;
}

.gate-action-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.gate-action-link {
  background: rgba(255, 255, 255, 0.88);
}

.preflight-issue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.preflight-issue-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(30, 52, 134, 0.1);
  background: rgba(255, 255, 255, 0.92);
}

.preflight-issue-card strong {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
}

.preflight-issue-card.preflight-rood {
  border-left: 5px solid var(--bad);
}

.preflight-issue-card.preflight-oranje {
  border-left: 5px solid var(--warn);
}

.preflight-issue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.preflight-jump {
  border: 1px solid rgba(30, 52, 134, 0.12);
  background: rgba(30, 52, 134, 0.05);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.preflight-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.results.hidden {
  display: none;
}

.summary-card {
  margin-bottom: 0;
  padding: 16px 18px;
}

.summary-card-inline {
  background: rgba(255, 255, 255, 0.78);
}

.summary-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.summary-card strong {
  font-size: 24px;
  line-height: 1;
  color: var(--ink);
}

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

.summary-detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
}

.summary-detail-item {
  display: grid;
  gap: 4px;
  padding: 0;
  border-bottom: none;
  background: transparent;
}

.summary-detail-item.is-wide {
  grid-column: 1 / -1;
}

.summary-detail-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.summary-detail-value {
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink);
}

.summary-detail-value.is-empty {
  color: var(--ink-3);
}

.compact-summary-card {
  padding: 14px 16px;
}

.compact-summary-card .card-title {
  font-size: 15px;
  margin-bottom: 10px;
}

.page-advance-bar {
  position: sticky;
  bottom: 18px;
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  z-index: 15;
  pointer-events: none;
}

.page-advance-bar.hidden {
  display: none;
}

.page-advance-bar .save-btn {
  min-width: 144px;
  pointer-events: auto;
}

.filter-toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.filter-row {
  display: grid;
  gap: 7px;
}

.filter-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.filter-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  border: 1px solid rgba(30, 52, 134, 0.12);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.filter-chip.filter-must {
  border-color: rgba(30, 52, 134, 0.18);
  background: rgba(30, 52, 134, 0.06);
  color: var(--accent-dark);
}

.filter-chip.filter-should {
  border-color: rgba(100, 163, 25, 0.18);
  background: rgba(100, 163, 25, 0.06);
  color: #4f7e14;
}

.filter-chip.filter-could {
  border-color: rgba(229, 131, 3, 0.2);
  background: rgba(229, 131, 3, 0.06);
  color: var(--warn);
}

.filter-chip.filter-warn {
  border-color: rgba(220, 53, 69, 0.2);
  background: rgba(220, 53, 69, 0.06);
  color: var(--bad);
}

.filter-chip.is-active {
  background: rgba(30, 52, 134, 0.1);
  border-color: rgba(30, 52, 134, 0.18);
  color: var(--accent-dark);
  box-shadow: inset 0 0 0 1px rgba(19, 32, 51, 0.06);
}

.filter-chip.filter-must.is-active {
  background: rgba(30, 52, 134, 0.14);
  border-color: rgba(30, 52, 134, 0.26);
  color: var(--accent-dark);
}

.filter-chip.filter-should.is-active {
  background: rgba(100, 163, 25, 0.14);
  border-color: rgba(100, 163, 25, 0.26);
  color: #4f7e14;
}

.filter-chip.filter-could.is-active {
  background: rgba(229, 131, 3, 0.14);
  border-color: rgba(229, 131, 3, 0.28);
  color: var(--warn);
}

.filter-chip.filter-warn.is-active {
  background: rgba(220, 53, 69, 0.14);
  border-color: rgba(220, 53, 69, 0.28);
  color: var(--bad);
}

.filter-chip:hover {
  border-color: rgba(33, 175, 142, 0.3);
}

.output-shell-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(30, 52, 134, 0.1);
}

.output-meta-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
}

.output-mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.output-mini-stat {
  min-width: 86px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(30, 52, 134, 0.08);
  background: rgba(255, 255, 255, 0.92);
}

.output-mini-stat strong {
  display: block;
  margin-bottom: 5px;
  font-size: 16px;
  color: var(--ink);
}

.output-mini-stat span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.output-shell-card .call-meta {
  text-align: right;
}

.result-card {
  margin-top: 14px;
  padding: 16px;
}

.result-stack {
  display: grid;
  gap: 10px;
}

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

.clause-group {
  display: grid;
  gap: 10px;
}

.audit-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.audit-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(30, 52, 134, 0.08);
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 600;
}

.muted-text {
  color: var(--ink-3);
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 10px;
}

.pill.must {
  background: rgba(30, 52, 134, 0.12);
  color: var(--accent-dark);
}

.pill.should {
  background: rgba(100, 163, 25, 0.12);
  color: #4f7e14;
}

.pill.could {
  background: rgba(229, 131, 3, 0.12);
  color: var(--warn);
}

.pill.warn {
  background: rgba(220, 53, 69, 0.12);
  color: var(--bad);
}

.result-empty-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 12px;
  border: 1px dashed rgba(30, 52, 134, 0.18);
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink-3);
}

.result-empty-card strong {
  color: var(--ink);
  font-size: 13px;
}

.result-empty-card span {
  font-size: 12px;
  line-height: 1.6;
}

.result-empty-card.compact {
  padding: 12px;
}

.compact-clause-layout {
  align-items: start;
}

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

.knowledge-explainer-card {
  background:
    radial-gradient(circle at top left, rgba(30, 52, 134, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 248, 251, 0.92));
}

.knowledge-item-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(30, 52, 134, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.84);
}

.knowledge-item-head {
  display: grid;
  gap: 4px;
}

.knowledge-item-head strong {
  font-size: 14px;
  color: var(--ink);
}

.knowledge-item-head span {
  font-size: 11px;
  color: var(--ink-3);
}

.knowledge-item-sections {
  display: grid;
  gap: 10px;
}

.knowledge-item-section {
  display: grid;
  gap: 6px;
}

.knowledge-item-section > span {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.knowledge-coverage-note {
  margin-bottom: 14px;
}

.knowledge-stats-row {
  margin-bottom: 14px;
}

.knowledge-footer-note {
  margin-top: 14px;
}

.clause-section-card {
  padding: 14px;
  border: 1px solid rgba(30, 52, 134, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
}

.clause-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.clause-section-head h4 {
  margin: 0 0 3px;
  font-size: 13px;
  color: var(--ink);
}

.clause-section-head span {
  font-size: 11px;
  color: var(--ink-3);
}

.clause-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-top: 1px solid rgba(30, 52, 134, 0.08);
}

.clause-section-card .clause-row:first-of-type {
  border-top: none;
  padding-top: 0;
}

.clause-row-copy {
  display: grid;
  gap: 4px;
}

.clause-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(30, 52, 134, 0.08);
  color: var(--ink-2);
  font-size: 10px;
  line-height: 1.4;
}

.detail-chip.warning {
  background: rgba(235, 131, 68, 0.14);
  color: #9a4b16;
}

.external-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(30, 52, 134, 0.09);
  color: #24419d;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  transition: transform 140ms ease, background 140ms ease, color 140ms ease;
}

.external-link-chip:hover,
.external-link-chip:focus-visible {
  background: rgba(30, 52, 134, 0.16);
  color: #19317d;
  transform: translateY(-1px);
}

.external-link-chip::after {
  content: "↗";
  font-size: 10px;
  line-height: 1;
}

.clause-row-copy strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.clause-conditions {
  margin: 0;
}

.signal-list {
  display: grid;
  gap: 10px;
}

.signal-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(30, 52, 134, 0.1);
  background: rgba(255, 255, 255, 0.9);
  border-left-width: 5px;
}

.signal-card strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

.signal-card-meta {
  margin: 0;
}

.signal-card-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.signal-card-head {
  display: flex;
  justify-content: flex-start;
}

.signal-card.signal-groen {
  border-left-color: #4f7e14;
}

.signal-card.signal-oranje {
  border-left-color: var(--warn);
}

.signal-card.signal-rood {
  border-left-color: var(--bad);
}

.audit-layout {
  display: grid;
  gap: 12px;
}

.audit-highlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.audit-note {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(30, 52, 134, 0.08);
  background: rgba(255, 255, 255, 0.9);
}

.audit-note span {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.audit-note strong {
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink);
}

.audit-entry-list {
  display: grid;
  gap: 10px;
}

.audit-entry {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(30, 52, 134, 0.08);
  background: rgba(255, 255, 255, 0.9);
}

.audit-entry-head {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.audit-entry-head strong {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}

.audit-entry-copy p {
  margin: 0;
}

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

.audit-field {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(30, 52, 134, 0.04);
}

.audit-field span {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.audit-field strong {
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
}

.contract-output {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(30, 52, 134, 0.08);
  border-radius: 14px;
  padding: 18px 20px;
  min-height: 260px;
  max-height: 70vh;
  overflow: auto;
  color: var(--ink);
}

.contract-output.is-empty {
  display: block;
}

.contract-empty-state {
  display: grid;
  gap: 8px;
  color: var(--ink-3);
}

.contract-empty-state strong {
  font-size: 14px;
  color: var(--ink);
}

.markdown-contract h1,
.markdown-contract h2,
.markdown-contract h3,
.markdown-contract h4 {
  margin: 0 0 12px;
  color: var(--accent-dark);
  line-height: 1.3;
}

.markdown-contract h1 {
  font-size: 24px;
}

.markdown-contract h2 {
  margin-top: 22px;
  font-size: 19px;
}

.markdown-contract h3 {
  margin-top: 18px;
  font-size: 16px;
}

.markdown-contract p,
.markdown-contract li {
  font-size: 13px;
  line-height: 1.8;
}

.markdown-contract p {
  margin: 0 0 12px;
}

.markdown-contract ul,
.markdown-contract ol {
  margin: 0 0 14px 20px;
  padding: 0;
}

.markdown-contract li + li {
  margin-top: 6px;
}

.markdown-contract hr {
  border: 0;
  border-top: 1px solid rgba(30, 52, 134, 0.12);
  margin: 18px 0;
}

.markdown-contract code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(30, 52, 134, 0.08);
  font-size: 12px;
}

.action-row {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.action-row-start {
  justify-content: flex-start;
}

.table-action-btn {
  padding: 8px 12px;
}

.admin-info-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(30, 52, 134, 0.1);
}

.pricing-reference-note {
  margin-bottom: 12px;
}

.pricing-table td,
.pricing-table th {
  white-space: nowrap;
}

.children-table-wrap {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
}

table.children-table {
  width: 100%;
  border-collapse: collapse;
}

.children-table th {
  text-align: left;
  vertical-align: top;
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-4);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 8px 11px;
  background: rgba(30, 52, 134, 0.05);
  border-bottom: 1px solid var(--border);
}

.children-table thead th:first-child {
  border-top-left-radius: var(--radius);
}

.children-table thead th:last-child {
  border-top-right-radius: var(--radius);
}

.children-table td {
  padding: 10px 11px;
  vertical-align: top;
  border-bottom: 1px solid rgba(30, 52, 134, 0.06);
  font-size: 12px;
}

.children-table tbody tr:last-child td {
  border-bottom: none;
}

.children-table tbody tr:hover {
  background: rgba(30, 52, 134, 0.04);
}

.output-source-row {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.status-chip {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

.status-chip.success {
  background: rgba(100, 163, 25, 0.12);
  color: #4f7e14;
}

.status-chip.error {
  background: rgba(220, 53, 69, 0.12);
  color: var(--bad);
}

@media (max-width: 1250px) {
  .preview {
    min-width: 0;
  }

  .intro-grid,
  .admin-grid,
  .result-split,
  .analysis-overview-grid,
  .preflight-issue-grid,
  .guide-flow-strip,
  .guide-detail-grid {
    grid-template-columns: 1fr;
  }

  .form-row-bottom {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .clause-group-grid {
    grid-template-columns: 1fr;
  }

  .audit-highlight-grid {
    grid-template-columns: 1fr;
  }

  .audit-field-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1020px) {
  .form-row-top,
  .form-row-bottom,
  .form-row-narrow,
  .summary-grid,
  .summary-grid.compact,
  .knowledge-card-grid,
  .analysis-summary-grid,
  .analysis-overview-meta,
  .summary-detail-list {
    grid-template-columns: 1fr;
  }

  .guide-flow-step::after {
    display: none;
  }

  .field.span-2,
  .field.span-3 {
    grid-column: auto;
  }

  .toggle-field-grid,
  .scenario-grid {
    grid-template-columns: 1fr;
  }

  .scenario-grid-spacer {
    display: none;
  }

  .prompt-management-grid {
    grid-template-columns: 1fr;
  }

  .prompt-output-grid {
    grid-template-columns: 1fr;
  }

  .prompt-management-actions,
  .prompt-editor-actions,
  .prompt-save-dialog-actions {
    justify-content: flex-start;
  }

  .output-meta-row {
    display: grid;
    align-items: start;
  }

  .clause-row {
    grid-template-columns: 1fr;
  }

  .spacer {
    display: none;
  }
}

@media (max-width: 860px) {
  :root {
    --left-w: 100%;
  }

  .menu-toggle {
    display: inline-flex;
  }

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

  .left {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: min(86vw, 320px);
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 0 10px 30px rgba(30, 52, 134, 0.12);
  }

  body.menu-open .left {
    transform: translateX(0);
  }

  .mobile-overlay {
    display: block;
  }

  body.menu-open .mobile-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .right {
    display: block;
    padding: 18px 16px 40px;
  }

  .preview {
    min-width: 0;
  }

  .preview-title {
    font-size: 18px;
    white-space: normal;
  }

  .preview-subtitle {
    font-size: 11px;
  }

  .topbar-left {
    gap: 10px;
  }

  .app-title-kicker {
    font-size: 8px;
  }

  .app-title-text {
    font-size: 15px;
  }

  .topbar-right {
    gap: 8px;
  }

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

  .brand-box {
    padding: 8px 12px;
  }

  .brand-logo {
    height: 22px;
  }

  .topbar .save-btn {
    padding: 7px 12px;
    font-size: 12px;
  }

  .topbar-account-button {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 520px) {
  .topbar {
    padding-right: 14px;
  }

  .section-head {
    flex-direction: column;
  }

  .brand {
    font-size: 14px;
  }

  .app-title-block {
    display: none;
  }

  .output-mini-stats {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .output-mini-stat {
    min-width: 0;
  }

  .contract-output {
    padding: 15px 16px;
  }

  .page-advance-bar .save-btn {
    width: 100%;
  }
}
