/* Terminportal UI – fachliche Bausteine einzelner Bereiche (Dashboard, Kalender, Kunden,
   Buchung, Kauf, Einrichtungsassistent). Allgemeine Bausteine stehen in components.css. */

@layer components {

  /* ================= Dashboard: Übersicht ================= */
  .card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-4); }
  .card-title h2, .card-title h3 { margin: 0; font-size: var(--fs-lg); }
  .card-title > a { flex: none; font-size: var(--fs-md); font-weight: 500; }
  .card-title .btn, .card-title button { flex: none; }

  .timeline { display: grid; margin-top: var(--sp-2); }
  .timeline article { display: grid; grid-template-columns: 56px 4px minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-2);
    border-top: 1px solid var(--border); border-radius: 0; }
  .timeline article:first-child { border-top: 0; }
  .timeline time { color: var(--text); font-size: var(--fs-md); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .timeline time span { display: block; color: var(--text-muted); font-size: var(--fs-xs); font-weight: 500; }
  .timeline i { width: 4px; height: 36px; border-radius: 2px; background: var(--primary); }
  .timeline i.apricot { background: var(--warning); }
  .timeline i.green { background: var(--success); }
  .timeline i.danger { background: var(--danger); }
  .timeline b { display: block; overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
  .timeline span { display: block; color: var(--text-muted); font-size: var(--fs-sm); }
  .timeline em { display: flex; align-items: center; gap: var(--sp-3); color: var(--text-muted); font-size: var(--fs-sm); font-style: normal; white-space: nowrap; }
  .timeline article.current { background: var(--primary-soft); border-radius: var(--r-md); border-top-color: transparent; }
  .timeline article.current + article { border-top-color: transparent; }
  .timeline.with-date article { grid-template-columns: 84px 4px minmax(0, 1fr) auto; }
  .timeline article.is-cancelled-row, .timeline article.is-cancelled { opacity: .6; }
  .timeline article.is-cancelled-row b { text-decoration: line-through; }
  .today-card > p:last-child:not(:first-child) { margin-top: var(--sp-4); }
  @media (max-width: 640px) {
    .timeline article, .timeline.with-date article { grid-template-columns: 52px 4px minmax(0, 1fr); }
    .timeline em { grid-column: 3; white-space: normal; flex-wrap: wrap; }
  }

  .availability-card { text-align: left; }
  .ring { --pct: var(--p, 0%); display: grid; width: 132px; height: 132px; margin: var(--sp-4) auto var(--sp-5); place-content: center; border-radius: 50%; text-align: center;
    background: radial-gradient(closest-side, var(--surface) 82%, transparent 83% 100%), conic-gradient(var(--primary) var(--pct), var(--surface-sunken) 0); }
  .ring strong { display: block; font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -.02em; }
  .ring small { display: block; color: var(--text-muted); font-size: var(--fs-xs); }
  .stat-row { display: grid; gap: var(--sp-2); }
  .stat-row span { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--sp-2); color: var(--text-muted); font-size: var(--fs-md); }
  .stat-row i { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
  .stat-row .soft-dot { background: var(--surface-sunken); outline: 1px solid var(--border-strong); outline-offset: -1px; }
  .stat-row b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

  .week-chart { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-3); height: 180px; margin-top: var(--sp-4); }
  .week-chart .day { display: grid; grid-template-rows: auto 1fr auto; gap: var(--sp-2); text-align: center; }
  .week-chart .day b { color: var(--text-muted); font-size: var(--fs-xs); font-weight: 500; }
  .week-chart .day.active b { color: var(--primary-text); font-weight: 600; }
  .week-chart .day > span { position: relative; display: flex; align-items: flex-end; overflow: hidden; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); }
  .week-chart .day > span i { display: block; width: 100%; height: max(4px, var(--p, 0%)); border-radius: var(--r-sm) var(--r-sm) 0 0; background: var(--accent-6); }
  .week-chart .day.active > span i { background: var(--primary); }
  .week-chart .day small { color: var(--text-muted); font-size: var(--fs-xs); }
  .week-controls { display: flex; gap: var(--sp-1); }

  .quick-card p { margin: var(--sp-3) 0; }
  .quick-card > div:last-of-type { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
  .quick-card small { display: block; min-height: 18px; margin-top: var(--sp-2); color: var(--success-text); }
  .live-dot { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border: 1px solid var(--success-border); border-radius: var(--r-full);
    background: var(--success-bg); color: var(--success-text); font-size: var(--fs-xs); font-weight: 500; }
  .live-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

  .connection-list { display: grid; margin: var(--sp-3) 0; }
  .connection-list > div { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; border-top: 1px solid var(--border); }
  .connection-list i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
  .connection-list small { display: block; color: var(--text-muted); font-size: var(--fs-xs); }

  .setup-list { display: grid; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
  .setup-list li { display: flex; align-items: center; gap: var(--sp-3); margin: 0; padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md); }
  .setup-list li.done { background: var(--surface-2); color: var(--text-muted); }
  .setup-success-body { display: flex; align-items: flex-start; gap: var(--sp-3); }
  .setup-success-body p { margin: 0; }
  .setup-success-icon { display: grid; width: 32px; height: 32px; flex: none; place-items: center; border-radius: 50%; background: var(--success); color: #fff; }
  .setup-list .check-icon { display: grid; width: 22px; height: 22px; flex: none; place-items: center; border: 1.5px solid var(--border-strong); border-radius: 50%; }
  .setup-list li.done .check-icon { border-color: var(--success); background: var(--success); color: #fff; }
  .setup-list li.done .check-icon .i { width: 13px; height: 13px; }
  .setup-list .grow b { display: block; font-weight: 500; }
  .setup-list li.done .grow b { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }
  .setup-list .grow small { color: var(--text-muted); }

  /* ================= Termine: Kalender ================= */
  .cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
  .cal-toolbar h2 { flex: 1; margin: 0; font-size: var(--fs-lg); text-transform: capitalize; }
  .cal-nav { display: flex; gap: var(--sp-1); }
  .cal-nav a { display: inline-flex; align-items: center; justify-content: center; min-width: var(--control-h-sm); min-height: var(--control-h-sm); padding: 0 var(--sp-3);
    border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); color: var(--text); font-size: var(--fs-sm); font-weight: 500; text-decoration: none; box-shadow: var(--shadow-xs); }
  .cal-nav a:hover { background: var(--surface-hover); text-decoration: none; }
  .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--border); }
  .cal-head { padding: var(--sp-2); background: var(--surface-2); color: var(--text-muted); font-size: var(--fs-xs); font-weight: 600; text-align: center; text-transform: uppercase; letter-spacing: .04em; }
  .cal-cell { display: flex; min-height: 108px; flex-direction: column; gap: 3px; padding: 6px; background: var(--surface); }
  .cal-grid.woche .cal-cell { min-height: 280px; }
  .cal-cell.outside { background: var(--surface-2); color: var(--text-subtle); }
  .cal-cell.today .cal-day { display: inline-grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: var(--primary); color: var(--on-primary); }
  .cal-day { align-self: flex-start; color: inherit; font-size: var(--fs-sm); font-weight: 500; text-decoration: none; }
  .cal-wd { display: none; color: var(--text-muted); font-weight: 400; }
  .cal-grid.woche .cal-wd { display: inline; }
  .cal-item { display: block; overflow: hidden; padding: 2px 6px; border-radius: var(--r-sm); font-size: var(--fs-xs); line-height: 1.4; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
  .cal-item.termin { background: var(--primary-soft); color: var(--primary-text); box-shadow: inset 2px 0 0 var(--primary); }
  .cal-item.extern { background: var(--surface-sunken); color: var(--text-muted); box-shadow: inset 2px 0 0 var(--gray-8); }
  .cal-item:hover { text-decoration: none; filter: brightness(.97); }
  .cal-item.is-cancelled { text-decoration: line-through; opacity: .6; }
  .cal-grid.woche .cal-item { white-space: normal; }
  .cal-more { color: var(--primary-text); font-size: var(--fs-xs); font-weight: 500; }
  .cal-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-3); }
  .cal-card { padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: var(--r-md); background: var(--surface); }
  .cal-card.extern { border-left-color: var(--gray-8); }
  .cal-card h3 { margin: 0 0 var(--sp-2); font-size: var(--fs-base); }
  .cal-card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--sp-3); margin: 0; font-size: var(--fs-md); }
  .cal-card dt { color: var(--text-muted); }
  .cal-card dd { margin: 0; }
  .cal-legend { margin-top: var(--sp-3); color: var(--text-muted); font-size: var(--fs-sm); }
  .cal-legend i { display: inline-block; width: 10px; height: 10px; margin: 0 6px 0 var(--sp-4); border-radius: 3px; vertical-align: -1px; }
  .cal-legend i:first-child { margin-left: 0; }
  .cal-legend i.termin { background: var(--primary); }
  .cal-legend i.extern { background: var(--gray-8); }
  @media (max-width: 700px) {
    .cal-cell { min-height: 64px; padding: 4px; }
    .cal-item { font-size: 10px; padding: 1px 4px; }
    .cal-grid.woche { grid-template-columns: 1fr; }
    .cal-grid.woche .cal-head { display: none; }
    .cal-grid.woche .cal-cell { min-height: 0; }
  }

  /* ================= Verfügbarkeit & Abwesenheit ================= */
  .vf-tag { display: grid; grid-template-columns: 160px 1fr; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
  .vf-schalter { display: flex; align-items: center; gap: var(--sp-2); cursor: pointer; font-size: var(--fs-md); }
  .vf-felder { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }
  .vf-fenster { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: var(--fs-sm); }
  .vf-fenster input { min-height: var(--control-h-sm); padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); color: var(--text); }
  .vf-tag:has(.vf-schalter input:not(:checked)) .vf-felder::before { content: "nicht buchbar"; color: var(--text-subtle); font-size: var(--fs-sm); }
  .vf-tag:has(.vf-schalter input:not(:checked)) .vf-fenster { display: none; }
  .vf-schalter input { width: 18px; height: 18px; accent-color: var(--primary); }
  @media (max-width: 640px) { .vf-tag { grid-template-columns: 1fr; } }
  .abw-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 var(--sp-4); align-items: end; }
  .abw-form .wide { grid-column: 1 / -1; }
  .abw-liste { margin: var(--sp-5) 0 0; padding: 0; list-style: none; }
  .abw-zeile { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin: 0; padding: var(--sp-3) 0; border-top: 1px solid var(--border); }
  .abw-zeile b { display: block; font-weight: 500; }
  .abw-zeile span { color: var(--text-muted); font-size: var(--fs-sm); }
  .abw-zeile .abw-jetzt { margin-left: 6px; padding: 1px 8px; border-radius: var(--r-full); background: var(--warning-bg); color: var(--warning-text); font-size: var(--fs-xs); font-weight: 500; }
  .abw-zeile form { margin: 0; }

  /* ================= Kunden, Journal, Dokumente ================= */
  .two-col { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: var(--sp-8); margin-top: var(--sp-2); }
  @media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } }
  .customer-head { display: flex; align-items: center; gap: var(--sp-4); margin: var(--sp-3) 0 var(--sp-2); }
  .customer-head h3 { margin: 0; font-size: var(--fs-lg); }
  .customer-head h3 a { color: inherit; }
  .customer-head p { margin: 2px 0 0; }
  .callout { margin: var(--sp-3) 0; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
  .callout p { margin: 4px 0 0; }
  .callout-empty { border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning-text); }
  .journal { display: grid; gap: var(--sp-3); }
  .entry { padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: var(--r-md); background: var(--surface); animation: tp-in .2s ease-out; }
  .entry-briefing { border-left-color: var(--warning); }
  .entry-debriefing { border-left-color: var(--success); }
  .entry-zusammenfassung { border-left-color: var(--ai); background: var(--ai-bg); }
  .entry header { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-bottom: 6px; }
  .entry header time { color: var(--text-muted); font-size: var(--fs-sm); }
  .entry-link { font-size: var(--fs-sm); }
  .entry p { margin: 4px 0; line-height: 1.55; overflow-wrap: anywhere; }
  .entry-next { padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); background: var(--surface-2); }
  .entry-del { margin-left: auto; }
  .entry-del button { padding: 2px 6px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-subtle); }
  .entry-del button:hover { background: var(--danger-bg); color: var(--danger-text); }
  .entry-original { margin: 6px 0 0; }
  .entry-original a { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--ai-border); border-radius: var(--r-sm); color: var(--ai-text); font-size: var(--fs-sm); }
  .entry-form textarea, .upload-form input[type=file] { width: 100%; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); color: var(--text); }
  .entry-form textarea { min-height: 90px; resize: vertical; }
  .entry-form textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
  .upload-form { margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px dashed var(--border-strong); }
  .doc { margin-bottom: var(--sp-2); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); animation: tp-in .2s ease-out; }
  .doc header { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
  .doc header a { color: inherit; font-weight: 500; }
  .doc-summary { margin-top: var(--sp-2); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--ai-border); border-radius: var(--r-md); background: var(--ai-bg); }
  .doc-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
  .doc-actions form { margin: 0; }
  .customer-list { display: grid; gap: var(--sp-2); margin-top: var(--sp-2); }
  .customer-row { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: inherit; text-decoration: none; }
  .customer-row:hover { border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; }
  .customer-main { display: grid; flex: 1; min-width: 0; gap: 1px; }
  .customer-main b { font-weight: 500; }
  .customer-main span { overflow: hidden; color: var(--text-muted); font-size: var(--fs-sm); text-overflow: ellipsis; white-space: nowrap; }
  .customer-meta { display: flex; gap: var(--sp-5); }
  .customer-meta span { display: grid; min-width: 52px; text-align: center; }
  .customer-meta small { color: var(--text-muted); font-size: var(--fs-xs); }
  .customer-meta b { font-weight: 600; font-variant-numeric: tabular-nums; }
  @media (max-width: 760px) { .customer-row { flex-wrap: wrap; } .customer-meta { width: 100%; justify-content: space-between; } }
  .appt-list { display: grid; gap: var(--sp-2); }
  .appt-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-md);
    background: var(--surface); color: inherit; text-decoration: none; }
  .appt-row:hover { border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; }
  .appt-row time { font-size: var(--fs-md); font-weight: 600; white-space: nowrap; }
  .appt-row time span { display: block; color: var(--text-muted); font-size: var(--fs-xs); font-weight: 500; }
  .appt-row div b { display: block; font-weight: 500; }
  .appt-row div span { color: var(--text-muted); font-size: var(--fs-sm); }
  .appt-row em { color: var(--primary-text); font-size: var(--fs-sm); font-style: normal; font-weight: 500; }
  .card.attention { box-shadow: 0 0 0 2px var(--warning); }
  .note-entry { padding: var(--sp-2) 0; border-top: 1px solid var(--border); }
  .edit-details { margin-top: var(--sp-3); }
  .edit-details summary { color: var(--primary-text); font-size: var(--fs-md); font-weight: 500; }
  .edit-details[open] summary { margin-bottom: var(--sp-3); }
  .search-form { display: flex; gap: var(--sp-2); margin: var(--sp-3) 0; }
  .search-form input { flex: 1; min-height: var(--control-h); padding: 0 var(--sp-3); border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); color: var(--text); }
  .search-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
  .pager { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-4); color: var(--text-muted); font-size: var(--fs-md); }
  .is-cancelled { opacity: .6; }
  .is-cancelled b { text-decoration: line-through; }

  /* Online-Raum (Berater und Kunde) */
  .room { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--sp-4); align-items: start; }
  .room-video { height: calc(100vh - 230px); min-height: 420px; overflow: hidden; border-radius: var(--r-lg); background: #0b0b0d; }
  .room-video iframe { border: 0; }
  .room-side { max-height: calc(100vh - 230px); overflow: auto; }
  .room-side h2 { margin: 0 0 var(--sp-2); font-size: var(--fs-base); }
  .room-side ul { margin: 0; padding: 0; list-style: none; }
  .room-side li { padding: var(--sp-2) 0; border-top: 1px solid var(--border); }
  .room-pane[hidden] { display: none; }
  .room-offline { padding: var(--sp-6); color: #fff; }
  .customer-row.is-unread b { font-weight: 700; }
  .customer-row.is-unread::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--primary); }
  @media (max-width: 1100px) { .room { grid-template-columns: 1fr; } .room-video { height: 60vh; } .room-side { max-height: none; } }

  /* ================= Superuser: Abrechnung ================= */
  .kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--sp-3); margin: 0 0 var(--sp-5); }
  .kpi { display: grid; gap: 2px; padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); color: inherit; text-decoration: none; box-shadow: var(--shadow-xs); }
  a.kpi:hover { border-color: var(--border-strong); text-decoration: none; }
  .kpi small { color: var(--text-muted); font-size: var(--fs-sm); font-weight: 500; }
  .kpi b { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
  .kpi span { color: var(--text-muted); font-size: var(--fs-sm); }
  .inv-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-3); }
  .lines-table input { width: 100%; }
  .lines-table td { padding: 4px 6px; }
  .todo { display: grid; gap: 6px; margin: 0; padding-left: 20px; }
  .admin-main > h2 { margin: var(--sp-8) 0 var(--sp-3); font-size: var(--fs-lg); }
  .admin-main > h2:first-child { margin-top: 0; }
  .admin-main > .card + h2 { margin-top: var(--sp-8); }

  /* ================= Öffentliche Buchung ================= */
  .service-list { display: grid; gap: var(--sp-3); }
  .service-list .card { margin: 0; }
  a.service-option { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px var(--sp-5); padding: var(--sp-5) var(--sp-6); }
  a.service-option:hover { border-color: var(--primary-soft-border); box-shadow: 0 0 0 3px var(--primary-soft); }
  .service-option .card-title { margin: 0; font-size: var(--fs-lg); font-weight: 600; }
  .service-option p { grid-column: 1; margin: 0; color: var(--text-muted); font-size: var(--fs-md); }
  .service-option .meta { display: flex; flex-wrap: wrap; grid-column: 1; gap: var(--sp-2); margin-top: var(--sp-1); }
  .service-option .choose { display: inline-flex; grid-column: 2; grid-row: 1 / span 3; align-items: center; gap: 6px; color: var(--primary-text); font-size: var(--fs-md); font-weight: 500; }
  .service-option .choose::after { content: "→"; transition: transform .15s var(--ease); }
  a.service-option:hover .choose::after { transform: translateX(3px); }
  @media (max-width: 560px) { a.service-option { grid-template-columns: 1fr; padding: var(--sp-4); } .service-option .choose { grid-column: 1; grid-row: auto; } }
  .meta-chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 var(--sp-2); border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); color: var(--text-muted); font-size: var(--fs-sm); font-weight: 500; }
  .summary-line { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0 0 var(--sp-5); }
  .day-group { margin-bottom: var(--sp-5); }
  .day-group h2 { margin: 0 0 var(--sp-2); font-size: var(--fs-md); }
  .slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--sp-2); }
  .slot-grid a { display: flex; min-height: 44px; align-items: center; justify-content: center; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface);
    color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; text-decoration: none; transition: border-color .12s, background .12s, color .12s; }
  .slot-grid a:hover, .slot-grid a:focus-visible { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); text-decoration: none; }
  .day-nav { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
  .day-nav a { padding: 4px var(--sp-3); border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); color: var(--text); font-size: var(--fs-sm); text-decoration: none; }
  .back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: var(--sp-4); color: var(--text-muted) !important; font-size: var(--fs-md); font-weight: 500; text-decoration: none; }
  .back-link:hover { color: var(--text) !important; text-decoration: none; }
  .success-mark, .status-icon { display: grid; width: 48px; height: 48px; margin-bottom: var(--sp-4); place-items: center; border-radius: var(--r-lg); background: var(--success-bg); color: var(--success-text); font-size: 1.4rem; font-weight: 700; }
  .status-icon { background: var(--primary-soft); color: var(--primary-text); }
  .status-icon-error { background: var(--danger-bg); color: var(--danger-text); }

  .slot-picker .picker-month { margin: 0 0 var(--sp-2); color: var(--text-muted); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
  .day-strip { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); padding: 2px 2px var(--sp-2); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; }
  .day-tile { display: flex; min-width: 60px; flex: 0 0 auto; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: var(--sp-2) 6px;
    border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); color: var(--text-muted); font-size: var(--fs-xs); text-decoration: none; scroll-snap-align: start; }
  .day-tile b { color: var(--text); font-size: var(--fs-xl); font-weight: 600; line-height: 1.15; }
  .day-tile:hover { border-color: var(--primary); text-decoration: none; }
  .day-tile.is-active { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
  .day-tile.is-active b { color: var(--on-primary); }
  .slot-picker .day-group h2 { color: var(--text-muted); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
  .slot-picker .slot-grid { grid-template-columns: repeat(2, 1fr); }
  .slot-picker .slot-grid a { min-height: 48px; font-size: var(--fs-base); }
  .slot-picker .slot-grid a.is-selected { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
  .slot-picker .only-js { display: none; }
  .slot-picker.js .only-js { display: inline; }
  .slot-picker.js .only-nojs { display: none; }
  .slot-picker.js .day-group { display: none; }
  .slot-picker.js .day-group.is-active { display: block; }
  .slot-picker:not(.js) .day-strip { display: none; }
  .slot-cta { display: flex; width: 100%; justify-content: center; margin-top: var(--sp-4); }
  .slot-cta[hidden] { display: none; }
  @media (min-width: 560px) { .slot-picker .slot-grid { grid-template-columns: repeat(4, 1fr); } }

  /* ================= Kauf, Tarife, Verträge ================= */
  .commerce-hero { max-width: 640px; margin: var(--sp-2) auto var(--sp-8); text-align: center; }
  .commerce-hero h1 { margin: var(--sp-2) 0 var(--sp-3); font-size: clamp(1.9rem, 5vw, 2.75rem); letter-spacing: -.03em; line-height: 1.1; }
  .commerce-hero > p:last-child, .commerce-lead { color: var(--text-muted); font-size: var(--fs-lg); }
  .pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-4); align-items: stretch; }
  .pricing-card { position: relative; display: flex; flex-direction: column; padding: var(--sp-6); border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-xs); }
  .pricing-card-featured { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow-md); }
  .pricing-card h2 { margin: var(--sp-3) 0 4px; font-size: var(--fs-xl); }
  .pricing-description { min-height: 3em; margin: 0; color: var(--text-muted); font-size: var(--fs-md); }
  .pricing-label, .pricing-badge { align-self: flex-start; padding: 2px 8px; border-radius: var(--r-full); background: var(--primary-soft); color: var(--primary-text); font-size: var(--fs-xs); font-weight: 600; }
  .pricing-badge { background: var(--primary); color: var(--on-primary); }
  .pricing-price { display: flex; align-items: baseline; gap: var(--sp-2); margin: var(--sp-5) 0 0; }
  .pricing-price strong { font-size: clamp(2rem, 5vw, 2.5rem); font-weight: 600; letter-spacing: -.035em; line-height: 1; }
  .pricing-price span, .pricing-tax { color: var(--text-muted); }
  .pricing-tax { margin: 6px 0 var(--sp-5); font-size: var(--fs-sm); }
  /* Aktionspreis: Normalpreis durchgestrichen davor, Hinweis zur Aktion darunter */
  .price-was { color: var(--text-muted); font-weight: 500; text-decoration: line-through; text-decoration-thickness: 1.5px; }
  .pricing-price .price-was { font-size: var(--fs-xl); }
  .aside-price .price-was { margin-right: var(--sp-2); font-size: var(--fs-lg); }
  .order-product > strong .price-was { display: block; font-size: var(--fs-md); text-align: right; }
  .promo-note { margin: 6px 0 0; color: var(--success-text); font-size: var(--fs-sm); font-weight: 600; }
  .feature-list { display: grid; gap: var(--sp-2); margin: 0 0 var(--sp-6); padding: 0; list-style: none; font-size: var(--fs-md); }
  .feature-list li { display: grid; grid-template-columns: 18px 1fr; gap: var(--sp-2); align-items: start; margin: 0; }
  .feature-list li span { color: var(--success-text); font-weight: 700; }
  .feature-list.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: var(--sp-4) 0; border-bottom: 1px solid var(--border); }
  .pricing-card .btn { margin-top: auto; }
  .commerce-card { padding: clamp(20px, 4vw, 36px); }
  .commerce-card h1 { margin: var(--sp-2) 0 var(--sp-2); font-size: clamp(1.6rem, 4vw, 2.1rem); letter-spacing: -.025em; }
  .commerce-form { margin-top: var(--sp-6); }
  .form-note { margin: var(--sp-4) 0 0; color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.5; }
  .checkout-layout, .payment-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(240px, .8fr); gap: var(--sp-5); align-items: start; }
  .checkout-layout > .card + .card, .payment-layout > .card + .card { margin-top: 0; }
  .order-aside { position: sticky; top: var(--sp-5); }
  .order-aside h2 { margin: var(--sp-3) 0 2px; }
  .aside-price { margin: var(--sp-4) 0 0; font-size: var(--fs-3xl); font-weight: 600; letter-spacing: -.03em; }
  .aside-price small { color: var(--text-muted); font-size: var(--fs-md); font-weight: 500; letter-spacing: 0; }
  .trust-list { display: grid; gap: var(--sp-2); margin: var(--sp-5) 0 0; padding: var(--sp-4) 0 0; border-top: 1px solid var(--border); color: var(--text-muted); font-size: var(--fs-md); list-style: none; }
  .order-product { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-5); margin-top: var(--sp-5); padding: var(--sp-5); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
  .order-product h2 { margin: var(--sp-2) 0 2px; }
  .order-product p { margin: 0; color: var(--text-muted); }
  .order-product > strong { font-size: var(--fs-xl); font-weight: 600; white-space: nowrap; }
  .price-breakdown { margin: var(--sp-5) 0; }
  .price-breakdown > div, .aside-details > div { display: flex; justify-content: space-between; gap: var(--sp-5); padding: var(--sp-2) 0; border-bottom: 1px solid var(--border); }
  .price-breakdown dt, .aside-details dt { color: var(--text-muted); }
  .price-breakdown dd, .aside-details dd { margin: 0; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
  .price-total { margin-top: 4px; border-bottom: 0 !important; font-size: var(--fs-lg); font-weight: 600; }
  .price-total dt { color: var(--text) !important; }
  .legal-acceptance { margin-top: var(--sp-6); padding-top: var(--sp-6); border-top: 1px solid var(--border); }
  .legal-acceptance h2 { margin: 0 0 var(--sp-4); }
  .legal-check { padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
  .aside-details { margin: var(--sp-4) 0; }
  .simulation-note { display: flex; align-items: center; gap: var(--sp-3); margin: 0 0 var(--sp-5); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--warning-border); border-radius: var(--r-md); background: var(--warning-bg); color: var(--warning-text); font-size: var(--fs-md); }
  .simulation-note span { padding: 2px 8px; border-radius: var(--r-full); background: var(--warning-text); color: var(--surface); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; }
  .card-number-wrap { position: relative; }
  .card-number-wrap input { padding-right: 64px !important; }
  .card-number-wrap span { position: absolute; top: 50%; right: 12px; color: var(--primary-text); font-size: var(--fs-xs); font-weight: 700; transform: translateY(-50%); }
  .payment-security, .payment-seal { margin: var(--sp-4) 0 0; color: var(--text-muted); font-size: var(--fs-sm); }
  .payment-seal { padding-top: var(--sp-4); border-top: 1px solid var(--border); line-height: 1.8; }
  .completion-card { max-width: 680px; margin-inline: auto; }
  .completion-steps { display: grid; gap: var(--sp-3); margin: var(--sp-6) 0; }
  .completion-steps > div { display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: var(--sp-3); }
  .completion-steps > div > span { display: grid; width: 36px; height: 36px; place-items: center; border-radius: var(--r-md); background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
  .completion-steps p, .completion-steps small { display: block; margin: 0; }
  .completion-steps small { color: var(--text-muted); }
  .legal-document section { margin-top: var(--sp-6); }
  .legal-document section h2 { margin-bottom: 6px; font-size: var(--fs-lg); }
  .legal-document section p, .legal-document section ul { color: var(--text-muted); }
  .legal-document section p { margin: 0; }
  .legal-document section p + p, .legal-document section ul + p { margin-top: var(--sp-2); }
  .legal-document section h3 { margin: var(--sp-4) 0 4px; }
  @media (max-width: 760px) {
    .checkout-layout, .payment-layout { grid-template-columns: 1fr; }
    .order-aside { position: static; order: -1; }
    .review-layout .order-aside, .payment-layout .order-aside { order: 0; }
    .feature-list.compact { grid-template-columns: 1fr; }
    .order-product { display: grid; }
  }

  /* ================= Hilfe, Voice, 2FA ================= */
  .help-item { margin: var(--sp-2) 0; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
  .help-item summary { font-weight: 500; }
  .help-item[open] summary { margin-bottom: var(--sp-2); }
  .voice-box { padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
  .totp-setup { display: grid; grid-template-columns: minmax(200px, 240px) 1fr; gap: var(--sp-8); align-items: start; }
  .totp-qr { padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-lg); background: #fff; }
  .totp-qr svg { width: 100%; height: auto; }
  @media (max-width: 640px) { .totp-setup { grid-template-columns: 1fr; } }

  /* ================= Einrichtungsassistent (Dialog über dem Dashboard) ================= */
  .tp-wiz-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: var(--sp-4); overflow: auto; background: var(--overlay); }
  .tp-wiz { display: flex; width: min(680px, 100%); max-height: calc(100vh - 32px); flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
  .tp-wiz-steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: var(--sp-5) var(--sp-6) 0; list-style: none; }
  .tp-wiz-steps li { flex: 1; min-width: 70px; margin: 0; padding-top: 6px; border-top: 3px solid var(--border); color: var(--text-subtle); font-size: var(--fs-xs); }
  .tp-wiz-steps li.done { border-color: var(--success); color: var(--success-text); }
  .tp-wiz-steps li.cur { border-color: var(--primary); color: var(--primary-text); font-weight: 600; }
  .tp-wiz-body { padding: var(--sp-5) var(--sp-6); overflow: auto; line-height: 1.55; }
  .tp-wiz-body h2 { margin: 0 0 var(--sp-3); font-size: var(--fs-xl); }
  .tp-wiz-why { margin: 0 0 var(--sp-3); padding: var(--sp-3); border: 1px solid var(--info-border); border-radius: var(--r-md); background: var(--info-bg); color: var(--info-text); }
  .tp-wiz-list { margin: var(--sp-2) 0 var(--sp-3); padding-left: 22px; }
  .tp-wiz-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 var(--sp-3); }
  .tp-wiz-tabs a { padding: 4px var(--sp-3); border: 1px solid var(--border-strong); border-radius: var(--r-full); color: inherit; font-size: var(--fs-sm); text-decoration: none; }
  .tp-wiz-tabs a.on { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
  .tp-wiz-form { display: grid; gap: var(--sp-3); margin-top: 6px; }
  .tp-wiz-field { display: grid; gap: 4px; font-size: var(--fs-md); font-weight: 500; }
  .tp-wiz-field small { color: var(--text-muted); font-weight: 400; }
  .tp-wiz-field input, .tp-wiz-field select { min-height: var(--control-h); padding: 6px var(--sp-3); border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); color: var(--text); font-weight: 400; }
  .tp-wiz-choice { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--border); }
  .tp-wiz-checks { margin: var(--sp-3) 0; padding: 0; list-style: none; }
  .tp-wiz-checks li { margin: var(--sp-2) 0; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md); }
  .tp-wiz-pill { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: var(--r-full); background: var(--surface-2); color: var(--text-muted); font-size: var(--fs-xs); font-weight: 500; }
  .tp-wiz-pill.tp-wiz-ok, .tp-wiz-result.tp-wiz-ok { background: var(--success-bg); color: var(--success-text); }
  .tp-wiz-pill.tp-wiz-err, .tp-wiz-result.tp-wiz-err { background: var(--danger-bg); color: var(--danger-text); }
  .tp-wiz-result { margin: var(--sp-2) 0; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); }
  .tp-wiz-note { color: var(--text-muted); font-size: var(--fs-md); }
  .tp-wiz-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-3) var(--sp-6); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }
  .tp-wiz-btn { display: inline-flex; align-items: center; min-height: var(--control-h); padding: 0 var(--sp-4); border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); color: var(--text); font-size: var(--fs-md); font-weight: 500; text-decoration: none; }
  .tp-wiz-btn:hover { background: var(--surface-hover); text-decoration: none; }
  .tp-wiz-primary { border-color: transparent; background: var(--primary); color: var(--on-primary); }
  .tp-wiz-primary:hover { background: var(--primary-hover); }
  .tp-wiz-link { border: 0; background: none; color: var(--text-muted); font-size: var(--fs-md); text-decoration: underline; }
  @media (max-width: 520px) { .tp-wiz-body { padding: var(--sp-4); } .tp-wiz-foot { padding: var(--sp-3) var(--sp-4); } }

  /* CMS-Videos (Hilfe) */
  .cms-video { position: relative; overflow: hidden; margin: var(--sp-3) 0; border-radius: var(--r-lg); background: #0b0b0d; aspect-ratio: 16 / 9; }
  .cms-video iframe, .cms-video video { width: 100%; height: 100%; border: 0; }
  .cms-video-play { position: absolute; inset: 0; display: grid; place-items: center; border: 0; background: rgba(0,0,0,.35); color: #fff; font-size: var(--fs-md); }

  /* Online-Raum (Meet): Video links, Seitenleiste rechts; Höhe passt public/ui/room.js an das Fenster an */
  .room { display: grid; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; gap: var(--sp-4); }
  .room-guest { grid-template-columns: minmax(0, 1fr) 300px; }
  .room-video { height: calc(100vh - 210px); min-height: 420px; overflow: hidden; border-radius: var(--r-lg); background: #111113; }
  .room-guest .room-video { height: 72vh; min-height: 420px; }
  .room-video iframe { border: 0; }
  .room-offline { margin: 0; padding: var(--sp-6); color: #edeef0; }
  .room-side { max-height: calc(100vh - 210px); overflow: auto; }
  .room-side h2 { margin: 0 0 var(--sp-2); font-size: var(--fs-lg); }
  .room-guest .room-side ul { margin: 0; padding: 0; list-style: none; }
  .room-guest .room-side li { margin: 0; padding: var(--sp-2) 0; border-top: 1px solid var(--border); }
  .room-pane[hidden] { display: none; }
  .book-wrap:has(.room-guest) { width: min(1280px, calc(100% - 32px)); }
  @media (max-width: 1100px) { .room-host { grid-template-columns: minmax(0, 1fr); } .room-host .room-video { height: 60vh; } .room-host .room-side { max-height: none; } }
  @media (max-width: 860px) { .room-guest { grid-template-columns: minmax(0, 1fr); } .room-guest .room-video { height: 62vh; min-height: 320px; } }

  /* Übersicht (/dash): selbst anordnen – Blöcke im Raster der Seite, Werkzeuge nur im Bearbeitungsmodus (public/ui/overview.js) */
  .ov-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); grid-auto-flow: row dense; gap: var(--sp-5); align-items: start; }
  .ov-module { position: relative; min-width: 0; }
  .ov-module.full { grid-column: 1 / -1; }
  .ov-module[hidden] { display: none; }
  .ov-module > .card { margin: 0; height: 100%; }
  .ov-module > .stats { margin: 0; }
  .ov-tools { display: none; }
  .ov-grid.is-editing .ov-module { padding: var(--sp-2); border: 1.5px dashed var(--primary-soft-border); border-radius: calc(var(--r-lg) + 6px); background: var(--primary-soft); cursor: grab; }
  .ov-grid.is-editing .ov-tools { display: flex; align-items: center; gap: 2px; margin: 0 0 var(--sp-2); padding: 0 var(--sp-1); color: var(--primary-text); font-size: var(--fs-sm); }
  .ov-tools b { flex: 1; font-weight: 600; }
  .ov-grip { display: inline-grid; place-items: center; width: 24px; color: var(--primary-text); }
  .ov-grid.is-editing .ov-module > :not(.ov-tools) { pointer-events: none; user-select: none; }
  .ov-module.is-dragging { opacity: .45; }
  .ov-panel { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-5); padding: var(--sp-4) var(--sp-5); border: 1px solid var(--primary-soft-border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
  .ov-panel[hidden] { display: none; }
  .ov-panel-text { display: grid; flex: 1 1 320px; gap: 2px; }
  .ov-panel-text span { color: var(--text-muted); font-size: var(--fs-sm); }
  .ov-panel-text .i { width: 14px; height: 14px; vertical-align: -2px; }
  .ov-hidden { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
  .ov-panel .actions { margin: 0; }
  @media (max-width: 1100px) { .ov-grid { grid-template-columns: minmax(0, 1fr); } }

  /* Absagen kompakt in der schmalen Spalte */
  .cancel-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
  .cancel-list li { margin: 0; }
  .cancel-list a { display: grid; gap: 1px; padding: var(--sp-2); margin: 0 calc(-1 * var(--sp-2)); border-radius: var(--r-md); border-left: 2px solid var(--danger); color: var(--text); text-decoration: none; }
  .cancel-list a:hover { background: var(--surface-hover); }
  .cancel-list b { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
  .cancel-list span { overflow: hidden; color: var(--text-muted); font-size: var(--fs-sm); text-overflow: ellipsis; white-space: nowrap; }
}

/* Einladungs-Mail: einfacher Texteditor (public/ui/editor.js) */
.rte-toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.rte { min-height: 14rem; padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--text); line-height: 1.6; }
.rte:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.rte h2 { margin: 0 0 var(--sp-2); font-size: var(--fs-lg); }
