/* propstack.css — Scoped styles for the Propstack integration feature.
   Extracted from propstack-api-bernert/public/style.css and scoped under
   .ps-wrap to avoid conflicts with the main platform styles.
   Global classes (position:fixed elements, body modifiers) remain unscoped. */

/* ── Global (unscoped — position:fixed elements and body-level modifiers) ── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-backdrop.hidden { display: none; }

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary, #282A3F);
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(40, 42, 63, 0.14);
  z-index: 9999;
  white-space: nowrap;
  pointer-events: none;
}
.toast.hidden { display: none; }

body.formulare-fullscreen .header  { display: none; }
body.formulare-fullscreen .sidebar { display: none; }
body.formulare-fullscreen .main { padding: 12px 24px 20px; }

#wizardFsBtn {
  background: none;
  border: 1px solid var(--border, #b6b6b6);
  cursor: pointer;
  padding: 7px;
  color: var(--text-secondary, #999);
  border-radius: 5px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  min-width: 36px;
  transition: color .15s, border-color .15s;
}
#wizardFsBtn:hover { color: var(--accent, #D2720D); border-color: var(--accent, #D2720D); }
body.formulare-fullscreen #wizardFsBtn {
  color: var(--accent, #D2720D);
  border-color: var(--accent, #D2720D);
  background: #fff4e8;
}

.badge-submitted { display: inline-block; padding: 2px 10px; border-radius: 50px; font-size: 12px; font-weight: 600; background: #e8f8ee; color: #1e7a40; }
.badge-dryrun    { display: inline-block; padding: 2px 10px; border-radius: 50px; font-size: 12px; font-weight: 600; background: #fff4e0; color: #a05c00; }
.badge-draft     { display: inline-block; padding: 2px 10px; border-radius: 50px; font-size: 12px; font-weight: 600; background: #fff0e0; color: #b35a00; }

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

/* ── All other classes scoped under .ps-wrap ── */

.ps-wrap {
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  color: var(--text, #282929);
}

/* ── Buttons ── */
.ps-wrap .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 36px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s, transform 0.1s;
  text-decoration: none;
  line-height: 1.2;
}
.ps-wrap .btn:active { transform: scale(0.98); }

.ps-wrap .btn-primary {
  background: linear-gradient(180deg, #EB8B26 0%, #D2720D 100%);
  border: none;
  color: #fff;
  width: 100%;
  margin-top: 8px;
}
.ps-wrap .btn-primary:hover { opacity: 0.9; }

.ps-wrap .btn-ghost {
  background: transparent;
  color: var(--text-secondary, #999);
  padding: 8px 12px;
  font-size: 13px;
  border: none;
}
.ps-wrap .btn-ghost:hover { color: var(--text, #282929); }

.ps-wrap .btn-sm { padding: 4px 10px; font-size: 12px; }

.ps-wrap .btn-danger {
  background: #c62828;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
}
.ps-wrap .btn-danger:hover { background: #b71c1c; }

/* ── Logout button ── */
.ps-wrap .btn-logout {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 7px 16px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-family: inherit;
  transition: background 0.2s;
}
.ps-wrap .btn-logout:hover { background: rgba(255, 255, 255, 0.2); }

/* ── Error message ── */
.ps-wrap .error-msg {
  background: #fde8e8;
  border: 1px solid #f5c0c0;
  color: #b10000;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

/* ── Form groups ── */
.ps-wrap .form-group { margin-bottom: 16px; }

.ps-wrap .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text, #282929);
  margin-bottom: 6px;
}

.ps-wrap .form-group input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--border, #b6b6b6);
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text, #282929);
  background: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.ps-wrap .form-group input:focus {
  border-color: var(--accent, #D2720D);
  box-shadow: 0 0 0 3px rgba(210, 114, 13, 0.12);
}

/* ── Form row grid ── */
.ps-wrap .form-row-grid { display: grid; grid-template-columns: 1fr auto; gap: 16px; }
.ps-wrap .form-row-grid .form-field:last-child { max-width: 120px; }

/* ── Section header ── */
.ps-wrap .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.ps-wrap .section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary, #999);
}

/* ── Automation Cards ── */
.ps-wrap .automations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.ps-wrap .automation-card {
  background: #ffffff;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(40, 42, 63, 0.08);
  border: 1.5px solid #e8e8e8;
  transition: box-shadow 0.2s;
}
.ps-wrap .automation-card:hover { box-shadow: 0 4px 20px rgba(40, 42, 63, 0.14); }

.ps-wrap .card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ps-wrap .card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(180deg, #EB8B26 0%, #D2720D 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.ps-wrap .card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text, #282929);
  margin-bottom: 4px;
}

.ps-wrap .card-trigger {
  font-size: 12px;
  color: var(--text-secondary, #999);
  font-family: monospace;
  background: #F1F1F1;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

.ps-wrap .card-description {
  font-size: 13px;
  color: var(--text-secondary, #999);
  line-height: 1.5;
  margin: 12px 0 16px;
}

/* ── Status Badge ── */
.ps-wrap .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
}
.ps-wrap .status-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ps-wrap .status-active      { background: #e8f8ee; color: #1e7a40; }
.ps-wrap .status-active::before      { background: #27ae60; }
.ps-wrap .status-dry_run     { background: #fff4e0; color: #a05c00; }
.ps-wrap .status-dry_run::before     { background: #e67e22; }
.ps-wrap .status-disabled    { background: #f2f2f2; color: #999999; }
.ps-wrap .status-disabled::before    { background: #BDBDBD; }
.ps-wrap .status-not_configured { background: #fde8e8; color: #b10000; }
.ps-wrap .status-not_configured::before { background: #b10000; }

/* ── Card Stats Row ── */
.ps-wrap .card-stats {
  display: flex;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid #e8e8e8;
}
.ps-wrap .stat-item { text-align: center; flex: 1; }
.ps-wrap .stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text, #282929);
  line-height: 1;
}
.ps-wrap .stat-value.ok    { color: #27ae60; }
.ps-wrap .stat-value.error { color: #b10000; }
.ps-wrap .stat-value.skip  { color: #999999; }
.ps-wrap .stat-label {
  font-size: 11px;
  color: var(--text-secondary, #999);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 3px;
}
.ps-wrap .card-last-run {
  font-size: 12px;
  color: var(--text-secondary, #999);
  margin-top: 12px;
}

/* ── Log Table ── */
.ps-wrap .log-card {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(40, 42, 63, 0.08);
  border: 1.5px solid #e8e8e8;
  overflow-x: auto;
  overflow-y: hidden;
}
.ps-wrap .log-table { width: 100%; border-collapse: collapse; }
.ps-wrap .log-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary, #999);
  padding: 12px 20px;
  background: #F1F1F1;
  border-bottom: 1px solid #e8e8e8;
}
.ps-wrap .log-table td {
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text, #282929);
  border-bottom: 1px solid #e8e8e8;
  vertical-align: middle;
}
.ps-wrap .log-table tr:last-child td { border-bottom: none; }
.ps-wrap .log-table tr:hover td { background: #fafafa; }

.ps-wrap .log-entity { font-family: monospace; font-size: 12px; color: var(--text-secondary, #999); }

.ps-wrap .log-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}
.ps-wrap .log-status.ok       { background: #e8f8ee; color: #1e7a40; }
.ps-wrap .log-status.error    { background: #fde8e8; color: #b10000; }
.ps-wrap .log-status.skipped  { background: #f2f2f2; color: #999999; }
.ps-wrap .log-status.dry_run  { background: #fff4e0; color: #a05c00; }
.ps-wrap .log-status.conflict { background: #fde8e8; color: #b10000; }

.ps-wrap .log-time { font-size: 12px; color: var(--text-secondary, #999); white-space: nowrap; }
.ps-wrap .log-direction { font-size: 11px; color: #BDBDBD; text-transform: uppercase; }

/* ── Empty State ── */
.ps-wrap .empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-secondary, #999);
  font-size: 14px;
}
.ps-wrap .empty-state .icon { font-size: 32px; margin-bottom: 8px; }

/* ── Loading / Spinner ── */
.ps-wrap .loading {
  text-align: center;
  padding: 60px;
  color: var(--text-secondary, #999);
  font-size: 14px;
}
.ps-wrap .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e8e8e8;
  border-top-color: var(--accent, #D2720D);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}

/* ── Action Buttons ── */
.ps-wrap .action-btn {
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border, #b6b6b6);
  background: #ffffff;
  color: var(--text, #282929);
  font-family: inherit;
  transition: background 0.15s;
  white-space: nowrap;
}
.ps-wrap .action-btn:hover        { background: #F1F1F1; }
.ps-wrap .action-btn-danger       { color: #b10000; border-color: #f5c0c0; }
.ps-wrap .action-btn-danger:hover { background: #fde8e8; }

/* ── Table Actions ── */
.ps-wrap .table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* ── Inline Name Edit ── */
.ps-wrap .inline-name {
  cursor: pointer;
  font-weight: 600;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s;
}
.ps-wrap .inline-name:hover { border-bottom-color: var(--text-secondary, #999); }

.ps-wrap .inline-name-input {
  width: 100%;
  min-width: 240px;
  padding: 4px 8px;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  border: 1px solid var(--accent, #D2720D);
  border-radius: 5px;
  outline: none;
  box-sizing: border-box;
}

/* ── Modal Box ── */
.ps-wrap .modal-box {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.22);
  padding: 32px 36px 36px;
  width: 100%;
  max-width: 520px;
  position: relative;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
.ps-wrap .modal-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}
.ps-wrap .modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text, #282929);
  margin-bottom: 20px;
  flex-shrink: 0;
}
.ps-wrap .modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-secondary, #999);
  line-height: 1;
  padding: 4px 6px;
  font-family: inherit;
}
.ps-wrap .modal-close:hover { color: var(--text, #282929); }

.ps-wrap .url-box {
  background: #F1F1F1;
  border: 1px solid var(--border, #b6b6b6);
  border-radius: 5px;
  padding: 12px 16px;
  font-family: monospace;
  font-size: 12px;
  word-break: break-all;
  color: var(--text, #282929);
  margin-bottom: 10px;
  line-height: 1.6;
}
.ps-wrap .warn-text {
  font-size: 12px;
  color: #b10000;
  font-weight: 600;
  margin-bottom: 20px;
  line-height: 1.5;
}
.ps-wrap .payload-pre {
  background: #F1F1F1;
  border-top: 1px solid #e8e8e8;
  padding: 14px 20px;
  font-size: 12px;
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
  color: var(--text, #282929);
  line-height: 1.5;
}

/* ── Wizard Tabs ── */
.ps-wrap .wizard-tabs {
  display: flex;
  border-bottom: 2px solid var(--border, #b6b6b6);
  margin-bottom: 24px;
  gap: 0;
  flex-shrink: 0;
}
.ps-wrap .wizard-tab {
  flex: 1;
  padding: 10px 8px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text-secondary, #999);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.ps-wrap .wizard-tab:hover { color: var(--text, #282929); }
.ps-wrap .wizard-tab.active {
  color: var(--accent, #D2720D);
  border-bottom-color: var(--accent, #D2720D);
}
.ps-wrap .wizard-panel { min-height: 180px; }

/* ── Wizard Footer ── */
.ps-wrap .wizard-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border, #b6b6b6);
  gap: 8px;
  flex-shrink: 0;
}
.ps-wrap .wizard-footer-right { display: flex; gap: 8px; align-items: center; }

/* ── Combobox ── */
.ps-wrap .cb-wrapper { position: relative; width: 100%; }
.ps-wrap .cb-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border, #b6b6b6);
  border-radius: 5px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  background: #fff;
  transition: border-color 0.15s;
}
.ps-wrap .cb-input:focus { border-color: var(--accent, #D2720D); }
.ps-wrap .cb-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border, #b6b6b6);
  border-radius: 5px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
  max-height: 220px;
  overflow-y: auto;
  z-index: 200;
}
.ps-wrap .cb-hidden { display: none; }
.ps-wrap .cb-option {
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}
.ps-wrap .cb-option:hover,
.ps-wrap .cb-option.cb-focused  { background: #F1F1F1; }
.ps-wrap .cb-option.cb-selected { font-weight: 700; color: var(--accent, #D2720D); }
.ps-wrap .cb-option.cb-no-results { color: var(--text-secondary, #999); cursor: default; font-style: italic; }

/* ── Enrich Options ── */
.ps-wrap .enrich-options {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border, #b6b6b6);
  border-radius: 5px;
  overflow: hidden;
}
.ps-wrap .enrich-option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border, #b6b6b6);
}
.ps-wrap .enrich-option-row:last-child { border-bottom: none; }
.ps-wrap .enrich-option-row:hover { background: #F1F1F1; }
.ps-wrap .enrich-option-row.selected { background: #fff8f2; }
.ps-wrap .enrich-option-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent, #D2720D);
  cursor: pointer;
  flex-shrink: 0;
}
.ps-wrap .enrich-option-label { font-weight: 600; flex: 1; }
.ps-wrap .enrich-id-field-group {
  display: none;
  padding: 8px 14px 12px 39px;
  background: #fff8f2;
  border-top: 1px solid #f0d9c8;
}
.ps-wrap .enrich-id-field-group.visible { display: block; }
.ps-wrap .enrich-id-field-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary, #999);
  display: block;
  margin-bottom: 4px;
}
.ps-wrap .enrich-id-field-group input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border, #b6b6b6);
  border-radius: 5px;
  font-family: monospace;
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
  background: #fff;
}

/* ── Settings ── */
.ps-wrap .settings-hint { font-size: 13px; color: var(--text-secondary, #999); margin-bottom: 16px; }
.ps-wrap .settings-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ── Users Table ── */
.ps-wrap .users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ps-wrap .users-table th { text-align: left; font-weight: 600; padding: 8px 10px; border-bottom: 2px solid var(--border, #b6b6b6); color: var(--text, #282929); }
.ps-wrap .users-table td { padding: 8px 10px; border-bottom: 1px solid #e8e8e8; vertical-align: middle; }
.ps-wrap .users-table tr.disabled-row { opacity: 0.5; }
.ps-wrap .users-table .perm-cb { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent, #D2720D); }

.ps-wrap .perm-fieldset { border: 1px solid #e8e8e8; border-radius: 8px; padding: 12px 16px; margin-top: 8px; }
.ps-wrap .perm-fieldset legend { font-size: 13px; font-weight: 600; padding: 0 6px; }
.ps-wrap .perm-check { display: block; font-size: 13px; margin: 6px 0; cursor: pointer; }
.ps-wrap .perm-check input { margin-right: 8px; accent-color: var(--accent, #D2720D); }

.ps-wrap .user-status { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.ps-wrap .user-status.active   { background: #e8f5e9; color: #2e7d32; }
.ps-wrap .user-status.disabled { background: #fce4ec; color: #c62828; }

.ps-wrap .invite-link-box { background: #f5f5f5; padding: 10px 14px; border-radius: 8px; font-size: 12px; word-break: break-all; margin-top: 10px; }

/* ── Kein Zugriff ── */
.ps-wrap .kein-zugriff-block { display: flex; align-items: center; justify-content: center; min-height: 300px; }
.ps-wrap .kein-zugriff-block .kein-zugriff-inner { text-align: center; padding: 40px; }
.ps-wrap .kein-zugriff-block .kein-zugriff-inner h2 { font-size: 20px; color: var(--text, #282929); margin-bottom: 8px; }
.ps-wrap .kein-zugriff-block .kein-zugriff-inner p { font-size: 14px; color: var(--text-secondary, #999); }

/* ── Formulare-Page Touch Targets (iPad-optimiert) ── */
.ps-wrap .formulare-page .btn { min-height: 44px; }
.ps-wrap .formulare-page .table-actions .btn { min-height: 44px; }
.ps-wrap .formulare-page .form-input { font-size: 16px; min-height: 44px; padding: 10px 14px; color: var(--text, #282929); }
.ps-wrap .formulare-page textarea.form-input { min-height: 100px; }
.ps-wrap .formulare-page .radio-item,
.ps-wrap .formulare-page .check-item { min-height: 44px; padding: 6px 10px; border-radius: 5px; }
.ps-wrap .formulare-page .wizard-tabs {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  flex-wrap: nowrap;
}
.ps-wrap .formulare-page .wizard-tabs .wizard-tab { flex: 0 0 auto; min-height: 44px; padding: 10px 16px; }

/* ── Formulare Wizard Sticky Footer ── */
.ps-wrap .formulare-wizard-footer {
  position: sticky;
  bottom: 0;
  background: #ffffff;
  border-top: 1px solid #e8e8e8;
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  z-index: 10;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}
.ps-wrap .formulare-wizard-footer .btn { min-height: 44px; }
.ps-wrap .formulare-page .custom-field-row .btn { min-height: 44px; min-width: 44px; padding: 6px 10px; }

/* ── Combobox in Formulare context ── */
.ps-wrap .formulare-page .cb-input { font-size: 16px; min-height: 44px; padding: 10px 14px; }
.ps-wrap .formulare-page .cb-option { min-height: 44px; display: flex; align-items: center; padding: 10px 14px; font-size: 15px; }
.ps-wrap .formulare-page .cb-option.cb-focused,
.ps-wrap .formulare-page .cb-option:hover { background: #fff4e8; color: var(--accent, #D2720D); }
.ps-wrap .formulare-page .cb-option.cb-selected { font-weight: 700; color: var(--accent, #D2720D); }

/* ── Modals in Formulare context ── */
#modalNewSubmission .modal-box,
#modalAddField .modal-box,
#modalWriteFlow .modal-box { max-width: min(95vw, 680px); max-height: 92vh; }

/* ── Diff / Write-Flow Screens ── */
.ps-wrap .formulare-page .diff-choice-screen { display: flex; flex-direction: column; gap: 16px; }
.ps-wrap .formulare-page .diff-choice-heading { font-size: 16px; font-weight: 700; color: var(--text, #282929); margin: 0 0 4px; }
.ps-wrap .formulare-page .diff-choice-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ps-wrap .formulare-page .diff-choice-card {
  border: 1px solid var(--border, #b6b6b6);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color .15s;
}
.ps-wrap .formulare-page .diff-choice-card:hover { border-color: var(--accent, #D2720D); }
.ps-wrap .formulare-page .diff-choice-title { font-size: 14px; font-weight: 700; color: var(--text, #282929); }
.ps-wrap .formulare-page .diff-choice-desc { font-size: 12px; font-weight: 400; color: var(--text-secondary, #999); line-height: 1.5; }
.ps-wrap .formulare-page .diff-loading { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-secondary, #999); padding: 24px 0; }
.ps-wrap .formulare-page .diff-section { margin-bottom: 24px; }
.ps-wrap .formulare-page .diff-section-heading { font-size: 12px; font-weight: 400; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary, #999); margin-bottom: 8px; }
.ps-wrap .formulare-page .diff-row { border: 1px solid var(--border, #b6b6b6); border-left: 3px solid #fcd34d; border-radius: 5px; padding: 8px 16px; margin-bottom: 8px; }
.ps-wrap .formulare-page .diff-label { font-size: 14px; font-weight: 700; color: var(--text-secondary, #999); margin-bottom: 8px; }
.ps-wrap .formulare-page .diff-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ps-wrap .formulare-page .diff-cell { display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 5px; background: #f9f9f9; border: 1px solid transparent; }
.ps-wrap .formulare-page .diff-cell:has(input:checked) { background: #fff8f0; border-color: var(--accent, #D2720D); }
.ps-wrap .formulare-page .diff-val { font-size: 14px; font-weight: 400; color: var(--text, #282929); line-height: 1.5; word-break: break-word; }
.ps-wrap .formulare-page .diff-val.diff-empty { font-style: italic; color: var(--text-secondary, #999); }
.ps-wrap .formulare-page .diff-no-conflict-summary { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 5px; padding: 8px 16px; font-size: 12px; color: #166534; margin-top: 8px; }
.ps-wrap .formulare-page .diff-note-row { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 5px; padding: 8px 16px; font-size: 12px; color: #0c4a6e; margin-top: 8px; }
.ps-wrap .formulare-page .diff-new-summary { display: flex; flex-direction: column; gap: 0; }
.ps-wrap .formulare-page .diff-error { color: #b10000; font-size: 14px; font-weight: 400; padding: 16px 0; }
.ps-wrap .formulare-page .diff-no-contact { font-size: 12px; color: var(--text-secondary, #999); font-style: italic; padding: 8px 0; }

/* ── Propstack Property Search ── */
.ps-wrap .formulare-page .ps-search-block { margin-bottom: 16px; }
.ps-wrap .formulare-page .ps-search-wrap { position: relative; }
.ps-wrap .formulare-page .ps-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border, #b6b6b6);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  z-index: 200;
  max-height: 260px;
  overflow-y: auto;
}
.ps-wrap .formulare-page .ps-hidden { display: none; }
.ps-wrap .formulare-page .ps-search-item {
  padding: 8px 12px;
  font-size: 15px;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  color: var(--text, #282929);
}
.ps-wrap .formulare-page .ps-search-item:hover,
.ps-wrap .formulare-page .ps-search-item.ps-focused { background: #fff4e8; color: var(--accent, #D2720D); }
.ps-wrap .formulare-page .ps-search-item.ps-focused .ps-match-id { color: var(--accent, #D2720D); }
.ps-wrap .formulare-page .ps-search-loading,
.ps-wrap .formulare-page .ps-search-noresult,
.ps-wrap .formulare-page .ps-search-error { padding: 8px 12px; font-size: 12px; color: var(--text-secondary, #999); font-style: italic; }
.ps-wrap .formulare-page .ps-search-error { color: #dc2626; }
.ps-wrap .formulare-page .ps-match-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 15px;
  color: var(--text, #282929);
}
.ps-wrap .formulare-page .ps-match-id { color: var(--text-secondary, #999); font-size: 11px; }
.ps-wrap .formulare-page .ps-match-banner .ps-reset-btn { margin-left: auto; font-size: 11px; flex-shrink: 0; }

/* ── Responsive ── */
@media (max-width: 1023px) {
  .ps-wrap .formulare-page .field-row,
  .ps-wrap .formulare-page .field-row.triple,
  .ps-wrap .formulare-page .field-row.quad { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .ps-wrap .formulare-page .radio-group,
  .ps-wrap .formulare-page .check-group { flex-direction: column; gap: 4px; }
  .ps-wrap .formulare-page .radio-item,
  .ps-wrap .formulare-page .check-item { width: 100%; }
  .ps-wrap .formulare-page .toggle-row { flex-wrap: wrap; gap: 8px; }
  .ps-wrap .formulare-page .toggle-label { min-width: 100%; flex-basis: 100%; }
  .ps-wrap .formulare-page .toggle-extra.visible { width: 100%; flex-basis: 100%; }
  .ps-wrap .formulare-page .log-table th:nth-child(4),
  .ps-wrap .formulare-page .log-table td:nth-child(4),
  .ps-wrap .formulare-page .log-table th:nth-child(5),
  .ps-wrap .formulare-page .log-table td:nth-child(5) { display: none; }
  .ps-wrap .formulare-page.dashboard-page .main { padding: 20px 16px 40px; }
}

@media (max-width: 520px) {
  .ps-wrap .formulare-page .diff-choice-cards { grid-template-columns: 1fr; }
  .ps-wrap .formulare-page .diff-cols { grid-template-columns: 1fr; }
}

@media (min-width: 768px) {
  body.formulare-fullscreen .ps-wrap .formulare-page .field-row { grid-template-columns: 1fr 1fr; }
  body.formulare-fullscreen .ps-wrap .formulare-page .field-row.triple { grid-template-columns: 2fr 1fr 1fr; }
  body.formulare-fullscreen .ps-wrap .formulare-page .field-row.quad { grid-template-columns: 1fr 1fr 1fr 1fr; }
}
