/* Mieter-Modal – Workflow-Cards (Viverea / Apple-Stil) */

.mt-tenant-modal.modal-box {
  display: flex;
  flex-direction: column;
  max-width: 640px;
  max-height: min(92vh, 900px);
  min-height: min(520px, calc(90vh - 3rem));
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.12);
}

.mt-tenant-modal .modal-head {
  flex-shrink: 0;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: var(--bg-1, #fff);
}

.mt-modal-summary {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  padding: 0.65rem 1.5rem;
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.mt-modal-summary[hidden] {
  display: none !important;
}

.mt-summary-chunk {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--on-bg-dim, #424245);
  line-height: 1.4;
}

.mt-modal-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 1rem !important;
}

.mt-modal-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.mt-modal-card {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.mt-modal-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  background: rgba(0, 0, 0, 0.015);
}

.mt-modal-card-title {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--on-bg-muted, #8e8e93);
}

.mt-badge-optional {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--on-bg-muted, #aeaeb2);
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.04);
}

.mt-modal-card-body {
  padding: 1rem 1rem 1.1rem;
}

.mt-modal-card-body--secondary {
  background: rgba(0, 0, 0, 0.01);
}

.mt-modal-card-body--flush {
  padding: 0.85rem 1rem 1rem;
}

.mt-modal-card-body .form-g {
  margin-bottom: 0.85rem;
}

.mt-modal-card-body .form-g:last-child {
  margin-bottom: 0;
}

.mt-modal-card-hint {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--on-bg-muted, #8e8e93);
}

.mt-label-opt {
  font-weight: 400;
  color: var(--on-bg-muted, #aeaeb2);
  font-size: 0.75em;
}

.mt-modal-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: var(--bg-1, #fff);
}

/* Vertrag & Dokumente im Modal */
.mt-modal-contract-body {
  margin: 0;
}

.mt-modal-contract-body .mt-contract-lead,
.mt-modal-contract-body .mt-contract-existing-note {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--on-bg-muted, #8e8e93);
}

.mt-modal-contract-body .mt-contract-existing-note {
  color: var(--on-bg-dim, #6e6e73);
}

.mt-contract-fields-compact .form-row {
  gap: 0.75rem;
  margin-bottom: 0;
}

.mt-contract-fields-compact .form-g {
  margin-bottom: 0.75rem;
}

.mt-contract-fields-compact .form-row:last-child .form-g {
  margin-bottom: 0;
}

.mt-modal-contract-wrap {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.mt-modal-contract-body .mt-contract-upload-section {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.mt-contract-docs-lead {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  color: var(--on-bg-muted, #8e8e93);
}

.mt-upload-zone--compact {
  padding: 0.75rem 0.85rem !important;
  border-radius: 10px !important;
}

.mt-upload-zone--compact .mt-upload-zone-icon {
  display: none;
}

.mt-upload-zone--compact .mt-upload-zone-text {
  font-size: 0.8125rem !important;
}

.mt-upload-zone--compact .mt-upload-zone-hint {
  font-size: 0.6875rem !important;
  margin-top: 0.15rem !important;
}

.mt-upload-empty {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--on-bg-muted, #aeaeb2);
  text-align: center;
}

.mt-upload-empty[hidden] {
  display: none !important;
}

/* Light theme overrides für Modal-Formulare */
[data-theme="light"] .mt-tenant-modal .form-g input,
[data-theme="light"] .mt-tenant-modal .form-g textarea,
[data-theme="light"] .mt-tenant-modal .form-g select,
[data-theme="light"] .mt-tenant-modal .mt-contract-fields input,
[data-theme="light"] .mt-tenant-modal .mt-contract-fields select {
  background: #fafafa;
  border-color: rgba(0, 0, 0, 0.08);
  color: var(--on-bg, #1d1d1f);
}

[data-theme="light"] .mt-tenant-modal .form-g input:focus,
[data-theme="light"] .mt-tenant-modal .form-g textarea:focus,
[data-theme="light"] .mt-tenant-modal .mt-contract-fields input:focus,
[data-theme="light"] .mt-tenant-modal .mt-contract-fields select:focus {
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.04);
}

@media (max-width: 640px) {
  .mt-tenant-modal.modal-box {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .mt-modal-scroll {
    padding: 1rem !important;
  }

  .mt-modal-card-body .form-row,
  .mt-contract-fields-compact .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

.mt-modal-card-link {
  font-size: 0.75rem;
  font-weight: 500;
  color: #2563eb;
  text-decoration: none;
  white-space: nowrap;
}

.mt-modal-card-link:hover {
  text-decoration: underline;
}
