/* Aufnamo App-CSS — vereint Backend-UI mit Aufnamo-Designsystem (warmes Beige + Grün). */

:root {
  /* Aufnamo-Palette (abgestimmt mit landing.css) */
  /* Marke „Signal": Ink + Indigo (Phase 32). --ok bleibt Erfolgs-Grün. */
  --bg: #fbfbfc;
  --bg-soft: #f1f1f4;
  --bg-tint: #f7f7fa;
  --surface: #ffffff;
  --panel: #ffffff;
  --ink: #0e1018;
  --ink-2: #62636f;
  --ink-3: #9b9ba6;
  --muted: #62636f;
  --primary: #5b6cff;
  --primary-dark: #4453e0;
  --primary-soft: #eaecff;
  --pale: #aeb6ff;
  --accent: #5b6cff;
  --border: #e6e6ec;
  --rule: #e6e6ec;
  --shadow: rgba(91, 108, 255, 0.16);
  --warn: #b3261e;
  --ok: #16a34a;
  --danger: #b3261e;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --grid-gutter: 16px;

  --sans: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Scrollleiste: dezent, markenfarben, dauerhaft sichtbar. Ohne dieses Styling
   zeigt Windows/Chrome eine ausgeblendete Overlay-Leiste — der Ziehbalken ist
   dann kaum zu sehen. Gilt für die ganze Seite und alle Scroll-Container. */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--ink-3) transparent;
}
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: var(--ink-3);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--ink-2, var(--muted));
}

/* ── Objektmodell / CRM-View (Plattform-Engine) ──────────────────────────── */
.obj-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.obj-card h2,
.obj-card h3 { margin: 0 0 10px; }
.obj-badge {
  display: inline-block;
  background: var(--bg-soft);
  color: var(--muted);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 13px;
  vertical-align: middle;
}
.obj-list { list-style: none; padding: 0; margin: 8px 0 0; }
.obj-list li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.obj-list li:last-child { border-bottom: 0; }
.obj-table { width: 100%; border-collapse: collapse; }
.obj-table th,
.obj-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.obj-table thead th { color: var(--muted); font-weight: 500; }

a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin-left: calc(var(--grid-gutter) / -2);
  margin-right: calc(var(--grid-gutter) / -2);
}

.col {
  flex: 1 1 0;
  min-width: 0;
  padding-left: calc(var(--grid-gutter) / 2);
  padding-right: calc(var(--grid-gutter) / 2);
}

[class^="col-"],
[class*=" col-"] {
  flex: 0 0 auto;
  min-width: 0;
  padding-left: calc(var(--grid-gutter) / 2);
  padding-right: calc(var(--grid-gutter) / 2);
}

.col-1 { width: 8.333%; }
.col-2 { width: 16.666%; }
.col-3 { width: 25%; }
.col-4 { width: 33.333%; }
.col-5 { width: 41.666%; }
.col-6 { width: 50%; }
.col-7 { width: 58.333%; }
.col-8 { width: 66.666%; }
.col-9 { width: 75%; }
.col-10 { width: 83.333%; }
.col-11 { width: 91.666%; }
.col-12 { width: 100%; }

@media (max-width: 980px) {
  .md-col-1 { width: 8.333%; }
  .md-col-2 { width: 16.666%; }
  .md-col-3 { width: 25%; }
  .md-col-4 { width: 33.333%; }
  .md-col-5 { width: 41.666%; }
  .md-col-6 { width: 50%; }
  .md-col-7 { width: 58.333%; }
  .md-col-8 { width: 66.666%; }
  .md-col-9 { width: 75%; }
  .md-col-10 { width: 83.333%; }
  .md-col-11 { width: 91.666%; }
  .md-col-12 { width: 100%; }

  .form-grid .form-field {
    grid-column: 1 / span var(--col-span-md, 12);
  }
}

@media (max-width: 720px) {
  .row {
    margin-left: 0;
    margin-right: 0;
  }
  .col,
  [class^="col-"],
  [class*=" col-"],
  .md-col-1,
  .md-col-2,
  .md-col-3,
  .md-col-4,
  .md-col-5,
  .md-col-6,
  .md-col-7,
  .md-col-8,
  .md-col-9,
  .md-col-10,
  .md-col-11,
  .md-col-12 {
    width: 100%;
    padding-left: 0;
    padding-right: 0;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .form-grid .form-field {
    grid-column: 1 / -1;
  }
}

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

.page-header h1 {
  margin: 0;
  font-size: 2rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px var(--shadow);
}

/* Dashboard-Karten-Raster (Phase 3 — fehlte das Grid + Anker-Styling) */
.dashboard h1 {
  margin: 0 0 4px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.cards .card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.cards .card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 12px 28px var(--shadow);
}
.cards .card h2 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--ink);
}
.cards .card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 16px;
  margin-bottom:20px;
}

.form {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  font-size: var(--form-font-size, 1rem);
  color: var(--form-text, var(--ink));
  font-family: var(--form-body-font, inherit);
  line-height: var(--form-line-height, 1.5);
}

/* Public-Form Container-Styling (Phase 19c) ─────────────────────────────── */
#public-form {
  max-width: var(--form-container-max-width, 100%);
  margin: 0 auto;
  padding: var(--form-container-padding, 24px);
  background: var(--form-container-bg, transparent);
  border-style: var(--form-border-style, none);
  border-width: var(--form-border-width, 0);
  border-color: var(--form-border-color, transparent);
  border-radius: var(--form-border-radius, 0);
  box-shadow: var(--form-shadow, none);
}
#public-form h1, #public-form h2, #public-form h3 {
  font-family: var(--form-heading-font, var(--form-body-font, inherit));
  color: var(--form-heading-color, inherit);
  font-size: var(--form-heading-size, 24px);
}
#public-form .button.send,
#public-form button[type="submit"] {
  background: var(--form-accent, var(--primary));
  color: var(--form-accent-text, #fff);
  border-color: var(--form-accent, var(--primary));
}
#public-form a { color: var(--form-accent, var(--primary)); }
.form-header-block {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--form-border-color, #e5e7eb);
  position: relative;
  z-index: 1;
}
.form-footer-block {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--form-border-color, #e5e7eb);
  font-size: 0.85em;
  opacity: 0.85;
  position: relative;
  z-index: 1;
}
.form-logo { position: relative; z-index: 1; }
.form-logo-center { display: block; margin-left: auto !important; margin-right: auto !important; }
.form-logo-right { margin-left: auto !important; }
.form-watermark { position: absolute; inset: 0; pointer-events: none; }
#public-form > * { position: relative; z-index: 1; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }

.form-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--grid-gutter);
}

.form-field {
  margin-bottom: var(--grid-gutter);
}

.form-grid .form-field {
  margin-bottom: 0;
  grid-column: var(--col-start, 1) / span var(--col-span, 12);
}

.form-grid.show-guides .form-field {
  background-clip: padding-box;
}

.form-field:last-child {
  margin-bottom: 0;
}

.form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.form input,
.form textarea,
.form select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: inherit;
  font-family: inherit;
  background-color: white;
}

/* Felder füllen immer ihre Spalte (verhindert mini-/uneinheitliche Inputs).
   Checkboxen/Radios bleiben klein. (Phase 30 — Responsive) */
.form input:not([type="checkbox"]):not([type="radio"]),
.form textarea,
.form select {
  width: 100%;
  max-width: 100%;
}

.form.has-custom-bg {
  padding: 16px;
  border-radius: var(--radius-lg);
}

.form.has-custom-bg .form-grid {
  margin-top: 0;
}

.form input[type="date"],
.form input[type="datetime-local"],
.form input[type="time"] {
  font-size: 1.1rem;
  padding: 12px 12px;
  min-height: 44px;
}

.datetime-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.datetime-row input {
  flex: 1 1 auto;
}

.mini-button {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.mini-button:hover {
  background: #f8fafc;
}

.terms-block {
  display: grid;
  gap: 10px;
  align-items: start;
}

.terms-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.terms-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.terms-content {
  white-space: pre-wrap;
  color: var(--ink);
  line-height: 1.5;
}

.form input:focus,
.form textarea:focus,
.form select:focus,
.button:focus,
.link-button:focus {
  outline: 3px solid rgba(91, 108, 255, 0.35);
  outline-offset: 2px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.button:hover {
  background: var(--primary-dark);
}

.button.ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.button.small {
  padding: 8px 12px;
  font-size: 0.9rem;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.helper {
  font-size: 0.9rem;
  color: var(--muted);
}
.helper.checkbox-required {
  display: flex!important;
}
.checkbox-required input {
  width: 20px!important;
  height: 20px!important;
}

.required-star {
  color: var(--warn);
  margin-left: 6px;
}

.error {
  color: var(--warn);
  font-size: 0.9rem;
}

.notice {
  background: #ecfdf3;
  border: 1px solid #abefc6;
  color: var(--ok);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom:15px;
}

.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  background: #eef2f7;
  color: #1f2933;
  border: 1px solid var(--border);
}

.badge.ok {
  background: #ecfdf3;
  border-color: #abefc6;
  color: #067647;
}

.badge.warn {
  background: #fffaeb;
  border-color: #fedf89;
  color: #b54708;
}

.badge.danger {
  background: #fef3f2;
  border-color: #fecdca;
  color: #b42318;
}

.badge.neutral {
  background: #f2f4f7;
  border-color: #e4e7ec;
  color: #475467;
}

.badge.admin {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #075985;
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.table th,
.table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table th {
  background: #f8fafc;
  font-size: 0.95rem;
}

.table th[data-sort] {
  position: relative;
  padding-right: 32px;
}

.table th[data-sort]::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 10px;
  height: 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  transform: translateY(-50%);
}

.table th[data-sort][data-direction="asc"]::after {
  width: 0;
  height: 0;
  border: none;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 8px solid var(--muted);
}

.table th[data-sort][data-direction="desc"]::after {
  width: 0;
  height: 0;
  border: none;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 8px solid var(--muted);
}

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

.section-title {
  margin: 0;
}

.field-row {
  display: grid;
  grid-template-columns: 36px 1fr 170px 160px 130px 36px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #f8fafc;
}

.field-row .icon-button {
  justify-self: end;
}

.field-row .drag-handle {
  cursor: grab;
  touch-action: none;
}

.field-row.dragging {
  opacity: 0.6;
  background: #eef2f7;
}

.field-row.placeholder {
  border: 1px dashed var(--border);
  background: #f8fafc;
}

.drag-ghost {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  opacity: 0.85;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
  border-radius: var(--radius-md);
}

.field-row .field-extra {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.field-size {
  display: grid;
  gap: 6px;
}

.field-size select {
  width: 100%;
}

.form-preview {
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: #f8fafc;
  font-size: var(--form-font-size, 1rem);
  color: var(--form-text, var(--ink));
}
.form-preview.has-custom-bg {
  background: transparent;
}

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

.layout-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.layout-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.layout-guides {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.layout-grid.show-guides,
.form-grid.show-guides {
  position: relative;
  background-image: repeating-linear-gradient(
    to right,
    rgba(148, 163, 184, 0.25),
    rgba(148, 163, 184, 0.25) 1px,
    transparent 1px,
    transparent calc((100% / 12))
  );
}

.layout-grid.show-guides {
  padding: 8px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
}

.layout-item {
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: grid;
  gap: 6px;
  cursor: grab;
  user-select: none;
  position: relative;
}

.layout-item.dragging {
  opacity: 0.6;
  background: #eef2f7;
}

.layout-item.placeholder {
  border: 1px dashed var(--border);
  background: #f8fafc;
}

.layout-item.resizing {
  cursor: col-resize;
}

.layout-item.offsetting {
  cursor: col-resize;
}

.layout-offset {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 14px;
  height: 54px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  cursor: col-resize;
}

.layout-offset::before {
  content: "";
  position: absolute;
  inset: 4px 6px;
  border-left: 2px solid var(--border);
  border-right: 2px solid var(--border);
}

.layout-resize {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 14px;
  height: 54px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  cursor: col-resize;
}

.layout-resize::before {
  content: "";
  position: absolute;
  inset: 4px 6px;
  border-left: 2px solid var(--border);
  border-right: 2px solid var(--border);
}

.layout-title {
  font-weight: 600;
}

.layout-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.form-image {
  max-width: 100%;
  height: auto;
}

.address-block button {
  float:right; margin-left:12px;
}

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

.address-grid label {
  display: grid;
  gap: 6px;
}

.address-grid label span {
  font-weight: 400;
}

.address-grid label input {
  font-weight: 400;
}

.address-summary {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.address-hidden {
  display: none;
}

.contacts-block {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

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

.contact-item {
  display: grid;
  grid-template-columns: 1fr 36px;
  gap: 8px;
  align-items: center;
}

.contact-item input {
  width: 100%;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.input-with-suffix {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.input-suffix {
  color: var(--muted);
  font-weight: 600;
}

@media (max-width: 720px) {
  .contact-item {
    grid-template-columns: 1fr;
  }
  .preview-row {
    grid-template-columns: 1fr;
  }
}

.address-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.address-status {
  margin-top: 6px;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 50;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100% - 32px));
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2);
}

.preview-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.preview-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.preview-files {
  margin-top: 16px;
}

.preview-files ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.address-required {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 6px 12px;
}

@media (max-width: 720px) {
  .address-grid {
    grid-template-columns: 1fr;
  }
}
.hidden{
  display: none;
}
.dropzone{
  padding:20px;text-align:center;border:1px dashed silver;margin:0; cursor: pointer;
  margin-top:8px;
}

.dropzone.is-dragging {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.dropzone-icon{
  width: 40px;height: 40px;
  display: inline-flex;;
}
.dropzone-text{
  font-size: 16px;
}
.static-text {
  margin: 0;
}
.terms-row{
  display: flex !important;
}
.signature {
  position: relative;
  display: grid;
  gap: 12px;
}
button.send{
  margin-top: 16px;
}
.signature canvas {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid darkgray;
  background: #fffaf0;
  touch-action: none;
}

.signature:fullscreen {
  background: var(--surface);
  padding: 20px;
}

.signature:fullscreen canvas {
  max-width: 100%;
  max-height: 100%;
}

.signature .signature-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 8px;
  z-index: 2;
}


.file-list {
  display: grid;
  gap: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
}

.json-preview {
  background: #111827;
  color: #f8fafc;
  padding: 16px;
  border-radius: var(--radius-md);
  white-space: pre-wrap;
}

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

  .field-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .field-row button {
    justify-self: start;
  }

  .content {
    padding: 16px;
  }

  .form {
    gap: 12px;
  }

  .signature {
    gap: 8px;
  }

  .signature .signature-actions {
    position: static;
    justify-content: flex-end;
  }

  .icon-button {
    width: 30px;
    height: 30px;
  }

  .signature canvas {
    min-height: 120px;
  }
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.public-view .nav {
  display: none;
}

.public-view .site-header {
  padding: 10px 16px;
}

.public-view .brand a {
  font-size: 0.85rem;
}

.public-view .site-footer {
  padding: 8px 12px 16px;
  font-size: 0.8rem;
  gap: 6px;
}

.public-view .site-footer span {
  margin: 0;
}

.brand a {
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Marke „Signal" (Phase 32) — Mark + Wortmarke nebeneinander. */
.brand a,
.sidebar-brand a,
.mobile-topbar .brand a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand-mark {
  color: var(--ink);
  flex: 0 0 auto;
}
.brand-cb {
  stroke: var(--accent);
}
.brand-dot {
  color: var(--accent);
}

.nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

.nav .cta {
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
}

.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px;
}

/* ── App-Shell mit Seitenleiste (Phase 29) ──────────────────────────────── */
.app-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}
.app-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.app-main .content {
  flex: 1 0 auto;
  width: 100%;
}
.app-main .site-footer {
  border-top: 1px solid var(--border);
}

.sidebar {
  flex: 0 0 240px;
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 22px 20px 10px;
}
.sidebar-brand a {
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 12px 16px;
  flex: 1 1 auto;
}
.nav-group-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
  font-weight: 600;
  padding: 16px 12px 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--ink-2);
  font-size: 0.94rem;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-link:hover {
  background: var(--primary-soft);
  color: var(--ink);
}
.nav-link.active {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  font-size: 0.78rem;
  color: var(--ink-3);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-logout {
  width: 100%;
}

/* Mobil-Topbar + Hamburger — am Desktop versteckt */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: 12px;
}
.hamburger {
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
}
.hamburger span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
}
.sidebar-backdrop {
  display: none;
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }
  .mobile-topbar {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }
  .mobile-topbar .brand a {
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--ink);
    text-decoration: none;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 2px 0 18px rgba(0, 0, 0, 0.18);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.42);
  }
  .content {
    padding: 20px 16px;
  }
}

.site-footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 22px;
  text-align: center;
  padding: 24px 32px 40px;
  color: var(--muted);
}

.hero {
  margin-top: 16px;
}

.hero .row {
  align-items: center;
  row-gap: 24px;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.hero .card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 6px 18px var(--shadow);
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.icon-button.danger {
  color: var(--warn);
}

.pdf-style-preview {
  gap: 12px;
}

.pdf-style-preview iframe {
  width: 100%;
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: #f8fafb;
  border: 1px solid var(--border);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.flash {
  background: #ecfdf3;
  border: 1px solid #abefc6;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.empty {
  text-align: center;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

/* Brand-Assets (Phase 19b) ───────────────────────────────────────────────── */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.brand-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface, #fff);
}
.brand-card-preview {
  background: repeating-conic-gradient(#f3f4f6 0% 25%, #fff 0% 50%) 50% / 16px 16px;
  border-radius: var(--radius-sm, 4px);
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.brand-card-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.brand-card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Form-Design-Modal Tabs (Phase 19c) ─────────────────────────────────────── */
.design-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.design-tab {
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-weight: 500;
  color: var(--muted, #6b7280);
}
.design-tab[aria-selected="true"] {
  color: var(--primary, #2563eb);
  border-bottom-color: var(--primary, #2563eb);
}
.design-tab-panel {
  display: none;
}
.design-tab-panel[data-active] {
  display: block;
}
.design-color-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.design-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.design-preset-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.design-preset-card:hover { border-color: var(--primary, #2563eb); }
.design-preset-swatches {
  display: flex;
  gap: 4px;
}
.design-preset-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.08);
}

@media (max-width: 720px) {
  .site-header {
    flex-direction: column;
    gap: 12px;
  }

  .content {
    padding: 24px;
  }

  .list-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* ── Legal pages (Impressum / Datenschutz / AGB / Kontakt) ──────────────── */
.legal {
  max-width: 760px;
  margin: 16px auto 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 48px;
  line-height: 1.65;
}
.legal h1 {
  margin: 0 0 24px;
  font-size: 32px;
  letter-spacing: -0.01em;
}
.legal h2 {
  margin: 32px 0 12px;
  font-size: 20px;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}
.legal h2:first-of-type { border-top: none; padding-top: 0; }
.legal h3 {
  margin: 20px 0 8px;
  font-size: 16px;
  color: var(--ink-2);
}
.legal p { margin: 0 0 12px; }
.legal ul { padding-left: 20px; margin: 8px 0 16px; }
.legal li { margin-bottom: 6px; }
.legal code {
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.92em;
}
.legal a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal .muted { color: var(--ink-3); font-size: 14px; }
.legal .lead {
  font-size: 18px;
  color: var(--ink-2);
  margin-bottom: 24px;
}

/* ── 404 NotFound ───────────────────────────────────────────────────────── */
.not-found {
  text-align: center;
  padding: 80px 24px;
  max-width: 520px;
  margin: 0 auto;
}
.not-found .code {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.not-found h1 {
  font-size: 40px;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}
.not-found p {
  color: var(--ink-2);
  margin: 0 0 28px;
  font-size: 17px;
}

/* ── Password reset ─────────────────────────────────────────────────────── */
.auth .helper {
  font-size: 14px;
  color: var(--ink-2);
  margin: 12px 0 0;
}

/* ── QR Scanner ─────────────────────────────────────────────────────────── */
.qr-input-wrap {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.qr-input-wrap > input { flex: 1 1 auto; }
.qr-input-button {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.qr-input-button:hover { background: var(--primary-soft); border-color: var(--primary); }

.qr-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.qr-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.55);
}
.qr-modal-card {
  position: relative;
  max-width: 520px;
  width: calc(100% - 32px);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
}
.qr-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.qr-modal-head h2 { margin: 0; font-size: 18px; }
.qr-modal-close {
  border: none; background: transparent; font-size: 24px;
  cursor: pointer; color: var(--ink-2); line-height: 1;
}
.qr-modal-tabs {
  display: flex; padding: 8px 16px 0; gap: 4px;
  border-bottom: 1px solid var(--border);
}
.qr-tab {
  border: none; background: transparent;
  padding: 10px 14px; font: inherit; cursor: pointer;
  color: var(--ink-2); border-bottom: 2px solid transparent;
}
.qr-tab.is-active {
  color: var(--ink); border-bottom-color: var(--primary);
  font-weight: 600;
}
.qr-modal-body { padding: 16px; overflow: auto; }
.qr-pane { display: none; }
.qr-pane.is-active { display: block; }
.qr-video {
  width: 100%; max-height: 320px; background: black; border-radius: var(--radius-md);
  object-fit: cover;
}
.qr-hint { color: var(--ink-2); font-size: 14px; margin: 12px 0 0; text-align: center; }
.qr-file-drop {
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--border); border-radius: var(--radius-md);
  padding: 32px 16px; cursor: pointer; color: var(--ink-2);
}
.qr-file-drop input { position: absolute; opacity: 0; pointer-events: none; }
.qr-file-preview { max-width: 100%; margin-top: 12px; border-radius: var(--radius-md); }
.qr-result {
  margin-top: 16px; padding: 12px; background: var(--primary-soft);
  border-radius: var(--radius-md); border: 1px solid var(--pale);
}
.qr-result-label { font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.qr-result-text {
  font-family: var(--mono); font-size: 14px; word-break: break-all;
  padding: 8px; background: var(--surface); border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.qr-result-actions { display: flex; gap: 8px; }
.qr-error {
  margin-top: 12px; padding: 10px 14px;
  background: #fef3f2; color: var(--danger);
  border-radius: var(--radius-md); border: 1px solid #fecdca;
  font-size: 14px;
}

/* ── ID-Document Scan-Block ─────────────────────────────────────────────── */
.id-document-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--bg-soft);
}
.id-document-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.id-document-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.id-document-grid label { display: grid; gap: 4px; font-weight: 500; font-size: 14px; }
.id-document-grid input {
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface);
  font: inherit;
}
.id-document-status {
  flex: 1 1 100%;
  font-size: 13px;
}
.id-document-status.success { color: var(--ok); }
.id-document-status.error { color: var(--danger); }
@media (max-width: 540px) {
  .id-document-grid { grid-template-columns: 1fr; }
}

/* ── Form-Actions (Phase 14a) ───────────────────────────────────────────── */
.action-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--surface);
  display: grid;
  gap: 12px;
}
.action-row-head {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
}
.action-row-head select {
  flex: 1 1 auto;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--surface);
}
.action-row-config {
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.action-row-config label.helper { display: grid; gap: 4px; font-weight: 500; font-size: 13px; }
.action-row-config label.helper input[type=text],
.action-row-config label.helper input[type=password] {
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface);
  font: inherit; font-weight: 400;
}
.action-row-config label.checkbox-required {
  flex-direction: row !important; display: flex !important;
  align-items: center; gap: 8px;
}
.action-row-config label.checkbox-required input { width: auto; }
.actions-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
}
@media (max-width: 540px) {
  .actions-grid { grid-template-columns: 1fr; }
}

/* ── API-Tokens (Phase 14b) ─────────────────────────────────────────────── */
.api-tokens .token-display {
  background: var(--ink);
  color: #fafafa;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 14px;
  word-break: break-all;
  overflow-x: auto;
  margin: 8px 0;
}
.api-tokens code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--bg-soft);
  padding: 1px 6px;
  border-radius: 3px;
}

/* ── Submission Detail (Phase 14g) ──────────────────────────────────────── */
.submission-detail .meta-list {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 16px;
  margin: 0;
}
.submission-detail .meta-list dt {
  font-weight: 600; color: var(--ink-2);
}
.submission-detail .meta-list dd {
  margin: 0; word-break: break-word;
}
.submission-detail .actions {
  display: flex; gap: 8px;
}
.submission-detail .payload-display {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.submission-detail .file-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.submission-detail .file-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.submission-detail .file-list li:last-child { border-bottom: none; }
.submission-detail .truncate {
  max-width: 380px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.submission-detail .error-text { color: var(--danger); }
.table.compact th, .table.compact td {
  font-size: 13px;
  padding: 6px 8px;
}

/* ── API Docs (Swagger UI overrides) ────────────────────────────────────── */
.api-docs { padding-bottom: 80px; }
.api-docs .helper { margin-bottom: 16px; }

/* ── Conditional Logic Builder (Phase 15a) ──────────────────────────────── */
.field-conditional {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: grid;
  gap: 8px;
}
.field-conditional > label.helper {
  font-size: 13px;
  display: flex !important;
  align-items: center;
  gap: 6px;
}
.field-conditional-config {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 6px;
  background: var(--bg-soft);
  padding: 8px;
  border-radius: var(--radius-sm);
}
.field-conditional-config select,
.field-conditional-config input {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  background: var(--surface);
}
@media (max-width: 640px) {
  .field-conditional-config { grid-template-columns: 1fr; }
}

/* ── Draft-Autosave-Banner (Phase 16b) ──────────────────────────────────── */
.draft-banner {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 10px 14px; margin-bottom: 16px;
  background: var(--accent-soft);
  border: 1px solid var(--pale, #aeb6ff);
  border-radius: var(--radius-md);
  color: var(--accent);
  font-size: 14px;
}
.draft-banner .draft-discard {
  background: transparent; border: 1px solid var(--accent);
  padding: 4px 10px; border-radius: var(--radius-sm);
  color: var(--accent); cursor: pointer; font: inherit; font-size: 13px;
}
.draft-banner .draft-discard:hover { background: var(--accent); color: white; }

/* ── Offline-Submit-Status (Phase 26c) ──────────────────────────────────── */
#offline-status { display: block; }
#offline-status[data-tone="warn"] {
  background: #fff7ed; border-color: #fdba74; color: #9a3412;
}
#offline-status[data-tone="ok"] {
  background: #ecfdf5; border-color: #6ee7b7; color: #065f46;
}

/* ── Step-Wizard (Phase 16c) ────────────────────────────────────────────── */
.page-break-marker { grid-column: 1 / -1; }
.page-break-line {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0;
  color: var(--ink-3); font-size: 13px;
}
.page-break-line::before,
.page-break-line::after {
  content: ""; flex: 1 1 auto;
  border-top: 2px dashed var(--rule);
}
.page-break-row {
  background: var(--bg-soft);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 12px;
}
.page-break-label { flex: 1 1 auto; color: var(--ink-3); font-size: 13px; font-weight: 500; }

.wizard-progress {
  display: flex; gap: 8px; justify-content: center;
  margin: 0 0 24px;
}
.wizard-dot {
  width: 32px; height: 4px; border-radius: 2px;
  background: var(--rule);
  transition: background .2s;
}
.wizard-dot.active { background: var(--accent); }
.wizard-dot.done { background: var(--pale, #aeb6ff); }

.wizard-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 24px;
}
.wizard-counter {
  color: var(--ink-2); font-size: 14px;
}

/* ════════════════════════════════════════════════════════════════════════
   Responsive-Feinschliff für kleinere Auflösungen (Phase 30)
   ════════════════════════════════════════════════════════════════════════ */

/* Footer-Einträge untereinander statt nebeneinander (Tablet & kleiner). */
@media (max-width: 760px) {
  .site-footer {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 16px 32px;
  }
}

/* Mehrspaltige Formular-Grids brechen auf Handys auf eine Spalte um. */
@media (max-width: 640px) {
  .design-color-grid,
  .address-grid,
  .address-modal-grid,
  .id-document-grid,
  .actions-grid,
  .preview-row,
  .form-grid {
    grid-template-columns: 1fr !important;
  }
  .form-grid .form-field {
    grid-column: 1 / -1 !important;
  }
  /* Section-/Card-Header (Titel + Aktionen) stapeln statt zu quetschen. */
  .section-header,
  .id-document-head,
  .action-row-head {
    flex-wrap: wrap;
  }
  .section-header .actions {
    width: 100%;
  }
  /* Button-Reihen dürfen umbrechen statt überzulaufen. */
  .actions,
  .modal-actions,
  .address-actions {
    flex-wrap: wrap;
  }
  /* Tabellen horizontal scrollbar machen, statt die Seite zu sprengen. */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Etwas mehr Luft sparen. */
  .content {
    padding: 16px 12px;
  }
  .card,
  .panel {
    padding: 16px;
  }
}
