/* Operator refinement: keep Senjara's paper, sand and forest identity. */
.app { gap: 16px; padding: 16px; }
.sidebar { width: 224px; height: calc(100dvh - 32px); padding: 24px 12px 12px; }
.wordmark { gap: 8px; padding: 0 4px 30px; font-size: 18px; letter-spacing: -.035em; white-space: nowrap; }
.home-external { width: 14px; height: 14px; flex: 0 0 14px; margin-left: auto; opacity: .5; }
.nav { gap: 6px; }
.workspace { display: flex; flex-direction: column; container-type: inline-size; padding: 0 24px 24px; }
.topbar { flex: 0 0 auto; flex-wrap: wrap; gap: 20px; margin: 0 -24px; border-bottom: 0; padding: 26px 24px 16px; background: transparent; }
.topbar h1 { flex-basis: 100%; font-size: var(--type-title); letter-spacing: -.032em; }
.toolbar { width: 100%; flex: 1 1 100%; flex-wrap: nowrap; gap: 8px; }
.date-label { flex: 1; padding: 0 12px 0 0; color: var(--foreground); font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.button { border-color: var(--border); font-weight: 500; }
.arrow { width: 36px; min-width: 36px; padding: 0; }
#today { margin-right: 12px; }
#new-booking { margin-left: 4px; white-space: nowrap; }
.button:disabled { opacity: .5; }
.notice { flex: 0 0 auto; margin: 0 0 16px; }
.notice[data-tone="info"] { min-height: 0; margin: 0 0 16px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--muted-foreground); font-size: 12px; }
.inspector { overflow-x: hidden; }
.detail { width: 100%; min-width: 0; padding: 18px; border: 1px solid var(--border); }
.customer .avatar { display: grid; flex: 0 0 39px; }
.customer > span:last-child { min-width: 0; }
.customer strong, .customer span { overflow-wrap: anywhere; }
.actions button:disabled { opacity: 1; border-color: var(--border); background: var(--paper); color: var(--muted-foreground); text-decoration: none; }

@container (max-width: 720px) {
  .toolbar { flex-wrap: wrap; }
  .date-label { flex-basis: 100%; padding-bottom: 6px; }
  #today { margin-right: auto; }
  #new-booking { margin-left: 0; }
}
.button:active:not(:disabled) { transform: scale(.98); }
@media (max-width: 1200px) {
  .sidebar { width: 200px; }
  .toolbar { flex-wrap: wrap; }
  .date-label { flex-basis: 100%; padding-bottom: 6px; }
  #today { margin-right: auto; }
}
@media (max-width: 860px) {
  .app { display: block; padding: 0; }
  .workspace { display: block; padding: 76px 16px 20px; }
  .topbar { position: relative; display: block; margin: 0 0 16px; padding: 0; }
  .topbar h1 { margin: 0 0 24px; font-size: 22px; line-height: 44px; }
  .toolbar { display: flex; gap: 8px; }
  .date-label { order: -1; flex: 1 0 100%; padding: 0 0 8px; font-size: 17px; }
  #new-booking { position: absolute; top: 0; right: 0; margin: 0; }
  #today { margin-right: auto; }
  .arrow { width: 44px; min-width: 44px; }
  .inspector { border-radius: 0; scroll-margin-top: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .button:active:not(:disabled) { transform: none; }
}

/* Homebase shell: Booking keeps its operator flows, but shares the same surface
   and account affordance as home.senjara.com. */

.app {
  gap: 12px;
  padding: 12px;
}

.sidebar {
  position: relative;
  z-index: 20;
  width: 248px;
  flex-shrink: 0;
  height: calc(100dvh - 24px);
  padding: 18px 0 0;
}

/* Side insets sit on the children (12 px nav, foot via senjara-foot), so the
   rail from @gurkendevteam/design (data-collapsible) can narrow them. */
.sidebar > .wordmark { padding-inline: 22px; }
.sidebar > .nav { padding-inline: 12px; }
.sidebar > .wordmark > span,
.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wordmark {
  min-height: 44px;
  padding: 0 10px 14px;
  font-size: 17px;
  letter-spacing: -.02em;
}

.nav {
  gap: 2px;
  margin-top: 14px;
}

.sidebar-footer {
  padding-top: 10px;
}

.module-link {
  margin-top: 10px;
}

.home-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-item:active {
  transform: scale(.97);
}

@media (hover: hover) and (pointer: fine) {
  .menu-item:hover {
    background: color-mix(in srgb, var(--sand) 55%, transparent);
  }
}

.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  overflow: hidden;
  background: var(--moss);
  color: var(--forest-deep);
  font-size: 14px;
  font-weight: 500;
  user-select: none;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Konto-Zeile und -Menü: Material aus dem Package (senjara-account-*). Hier bleiben nur
   Bild im Avatar, Lage, Einblenden ohne Base UI und der Haken am vorhandenen data-current. */
.senjara-account-avatar {
  overflow: hidden;
}

.senjara-account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

@starting-style {
  .senjara-account-menu {
    opacity: 0;
    transform: scale(.96);
  }
}

.workspace-status {
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 1.3;
}

.senjara-account-row[data-current="true"] > .senjara-account-check {
  opacity: 1;
}

.senjara-account-check svg {
  display: block;
  width: 100%;
  height: 100%;
}

.menu-item {
  min-height: 44px;
  gap: 10px;
  border-radius: var(--radius);
  padding: 0 10px;
  color: var(--forest);
  font-size: 15px;
  transition: background-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}

@media (max-width: 860px) {
  .app { padding: 0; }
  .workspace,
  .inspector { border: 0; border-radius: 0; box-shadow: none; }
  
  
  
}

@media (prefers-reduced-motion: reduce) {
  .menu-item,
  .module-link,
  .senjara-account-menu { transition: opacity 200ms var(--ease-out); }
  .menu-item:active,
  .module-link:active { transform: none; }
  @starting-style { .senjara-account-menu { transform: none; } }
}

/* Einstellungen: eine Gruppe je Thema, jeder Abschnitt links erklärt, rechts bedienbar. */
.settings-panel { max-width: 980px; padding: 12px 0; }
.settings-panel[hidden] { display: none; }
.settings-group { margin: 0; padding: 0 0 14px; border-bottom: 1px solid var(--border); color: var(--foreground); font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.settings-section { display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 560px); gap: 40px; padding: 28px 0; border-bottom: 1px solid var(--border); }
.settings-section-copy h3 { margin: 0; color: var(--foreground); font-size: 16px; font-weight: 650; letter-spacing: -.015em; }
.settings-section-copy p { max-width: 34ch; margin: 8px 0 0; color: var(--muted-foreground); font-size: 13px; line-height: 1.55; }
.timezone-current { margin: 0 0 20px; color: var(--muted-foreground); font-size: 13px; }
.timezone-current strong { display: block; margin-top: 3px; color: var(--foreground); font-size: 17px; font-weight: 600; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.settings-section-body > label { display: block; margin-bottom: 8px; color: var(--foreground); font-size: 13px; font-weight: 650; }
.settings-section-body input[type="search"] { width: 100%; min-height: 46px; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 13px; background: var(--card); color: var(--foreground); font: inherit; font-size: 15px; caret-color: var(--primary); transition: border-color 150ms ease; }
.settings-section-body input[type="search"]:hover:not(:disabled) { border-color: var(--muted-foreground); }
.settings-section-body input[type="search"]:disabled { background: var(--muted); opacity: .8; }
.settings-section-body input::placeholder, .funnel-step input[type="search"]::placeholder { color: var(--muted-foreground); opacity: 1; }
.settings-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }
.settings-actions .create { min-height: 44px; margin-left: 0; padding: 0 18px; }
.settings-actions .form-status { font-size: 13px; }
#timezone-manage-note { margin: 10px 0 0; }

/* Zeitzonen-Liste: senjara-option-list (Package 0.4.0) unter dem Suchfeld. */
#timezone-options { margin-top: 8px; }

/* Hinweis vor dem Speichern: warm getönt, weil er eine Folge ankündigt, keinen Fehler. */
.tz-impact { margin-top: 16px; border: 1px solid color-mix(in srgb, var(--warning) 24%, transparent); border-radius: var(--radius-medium); padding: 14px 16px; background: var(--warning-surface); color: var(--foreground); transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out); }
.tz-impact[hidden] { display: none; }
.tz-impact strong { display: block; font-size: 14px; font-weight: 650; }
.tz-impact p { max-width: 62ch; margin: 6px 0 0; font-size: 13px; line-height: 1.55; }
@starting-style { .tz-impact { opacity: 0; transform: translateY(-4px); } }
.funnel-step .tz-impact { margin-top: 0; }

@media (max-width: 860px) {
  .settings-section { grid-template-columns: 1fr; gap: 18px; padding: 22px 0; }
  .settings-section-copy p { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tz-impact { transition: opacity 180ms ease; }
  @starting-style { .tz-impact { transform: none; } }
}
.settings-section-body input[type="search"]::-webkit-search-cancel-button, .funnel-step input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; background: var(--muted-foreground); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3 3l8 8M11 3l-8 8' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3 3l8 8M11 3l-8 8' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; cursor: pointer; }

/* Kundenansicht → Aussehen: Feldgruppen (Bilder, Farben, Schrift, Texte); Raster und Vorschau in kundenansicht.css. */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.settings-group-next { margin-top: 40px; }
.brand-group { min-width: 0; margin: 0 0 30px; border: 0; padding: 0; }
.brand-group legend { margin-bottom: 10px; padding: 0; color: var(--foreground); font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.brand-help { margin: 0 0 12px; color: var(--muted-foreground); font-size: 12px; line-height: 1.5; }

.brand-image { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.brand-image:last-of-type { border-bottom: 1px solid var(--border); }
.brand-thumb { display: grid; place-items: center; width: 64px; height: 44px; overflow: hidden; border-radius: var(--radius-small); background: var(--muted); }
.brand-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-thumb-header img { width: 100%; height: 100%; object-fit: cover; }
.brand-thumb img[hidden] { display: none; }
.brand-image-copy strong { display: block; color: var(--foreground); font-size: 14px; font-weight: 600; }
.brand-image-copy small { display: block; margin-top: 2px; color: var(--muted-foreground); font-size: 12px; }
.brand-file { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.brand-file:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }
.brand-file:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.brand-image .button[hidden] { display: none; }

.brand-color { display: grid; grid-template-columns: 40px minmax(0, 1fr) 112px; align-items: center; gap: 4px 12px; padding: 7px 0; }
.brand-color input[type="color"] { width: 40px; height: 40px; border: 1px solid var(--border); border-radius: var(--radius-small); padding: 0; background: none; cursor: pointer; }
.brand-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.brand-color input[type="color"]::-webkit-color-swatch { border: 0; border-radius: var(--radius-small); }
.brand-color input[type="color"]::-moz-color-swatch { border: 0; border-radius: var(--radius-small); }
.brand-color label span { display: block; color: var(--foreground); font-size: 14px; font-weight: 600; }
.brand-color label small { display: block; color: var(--muted-foreground); font-size: 12px; }
.brand-hex, .brand-text input, .brand-text textarea { width: 100%; min-height: 42px; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 12px; background: var(--card); color: var(--foreground); font: inherit; font-size: 15px; transition: border-color 150ms ease; }
.brand-hex { font-size: 14px; font-variant-numeric: tabular-nums; }
.brand-text textarea { min-height: 84px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.brand-hex:hover:not(:disabled), .brand-text input:hover:not(:disabled), .brand-text textarea:hover:not(:disabled) { border-color: var(--muted-foreground); }
.brand-hex:disabled, .brand-text input:disabled, .brand-text textarea:disabled { background: var(--muted); opacity: .8; }
.brand-hex[aria-invalid="true"], .brand-text input[aria-invalid="true"] { border-color: var(--danger); }
.brand-field-error { grid-column: 2 / -1; color: var(--danger); font-size: 12px; }
.brand-field-error[hidden] { display: none; }

.brand-fonts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.brand-font { position: relative; display: block; border: 1px solid var(--border); border-radius: var(--radius-medium); padding: 12px 13px; background: var(--card); cursor: pointer; transition: border-color 150ms ease, background-color 150ms ease; }
.brand-font input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.brand-font strong { display: block; color: var(--foreground); font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.brand-font small { display: block; margin-top: 3px; color: var(--muted-foreground); font-size: 12px; line-height: 1.4; }
.brand-font-system strong { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.brand-font-serif strong { font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; }
.brand-font:has(input:checked) { border-color: var(--primary); background: var(--secondary); }
.brand-font:has(input:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; }
.brand-font:has(input:disabled) { opacity: .6; cursor: not-allowed; }
@media (hover: hover) { .brand-font:hover:not(:has(input:checked)):not(:has(input:disabled)) { border-color: var(--muted-foreground); } }

.brand-texts { display: grid; gap: 14px; }
.brand-text { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 6px 10px; }
.brand-group > .brand-text + .brand-text { margin-top: 14px; }
.brand-text label { grid-column: 1; grid-row: 1; color: var(--foreground); font-size: 13px; font-weight: 600; }
.brand-text .brand-reset { grid-column: 2; grid-row: 1; }
.brand-text input, .brand-text textarea { grid-column: 1 / -1; grid-row: 2; }
.brand-text .brand-field-error { grid-column: 1 / -1; grid-row: 3; }
.brand-reset { border: 0; border-radius: var(--radius-small); padding: 2px 6px; background: none; color: var(--muted-foreground); font: inherit; font-size: 12px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.brand-reset[hidden] { display: none; }
.brand-reset:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
@media (hover: hover) { .brand-reset:hover { color: var(--foreground); } }

@media (max-width: 520px) {
  .brand-fonts { grid-template-columns: 1fr; }
  .brand-image { grid-template-columns: 56px minmax(0, 1fr); }
  .brand-image .button { justify-self: start; }
  .brand-color { grid-template-columns: 40px minmax(0, 1fr) 96px; }
}

/* Einstellungen → E-Mail: Zeilen statt Karten, Zustand als kleine Pille, Protokoll als Tabelle. */
.mail-settings[hidden], .mail-read-note[hidden] { display: none; }
.mail-read-note { margin: 18px 0 0; font-size: 13px; }
.mail-routes { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.mail-route { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 16px; min-height: 64px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.mail-route-copy { display: grid; gap: 3px; min-width: 0; }
.mail-route-copy strong { color: var(--foreground); font-size: 14px; font-weight: 650; }
.mail-route-copy span { color: var(--muted-foreground); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.mail-route-end .google-oauth-note { max-width: 30ch; color: var(--muted-foreground); font-size: 12px; line-height: 1.45; text-align: right; }
.google-oauth-note a { color: inherit; text-underline-offset: 2px; }
.mail-route[data-state="unavailable"] .mail-route-copy strong { color: var(--muted-foreground); }
.mail-route-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.mail-route-end .button { min-height: 36px; border-radius: var(--radius); }
.mail-pill { display: inline-flex; align-items: center; min-height: 24px; border-radius: var(--radius-pill); padding: 0 10px; background: var(--muted); color: var(--muted-foreground); font-size: 12px; font-weight: 650; white-space: nowrap; }
.mail-pill[data-state="connected"], .mail-pill[data-state="active"], .mail-pill[data-state="sent"] { background: var(--success-surface); color: var(--forest); }
.mail-pill[data-state="broken"], .mail-pill[data-state="failed"] { background: var(--danger-surface); color: var(--danger); }
.mail-pill[data-state="unavailable"], .mail-pill[data-state="idle"] { background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.mail-alert { margin: 0 0 16px; border: 1px solid color-mix(in srgb, var(--warning) 24%, transparent); border-radius: var(--radius-medium); padding: 12px 14px; background: var(--warning-surface); color: var(--foreground); font-size: 13px; line-height: 1.55; transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out); }
.mail-alert[data-tone="error"] { border-color: color-mix(in srgb, var(--danger) 24%, transparent); background: var(--danger-surface); }
.mail-alert[hidden] { display: none; }
@starting-style { .mail-alert { opacity: 0; transform: translateY(-4px); } }
.mail-smtp { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px 12px; margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius-medium); padding: 18px; background: var(--background); }
.mail-smtp[hidden] { display: none; }
.mail-smtp h4 { grid-column: 1 / -1; margin: 0; color: var(--foreground); font-size: 14px; font-weight: 650; }
.mail-field { display: grid; align-content: start; gap: 6px; grid-column: span 3; min-width: 0; margin: 0; border: 0; padding: 0; }
.mail-field-wide { grid-column: span 4; }
.mail-field-wide + .mail-field { grid-column: span 2; }
.mail-tls { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; }
.mail-tls legend { width: 100%; margin-bottom: 6px; padding: 0; }
.mail-field label:where(:not(.senjara-filter-segments > label)), .mail-field legend, .mail-log-section .settings-section-body > label, #mail-contact-form .settings-section-body > label, #mail-test-form .settings-section-body > label { color: var(--foreground); font-size: 13px; font-weight: 600; }
.mail-field label span { color: var(--muted-foreground); font-weight: 400; }
.mail-tls label { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; font-weight: 500; }
.mail-tls input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.mail-field small { color: var(--muted-foreground); font-size: 12px; }
.mail-field small[hidden] { display: none; }
.mail-field input:not([type="radio"]), .mail-field select, .mail-input { width: 100%; min-height: 42px; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 12px; background: var(--card); color: var(--foreground); font: inherit; font-size: 15px; caret-color: var(--primary); transition: border-color 150ms ease; }
.mail-field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%234b6054' stroke-width='1.5'/%3E%3C/svg%3E"); background-position: right 12px center; background-repeat: no-repeat; background-size: 14px; padding-right: 34px; }
.mail-field input:hover:not(:disabled), .mail-field select:hover:not(:disabled), .mail-input:hover:not(:disabled) { border-color: var(--muted-foreground); }
.mail-field input:disabled, .mail-field select:disabled, .mail-input:disabled { background-color: var(--muted); opacity: .8; }
.mail-input[aria-invalid="true"] { border-color: var(--danger); }
.mail-input::placeholder, .mail-field input::placeholder { color: var(--muted-foreground); opacity: 1; }
.mail-form-error { grid-column: 1 / -1; margin: 0; }
.mail-smtp .settings-actions { grid-column: 1 / -1; margin-top: 4px; }
#mail-contact-form .settings-section-body > label, #mail-test-form .settings-section-body > label { display: block; margin-bottom: 8px; }
#mail-contact-error, #mail-test-error { display: block; margin-top: 6px; }
#mail-contact-error[hidden], #mail-test-error[hidden] { display: none; }
.settings-actions .form-status[data-tone="error"], .mail-log-toolbar .form-status[data-tone="error"], #mail-routes-status[data-tone="error"] { color: var(--danger); }
#mail-routes-status { margin: 12px 0 0; font-size: 13px; }
#mail-routes-status:empty { display: none; }
.notification-settings { scroll-margin-top: 72px; }
.notification-sender, .notification-help, .notification-field small { margin: 0; color: var(--muted-foreground); font-size: 13px; line-height: 1.55; }
.notification-sender { margin-bottom: 18px; color: var(--foreground); }
.notification-field { min-width: 0; margin: 0; border: 0; padding: 0; }
.notification-field + .notification-field { margin-top: 20px; }
.notification-field legend, .notification-field > label { display: block; margin-bottom: 8px; color: var(--foreground); font-size: 13px; font-weight: 600; }
.notification-members { display: grid; margin: 12px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.notification-members > li { min-height: 56px; border-bottom: 1px solid var(--border); color: var(--muted-foreground); font-size: 13px; }
.notification-members label { display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 10px; align-items: center; min-height: 56px; cursor: pointer; }
.notification-members input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.notification-members strong, .notification-members small { display: block; min-width: 0; overflow-wrap: anywhere; }
.notification-members strong { color: var(--foreground); font-size: 14px; font-weight: 650; }
.notification-members small { grid-column: 2; margin-top: -15px; }
.notification-field textarea { width: 100%; min-height: 94px; resize: vertical; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--card); color: var(--foreground); font: inherit; font-size: 15px; line-height: 1.5; caret-color: var(--primary); transition: border-color 150ms ease; }
.notification-field textarea:hover:not(:disabled) { border-color: var(--muted-foreground); }
.notification-field textarea:disabled { background: var(--muted); opacity: .8; }
.notification-field textarea[aria-invalid="true"] { border-color: var(--danger); }
.notification-field textarea::placeholder { color: var(--muted-foreground); opacity: 1; }
.notification-opt-out { margin: 18px 0 0; color: var(--muted-foreground); font-size: 13px; line-height: 1.55; }
#booking-notification-error { display: block; margin-top: 7px; }
#booking-notification-error[hidden] { display: none; }
@media (max-width: 640px) {
  .mail-route { grid-template-columns: 1fr; }
  .mail-route-end { justify-content: flex-start; }
  .mail-smtp { grid-template-columns: 1fr; padding: 16px; }
  .mail-field, .mail-field-wide, .mail-field-wide + .mail-field { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  .mail-alert { transition: opacity 180ms ease; }
  .notification-settings { scroll-margin-top: 64px; }
  @starting-style { .mail-alert { transform: none; } }
}

/* Einstellungen → E-Mail-Vorlagen: Fälle als Zeilengruppen, Baukasten links, Vorschau rechts. */
.tpl-settings[hidden], .tpl-editor[hidden], .tpl-palette[hidden], .tpl-field[hidden], .tpl-delete[hidden], #tpl-save[hidden], #tpl-offset-field[hidden] { display: none; }
.tpl-list-section { grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); }
.tpl-cases { display: grid; gap: 26px; }
.tpl-case-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-bottom: 10px; }
.tpl-case-copy h4 { margin: 0; color: var(--foreground); font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.tpl-case-copy span { display: block; margin-top: 2px; color: var(--muted-foreground); font-size: 12px; }
.tpl-case-head .button, .tpl-row .button { min-height: 34px; border-radius: var(--radius); white-space: nowrap; }
.tpl-rows { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.tpl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px 14px; min-height: 56px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.tpl-row-copy { min-width: 0; }
.tpl-row-copy strong { display: block; color: var(--foreground); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.tpl-row-copy span { display: block; margin-top: 2px; color: var(--muted-foreground); font-size: 12px; }
.tpl-row[data-template="builtin"] .tpl-row-copy strong { color: var(--muted-foreground); font-weight: 500; }
#tpl-list-status:empty { display: none; }

.tpl-editor { padding: 30px 0 0; scroll-margin-top: 16px; }
.tpl-editor-head h3 { margin: 0; color: var(--foreground); font-size: 18px; font-weight: 650; letter-spacing: -.02em; overflow-wrap: anywhere; }
.tpl-editor-head p { margin: 4px 0 0; color: var(--muted-foreground); font-size: 13px; }
.tpl-meta { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px 12px; margin: 20px 0 18px; }
.tpl-meta .mail-field { grid-column: span 3; }
.tpl-meta .tpl-meta-name { grid-column: span 2; }
.tpl-meta .tpl-meta-subject { grid-column: span 4; }
.tpl-meta .mail-field > span { color: var(--foreground); font-size: 13px; font-weight: 600; }
.tpl-active { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 10px; min-height: 36px; color: var(--foreground); font-size: 14px; cursor: pointer; }
.tpl-active input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.tpl-alert { margin: 0 0 16px; }
.tpl-alert strong { font-weight: 650; }

.tpl-workbench { display: grid; grid-template-columns: minmax(0, 1fr) 422px; gap: 28px; align-items: start; }
.tpl-palette { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tpl-add { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 0 12px 0 9px; background: var(--background); color: var(--foreground); font: inherit; font-size: 13px; cursor: pointer; transition: border-color 150ms ease, background-color 150ms ease, transform 160ms var(--ease-out); }
.tpl-add:active { transform: scale(.97); }
.tpl-add .tpl-icon { width: 14px; height: 14px; color: var(--muted-foreground); }
.tpl-icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tpl-blocks { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tpl-block { position: relative; border: 1px solid var(--border); border-radius: var(--radius-medium); padding: 8px 10px 14px; background: var(--card); transition: border-color 150ms ease, opacity 150ms ease; }
.tpl-block:focus-within { border-color: var(--muted-foreground); }
.tpl-block[data-dragging="true"] { opacity: .45; }
.tpl-block[data-drop]::before { content: ""; position: absolute; left: 10px; right: 10px; height: 2px; border-radius: 2px; background: var(--primary); }
.tpl-block[data-drop="before"]::before { top: -6px; }
.tpl-block[data-drop="after"]::before { bottom: -6px; }
.tpl-block-head { display: flex; align-items: center; gap: 6px; min-height: 32px; }
.tpl-grip { display: grid; place-items: center; width: 24px; height: 32px; color: var(--muted-foreground); cursor: grab; touch-action: none; }
.tpl-grip .tpl-icon { stroke-width: 2.6; }
.tpl-block-head strong { flex: 1; min-width: 0; color: var(--foreground); font-size: 13px; font-weight: 650; }
.tpl-block-tools { display: flex; gap: 2px; }
.tpl-icon-button { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: var(--radius-small); padding: 0; background: transparent; color: var(--muted-foreground); cursor: pointer; transition: background-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out); }
.tpl-icon-button:active:not(:disabled) { transform: scale(.94); }
.tpl-icon-button:disabled { opacity: .3; cursor: default; }
.tpl-icon-button:focus-visible, .tpl-add:focus-visible, .tpl-chip:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.tpl-block-body { display: grid; gap: 10px; padding: 2px 4px 0 30px; }
.tpl-block-note { margin: 0; color: var(--muted-foreground); font-size: 12px; line-height: 1.5; }
.tpl-field { display: grid; gap: 5px; min-width: 0; }
.tpl-field > span { color: var(--muted-foreground); font-size: 12px; font-weight: 600; }
.tpl-field input, .tpl-field textarea, .tpl-field select { width: 100%; min-height: 40px; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 12px; background: var(--card); color: var(--foreground); font: inherit; font-size: 14px; caret-color: var(--primary); transition: border-color 150ms ease; }
.tpl-field textarea { min-height: 84px; padding: 9px 12px; line-height: 1.55; resize: vertical; }
.tpl-field input:disabled, .tpl-field textarea:disabled, .tpl-field select:disabled { background: var(--muted); opacity: .8; }
.tpl-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tpl-column { display: grid; align-content: start; gap: 10px; min-width: 0; }
.tpl-image { display: grid; grid-template-columns: 64px auto; align-items: center; justify-content: start; gap: 10px 12px; }
.tpl-image .tpl-field { grid-column: 1 / -1; }
.tpl-image-empty { color: var(--muted-foreground); font-size: 11px; }
.tpl-placeholders { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 8px; }
.tpl-placeholders summary { display: flex; align-items: center; min-height: 36px; color: var(--foreground); font-size: 13px; font-weight: 600; cursor: pointer; }
.tpl-placeholders p { margin: 2px 0 10px; color: var(--muted-foreground); font-size: 12px; }
#tpl-placeholder-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; margin: 0; padding: 0; list-style: none; }
#tpl-placeholder-list li { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted-foreground); font-size: 12px; }
.tpl-chip { flex: none; border: 1px solid var(--border); border-radius: var(--radius-small); padding: 3px 7px; background: var(--background); color: var(--foreground); font: 12px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; cursor: pointer; transition: border-color 150ms ease; }
@media (hover: hover) and (pointer: fine) {
  .tpl-add:hover { border-color: var(--muted-foreground); background: var(--card); }
  .tpl-icon-button:hover:not(:disabled) { background: var(--secondary); color: var(--foreground); }
  .tpl-icon-button[data-action="remove"]:hover:not(:disabled) { background: var(--danger-surface); color: var(--danger); }
  .tpl-chip:hover { border-color: var(--muted-foreground); }
  .tpl-field input:hover:not(:disabled), .tpl-field textarea:hover:not(:disabled), .tpl-field select:hover:not(:disabled) { border-color: var(--muted-foreground); }
  .tpl-block:hover .tpl-grip { color: var(--foreground); }
}

.tpl-preview { position: sticky; top: 20px; min-width: 0; }
.tpl-preview-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.tpl-preview-bar strong { color: var(--foreground); font-size: 13px; font-weight: 650; }
.tpl-preview-subject { margin: 0 0 8px; color: var(--foreground); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.tpl-preview-subject:empty { display: none; }
.tpl-preview-frame { overflow: hidden; margin-inline: auto; border: 1px solid var(--border); border-radius: var(--radius-medium); background: #fff; box-shadow: 0 1px 2px color-mix(in srgb, var(--forest-deep) 6%, transparent), 0 14px 32px -16px color-mix(in srgb, var(--forest-deep) 28%, transparent); }
.tpl-preview-frame iframe { display: block; border: 0; transform-origin: 0 0; }
.tpl-preview-frame[data-view="desktop"] { width: 420px; height: 588px; }
.tpl-preview-frame[data-view="desktop"] iframe { width: 600px; height: 840px; transform: scale(.7); }
.tpl-preview-frame[data-view="mobile"] { width: 300px; height: 588px; border-radius: 28px; }
.tpl-preview-frame[data-view="mobile"] iframe { width: 375px; height: 735px; transform: scale(.8); }
.tpl-preview-status { margin: 8px 0 0; font-size: 12px; }
.tpl-preview-status[data-tone="error"], #tpl-status[data-tone="error"], #tpl-list-status[data-tone="error"] { color: var(--danger); }

.tpl-actions { position: sticky; bottom: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 24px; padding: 12px 0; border-top: 1px solid var(--border); background: var(--paper); }
.tpl-actions .create { min-height: 42px; padding: 0 18px; }
.tpl-actions > .button { min-height: 42px; border-radius: var(--radius); }
.tpl-test { display: inline-flex; align-items: center; gap: 8px; }
.tpl-test .mail-input { width: 220px; min-height: 42px; }
.tpl-test .button { min-height: 42px; border-radius: var(--radius); white-space: nowrap; }
.tpl-actions .tpl-delete { margin-left: auto; color: var(--danger); }
#tpl-status { flex-basis: 100%; font-size: 13px; }
#tpl-status:empty { display: none; }
@media (min-width: 861px) { .tpl-actions { bottom: -32px; padding-bottom: 44px; } }
@media (max-width: 1240px) {
  .tpl-workbench { grid-template-columns: minmax(0, 1fr); }
  .tpl-preview { position: static; }
  .tpl-preview-frame[data-view="desktop"] { width: 100%; height: 640px; }
  .tpl-preview-frame[data-view="desktop"] iframe { width: 100%; height: 100%; transform: none; }
  .tpl-preview-frame[data-view="mobile"] { width: min(375px, 100%); height: 667px; }
  .tpl-preview-frame[data-view="mobile"] iframe { width: 100%; height: 100%; transform: none; }
}
@media (max-width: 860px) { .tpl-list-section { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .tpl-meta { grid-template-columns: 1fr; }
  .tpl-meta .mail-field, .tpl-meta .tpl-meta-name, .tpl-meta .tpl-meta-subject { grid-column: 1 / -1; }
  .tpl-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tpl-row > .button { grid-column: 1 / -1; justify-self: start; }
  .tpl-case-head { align-items: flex-start; flex-direction: column; }
  .tpl-block-body { padding-left: 0; }
  .tpl-columns { grid-template-columns: 1fr; }
  .tpl-test { flex-wrap: wrap; width: 100%; }
  .tpl-test .mail-input { flex: 1; width: auto; min-width: 0; }
  .tpl-actions { position: static; }
  .tpl-actions .tpl-delete { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tpl-add, .tpl-icon-button { transition: background-color 150ms ease, color 150ms ease; }
  .tpl-add:active, .tpl-icon-button:active:not(:disabled) { transform: none; }
}

/* Einstellungen → Preise.  Regeln als Zeilen wie die Vorlagen, Editor auf Papier wie das SMTP-Formular. */
.price-settings[hidden], .price-editor[hidden], .price-add[hidden], #price-save[hidden], #price-delete[hidden], #price-settings-save[hidden], .price-editor [hidden] { display: none; }
.price-rules { margin-bottom: 14px; }
.price-rule { grid-template-columns: minmax(0, 1fr) auto auto; }
.price-rule .price-rule-summary { color: var(--foreground); font-size: 13px; font-variant-numeric: tabular-nums; }
.price-empty { display: grid; gap: 2px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.price-empty strong { color: var(--foreground); font-size: 14px; font-weight: 600; }
.price-empty span, .price-empty-line { color: var(--muted-foreground); font-size: 13px; line-height: 1.5; }
.price-editor { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px 12px; margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius-medium); padding: 18px; background: var(--background); scroll-margin-top: 16px; }
.price-editor h4 { grid-column: 1 / -1; margin: 0; color: var(--foreground); font-size: 15px; font-weight: 650; letter-spacing: -.01em; overflow-wrap: anywhere; }
.price-editor .price-wide, .price-settings-body .price-wide { grid-column: 1 / -1; }
.price-editor .settings-actions { margin-top: 2px; }
.price-editor legend { margin-bottom: 6px; padding: 0; }
.price-choice { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.price-choice legend { width: 100%; }
.price-choice label, .price-service { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; color: var(--foreground); font-size: 14px; cursor: pointer; }
.price-choice input, .price-service input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.price-amount-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.price-amount-input { position: relative; display: inline-flex; align-items: center; }
.price-amount-input input { width: 140px; min-height: 42px; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 34px 0 12px; background: var(--card); color: var(--foreground); font: inherit; font-size: 15px; font-variant-numeric: tabular-nums; text-align: right; caret-color: var(--primary); transition: border-color 150ms ease; }
.price-amount-input input:hover:not(:disabled) { border-color: var(--muted-foreground); }
.price-amount-input input:disabled { background: var(--muted); opacity: .8; }
.price-amount-input input[aria-invalid="true"] { border-color: var(--danger); }
.price-amount-input input::placeholder { color: var(--muted-foreground); opacity: 1; text-align: left; }
.price-amount-input > span { position: absolute; right: 12px; color: var(--muted-foreground); font-size: 14px; pointer-events: none; }
.price-cap-input input { width: 96px; }
.price-hint { color: var(--muted-foreground); font-size: 12px; margin-top: -8px; }
.price-service-field .tpl-active { min-height: 32px; }
.price-services { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2px 16px; margin-top: 4px; padding-left: 28px; }
.price-service { display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 8px; }
.price-service small { grid-column: 2; margin-top: -4px; color: var(--muted-foreground); font-size: 12px; font-variant-numeric: tabular-nums; }
.price-settings-body { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px 12px; }
.price-settings-body .mail-field:first-child { grid-column: 1 / -1; }
.price-days-block h4 { margin: 4px 0 8px; color: var(--foreground); font-size: 13px; font-weight: 650; }
.price-custom, .price-holidays { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.price-custom li, .price-holidays li { display: grid; grid-template-columns: 7.5em minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 40px; padding: 6px 0; border-bottom: 1px solid var(--border); color: var(--foreground); font-size: 14px; }
.price-custom:empty { display: none; }
.price-holidays li.price-empty-line { display: block; }
.price-date { color: var(--muted-foreground); font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-custom-remove { min-height: 32px; border-radius: var(--radius); font-size: 13px; }
.price-custom-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.price-custom-add .mail-input[type="date"] { flex: 0 0 170px; width: 170px; }
.price-custom-add .mail-input:not([type="date"]) { flex: 1 1 180px; width: auto; }
/* Aufschlüsselung eines Preises: Kalender-Detail und Leistungen. */
.price-breakdown { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; margin: 10px 0 0; font-size: 13px; }
.price-breakdown dt { min-width: 0; color: var(--foreground); overflow-wrap: anywhere; }
.price-breakdown dt small { display: block; color: var(--muted-foreground); font-size: 12px; }
.price-breakdown dd { margin: 0; color: var(--foreground); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.price-breakdown dd[data-kind="discount"], .price-breakdown dd[data-kind="cap"] { color: var(--muted-foreground); }
.price-breakdown [data-kind="total"] { margin-top: 4px; border-top: 1px solid var(--border); padding-top: 8px; font-weight: 650; }
.booking-price-field #booking-price { font-variant-numeric: tabular-nums; }
.price-settings .form-status[data-tone="error"] { color: var(--danger); }
@media (max-width: 860px) {
  .price-editor, .price-settings-body { grid-template-columns: 1fr; padding: 16px; }
  .price-settings-body { padding: 0; }
  .price-editor .mail-field, .price-settings-body .mail-field { grid-column: 1 / -1; }
  .price-rule { grid-template-columns: minmax(0, 1fr) auto; }
  .price-rule > .button { grid-column: 1 / -1; justify-self: start; }
  .price-services { grid-template-columns: 1fr; padding-left: 0; }
  .price-custom li, .price-holidays li { grid-template-columns: 6.5em minmax(0, 1fr) auto; }
  .price-custom-add .mail-input[type="date"] { flex: 1 1 100%; width: 100%; }
}
/* Die allgemeinen Feldregeln (.mail-field input, .settings-section-body > label) dürfen Checkboxen, Einheit und Deckelfeld nicht überschreiben. */
.mail-field input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; border: 0; }
.mail-field .price-amount-input input { padding-right: 34px; }
.price-settings-body > .mail-field { display: grid; margin: 0; font-weight: 400; }
.mail-field .price-amount-input { justify-self: start; }
.mail-field .price-cap-input input { width: 96px; }
.mail-field .price-amount-input input { width: 140px; }
.mail-field .price-cap-input input { width: 96px; }
.price-breakdown { column-gap: 0; }
.price-breakdown dd { padding-left: 12px; }

/* Einstellungen → Zusatzleistungen.  Zeilen wie die Preisregeln, mit Vorschaubild und einer kleinen Auswertung. */
.upsell-settings[hidden], .upsell-editor [hidden], #upsell-save[hidden], #upsell-delete[hidden], .upsell-capacity[hidden] { display: none; }
.upsell-list { margin-bottom: 14px; }
.upsell-row { grid-template-columns: 44px minmax(0, 1fr) auto; align-items: start; row-gap: 6px; }
.upsell-row > .upsell-thumb { grid-row: 1 / span 2; }
.upsell-row > .upsell-stats { grid-column: 2; grid-row: 2; }
.upsell-row > .upsell-row-end { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
.upsell-row .upsell-summary { color: var(--foreground); font-size: 13px; font-variant-numeric: tabular-nums; }
.upsell-row .upsell-quota-used { font-variant-numeric: tabular-nums; }
.upsell-row-end { display: flex; align-items: center; gap: 10px; }
.upsell-thumb { display: grid; place-items: center; width: 44px; height: 44px; overflow: hidden; border-radius: var(--radius-small); background: var(--muted); box-shadow: inset 0 0 0 1px var(--border); color: var(--foreground); font-size: 16px; font-weight: 650; }
.upsell-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.upsell-thumb[data-empty="true"] { background: var(--sand); box-shadow: none; }
.upsell-stats { display: grid; grid-template-columns: repeat(2, auto auto minmax(auto, max-content)); justify-content: start; align-items: baseline; gap: 2px 8px; margin: 0; font-size: 12px; }
.upsell-stats dt:nth-of-type(2) { margin-left: 14px; padding-left: 14px; border-left: 1px solid var(--border); }
.upsell-stats dt { color: var(--muted-foreground); white-space: nowrap; }
.upsell-stats dd { display: contents; }
.upsell-stat-count, .upsell-stat-sum { color: var(--foreground); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.upsell-stat-sum { font-weight: 600; }
.upsell-editor textarea { width: 100%; min-height: 64px; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--card); color: var(--foreground); font: inherit; font-size: 15px; line-height: 1.5; resize: vertical; caret-color: var(--primary); transition: border-color 150ms ease; }
.upsell-editor textarea:hover:not(:disabled) { border-color: var(--muted-foreground); }
.upsell-editor textarea:disabled { background: var(--muted); opacity: .8; }
.upsell-editor .mail-field .price-amount-input input#upsell-max { width: 120px; padding-right: 54px; }
.upsell-editor .mail-field .price-amount-input input#upsell-capacity { width: 140px; padding-right: 54px; }
/* Vier Segmente passen auf dem Handy nicht in eine Pille: zwei Spalten statt Umbruch. */
@media (max-width: 640px) {
  #upsell-editor .upsell-scope { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: var(--radius-large); }
}
.upsell-capacity { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 10px; transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out); }
@starting-style { .upsell-capacity { opacity: 0; transform: translateY(-4px); } }
.upsell-capacity small { flex: 1 1 220px; }
.upsell-image-row { display: flex; align-items: center; gap: 14px; }
.upsell-image-row .upsell-thumb { width: 64px; height: 64px; border-radius: var(--radius-small); }
.upsell-image-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.upsell-image-actions .button { min-height: 36px; border-radius: var(--radius); }
.upsell-image-actions small { flex-basis: 100%; }
.upsell-settings .form-status[data-tone="error"] { color: var(--danger); }
@media (max-width: 860px) {
  .upsell-row { grid-template-columns: 44px minmax(0, 1fr); }
  .upsell-row > .upsell-thumb { grid-row: 1; }
  .upsell-row > .upsell-row-end { grid-column: 2; grid-row: 3; justify-content: space-between; }
  .upsell-stats { grid-template-columns: auto auto 1fr; justify-content: stretch; }
  .upsell-stats dt:nth-of-type(2) { margin-left: 0; padding-left: 0; border-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .upsell-capacity { transition: opacity 180ms ease; } @starting-style { .upsell-capacity { transform: none; } } }

/* Buchungsformular je Leistung (§4): Dialog mit Standardfeldern als Schalterzeilen und eigenen Feldern als aufklappbare Zeilen. */
.form-dialog { width: min(680px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); }
.form-editor { gap: 20px; }
.form-block h3 { margin: 0 0 8px; color: var(--foreground); font-size: 14px; font-weight: 650; }
.form-rows { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.form-dialog header p { color: var(--muted-foreground); }
/* Eigene Felder: die Werkzeuge liegen über der Zusammenfassung, das aufgeklappte Feld nutzt die ganze Breite. */
.form-field-row > .form-field-details { grid-column: 1 / -1; grid-row: 1; }
.form-field-row > .tpl-block-tools { grid-column: 2; grid-row: 1; }
.form-field-details summary { padding-right: 112px; }
.form-row-standard { align-items: center; min-height: 56px; }
.booking-form .form-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; cursor: pointer; }
.booking-form .form-switch input { appearance: none; position: relative; width: 36px; min-height: 0; height: 22px; margin: 0; border: 0; border-radius: var(--radius-pill); padding: 0; background: var(--muted); cursor: pointer; transition: background-color 160ms ease; }
.booking-form .form-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px color-mix(in srgb, var(--forest-deep) 24%, transparent); transition: transform 180ms var(--ease-out); }
.booking-form .form-switch input:checked { background: var(--primary); }
.booking-form .form-switch input:checked::after { transform: translateX(14px); }
.booking-form .form-switch input:disabled { opacity: .55; cursor: default; }
.booking-form .form-switch input:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.form-field-details { min-width: 0; }
.form-field-details summary { display: flex; align-items: center; min-height: 36px; border-radius: var(--radius-small); cursor: pointer; list-style: none; }
.form-field-details summary::-webkit-details-marker { display: none; }
.form-field-details summary::before { content: ""; flex: none; width: 7px; height: 7px; margin: 0 12px 0 4px; border-right: 1.6px solid var(--muted-foreground); border-bottom: 1.6px solid var(--muted-foreground); transform: rotate(-45deg); transition: transform 160ms var(--ease-out); }
.form-field-details[open] summary::before { transform: rotate(45deg); }
.form-field-details summary:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.form-field-details .tpl-row-copy span { font-variant-numeric: tabular-nums; }
.form-field-body { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px 12px; margin: 10px 0 4px 23px; border: 1px solid var(--border); border-radius: var(--radius-medium); padding: 16px; background: var(--background); }
.form-field-body .price-wide { grid-column: 1 / -1; }
.form-field-body .mail-field > span { color: var(--foreground); font-size: 13px; font-weight: 600; }
.booking-form .form-field-body small { color: var(--muted-foreground); font-size: 12px; font-weight: 400; line-height: 1.45; }
.booking-form .form-field-body input:not([type="checkbox"]), .booking-form .form-field-body select, .form-field-body textarea { min-height: 40px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); font-size: 14px; }
.form-field-body textarea { width: 100%; padding: 9px 12px; color: var(--foreground); font: inherit; font-size: 14px; resize: vertical; }
.booking-form .form-field-body input[readonly] { border-style: dashed; background: transparent; color: var(--muted-foreground); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.booking-form .form-field-body .tpl-active { display: inline-flex; font-weight: 500; }
.booking-form .form-field-body .tpl-active input { width: 16px; min-height: 0; height: 16px; margin: 0; accent-color: var(--primary); }
.form-row .tpl-block-tools { padding-top: 2px; }
.form-row .tpl-icon-button[data-action="remove"]:hover:not(:disabled) { color: var(--danger); }
#form-add .tpl-add { margin-top: 12px; }
#form-add[hidden], #form-save[hidden] { display: none; }
#form-status:empty, #form-error[hidden] { display: none; }
#form-status { margin: 0; font-size: 13px; }
#form-status[data-tone="error"] { color: var(--danger); }
@starting-style { .form-field-details[open] .form-field-body { opacity: 0; transform: translateY(-4px); } }
.form-field-body { transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out); }
@media (max-width: 640px) {
  .form-field-body { grid-template-columns: minmax(0, 1fr); margin-left: 0; }
  .form-field-body .mail-field { grid-column: 1 / -1; }
}

/* Formularfelder einer Leistung in Blättern (Neuer Termin, #102): Kontakt und eigene Felder. */
.booking-form .field-label { display: flex; align-items: baseline; gap: 8px; }
.booking-form .field-help { color: var(--muted-foreground); font-size: 12px; font-weight: 400; }
.booking-form .field-error { color: var(--danger); font-size: 12px; font-weight: 600; }
.booking-form .field-error[hidden] { display: none; }
.booking-form [data-invalid="true"] input:not([type="checkbox"]), .booking-form [data-invalid="true"] select { border-color: var(--danger); }
.booking-form .field-choice { display: grid; gap: 4px; margin: 0; border: 0; padding: 0; }
.booking-form .field-choice legend { margin-bottom: 6px; padding: 0; font-size: 13px; font-weight: 700; }
.booking-form .field-check, .booking-form .field-consent { display: flex; align-items: center; gap: 10px; min-height: 32px; font-weight: 500; }
.booking-form .field-consent { flex-wrap: wrap; }
.booking-form .field-consent > small { flex-basis: 100%; padding-left: 26px; }
.booking-form .field-check input, .booking-form .field-consent input { width: 16px; min-height: 0; height: 16px; margin: 0; accent-color: var(--primary); }

/* Einstellungen → Einbettung: Widgets wie die Preisregeln, darunter Generator mit Code und Vorschau. */
.widget-settings[hidden], .widget-editor [hidden], #widget-save[hidden], #widget-delete[hidden] { display: none; }
.widget-row { grid-template-columns: minmax(0, 1fr) auto; }
.widget-editor textarea { width: 100%; min-height: 84px; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--card); color: var(--foreground); font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; transition: border-color 150ms ease; }
.widget-editor textarea[aria-invalid="true"] { border-color: var(--danger); }
.widget-editor textarea:disabled { background: var(--muted); }
.mail-field .widget-origins-hint { color: var(--primary); }
.widget-services .price-service { flex-wrap: wrap; }
.widget-services .price-service small { flex-basis: 100%; padding-left: 26px; }
.widget-generator { display: grid; gap: 10px; margin-top: 4px; border-top: 1px solid var(--border); padding-top: 18px; }
.widget-generator-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.widget-generator-head h4 { margin: 0; color: var(--foreground); font-size: 14px; font-weight: 650; }
.widget-kind-hint { margin: 0; color: var(--muted-foreground); font-size: 13px; line-height: 1.5; }
.widget-code { margin: 0; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-medium); padding: 12px 14px; background: var(--forest-deep); color: var(--paper); font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.widget-code:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.widget-copy-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 12px; }
.widget-copy-row .create { margin: 0; }
.widget-copy-row .form-status[data-tone="ok"] { color: var(--primary); }
.widget-preview { display: grid; gap: 8px; margin-top: 8px; }
.widget-preview small { color: var(--muted-foreground); font-size: 12px; }
.widget-preview-frame { overflow: hidden; margin-inline: auto; border: 1px solid var(--border); border-radius: var(--radius-medium); background: #fff; box-shadow: 0 1px 2px color-mix(in srgb, var(--forest-deep) 6%, transparent), 0 14px 32px -16px color-mix(in srgb, var(--forest-deep) 28%, transparent); transition: width 220ms var(--ease-out), border-radius 220ms var(--ease-out); }
.widget-preview-frame iframe { display: block; width: 100%; height: 620px; border: 0; }
.widget-preview-frame[data-view="desktop"] { width: 100%; }
.widget-preview-frame[data-view="mobile"] { width: 375px; max-width: 100%; border-radius: 28px; }
@media (max-width: 860px) { .widget-generator-head { flex-wrap: wrap; } }
@media (prefers-reduced-motion: reduce) { .widget-preview-frame, .form-field-body, .booking-form .form-switch input::after { transition: none; } }

/* Einstellungen → CRM: Schalter, Zuordnung als Zeilen wie die Formularfelder, Vorschau auf Papier, Übertragungen wie das Mail-Protokoll. */
.crm-settings[hidden], #crm-mapping-section[hidden], #crm-log-section[hidden], .crm-link-field[hidden], #crm-save[hidden] { display: none; }
.crm-setup-note { margin: 0 0 16px; border: 1px solid color-mix(in srgb, var(--ochre) 45%, var(--border)); border-radius: var(--radius-medium); padding: 12px 14px; background: color-mix(in srgb, var(--sand) 38%, var(--card)); color: var(--foreground); font-size: 13px; line-height: 1.55; }
.crm-setup-note strong { font-weight: 650; }
.settings-section-body > .crm-switch, .crm-switch { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; color: var(--foreground); font-size: 14px; font-weight: 600; cursor: pointer; }
.settings-section-body .crm-switch input { appearance: none; position: relative; flex: none; width: 36px; min-width: 36px; height: 22px; min-height: 0; margin: 0; border: 0; border-radius: var(--radius-pill); padding: 0; background: var(--muted); cursor: pointer; transition: background-color 160ms ease; }
.crm-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px color-mix(in srgb, var(--forest-deep) 24%, transparent); transition: transform 180ms var(--ease-out); }
.crm-switch input:checked { background: var(--primary); }
.crm-switch input:checked::after { transform: translateX(14px); }
.crm-switch input:disabled { opacity: .55; cursor: default; }
.crm-switch:has(input:disabled) { color: var(--muted-foreground); cursor: default; }
.crm-switch input:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.crm-map-head { display: grid; grid-template-columns: minmax(0, 1fr) 16px minmax(0, 250px); gap: 12px; padding: 0 0 8px; color: var(--muted-foreground); font-size: 12px; font-weight: 650; }
.crm-map-head span:last-child { grid-column: 3; }
.crm-map { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.crm-map-group { padding: 18px 0 6px; color: var(--muted-foreground); font-size: 12px; font-weight: 650; }
.crm-map-row { display: grid; grid-template-columns: minmax(0, 1fr) 16px minmax(0, 250px); align-items: center; gap: 12px; min-height: 54px; border-bottom: 1px solid var(--border); padding: 6px 0; }
.crm-source { min-width: 0; overflow-wrap: anywhere; color: var(--foreground); font-size: 14px; }
.crm-arrow { width: 16px; height: 16px; fill: none; stroke: var(--muted-foreground); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.crm-target { width: 100%; min-height: 40px; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 34px 0 12px; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%234b6054' stroke-width='1.5'/%3E%3C/svg%3E") right 12px center / 14px no-repeat; color: var(--muted-foreground); font: inherit; font-size: 14px; appearance: none; transition: border-color 150ms ease, color 150ms ease; }
.crm-target[data-mapped="true"] { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); color: var(--foreground); font-weight: 600; }
.crm-target:hover:not(:disabled) { border-color: var(--muted-foreground); }
.crm-target:disabled { background-color: var(--muted); opacity: .8; }
.crm-target:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.crm-preview { margin-top: 28px; }
.crm-preview-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 10px; }
.crm-preview-head h4 { margin: 0; color: var(--foreground); font-size: 14px; font-weight: 650; }
.crm-preview-head .form-status { font-size: 12px; }
.crm-preview-head .form-status[data-tone="error"] { color: var(--danger); }
.crm-preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.crm-preview-card { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-medium); padding: 14px 16px; background: var(--background); }
.crm-preview-activity { grid-column: 1 / -1; }
.crm-preview-card h5 { margin: 0 0 10px; color: var(--foreground); font-size: 13px; font-weight: 650; }
.crm-preview-list { display: grid; gap: 8px; margin: 0; }
.crm-preview-list div { display: grid; gap: 1px; min-width: 0; }
.crm-preview-list dt { color: var(--muted-foreground); font-size: 12px; }
.crm-preview-list dd { margin: 0; overflow-wrap: anywhere; color: var(--foreground); font-size: 14px; font-variant-numeric: tabular-nums; }
.crm-preview-activity .crm-preview-list { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.crm-preview-empty { margin: 0; color: var(--muted-foreground); font-size: 13px; line-height: 1.5; }
.crm-preview-text { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.crm-preview-text span { color: var(--muted-foreground); font-size: 12px; }
.crm-preview-text p { margin: 2px 0 0; color: var(--foreground); font-size: 13px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.crm-log-table td small { max-width: 30ch; }
.crm-log-link, .crm-link { color: var(--primary); font-weight: 650; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.crm-log-link:hover, .crm-link:hover { text-decoration-thickness: 2px; }
.crm-log-link:focus-visible, .crm-link:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
@media (max-width: 860px) {
  .crm-map-head { display: none; }
  .crm-map-row { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 10px 0; }
  .crm-map-row .crm-arrow { display: none; }
  .crm-preview-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .crm-target, .crm-switch input, .crm-switch input::after { transition: none; } }

/* Tagesansicht: Sperren aus verbundenen Kalendern schraffiert und gedämpft, ohne Klick und ohne Fokus. */
.booking-flag { display: inline-block; max-width: 100%; margin-top: 4px; border-radius: var(--radius-pill); padding: 1px 7px; background: var(--warning-surface); color: var(--foreground); font-size: 11px; font-weight: 600; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Oben rechts auf der Karte, damit der Hinweis auch bei kurzen Terminen sichtbar bleibt. */
.booking-flag[data-tone="error"] { background: var(--danger-surface); color: var(--danger); }
.booking-flag[data-tone="muted"] { background: transparent; padding: 0; color: var(--muted-foreground); font-weight: 500; }
#booking-calendar-note { color: var(--foreground); font-size: 13px; font-weight: 600; }
#booking-calendar-note[data-tone="error"] { color: var(--danger); }
#booking-calendar-note[data-tone="muted"] { color: var(--muted-foreground); font-weight: 500; }
