:root {
  color-scheme: light;
  --bg: #eef1f4;
  --panel: #ffffff;
  --panel-muted: #f7f8fa;
  --text: #18202b;
  --muted: #667085;
  --border: #d8dee6;
  --accent: #1f7a64;
  --accent-strong: #14604e;
  --code-bg: #f3f5f7;
  --shadow: 0 12px 30px rgba(24, 32, 43, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.home-page {
  background: #f2f4f7;
  overflow-x: hidden;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
  padding: 18px clamp(18px, 4vw, 52px);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
}

.home-wordmark {
  color: var(--text);
  font-size: 20px;
  font-weight: 850;
  letter-spacing: 0;
  text-decoration: none;
}

.home-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.home-nav a,
.secondary-link,
.primary-link,
.core-list a {
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}

.home-nav a {
  padding: 8px 10px;
}

.home-nav a:hover,
.home-nav a:focus-visible,
.secondary-link:hover,
.secondary-link:focus-visible,
.core-list a:hover,
.core-list a:focus-visible {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--border);
}

.home-hero,
.home-section {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(560px, 1.25fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: center;
  min-height: calc(100vh - 68px);
  padding: 42px 0 34px;
}

.home-hero-copy,
.pipeline-panel,
.section-copy,
.section-heading-row > p,
.demo-grid,
.core-list {
  min-width: 0;
}

.home-hero h1,
.home-section h2 {
  margin: 0;
  color: #111827;
  letter-spacing: 0;
}

.home-hero h1 {
  max-width: 12ch;
  font-size: clamp(44px, 6vw, 76px);
  line-height: 0.96;
}

.home-lede {
  max-width: 62ch;
  margin: 22px 0 0;
  color: #475467;
  font-size: 18px;
  line-height: 1.55;
}

.home-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
}

.primary-link {
  background: var(--accent);
  color: #ffffff;
}

.primary-link:hover,
.primary-link:focus-visible {
  background: var(--accent-strong);
}

.secondary-link {
  border: 1px solid var(--border);
  background: #ffffff;
}

.pipeline-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.pipeline-column {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
  min-width: 0;
}

.pipeline-column > span,
.demo-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.pipeline-column pre,
.mini-page {
  min-height: 330px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.pipeline-column pre {
  overflow: auto;
  padding: 16px;
  color: #18202b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.pipeline-cursor {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  margin-left: 2px;
  vertical-align: -0.18em;
  background: var(--accent);
  animation: pipeline-cursor-blink 1s steps(1) infinite;
}

@keyframes pipeline-cursor-blink {
  50% {
    opacity: 0;
  }
}

.pipeline-arrow {
  display: grid;
  align-items: center;
  padding-top: 24px;
  color: var(--muted);
  font-size: 25px;
  font-weight: 800;
}

.mini-page {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 32px 28px;
  font-family: Georgia, "Times New Roman", serif;
}

.mini-page strong {
  font-size: 30px;
  line-height: 1.05;
}

.mini-page small {
  color: #667085;
  font-family: Arial, sans-serif;
  font-size: 13px;
}

.mini-page p {
  margin: 18px 0 0;
  min-height: 8.5em;
  font-size: 17px;
  line-height: 1.55;
}

@media (prefers-reduced-motion: reduce) {
  .pipeline-cursor {
    animation: none;
  }
}

.home-section {
  padding: 58px 0;
  border-top: 1px solid var(--border);
}

.split-section,
.section-heading-row {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 52px);
  align-items: start;
}

.home-section h2 {
  max-width: 14ch;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.02;
}

.section-copy,
.section-heading-row > p {
  color: #475467;
  font-size: 17px;
  line-height: 1.6;
}

.section-copy p,
.section-heading-row > p {
  margin: 0;
}

.section-copy p + p {
  margin-top: 16px;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.faq-item {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 190px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  padding: 18px;
  box-shadow: var(--shadow);
}

.faq-item h3 {
  margin: 0;
  color: #111827;
  font-size: 18px;
  line-height: 1.15;
}

.faq-item p {
  margin: 0;
  color: #475467;
  font-size: 14px;
  line-height: 1.5;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.demo-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 220px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 18px;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.demo-card:hover,
.demo-card:focus-visible {
  border-color: rgba(31, 122, 100, 0.45);
  outline: 0;
  transform: translateY(-1px);
}

.demo-card strong {
  font-size: 22px;
  line-height: 1.08;
}

.demo-card > span:last-child {
  color: #475467;
  font-size: 14px;
  line-height: 1.5;
}

.featured-demo {
  grid-column: span 2;
}

.core-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.core-list a {
  border: 1px solid var(--border);
  background: #ffffff;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.home-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 34px;
  border-top: 1px solid var(--border);
  color: #475467;
  font-size: 14px;
  line-height: 1.5;
}

.home-footer p {
  margin: 0;
}

.home-footer a {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font-weight: 750;
  padding: 8px 10px;
  text-decoration: none;
}

.home-footer a:hover,
.home-footer a:focus-visible {
  box-shadow: inset 0 0 0 1px var(--border);
}

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

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 24px 12px;
}

.app-header h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.header-actions {
  align-items: end;
  display: flex;
  gap: 8px;
  position: relative;
}

.export-control {
  align-items: stretch;
  display: inline-flex;
  position: relative;
}

.export-primary {
  border-bottom-right-radius: 0;
  border-top-right-radius: 0;
  padding-inline: 14px 12px;
}

.export-toggle {
  border-bottom-left-radius: 0;
  border-left-color: rgba(255, 255, 255, 0.35);
  border-top-left-radius: 0;
  min-inline-size: 34px;
  padding: 0;
}

.export-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  z-index: 20;
  display: grid;
  min-inline-size: 128px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 5px;
}

.export-menu[hidden] {
  display: none;
}

.export-menu button {
  justify-content: flex-start;
  min-height: 32px;
  border: 0;
  border-radius: 5px;
  background: #ffffff;
  color: var(--text);
  text-align: left;
}

.export-menu button:hover,
.export-menu button:focus-visible {
  background: var(--panel-muted);
  color: var(--text);
}

.debug-toggle {
  align-items: center;
  display: flex;
  gap: 7px;
  min-height: 36px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.debug-toggle input {
  accent-color: var(--accent);
  inline-size: 16px;
  block-size: 16px;
}

.case-picker {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

select {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 0 34px 0 10px;
}

input[type="text"] {
  min-height: 34px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  padding: 0 9px;
}

button {
  border: 1px solid var(--accent-strong);
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  min-height: 36px;
  padding: 0 14px;
}

button:hover,
button:focus-visible {
  background: var(--accent-strong);
}

.profile-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.mode-button {
  min-height: 28px;
  border-color: var(--border);
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  padding: 0 10px;
}

.mode-button:hover,
.mode-button:focus-visible,
.mode-button.active {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: #ffffff;
}

.workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 12px 24px 24px;
}

.pane {
  min-height: 42vh;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-muted);
}

.pane-header h2 {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
}

.badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 8px;
  white-space: nowrap;
}

.badge.error {
  border-color: #d92d20;
  color: #b42318;
}

textarea {
  display: block;
  width: 100%;
  height: calc(42vh - 45px);
  min-height: 340px;
  resize: vertical;
  border: 0;
  outline: 0;
  padding: 16px;
  background: #101828;
  color: #f8fafc;
  caret-color: #a7f3d0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  tab-size: 2;
}

.source-editor-wrap {
  position: relative;
  height: calc(42vh - 86px);
  min-height: 210px;
  background: #101828;
}

.source-editor-wrap textarea {
  position: relative;
  z-index: 1;
  height: 100%;
  min-height: 0;
  background: transparent;
}

.source-highlights {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.source-highlight-range {
  position: absolute;
  left: 10px;
  right: 10px;
  border: 1px solid rgba(245, 158, 11, 0.82);
  border-radius: 5px;
  background: rgba(245, 158, 11, 0.18);
  box-shadow: inset 3px 0 0 rgba(245, 158, 11, 0.95);
}

.source-link {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  height: 40px;
  max-height: 40px;
  border-bottom: 1px solid rgba(216, 222, 230, 0.75);
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  overflow: hidden;
  padding: 7px 12px;
  white-space: nowrap;
}

.source-link strong {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 13px;
}

.source-link span {
  min-width: 0;
}

.source-link-chip,
.source-link-more {
  display: inline-block;
  flex: 0 1 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: #344054;
  max-width: min(32ch, 34%);
  overflow: hidden;
  padding: 4px 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-link-more {
  color: var(--muted);
  font-weight: 700;
}

textarea::selection {
  background: rgba(71, 194, 161, 0.35);
}

.profile-structure {
  height: calc(42vh - 45px);
  min-height: 340px;
  overflow: auto;
  background: #f8fafc;
  padding: 12px;
}

.profile-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.profile-section + .profile-section {
  margin-top: 10px;
}

.profile-section summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-height: 38px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 800;
}

.profile-section summary::marker {
  color: var(--muted);
}

.profile-section-body {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding: 10px;
}

.profile-card {
  border: 1px solid var(--border);
  border-left: 4px solid #64748b;
  border-radius: 6px;
  background: #ffffff;
  padding: 8px 10px;
}

.profile-card[data-role] {
  cursor: crosshair;
}

.profile-card-note {
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.profile-card.roles { border-left-color: #2563eb; }
.profile-card.generated { border-left-color: #7c3aed; }
.profile-card.recognize { border-left-color: #be185d; }
.profile-card.layout { border-left-color: #0891b2; }
.profile-card.present { border-left-color: #15803d; }

.profile-card h4 {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.25;
}

.profile-card dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 8px;
  margin: 0;
  font-size: 12px;
}

.profile-card dt {
  color: var(--muted);
  font-weight: 800;
}

.profile-card dd {
  margin: 0;
  min-width: 0;
}

.profile-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.profile-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  color: #344054;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  padding: 4px 7px;
}

.profile-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.profile-diagnostics {
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--border);
  background: #ffffff;
  max-height: 150px;
  overflow: auto;
  padding: 8px 12px;
}

.profile-diagnostic {
  border: 1px solid var(--border);
  border-left: 4px solid #64748b;
  border-radius: 6px;
  background: #ffffff;
  color: #344054;
  font-size: 12px;
  line-height: 1.35;
  padding: 7px 8px;
}

.profile-diagnostic.error {
  border-left-color: #d92d20;
  background: #fff1f0;
  color: #7a271a;
}

.profile-diagnostic.warning {
  border-left-color: #f79009;
  background: #fffaeb;
  color: #7a2e0e;
}

.profile-diagnostic.info {
  border-left-color: #2563eb;
  background: #eff6ff;
  color: #1e3a8a;
}

.rule-builder {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  padding: 12px;
}

.rule-builder-header,
.rule-builder-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.rule-builder h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
}

.selection-pill {
  max-width: 62%;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  padding: 5px 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-pill.ready {
  border-color: #90c9ba;
  color: var(--accent-strong);
}

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

.rule-builder label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.rule-builder select,
.rule-builder input[type="text"] {
  min-width: 0;
  min-height: 34px;
  font-size: 13px;
}

.rule-builder-actions {
  justify-content: flex-end;
}

.preview {
  height: calc(42vh - 45px);
  min-height: 340px;
  overflow: auto;
  padding: 22px;
}

.preview > :first-child {
  margin-top: 0;
}

.preview > :last-child {
  margin-bottom: 0;
}

.markdown-preview {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  font-size: 17px;
  line-height: 1.65;
}

.markdown-block {
  position: relative;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4,
.markdown-preview h5,
.markdown-preview h6 {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  line-height: 1.2;
  margin: 1.2em 0 0.35em;
}

.markdown-preview h1 {
  font-size: 32px;
}

.markdown-preview h2 {
  font-size: 25px;
}

.markdown-preview h3 {
  font-size: 20px;
}

.markdown-preview a {
  color: var(--accent-strong);
}

.markdown-preview code,
.markdown-preview pre {
  background: var(--code-bg);
  border-radius: 5px;
}

.markdown-preview code {
  padding: 2px 5px;
  font-size: 0.9em;
}

.markdown-preview pre {
  overflow: auto;
  padding: 12px;
}

.markdown-preview blockquote {
  margin-left: 0;
  padding-left: 16px;
  border-left: 4px solid var(--border);
  color: #475467;
}

.meltdown-page {
  background: #cfd6df;
  padding: 24px;
}

.render-document {
  display: grid;
  gap: 24px;
}

.render-sheet {
  width: var(--page-width, 210mm);
  aspect-ratio: var(--page-ratio, 210 / 297);
  margin: 0 auto;
  background: #ffffff;
  color: #000000;
  box-shadow: 0 18px 45px rgba(17, 24, 39, 0.18);
  overflow: hidden;
  position: relative;
}

.sheet-header,
.sheet-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: start;
  color: #000000;
  font-family: Arial, sans-serif;
  font-size: 12px;
  line-height: 1.25;
}

.sheet-header {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.sheet-header strong {
  font-size: 16px;
  line-height: 1.2;
}

.sheet-footer {
  border-top: 0;
  margin-top: 34px;
  padding-top: 10px;
}

.slot-center {
  text-align: center;
}

.slot-right {
  text-align: right;
}

.role-block {
  margin: 0;
  position: relative;
}

.role-block[data-role="Einleitungstext"],
.role-block[data-role="Frageblock"],
.role-block[data-role="SchlussortDatum"],
.role-block[data-role="SchlussSignatur"] {
  max-width: 132mm;
}

.render-sheet h1,
.render-sheet h2,
.render-sheet h3,
.render-sheet h4,
.render-sheet h5,
.render-sheet h6,
.render-sheet p,
.render-sheet ol,
.render-sheet ul,
.render-sheet blockquote {
  font: inherit;
  line-height: inherit;
  margin: 0;
}

.render-sheet ol,
.render-sheet ul {
  padding-left: 5mm;
}

.render-sheet li + li {
  margin-top: 1.5mm;
}

.debug-label {
  display: none;
}

.debug-mode .markdown-block,
.debug-mode .role-block {
  --debug-color: #64748b;
  border: 1px solid var(--debug-color);
  box-shadow: inset 4px 0 0 var(--debug-color);
  background: #ffffff;
  margin-block: 3px;
  padding: 8px 8px 8px 12px;
}

.debug-mode .role-block {
  margin-block: 2px;
  padding: 5px 5px 5px 10px;
}

.debug-mode .markdown-block:hover,
.debug-mode .role-block:hover {
  outline: 2px solid var(--debug-color);
  outline-offset: 1px;
}

.profile-card.is-role-active,
.markdown-block.is-role-active,
.role-block.is-role-active {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.16);
}

.markdown-block.is-role-active,
.role-block.is-role-active {
  background: rgba(255, 251, 235, 0.95);
}

.debug-mode .markdown-block::before,
.debug-mode .role-block::before {
  content: attr(data-debug-label);
  display: none;
  position: absolute;
  z-index: 3;
  inset-block-start: -8px;
  inset-inline-start: 8px;
  border: 1px solid var(--debug-color);
  border-radius: 4px;
  background: #ffffff;
  color: #111827;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  max-width: min(360px, 90%);
  overflow: hidden;
  padding: 3px 5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.debug-mode .markdown-block:hover::before,
.debug-mode .role-block:hover::before {
  display: inline-block;
}

.debug-mode [data-role="Body"] { --debug-color: #64748b; }
.debug-mode [data-role="Hidden"],
.debug-mode [data-style="Hidden"] { --debug-color: #94a3b8; }
.debug-mode [data-role="Herausgeber"],
.debug-mode [data-role="CourtTitle"] { --debug-color: #2563eb; }
.debug-mode [data-role="DokumentMeta"],
.debug-mode [data-role="TermLine"],
.debug-mode [data-role="PageNumber"],
.debug-mode [data-role="SlipMarker"] { --debug-color: #7c3aed; }
.debug-mode [data-role="Dokumentart"],
.debug-mode [data-role="SyllabusHeading"],
.debug-mode [data-role="OpinionHeading"],
.debug-mode [data-role="ConcurrenceHeading"] { --debug-color: #dc2626; }
.debug-mode [data-role="Urheber"],
.debug-mode [data-role="OpinionAuthor"],
.debug-mode [data-role="ConcurrenceAuthor"] { --debug-color: #c2410c; }
.debug-mode [data-role="Titel"],
.debug-mode [data-role="CaseCaption"],
.debug-mode [data-role="OpinionCaption"] { --debug-color: #0891b2; }
.debug-mode [data-role="Einleitungstext"],
.debug-mode [data-role="SyllabusBody"],
.debug-mode [data-role="OpinionBody"],
.debug-mode [data-role="ConcurrenceBody"] { --debug-color: #15803d; }
.debug-mode [data-role="Frageblock"],
.debug-mode [data-role="Holding"] { --debug-color: #ca8a04; }
.debug-mode [data-role="SectionHeading"],
.debug-mode [data-role="SubsectionHeading"],
.debug-mode [data-role="Einleitungsformel"] { --debug-color: #be185d; }

.diagnostics {
  width: min(100%, 760px);
  margin: 0 auto 14px;
  border: 1px solid #fda29b;
  border-radius: 6px;
  background: #fff1f0;
  color: #7a271a;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 980px) {
  .home-hero,
  .split-section,
  .section-heading-row {
    grid-template-columns: 1fr;
  }

  .home-hero {
    min-height: auto;
  }

  .home-hero h1,
  .home-section h2 {
    max-width: 16ch;
  }

  .pipeline-panel {
    grid-template-columns: 1fr;
  }

  .pipeline-arrow {
    display: none;
  }

  .pipeline-column pre,
  .mini-page {
    min-height: 210px;
  }

  .faq-grid,
  .demo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .header-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }

  textarea,
  .preview {
    height: auto;
  }

  .rule-builder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .home-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .home-footer {
    align-items: flex-start;
    flex-direction: column;
    width: min(100% - 24px, 1180px);
  }

  .home-hero,
  .home-section {
    width: min(100% - 24px, 1180px);
  }

  .home-hero h1 {
    font-size: 40px;
  }

  .home-lede,
  .section-copy,
  .section-heading-row > p {
    font-size: 16px;
  }

  .faq-grid,
  .demo-grid {
    grid-template-columns: 1fr;
  }

  .featured-demo {
    grid-column: auto;
  }

  .app-header,
  .workspace {
    padding-left: 12px;
    padding-right: 12px;
  }

  .meltdown-page {
    padding: 12px;
  }

  .render-sheet {
    min-height: auto;
  }

  .rule-builder-grid {
    grid-template-columns: 1fr;
  }

  .rule-builder-header,
  .rule-builder-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .selection-pill {
    max-width: 100%;
  }
}

@media print {
  @page {
    margin: 0;
  }

  body {
    background: #ffffff;
  }

  body > :not(.workspace),
  .workspace > :not(.preview-pane:last-child),
  .preview-pane:last-child .pane-header {
    display: none !important;
  }

  .workspace,
  .preview-pane,
  .meltdown-page {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: #ffffff;
    overflow: visible;
  }

  .preview,
  .meltdown-page {
    height: auto;
    min-height: 0;
  }

  .render-document {
    gap: 0;
    zoom: 1 !important;
  }

  .render-sheet {
    box-shadow: none;
    margin: 0;
    page-break-after: always;
  }

  .debug-label {
    display: none !important;
  }
}