/* Entry-Dialog — Hörmann-Design für Termine */

.ed-dialog {
  width: 100%;
  max-width: 760px;
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  /* Kopf/Tabs/Footer bleiben immer sichtbar, nur .ed-body scrollt —
     nichts darf unsichtbar über den Viewport-Rand hinauslaufen. */
  overflow: hidden;
  flex-direction: column;
  max-height: calc(100dvh - 4vh);
  /* Oben fixieren statt vertikal zentriert — sonst springt der Dialog
     beim Tab-Wechsel (Buchung vs. Abwesenheit) hoch/runter, weil sich
     die Gesamt-Höhe ändert. */
  margin-top: 2vh;
  margin-bottom: auto;
}
/* display nur im offenen Zustand setzen — ein unbedingtes display:flex
   würde das UA-Default dialog:not([open]) { display:none } überschreiben
   und den geschlossenen Dialog sichtbar machen. */
.ed-dialog[open] { display: flex; }
.ed-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }

.ed-dialog::before {
  content: "";
  display: block;
  height: 4px;
  flex: none;
  background: linear-gradient(90deg, var(--color-brand-primary), color-mix(in srgb, var(--color-brand-primary) 75%, white));
}

.ed-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.ed-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 20px 6px;
  border-bottom: 1px solid var(--color-border);
  flex: none;
}
.ed-eyebrow {
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-brand-primary);
  margin-bottom: 4px;
}
.ed-title { margin: 0; font-size: var(--font-size-xl); font-weight: var(--font-weight-semibold); }

.ed-close {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.ed-close:hover { background: var(--color-surface-muted); color: var(--color-text-default); }

/* Tabs */
.ed-tabs {
  display: flex;
  gap: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  flex: none;
}
.ed-tab {
  appearance: none;
  background: transparent;
  border: none;
  padding: 9px 16px;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color 100ms ease, border-color 100ms ease;
}
.ed-tab:hover { color: var(--color-text-default); }
.ed-tab.is-active {
  color: var(--color-brand-primary);
  border-bottom-color: var(--color-brand-primary);
}

.ed-body {
  padding: 10px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  /* Scrollt nur, wenn der Platz wirklich nicht reicht — das SearchableSelect-
     Dropdown liegt im Scroll-Bereich und bleibt damit erreichbar. */
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.ed-tabpane {
  grid-column: 1 / -1;
  /* Höhe konstant halten — sonst springt der Dialog beim Tab-Wechsel,
     weil Buchung 4 Felder hat und Abwesenheit nur 1. */
  min-height: 168px;
}
.ed-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ed-field { display: flex; flex-direction: column; gap: 4px; }
.ed-field > span:first-child {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ed-field-wide { grid-column: 1 / -1; }
.ed-allday-row { align-self: end; }
.ed-time-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.ed-hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: 4px;
  font-weight: var(--font-weight-regular);
  text-transform: none;
  letter-spacing: 0;
}

.ed-field input[type="text"],
.ed-field input[type="datetime-local"],
.ed-field input[type="date"],
.ed-field input[type="time"],
.ed-field input[type="number"],
.ed-field select,
.ed-field textarea {
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--font-size-md);
  font-family: var(--font-family-base);
  transition: border-color 100ms ease, box-shadow 100ms ease;
}
.ed-field input:focus,
.ed-field select:focus,
.ed-field textarea:focus {
  outline: none;
  border-color: var(--color-brand-primary);
  box-shadow: 0 0 0 3px var(--color-brand-primary-soft);
}
.ed-field textarea { resize: vertical; min-height: 56px; }

.ed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  background: var(--color-surface);
}
.ed-toggle input { accent-color: var(--color-brand-primary); }
.ed-toggle span { font-size: var(--font-size-md); font-weight: var(--font-weight-medium); }

.ed-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  flex: none;
}

.ed-foot button {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 100ms ease, color 100ms ease, border-color 100ms ease;
}
.ed-delete {
  background: transparent;
  color: var(--color-status-error);
  border-color: var(--color-status-error);
}
.ed-delete:hover { background: var(--color-status-error); color: white; }
.ed-delete-confirm {
  background: var(--color-status-error);
  color: white;
  border-color: var(--color-status-error);
}
.ed-delete-confirm:hover { filter: brightness(0.95); }
.ed-delete-cancel {
  background: var(--color-surface);
  color: var(--color-text-default);
  border-color: var(--color-border-strong);
}
.ed-delete-cancel:hover { background: var(--color-surface-muted); }
.ed-cancel {
  background: var(--color-surface);
  color: var(--color-text-default);
  border-color: var(--color-border-strong);
}
.ed-cancel:hover { background: var(--color-surface-muted); }
.ed-save {
  background: var(--color-brand-primary);
  color: var(--color-brand-primary-on);
  border-color: var(--color-brand-primary);
}
.ed-save:hover { background: var(--color-brand-primary-hover); color: var(--color-brand-primary-on-hover); }
.ed-save:disabled { opacity: 0.6; cursor: not-allowed; }

/* Inline-Fehler */
.ed-error {
  margin: 0 24px 12px;
  padding: 10px 14px;
  background: #fde2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

/* Konflikt-Banner */
.ed-conflict {
  margin: 0 24px 12px;
  padding: 10px 14px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
}
.ed-conflict.is-block {
  background: #fde2e2;
  color: #991b1b;
  border-color: #fca5a5;
}
.ed-conflict-headline { font-weight: var(--font-weight-semibold); margin-bottom: 4px; }
.ed-conflict-list { margin: 0; padding-left: 18px; }
.ed-conflict-list li { margin: 2px 0; }

/* SearchableSelect im Dialog (Kunde) */
.ed-customer-mount .ss-root { width: 100%; }
.ed-customer-mount .ss-input {
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--font-size-md);
  font-family: var(--font-family-base);
  width: 100%;
}
.ed-customer-mount .ss-input:focus {
  outline: none;
  border-color: var(--color-brand-primary);
  box-shadow: 0 0 0 3px var(--color-brand-primary-soft);
}

@media (max-width: 600px) {
  .ed-body { grid-template-columns: 1fr; }
  .ed-grid { grid-template-columns: 1fr; }
}
